/*
 * 工厂 ERP B0 工作台样式。
 * 手写 CSS，无框架、无 @import、无外部字体或图片资源。
 * 关键约定：
 *  - :focus-visible 在所有可交互元素上都有可见焦点环。
 *  - 820px 以下侧边栏折叠为顶部导航条。
 *  - 授权菜单不使用 display:none 隐藏：未授权的菜单根本不会生成 DOM。
 */

:root {
  --bg: #f4f6fa;
  --surface: #ffffff;
  --surface-alt: #f8fafc;
  --border: #dfe4ec;
  --border-strong: #c3cbd9;
  --text: #1c2431;
  --text-muted: #5b6676;
  --brand: #1f5eff;
  --brand-dark: #1743c4;
  --danger: #c02626;
  --danger-bg: #fdecec;
  --warn: #9a6200;
  --warn-bg: #fff5e0;
  --ok: #1a6f42;
  --ok-bg: #e7f6ed;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(20, 30, 50, 0.06), 0 8px 24px rgba(20, 30, 50, 0.06);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.6;
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

/* 读屏专用：不显示但可朗读（aria-live 播报区、路由标题）。 */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- 焦点可见性：所有可交互元素 ---------- */

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 2px;
  border-radius: 4px;
}

.content:focus-visible {
  outline: 3px dashed var(--brand);
  outline-offset: 4px;
}

/* ---------- 登录页 ---------- */

.login-shell,
.boot-shell {
  display: flex;
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.boot-shell {
  flex-direction: column;
}

.login-shell {
  gap: 32px;
  flex-wrap: wrap;
}

.login-brand {
  max-width: 420px;
  padding: 32px;
  border-radius: 16px;
  background: linear-gradient(160deg, #1b2a4a, #24407a);
  color: #f2f6ff;
}

.brand-mark {
  display: inline-flex;
  width: 48px;
  height: 48px;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.16);
  font-size: 22px;
  font-weight: 700;
}

.brand-mark-sm {
  width: 36px;
  height: 36px;
  margin-bottom: 0;
  font-size: 17px;
  background: rgba(31, 94, 255, 0.14);
  color: var(--brand);
}

.brand-title {
  font-size: 22px;
  margin-bottom: 8px;
}

.brand-text {
  color: #cfdcf7;
  font-size: 14px;
}

.eyebrow {
  color: var(--text-muted);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.login-panel {
  width: 100%;
  max-width: 400px;
}

.login-card {
  padding: 28px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.login-title {
  margin: 6px 0 4px;
  font-size: 22px;
}

.login-subtitle,
.login-note {
  color: var(--text-muted);
  font-size: 13px;
}

.login-note {
  margin-top: 14px;
  font-size: 12px;
}

/* ---------- 布局 ---------- */

.layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  display: flex;
  width: 232px;
  flex: 0 0 232px;
  flex-direction: column;
  gap: 18px;
  padding: 20px 16px;
  border-right: 1px solid var(--border);
  background: var(--surface);
}

.sidebar-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-title {
  font-size: 16px;
  font-weight: 700;
}

.sidebar-subtitle {
  color: var(--text-muted);
  font-size: 12px;
}

.nav {
  flex: 1 1 auto;
  overflow-y: auto;
}

.nav-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-link {
  display: block;
  padding: 9px 12px;
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
  text-decoration: none;
}

.nav-link:hover {
  background: var(--surface-alt);
}

.nav-link.is-active {
  background: rgba(31, 94, 255, 0.1);
  color: var(--brand-dark);
  font-weight: 600;
}

.nav-empty {
  padding: 8px 12px;
  color: var(--text-muted);
  font-size: 13px;
}

/* 主数据下的子功能入口：缩进一级，权限不足时不渲染 */
.nav-sublist {
  margin: 2px 0 4px;
  padding: 0 0 0 10px;
  list-style: none;
  border-left: 1px solid var(--border);
}

.nav-sublink {
  display: block;
  padding: 6px 12px;
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 13px;
  text-decoration: none;
}

.nav-sublink:hover {
  background: var(--surface-alt);
  color: var(--text);
}

@media (max-width: 480px) {
  .nav-sublink {
    padding: 8px 12px;
    font-size: 14px;
  }
}

.sidebar-foot {
  border-top: 1px solid var(--border);
  padding-top: 14px;
}

.sidebar-user {
  font-weight: 600;
}

.sidebar-roles {
  color: var(--text-muted);
  font-size: 12px;
  margin-bottom: 10px;
  word-break: break-word;
}

.main-column {
  display: flex;
  min-width: 0;
  flex: 1 1 auto;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-wrap: wrap;
}

.topbar-title {
  font-size: 16px;
  font-weight: 700;
}

.topbar-meta {
  color: var(--text-muted);
  font-size: 12px;
}

.content {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.content:focus {
  outline: none;
}

/* ---------- 视图标题与面板 ---------- */

.view-head {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.view-title {
  font-size: 20px;
}

.view-subtitle {
  color: var(--text-muted);
  font-size: 14px;
}

.panel {
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.panel-title {
  margin-bottom: 14px;
  font-size: 15px;
}

.muted {
  color: var(--text-muted);
}

/* ---------- 状态块：加载 / 空 / 错误 / 403 ---------- */

.state {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  padding: 22px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface-alt);
}

.state-title {
  font-size: 15px;
  font-weight: 700;
}

.state-title-403 {
  color: var(--danger);
}

.state-403 {
  border-color: #f0b6b6;
  border-style: solid;
  background: var(--danger-bg);
}

.state-error {
  border-color: #f0b6b6;
  border-style: solid;
  background: var(--danger-bg);
}

.state-text {
  color: var(--text-muted);
  font-size: 14px;
}

.state-403 .state-text {
  color: #8d2323;
}

.skeleton {
  border-radius: 6px;
  background: linear-gradient(90deg, #e8ecf3 25%, #f3f6fa 37%, #e8ecf3 63%);
  background-size: 400% 100%;
  animation: skeleton-sweep 1.3s ease-in-out infinite;
}

.skeleton-line {
  width: 60%;
  height: 14px;
}

.skeleton-block {
  width: 100%;
  height: 96px;
}

@keyframes skeleton-sweep {
  0% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0 50%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .skeleton {
    animation: none;
  }
}

/* ---------- 卡片 ---------- */

.card-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}

.card {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-alt);
}

.card-label {
  color: var(--text-muted);
  font-size: 13px;
}

.card-value {
  font-size: 24px;
  font-weight: 700;
}

.card-error,
.card-muted {
  border-color: var(--border-strong);
}

/* ---------- 表格 ---------- */

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.table th,
.table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.table th {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  text-transform: none;
  white-space: nowrap;
}

.table tbody tr:hover {
  background: var(--surface-alt);
}

.table-clickable tbody tr {
  cursor: pointer;
}

.table-caption {
  margin-bottom: 10px;
  color: var(--text-muted);
  font-size: 13px;
}

.cell-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-start;
}

.cell-note {
  width: 100%;
  color: var(--text-muted);
  font-size: 12px;
}

.row-expanded td {
  background: var(--surface-alt);
}

/* ---------- 徽章 ---------- */

.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-draft {
  background: #eef1f6;
  color: #445063;
}

.badge-effective {
  background: var(--ok-bg);
  color: var(--ok);
}

.badge-pending {
  background: var(--warn-bg);
  color: var(--warn);
}

.badge-void,
.badge-reversed,
.badge-neutral {
  background: #eef1f6;
  color: #445063;
}

/* ---------- 表单 ---------- */

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field label {
  font-size: 13px;
  font-weight: 600;
}

.field-hint {
  color: var(--text-muted);
  font-size: 12px;
}

.input {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

.textarea {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  resize: vertical;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  grid-column: 1 / -1;
}

.form-error {
  grid-column: 1 / -1;
  min-height: 20px;
  color: var(--danger);
  font-size: 13px;
}

.form-error:empty {
  min-height: 0;
}

.inline-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.inline-form-inline .field {
  min-width: 180px;
}

/* ---------- 按钮 ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 15px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.btn:hover:not(:disabled) {
  background: var(--surface-alt);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-primary {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--brand-dark);
}

.btn-secondary {
  background: var(--surface);
}

.btn-ghost {
  border-color: transparent;
  background: transparent;
  color: var(--brand-dark);
}

.btn-block {
  width: 100%;
}

.btn-small {
  padding: 6px 11px;
  font-size: 13px;
}

/* ---------- 审批标签页 ---------- */

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 10px;
}

.tab {
  padding: 7px 13px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.tab.is-active {
  border-color: var(--brand);
  background: rgba(31, 94, 255, 0.1);
  color: var(--brand-dark);
}

/* ---------- 操作日志详情（只读对照） ---------- */

.log-detail:empty {
  display: none;
}

.log-detail {
  margin-top: 14px;
}

.log-detail-inner {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-alt);
}

.log-detail-head {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.log-compare {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}

.log-side {
  min-width: 0;
}

.log-side-title {
  margin-bottom: 6px;
  color: var(--text-muted);
  font-size: 13px;
}

.log-json {
  max-height: 320px;
  margin: 0;
  padding: 12px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #10182a;
  color: #dce6ff;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ---------- 窄屏：侧边栏折叠为顶部导航条 ---------- */

@media (max-width: 820px) {
  .layout {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    flex: 0 0 auto;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    border-right: 0;
    border-bottom: 1px solid var(--border);
    padding: 12px 16px;
  }

  .sidebar-head {
    flex: 0 0 auto;
  }

  .nav {
    flex: 1 1 100%;
    overflow-x: auto;
  }

  .nav-list {
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 6px;
    padding-bottom: 4px;
  }

  .nav-link {
    border: 1px solid var(--border);
    white-space: nowrap;
  }

  .nav-link.is-active {
    border-color: var(--brand);
  }

  .sidebar-foot {
    display: flex;
    width: 100%;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    border-top: 0;
    padding-top: 0;
  }

  .sidebar-roles {
    margin-bottom: 0;
  }

  .sidebar-foot .btn {
    width: auto;
    margin-left: auto;
  }

  .topbar,
  .content {
    padding: 14px 16px;
  }

  .login-shell {
    padding: 16px;
  }

  .login-brand {
    padding: 24px;
  }
}

@media (max-width: 480px) {
  .form-grid {
    grid-template-columns: 1fr;
  }
}

/* ------------------------------------------------------------------ *
 * B1 主数据 - 规格类型
 * 桌面端 1440×900 与手机端 360×800 均可用；无外部资源。
 * ------------------------------------------------------------------ */

.spec-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.spec-title { margin: 0 0 4px; font-size: 20px; }
.spec-hint { margin: 0; color: #6b7280; font-size: 13px; }

.spec-card {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 12px;
  background: #fff;
}

.spec-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.spec-card-title { margin: 0; font-size: 16px; }
.spec-card-meta { margin: 4px 0 0; font-size: 12px; color: #6b7280; }
.spec-pattern { margin: 8px 0 0; font-size: 13px; color: #374151; word-break: break-all; }

.spec-fields { width: 100%; border-collapse: collapse; margin-top: 12px; font-size: 13px; }
.spec-fields th,
.spec-fields td { border-bottom: 1px solid #f1f5f9; padding: 6px 8px; text-align: left; }
.spec-fields th { color: #6b7280; font-weight: 600; }
.spec-empty-row { color: #9ca3af; text-align: center; }

.spec-card-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }

.badge { padding: 2px 8px; border-radius: 999px; font-size: 12px; }
.badge-ok { background: #dcfce7; color: #166534; }
.badge-muted { background: #f3f4f6; color: #4b5563; }

.btn-mini { padding: 2px 8px; font-size: 12px; }

.spec-form {
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
  background: #f9fafb;
}

.spec-form-title { margin: 0 0 12px; font-size: 16px; }
.spec-form-subtitle { margin: 16px 0 8px; font-size: 14px; }
.spec-form-actions { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }

.spec-field-row {
  display: grid;
  grid-template-columns: 80px 1fr 80px 1fr 60px 1fr 60px 1fr 40px 1fr 150px;
  gap: 6px;
  align-items: center;
  margin-bottom: 8px;
}

.spec-field-cell { font-size: 13px; }
.spec-field-editor { margin-bottom: 8px; }

.form-errors:empty { display: none; }
.form-errors {
  border: 1px solid #fecaca;
  background: #fef2f2;
  color: #991b1b;
  border-radius: 6px;
  padding: 10px 12px;
  margin-bottom: 12px;
}
.form-errors-title { margin: 0 0 4px; font-weight: 600; font-size: 13px; }
.form-errors-item { margin: 0; font-size: 13px; word-break: break-all; }

/* 手机端 360×800：字段编辑区改为单列纵向排布，避免横向溢出。 */
@media (max-width: 720px) {
  .spec-head { flex-direction: column; align-items: stretch; }
  .spec-head .btn { width: 100%; }
  .spec-card-head { flex-direction: column; align-items: flex-start; }
  .spec-card-actions .btn { flex: 1 1 auto; }
  .spec-field-row { grid-template-columns: 1fr; gap: 4px; padding: 8px 0; border-bottom: 1px solid #e5e7eb; }
  .spec-field-cell { font-weight: 600; }
  .spec-fields thead { display: none; }
  .spec-fields tr { display: block; margin-bottom: 8px; }
  .spec-fields td { display: flex; justify-content: space-between; border: none; padding: 2px 0; }
  .spec-fields td::before { content: attr(data-label); color: #6b7280; }
}

/* ------------------------------------------------------------------ *
 * B1 导入 / 迁移 / 照片视图：表格横向滚动、状态徽标、提示框与照片网格
 * 目标视口：1440×900 桌面与 360×800 移动端，文字不被截断、布局不崩塌。
 * ------------------------------------------------------------------ */

.view { display: block; width: 100%; }

.form-row { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.form-row-inline { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px; }
.form-row-inline label { flex: 0 0 auto; font-weight: 600; }

.text-input,
.form-row input[type="text"],
.form-row textarea {
  padding: 6px 8px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font: inherit;
  max-width: 100%;
}

.btn-link { color: #1d4ed8; text-decoration: underline; cursor: pointer; }
.btn-disabled { opacity: 0.6; cursor: not-allowed; }

/* 表格：容器横向滚动，单元格文字换行而非溢出 */
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }

.data-table,
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  min-width: 560px;
}
.data-table th,
.data-table td,
.table th,
.table td {
  border: 1px solid #e5e7eb;
  padding: 6px 8px;
  text-align: left;
  vertical-align: top;
}
.data-table th,
.table th { background: #f9fafb; white-space: nowrap; }
.cell-wrap { white-space: normal; overflow-wrap: anywhere; word-break: break-word; }

/* 分类统计卡片 */
.stat-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 12px; }
.stat-card {
  flex: 1 1 96px;
  min-width: 96px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.stat-label { font-size: 12px; color: #6b7280; }
.stat-value { font-size: 18px; }

.hint { color: #4b5563; font-size: 13px; margin: 4px 0; overflow-wrap: anywhere; }
.message-host { margin: 8px 0; }

/* 导入状态徽标：NORMAL / WARNING / ERROR */
.row-normal,
tr.row-normal_create,
tr.row-normal_update { background: #ffffff; }
.row-warning,
tr.row-warning { background: #fef9c3; }
.row-error,
tr.row-error { background: #fee2e2; }

.badge-warning { background: #fef3c7; color: #92400e; }
.badge-error { background: #fee2e2; color: #991b1b; }
.badge-normal { background: #dcfce7; color: #166534; }

.panel-error { border-color: #fca5a5; }

.import-row { display: flex; flex-wrap: wrap; gap: 8px; padding: 6px 0; border-bottom: 1px solid #f3f4f6; }
.import-row.row-header { font-weight: 600; background: #f9fafb; }
.row-cell { flex: 1 1 120px; min-width: 0; overflow-wrap: anywhere; word-break: break-word; }

/* 照片网格：桌面多列、移动端单列 */
.photos-card { display: block; }
.photo-grid {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}
.photo-card { border: 1px solid #e5e7eb; border-radius: 8px; padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.photo-card-primary { border-color: #1d4ed8; box-shadow: 0 0 0 1px #1d4ed8 inset; }
.photo-thumb { min-height: 120px; display: flex; align-items: center; justify-content: center; background: #f9fafb; }
.photo-image { max-width: 100%; height: auto; display: block; }
.photo-thumb-fallback { color: #6b7280; font-size: 12px; text-align: center; padding: 8px; margin: 0; }
.photo-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.photo-line { margin: 0; font-size: 12px; color: #4b5563; overflow-wrap: anywhere; }
.photo-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.photos-upload { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px; }
.photos-upload-status { margin: 0; font-size: 13px; }
.photos-status-ok { color: #166534; }
.photos-status-error { color: #b91c1c; }
.photos-status-busy { color: #92400e; }
.photos-readonly { color: #6b7280; margin: 0; }
.photos-toolbar { margin-bottom: 8px; }
.photos-hint { font-size: 13px; color: #4b5563; }
.photos-target { margin: 4px 0 8px; }

@media (max-width: 480px) {
  .form-row-inline { flex-direction: column; align-items: stretch; }
  .data-table, .table { min-width: 100%; font-size: 13px; }
  .photo-grid { grid-template-columns: 1fr; }
  .stat-card { flex: 1 1 100%; }
  .row-cell { flex: 1 1 100%; }
}

/* ================================================================== *
 * B2-T08 库存页面（inventory.js）专用样式。
 * 全部以 .inv- 前缀作用域，只追加、不改动 B0/B1 既有选择器与取值。
 * 宽 1440 与窄 390 均不得产生整页水平溢出：表格一律放进可横滚容器，
 * 长标识类文本用 overflow-wrap 换行而不是撑宽页面。
 * ================================================================== */

.inv-view {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.inv-tabs {
  flex-wrap: wrap;
  gap: 4px;
}

.inv-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

/* 表格容器：容器内横向滚动，页面本身不被撑宽 */
.inv-table-scroll {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 8px;
}

.inv-table {
  min-width: 640px;
  border: 0;
}

.inv-table-scroll .table-caption {
  padding: 8px 12px;
  margin: 0;
  font-size: 13px;
}

.inv-filters {
  align-items: end;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.inv-field-actions {
  display: flex;
  align-items: end;
}

.inv-input,
.inv-select {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  padding: 7px 9px;
  border: 1px solid var(--border, #d1d5db);
  border-radius: 6px;
  font-size: 14px;
  background: #fff;
}

.inv-stack {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-start;
}

.inv-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* 卡片内小标题：只在库存视图内定义，不影响 B0/B1 的任何既有元素 */
.inv-view .panel-subtitle {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.inv-form-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 8px;
  background: #fbfbfd;
  min-width: 0;
}

.inv-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
}

.inv-inline .field {
  flex: 1 1 220px;
  min-width: 0;
}

.inv-lines {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.inv-form-result {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.inv-details {
  min-width: 0;
}

.inv-details > summary {
  cursor: pointer;
  padding: 6px 0;
  font-size: 13px;
  color: #1d4ed8;
}

/* 勾选组：物料/仓库显式范围，窄屏自动换行 */
.inv-check-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
  min-width: 0;
}

.inv-check-title {
  margin: 0;
  font-weight: 600;
  font-size: 13px;
}

.inv-check-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  max-height: 180px;
  overflow-y: auto;
}

.inv-check-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  max-width: 100%;
}

.inv-check-label > span {
  overflow-wrap: anywhere;
}

/* 守恒：差额非零同时给颜色 + 文字 + 数值，不只靠颜色传达 */
.inv-row-unbalanced {
  border-left: 4px solid #dc2626;
}

.inv-balance-text {
  margin: 0;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.inv-balance-ok { color: #166534; }
.inv-balance-bad { color: #b91c1c; }

.inv-diff-unbalanced {
  color: #b91c1c;
}

.badge-bad {
  background: #fee2e2;
  color: #991b1b;
}

/* 窄屏 390：单列堆叠，控件与表格不撑宽页面 */
@media (max-width: 480px) {
  .inv-filters {
    grid-template-columns: 1fr;
  }

  .inv-inline {
    flex-direction: column;
    align-items: stretch;
  }

  .inv-inline .field {
    flex: 1 1 auto;
  }

  .inv-table {
    min-width: 560px;
  }

  .inv-check-list {
    max-height: 140px;
  }
}

/* =====================================================================
 * B3 采购与应付（procurement.js）
 * 复用既有变量与 .table/.panel/.badge 视觉，不新增依赖。
 * 桌面双栏、窄屏单栏；宽表格只在容器内横向滚动，页面本身不被撑宽。
 * ===================================================================== */

.pro-view {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.pro-tabs {
  flex-wrap: wrap;
  gap: 4px;
}

.pro-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.pro-page,
.pro-detail-host {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.pro-result {
  min-width: 0;
}

/* 只读事实卡片区：桌面自适应列，窄屏单列 */
.pro-facts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
  margin: 12px 0;
}

.pro-fact {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-alt);
}

.pro-fact .card-value {
  overflow-wrap: anywhere;
}

/* 表格容器：容器内横向滚动，页面本身不产生整页水平溢出 */
.pro-table-scroll {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  margin: 8px 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.pro-table {
  width: 100%;
  border-collapse: collapse;
}

.pro-table th,
.pro-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.pro-table tbody tr:last-child td {
  border-bottom: none;
}

/* 明细行编辑器：输入保持原始字符串，页面不做取整或金额计算 */
.pro-line-editor {
  min-width: 0;
}

.pro-line-ids {
  margin: 0 0 8px;
  padding-left: 20px;
  color: var(--text-muted);
  overflow-wrap: anywhere;
}

.pro-form-block {
  min-width: 0;
}

/* 成功态：与错误态明确区分，读屏软件也会礼貌播报 */
.pro-success {
  margin: 12px 0;
  padding: 12px 14px;
  border: 1px solid var(--ok);
  border-radius: var(--radius);
  background: var(--ok-bg);
}

.pro-success-title {
  margin: 0 0 4px;
  font-weight: 600;
  color: var(--ok);
}

.pro-success-text {
  margin: 0;
  overflow-wrap: anywhere;
}

/* 提示条：未匹配行、勾稽未通过等必须同时有文字，不能只靠颜色 */
.pro-warning {
  margin: 10px 0;
  padding: 10px 14px;
  border: 1px solid var(--warn);
  border-radius: var(--radius);
  background: var(--warn-bg);
  color: var(--warn);
}

.pro-delete-request {
  margin-top: 16px;
}

@media (max-width: 820px) {
  .pro-facts {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  }
}

@media (max-width: 480px) {
  .pro-facts {
    grid-template-columns: 1fr;
  }

  .pro-filters {
    grid-template-columns: 1fr;
  }

  .pro-table {
    min-width: 560px;
  }
}

/* ================================================================= *
 * B4-T10 发货/退货/应收页面
 * 布局目标：1366x900 与 390x844 下字段都不丢失；明细表格可横向滚动；
 * 状态、逐行收费/免费、待接入依赖除颜色外均有文字标识。
 * ================================================================= */

.sales-h2 { font-size: 1.15rem; margin: 0 0 8px; }
.sales-h3 { font-size: 1rem; margin: 12px 0 6px; }
.sales-h4 { font-size: 0.9rem; margin: 10px 0 4px; color: #444; }
.sales-muted { color: #5a5a5a; margin: 4px 0 8px; font-size: 0.9rem; }
.sales-hint { color: #6b6b6b; font-size: 0.85rem; margin: 4px 0; }

.sales-panel {
  background: #fff; border: 1px solid #e2e2e2; border-radius: 6px;
  padding: 14px 16px; margin: 0 0 16px;
}
.sales-block { margin-top: 12px; }

/* 明细表格：窄屏横向滚动，列不裁剪、不丢字段 */
.sales-table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.sales-table { min-width: 960px; border-collapse: collapse; }
.sales-table th, .sales-table td {
  border-bottom: 1px solid #ececec; padding: 6px 8px;
  text-align: left; vertical-align: top; white-space: nowrap;
}
.sales-table th { background: #f6f6f6; font-weight: 600; }

.sales-dl { display: grid; grid-template-columns: minmax(120px, 200px) 1fr; gap: 4px 12px; margin: 0; }
.sales-dl dt { color: #555; }
.sales-dl dd { margin: 0; overflow-wrap: anywhere; }

.sales-form { display: grid; gap: 10px; margin: 0 0 8px; }
.sales-form-inline { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); align-items: end; }
.sales-label { display: flex; flex-direction: column; gap: 4px; font-size: 0.9rem; }
.sales-label-text { color: #444; }
.sales-form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.sales-form-status { margin: 4px 0 0; color: #444; font-size: 0.9rem; }

.sales-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 8px 0; }

.sales-line-editor { display: flex; flex-direction: column; gap: 8px; }
.sales-line-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px; align-items: end;
  border: 1px dashed #d8d8d8; border-radius: 4px; padding: 8px;
}
.sales-line-cell { display: flex; flex-direction: column; gap: 4px; font-size: 0.85rem; }
.sales-line-label { color: #555; }

/* 状态与结果块 */
.sales-state { border-radius: 4px; padding: 10px 12px; margin: 8px 0; border-left: 4px solid #bbb; background: #fafafa; }
.sales-state-error { border-left-color: #b3261e; background: #fdf3f2; }
.sales-state-forbidden { border-left-color: #8a6d00; background: #fdf8ec; }
.sales-state-empty { border-left-color: #6b7280; }
.sales-state-waiting { border-left-color: #2f6f9f; background: #f2f7fc; }
.sales-state-title { margin: 0 0 4px; font-weight: 600; }
.sales-state-detail { margin: 2px 0 0; color: #444; font-size: 0.9rem; }

.sales-outcome { border: 1px solid #e2e2e2; border-radius: 6px; padding: 12px 14px; margin: 12px 0; background: #fdfdfd; }
.sales-result-status { margin: 6px 0; }

.sales-badge {
  display: inline-block; border: 1px solid #ccc; border-radius: 10px;
  padding: 1px 8px; font-size: 0.8rem; background: #f7f7f7; white-space: nowrap;
}
.sales-tone-draft { border-color: #999; }
.sales-tone-effective { border-color: #1f7a3d; background: #eefaf1; }
.sales-tone-pending { border-color: #a8751a; background: #fdf6e7; }
.sales-tone-void { border-color: #7a7a7a; background: #f0f0f0; }
.sales-tone-reversed { border-color: #5b5b8a; background: #f2f2fa; }
.sales-tone-chargeable { border-color: #1f5fa7; background: #eef4fd; }
.sales-tone-free { border-color: #8a5a00; background: #fdf3e3; }
.sales-tone-sample { border-color: #7a3fa7; background: #f7f0fd; }
.sales-price-empty { color: #6b6b6b; font-style: normal; }

.sales-raw {
  white-space: pre-wrap; overflow-wrap: anywhere; max-height: 320px; overflow: auto;
  background: #f6f6f6; border-radius: 4px; padding: 8px; font-size: 0.85rem; margin: 4px 0;
}
.sales-details summary { cursor: pointer; color: #1f5fa7; }
.sales-detail-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }

@media (max-width: 760px) {
  .sales-panel { padding: 12px 10px; }
  .sales-dl { grid-template-columns: 1fr; gap: 2px; }
  .sales-dl dt { margin-top: 6px; font-size: 0.85rem; }
  .sales-form-inline { grid-template-columns: 1fr; }
  .sales-line-row { grid-template-columns: 1fr; }
  .sales-table th, .sales-table td { white-space: normal; }
}
/* ==================================================================== *
 * B5-T08 生产页面（报工录入 / 中转筐扫码 / 报工设置）
 * 只复用既有变量与组件语义，不引入新设计语言：
 * 桌面 1366x900 为录入主场景，手机 390x844 为扫码主场景。
 * ==================================================================== */
.prd-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-top: 16px;
}

.prd-stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.prd-panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.prd-panel-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.prd-panel-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.prd-form-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.prd-field {
  min-width: 0;
}

.prd-input {
  min-width: 0;
  width: 100%;
}

/* 录入表：列多，允许横向滚动，不压缩到读不清 */
.prd-table-wrap {
  overflow-x: auto;
}

.prd-table {
  min-width: 1180px;
}

.prd-table th,
.prd-table td {
  vertical-align: top;
}

.prd-table td select,
.prd-table td input {
  min-width: 96px;
}

.prd-idx {
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
}

.prd-cell-wrap {
  min-width: 260px;
}

.prd-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
}

.prd-kv {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-alt);
}

.prd-kv-value {
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.prd-form-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.prd-btn {
  white-space: nowrap;
}

.prd-request-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.prd-request-row .prd-input {
  flex: 1 1 260px;
  min-width: 200px;
}

/* 数量为 0 / 已用完 / 打印失败等需要文字说明的状态：不只靠颜色 */
.prd-warn {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-left-width: 4px;
  border-radius: var(--radius);
  background: var(--surface-alt);
  font-size: 13px;
  line-height: 1.6;
}

.prd-disabled-note {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface-alt);
}

.prd-notdelivered {
  align-items: flex-start;
}

.prd-photo {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.prd-photo-image {
  max-width: 320px;
  height: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.prd-photo-fallback {
  padding: 16px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  font-size: 13px;
}

/* 字段级失败提示：服务端指出了是哪个字段出错，用户照着改 */
.prd-field-issue {
  margin: 0;
  padding: 8px 10px;
  border-left: 4px solid #b45309;
  border-radius: var(--radius);
  background: var(--surface-alt);
  font-size: 13px;
  line-height: 1.6;
}

/* 分筐合计提示（合计由定点十进制算出，数值本身仍由服务端校验） */
.prd-box-sum {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
}

.prd-plain-list {
  margin: 0;
  padding-left: 20px;
  font-size: 13px;
  line-height: 1.7;
}

/* 固定报工纸：纸面数量格留空给现场手写，系统记录列仅供核对 */
.prd-print-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.prd-print-table {
  min-width: 0;
}

.prd-blank-cell {
  min-width: 72px;
  height: 30px;
  background: #fff;
}

.prd-print-reference {
  color: var(--text-muted);
  font-size: 12px;
}

/* 打印只输出固定报工纸本身；「系统记录」参考列不打印 */
@media print {
  body * {
    visibility: hidden;
  }

  .prd-print-form,
  .prd-print-form * {
    visibility: visible;
  }

  .prd-print-form {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
  }

  .prd-print-reference {
    display: none !important;
  }
}

/* 手机 390x844：扫码与领用是主场景，按钮与输入撑满可点区域 */
@media (max-width: 720px) {
  .prd-tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
  }

  .prd-form-grid {
    grid-template-columns: 1fr;
  }

  .prd-summary {
    grid-template-columns: 1fr;
  }

  .prd-form-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .prd-form-actions .btn {
    width: 100%;
    min-height: 44px;
  }

  .prd-input {
    min-height: 40px;
  }

  .prd-photo-image {
    max-width: 100%;
  }
}

@media (max-width: 480px) {
  .prd-panel-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .prd-panel-actions .btn {
    width: 100%;
  }
}

/* ------------------------------------------------------------------ *
 * B8 工资管理（payroll.js）与工人手机端（worker-self.js）追加样式。
 * 只在文件末尾追加，不修改任何既有前缀规则。
 * 所有 B8 选择器均限定在 .payroll-view / .worker-view 根下，不污染 B0–B5 既有模块。
 * 窄屏优先：390x844 下金额与操作不丢失，明细表横向滚动。
 * ------------------------------------------------------------------ */

.payroll-view,
.worker-view {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.payroll-view .view-subtitle,
.worker-view .view-subtitle {
  margin: 0;
  color: var(--muted, #5b6472);
  font-size: 14px;
  line-height: 1.6;
}

.payroll-view .summary-grid,
.worker-view .summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}

/* 金额一律原样显示服务端十进制字符串：等宽 + 不换行，避免误读。 */
.payroll-view .money-cell,
.worker-view .money-cell {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  text-align: right;
}

.payroll-view .form-hint,
.worker-view .form-hint {
  margin: 4px 0 0;
  color: var(--muted, #5b6472);
  font-size: 13px;
  line-height: 1.6;
}

.payroll-view .field-label,
.worker-view .field-label {
  margin: 0 0 4px;
  font-size: 13px;
  font-weight: 600;
}

.payroll-view .form-outcome,
.worker-view .form-outcome {
  margin-top: 12px;
}

.payroll-view .form-outcome:empty,
.worker-view .form-outcome:empty {
  margin-top: 0;
}

.payroll-view .state-ok,
.worker-view .state-ok {
  border-color: #b7e0c2;
  background: #f1f9f3;
}

.payroll-view .form-row,
.worker-view .form-row {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
}

.payroll-view .form-row > .field,
.worker-view .form-row > .field {
  flex: 1 1 180px;
  min-width: 0;
}

/* 明细表横向滚动：手机窄屏不丢字段。 */
.payroll-view .table-scroll,
.worker-view .table-scroll {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.payroll-view .table-caption,
.worker-view .table-caption {
  text-align: left;
  font-size: 13px;
  color: var(--muted, #5b6472);
  padding-bottom: 6px;
}

.payroll-view .link,
.worker-view .link {
  color: var(--primary, #1f5fd0);
  text-decoration: underline;
}

/* 三列税社保回传行编辑器 */
.payroll-view .tax-social-rows,
.worker-view .tax-social-rows {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
}

.payroll-view .tax-social-row,
.worker-view .tax-social-row {
  padding: 10px;
  border: 1px solid var(--border, #dfe3e8);
  border-radius: 8px;
}

.payroll-view .objection-patch[hidden],
.worker-view .objection-patch[hidden] {
  display: none;
}

/* ------------------------------------------------------------------ *
 * 工人手机端
 * ------------------------------------------------------------------ */

.payroll-view .tab-bar,
.worker-view .tab-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border, #dfe3e8);
  padding-bottom: 8px;
}

.payroll-view .tab,
.worker-view .tab {
  flex: 1 1 auto;
  min-width: 96px;
  padding: 10px 12px;
  font-size: 15px;
  border: 1px solid var(--border, #dfe3e8);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
}

.payroll-view .tab-active,
.worker-view .tab-active {
  border-color: var(--primary, #1f5fd0);
  color: var(--primary, #1f5fd0);
  font-weight: 600;
}

.payroll-view .worker-section,
.worker-view .worker-section {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.payroll-view .worker-slip,
.worker-view .worker-slip {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.payroll-view .status-line,
.worker-view .status-line {
  margin: 0;
  font-weight: 600;
}

/* 工资条金额：两列定义列表，手机上一行一项也不会挤压。 */
.payroll-view .money-list,
.worker-view .money-list {
  display: grid;
  grid-template-columns: minmax(96px, 40%) 1fr;
  gap: 6px 12px;
  margin: 0;
}

.payroll-view .money-list dt,
.worker-view .money-list dt {
  color: var(--muted, #5b6472);
  font-size: 14px;
}

.payroll-view .money-list dd,
.worker-view .money-list dd {
  margin: 0;
  text-align: right;
}

/* 手机上主要动作固定在底部，拇指可达。 */
.payroll-view .form-actions-sticky,
.worker-view .form-actions-sticky {
  position: sticky;
  bottom: 0;
  z-index: 2;
  padding: 10px 0;
  background: var(--surface, #fff);
  border-top: 1px solid var(--border, #dfe3e8);
}

.payroll-view .form-actions-sticky .btn,
.worker-view .form-actions-sticky .btn {
  flex: 1 1 auto;
}

.payroll-view .btn-touch,
.worker-view .btn-touch {
  min-height: 44px;
  padding: 10px 16px;
  font-size: 15px;
}

.payroll-view .objection-form,
.worker-view .objection-form {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--border, #dfe3e8);
}

.payroll-view .objection-item,
.worker-view .objection-item {
  padding: 12px 0;
  border-bottom: 1px solid var(--border, #dfe3e8);
}

.payroll-view .objection-item:last-child,
.worker-view .objection-item:last-child {
  border-bottom: none;
}

.payroll-view .objection-target,
.worker-view .objection-target {
  margin: 4px 0;
  font-weight: 600;
}

@media (max-width: 480px) {
  .payroll-view .summary-grid,
  .worker-view .summary-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  }

  .payroll-view .money-list,
  .worker-view .money-list {
    grid-template-columns: minmax(84px, 46%) 1fr;
  }

  .payroll-view .form-row > .field,
  .worker-view .form-row > .field {
    flex: 1 1 100%;
  }

  .payroll-view .panel,
  .worker-view .panel {
    padding: 12px;
  }
}

/* 长来源版本哈希与状态文本按字符换行：不截断、不隐藏文字，也不动表内横滚。 */
.payroll-view .card-value,
.worker-view .card-value {
  overflow-wrap: anywhere;
  white-space: normal;
}

/* 工资详情长快照/附件标识可换行；保留完整内容和表格内部滚动。 */
.payroll-view .form-hint,
.worker-view .form-hint {
  overflow-wrap: anywhere;
}

.payroll-view .panel,
.worker-view .panel,
.payroll-view .field,
.worker-view .field {
  min-width: 0;
  max-width: 100%;
}

/* J5018 · 工业级 ERP 工作台设计系统 */
:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-alt: #f1f5f9;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text: #0f172a;
  --text-muted: #64748b;
  --brand: #2563eb;
  --brand-dark: #1d4ed8;
  --danger: #dc2626;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 8px 24px rgba(15, 23, 42, .06);
}

html, body { max-width: 100%; }
body { background: #f8fafc; color: #0f172a; }
.layout { width: 100%; max-width: 100%; min-width: 0; }
.sidebar {
  position: sticky; top: 0; height: 100vh; width: 248px; flex: 0 0 248px;
  gap: 14px; padding: 20px 14px 14px; overflow: hidden;
  color: #e2e8f0; background: #0f172a; border: 0; box-shadow: 4px 0 20px rgba(15,23,42,.08);
}
.sidebar-head { flex: 0 0 auto; padding: 0 5px 14px; border-bottom: 1px solid rgba(148,163,184,.2); }
.sidebar-title { color: #f8fafc; letter-spacing: .01em; }
.sidebar-subtitle { color: #94a3b8; }
.brand-mark-sm { color: #fff; background: linear-gradient(145deg,#2563eb,#60a5fa); box-shadow: 0 5px 16px rgba(37,99,235,.28); }
.nav-search-wrap { position: relative; flex: 0 0 auto; }
.nav-search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: #94a3b8; pointer-events: none; }
#nav-search.nav-search {
  display: block; width: 100%; min-width: 0; height: 40px; padding: 8px 10px 8px 36px;
  color: #f8fafc; background: rgba(30,41,59,.88); border: 1px solid #334155; border-radius: 9px;
  outline: none; font-size: 13px;
}
#nav-search.nav-search::placeholder { color: #94a3b8; }
#nav-search.nav-search:focus { border-color: #60a5fa; box-shadow: 0 0 0 3px rgba(37,99,235,.2); }
.nav { min-height: 0; margin: 0 -5px; padding: 0 5px; }
.nav-groups { display: flex; flex-direction: column; gap: 5px; }
.nav-group { min-width: 0; }
.nav-group-toggle {
  display: flex; width: 100%; min-height: 38px; align-items: center; gap: 9px; padding: 7px 9px;
  color: #cbd5e1; background: transparent; border: 0; border-radius: 8px; text-align: left; cursor: pointer;
  font: inherit; font-size: 12px; font-weight: 700; letter-spacing: .025em; transition: color .16s ease, background .16s ease;
}
.nav-group-toggle:hover { color: #fff; background: rgba(148,163,184,.1); }
.nav-group-icon { flex: 0 0 16px; color: #94a3b8; }
.nav-group-label { flex: 1 1 auto; min-width: 0; }
.nav-group-chevron { color: #64748b; font-size: 16px; line-height: 1; }
.nav-group-list { gap: 2px; padding: 2px 0 5px; }
.nav-link {
  display: flex; position: relative; min-height: 38px; align-items: center; gap: 10px; padding: 8px 10px 8px 13px;
  overflow: hidden; color: #cbd5e1; border-radius: 8px; font-size: 13px; transition: color .16s ease, background .16s ease;
}
.nav-item-icon { flex: 0 0 16px; color: #94a3b8; }
.nav-link:hover { color: #f8fafc; background: rgba(148,163,184,.1); }
.nav-link.is-active { color: #fff; font-weight: 650; background: linear-gradient(90deg,rgba(37,99,235,.28),rgba(37,99,235,.1)); }
.nav-link.is-active::before { position: absolute; inset: 7px auto 7px 0; width: 3px; content: ""; border-radius: 0 3px 3px 0; background: #60a5fa; }
.nav-link.is-active .nav-item-icon { color: #93c5fd; }
.nav-sublist { border-color: #334155; }
.nav-sublink { color: #94a3b8; }
.nav-sublink:hover { color: #f8fafc; background: rgba(148,163,184,.1); }
.sidebar-foot { flex: 0 0 auto; padding: 13px 5px 0; border-color: rgba(148,163,184,.2); }
.sidebar-user { overflow-wrap: anywhere; color: #f8fafc; }
.sidebar-roles { color: #94a3b8; }
.sidebar-foot .btn { min-height: 40px; color: #e2e8f0; background: rgba(30,41,59,.8); border-color: #334155; }
.sidebar-foot .btn:hover { color: #fff; background: #334155; }
.main-column { min-width: 0; max-width: calc(100% - 248px); }
.topbar {
  position: sticky; z-index: 20; top: 0; min-height: 64px; align-items: center; flex-wrap: wrap;
  padding: 10px 24px; background: rgba(255,255,255,.92); border-color: #e2e8f0;
  box-shadow: 0 1px 3px rgba(15,23,42,.04); backdrop-filter: blur(14px);
}
.topbar-breadcrumb { display: flex; min-width: 0; align-items: center; gap: 8px; color: #64748b; font-size: 13px; }
.topbar-domain { overflow: hidden; max-width: 180px; text-overflow: ellipsis; white-space: nowrap; }
.topbar-page { overflow: hidden; color: #0f172a; font-size: 15px; text-overflow: ellipsis; white-space: nowrap; }
.topbar-batch { flex: 0 0 auto; padding: 3px 8px; color: #1d4ed8; background: #eff6ff; border: 1px solid #dbeafe; border-radius: 999px; font-size: 11px; font-weight: 700; }
.topbar-actions { display: flex; min-width: 0; align-items: center; justify-content: flex-end; gap: 9px; }
.system-status, .account-pill { display: inline-flex; min-height: 30px; align-items: center; gap: 7px; padding: 4px 10px; color: #475569; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 999px; font-size: 11px; white-space: nowrap; }
.system-status::before { width: 7px; height: 7px; content: ""; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 3px rgba(34,197,94,.12); }
.account-pill { max-width: 240px; overflow: hidden; text-overflow: ellipsis; }
.mobile-nav-toggle { display: none; }
.content { min-width: 0; width: 100%; padding: 24px; gap: 20px; }
.view-head { gap: 5px; }
.view-title { color: #0f172a; font-size: 22px; letter-spacing: -.025em; }
.view-subtitle { color: #64748b; }
.panel, .card, .stat-card, .kpi-card {
  min-width: 0; border-color: #e2e8f0; border-radius: 12px; background: #fff;
  box-shadow: 0 1px 2px rgba(15,23,42,.035), 0 5px 16px rgba(15,23,42,.035);
}
.panel { padding: 18px; }
.panel-title { color: #0f172a; font-weight: 700; }
.card, .stat-card, .kpi-card { position: relative; overflow: hidden; }
.card::before, .stat-card::before, .kpi-card::before { position: absolute; inset: 0 0 auto; height: 3px; content: ""; background: linear-gradient(90deg,#2563eb,#60a5fa); }
.card-label { color: #64748b; font-size: 12px; font-weight: 600; }
.card-value { color: #0f172a; font-size: 26px; font-weight: 750; letter-spacing: -.025em; font-variant-numeric: tabular-nums; }
.btn { min-height: 40px; border-radius: 8px; font-weight: 600; transition: transform .15s ease, box-shadow .15s ease, background .15s ease; }
.btn-primary { color: #fff; background: linear-gradient(135deg,#2563eb,#1d4ed8); border-color: #1d4ed8; box-shadow: 0 2px 5px rgba(37,99,235,.2); }
.btn-primary:hover:not(:disabled) { transform: translateY(-1px); background: #1d4ed8; box-shadow: 0 5px 12px rgba(37,99,235,.24); }
.btn-secondary { color: #334155; background: #fff; border-color: #cbd5e1; }
.btn-secondary:hover:not(:disabled) { color: #1d4ed8; background: #f8fafc; border-color: #93c5fd; }
button:disabled, .btn:disabled { cursor: not-allowed; opacity: .52; box-shadow: none; }
.btn-danger, .btn-void, .btn-reverse { color: #b91c1c; border-color: #fecaca; background: #fff; }
input:not([type="checkbox"]):not([type="radio"]), select, textarea { border-color: #cbd5e1; border-radius: 8px; }
input:not([type="checkbox"]):not([type="radio"]):focus, select:focus, textarea:focus { border-color: #60a5fa; outline: 0; box-shadow: 0 0 0 3px rgba(37,99,235,.13); }
.field { min-width: 0; }
.table-wrap, .table-scroll, .data-table-wrap, .table-container { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid #e2e8f0; border-radius: 10px; }
table, .table, .data-table { font-variant-numeric: tabular-nums; }
.table th, .data-table th, table thead th { position: sticky; z-index: 2; top: 0; color: #334155; background: #f1f5f9; font-weight: 700; }
.table th, .table td, .data-table th, .data-table td, table th, table td { border-color: #e2e8f0; }
.table tbody tr:nth-child(even), .data-table tbody tr:nth-child(even), table tbody tr:nth-child(even) { background: #f8fafc; }
.table tbody tr:hover, .data-table tbody tr:hover, table tbody tr:hover { background: #eff6ff; }
td.num, th.num, .num, .amount, .quantity, .weight, .unit-price { font-variant-numeric: tabular-nums; text-align: right; }
.badge { display: inline-flex; min-height: 23px; align-items: center; padding: 2px 9px; border: 1px solid transparent; border-radius: 999px; font-size: 11px; font-weight: 700; line-height: 1.4; white-space: nowrap; }
.badge-effective, .badge-ok, .badge-normal { color: #166534; background: #dcfce7; border-color: #bbf7d0; }
.badge-pending, .badge-warning { color: #92400e; background: #fef3c7; border-color: #fde68a; }
.badge-bad { color: #991b1b; background: #fee2e2; border-color: #fecaca; }
.badge-neutral, .badge-muted { color: #475569; background: #f1f5f9; border-color: #e2e8f0; }
.badge-info, .badge-primary { color: #1d4ed8; background: #dbeafe; border-color: #bfdbfe; }
.empty-state, .state-empty, .empty, .nav-empty { color: #64748b; }
.empty-state, .state-empty { padding: 28px 20px; border: 1px dashed #cbd5e1; border-radius: 12px; background: #f8fafc; text-align: center; }
.login-shell { margin: max(24px, calc((100dvh - 680px) / 2)) auto; width: min(1060px, calc(100% - 40px)); min-height: min(680px, calc(100vh - 48px)); flex-wrap: nowrap; gap: 0; padding: 0; overflow: hidden; border: 1px solid #e2e8f0; border-radius: 22px; background: #fff; box-shadow: 0 24px 70px rgba(15,23,42,.14); }
.login-shell .login-brand { display: flex; width: 50%; max-width: none; min-height: 580px; flex-direction: column; justify-content: center; padding: clamp(32px, 6vw, 68px); border-radius: 0; background: radial-gradient(circle at 85% 15%,rgba(96,165,250,.26),transparent 36%), linear-gradient(145deg,#0f172a 4%,#172554 62%,#1e3a8a); }
.login-brand .eyebrow { margin: 4px 0 16px; color: #93c5fd; }
.login-brand .brand-title { max-width: 440px; margin-bottom: 14px; font-size: clamp(25px,3vw,34px); line-height: 1.28; }
.login-brand .brand-text { max-width: 440px; color: #cbd5e1; font-size: 15px; line-height: 1.8; }
.login-principles { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; margin-top: 32px; }
.login-principle { padding: 10px 12px; color: #dbeafe; background: rgba(255,255,255,.08); border: 1px solid rgba(191,219,254,.24); border-radius: 9px; font-size: 13px; font-weight: 650; }
.login-panel { display: flex; width: 50%; max-width: none; align-items: center; justify-content: center; padding: clamp(24px,5vw,64px); }
.login-card { width: 100%; max-width: 390px; padding: 0; border: 0; border-radius: 0; box-shadow: none; }
.login-card .eyebrow { color: #2563eb; font-weight: 700; }
.login-title { margin: 10px 0 5px; font-size: 27px; letter-spacing: -.03em; }
.login-card .field { margin-top: 18px; }
.login-card .input { min-height: 46px; }
.login-card .btn-block { margin-top: 22px; min-height: 46px; }
.login-note { margin-top: 16px; line-height: 1.7; }

@media (max-width: 1000px) {
  .topbar { padding-right: 16px; padding-left: 16px; }
  .topbar-actions { gap: 6px; }
  .account-pill { max-width: 170px; }
  .content { padding: 18px; }
}
@media (max-width: 820px) {
  .layout { display: flex; width: 100%; }
  .sidebar {
    position: fixed; z-index: 50; inset: 0 auto 0 0; width: min(290px,86vw); height: 100dvh;
    flex: none; transform: translateX(-105%); transition: transform .22s ease; box-shadow: 12px 0 34px rgba(15,23,42,.3);
  }
  .sidebar.is-open { transform: translateX(0); }
  .main-column { width: 100%; max-width: 100%; }
  .topbar { min-height: 58px; gap: 10px; padding: 9px 14px; }
  .mobile-nav-toggle { display: inline-flex; width: 40px; height: 40px; flex: 0 0 40px; align-items: center; justify-content: center; color: #334155; background: #fff; border: 1px solid #e2e8f0; border-radius: 9px; font-size: 19px; cursor: pointer; }
  .topbar-breadcrumb { flex: 1 1 auto; gap: 5px; }
  .topbar-actions { flex: 0 1 auto; }
  .system-status, .account-pill { display: none; }
  .content { padding: 16px; }
}
@media (max-width: 560px) {
  .topbar { flex-wrap: wrap; }
  .topbar-breadcrumb { min-width: 0; }
  .topbar-domain { display: none; }
  .topbar-batch { font-size: 10px; padding: 2px 6px; }
  .topbar-actions { width: auto; margin-left: auto; }
  .topbar-actions > .btn { min-height: 38px; padding: 7px 10px; font-size: 12px; }
  .content { padding: 13px; gap: 14px; }
  .panel { padding: 13px; }
  .view-title { font-size: 19px; }
  .login-shell { width: calc(100% - 24px); min-height: 0; flex-direction: column; margin: 12px auto; border-radius: 16px; }
  .login-shell .login-brand { width: 100%; min-height: 0; padding: 23px 22px; }
  .login-brand .brand-mark { width: 40px; height: 40px; margin-bottom: 10px; }
  .login-brand .eyebrow { margin: 0 0 8px; font-size: 10px; }
  .login-brand .brand-title { margin-bottom: 8px; font-size: 22px; }
  .login-brand .brand-text { font-size: 13px; }
  .login-principles { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 7px; margin-top: 14px; }
  .login-principle { padding: 7px 8px; font-size: 12px; }
  .login-panel { width: 100%; padding: 25px 22px 28px; }
  .login-title { font-size: 23px; }
  input:not([type="checkbox"]):not([type="radio"]), select, textarea { min-height: 40px; }
  button, .btn { min-height: 40px; }
}
@media (prefers-reduced-motion: reduce) {
  .sidebar, .nav-link, .nav-group-toggle, .btn { transition: none !important; }
}
.nav-group-list[hidden] { display: none; }
.topbar > .help-drawer-toggle, .topbar-actions .help-drawer-toggle { min-height: 40px; color: #1d4ed8; background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 9px; font-weight: 700; }
.topbar > .help-drawer-toggle:hover, .topbar-actions .help-drawer-toggle:hover { background: #dbeafe; }

/* 顶栏在内容变化和长账号下自适应换行，所有操作保持可达。 */
.topbar-breadcrumb { flex: 1 1 220px; flex-wrap: wrap; }
.topbar-actions { flex-wrap: wrap; }
.account-name, .account-role-codes { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.account-role { flex: none; padding: 1px 6px; border-radius: 5px; background: #e0e7ff; color: #3730a3; font-weight: 700; }
.account-role-boss { background: #dbeafe; color: #1d4ed8; }
@media (min-width: 821px) and (max-width: 1440px) {
  .topbar-breadcrumb { flex-basis: 100%; }
  .topbar-actions { flex: 1; justify-content: flex-start; }
}
@media (max-width: 820px) {
  .nav-group-toggle, .nav-link, .nav-sublink { min-height: 40px; }
  .topbar-breadcrumb { flex-basis: calc(100% - 56px); }
  .topbar-actions { flex: 1 1 auto; justify-content: flex-start; }
  .topbar-actions > .btn { min-height: 40px; }
  .sidebar:not(.is-open) { visibility: hidden; }
}
@media (prefers-reduced-motion: reduce) {
  .btn-primary:hover:not(:disabled) { transform: none; }
}

.badge-draft { color:#475569; background:#f1f5f9; border-color:#e2e8f0; }
.badge-void, .badge-reversed { color:#b91c1c; background:#fef2f2; border-color:#fecaca; }
.sidebar .nav-empty { color:#94a3b8; }
.table-wrap, .table-scroll, .data-table-wrap, .table-container { overscroll-behavior-x:contain; scroll-behavior:smooth; }
@media (prefers-reduced-motion: reduce) {
  .table-wrap, .table-scroll, .data-table-wrap, .table-container { scroll-behavior:auto; }
}
.sidebar .nav { scrollbar-width:thin; scrollbar-color:#475569 #0f172a; }
.sidebar .nav::-webkit-scrollbar { width:5px; }
.sidebar .nav::-webkit-scrollbar-track { background:#0f172a; }
.sidebar .nav::-webkit-scrollbar-thumb { background:#475569; border-radius:8px; }
/* 兼容旧版顶部导航断点：移动抽屉始终使用纵向列表。 */
@media (max-width:820px) {
  .sidebar { flex-direction:column; flex-wrap:nowrap; padding:20px 14px 14px; border-bottom:0; }
  .sidebar-head, .nav-search-wrap, .sidebar-foot { width:100%; }
  .sidebar .nav { flex:1 1 auto; width:auto; overflow-x:hidden; overflow-y:auto; }
  .sidebar .nav-list { flex-direction:column; flex-wrap:nowrap; width:100%; }
  .sidebar .nav-group-list { gap:2px; }
  .sidebar.is-open { box-shadow:12px 0 34px #0f172a4d, 0 0 0 100vmax #0f172a66; }
}
.content:focus-visible { outline:3px dashed #2563eb; outline-offset:-4px; }
:where(input, select, textarea):focus-visible { outline:2px solid #2563eb !important; outline-offset:2px; }
.spec-empty-row { color:#64748b; }
.table-wrap, .table-scroll, .data-table-wrap, .table-container { max-height: min(65vh, 640px); }
@media (min-width:721px) and (max-width:1300px) {
  .spec-field-row { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .spec-field-cell { min-width:0; }
}
.login-shell { align-items:stretch; }
@media (max-width:820px) {
  .sidebar { align-items:stretch; }
  .sidebar .nav { width:100%; }
  .sidebar .nav-link { border:0; white-space:normal; }
  .sidebar-foot { display:block; border-top:1px solid #334155; padding-top:13px; }
  .sidebar-foot .btn { width:100%; margin:8px 0 0; }
}
@media (max-width:560px) { .topbar-breadcrumb > [aria-hidden="true"] { display:none; } }

/* ==================================================================== *
 * OPUS55 · 精密制造 ERP 视觉精修层（Linear / Stripe / 旗舰 MES 质感）
 * 只追加在文件末尾、靠层叠覆盖 J5018 设计系统；不改任何 DOM 契约
 * （id / name / data-testid / data-menu / 按钮文案 / 接口），不引入外部资源。
 * data-ui-* 属性与 ui- 前缀类由 ui-polish.js 只读识别后追加，仅用于展示。
 * ==================================================================== */
:root {
  --ui-ease: cubic-bezier(0.16, 1, 0.3, 1);
  --ui-dur: 180ms;
  --ui-ring: 0 0 0 3px rgba(37, 99, 235, 0.18);
  --ui-canvas: #f8fafc;
  --ui-hairline: #e6ebf2;
  --ui-hairline-dark: rgba(255, 255, 255, 0.07);
  --ui-shadow-card: 0 1px 3px rgba(15, 23, 42, 0.04), 0 4px 12px rgba(15, 23, 42, 0.03);
  --ui-shadow-raise: 0 2px 6px rgba(15, 23, 42, 0.05), 0 12px 28px rgba(15, 23, 42, 0.07);
  --ui-nav-bg: linear-gradient(180deg, #0b1120 0%, #0f172a 100%);
  --ui-mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --bg: #f8fafc;
  --border: #e6ebf2;
}

/* ---------- 1. 全局排版：等宽数字，账表一眼对齐 ---------- */
body {
  background: var(--ui-canvas);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
::selection { background: rgba(37, 99, 235, 0.18); }
td, th, input, select, textarea, code, kbd, samp, output,
.card-value, .num, .amount, .quantity, .weight, .unit-price, .bom-num, .bom-edge-qty,
[class*="-amount"], [class*="-qty"], [class*="-price"], [class*="-weight"], [class*="-total"], [class*="-code"], [class*="-num"] {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}
.bom-tree-code, .mobile-scan-sheet-title, .topbar-batch, .login-principle-index { font-family: var(--ui-mono); }

/* ---------- 2. 侧边导航：深邃石墨蓝微渐变 + 内发光分割线 ---------- */
.sidebar {
  background: var(--ui-nav-bg);
  box-shadow: inset -1px 0 0 var(--ui-hairline-dark), 6px 0 24px rgba(2, 6, 23, 0.08);
}
.sidebar-head { border-bottom-color: var(--ui-hairline-dark); }
.sidebar-foot { border-top: 1px solid var(--ui-hairline-dark); border-color: var(--ui-hairline-dark); }
.brand-mark-sm {
  background: linear-gradient(145deg, #3b82f6, #1d4ed8);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 0 0 1px rgba(255, 255, 255, 0.06), 0 6px 18px rgba(37, 99, 235, 0.35);
}
#nav-search.nav-search {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.09);
  transition: border-color var(--ui-dur) var(--ui-ease), background-color var(--ui-dur) var(--ui-ease), box-shadow var(--ui-dur) var(--ui-ease);
}
#nav-search.nav-search:hover { border-color: rgba(255, 255, 255, 0.16); }
#nav-search.nav-search:focus { background: rgba(255, 255, 255, 0.07); border-color: rgba(96, 165, 250, 0.75); box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.3); }
.nav-group-toggle {
  color: #8b9ab0;
  font-size: 11.5px;
  letter-spacing: 0.06em;
  transition: color var(--ui-dur) var(--ui-ease), background-color var(--ui-dur) var(--ui-ease);
}
.nav-group-toggle:hover { color: #f1f5f9; background: rgba(255, 255, 255, 0.04); }
.nav-group-toggle[aria-expanded="true"] { color: #cbd5e1; }
.nav-group-toggle[aria-expanded="true"] .nav-group-icon { color: #60a5fa; }
.nav-link {
  color: #c3cddb;
  transition: color var(--ui-dur) var(--ui-ease), background-color var(--ui-dur) var(--ui-ease), box-shadow var(--ui-dur) var(--ui-ease);
}
.nav-link:hover { color: #fff; background: rgba(255, 255, 255, 0.05); }
.nav-link:hover .nav-item-icon { color: #e2e8f0; }
.nav-item-icon { transition: color var(--ui-dur) var(--ui-ease); }
.nav-link.is-active {
  color: #fff;
  background: linear-gradient(90deg, rgba(59, 130, 246, 0.24), rgba(59, 130, 246, 0.05));
  box-shadow: inset 0 0 0 1px rgba(96, 165, 250, 0.14);
}
.nav-link.is-active::before { background: #60a5fa; box-shadow: 0 0 10px rgba(96, 165, 250, 0.85); }
.nav-sublist { border-color: rgba(255, 255, 255, 0.08); }
.sidebar-foot .btn { background: rgba(255, 255, 255, 0.04); border-color: rgba(255, 255, 255, 0.1); }
.sidebar-foot .btn:hover:not(:disabled) { color: #fff; background: rgba(255, 255, 255, 0.09); border-color: rgba(255, 255, 255, 0.16); }
.sidebar .nav { scrollbar-color: rgba(148, 163, 184, 0.35) transparent; }
.sidebar .nav::-webkit-scrollbar-track { background: transparent; }
.sidebar .nav::-webkit-scrollbar-thumb { background: rgba(148, 163, 184, 0.35); }
@media (max-width: 820px) {
  .sidebar { transition: transform 220ms var(--ui-ease), visibility 220ms var(--ui-ease); }
  .sidebar-foot { border-top-color: var(--ui-hairline-dark); }
}

/* ---------- 3. 顶栏：毛玻璃吸顶 + 实时在线呼吸点 ---------- */
.topbar {
  background: rgba(255, 255, 255, 0.82);
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.6) inset, 0 1px 2px rgba(15, 23, 42, 0.03);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  backdrop-filter: blur(16px) saturate(180%);
}
.topbar-page { font-weight: 700; letter-spacing: -0.01em; }
.topbar-batch { letter-spacing: 0.02em; }
.system-status::before { animation: ui-breathe-green 2.4s ease-in-out infinite; }
.mobile-nav-toggle { transition: background-color var(--ui-dur) var(--ui-ease), border-color var(--ui-dur) var(--ui-ease), transform var(--ui-dur) var(--ui-ease); }
.mobile-nav-toggle:active { transform: scale(0.94); }

/* ---------- 4. 卡片与面板：纯白表面 + 多层细腻柔和阴影 ---------- */
.view-title { font-weight: 750; letter-spacing: -0.028em; }
.panel, .card, .stat-card, .kpi-card {
  border-color: var(--ui-hairline);
  background: #fff;
  box-shadow: var(--ui-shadow-card);
  transition: box-shadow var(--ui-dur) var(--ui-ease), transform var(--ui-dur) var(--ui-ease), border-color var(--ui-dur) var(--ui-ease);
}
.panel:hover { box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05), 0 8px 22px rgba(15, 23, 42, 0.045); }
.card:hover, .stat-card:hover, .kpi-card:hover { transform: translateY(-2px); border-color: #d9e2ee; box-shadow: var(--ui-shadow-raise); }
.card::before, .stat-card::before, .kpi-card::before { height: 2px; opacity: 0.85; background: linear-gradient(90deg, #2563eb, #38bdf8 60%, rgba(56, 189, 248, 0)); }
.panel-title { letter-spacing: -0.01em; }
.card-label { letter-spacing: 0.02em; }
.card-value { font-weight: 760; }
.state { border-color: #d5dde8; background: #fbfcfe; }

/* ---------- 5. 按钮：渐变质感 + 按压回弹 ---------- */
.btn, .tab, .bom-btn {
  transition: transform var(--ui-dur) var(--ui-ease), box-shadow var(--ui-dur) var(--ui-ease), background-color var(--ui-dur) var(--ui-ease), border-color var(--ui-dur) var(--ui-ease), color var(--ui-dur) var(--ui-ease);
}
.btn:active:not(:disabled), .tab:active, .bom-btn:active { transform: translateY(0) scale(0.98); }
.btn-primary {
  border-color: #1d4ed8;
  background: linear-gradient(180deg, #3b82f6 0%, #2563eb 52%, #1d4ed8 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(15, 23, 42, 0.12), 0 4px 10px rgba(37, 99, 235, 0.18);
}
.btn-primary:hover:not(:disabled) {
  background: linear-gradient(180deg, #3b82f6 0%, #1d4ed8 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 2px 4px rgba(15, 23, 42, 0.12), 0 8px 18px rgba(37, 99, 235, 0.28);
}
.btn-secondary { box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05); }
.btn-secondary:hover:not(:disabled) { box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 4px 10px rgba(37, 99, 235, 0.08); }
.tab { border-color: #dbe3ee; }
.tab:hover:not(.is-active) { border-color: #93c5fd; color: #1d4ed8; }
.tab.is-active { border-color: #2563eb; background: #eff6ff; color: #1d4ed8; box-shadow: 0 1px 2px rgba(37, 99, 235, 0.12), inset 0 0 0 1px rgba(37, 99, 235, 0.12); }

/* ---------- 6. 焦点态：清晰高对比光环 ---------- */
a:focus-visible, button:focus-visible, summary:focus-visible, [tabindex]:not(.content):focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
  box-shadow: var(--ui-ring);
}
.btn:focus-visible, .tab:focus-visible, .nav-link:focus-visible, .nav-group-toggle:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
  box-shadow: 0 0 0 5px rgba(37, 99, 235, 0.18);
}
.sidebar .nav-link:focus-visible, .sidebar .nav-group-toggle:focus-visible, .sidebar-foot .btn:focus-visible { outline-color: #60a5fa; box-shadow: 0 0 0 5px rgba(96, 165, 250, 0.25); }
input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="range"]), select, textarea {
  transition: border-color var(--ui-dur) var(--ui-ease), box-shadow var(--ui-dur) var(--ui-ease), background-color var(--ui-dur) var(--ui-ease);
}
input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not(:disabled):not(:focus):hover,
select:not(:disabled):not(:focus):hover, textarea:not(:disabled):not(:focus):hover { border-color: #94a3b8; }
input:not([type="checkbox"]):not([type="radio"]):focus, select:focus, textarea:focus { border-color: #2563eb; box-shadow: var(--ui-ring); }
input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 0 !important;
  border-color: #2563eb;
  box-shadow: 0 0 0 1px #2563eb, var(--ui-ring);
}
#nav-search.nav-search:focus-visible { box-shadow: 0 0 0 1px rgba(96, 165, 250, 0.9), 0 0 0 4px rgba(37, 99, 235, 0.3); }
input:disabled, select:disabled, textarea:disabled { background-color: #f1f5f9; color: #64748b; }

/* ---------- 7. 数据表格：吸顶表头 + 斑马纹微对比 + 悬停高亮 + 横向滚动提示 ---------- */
.table-wrap, .table-scroll, .data-table-wrap, .table-container { border-color: var(--ui-hairline); border-radius: 12px; background: #fff; }
.table th, .data-table th, table thead th {
  background: #f8fafc;
  color: #475569;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.02em;
  box-shadow: inset 0 -1px 0 #e2e8f0;
}
.table th, .table td, .data-table th, .data-table td, table th, table td { border-color: #eef2f7; }
.table tbody tr, .data-table tbody tr, table tbody tr { transition: background-color 120ms var(--ui-ease); }
.table tbody tr:nth-child(even), .data-table tbody tr:nth-child(even), table tbody tr:nth-child(even) { background: #fafbfd; }
.table tbody tr:hover, .data-table tbody tr:hover, table tbody tr:hover { background: #f1f5f9; }
.table-clickable tbody tr:hover { box-shadow: inset 3px 0 0 #2563eb; }
.row-expanded td { background: #f5f8ff; }
[data-ui-scroll="start"] {
  -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 36px), rgba(0, 0, 0, 0.18));
  mask-image: linear-gradient(90deg, #000 calc(100% - 36px), rgba(0, 0, 0, 0.18));
}
[data-ui-scroll="middle"] {
  -webkit-mask-image: linear-gradient(90deg, rgba(0, 0, 0, 0.18), #000 36px, #000 calc(100% - 36px), rgba(0, 0, 0, 0.18));
  mask-image: linear-gradient(90deg, rgba(0, 0, 0, 0.18), #000 36px, #000 calc(100% - 36px), rgba(0, 0, 0, 0.18));
}
[data-ui-scroll="end"] {
  -webkit-mask-image: linear-gradient(90deg, rgba(0, 0, 0, 0.18), #000 36px);
  mask-image: linear-gradient(90deg, rgba(0, 0, 0, 0.18), #000 36px);
}
.table-wrap::-webkit-scrollbar, .table-scroll::-webkit-scrollbar, .data-table-wrap::-webkit-scrollbar, .table-container::-webkit-scrollbar { width: 10px; height: 10px; }
.table-wrap::-webkit-scrollbar-thumb, .table-scroll::-webkit-scrollbar-thumb, .data-table-wrap::-webkit-scrollbar-thumb, .table-container::-webkit-scrollbar-thumb { border: 3px solid transparent; border-radius: 999px; background: #cbd5e1 padding-box; }

/* ---------- 8. 语义状态胶囊徽章 ---------- */
.badge, .sales-badge, .cutover-badge {
  display: inline-flex;
  min-height: 22px;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  font-weight: 650;
  letter-spacing: 0.01em;
  line-height: 1.4;
  white-space: nowrap;
  vertical-align: middle;
}
.badge { padding: 2px 10px; border: 1px solid transparent; font-size: 11.5px; }
.sales-badge { padding: 1px 10px; font-size: 12px; }
/* READY / MATCH / BALANCED：翡翠绿 + 呼吸圆点 */
.badge-ok, .badge-effective, .badge-normal, .cutover-badge.cutover-ready, .sales-badge.sales-tone-effective, [data-ui-tone="ok"]:not(td) {
  color: #047857;
  background: #ecfdf5;
  border-color: #a7f3d0;
}
.badge-ok::before, .badge-effective::before, .badge-normal::before, .cutover-badge.cutover-ready::before, .sales-badge.sales-tone-effective::before, [data-ui-tone="ok"]:not(td)::before {
  flex: none;
  width: 6px;
  height: 6px;
  content: "";
  border-radius: 50%;
  background: #10b981;
  animation: ui-breathe-green 2.2s ease-in-out infinite;
}
/* PENDING_REVIEW / 待交接：琥珀黄高对比 */
.badge-pending, .badge-warning, .sales-badge.sales-tone-pending, [data-ui-tone="warn"]:not(td) {
  color: #7c2d12;
  background: #fef3c7;
  border-color: #fbbf24;
}
.badge-pending::before, .badge-warning::before, .sales-badge.sales-tone-pending::before, [data-ui-tone="warn"]:not(td)::before {
  flex: none;
  width: 7px;
  height: 7px;
  content: "";
  border: 2px solid #d97706;
  border-radius: 50%;
  background: #fde68a;
}
/* BLOCKED / 超3%磅差拦截：警示红 + 边框 */
.badge-bad, .cutover-badge.cutover-blocked, [data-ui-tone="bad"]:not(td) {
  color: #b91c1c;
  background: #fef2f2;
  border-color: #f87171;
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.08);
}
.badge-bad::before, .cutover-badge.cutover-blocked::before, [data-ui-tone="bad"]:not(td)::before {
  flex: none;
  width: 6px;
  height: 6px;
  content: "";
  border-radius: 1px;
  background: #dc2626;
  transform: rotate(45deg);
}
.badge-info, .badge-primary { color: #1d4ed8; background: #eff6ff; border-color: #bfdbfe; }
.badge-neutral, .badge-muted, .badge-draft { color: #475569; background: #f1f5f9; border-color: #e2e8f0; }
/* 纯文本状态单元格：彩色文字 + 前导状态点（不改单元格文本） */
td[data-ui-tone] { font-weight: 650; white-space: nowrap; }
td[data-ui-tone]::before {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 7px;
  content: "";
  border-radius: 50%;
  vertical-align: 1px;
}
td[data-ui-tone="ok"] { color: #047857; }
td[data-ui-tone="ok"]::before { background: #10b981; box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.16); }
td[data-ui-tone="warn"] { color: #b45309; }
td[data-ui-tone="warn"]::before { background: #f59e0b; box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.18); }
td[data-ui-tone="bad"] { color: #b91c1c; }
td[data-ui-tone="bad"]::before { border-radius: 1px; background: #dc2626; transform: rotate(45deg); box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.15); }
/* *** 价格打码：磨砂胶囊标签（文本保持 *** 原样） */
.ui-mask-pill, [data-ui-masked="true"] {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 1px 10px 1px 8px;
  border: 1px solid rgba(148, 163, 184, 0.38);
  border-radius: 999px;
  color: #64748b;
  background: linear-gradient(135deg, rgba(248, 250, 252, 0.92), rgba(226, 232, 240, 0.78));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85), 0 1px 2px rgba(15, 23, 42, 0.06);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  font-weight: 700;
  letter-spacing: 0.16em;
  line-height: 1.5;
  white-space: nowrap;
}
.ui-mask-pill { font-size: 12px; }
.ui-mask-pill::before, [data-ui-masked="true"]::before {
  flex: none;
  width: 10px;
  height: 10px;
  content: "";
  background: center / contain no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4' y='11' width='16' height='10' rx='2'/%3E%3Cpath d='M8 11V7a4 4 0 0 1 8 0v4'/%3E%3C/svg%3E");
}

/* ---------- 9. 多级 BOM 成本树：层级缩进引导线 ---------- */
.cost-tree-label { --ui-depth: 0; display: inline-block; background-repeat: no-repeat; background-position: 0 50%; background-size: calc(var(--ui-depth) * 1em) 1.7em; background-image: repeating-linear-gradient(90deg, transparent 0 0.45em, #cbd5e1 0.45em calc(0.45em + 1px), transparent calc(0.45em + 1px) 1em); }
.cost-tree-label[data-depth="0"] { color: #0f172a; font-weight: 700; }
.cost-tree-label[data-depth="1"] { --ui-depth: 1; }
.cost-tree-label[data-depth="2"] { --ui-depth: 2; }
.cost-tree-label[data-depth="3"] { --ui-depth: 3; }
.cost-tree-label[data-depth="4"] { --ui-depth: 4; }
.cost-tree-label[data-depth="5"] { --ui-depth: 5; }
.cost-tree-label[data-depth="6"] { --ui-depth: 6; }
.cost-tree-label[data-depth="7"] { --ui-depth: 7; }
.cost-tree-label[data-depth="8"] { --ui-depth: 8; }

/* B1 工艺路线树（b1-boms.js 运行时注入基础样式，此处以 .bom-view 作用域提升优先级） */
.bom-view .bom-panel { border-color: var(--ui-hairline); border-radius: 12px; box-shadow: var(--ui-shadow-card); }
.bom-view .bom-tree-root { margin: 12px 0; padding: 14px 16px; border: 1px solid var(--ui-hairline); border-radius: 12px; background: #fff; box-shadow: var(--ui-shadow-card); }
.bom-view .bom-tree-node { position: relative; margin: 4px 0 10px; padding-left: 0; border-left: 0; }
.bom-view .bom-tree-children { position: relative; margin: 6px 0 0 11px; padding-left: 20px; border-left: 1px dashed #cbd5e1; }
.bom-view .bom-tree-children > .bom-tree-node::before { position: absolute; top: 17px; left: -20px; width: 16px; content: ""; border-top: 1px dashed #cbd5e1; }
.bom-view .bom-tree-children > .bom-tree-node::after { position: absolute; top: 14px; left: -23px; width: 7px; height: 7px; content: ""; border-radius: 50%; background: #fff; box-shadow: 0 0 0 1.5px #94a3b8; }
.bom-view .bom-tree-head { display: inline-flex; max-width: 100%; align-items: baseline; gap: 10px; padding: 6px 12px; border: 1px solid #e2e8f0; border-radius: 9px; background: #f8fafc; transition: border-color var(--ui-dur) var(--ui-ease), background-color var(--ui-dur) var(--ui-ease); }
.bom-view .bom-tree-head:hover { border-color: #93c5fd; background: #f5f9ff; }
.bom-view .bom-tree-root > .bom-tree-head { border-color: #bfdbfe; background: linear-gradient(180deg, #eff6ff, #f8fbff); }
.bom-view .bom-tree-code { color: #1d4ed8; font-size: 12.5px; font-weight: 700; letter-spacing: 0.02em; }
.bom-view .bom-tree-name { color: #0f172a; font-weight: 600; }
.bom-view .bom-tree-edge { gap: 6px; margin: 10px 0 2px; }
.bom-view .bom-edge-process, .bom-view .bom-edge-qty { padding: 1px 9px; border-radius: 999px; font-size: 11.5px; line-height: 1.6; }
.bom-view .bom-edge-process { color: #475569; background: #f1f5f9; }
.bom-view .bom-edge-qty { color: #1d4ed8; background: #eff6ff; font-weight: 650; }
.bom-view .bom-tree-leaf { margin: 4px 0 2px 2px; color: #94a3b8; font-style: italic; }
.bom-view .bom-tree-leaf::before { content: "◦ "; font-style: normal; }
.bom-view .bom-table-wrap { border: 1px solid var(--ui-hairline); border-radius: 10px; }
.bom-view .bom-table th { position: sticky; top: 0; background: #f8fafc; color: #475569; }
.bom-view .bom-btn { min-height: 38px; border-radius: 8px; font-weight: 600; }
.bom-view .bom-btn-primary { background: linear-gradient(180deg, #3b82f6, #1d4ed8); border-color: #1d4ed8; }
.bom-view .bom-input { min-height: 38px; padding: 7px 10px; border-radius: 8px; }

/* ---------- 10. 登录页：数字孪生网格光影 + 实时健康徽章 + 能力矩阵 ---------- */
body:has(.login-shell) {
  background:
    radial-gradient(ellipse 60% 50% at 0% 0%, rgba(37, 99, 235, 0.08), transparent 60%),
    radial-gradient(ellipse 50% 50% at 100% 100%, rgba(14, 165, 233, 0.07), transparent 60%),
    #f1f5f9;
}
.login-shell { border-color: rgba(15, 23, 42, 0.06); box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 30px 80px rgba(15, 23, 42, 0.16); }
.login-shell .login-brand {
  position: relative;
  z-index: 0;
  overflow: hidden;
  isolation: isolate;
  background:
    radial-gradient(ellipse 60% 45% at 88% 8%, rgba(59, 130, 246, 0.38), transparent 62%),
    radial-gradient(ellipse 55% 40% at 0% 100%, rgba(14, 165, 233, 0.22), transparent 62%),
    linear-gradient(160deg, #0b1120 0%, #0f172a 46%, #172554 100%);
}
.login-shell .login-brand::before {
  position: absolute;
  z-index: -1;
  inset: 0;
  content: "";
  pointer-events: none;
  background-image:
    radial-gradient(circle, rgba(147, 197, 253, 0.55) 1.2px, transparent 1.6px),
    linear-gradient(rgba(148, 163, 184, 0.11) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.11) 1px, transparent 1px),
    linear-gradient(rgba(148, 163, 184, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.05) 1px, transparent 1px);
  background-position: -0.5px -0.5px;
  background-size: 64px 64px, 64px 64px, 64px 64px, 16px 16px, 16px 16px;
  -webkit-mask-image: radial-gradient(ellipse 85% 75% at 65% 35%, #000 25%, transparent 85%);
  mask-image: radial-gradient(ellipse 85% 75% at 65% 35%, #000 25%, transparent 85%);
}
.login-shell .login-brand::after {
  position: absolute;
  z-index: -1;
  top: 0;
  left: 0;
  right: 0;
  height: 140px;
  content: "";
  pointer-events: none;
  background: linear-gradient(180deg, rgba(96, 165, 250, 0) 0%, rgba(96, 165, 250, 0.1) 85%, rgba(165, 243, 252, 0.55) 99%, rgba(165, 243, 252, 0) 100%);
  animation: ui-twin-scan 7.5s cubic-bezier(0.45, 0, 0.55, 1) infinite;
}
.login-brand-top { display: flex; min-width: 0; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 22px; }
.login-brand .brand-mark {
  flex: none;
  margin-bottom: 0;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.05));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 10px 26px rgba(2, 6, 23, 0.4);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
.login-health {
  display: inline-flex;
  min-width: 0;
  max-width: 100%;
  flex: 0 1 auto;
  align-items: center;
  gap: 8px;
  padding: 5px 12px 5px 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  color: #cbd5e1;
  background: rgba(2, 6, 23, 0.38);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
  transition: border-color var(--ui-dur) var(--ui-ease), color var(--ui-dur) var(--ui-ease);
}
.login-health-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.login-health-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: #94a3b8; }
.login-health[data-ui-health="checking"] .login-health-dot { animation: ui-blink 1s ease-in-out infinite; }
.login-health[data-ui-health="ok"] { color: #d1fae5; border-color: rgba(52, 211, 153, 0.32); }
.login-health[data-ui-health="ok"] .login-health-dot { background: #34d399; animation: ui-breathe-green 2.2s ease-in-out infinite; }
.login-health[data-ui-health="degraded"] { color: #fde68a; border-color: rgba(251, 191, 36, 0.4); }
.login-health[data-ui-health="degraded"] .login-health-dot { background: #fbbf24; }
.login-health[data-ui-health="offline"] { color: #fecaca; border-color: rgba(248, 113, 113, 0.4); }
.login-health[data-ui-health="offline"] .login-health-dot { background: #f87171; }
.login-brand .eyebrow { color: #7dd3fc; letter-spacing: 0.16em; font-weight: 600; }
.login-brand .brand-title { color: #f8fafc; font-weight: 750; letter-spacing: -0.02em; }
.login-brand .brand-text { color: #a9b6c9; }
.login-principles { gap: 10px; margin-top: 30px; }
.login-principle {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 3px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  color: #e2e8f0;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.085), rgba(255, 255, 255, 0.025));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  transition: transform var(--ui-dur) var(--ui-ease), border-color var(--ui-dur) var(--ui-ease), background-color var(--ui-dur) var(--ui-ease);
}
.login-principle:hover { transform: translateY(-2px); border-color: rgba(147, 197, 253, 0.38); }
.login-principle-index { color: #60a5fa; font-size: 10.5px; font-weight: 600; letter-spacing: 0.1em; line-height: 1.2; }
.login-principle-title { color: #f8fafc; font-size: 14px; font-weight: 700; line-height: 1.35; }
.login-principle-desc { color: #94a3b8; font-size: 12px; font-weight: 500; line-height: 1.5; }
.login-panel { background: #fff; }
.login-card .eyebrow { font-size: 11px; letter-spacing: 0.16em; }
.login-title { color: #0f172a; font-weight: 760; }
.login-subtitle { font-size: 13.5px; line-height: 1.7; }
.login-card .field label { color: #334155; font-size: 12.5px; font-weight: 650; }
.login-card .form-error:not(:empty) { margin-top: 14px; padding: 9px 12px; border: 1px solid #fecaca; border-radius: 10px; background: #fef2f2; color: #b91c1c; }
#login-username, #login-password {
  min-height: 48px;
  padding-left: 44px;
  border-color: #dbe3ee;
  border-radius: 10px;
  background-color: #fff;
  background-repeat: no-repeat;
  background-position: 15px 50%;
  background-size: 18px 18px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
#login-username { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='8' r='4'/%3E%3Cpath d='M4 21a8 8 0 0 1 16 0'/%3E%3C/svg%3E"); }
#login-password { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4' y='11' width='16' height='10' rx='2'/%3E%3Cpath d='M8 11V7a4 4 0 0 1 8 0v4'/%3E%3C/svg%3E"); }
#login-username:hover, #login-password:hover { border-color: #94a3b8; }
#login-username:focus, #login-password:focus { border-color: #2563eb; background-color: #fff; box-shadow: 0 0 0 1px #2563eb, var(--ui-ring); }
#login-username:focus { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232563eb' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='8' r='4'/%3E%3Cpath d='M4 21a8 8 0 0 1 16 0'/%3E%3C/svg%3E"); }
#login-password:focus { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232563eb' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4' y='11' width='16' height='10' rx='2'/%3E%3Cpath d='M8 11V7a4 4 0 0 1 8 0v4'/%3E%3C/svg%3E"); }
#login-submit {
  min-height: 48px;
  border-color: #0f172a;
  border-radius: 10px;
  background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 1px 2px rgba(15, 23, 42, 0.2), 0 6px 16px rgba(15, 23, 42, 0.18);
  font-size: 15px;
  letter-spacing: 0.08em;
}
#login-submit:hover:not(:disabled) { background: linear-gradient(180deg, #334155 0%, #0f172a 100%); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), 0 2px 4px rgba(15, 23, 42, 0.2), 0 10px 22px rgba(15, 23, 42, 0.22); }
#dingtalk-login-btn {
  position: relative;
  gap: 10px;
  min-height: 52px;
  margin-top: 44px;
  border: 1px solid #0b63f6;
  border-radius: 12px;
  color: #fff;
  background: linear-gradient(135deg, #1a8cff 0%, #0b63f6 55%, #2f54eb 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 2px 4px rgba(11, 99, 246, 0.18), 0 10px 26px rgba(11, 99, 246, 0.3);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
#dingtalk-login-btn::before {
  flex: none;
  width: 22px;
  height: 22px;
  content: "";
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.18) center / 15px 15px no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23ffffff'%3E%3Cpath d='M20.6 9.2c-.3-.7-1.3-1-4.7-2.4C11.4 5 6.8 3.6 4.5 3c-.5-.1-.8.4-.5.8.9 1.1 3.8 3 7.5 4.6-2.9-.6-5.6-1.6-7-2.1-.5-.2-.9.3-.6.7 1.2 1.6 4 3.6 7.6 4.6-2-.1-3.9-.6-4.8-.9-.4-.1-.7.3-.5.7.8 1.4 3.2 3.2 6.6 3.4l-1.4 4.5c-.2.6.5 1 1 .6l7.2-6.6c.7-.6 1.2-1.4 1.3-2.2.1-.9 0-1.3-.3-1.9Z'/%3E%3C/svg%3E");
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22);
}
#dingtalk-login-btn::after {
  position: absolute;
  top: -30px;
  left: 0;
  right: 0;
  content: "或使用钉钉企业身份";
  color: #94a3b8;
  background:
    linear-gradient(#e2e8f0, #e2e8f0) left 50% / calc(50% - 76px) 1px no-repeat,
    linear-gradient(#e2e8f0, #e2e8f0) right 50% / calc(50% - 76px) 1px no-repeat;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.04em;
  line-height: 18px;
  text-align: center;
  pointer-events: none;
}
#dingtalk-login-btn:hover:not(:disabled) {
  color: #fff;
  border-color: #0a58dc;
  background: linear-gradient(135deg, #3399ff 0%, #0b63f6 50%, #2340d0 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28), 0 4px 8px rgba(11, 99, 246, 0.2), 0 14px 32px rgba(11, 99, 246, 0.38);
  transform: translateY(-1px);
}
#dingtalk-login-btn:active:not(:disabled) { transform: translateY(0) scale(0.985); }
#dingtalk-login-btn:focus-visible { outline: 2px solid #0b63f6; outline-offset: 3px; box-shadow: 0 0 0 6px rgba(11, 99, 246, 0.2); }
#dingtalk-login-status { margin-top: 14px; padding: 10px 12px; border: 1px solid #eef2f7; border-radius: 10px; background: #f8fafc; color: #64748b; font-size: 12px; }
@media (max-width: 560px) {
  .login-brand-top { margin-bottom: 14px; }
  .login-health { padding: 4px 10px 4px 8px; font-size: 11px; }
  .login-principles { margin-top: 14px; gap: 7px; }
  .login-principle { padding: 8px 10px; border-radius: 10px; }
  .login-principle-desc { display: none; }
  .login-principle-title { font-size: 13px; }
  #dingtalk-login-btn { margin-top: 40px; min-height: 50px; font-size: 14px; }
}

/* 切换页头的「以实时证据为准」是说明性提示而非阻断结论：用信息蓝，红色只留给真正的 BLOCKED 条目 */
.cutover-header .cutover-badge.cutover-blocked { color: #1d4ed8; background: #eff6ff; border-color: #bfdbfe; box-shadow: none; }
.cutover-header .cutover-badge.cutover-blocked::before { border-radius: 50%; background: #3b82f6; transform: none; }
/* 路由切换后程序化聚焦主内容区：保留可见但更克制的内描边，避免整页虚线框干扰阅读 */
.content:focus-visible { outline: 2px solid rgba(37, 99, 235, 0.28); outline-offset: -2px; }

/* ---------- 11. 关键帧与无障碍降级 ---------- */
@keyframes ui-breathe-green {
  0%, 100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.5); }
  60% { box-shadow: 0 0 0 5px rgba(16, 185, 129, 0); }
}
@keyframes ui-blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }
@keyframes ui-twin-scan {
  0% { transform: translateY(-140px); opacity: 0; }
  12% { opacity: 1; }
  88% { opacity: 1; }
  100% { transform: translateY(760px); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .login-shell .login-brand::after { animation: none; opacity: 0; }
  .system-status::before, .login-health-dot, .badge::before, .sales-badge::before, .cutover-badge::before, [data-ui-tone]::before { animation: none !important; }
  .nav-link, .card, .card:hover, .stat-card:hover, .kpi-card:hover, .login-principle:hover, .btn, .tab, #dingtalk-login-btn:hover:not(:disabled) { transition: none !important; transform: none !important; }
  .table tbody tr, .data-table tbody tr, table tbody tr { transition: none; }
}
@media print {
  [data-ui-scroll] { -webkit-mask-image: none !important; mask-image: none !important; }
  td[data-ui-tone]::before, .ui-mask-pill::before, [data-ui-masked="true"]::before { display: none; }
}

/* FIX-R11B: contain intrinsic table/form widths, keep horizontal access inside tables. */
.ui-table-viewport { max-width: 100%; min-width: 0; overflow-x: auto; -webkit-overflow-scrolling: touch; }
@media (max-width: 820px) {
  .content :where(section, article, form, fieldset, .panel, .card, .form-grid, .table-wrap, .table-scroll) {
    min-width: 0; max-width: 100%;
  }
  .content :where(input, select, textarea) { min-width: 0; max-width: 100%; }
  .content :where(pre, p, dd, h1, h2, h3, h4, label) { overflow-wrap: anywhere; }
  .content pre { white-space: pre-wrap; min-width: 0; max-width: 100%; }
  .content fieldset { margin-inline: 0; }
  .content .form-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 820px) {
  .content .cutover-root { width: 100%; min-width: 0; max-width: 100%; }
  .content .ui-table-viewport { width: 100%; max-width: 100%; }
}
@media (max-width: 820px) {
  .content .form-actions .btn { max-width: 100%; min-width: 0; white-space: normal; overflow-wrap: anywhere; }
  #operation-logs-body { min-width: 0; max-width: 100%; overflow-x: auto; }
}
