/* ============================================================
   装修业务工作台 · Task9 方向 A「精工控制台」设计系统
   冻结 token：冷灰、精确、信号、密度、秩序、专业工程感
   （docs/TASK9_PRECISION_CONSOLE_UI_V1.md §2.1）
   ============================================================ */

:root {
  --bg: #F6F8FA;
  --card: #FFFFFF;
  --border: #E2E8F0;
  --border-strong: #CBD5E1;
  --ink: #0F172A;
  --ink-2: #334155;
  --muted: #64748B;
  --faint: #61708A;

  --brand: #2563EB;
  --brand-ink: #1D4ED8;
  --brand-soft: #EFF6FF;
  --brand-line: #BFDBFE;

  --ok: #15803D;
  --ok-bg: #F0FDF4;
  --ok-line: #BBF7D0;
  --warn: #B45309;
  --warn-bg: #FFFBEB;
  --warn-line: #FDE68A;
  --bad: #B91C1C;
  --bad-bg: #FEF2F2;
  --bad-line: #FECACA;
  --neutral-bg: #F1F5F9;

  --radius: 6px;
  --radius-card: 8px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
  --shadow-card: 0 1px 2px rgba(15, 23, 42, .04), 0 8px 24px rgba(15, 23, 42, .06);

  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
.num, .kpi-value, .money, td.r, th.r, .summary-table td:last-child {
  font-variant-numeric: tabular-nums;
}
.num, td.r, th.r { text-align: right; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; font-weight: 700; margin: 0; letter-spacing: .2px; }
h2 { font-size: 15px; font-weight: 650; margin: 0 0 10px; }
h3 { font-size: 14px; }
.muted { color: var(--muted); }
.muted-small { color: var(--muted); font-size: 13px; font-weight: normal; }
.code { font-family: ui-monospace, Menlo, monospace; color: var(--muted); font-size: 12.5px; }

/* 统一焦点：键盘 Tab 焦点环可见（§9.3） */
:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 1px;
  border-radius: 4px;
}

/* ================= 应用壳（§3.1） ================= */
.shell { display: flex; min-height: 100vh; }

.side {
  width: 216px; flex: none;
  background: var(--card);
  border-right: 1px solid var(--border);
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  overflow-y: auto;
}
.side-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 18px 14px;
  border-bottom: 1px solid var(--border);
}
.logo {
  width: 26px; height: 26px; border-radius: 7px; flex: none;
  background: var(--brand);
  display: flex; align-items: center; justify-content: center;
}
.logo svg { display: block; }
.logo-sm { width: 24px; height: 24px; border-radius: 6px; }
.side-brand .t1 { font-size: 14px; font-weight: 650; letter-spacing: .2px; white-space: nowrap; }
.side-brand .t2 { font-size: 11px; color: var(--faint); margin-top: -1px; white-space: nowrap; }

.side-nav { padding: 10px 10px 0; }
.side-nav .grp {
  font-size: 11px; color: var(--faint); letter-spacing: .8px;
  padding: 12px 10px 5px;
}
.side-nav a {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px; margin: 1px 0;
  border-radius: var(--radius);
  color: var(--ink-2); font-size: 13.5px;
  border-left: 3px solid transparent;
  white-space: nowrap;
}
.side-nav a:hover { background: var(--neutral-bg); text-decoration: none; }
.side-nav a.on {
  background: var(--brand-soft);
  color: var(--brand-ink); font-weight: 600;
  border-left-color: var(--brand);
}
.side-nav a .ic { width: 15px; height: 15px; flex: none; opacity: .75; }

/* 身份区固定侧栏底部（§3.1、§4-1、§4-5） */
.side-id {
  margin-top: auto;
  border-top: 1px solid var(--border);
  padding: 12px 14px 14px;
  display: flex; align-items: center; gap: 10px;
}
.avatar {
  width: 30px; height: 30px; border-radius: 50%; flex: none;
  background: #E0E7FF; color: #3730A3;
  font-size: 12px; font-weight: 650;
  display: flex; align-items: center; justify-content: center;
}
.avatar-sm { width: 24px; height: 24px; font-size: 11px; }
.side-id .who { min-width: 0; flex: 1; }
.side-id .who .n {
  font-size: 13px; font-weight: 600; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.side-id .who .r { font-size: 11px; color: var(--muted); white-space: nowrap; }
.side-id .id-acts {
  display: flex; flex-direction: column; align-items: flex-end; gap: 4px;
  flex: none;
}
.side-id .id-acts a, .side-id .id-acts .linklike {
  font-size: 12px; color: var(--muted); white-space: nowrap;
}
.side-id .id-acts a:hover, .side-id .id-acts .linklike:hover { color: var(--brand-ink); }

.main { flex: 1; min-width: 0; padding: 0 32px 64px; }
.page { max-width: 1180px; margin: 0 auto; }

/* 手机顶栏（仅 ≤860px 显示） */
.topbar { display: none; }

/* ================= 页头（§3.1） ================= */
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; padding: 24px 0 18px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}
.page-head h1 { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.crumbs { font-size: 12px; color: var(--faint); margin-bottom: 6px; }
.crumbs b { color: var(--faint); font-weight: 500; }
.page-head .sub { color: var(--faint); font-size: 13px; margin-top: 5px; }
/* R1 修复（§9.3）：#64748B 在页面底色 #F6F8FA 上仅 4.48:1（不足 4.5），
   白卡上 4.77:1 达标。凡直接落在页面底色上的辅助文字统一改用
   --faint #61708A（对 #F6F8FA 为 4.71:1）；白卡/tinted 容器内不变。 */
.page-head .sub .sep { color: var(--faint); margin: 0 8px; }
/* 页头/窄页/动作区/看板分组落在页面底色上，其内的辅助文字同样使用 --faint。 */
.page-head .muted, .page-head .muted-small,
.page-narrow > .muted, .page-narrow > .muted-small,
.action-panel .muted, .board-region .muted {
  color: var(--faint);
}
.head-actions { display: flex; gap: 10px; align-items: center; flex: none; flex-wrap: wrap; }
/* 区块内嵌的次级页头（如项目详情「进度时间线」） */
.card-section > .page-head, .page-head.compact {
  padding: 0 0 10px; border-bottom: none; margin-bottom: 10px;
}

/* ================= 按钮 ================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 36px; padding: 0 15px;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: var(--card); color: var(--ink-2);
  font-size: 13.5px; font-weight: 550; font-family: var(--font);
  line-height: 1.4;
  cursor: pointer; white-space: nowrap; text-decoration: none;
}
.btn:hover { background: var(--neutral-bg); text-decoration: none; }
.btn-primary {
  background: var(--brand); border-color: var(--brand); color: #fff;
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover { background: var(--brand-ink); }
.btn-primary:disabled {
  background: #93C5FD; border-color: #93C5FD; cursor: not-allowed;
}
.btn-small { min-height: 30px; padding: 0 11px; font-size: 12.5px; }
.btn-danger { color: var(--bad); border-color: var(--bad-line); }
.btn-danger:hover { background: var(--bad-bg); }
.btn .ic { width: 14px; height: 14px; }
.linklike {
  background: none; border: none; padding: 0; color: var(--muted);
  font-size: 12px; cursor: pointer; font-family: var(--font);
}
.linklike:hover { text-decoration: underline; color: var(--brand-ink); }

/* ================= 状态表达（文字+颜色双通道 §9.3） ================= */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 22px; padding: 0 10px;
  border-radius: 999px;
  font-size: 12px; font-weight: 550; white-space: nowrap;
  border: 1px solid transparent;
}
.pill .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.pill-ok   { color: var(--ok);   background: var(--ok-bg);   border-color: var(--ok-line); }
.pill-warn { color: var(--warn); background: var(--warn-bg); border-color: var(--warn-line); }
.pill-bad  { color: var(--bad);  background: var(--bad-bg);  border-color: var(--bad-line); }
.pill-mut  { color: var(--faint); background: var(--neutral-bg); border-color: var(--border); }
.pill-info { color: var(--brand-ink); background: var(--brand-soft); border-color: var(--brand-line); }

/* 既有 tag 钩子（草稿/锁定/匹配状态）统一为信号药丸 */
.tag {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 22px; padding: 0 10px; border-radius: 999px;
  font-size: 12px; font-weight: 550; white-space: nowrap;
  background: var(--neutral-bg); color: var(--ink-2);
  border: 1px solid var(--border);
}
.tag-draft { color: var(--warn); background: var(--warn-bg); border-color: var(--warn-line); }
.tag-final { color: var(--ok); background: var(--ok-bg); border-color: var(--ok-line); }
.tag-ok { color: var(--ok); background: var(--ok-bg); border-color: var(--ok-line); }
.tag-warn { color: var(--warn); background: var(--warn-bg); border-color: var(--warn-line); }

/* ================= 横幅与闪存消息 ================= */
.flash {
  padding: 10px 14px; border-radius: var(--radius); margin-bottom: 14px;
  border: 1px solid; font-size: 13.5px;
}
.flash-success { background: var(--ok-bg); border-color: var(--ok-line); color: var(--ok); }
.flash-error { background: var(--bad-bg); border-color: var(--bad-line); color: var(--bad); }
.flash-info { background: var(--brand-soft); border-color: var(--brand-line); color: var(--brand-ink); }
.banner {
  padding: 10px 14px; border-radius: var(--radius); margin: 10px 0 16px;
  border: 1px solid; font-size: 13.5px;
}
.banner ul { margin: 6px 0 0; padding-left: 20px; }
.banner-warn { background: var(--warn-bg); border-color: var(--warn-line); color: #78350F; }
.banner-error { background: var(--bad-bg); border-color: var(--bad-line); color: var(--bad); }
.banner-ok { background: var(--ok-bg); border-color: var(--ok-line); color: var(--ok); }
.banner-info { background: var(--brand-soft); border-color: var(--brand-line); color: var(--brand-ink); }

/* ================= 管理员永久删除项目 ================= */
.deletion-impact { margin-top: 12px; }
.deletion-impact strong { font-size: 20px; }
.deletion-retained { margin: 14px 0 0; }
.danger-zone { border-top: 3px solid var(--bad); }
.delete-project-form { margin-top: 14px; padding: 0; box-shadow: none; border: 0; }
.delete-project-form label { display: block; margin-bottom: 6px; font-weight: 600; }
.delete-project-form input[type="text"] { width: 100%; }
.delete-project-form .hint-muted { margin: 7px 0 16px; color: var(--faint); }
.delete-submit { min-height: 40px; }

/* ================= 卡片与区块 ================= */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; margin-top: 16px; }
.card {
  display: block; background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-card); padding: 16px; color: inherit;
  box-shadow: var(--shadow-sm);
}
a.card:hover { border-color: var(--brand); text-decoration: none; }
.card h2 { margin-bottom: 6px; }
.card p { color: var(--muted); margin: 0 0 10px; }
.card-go { color: var(--brand); font-size: 13px; }
.card-disabled { opacity: .75; }
.placeholder {
  background: var(--card); border: 1px dashed var(--border-strong);
  border-radius: var(--radius-card);
  padding: 34px; text-align: center; color: var(--muted); margin-top: 14px;
}
.card-section {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-card); padding: 16px 18px; margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}
.sec-title {
  display: flex; align-items: baseline; gap: 10px;
  margin: 26px 0 12px;
}
.sec-title h2 { font-size: 15px; font-weight: 650; margin: 0; }
.sec-title .note { font-size: 12.5px; color: var(--faint); }
.sec-title .count {
  font-size: 12px; font-weight: 650; color: var(--bad);
  background: var(--bad-bg); border-radius: 999px; padding: 1px 8px;
}

/* ================= 表单（§3.5：label/控件/hint/错误/禁用/焦点统一） ================= */
.form-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-card); padding: 18px 20px; max-width: 560px;
  box-shadow: var(--shadow-sm);
}
.form-row { margin-bottom: 14px; }
.form-row label, .form-card > label {
  display: block; margin: 12px 0 6px; font-size: 13px; font-weight: 600;
  color: var(--ink-2);
}
.form-row label { margin: 0 0 6px; }
.form-row input[type="text"], .form-row input[type="date"], .form-row input[type="password"],
.form-row select, .form-row textarea,
.form-card input[type="text"], .form-card input[type="password"], .form-card select {
  width: 100%; min-height: 38px; padding: 7px 11px;
  border: 1px solid var(--border-strong); border-radius: var(--radius);
  font-size: 14px; font-family: var(--font); color: var(--ink);
  background: #fff;
}
.form-card input, .form-card select { max-width: 420px; }
.form-row input:focus, .form-row select:focus, .form-row textarea:focus,
.form-card input:focus, .form-card select:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
input:disabled, select:disabled, textarea:disabled {
  background: var(--neutral-bg); color: var(--muted); cursor: not-allowed;
}
/* §4-4：hint 必须位于控件下方并 display:block */
.form-row small, .form-card small, .v2-field small {
  display: block; margin-top: 5px; color: var(--muted);
  font-size: 12.5px; line-height: 1.45;
}
.req { color: var(--bad); }
textarea.wide {
  width: 100%; padding: 8px 11px; border: 1px solid var(--border-strong);
  border-radius: var(--radius); font-size: 14px; font-family: var(--font);
  resize: vertical; color: var(--ink); background: #fff;
}
textarea.wide:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
.form-actions { margin-top: 14px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

/* 修改密码页：确认密码输入框与提交按钮保留清晰呼吸空间。
   clamp 让手机保持紧凑、桌面适度放宽，不影响其他表单按钮。 */
.password-form .password-submit {
  margin-top: clamp(18px, 2.2vw, 24px);
}
.check-line { display: block; margin: 10px 0; font-size: 13.5px; }
.check-line input { margin-right: 6px; }
select, .input-num {
  padding: 5px 8px; border: 1px solid var(--border-strong);
  border-radius: var(--radius); font-size: 13px; font-family: var(--font);
  background: #fff; color: var(--ink);
}
.input-num { width: 96px; text-align: right; font-variant-numeric: tabular-nums; }
.form-subsection + .form-subsection {
  border-top: 1px solid var(--border); margin-top: 18px; padding-top: 18px;
}
.form-subsection > h2 { font-size: 16px; margin-bottom: 6px; }

/* 客户识别（Task5A） */
.customer-selection-status {
  padding: 9px 11px; border: 1px solid var(--border-strong); border-radius: var(--radius);
  background: var(--bg); color: var(--faint); font-size: 13px;
}
.customer-selection-status.is-selected { background: var(--ok-bg); border-color: var(--ok-line); color: var(--ok); }
.customer-selection-status.is-creating { background: var(--brand-soft); border-color: var(--brand-line); color: var(--brand-ink); }
.customer-match-panel {
  margin-top: 10px; padding: 10px; border: 1px solid var(--brand-line);
  border-radius: var(--radius); background: var(--brand-soft);
}
.customer-match-list { display: grid; gap: 7px; margin-top: 8px; }
.customer-match-item {
  width: 100%; padding: 8px 10px; text-align: left; border: 1px solid var(--border);
  border-radius: var(--radius); background: #fff; color: var(--ink); cursor: pointer;
  font-family: var(--font);
}
.customer-match-item:hover { border-color: var(--brand); background: var(--brand-soft); }
.customer-match-item span, .customer-match-item small { display: block; }
.customer-match-item small { margin-top: 2px; color: var(--muted); }
.customer-choice-actions { margin-top: 8px; }

/* 详情栅格 */
.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(220px, 1fr)); gap: 14px 24px; }
.detail-grid > div { display: flex; flex-direction: column; gap: 4px; }
.detail-grid .detail-wide { grid-column: 1 / -1; }

/* ================= 表格 ================= */
.table { width: 100%; border-collapse: collapse; background: var(--card); }
.table th, .table td {
  border-bottom: 1px solid var(--border); padding: 9px 12px;
  text-align: left; vertical-align: top; font-size: 13.5px;
}
.table thead th {
  font-size: 12px; font-weight: 600; color: var(--muted);
  white-space: nowrap; border-bottom: 1px solid var(--border);
}
.table tbody tr:hover td { background: #F8FAFC; }
.table tr:last-child td { border-bottom: none; }
.table-dense th, .table-dense td { padding: 7px 9px; font-size: 13px; }
.row-attention { background: var(--warn-bg); }
.row-attention:hover { background: #FEF3C7; }
.row-needs-input { background: var(--bg); }
.row-needs-input:hover { background: var(--brand-soft); }
/* 局部横向滚动容器（§3.5：宽表只在容器内滚动，不撑宽 document） */
.tbl-scroll {
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  max-width: 100%;
}
.draft-table { min-width: 1050px; }
.ops { white-space: nowrap; }
.inline { display: inline; }
.addable { margin-top: 12px; }
.addable summary { cursor: pointer; color: var(--brand); margin-bottom: 8px; }
.ai-details, .unmatched-details { margin-top: 12px; }
.ai-details > summary, .unmatched-details > summary,
.gate-summary summary { cursor: pointer; color: var(--brand); }
.ai-details h3 { font-size: 14px; margin: 14px 0 6px; }
.gate-summary details { margin-top: 8px; }
.unmatched-list { margin: 8px 0 0; padding-left: 20px; }
.pending-card { border-left: 4px solid var(--warn-line); border-radius: var(--radius); padding: 10px 14px; margin-bottom: 10px; }
.pending-card:hover { background: var(--warn-bg); }
.pending-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.pending-card details { margin: 8px 0; }
.pending-card details summary { cursor: pointer; color: var(--brand); margin-bottom: 8px; }
.evidence { color: var(--warn); font-size: 12px; margin-top: 3px; }
.original-text { color: var(--muted); font-size: 12px; margin-top: 3px; }
.qty-hint { color: var(--warn); font-size: 11.5px; line-height: 1.35; margin-top: 3px; min-width: 150px; }

/* 汇总表（金额右对齐、层级清楚 §3.4） */
.summary-table { max-width: 460px; }
.summary-table td:first-child { color: var(--muted); }
.summary-table td:last-child { text-align: right; font-weight: 550; }
.summary-table .grand td {
  font-weight: 700; font-size: 15px;
  border-top: 2px solid var(--ink); color: var(--ink);
}

/* 账号管理宽表（Task8 R3 冻结锚点：局部滚动 + min-width） */
.data-table-scroll {
  width: 100%; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-card); box-shadow: var(--shadow-sm);
}
.data-table { width: 100%; min-width: 760px; border-collapse: collapse; background: var(--card); }
.data-table th, .data-table td {
  border-bottom: 1px solid var(--border); padding: 9px 12px;
  text-align: left; font-size: 13px; vertical-align: middle;
  /* §9.3：账号/姓名/角色/状态不逐字竖排；超宽由局部滚动承担 */
  white-space: nowrap;
}
.data-table th {
  background: var(--card); font-size: 12px; font-weight: 600;
  color: var(--muted); white-space: nowrap;
}
.data-table tr:last-child td { border-bottom: none; }
.row-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.inline-form { display: inline; }

/* ================= Task5B：21 项确认卡 ================= */
.v2-overview { display: grid; grid-template-columns: repeat(4, minmax(150px, 1fr)); gap: 14px; align-items: end; }
.v2-overview > div { display: flex; flex-direction: column; gap: 4px; }
.v2-tier-form { display: flex; align-items: end; gap: 7px; flex-wrap: wrap; }
.v2-tier-form label { width: 100%; }
.v2-card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(430px, 1fr)); gap: 14px; margin-bottom: 16px; }
.v2-rule-card {
  background: var(--card); border: 1px solid var(--border);
  border-left: 4px solid #D97706;
  border-radius: var(--radius-card); padding: 14px 16px;
  box-shadow: var(--shadow-sm);
}
.v2-rule-card.is-resolved { border-left-color: var(--ok); }
.v2-rule-card header { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-bottom: 10px; }
.v2-card-index {
  display: inline-grid; place-items: center; width: 24px; height: 24px;
  margin-right: 7px; border-radius: 50%;
  background: var(--brand); color: #fff; font-size: 12px;
}
.v2-rule-hint, .v2-rule-calc { font-size: 12px; line-height: 1.55; padding: 7px 9px; border-radius: 5px; margin-bottom: 7px; }
.v2-rule-hint { background: var(--bg); }
.v2-rule-calc { background: var(--brand-soft); color: var(--brand-ink); }
.v2-fields { display: grid; grid-template-columns: repeat(2, minmax(150px, 1fr)); gap: 9px 12px; margin: 12px 0; }
.v2-field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; }
.v2-field input:not([type="checkbox"]), .v2-field select {
  width: 100%; padding: 6px 8px; border: 1px solid var(--border-strong);
  border-radius: var(--radius); font-family: var(--font);
}
.v2-field em { color: var(--bad); font-style: normal; }
.v2-checkbox { flex-direction: row; align-items: center; padding-top: 22px; }
.v2-card-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.v2-bulk-confirm {
  display: flex; justify-content: space-between; gap: 20px;
  align-items: center; border-color: var(--brand-line);
}
.v2-bulk-confirm h3 { margin: 0 0 7px; }
.v2-bulk-confirm p { margin: 0 0 7px; max-width: 880px; }
.v2-bulk-actions { display: flex; flex: 0 1 520px; flex-direction: column; gap: 14px; }
.v2-bulk-actions form { display: flex; justify-content: flex-end; }
.v2-bulk-feedback { margin: 0; }
.v2-row-feedback { margin: 0; }

/* ================= Task7B 项目进度看板（§3.3） ================= */
/* 6 指标卡：统一信号色与数字层级（DOM 保持 metric-value 紧邻 metric-label） */
.board-metrics {
  display: grid; grid-template-columns: repeat(6, 1fr);
  gap: 12px; margin-bottom: 18px;
}
.board-metric {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-card); padding: 12px 14px 11px;
  box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; gap: 2px;
}
.board-metric .metric-value {
  font-size: 26px; font-weight: 680; line-height: 1.25;
  letter-spacing: .2px; font-variant-numeric: tabular-nums;
}
.board-metric .metric-label {
  order: -1;
  color: var(--muted); font-size: 12px; font-weight: 500;
}
.board-metric.metric-warn { border-left: 3px solid #D97706; }
.board-metric.metric-warn .metric-value { color: var(--warn); }
.board-metric.metric-bad { border-left: 3px solid #DC2626; }
.board-metric.metric-bad .metric-value { color: var(--bad); }

.board-filters {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-card); padding: 12px 14px; margin-bottom: 18px;
  display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end;
  box-shadow: var(--shadow-sm);
}
.board-filters label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.board-filters input[type="text"], .board-filters select {
  min-height: 34px; padding: 5px 9px; border: 1px solid var(--border-strong);
  border-radius: var(--radius); font-size: 13px; font-family: var(--font);
  background: #fff;
}
.board-filters .filter-check {
  display: flex; align-items: center; gap: 5px;
  padding-bottom: 8px; font-size: 13px; color: var(--ink-2);
}

.board-region { margin-bottom: 22px; }
.board-region > h2 { font-size: 15px; margin-bottom: 10px; font-weight: 650; }
.board-region.region-tbd > h2 { color: var(--warn); }
.board-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }

/* 风险卡（需优先处理/分组卡共用，展示字段不删减 §3.3） */
.progress-card {
  background: var(--card); border: 1px solid var(--border);
  border-left: 4px solid var(--border-strong);
  border-radius: var(--radius-card); padding: 14px 16px 13px;
  box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; gap: 9px;
}
.progress-card.pc-priority { border-left-color: #DC2626; }
.progress-card.pc-warn { border-left-color: #D97706; }
.progress-card .pc-title { font-size: 14.5px; font-weight: 650; }
.progress-card .pc-title .muted-small { font-weight: 500; font-size: 12.5px; margin-left: 6px; }
.progress-card .pc-line { font-size: 12.5px; color: var(--ink-2); }
.progress-card .pc-line .muted { margin-right: 6px; color: var(--faint); }
.progress-card .pc-actions { display: flex; gap: 8px; margin-top: auto; flex-wrap: wrap; }

.hint-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.hint-tag {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 550; padding: 1px 9px;
  min-height: 20px; border-radius: 999px; border: 1px solid;
  white-space: nowrap;
}
.hint-bad { background: var(--bad-bg); border-color: var(--bad-line); color: var(--bad); }
.hint-warn { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn); }
.hint-info { background: var(--brand-soft); border-color: var(--brand-line); color: var(--brand-ink); }
.hint-muted { background: var(--neutral-bg); border-color: var(--border); color: var(--faint); }

.condition-normal { color: var(--ok); }
.condition-at_risk { color: var(--warn); font-weight: 600; }
.condition-unable { color: var(--bad); font-weight: 600; }

.priority-section { margin-bottom: 22px; }
.priority-section > h2 { font-size: 15px; margin-bottom: 10px; font-weight: 650; }

.progress-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 8px; }

/* 八段施工阶段轨道（纯展示；状态映射只来自服务端 §3.3） */
.track { display: flex; align-items: flex-start; }
.track .st { flex: 1; min-width: 0; position: relative; text-align: center; }
.track .st::before {
  content: ""; position: absolute; top: 4px; left: -50%; right: 50%;
  height: 2px; background: var(--border-strong);
}
.track .st:first-child::before { display: none; }
.track .st .pt {
  width: 9px; height: 9px; border-radius: 50%;
  background: #fff; border: 2px solid var(--border-strong);
  margin: 0 auto; position: relative; z-index: 1;
}
.track .st .lb {
  display: block; font-size: 10px; color: var(--faint);
  margin-top: 5px; white-space: nowrap;
}
.track .st.done::before { background: var(--brand); }
.track .st.done .pt { background: var(--brand); border-color: var(--brand); }
.track .st.done .lb { color: var(--muted); }
.track .st.cur::before { background: var(--brand); }
.track .st.cur .pt {
  background: #fff; border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
  width: 11px; height: 11px; margin-top: -1px;
}
.track .st.cur .lb { color: var(--brand-ink); font-weight: 650; }
.track-compact { min-width: 130px; }

/* 看板分组高密度表（§3.3 桌面；手机转卡片） */
.tbl-wrap {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-card); box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.tbl-zone {
  padding: 10px 16px; font-size: 12.5px; font-weight: 650; color: var(--ink-2);
  background: var(--neutral-bg); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 8px;
}
.tbl-zone .n { color: var(--faint); font-weight: 500; }
table.tbl { width: 100%; border-collapse: collapse; }
.tbl th {
  text-align: left; font-size: 12px; font-weight: 600; color: var(--muted);
  padding: 9px 12px; border-bottom: 1px solid var(--border);
  white-space: nowrap; background: var(--card);
}
.tbl td {
  padding: 11px 12px; border-bottom: 1px solid var(--border);
  font-size: 13.5px; vertical-align: middle;
}
.tbl tr:last-child td { border-bottom: none; }
.tbl tbody tr:hover td { background: #F8FAFC; }
.tbl .r { text-align: right; }
.tbl .c { text-align: center; }
.tbl .pname { font-weight: 600; color: var(--ink); white-space: nowrap; }
.tbl .pname:hover { color: var(--brand-ink); }
.tbl .sub2 { font-size: 12px; color: var(--faint); }
.owner-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; white-space: nowrap; }
.owner-chip .av {
  width: 20px; height: 20px; border-radius: 50%;
  background: #E0E7FF; color: #3730A3;
  font-size: 10px; font-weight: 650;
  display: inline-flex; align-items: center; justify-content: center;
}
.due-bad { color: var(--bad); font-weight: 600; }
.due-warn { color: var(--warn); font-weight: 600; }

/* 时间线 */
.timeline { list-style: none; margin: 8px 0 0; padding: 0; border-left: 2px solid var(--border-strong); }
.timeline li { padding: 8px 0 8px 16px; position: relative; }
.timeline li::before {
  content: ""; position: absolute; left: -5px; top: 14px;
  width: 8px; height: 8px; border-radius: 50%; background: var(--brand);
}
.timeline .tl-head { font-size: 13px; }
.timeline .tl-note { font-size: 13px; color: var(--ink-2); margin-top: 2px; white-space: pre-wrap; }
.timeline .tl-error { color: var(--bad); font-weight: 600; }
.timeline .tl-time { color: var(--muted); font-size: 12px; }
.timeline-actor { color: var(--muted); font-size: 12px; }

.progress-edit-form { max-width: 640px; }
.action-panel { border-top: 1px solid var(--border); margin-top: 20px; padding-top: 16px; }
.action-panel h2 { font-size: 15px; }

/* ================= 报价正式单据层级（§3.4） ================= */
.doc-head {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 0;
  border: 1px solid var(--border); border-radius: 8px 8px 0 0;
  background: var(--card); border-bottom: none;
  box-shadow: var(--shadow-sm);
}
.doc-head .cell { padding: 13px 18px; border-right: 1px solid var(--border); }
.doc-head .cell:nth-child(3n) { border-right: none; }
.doc-head .cell:nth-child(-n+3) { border-bottom: 1px solid var(--border); }
.doc-head .k { font-size: 11.5px; color: var(--faint); margin-bottom: 3px; }
.doc-head .v { font-size: 13.5px; font-weight: 600; color: var(--ink-2); }
.doc-head .v.num { text-align: left; }

.hero {
  display: flex; align-items: center; gap: 28px;
  background: var(--card);
  border: 1px solid var(--border); border-bottom: none;
  padding: 20px 22px;
}
.hero .amt .k { font-size: 12px; color: var(--muted); }
.hero .amt .v {
  font-size: 34px; font-weight: 700; letter-spacing: .3px;
  font-variant-numeric: tabular-nums;
}
.hero .amt .v .cur { font-size: 18px; color: var(--muted); font-weight: 600; margin-right: 4px; }
.hero .upper {
  margin-left: auto; max-width: 430px;
  border: 1px solid var(--brand-line); background: var(--brand-soft);
  border-radius: var(--radius); padding: 10px 14px;
}
.hero .upper .k { font-size: 11px; color: var(--brand-ink); opacity: .8; }
.hero .upper .v { font-size: 15px; font-weight: 650; color: var(--brand-ink); letter-spacing: 1px; }

.doc-body {
  background: var(--card);
  border: 1px solid var(--border); border-bottom: none;
  padding: 6px 0 0;
}
.doc-sec {
  padding: 14px 22px 4px;
  font-size: 13px; font-weight: 700; color: var(--ink-2);
  display: flex; align-items: center; gap: 10px;
  white-space: nowrap;
}
.doc-sec .line { flex: 1; height: 1px; background: var(--border); }
.doc-sec .tag { font-size: 11px; color: var(--faint); font-weight: 500; border: none; background: none; padding: 0; }

table.lineitems { width: 100%; border-collapse: collapse; min-width: 620px; }
.lineitems th {
  font-size: 11.5px; color: var(--faint); font-weight: 600; text-align: left;
  padding: 8px 12px; border-bottom: 1px solid var(--border);
}
.lineitems td { padding: 9px 12px; font-size: 13px; border-bottom: 1px solid #F1F5F9; }
.lineitems .grp td {
  background: #F8FAFC; font-weight: 650; color: var(--ink-2);
  border-bottom: 1px solid var(--border); font-size: 12.5px;
}
.lineitems .grp td .no { color: var(--faint); font-weight: 500; margin-right: 8px; }
.lineitems .sub td { font-weight: 650; border-bottom: 1px solid var(--border); background: var(--card); }
.lineitems .sub td .sub-lb { font-size: 12px; color: var(--muted); font-weight: 550; }
.lineitems td.r, .lineitems th.r { text-align: right; }
.lineitems .memo { color: var(--faint); font-size: 12px; }

.summary { display: flex; justify-content: flex-end; padding: 18px 22px 20px; }
.summary .summary-table { width: 420px; max-width: 100%; }

.doc-foot {
  background: var(--card);
  border: 1px solid var(--border); border-top: none;
  border-radius: 0 0 8px 8px;
  box-shadow: var(--shadow-sm);
  padding: 12px 22px 14px;
  font-size: 12px; color: var(--muted);
  display: flex; gap: 24px; flex-wrap: wrap;
}

/* ================= 登录与鉴权页（§3.2） ================= */
.auth {
  min-height: 100vh;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 40px 20px;
}
.auth-hero { text-align: center; margin-bottom: 22px; }
.auth-hero .logo {
  width: 46px; height: 46px; border-radius: 12px; margin: 0 auto 13px;
  box-shadow: 0 4px 16px rgba(37, 99, 235, .30);
}
.auth-hero .logo svg { width: 25px; height: 25px; }
.auth-title { font-size: 21px; font-weight: 700; letter-spacing: .5px; }
.auth-sub { font-size: 12px; color: var(--faint); margin-top: 6px; }
.auth-card {
  width: 400px; max-width: 100%;
  background: var(--card);
  border: 1px solid var(--border);
  border-top: 3px solid var(--brand);
  border-radius: 12px;
  box-shadow: var(--shadow-card);
  padding: 24px 36px 28px;
}
.auth-mods {
  display: flex; justify-content: space-between; gap: 8px;
  padding-bottom: 15px; margin-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.auth-mods span {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px; color: var(--muted); white-space: nowrap;
}
.auth-mods svg { width: 13px; height: 13px; color: var(--faint); flex: none; }
.auth-error {
  background: var(--bad-bg); border: 1px solid var(--bad-line); color: var(--bad);
  border-radius: var(--radius); padding: 8px 12px; margin: 12px 0 2px; font-size: 13px;
}
.auth-form label {
  display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-2);
  margin: 14px 0 6px;
}
.auth-form .fld { position: relative; }
.auth-form input {
  width: 100%; height: 42px;
  padding: 0 12px; font-size: 14.5px; font-family: var(--font);
  border: 1px solid var(--border-strong); border-radius: var(--radius);
  color: var(--ink); background: #fff;
}
.auth-form input:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
.auth-form .fld .peek {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  height: 30px; padding: 0 10px;
  border: none; background: transparent; border-radius: 5px;
  font-size: 12px; color: var(--muted); cursor: pointer; font-family: var(--font);
}
.auth-form .fld .peek:hover { background: var(--neutral-bg); color: var(--ink-2); }
.auth-form input.has-peek { padding-right: 58px; }
.auth-submit {
  width: 100%; height: 44px; margin-top: 22px;
  border: none; border-radius: var(--radius);
  background: var(--brand); color: #fff;
  font-size: 15px; font-weight: 600; font-family: var(--font);
  cursor: pointer; box-shadow: var(--shadow-sm);
}
.auth-submit:hover { background: var(--brand-ink); }
.auth-note {
  margin-top: 20px; padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 12px; color: var(--muted);
  display: flex; flex-direction: column; gap: 6px;
}
.auth-note .row { display: flex; gap: 8px; align-items: flex-start; }
.auth-note .ic { width: 13px; height: 13px; flex: none; margin-top: 2px; color: var(--faint); }

/* 修改密码页：密码管理器关联用的隐藏 username 字段（不提交、不可见） */
.form-card input.pm-username {
  position: absolute; width: 1px; min-width: 1px; max-width: 1px;
  height: 1px; min-height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ================= 账号/密码/错误页 ================= */
.page-narrow { max-width: 560px; }
.temp-password-box { margin: 14px 0; }
.temp-password-row { display: flex; gap: 10px; align-items: center; margin-top: 6px; flex-wrap: wrap; }
.temp-password-row code {
  font-family: ui-monospace, Menlo, monospace; font-size: 16px;
  background: var(--neutral-bg); padding: 6px 10px; border-radius: var(--radius);
  user-select: all;
}
.error-page { text-align: center; padding-top: 48px; }
.error-page h1 { font-size: 40px; margin-bottom: 4px; }
.error-message { font-size: 15px; color: var(--faint); }

/* ================= 手机端（≤860px；§3.1/§4-2/§4-6/§9.3） ================= */
@media (max-width: 860px) {
  .shell { flex-direction: column; }
  .side { display: none; }

  .topbar {
    display: block;
    background: var(--card);
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 20;
  }
  .topbar .tb-row1 {
    display: flex; align-items: center; gap: 9px;
    padding: 8px 14px 7px;
  }
  .topbar .tb-row1 .t { font-size: 14.5px; font-weight: 700; white-space: nowrap; }
  .topbar .tb-id { margin-left: auto; display: flex; align-items: center; gap: 6px; min-width: 0; }
  /* R1 修复：手机身份区可见展示完整姓名与角色（不只 aria-hidden 头像）。 */
  .topbar .tb-who {
    display: flex; flex-direction: column; align-items: flex-end;
    line-height: 1.3; min-width: 0; flex: none;
  }
  .topbar .tb-who .tb-name {
    font-size: 12.5px; font-weight: 600; color: var(--ink);
    max-width: 96px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .topbar .tb-who .tb-role { font-size: 10.5px; color: var(--faint); white-space: nowrap; }
  .topbar .tb-id .linklike, .topbar .tb-id a {
    font-size: 12px; color: var(--muted); white-space: nowrap;
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 44px; min-height: 44px;
  }
  .topbar .tb-nav { position: relative; }
  .topbar .tb-nav::after {
    content: ""; position: absolute; right: 0; top: 0; bottom: 9px; width: 46px;
    background: linear-gradient(to right, rgba(255,255,255,0), #FFFFFF 82%);
    pointer-events: none;
  }
  .topbar nav {
    display: flex; gap: 4px; overflow-x: auto;
    padding: 0 40px 9px 10px; -webkit-overflow-scrolling: touch;
  }
  .topbar nav a {
    flex: none; display: inline-flex; align-items: center; min-height: 44px;
    padding: 0 12px; border-radius: 999px;
    font-size: 12.5px; color: var(--ink-2); white-space: nowrap;
  }
  .topbar nav a.on { background: var(--brand-soft); color: var(--brand-ink); font-weight: 650; }

  .main { padding: 0 14px 48px; }
  .page-head { flex-direction: column; align-items: stretch; padding: 18px 0 14px; gap: 12px; }
  .page-head h1 { font-size: 19px; }
  .head-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .head-actions .btn { justify-content: center; }
  .card-section > .page-head, .page-head.compact { padding: 0 0 10px; }

  /* §4-6：手机关键操作触控目标 ≥44px */
  .btn { min-height: 44px; }
  /* R1 修复（§4-6/§9.3）：手机端卡片/列表中的关键文字链接
     （项目名、客户名、详情、查看、更新进度等）实际可点击框同样 ≥44×44px。 */
  .tbl.resp td a, .detail-grid a, .timeline .tl-time a, .banner a {
    display: inline-flex; align-items: center;
    min-width: 44px; min-height: 44px;
  }
  .form-row input[type="text"], .form-row input[type="date"], .form-row input[type="password"],
  .form-row select, .form-row textarea,
  .form-card input[type="text"], .form-card input[type="password"], .form-card select {
    min-height: 46px; font-size: 16px;
  }
  .form-card input.pm-username {
    width: 1px; min-width: 1px; max-width: 1px;
    height: 1px; min-height: 1px; font-size: 1px;
  }
  .input-num, .tbl-scroll select, .data-table select, .v2-tier-form select,
  .v2-field input:not([type="checkbox"]), .v2-field select {
    min-height: 44px; font-size: 16px;
  }
  .v2-checkbox { min-height: 44px; }
  .board-filters input[type="text"], .board-filters select {
    width: 100%; min-height: 44px; font-size: 16px;
  }
  .check-line { min-height: 44px; display: flex; align-items: center; }

  .cards { grid-template-columns: 1fr; }
  .form-card { max-width: 100%; padding: 14px; }
  .board-cards { grid-template-columns: 1fr; }
  .board-filters { flex-direction: column; align-items: stretch; }
  .board-filters .filter-check { padding-bottom: 0; min-height: 44px; }
  .board-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .board-metric .metric-value { font-size: 24px; }
  .progress-summary { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .progress-card .pc-actions .btn { flex: 1; }

  /* §4-2：业务列表手机端转语义卡片，不逐字竖排、不截断金额 */
  .tbl.resp, .tbl.resp tbody, .tbl.resp tr, .tbl.resp td { display: block; width: 100%; }
  .tbl.resp thead { display: none; }
  .tbl.resp tr { border-bottom: 1px solid var(--border); padding: 10px 4px; }
  .tbl.resp tr:last-child { border-bottom: none; }
  .tbl.resp td { border: none; padding: 4px 12px; font-size: 13px; }
  /* 桌面数字列按列中心对齐；手机卡片继续保持左标签、右数据。 */
  .tbl.resp td.c { text-align: right; }
  .tbl.resp td::before {
    content: attr(data-lb);
    display: inline-block; width: 76px; flex: none;
    color: var(--faint); font-size: 11.5px;
  }
  .tbl.resp td.no-lb::before { display: none; }
  .tbl.resp tbody tr:hover td { background: transparent; }
  .tbl.resp td .track { min-width: 150px; max-width: 220px; }

  .doc-head { grid-template-columns: 1fr 1fr; border-radius: 8px 8px 0 0; }
  .doc-head .cell { border-bottom: 1px solid var(--border); }
  .doc-head .cell:nth-child(3n) { border-right: 1px solid var(--border); }
  .doc-head .cell:nth-child(2n) { border-right: none; }
  .doc-head .cell:nth-last-child(-n+2) { border-bottom: none; }
  .hero { flex-direction: column; align-items: stretch; gap: 14px; padding: 18px; }
  .hero .amt .v { font-size: 30px; }
  .hero .upper { margin-left: 0; max-width: none; }
  .summary { padding: 14px 16px 16px; }
  .summary .summary-table { width: 100%; }
  .doc-sec { flex-wrap: wrap; padding: 12px 16px 4px; }
  .doc-sec .tag { display: none; }

  .v2-overview { grid-template-columns: repeat(2, minmax(140px, 1fr)); }
  .v2-card-grid { grid-template-columns: 1fr; }
  .v2-fields { grid-template-columns: 1fr; }
  .v2-bulk-confirm { align-items: stretch; flex-direction: column; }
  .v2-bulk-actions { flex-basis: auto; }
  .v2-bulk-confirm .btn { width: 100%; }

  /* §3.2：手机登录输入 ≥46px、按钮 ≥48px、字号 ≥16px */
  .auth { padding: 28px 16px; justify-content: flex-start; }
  .auth-card { padding: 26px 22px 22px; border-radius: 10px; }
  .auth-mods { flex-wrap: wrap; justify-content: center; row-gap: 6px; }
  .auth-form input { height: 46px; font-size: 16px; }
  .auth-form .fld .peek { min-width: 44px; min-height: 44px; height: 44px; }
  .auth-submit { height: 48px; font-size: 16px; }
}
