/* 2026 workbench refresh: calm enterprise SaaS, inspired by shadcn/ui, Tremor and Geist */
:root {
  /* Brand */
  --brand: #4f46e5;
  --brand-hover: #4338ca;
  --brand-active: #3730a3;
  --brand-soft: #eef2ff;
  --brand-soft-strong: #e0e7ff;
  --brand-ring: rgba(79, 70, 229, .12);

  /* Neutral */
  --ink: #0f172a;
  --ink-2: #1e293b;
  --ink-3: #475569;
  --muted: #64748b;
  --muted-2: #94a3b8;
  --line: #e5eaf1;
  --line-strong: #cbd5e1;
  --line-soft: #eef2f7;
  --paper: #f5f7fb;
  --paper-2: #eef2f7;
  --card: #ffffff;
  --card-2: #f8fafc;

  /* Semantic */
  --positive: #059669;
  --positive-soft: #ecfdf5;
  --positive-border: #d1fae5;
  --warning: #b45309;
  --warning-soft: #fff7ed;
  --warning-border: #ffedd5;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --danger-border: #fee2e2;
  --info: #0369a1;
  --info-soft: #f0f9ff;
  --info-border: #e0f2fe;
  --neutral-soft: #f8fafc;
  --neutral-border: #e9eef5;

  /* Legacy aliases：先保持现有组件视觉不变，后续再逐步迁移到上方语义名 */
  --accent: var(--brand);
  --accent-hover: var(--brand-hover);
  --accent-soft: var(--brand-soft);
  --emerald: var(--brand);
  --emerald-soft: var(--brand-soft);
  --gold: var(--warning);
  --gold-soft: var(--warning-soft);
  --coral: var(--danger);
  --coral-soft: var(--danger-soft);
  --blue: var(--info);
  --blue-soft: var(--info-soft);
  --violet: #7c3aed;
  --violet-soft: #f5f3ff;
  --success: var(--positive);
  --success-soft: var(--positive-soft);

  /* Typography scale */
  --fs-xs: 11px;
  --fs-sm: 12px;
  --fs-base: 13px;
  --fs-md: 14px;
  --fs-lg: 16px;
  --fs-xl: 20px;
  --fs-2xl: 24px;
  --fs-3xl: 32px;

  /* Spacing scale */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;

  /* Radius scale */
  --radius-1: 6px;
  --radius-2: 8px;
  --radius-3: 10px;
  --radius-4: 12px;
  --radius-5: 16px;
  --radius-6: 20px;
  --radius-pill: 999px;
  --radius: 14px;
  --radius-sm: 12px;

  /* Elevation */
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, .04);
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .04);
  --shadow-md: 0 12px 32px rgba(15, 23, 42, .09), 0 2px 8px rgba(15, 23, 42, .04);
  --shadow-lg: 0 20px 48px rgba(15, 23, 42, .12), 0 4px 12px rgba(15, 23, 42, .05);
  --focus-ring: 0 0 0 3px rgba(79, 70, 229, .12);

  /* Layout & controls */
  --sidebar: 236px;
  --control-h: 36px;
  --control-h-sm: 32px;
  --touch-target: 44px;
  --border: 1px solid var(--line);

  /* Font stacks */
  --font-ui: "Inter", "SF Pro Text", "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --font-display: var(--font-ui);
  --font-num: "SF Pro Display", "Bahnschrift", "DIN Alternate", "Arial Narrow", sans-serif;
}

@media (max-width: 560px) {
  .panel-head.expense-tag-head {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .expense-tag-head .panel-actions {
    justify-content: flex-start;
  }
}

/* Multi-person listing split */
.listing-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.listing-role-card { border: 1px solid #e5eaf2; border-radius: 10px; padding: 12px; background: #fbfcfe; min-width: 0; }
.listing-role-head { display: flex; flex-direction: column; gap: 3px; margin-bottom: 10px; }
.listing-role-head strong { font-size: 12px; color: #1f2937; }
.listing-role-head span { font-size: 9px; color: var(--muted-2); }
.person-group { display: flex; flex-direction: column; gap: 8px; }
.person-row { display: grid; grid-template-columns: minmax(0, 1fr) 92px 32px; gap: 7px; align-items: center; }
.person-row.primary { grid-template-columns: minmax(0, 1fr) 82px 82px; }
.person-row .btn { width: 32px; padding: 0; }
.person-rows { display: flex; flex-direction: column; gap: 7px; }
.person-add { align-self: flex-start; margin-top: 2px; }

/* 房源费池：必填星号 + 未选人时的提示 */
.req-mark { color: #dc2626; font-weight: 700; margin-left: 2px; font-size: 12px; line-height: 1; }
.listing-req-tip { display: flex; align-items: flex-start; gap: 6px; margin-top: 8px; padding: 7px 10px; border-radius: 8px; background: #fff4f2; border: 1px solid #f7cfc7; color: #b42318; font-size: 11px; line-height: 1.5; }
.listing-req-tip svg { width: 14px; height: 14px; flex: none; margin-top: 1px; }
.listing-role-card[data-need-pick="1"] { border-color: #f0c8c0; background: #fffaf9; }

/* 原生必填校验拦下提交时，把对应字段标红，避免用户不知道哪儿没填 */
.is-invalid-field {
  border-color: #dc2626 !important;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.12) !important;
  background-color: #fffafa !important;
}

/* 手机端「更多」页底部的账号卡片与退出登录 */
.more-account { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border: 1px solid #e5eaf2; border-radius: 12px; background: #fff; }
.more-account .avatar { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: #fff; font-size: 12px; font-weight: 600; flex: none; }
.more-account-copy { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.more-account-copy b { font-size: 13px; color: #1f2937; }
.more-account-copy small { font-size: 11px; color: #94a3b8; }
.more-logout { margin-left: auto; gap: 6px; color: #b91c1c; border-color: #f2c9c4; background: #fff7f6; }
.more-logout:hover { background: #fef2f2; }
.more-pwd { margin-top: 8px; width: 100%; }
.attachment-link { border: 0; background: transparent; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.attachment-link small { display: block; color: var(--muted-2); font-size: 8px; font-weight: 500; margin-top: 1px; }

@media (max-width: 1100px) {
  .listing-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
}
@media (max-width: 640px) {
  .listing-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
  .person-row.primary { grid-template-columns: 1fr 1fr; }
  .person-row.primary .select { grid-column: 1 / -1; }
  .person-row { grid-template-columns: 1fr 90px 32px; }
}

html { background: var(--paper); }
body {
  color: var(--ink);
  background:
    radial-gradient(circle at 96% 0%, rgba(99, 102, 241, .055), transparent 28rem),
    linear-gradient(180deg, #f8faff 0, var(--paper) 280px);
  font-size: 13px;
  line-height: 1.55;
  letter-spacing: -.006em;
}
::selection { color: #fff; background: rgba(79, 70, 229, .88); }

/* Sidebar */
.sidebar {
  width: var(--sidebar);
  padding: 18px 12px 14px;
  color: var(--ink-2);
  background: rgba(255, 255, 255, .88);
  border-right: 1px solid var(--line);
  box-shadow: 10px 0 30px rgba(15, 23, 42, .015);
  backdrop-filter: blur(18px);
}
.brand { gap: 10px; padding: 3px 8px 24px; }
.brand-mark {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 10px;
  color: #fff;
  background: linear-gradient(145deg, var(--brand), var(--brand-hover));
  box-shadow: 0 7px 16px rgba(79, 70, 229, .24), inset 0 1px 0 rgba(255,255,255,.22);
}
.brand-mark svg { width: 19px; height: 19px; }
.brand-name {
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 17px;
  font-weight: 750;
  letter-spacing: -.025em;
}
.brand-sub {
  margin-top: 2px;
  color: var(--muted-2);
  font-size: 9px;
  font-weight: 650;
  letter-spacing: .14em;
}
.nav-label {
  padding: 13px 11px 7px;
  color: var(--muted-2);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .13em;
}
.nav { gap: 3px; }
/* 使用说明与业务菜单之间的分隔线（2026-11-15） */
.nav-divider {
  height: 1px;
  margin: 10px 11px 8px;
  background: var(--line);
}
.nav-item.nav-help {
  color: var(--muted);
}
.nav-item.nav-help:hover {
  color: var(--accent);
  background: #f8fafc;
}
.nav-item {
  min-height: 40px;
  gap: 10px;
  padding: 9px 11px;
  border: 1px solid transparent;
  border-radius: 9px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 550;
}
.nav-item:hover {
  color: var(--ink-2);
  background: #f8fafc;
  border-color: #edf1f6;
}
.nav-item.active {
  color: var(--brand-hover);
  background: var(--accent-soft);
  border-color: #e0e7ff;
  box-shadow: none;
}
.nav-item.active .nav-icon, .nav-item.active > svg { color: var(--accent); opacity: 1; }
.nav-item > svg, .nav-icon, .nav-icon svg { width: 17px; height: 17px; flex-basis: 17px; opacity: .85; }
.nav-text { font-size: 12px; }
.nav-badge {
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  color: var(--brand-hover);
  background: #e0e7ff;
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 750;
}
.nav-item.active .nav-badge { color: #fff; background: var(--accent); }
.sidebar-foot { padding-top: 16px; }
/* 备案号：工信部要求网站底部公示，点击跳工信部官网（2026-11-15 备案通过后加） */
.icp-link {
  display: block;
  margin-top: 10px;
  padding: 6px 0 2px;
  text-align: center;
  font-size: 10px;
  color: var(--muted);
  text-decoration: none;
  letter-spacing: .2px;
  transition: color .15s;
}
.icp-link:hover { color: var(--accent); text-decoration: underline; }
.demo-card {
  padding: 12px;
  border-radius: 11px;
  background: #f8fafc;
  border: 1px solid var(--line);
}
.demo-card-title { color: var(--muted); font-size: 10px; font-weight: 650; }
.demo-dot, .demo-card-title .demo-dot {
  width: 6px;
  height: 6px;
  background: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, .1);
}
.demo-card p { margin: 6px 0 10px; color: var(--muted-2); font-size: 10px; line-height: 1.6; }
.demo-card .btn {
  color: #475569;
  background: #fff;
  border-color: var(--line);
}
.demo-card .btn:hover { color: var(--ink); background: #fff; border-color: var(--line-strong); }

/* Main shell and top bar */
.main-shell { margin-left: var(--sidebar); }
.topbar {
  min-height: 76px;
  padding: 14px 30px;
  background: rgba(250, 251, 254, .82);
  border-bottom: 1px solid rgba(226, 232, 240, .9);
  backdrop-filter: blur(22px) saturate(1.25);
}
.topbar-left { display: flex; flex-direction: column; }
.page-eyebrow {
  gap: 7px;
  margin-bottom: 3px;
  color: var(--muted-2);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .12em;
}
.page-eyebrow .sep { width: 12px; background: var(--line-strong); }
.page-title {
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 24px;
  font-weight: 720;
  letter-spacing: -.035em;
  line-height: 1.25;
}
.topbar-actions { gap: 8px; }
.role-chip {
  height: 36px;
  padding: 0 10px 0 5px;
  gap: 7px;
  color: var(--ink-3);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 9px;
  box-shadow: var(--shadow-sm);
  font-size: 11px;
  font-weight: 600;
}
.avatar {
  width: 26px;
  height: 26px;
  color: #fff;
  background: linear-gradient(145deg, #818cf8, #4f46e5) !important;
  font-size: 10px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.2);
}
.role-chip select { font-size: 11px; font-weight: 600; }
.content { padding: var(--space-6) var(--space-8) 54px; max-width: 1660px; margin: 0 auto; }
.page-head {
  align-items: center;
  margin-bottom: var(--space-5);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--line);
}
.page-head h2 {
  font-family: var(--font-ui);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -.025em;
}
.page-head p { margin-top: 4px; color: var(--muted-2); font-size: var(--fs-xs); }
.page-head-actions { gap: 7px; }
.page-head-actions .input { width: 150px; }

/* Controls */
.btn {
  height: var(--control-h);
  gap: var(--space-2);
  padding: 0 var(--space-3);
  color: var(--ink-3);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-2);
  box-shadow: var(--shadow-xs);
  font-size: var(--fs-sm);
  font-weight: 600;
  letter-spacing: -.005em;
  transition: background .15s ease, border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.btn:hover {
  color: var(--ink-2);
  background: var(--card-2);
  border-color: var(--line-strong);
  box-shadow: var(--shadow-sm);
}
.btn svg { width: 15px; height: 15px; }
.btn-primary, .btn-emerald {
  color: #fff;
  background: linear-gradient(180deg, var(--brand), var(--brand-hover));
  border-color: var(--brand);
  box-shadow: 0 4px 12px rgba(79,70,229,.2), inset 0 1px 0 rgba(255,255,255,.17);
}
.btn-primary:hover, .btn-emerald:hover {
  color: #fff;
  background: linear-gradient(180deg, var(--brand-hover), var(--brand-active));
  border-color: var(--brand-hover);
  box-shadow: 0 6px 16px rgba(79,70,229,.25);
}
.btn-danger { color: #b91c1c; background: #fef2f2; border-color: #fecaca; }
/* 系统内确认弹窗：替换浏览器原生 confirm */
.confirm-dialog { display: flex; gap: 14px; align-items: flex-start; padding: 4px 2px; }
.confirm-icon { flex: 0 0 36px; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--brand-soft); color: #4f46e5; }
.confirm-icon.is-danger { background: #fef2f2; color: #dc2626; }
.confirm-icon svg { width: 18px; height: 18px; }
.confirm-text { flex: 1; min-width: 0; font-size: 13px; line-height: 1.65; color: #334155; }
.confirm-text p { margin: 0 0 6px; }
.confirm-text p:last-child { margin-bottom: 0; }
.btn-danger { color: var(--danger); background: var(--card); border-color: var(--danger-border); }
.btn-danger:hover { background: var(--danger-soft); border-color: var(--danger-border); }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; }
.btn-small { height: var(--control-h-sm); padding: 0 10px; border-radius: var(--radius-1); font-size: var(--fs-xs); }
.icon-btn, .modal-close {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
}
.icon-btn:hover, .modal-close:hover { background: #f8fafc; color: var(--ink); }

.field { gap: 6px; }
.field label { color: #475569; font-size: 10px; font-weight: 650; }
.input, .select, .textarea {
  color: var(--ink-2);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-2);
  box-shadow: var(--shadow-xs);
  font-size: var(--fs-sm);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.input, .select { height: var(--control-h); padding: 0 var(--space-3); }
.textarea { min-height: 82px; padding: 9px var(--space-3); }
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--brand-soft-strong);
  box-shadow: var(--focus-ring);
  background: var(--card);
}
.input::placeholder, .textarea::placeholder { color: #a8b3c2; }
.select {
  padding-right: 29px;
  background-position: calc(100% - 14px) 15px, calc(100% - 9px) 15px;
}
.filter-bar { gap: 8px; margin-bottom: 14px; }
.filter-bar .input { width: 230px; }
.filter-bar .select { width: 136px; }
.search-wrap svg { top: 10px; color: var(--muted-2); }
.search-wrap .input { padding-left: 33px; }
.segmented {
  gap: 2px;
  padding: 3px;
  background: #f1f5f9;
  border: 1px solid #e8edf4;
  border-radius: 9px;
}
.segmented button {
  height: 28px;
  border-radius: 6px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 650;
}
.segmented button.active {
  color: var(--brand-hover);
  background: #fff;
  box-shadow: 0 1px 3px rgba(15,23,42,.1);
}

/* Layout and KPI cards */
.grid, .two-col, .three-col, .stack { gap: var(--space-4); }
.kpi-grid { gap: var(--space-3); margin-bottom: var(--space-4); }
.kpi-card {
  min-height: 122px;
  padding: var(--space-4);
  overflow: visible;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-4);
  box-shadow: var(--shadow-sm);
}
.kpi-card::after { display: none; }
.kpi-top { gap: 8px; }
.kpi-label { color: var(--muted); font-size: var(--fs-xs); font-weight: 650; letter-spacing: .005em; }
.kpi-icon {
  width: 27px;
  height: 27px;
  border-radius: 7px;
  color: var(--accent);
  background: var(--accent-soft);
}
.kpi-icon.gold { color: #c2410c; background: #fff7ed; }
.kpi-icon.coral { color: #dc2626; background: #fef2f2; }
.kpi-icon.blue { color: #0369a1; background: #f0f9ff; }
.kpi-icon svg { width: 14px; height: 14px; }
.kpi-value {
  margin-top: 12px;
  color: var(--ink);
  font-family: var(--font-num);
  font-size: clamp(22px, 1.75vw, 27px);
  font-weight: 720;
  letter-spacing: -.025em;
  line-height: 1.1;
}
.kpi-value small { color: var(--muted); font-size: var(--fs-xs); }
.kpi-meta { gap: 6px; margin-top: 9px; color: var(--muted-2); font-size: var(--fs-xs); }
.kpi-meta .up { color: var(--success); }
.kpi-meta .down { color: #dc2626; }

.two-col { grid-template-columns: minmax(0, 1.42fr) minmax(310px, .78fr); }
.two-col.ratio-64 { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
.three-col { gap: 14px; }
.panel {
  padding: var(--space-5);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-4);
  box-shadow: var(--shadow-sm);
}
.panel.flush { border-radius: var(--radius-4); }
.panel-head { margin-bottom: 15px; }
.panel.flush .panel-head { padding: 17px 18px 0; margin-bottom: 13px; }
.panel-title { color: var(--ink-2); font-size: var(--fs-base); font-weight: 700; letter-spacing: -.015em; }
.panel-sub { margin-top: 3px; color: var(--muted-2); font-size: var(--fs-xs); }
.panel-link { color: var(--accent); font-size: 10px; }
.panel-link:hover { color: var(--accent-hover); }

/* Tables */
.data-table { font-size: var(--fs-sm); }
.data-table th {
  padding: var(--space-3) 11px;
  color: var(--muted);
  background: var(--card-2);
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line);
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: .04em;
}
.data-table td { padding: var(--space-3) 11px; border-bottom: 1px solid var(--line-soft); color: var(--ink-3); }
.data-table tbody tr:hover { background: #fafbff; }
.data-table .num { color: var(--ink-2); font-family: var(--font-num); font-weight: 650; }
.data-table .muted { color: var(--muted-2); font-size: 10px; }
.data-table .row-title { color: var(--ink-2); font-weight: 650; }
.data-table .row-sub { margin-top: 2px; color: var(--muted-2); font-size: 9px; }
.data-table th:first-child, .data-table td:first-child { min-width: 64px; }

/* Badges, tags and semantic status */
.badge {
  height: 22px;
  gap: var(--space-1);
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0;
}
.badge::before { width: 5px; height: 5px; opacity: 1; }
.badge.green { color: #047857; background: #ecfdf5; border-color: #d1fae5; }
.badge.gold { color: #b45309; background: #fff7ed; border-color: #ffedd5; }
.badge.red { color: #b91c1c; background: #fef2f2; border-color: #fee2e2; }
.badge.blue { color: #0369a1; background: #f0f9ff; border-color: #e0f2fe; }
.badge.violet { color: #6d28d9; background: #f5f3ff; border-color: #ede9fe; }
.badge.gray { color: #475569; background: #f8fafc; border-color: #e9eef5; }
.tag {
  height: 22px;
  padding: 0 8px;
  color: var(--muted);
  background: var(--neutral-soft);
  border-radius: var(--radius-1);
  font-size: var(--fs-xs);
  font-weight: 650;
}
.text-emerald { color: var(--success); }
.text-coral { color: #dc2626; }
.text-gold { color: #b45309; }

/* Progress, charts, timelines */
.progress { height: 6px; background: var(--line-soft); }
.progress > span { background: linear-gradient(90deg, var(--brand), #818cf8); }
.bar-list { gap: var(--space-3); }
.bar-row { grid-template-columns: 94px minmax(0,1fr) 48px; gap: var(--space-3); font-size: var(--fs-sm); }
.bar-name { color: var(--muted); }
.bar-track { height: 6px; background: var(--line-soft); }
.bar-fill { background: linear-gradient(90deg, #4f46e5, #818cf8); }
.bar-fill.gold { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.bar-fill.coral { background: linear-gradient(90deg, #ef4444, #f87171); }
.bar-fill.blue { background: linear-gradient(90deg, #0284c7, #38bdf8); }
.bar-value { color: var(--ink-3); font-family: var(--font-ui); font-weight: 700; }
.chart { min-height: 210px; }
.chart-legend { gap: var(--space-4); margin-top: 7px; color: var(--muted); font-size: var(--fs-xs); }
.legend-dot { width: 8px; height: 8px; }
.chart-grid line { stroke: var(--line-soft); }
.chart-axis { fill: var(--muted-2); font-size: var(--fs-xs); }
.chart-line { stroke-width: 2; }
.chart-area { opacity: .065; }
.chart-point { stroke: #fff; stroke-width: 2; }
.donut-wrap { gap: 24px; min-height: 188px; }
.donut { flex-basis: 154px; width: 154px; height: 154px; }
.donut-center { fill: var(--ink); font-family: var(--font-num); font-size: var(--fs-xl); font-weight: 750; }
.donut-center-sub { fill: var(--muted-2); font-size: var(--fs-xs); }
.donut-legend { gap: 10px; }
.donut-legend-row { gap: 18px; font-size: var(--fs-sm); }
.donut-legend-name { color: var(--muted); }
.donut-legend-value { color: var(--ink-2); font-family: var(--font-num); font-weight: 700; }
.timeline-stage { grid-template-columns: 24px minmax(0,1fr); gap: 11px; min-height: 54px; }
.timeline-rail::after { width: 1px; background: #e5eaf1; }
.timeline-dot {
  width: 10px;
  height: 10px;
  margin-top: 3px;
  border: 2px solid #fff;
  background: var(--line-strong);
  box-shadow: 0 0 0 1px #d9e1ea;
}
.timeline-stage.done .timeline-dot { background: #4f46e5; box-shadow: 0 0 0 1px #c7d2fe; }
.timeline-stage.current .timeline-dot { background: #f59e0b; box-shadow: 0 0 0 4px #fef3c7; }
.timeline-stage.overdue .timeline-dot { background: #dc2626; box-shadow: 0 0 0 4px #fee2e2; }
.timeline-stage.na .timeline-dot { background: #e2e8f0; }
.timeline-name { color: #334155; font-size: 11px; font-weight: 650; }
.timeline-date { color: var(--muted-2); font-size: 9px; }
.timeline-note { color: var(--muted-2); font-size: 9px; }
.timeline-file { color: var(--brand-hover); background: var(--brand-soft); border-radius: 4px; font-size: 9px; }
.timeline-layout { display: grid; grid-template-columns: minmax(0, 1fr) 248px; gap: 16px; align-items: start; }
.timeline-flow { min-width: 0; }
.timeline-side { position: sticky; top: 0; display: flex; flex-direction: column; gap: 10px; }
.flow-summary {
  padding: 14px;
  background: #f8fafc;
  border: 1px solid #e7ecf3;
  border-radius: 10px;
}
.flow-summary-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 9px; }
.flow-summary-top span { color: var(--muted); font-size: 9px; font-weight: 650; }
.flow-summary-top strong { color: var(--brand-hover); font-family: var(--font-num); font-size: 18px; font-weight: 720; }
.flow-facts { display: grid; gap: 0; margin-top: 10px; }
.flow-facts > div { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid #e9eef5; }
.flow-facts > div:last-child { padding-bottom: 0; border-bottom: 0; }
.flow-facts span { color: var(--muted-2); font-size: 9px; }
.flow-facts strong { max-width: 125px; color: #334155; font-size: 10px; font-weight: 650; text-align: right; }
.settlement-card {
  display: flex;
  gap: 10px;
  padding: 13px;
  background: #fff7ed;
  border: 1px solid #ffedd5;
  border-radius: 10px;
}
.settlement-card.ready { background: #ecfdf5; border-color: #d1fae5; }
.settlement-card-icon {
  width: 27px;
  height: 27px;
  flex: 0 0 27px;
  display: grid;
  place-items: center;
  color: #b45309;
  background: #fff;
  border: 1px solid rgba(180,83,9,.12);
  border-radius: 7px;
}
.settlement-card.ready .settlement-card-icon { color: #047857; border-color: rgba(4,120,87,.12); }
.settlement-card-icon svg { width: 14px; height: 14px; }
.settlement-card-title { color: #92400e; font-size: 10px; font-weight: 700; }
.settlement-card.ready .settlement-card-title { color: #065f46; }
.settlement-card-text { margin-top: 3px; color: #a16207; font-size: 9px; line-height: 1.55; }
.settlement-card.ready .settlement-card-text { color: #047857; }
.timeline-side-note { padding: 2px 4px; color: var(--muted-2); font-size: 8px; line-height: 1.55; }

/* Kanban and lists */
.kanban { gap: 11px; }
.kanban-col {
  flex-basis: 230px;
  min-width: 230px;
  padding: 9px;
  background: #f8fafc;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
}
.kanban-head { padding: 2px 3px 9px; }
.kanban-title { color: #475569; font-size: 10px; font-weight: 700; }
.kanban-count { color: var(--muted); background: #e9eef5; font-family: var(--font-ui); font-size: 9px; }
.kanban-card {
  margin-bottom: 7px;
  padding: 11px;
  background: #fff;
  border: 1px solid #e4eaf2;
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(15,23,42,.03);
}
.kanban-card:hover { border-color: #c7d2fe; box-shadow: 0 4px 12px rgba(15,23,42,.07); }
.kanban-card-title { color: #334155; font-size: 10px; font-weight: 650; }
.kanban-card-sub, .kanban-card-bottom { color: var(--muted-2); font-size: 9px; }
.kanban-card-bottom { border-top-color: var(--line-soft); }
.kanban-card-bottom strong { color: #475569; }
.list-row { gap: var(--space-3); padding: var(--space-3) 0; border-bottom-color: var(--line-soft); }
.list-title { color: var(--ink-3); font-size: var(--fs-sm); font-weight: 650; }
.list-sub { color: var(--muted-2); font-size: var(--fs-xs); line-height: 1.55; }
.list-value { color: var(--ink-2); font-family: var(--font-num); font-size: var(--fs-sm); font-weight: 700; }
.list-side small { color: var(--muted-2); font-size: 8px; }
.list-row > svg, .data-table td > svg { color: var(--muted-2); }
.employee-recycle-row { align-items: flex-start; }
.employee-recycle-actions { display: flex; gap: 6px; flex-shrink: 0; align-items: center; }
@media (max-width: 560px) {
  .employee-recycle-row { flex-wrap: wrap; }
  .employee-recycle-actions { width: 100%; justify-content: flex-end; }
}

/* Inline notices */
.notice {
  gap: 9px;
  padding: 11px 12px;
  color: #92400e;
  background: #fffbeb;
  border: 1px solid #fef3c7;
  border-radius: 9px;
  font-size: 10px;
  line-height: 1.6;
}
.notice.red { color: #991b1b; background: #fef2f2; border-color: #fee2e2; }
.notice.green { color: #065f46; background: #ecfdf5; border-color: #d1fae5; }
.notice svg { width: 15px; height: 15px; flex-basis: 15px; margin-top: 1px; }

/* Store locks and approvals */
.lock-grid { gap: 11px; }
.lock-card {
  padding: 14px;
  background: #fbfcfe;
  border: 1px solid #e7ecf3;
  border-radius: 10px;
}
.lock-card.locked { background: #f0fdf4; border-color: #d1fae5; }
.lock-card.blocked { background: #fffafa; border-color: #fee2e2; }
.lock-store { color: var(--ink-2); font-size: 11px; font-weight: 700; }
.lock-meta { margin-top: 6px; color: var(--muted-2); font-size: 9px; line-height: 1.65; }
.lock-actions { margin-top: 11px; gap: 6px; }
.approval-step { gap: 10px; min-height: 42px; }
.approval-rail { width: 15px; }
.approval-dot { width: 8px; height: 8px; background: var(--line-strong); border: 2px solid #fff; box-shadow: 0 0 0 1px #d9e1ea; }
.approval-step.done .approval-dot { background: #4f46e5; box-shadow: 0 0 0 1px #c7d2fe; }
.approval-step.current .approval-dot { background: #f59e0b; box-shadow: 0 0 0 3px #fef3c7; }
.approval-step.rejected .approval-dot { background: #dc2626; }
.approval-rail::after { width: 1px; background: #e5eaf1; }
.approval-title { color: #334155; font-size: 10px; font-weight: 650; }
.approval-text { color: var(--muted-2); font-size: 9px; }
.approval-comment { color: #475569; background: #f8fafc; border: 1px solid var(--line-soft); border-radius: 5px; font-size: 9px; }

/* Modals and forms */
.modal-backdrop { background: rgba(15, 23, 42, .42); backdrop-filter: blur(7px); }
.modal {
  border: 1px solid rgba(255,255,255,.75);
  border-radius: var(--radius-5);
  background: var(--card);
  box-shadow: 0 30px 80px rgba(15,23,42,.22), 0 2px 8px rgba(15,23,42,.08);
}
.modal-head { padding: var(--space-5) var(--space-6) var(--space-3); border-bottom-color: var(--line); }
.modal-title { color: var(--ink); font-family: var(--font-ui); font-size: 18px; font-weight: 720; letter-spacing: -.025em; }
.modal-sub { margin-top: 3px; color: var(--muted-2); font-size: var(--fs-xs); }
.modal-body { padding: var(--space-5) var(--space-6) var(--space-6); }
.modal-foot { flex-wrap: wrap; padding: var(--space-3) var(--space-6); background: var(--card-2); border-top-color: var(--line); }
.modal-foot .btn { flex-shrink: 0; }
.form-grid { gap: 12px; }
.form-section { margin: 17px 0 11px; padding-top: 15px; border-top-color: #edf1f6; border-top-style: solid; }
.form-section-title { color: var(--muted-2); font-size: 9px; font-weight: 750; letter-spacing: .1em; }
.file-drop {
  min-height: 48px;
  padding: 9px 11px;
  color: var(--muted-2);
  background: #fbfcfe;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  font-size: 10px;
}
.file-drop input { color: var(--muted); font-size: 9px; }
.attachment-list { gap: 6px; margin-top: 7px; }
.detail-hero h3 { color: var(--ink); font-size: 16px; font-weight: 720; letter-spacing: -.02em; }
.detail-hero p { color: var(--muted-2); font-size: 10px; }
.modal .detail-hero h3 { display: none; }
.modal .detail-hero { margin-bottom: 11px; }
.detail-badges { gap: 5px; }
.detail-kpis { gap: 8px; margin-bottom: 15px; }
.mini-kpi { padding: var(--space-3); background: var(--card-2); border: 1px solid var(--line); border-radius: var(--radius-2); }
.mini-kpi-label { color: var(--muted-2); font-size: var(--fs-xs); font-weight: 650; }
.mini-kpi-value { margin-top: 3px; color: var(--ink-2); font-family: var(--font-num); font-size: var(--fs-lg); font-weight: 720; }
.detail-tabs { gap: 2px; padding: 3px; margin-bottom: 15px; background: #f1f5f9; border: 1px solid #e8edf4; border-radius: 8px; }
.detail-tabs button { height: 28px; padding: 0 11px; border-radius: 6px; color: var(--muted); font-size: 10px; font-weight: 650; transition: color .16s ease, background .16s ease, box-shadow .16s ease; }
.detail-tabs button.active { color: var(--brand-hover); background: #fff; box-shadow: 0 1px 3px rgba(15,23,42,.1); }
.detail-grid { gap: 12px; }
.info-grid { gap: 12px 16px; }
.info-grid .info-item.span-2 { grid-column: 1 / -1; }
.info-label { color: var(--muted-2); font-size: 9px; }
.info-value { margin-top: 2px; color: #334155; font-size: 10px; font-weight: 650; }
.section-title { margin: 17px 0 9px; }
.section-title h4 { color: #334155; font-size: 11px; font-weight: 700; }
.section-title span { color: var(--muted-2); font-size: 9px; }

/* Toasts and empty states */
#toast-root { right: 20px; bottom: 20px; gap: 7px; }
.toast {
  min-width: 230px;
  padding: 11px 13px;
  color: #fff;
  background: var(--ink-2);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 9px;
  box-shadow: 0 12px 32px rgba(15,23,42,.2);
  font-size: 10px;
}
.toast.success { background: #047857; }
.toast.error { background: #b91c1c; }

/* 云端保存失败横幅（覆盖 styles.css，适配浅色主题） */
.sync-status { bottom: 20px; }
.sync-status-inner {
  gap: 11px;
  padding: 12px 14px;
  border-radius: 10px;
  background: #fef2f2;
  border: 1px solid #fca5a5;
  box-shadow: 0 14px 36px rgba(15, 23, 42, .16);
}
.sync-status-inner > svg { color: #b91c1c; }
.sync-status-text strong { font-size: 11px; color: #991b1b; }
.sync-status-text span { font-size: 9.5px; color: #b45309; }
.sync-status .sync-status-btn { background: #b91c1c; border-color: #b91c1c; color: #fff; }
.sync-status .sync-status-btn:hover { background: #991b1b; border-color: #991b1b; }
@media (max-width: 720px) { .sync-status { bottom: 12px; } }
.empty { padding: 32px 18px; color: var(--muted-2); }
.empty svg { color: var(--line-strong); opacity: 1; }
.empty h4 { color: var(--muted); font-size: 11px; }
.empty p { color: var(--muted-2); font-size: 9px; }

/* Utilities and responsive refinements */
.mono { font-variant-numeric: tabular-nums; }
/* KPI 网格：按卡片数量自适应，避免 5 张卡被塞进 6 列留空一格 */
@media (min-width: 901px) {
  .kpi-grid.kpi-count-4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
  .kpi-grid.kpi-count-5 { grid-template-columns: repeat(5, minmax(0,1fr)); }
  .kpi-grid.kpi-count-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .kpi-grid.kpi-count-2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  /* 只有一张卡时撑满整行（2026-11-15：日常支出页删掉 4 张净利润卡后只剩 1 张） */
  .kpi-grid.kpi-count-1 { grid-template-columns: 1fr; }
  .kpi-grid.kpi-count-1 > .kpi-card { min-height: 96px; }
}
@media (max-width: 1450px) {
  .kpi-grid { grid-template-columns: repeat(3, minmax(0,1fr)); }
  /* 5 张卡的页面在中等屏保持一行 5 列，挤一点但整齐 */
  .kpi-grid.kpi-count-5 { grid-template-columns: repeat(5, minmax(0,1fr)); }
}
@media (max-width: 1180px) {
  :root { --sidebar: 216px; }
  .topbar { padding-left: 24px; padding-right: 24px; }
  .content { padding-left: 24px; padding-right: 24px; }
  .two-col { grid-template-columns: minmax(0, 1fr); }
  .three-col { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 900px) {
  :root { --sidebar: 0px; }
  body { background: #f6f8fc; }
  .topbar { min-height: 72px; padding: 12px 16px; background: rgba(250,251,254,.9); }
  .page-title { font-size: 21px; }
  .content { padding: 20px 16px 32px; }
  .page-head { padding-bottom: 14px; align-items: stretch; text-align: left; }
  .filter-bar > .text-muted, .filter-bar > .tag { display: none; }
  .kpi-grid { gap: 9px; }
  .kpi-card { min-height: 108px; padding: 13px; }
  .kpi-value { font-size: 22px; }
  .panel { padding: 15px; }
  .two-col, .three-col { gap: 11px; }
  .mobile-nav {
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    background: rgba(255,255,255,.96);
    border-top: 1px solid #e5eaf1;
    box-shadow: 0 -8px 24px rgba(15,23,42,.04);
    backdrop-filter: blur(20px);
  }
  .mobile-nav button { min-height: 48px; color: #8a97a8; font-size: 8px; font-weight: 600; }
  .mobile-nav button.active { color: var(--brand-hover); background: var(--brand-soft); }
  .modal { border-radius: 0; }
  .detail-tabs { background: #f1f5f9; }
  .timeline-layout { grid-template-columns: minmax(0, 1fr); }
  .timeline-side { position: static; }
  .table-wrap { -webkit-overflow-scrolling: touch; }
  .table-wrap .data-table th:first-child,
  .table-wrap .data-table td:first-child {
    position: sticky;
    left: 0;
    z-index: 1;
    background: #fff;
    box-shadow: 1px 0 0 #edf1f6;
  }
  .table-wrap .data-table th:first-child { z-index: 2; background: #f8fafc; }
  .table-wrap .data-table tbody tr:hover td:first-child { background: #fafbff; }
}
@media (max-width: 560px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .kpi-card { min-height: 102px; }
  .kpi-value { font-size: 21px; }
  .bar-row { grid-template-columns: 74px minmax(0,1fr) 38px; }
}

/* Employee profiles and payroll input controls */
.check-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.check-option {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid #e5eaf2;
  border-radius: 8px;
  background: #fbfcfe;
  color: #334155;
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}
.check-option:hover { border-color: #c7d2fe; background: #f8faff; }
.check-option.is-checked { border-color: #c7d2fe; background: var(--brand-soft); color: #3730a3; }
.check-option input { width: 14px; height: 14px; margin: 0; accent-color: #4f46e5; flex: 0 0 14px; }
.check-option span { display: flex; min-width: 0; flex-direction: column; gap: 2px; line-height: 1.35; }
.check-option small { color: var(--muted-2); font-size: 8px; font-weight: 500; }
.field-help, .field-hint {
  color: var(--muted-2);
  font-size: 9px;
  font-weight: 500;
  line-height: 1.45;
}
.field-hint { margin-left: auto; padding-left: 8px; font-weight: 500; }
.input-suffix { position: relative; display: flex; align-items: center; }
.input-suffix .input { width: 100%; padding-right: 34px; }
.input-suffix > span {
  position: absolute;
  right: 11px;
  color: var(--muted-2);
  font-size: 9px;
  font-weight: 600;
  pointer-events: none;
}
.form-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpi-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.textarea { min-height: 88px; padding: 10px 11px; resize: vertical; }
@media (max-width: 900px) {
  .check-grid { grid-template-columns: minmax(0, 1fr); }
  .form-grid-3, .form-grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mobile-nav { justify-content: flex-start; overflow-x: auto; scrollbar-width: none; }
  .mobile-nav::-webkit-scrollbar { display: none; }
  .mobile-nav button { flex: 0 0 60px; }
}

[hidden] { display: none !important; }

/* Payroll slips and batch operations */
.inline-actions { display: inline-flex; align-items: center; justify-content: flex-end; gap: 3px; }

.row-quick-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  margin-top: 7px;
}

.row-quick-actions .btn {
  height: 22px;
  padding: 0 7px;
  font-size: 10.5px;
  border-radius: 6px;
}

.timeline-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  margin-bottom: 14px;
  border: 1px solid #e2e9f1;
  border-radius: 12px;
  background: linear-gradient(135deg, #f8fafc, #f2f7f4);
}

.timeline-toolbar-main { min-width: 0; }
.timeline-toolbar-main strong { display: block; font-size: 12.5px; color: var(--ink-2); }
.timeline-toolbar-main small { display: block; margin-top: 3px; font-size: 10.5px; line-height: 1.5; color: #7b8797; }
.timeline-toolbar-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 6px; flex: 0 0 auto; }

.payroll-picker-list .list-row { gap: 12px; }
.payroll-picker-list .list-title .tag { margin-left: 4px; }

@media (max-width: 560px) {
  .timeline-toolbar { align-items: flex-start; flex-direction: column; }
  .timeline-toolbar-actions { width: 100%; justify-content: flex-start; }
  .row-quick-actions .btn { height: 24px; font-size: 11px; }
}
.payslip {
  overflow: hidden;
  color: var(--ink);
  background: #fff;
  border: 1px solid #e5eaf1;
  border-radius: 14px;
}
.payslip-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 20px 22px 17px;
  background: linear-gradient(135deg, #f8fafc, #fff);
  border-bottom: 2px solid var(--ink);
}
.payslip-eyebrow { color: var(--muted); font-size: 9px; font-weight: 750; letter-spacing: .15em; }
.payslip h3 { margin: 5px 0 0; color: var(--ink); font-size: 21px; font-weight: 780; letter-spacing: -.025em; }
.payslip p { margin: 5px 0 0; color: var(--muted-2); font-size: 10px; }
.payslip-status { align-self: flex-start; padding: 5px 10px; border-radius: 999px; background: #fff7ed; color: #b45309; font-size: 10px; font-weight: 750; white-space: nowrap; }
.payslip-status.paid { color: #047857; background: #ecfdf5; }
.payslip-status.failed { color: #b91c1c; background: #fef2f2; }
.payslip-status.draft { color: var(--muted); background: #f8fafc; }
.payslip-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 1px; margin: 0; background: #e9eef5; border-bottom: 1px solid #e9eef5; }
.payslip-grid > div { min-width: 0; padding: 10px 14px; background: #fff; }
.payslip-grid .span-2 { grid-column: span 2; }
.payslip-grid span { display: block; color: var(--muted-2); font-size: 8px; }
.payslip-grid strong { display: block; margin-top: 2px; overflow-wrap: anywhere; color: #334155; font-size: 11px; }
.payslip-table-wrap { padding: 15px 18px 0; overflow-x: auto; }
.payslip-table { width: 100%; border-collapse: collapse; font-size: 10px; }
.payslip-table th, .payslip-table td { padding: 8px 9px; border-bottom: 1px solid var(--line-soft); text-align: left; }
.payslip-table th { color: var(--muted-2); background: #f8fafc; font-size: 8px; font-weight: 700; letter-spacing: .06em; }
.payslip-table td:nth-child(2) { color: var(--muted); }
.payslip-table th:nth-child(2) { width: 68%; }
.payslip-item { color: #334155; font-weight: 700; white-space: nowrap; }
.payslip-source-title { margin-bottom: 3px; color: #475569; font-weight: 650; }
.payslip-source-list { display: grid; gap: 2px; color: var(--muted-2); font-size: 9px; line-height: 1.5; }
.payslip-table .right { text-align: right; }
.payslip-table .income { color: #047857; font-weight: 700; }
.payslip-table .deduction td, .payslip-table .deduction { color: #b91c1c; }
.payslip-table tfoot td { padding: 12px 9px; border-top: 2px solid var(--ink); border-bottom: 0; color: var(--ink); font-size: 14px; font-weight: 800; }
.payslip-summary { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px; padding: 15px 18px 0; }
.payslip-summary > div { padding: 10px 11px; background: #f8fafc; border: 1px solid #e5eaf1; border-radius: 8px; }
.payslip-summary span { display: block; color: var(--muted-2); font-size: 8px; }
.payslip-summary strong { display: block; margin-top: 3px; font-size: 15px; }
.payslip-summary .deduction { color: #b91c1c; }
.payslip-summary .net { color: #fff; background: var(--ink); border-color: var(--ink); }
.payslip-summary .net span { color: var(--line-strong); }
.payslip-note { margin: 12px 18px 0; padding: 8px 10px; color: #92400e; background: #fffbeb; border: 1px solid #fef3c7; border-radius: 7px; font-size: 9px; line-height: 1.55; }
.payslip-note.danger { color: #991b1b; background: #fef2f2; border-color: #fee2e2; }
.payslip-foot { display: flex; justify-content: space-between; gap: 12px; margin-top: 16px; padding: 12px 18px; color: var(--muted-2); background: #fbfcfe; border-top: 1px solid #edf1f6; font-size: 8px; }

@media (max-width: 680px) {
  .payslip-head { flex-direction: column; padding: 16px; }
  .payslip h3 { font-size: 18px; }
  .payslip-grid { grid-template-columns: minmax(0, 1fr); }
  .payslip-grid .span-2 { grid-column: span 1; }
  .payslip-table-wrap { padding: 12px 12px 0; }
  .payslip-table { min-width: 520px; }
  .payslip-summary { grid-template-columns: 1fr 1fr; padding: 12px 12px 0; }
  .payslip-summary .net { grid-column: span 2; }
  .payslip-note { margin: 10px 12px 0; }
  .payslip-foot { flex-direction: column; padding: 10px 12px; }
}
@media (max-width: 560px) {
  .form-grid-3, .form-grid-4 { grid-template-columns: minmax(0, 1fr); }
}

/* Dashboard interactions, page-lock entry and settings calculator */
.topbar-actions .page-lock-entry,
.topbar-actions .page-lock-now {
  width: auto;
  min-width: 0;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 10px;
  border: 1px solid #e5eaf2;
  border-radius: 9px;
  color: var(--muted);
  background: #fff;
  font-size: 9px;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .03);
}
.topbar-actions .page-lock-entry:hover,
.topbar-actions .page-lock-now:hover { color: var(--brand-hover); border-color: #c7d2fe; background: #f8faff; }
.topbar-actions .page-lock-now { color: var(--brand-hover); border-color: #dbe2ff; background: var(--brand-soft); }
.kpi-card.is-interactive { cursor: pointer; transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease; outline: none; }
.kpi-card.is-interactive:hover,
.kpi-card.is-interactive:focus-visible { transform: translateY(-2px); border-color: #c7d2fe; box-shadow: 0 10px 26px rgba(79, 70, 229, .10); }
.kpi-open-hint { position: absolute; right: 14px; bottom: 10px; color: var(--brand); font-size: 8px; font-weight: 700; opacity: 0; transform: translateY(3px); transition: opacity .16s ease, transform .16s ease; }
.kpi-card.is-interactive:hover .kpi-open-hint,
.kpi-card.is-interactive:focus-visible .kpi-open-hint { opacity: 1; transform: translateY(0); }
.kpi-card.is-interactive { position: relative; }
.kpi-hover-card {
  position: absolute;
  z-index: 45;
  left: 10px;
  right: 10px;
  top: calc(100% + 7px);
  padding: 10px 11px;
  border: 1px solid rgba(99,102,241,.35);
  border-radius: 10px;
  color: #e5e7eb;
  background: rgba(15,23,42,.97);
  box-shadow: 0 14px 34px rgba(15,23,42,.22);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity .16s ease, transform .16s ease, visibility .16s ease;
}
.kpi-card.is-interactive:hover .kpi-hover-card,
.kpi-card.is-interactive:focus-visible .kpi-hover-card { opacity: 1; visibility: visible; transform: translateY(0); }
.kpi-hover-card strong { display: block; font-size: 9px; font-weight: 600; line-height: 1.55; }
.kpi-hover-card small { display: block; margin-top: 4px; color: #a5b4fc; font-size: 8px; line-height: 1.5; }
.kpi-hover-card i { display: block; margin-top: 6px; color: #c7d2fe; font-size: 8px; font-style: normal; }
.commission-breakdown { margin-bottom: 16px; }
.commission-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.commission-item { min-width: 0; padding: var(--space-3); border: 1px solid var(--line); border-radius: var(--radius-3); background: var(--card-2); }
.commission-item span { display: block; color: var(--muted-2); font-size: var(--fs-xs); font-weight: 650; }
.commission-item strong { display: block; margin-top: 4px; color: var(--ink-2); font-family: var(--font-num); font-size: var(--fs-lg); font-weight: 760; }
.commission-item small { display: block; margin-top: 3px; color: var(--muted-2); font-size: var(--fs-xs); line-height: 1.35; }
.commission-item.accent { border-color: #c7d2fe; background: var(--brand-soft); }
.commission-item.accent strong { color: var(--brand-hover); }
.commission-item.positive { border-color: #bbf7d0; background: #f0fdf4; }
.commission-item.positive strong { color: #047857; }
.commission-item.minus strong { color: #b45309; }
.settings-calculator .calc-input-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.settings-calculator .field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.settings-calculator .field > span { color: var(--muted); font-size: 9px; font-weight: 650; }
.calc-result-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; margin-top: 12px; overflow: hidden; border: 1px solid #e8edf4; border-radius: 10px; background: #e8edf4; }
.calc-result-grid > div { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-width: 0; padding: 9px 11px; background: #fff; }
.calc-result-grid span { color: var(--muted); font-size: 9px; }
.calc-result-grid strong { color: var(--ink-2); font-family: var(--font-num); font-size: 12px; font-weight: 750; }
.calc-result-grid .positive { background: #f0fdf4; }
.calc-result-grid .positive strong { color: #047857; }
.calc-note { display: flex; align-items: flex-start; gap: 7px; margin-top: 10px; padding: 9px 10px; border-radius: 8px; color: var(--muted); background: #f8fafc; font-size: 9px; line-height: 1.5; }
.calc-note svg { width: 13px; height: 13px; flex: 0 0 auto; color: #4f46e5; }
.calc-actions { margin-top: 12px; }
.quality-row { width: 100%; border-left: 0; border-right: 0; border-top: 0; color: inherit; background: transparent; text-align: left; cursor: pointer; }
.quality-row:hover { background: #f8faff; }
.quality-row .list-value { display: inline-flex; align-items: center; gap: 5px; }
.quality-row .list-value svg { width: 11px; height: 11px; color: var(--muted-2); }
.chart-interactive { position: relative; touch-action: manipulation; }
.chart-tooltip { position: absolute; z-index: 20; min-width: 148px; max-width: min(260px, calc(100% - 12px)); padding: 9px 10px; border: 1px solid #dfe6f0; border-radius: 9px; color: #334155; background: rgba(255,255,255,.98); box-shadow: 0 12px 32px rgba(15,23,42,.14); pointer-events: none; }
.chart-tooltip-title { margin-bottom: 5px; color: var(--ink-2); font-size: 9px; font-weight: 750; }
.chart-tooltip-row { display: grid; grid-template-columns: 6px minmax(50px, 1fr) auto; align-items: center; gap: 6px; margin-top: 4px; font-size: 9px; }
.chart-tooltip-row i { width: 6px; height: 6px; border-radius: 50%; }
.chart-tooltip-row span { color: var(--muted); white-space: nowrap; }
.chart-tooltip-row strong { color: var(--ink-2); font-family: var(--font-num); text-align: right; white-space: nowrap; }
.chart-crosshair { opacity: 0; stroke: var(--muted-2); stroke-width: 1; stroke-dasharray: 3 3; pointer-events: none; }
.chart-index-hit { outline: none; }
.chart-index-hit:hover .chart-crosshair,
.chart-index-hit:focus .chart-crosshair { opacity: .85; }
.chart-hit-layer { cursor: crosshair; }
.donut-svg { display: block; width: 100%; height: 100%; }
.donut-segment { cursor: pointer; outline: none; transition: stroke-width .14s ease, filter .14s ease; }
.donut-segment:hover,
.donut-segment:focus { stroke-width: 25; filter: drop-shadow(0 2px 4px rgba(15,23,42,.18)); }
.metric-detail-hero { display: flex; flex-direction: column; gap: 4px; padding: 16px; border: 1px solid #dbe2ff; border-radius: 12px; background: linear-gradient(135deg, var(--brand-soft), #f8faff); }
.metric-detail-hero span { color: var(--brand); font-size: 9px; font-weight: 750; letter-spacing: .04em; }
.metric-detail-hero strong { color: var(--ink-2); font-family: var(--font-num); font-size: 28px; line-height: 1.1; }
.metric-detail-hero small { color: var(--muted); font-size: 9px; }
.metric-detail-block { margin-top: 12px; padding: 11px 12px; border: 1px solid #edf1f6; border-radius: 9px; background: #fff; }
.metric-detail-block span { display: block; margin-bottom: 5px; color: var(--muted-2); font-size: 8px; font-weight: 700; letter-spacing: .04em; }
.metric-detail-block p { margin: 0; color: #475569; font-size: 10px; line-height: 1.65; }
.metric-detail-block code { color: var(--brand-hover); font-family: var(--font-num); font-size: 9px; line-height: 1.6; white-space: normal; }
@media (max-width: 900px) {
  .commission-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .settings-calculator .calc-input-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 680px) {
  .topbar-actions .page-lock-entry span,
  .topbar-actions .page-lock-now span { display: none; }
  .topbar-actions .page-lock-entry,
  .topbar-actions .page-lock-now { width: 34px; padding: 0; }
  .commission-grid { grid-template-columns: 1fr 1fr; }
  .calc-result-grid { grid-template-columns: minmax(0, 1fr); }
  .chart-tooltip { min-width: 130px; }
}

/* Dashboard summaries and settings navigation */
.analytics-glance { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-3); margin-bottom: var(--space-3); }
.analytics-glance-card {
  position: relative;
  min-width: 0;
  padding: var(--space-3) 13px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius-4);
  background: var(--card);
  cursor: pointer;
  outline: none;
  transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}
.analytics-glance-card:hover,
.analytics-glance-card:focus-visible { border-color: #c7d2fe; box-shadow: 0 8px 22px rgba(79,70,229,.08); transform: translateY(-1px); }
.analytics-glance-card > span { display: block; color: var(--muted); font-size: var(--fs-xs); font-weight: 650; }
.analytics-glance-card > strong { display: block; margin-top: 4px; color: var(--ink); font-family: var(--font-num); font-size: var(--fs-xl); font-weight: 760; line-height: 1.1; }
.analytics-glance-card > small { display: block; margin-top: 4px; color: var(--muted-2); font-size: var(--fs-xs); line-height: 1.4; }
.analytics-glance-card > i { position: absolute; right: 10px; top: 10px; color: var(--brand); font-size: var(--fs-xs); font-style: normal; font-weight: 700; opacity: 0; transition: opacity .16s ease; }
.analytics-glance-card:hover > i,
.analytics-glance-card:focus-visible > i { opacity: 1; }
.analytics-grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.analytics-donut-wrap { flex-direction: column; gap: 14px; min-height: 0; }
.analytics-donut-wrap .donut { align-self: center; flex-basis: 138px; width: 138px; height: 138px; }
.analytics-donut-wrap .donut-legend { width: 100%; gap: 7px; }
.analytics-donut-wrap .donut-legend-row { gap: 10px; }
.bar-row-clickable { cursor: pointer; padding: 4px 6px; margin: -4px -6px; border-radius: 6px; transition: background .15s ease; }
.bar-row-clickable:hover,
.bar-row-clickable:focus-visible { background: #f6f8ff; outline: none; }
.kpi-card.is-interactive .kpi-hover-card { pointer-events: none; }

.settings-jump { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; padding: 7px; border: 1px solid #e8edf4; border-radius: 10px; background: #f8faff; }
.settings-jump button { display: inline-flex; align-items: center; gap: 5px; height: 28px; padding: 0 10px; border: 1px solid transparent; border-radius: 7px; color: var(--muted); background: transparent; font-size: 9px; font-weight: 650; }
.settings-jump button:hover,
.settings-jump button:focus-visible { border-color: #dbe2ff; color: var(--brand-hover); background: #fff; outline: none; }
.settings-jump button svg { width: 12px; height: 12px; }
.settings-layout { align-items: start; }
.settings-target-flash { animation: settings-target-flash 1.35s ease; }
@keyframes settings-target-flash {
  0% { box-shadow: 0 0 0 0 rgba(79,70,229,.26); }
  35% { box-shadow: 0 0 0 4px rgba(79,70,229,.13); }
  100% { box-shadow: 0 0 0 0 rgba(79,70,229,0); }
}
.audit-row { width: 100%; border-left: 0; border-right: 0; border-top: 0; color: inherit; background: transparent; text-align: left; cursor: pointer; }
.audit-row:hover { background: #f8faff; }
.audit-actor { font-size: 11px; color: #475569; font-weight: 500; }
.audit-row .list-side small { display: block; margin-top: 2px; font-size: 10px; color: var(--muted-2); }
.audit-row .list-title { font-size: 12px; }
.audit-row .list-sub { font-size: 11px; color: var(--muted); line-height: 1.5; }
.audit-log-toolbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.audit-log-filter { min-width: 240px; }
.audit-log-filter span { font-size: 11px; }
.audit-log-list { max-height: 52vh; overflow-y: auto; border: 1px solid #e8edf4; border-radius: 10px; }

/* ── 操作日志页（2026-11-02 新增） ── */
.audit-filters {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
}
.audit-filters .field { margin: 0; }
.audit-filters .field > span { font-size: 11px; color: var(--muted); }
.audit-filters .select,
.audit-filters .input { width: 100%; height: 38px; }
@media (max-width: 1100px) {
  .audit-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .audit-filters { grid-template-columns: minmax(0, 1fr); }
}
#settings-security, #settings-commission, #settings-types, #settings-stages, #settings-quality, #settings-roles, #settings-audit { scroll-margin-top: 88px; }

@media (max-width: 1180px) {
  .analytics-grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .analytics-glance { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .analytics-grid-3 { grid-template-columns: minmax(0, 1fr); }
  .settings-jump { overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; }
  .settings-jump::-webkit-scrollbar { display: none; }
  .settings-jump button { flex: 0 0 auto; }
}
@media (max-width: 560px) {
  .analytics-glance-card > strong { font-size: 17px; }
  .analytics-glance-card > i { display: none; }
}

/* Readability pass: raise the minimum type scale without changing layout density */
body { font-size: 14px; }
.brand-name { font-size: 18px; }
.brand-sub, .nav-label, .page-eyebrow { font-size: 10.5px; }
.nav-item, .nav-text { font-size: 13px; }
.nav-badge { font-size: 10.5px; }
.demo-card-title, .demo-card p { font-size: 11px; }
.page-title { font-size: 26px; }
.role-chip, .role-chip select { font-size: 12px; }
.avatar { font-size: 11px; }
.page-head h2 { font-size: 19px; }
.page-head p { font-size: 12px; }
.btn { font-size: 12.5px; }
.btn-small { font-size: 11.5px; }
.field label, .settings-calculator .field > span { font-size: 11px; }
.input, .select, .textarea { font-size: 12.5px; }
.segmented button { font-size: 11.5px; }
.notice { font-size: 11.5px; }
.toast { font-size: 11.5px; }
.kpi-label { font-size: 11.5px; }
.kpi-value small { font-size: 11px; }
.kpi-meta { font-size: 10.5px; }
.kpi-open-hint { font-size: 10px; }
.panel-title { font-size: 15px; }
.panel-sub, .panel-link { font-size: 11.5px; }
.data-table { font-size: 12.5px; }
.data-table th { font-size: 10.5px; }
.data-table .muted { font-size: 11px; }
.data-table .row-sub { font-size: 10.5px; }
.badge, .tag { font-size: 10.5px; }
.bar-row { font-size: 11.5px; }
.chart-legend, .chart-axis { font-size: 10.5px; }
.donut-center-sub { font-size: 9.5px; }
.donut-legend-row { font-size: 11.5px; }
.timeline-name { font-size: 12.5px; }
.timeline-date, .timeline-note, .timeline-file { font-size: 10.5px; }
.flow-summary-top span, .flow-facts span { font-size: 10px; }
.flow-facts strong { font-size: 11px; }
.settlement-card-title { font-size: 11px; }
.settlement-card-text, .timeline-side-note { font-size: 10px; }
.kanban-title { font-size: 11.5px; }
.kanban-count { font-size: 10px; }
.kanban-card-title { font-size: 11.5px; }
.kanban-card-sub, .kanban-card-bottom { font-size: 10px; }
.list-title { font-size: 12px; }
.list-sub { font-size: 10.5px; }
.list-value { font-size: 13px; }
.list-side small { font-size: 10px; }
.lock-store { font-size: 12px; }
.lock-meta { font-size: 10.5px; }
.approval-title { font-size: 11.5px; }
.approval-text, .approval-comment { font-size: 10.5px; }
.modal-title { font-size: 20px; }
.modal-sub { font-size: 11.5px; }
.form-section-title { font-size: 10.5px; }
.file-drop input { font-size: 10.5px; }
.detail-hero h3 { font-size: 18px; }
.detail-hero p { font-size: 11.5px; }
.mini-kpi-label { font-size: 10px; }
.detail-tabs button { font-size: 12px; }
.info-label { font-size: 10.5px; }
.info-value { font-size: 12.5px; }
.section-title h4 { font-size: 12.5px; }
.section-title span { font-size: 10.5px; }
.empty h4 { font-size: 12.5px; }
.empty p { font-size: 10.5px; }
.check-option small { font-size: 10px; }
.kpi-hover-card strong { font-size: 11px; }
.kpi-hover-card small, .kpi-hover-card i { font-size: 10px; }
.commission-item span, .commission-item small { font-size: 10px; }
.calc-result-grid span { font-size: 10.5px; }
.calc-note { font-size: 10.5px; }
.chart-tooltip-title, .chart-tooltip-row { font-size: 10.5px; }
.metric-detail-hero span, .metric-detail-hero small { font-size: 10.5px; }
.metric-detail-block span { font-size: 10px; }
.metric-detail-block p { font-size: 11.5px; }
.metric-detail-block code { font-size: 10.5px; }

/* Metric drill-down: actual ledger and payroll records */
.metric-detail-rich { display: grid; gap: 0; min-width: 0; overflow: hidden; }
.metric-detail-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 9px;
  margin-top: 12px;
  min-width: 0;
}
.metric-detail-stats > div {
  padding: 10px 11px;
  border: 1px solid #e6ebf3;
  border-radius: 9px;
  background: #f8fafc;
  min-width: 0;
}
.metric-detail-stats span { display: block; color: var(--muted-2); font-size: 10px; font-weight: 650; }
.metric-detail-stats strong { display: block; margin-top: 4px; color: var(--ink-2); font-family: var(--font-num); font-size: 16px; }
.metric-detail-jumps { position: sticky; top: -1px; z-index: 4; display: flex; gap: 7px; flex-wrap: wrap; margin: 13px -1px 0; padding: 8px 1px; background: rgba(255,255,255,.97); backdrop-filter: blur(8px); }
.metric-detail-jumps button { display: inline-flex; align-items: center; gap: 6px; padding: 7px 10px; border: 1px solid #e2e8f0; border-radius: 8px; color: #475569; background: #fff; font: inherit; font-size: 11px; font-weight: 650; cursor: pointer; }
.metric-detail-jumps button:hover, .metric-detail-jumps button:focus-visible { border-color: #c7d2fe; color: var(--brand-hover); background: #f5f6ff; outline: none; }
.metric-detail-jumps b { min-width: 18px; padding: 1px 5px; border-radius: 999px; color: #4f46e5; background: var(--brand-soft); font-family: var(--font-num); font-size: 10px; text-align: center; }
.metric-data-section { margin-top: 16px; padding-top: 15px; border-top: 1px solid #edf1f6; min-width: 0; overflow: hidden; }
.metric-data-section { scroll-margin-top: 48px; }
.metric-data-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 9px; }
.metric-data-head h3 { margin: 0; color: var(--ink-2); font-size: 14px; }
.metric-data-head p { margin: 4px 0 0; color: var(--muted-2); font-size: 10.5px; line-height: 1.55; }
.metric-table-wrap { width: 100%; max-width: 100%; min-width: 0; max-height: 430px; overflow: auto; border: 1px solid #e8edf4; border-radius: 10px; }
.metric-data-table { min-width: 980px; }
.metric-data-table thead th { position: sticky; top: 0; z-index: 2; background: #f8fafc; }
.metric-data-table td { vertical-align: middle; }
.metric-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 112px;
  padding: 18px;
  border: 1px dashed #dfe6ef;
  border-radius: 10px;
  color: var(--muted-2);
  background: #fbfcfe;
  text-align: center;
}
.metric-empty svg { width: 20px; height: 20px; color: #a5b4fc; }
.metric-empty strong { color: #475569; font-size: 12px; }
.metric-empty span { font-size: 10.5px; line-height: 1.55; }
.metric-legend-button { width: 100%; border-radius: 7px; cursor: pointer; outline: none; transition: background .15s ease, box-shadow .15s ease; }
.metric-legend-button:hover, .metric-legend-button:focus-visible { background: #f3f5ff; box-shadow: inset 0 0 0 1px #dfe4ff; }
.commission-item.is-interactive { cursor: pointer; outline: none; transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease; }
.commission-item.is-interactive:hover,
.commission-item.is-interactive:focus-visible { transform: translateY(-1px); border-color: #c7d2fe; box-shadow: 0 8px 20px rgba(79, 70, 229, .08); }
.table-link { padding: 0; border: 0; color: #4f46e5; background: transparent; font: inherit; font-weight: 700; cursor: pointer; text-align: left; }
.table-link:hover { text-decoration: underline; }
@media (max-width: 720px) {
  .metric-detail-stats { grid-template-columns: 1fr 1fr; }
  .metric-data-head { align-items: flex-start; }
  .metric-data-table { min-width: 860px; }
}
.analytics-glance-card > span { font-size: var(--fs-xs); }
.analytics-glance-card > strong { font-size: var(--fs-xl); }
.analytics-glance-card > small { font-size: var(--fs-xs); }
.analytics-glance-card > i { font-size: var(--fs-xs); }
.settings-jump button { font-size: 10.5px; }
.payslip-grid span, .payslip-table th, .payslip-summary span { font-size: 10px; }
.payslip-grid strong { font-size: 12px; }
.payslip-table { font-size: 11px; }
.payslip-note, .payslip-foot { font-size: 10px; }
@media (max-width: 900px) {
  .page-title { font-size: 22px; }
  .page-head h2 { font-size: 18px; }
  .mobile-nav button { font-size: 9.5px; }
  .analytics-glance-card > strong { font-size: 19px; }
}
.data-table tr.is-void { opacity: .68; }
.data-table tr.is-void .row-title { text-decoration: line-through; text-decoration-thickness: 1px; }
.data-table tr.is-void .row-sub { opacity: .8; }

/* Operating efficiency gauges */
.gauge-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.gauge-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 166px;
  padding: 14px 16px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius-4);
  background: linear-gradient(160deg, #fff 0%, #fbfcff 100%);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  outline: none;
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}
.gauge-card:hover,
.gauge-card:focus-visible {
  transform: translateY(-2px);
  border-color: #c7d2fe;
  box-shadow: 0 10px 26px rgba(79, 70, 229, .10);
}
.gauge-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.gauge-label { color: var(--muted); font-size: var(--fs-sm); font-weight: 700; letter-spacing: .005em; }
.gauge-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  color: #4f46e5;
  background: var(--brand-soft);
}
.gauge-icon.blue { color: #0369a1; background: #f0f9ff; }
.gauge-icon.gold { color: #c2410c; background: #fff7ed; }
.gauge-icon.coral { color: #dc2626; background: #fef2f2; }
.gauge-icon svg { width: 14px; height: 14px; }
.gauge-svg { display: block; width: 100%; height: 100px; margin: 3px auto 1px; overflow: visible; }
.gauge-track { fill: none; stroke: var(--line-soft); stroke-width: 9; stroke-linecap: round; }
.gauge-tick { stroke: #dfe6ef; stroke-width: 1.3; stroke-linecap: round; }
.gauge-fill { fill: none; stroke-width: 9; stroke-linecap: round; transition: stroke-dasharray .55s ease; }
.gauge-fill.green { stroke: #1D9E75; }
.gauge-fill.blue { stroke: #0ea5e9; }
.gauge-fill.gold { stroke: #f59e0b; }
.gauge-fill.coral { stroke: #ef4444; }
.gauge-dot.green { fill: #1D9E75; }
.gauge-dot.blue { fill: #0ea5e9; }
.gauge-dot.gold { fill: #f59e0b; }
.gauge-dot.coral { fill: #ef4444; }
.gauge-number {
  fill: var(--ink);
  font-family: var(--font-num);
  font-size: 23px;
  font-weight: 760;
  letter-spacing: -.03em;
}
.gauge-meta {
  min-height: 28px;
  color: var(--muted-2);
  font-size: var(--fs-xs);
  line-height: 1.45;
  text-align: center;
}
.gauge-open-hint {
  position: absolute;
  right: 13px;
  top: 39px;
  color: var(--brand);
  font-size: 9px;
  font-weight: 700;
  opacity: 0;
  transform: translateY(2px);
  transition: opacity .16s ease, transform .16s ease;
}
.gauge-card:hover .gauge-open-hint,
.gauge-card:focus-visible .gauge-open-hint { opacity: 1; transform: translateY(0); }
@media (max-width: 1000px) {
  .gauge-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .gauge-grid { grid-template-columns: minmax(0, 1fr); gap: 9px; }
  .gauge-card { min-height: 146px; padding: 12px 14px 9px; }
  .gauge-svg { height: 92px; }
}

/* Employee self-service portal */
.employee-portal-banner {
  display: flex;
  align-items: center;
  gap: 13px;
  margin-bottom: 14px;
  padding: 14px 16px;
  background: linear-gradient(135deg, #eff6ff 0%, #f8fafc 62%, #ecfeff 100%);
  border: 1px solid #dbeafe;
  border-radius: 13px;
}
.employee-portal-avatar {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  color: #fff;
  background: linear-gradient(145deg, #0f766e, #0e7490);
  border-radius: 12px;
  box-shadow: 0 8px 18px rgba(14, 116, 144, .2);
  font-size: 13px;
  font-weight: 760;
}
.employee-portal-copy { min-width: 0; flex: 1; }
.employee-portal-copy strong { display: block; color: var(--ink); font-size: 12px; font-weight: 750; }
.employee-portal-copy span { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; line-height: 1.55; }
.employee-portal-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.employee-payroll-kpis { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.mini-kpi-meta { margin-top: 3px; color: var(--muted-2); font-size: 9px; line-height: 1.45; }
.employee-progress-cell { display: grid; gap: 4px; min-width: 108px; }
.employee-progress-cell small { color: var(--muted-2); font-size: 9px; white-space: nowrap; }
.employee-progress-cell .progress { height: 5px; }
.employee-private-note { background: #f0f9ff; border-color: #e0f2fe; }
.employee-deal-basics { margin-bottom: 14px; }
.employee-payroll-layout { grid-template-columns: minmax(0, 1fr) 310px; align-items: start; }
.employee-payroll-side { position: sticky; top: 0; }
.employee-payroll-info { grid-template-columns: 1fr 1fr; }
.employee-payroll-info .span-2 { grid-column: 1 / -1; }
.employee-source-list { display: grid; gap: 3px; max-width: 640px; }
.employee-source-list span { color: var(--muted); font-size: 9px; line-height: 1.5; }
.employee-salary-table td:nth-child(2) { min-width: 250px; }
.settlement-card > div:last-child strong { display: block; color: #92400e; font-size: 10px; }
.settlement-card.ready > div:last-child strong { color: #065f46; }
.settlement-card > div:last-child p { margin: 3px 0 0; color: #a16207; font-size: 9px; line-height: 1.55; }
.settlement-card.ready > div:last-child p { color: #047857; }
.account-role-dot.employee { background: #0e7490; }
.text-amber { color: #b45309; }
@media (max-width: 1080px) {
  .employee-payroll-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .employee-payroll-layout { grid-template-columns: minmax(0, 1fr); }
  .employee-payroll-side { position: static; }
}
@media (max-width: 720px) {
  .employee-portal-banner { align-items: flex-start; padding: 12px; }
  .employee-portal-banner > .badge { display: none; }
  .employee-portal-kpis, .employee-payroll-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .employee-payroll-info { grid-template-columns: minmax(0, 1fr); }
  .employee-payroll-info .span-2 { grid-column: auto; }
  .employee-salary-table td:nth-child(2) { min-width: 0; }
  .employee-ledger-panel { padding: 0; background: transparent; border: 0; box-shadow: none; }
  .employee-ledger-table-wrap { width: 100%; margin: 0; overflow: visible; }
  .employee-ledger-table,
  .employee-ledger-table tbody { display: block; width: 100%; background: transparent; }
  .employee-ledger-table { min-width: 0; }
  .employee-ledger-table thead { display: none; }
  .employee-ledger-table tbody { display: grid; gap: 10px; }
  .employee-ledger-table tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 11px 14px;
    padding: 14px;
    background: #fff;
    border: 1px solid #e5eaf1;
    border-radius: 12px;
    box-shadow: 0 6px 18px rgba(15, 23, 42, .035);
  }
  .employee-ledger-table td,
  .table-wrap .employee-ledger-table td:first-child {
    position: static;
    display: flex;
    min-width: 0;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    padding: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
  }
  .employee-ledger-table td::before {
    content: attr(data-label);
    color: var(--muted-2);
    font-size: 9px;
    font-weight: 600;
  }
  .employee-ledger-table td:first-child,
  .employee-ledger-table td:nth-child(5),
  .employee-ledger-table td:nth-child(7) { grid-column: 1 / -1; }
  .employee-ledger-table td:first-child::before,
  .employee-ledger-table td:nth-child(7)::before { display: none; }
  .employee-ledger-table td:nth-child(5) .employee-progress-cell { width: 100%; }
  .employee-ledger-table td:nth-child(7) .btn { width: 100%; justify-content: center; }
  .employee-ledger-table .row-title { font-size: 12px; }
}

/* ══════════════════════════════════════════════════════════════
   手机端适配 A 档（2026-10-29）
   目标：统一断点、修卡片比例、通用表格卡片化
   原则：只改尺寸与排布，不动任何业务逻辑与数据
   ══════════════════════════════════════════════════════════════ */

/* ── 1. 全局防溢出：任何情况下都不让页面横向滚动 ── */
/* 注意：不要在 html/body 上设 overflow-x:hidden，移动端会破坏宽度计算并裁切内容 */
.main-shell, .content, .page { min-width: 0; }
.table-wrap { max-width: 100%; }
/* 长文本（小区名、备注）不撑破容器 */
.kpi-meta, .list-sub, .row-sub, .field-help { overflow-wrap: anywhere; }

/* ── 2. 手机端（≤560px）卡片与字号修正 ── */
@media (max-width: 560px) {
  /* KPI 数字：原来 21px，长金额溢出。改 18px 并按容器缩放 */
  .kpi-value { font-size: clamp(16px, 4.6vw, 19px) !important; letter-spacing: -.02em; }
  .kpi-value small { font-size: 9px !important; }
  .kpi-label { font-size: 9.5px !important; }
  .kpi-meta { font-size: 9px !important; gap: 4px !important; }
  .kpi-card { min-height: 0 !important; padding: 11px 12px !important; }
  .kpi-card::after { width: 56px; height: 56px; right: -20px; bottom: -26px; }

  /* 5 张卡的页面：改成横向滑动，不再出现 2+2+1 的孤行 */
  .kpi-grid.kpi-count-5 {
    display: flex !important;
    grid-template-columns: none !important;
    gap: 9px !important;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding-bottom: 6px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .kpi-grid.kpi-count-5::-webkit-scrollbar { display: none; }
  .kpi-grid.kpi-count-5 > .kpi-card {
    flex: 0 0 46%;
    scroll-snap-align: start;
  }
  /* 6 张及以上同理 */
  .kpi-grid.kpi-count-6 {
    display: flex !important;
    grid-template-columns: none !important;
    gap: 9px !important;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding-bottom: 6px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .kpi-grid.kpi-count-6::-webkit-scrollbar { display: none; }
  .kpi-grid.kpi-count-6 > .kpi-card {
    flex: 0 0 38%;
    scroll-snap-align: start;
  }

  /* 4 张卡：保持 2×2，整齐 */
  .kpi-grid.kpi-count-4 { grid-template-columns: repeat(2, minmax(0,1fr)) !important; }
  /* 3 张卡：1 大 2 小会乱，统一 1 列更清楚 */
  .kpi-grid.kpi-count-3 { grid-template-columns: repeat(2, minmax(0,1fr)) !important; }
  .kpi-grid.kpi-count-3 > .kpi-card:first-child { grid-column: 1 / -1; }

  /* 表单字段一律单列，不再两列硬挤 */
  .form-grid,
  .deal-grid,
  .deal-cards,
  .check-grid { grid-template-columns: minmax(0, 1fr) !important; }
  .form-grid .span-2,
  .deal-grid .span-2,
  .deal-grid > .field.col-4,
  .deal-grid > .field.col-6,
  .deal-grid > .field.col-8 { grid-column: auto !important; }

  /* 两栏/三栏布局全部单列 */
  .two-col, .three-col, .two-col.ratio-64, .detail-kpis { grid-template-columns: minmax(0, 1fr) !important; }

  /* 筛选/操作区：按钮不再撑满整屏高度 */
  .page-head { gap: 10px; }
  .page-head-actions { gap: 7px; }
  .page-head-actions .btn { padding: 0 10px; font-size: 11px; }
  .search-wrap { flex: 1 1 100%; }
  .search-wrap .input { font-size: 12px; }
}

/* ── 3. 通用表格 → 手机卡片化（只对有 data-label 的行生效） ──
   原理：thead 隐藏，每个 tr 变成一张卡片，每个 td 变成「标签 + 值」两行。
   没加 data-label 的表格保持原来的横向滚动，不会被改坏。 */

/* ── 4. 超宽工资表：手机端保持表格但优化滚动体验 ──
   工资表列多（10+ 列），卡片化反而更难读，先做横向滚动 + 首列冻结提示 */

/* ── 5. 工资表卡片化特殊处理（≤720px） ──
   14 列在手机上堆成一张超长卡片会很难读，所以：
   - 首列（员工姓名）突出显示
   - 金额类字段用小字号两列并排，节省纵向空间
   - 「实发」单独强调，排在最后满宽显示 */

/* ── 6. 指标明细表（数据看板弹窗）卡片化：紧凑 3 列 ──
   这些表列多、字段短（日期、金额、平台），3 列排布比 2 列更省纵向空间 */

/* ══════════════════════════════════════════════════════════════
   手机端卡片化 · 修正版（2026-10-29 晚）
   问题：台账列表、工资列表变形
   根因：
     1) theme.css:425 的 `.data-table td:first-child { min-width:64px }`
        没有 !important，特异性(0,2,1) 高于卡片规则里的
        `.data-table:has(td[data-label]) td`(0,2,1 但被 :has 提升到 0,3,1 反而不够)，
        导致首列被撑到 64px 并把 grid 挤歪；
     2) 900px 断点里的 `td:first-child { position: sticky; box-shadow }`
        在卡片模式下残留，造成卡片左侧出现一条阴影分割线；
     3) 工资表 14 列在 3 列网格里，长金额（如 ¥12,345.67）超出列宽后被截断。
   解决：用更高特异性 + !important 重置，并把金额改成允许换行/缩字号。
   ══════════════════════════════════════════════════════════════ */

/* ── 工资列表专项修正 ── */

/* ── 业务台账列表专项修正 ── */

/* ══════════════════════════════════════════════════════════════
   手机端卡片化 · 第二轮修正（2026-10-29 晚 20:30）
   用户截图反馈的四个问题：
     ① 卡片顶部多余出现一组操作按钮（row-quick-actions 在首列内部）
        → 与底部操作列重复，手机端隐藏
     ② 首列标题左侧被裁切（overflow 残留 + padding 不够）
     ③ tfoot 合计行溢出卡片外、只剩半个框
     ④ 卡片内首列内容与上方网格没有对齐
   ══════════════════════════════════════════════════════════════ */

/* ══════════════════════════════════════════════════════════════
   手机端卡片化 · 第三轮修复（2026-10-29 20:33）
   症状：卡片整体偏左、超出手机屏幕、文字显示不全
   根因（这次查到底）：
     1) styles.css:978/1280 的 `.nowrap { white-space: nowrap }`
        是**全局类**，卡片里带 nowrap 的单元格（成交日期、操作列）
        被强制不换行，内容有多宽就撑多宽，把 grid 撑爆 → 整卡溢出屏幕
     2) theme.css:425 `.data-table td:first-child { min-width:64px }`
        没有 !important，在部分场景仍生效
     3) `.table-wrap` 默认 overflow 可见，卡片溢出了也不出滚动条，
        而是直接顶穿页面，造成"整体偏左"
   策略：用「极致特异性 + 全属性 !important」做一次暴力重置，
        并且给外层容器加 overflow 兜底，确保永不顶穿屏幕。
   ══════════════════════════════════════════════════════════════ */

/* ══════════════════════════════════════════════════════════════
   手机端卡片化 · 最终版（2026-10-29 20:40）★ 不依赖 :has()
   真正根因：整个方案依赖 CSS :has()，而 :has() 是 2023 年新特性，
   360 浏览器 / 安卓系统自带浏览器多为旧版 Chromium 内核，不支持 → 整条规则被忽略
   → 卡片样式全部没生效，用户看到的仍是普通表格被挤压 = "文字偏左、显示不全"

   解决：改用 .stack-table 类名（由 JS 直接加到 table 上），零兼容性要求。
   同时保留原 :has() 规则作为渐进增强（新浏览器走更精细的分支样式）。
   ══════════════════════════════════════════════════════════════ */
@media (max-width: 900px) {
  /* ── 外层容器防溢出（所有手机浏览器都生效） ── */
  .content, #page-content, .page, .main-shell, .table-wrap {
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
  }
  .panel { max-width: 100% !important; min-width: 0 !important; box-sizing: border-box !important; }

  /* ── 表格本体转块级 ── */
  table.stack-table {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    table-layout: auto !important;
    border-collapse: collapse !important;
  }
  table.stack-table > tbody,
  table.stack-table > tfoot {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
  }
  table.stack-table > thead { display: none !important; }

  /* ── 每行 = 一张卡片（2 列网格） ── */
  table.stack-table > tbody > tr {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    gap: 10px 12px !important;
    padding: 13px 14px !important;
    margin-bottom: 10px !important;
    overflow: hidden !important;
    background: #fff !important;
    border: 1px solid #e5eaf1 !important;
    border-radius: 12px !important;
    box-shadow: 0 4px 14px rgba(15, 23, 42, .04) !important;
  }

  /* ── 每个单元格 = 标签 + 值 ── */
  table.stack-table > tbody > tr > td {
    display: block !important;
    position: static !important;
    left: auto !important;
    top: auto !important;
    float: none !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: 100% !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    text-align: left !important;
    white-space: normal !important;
    word-break: break-word !important;
    overflow-wrap: break-word !important;
    overflow: visible !important;
    text-overflow: clip !important;
    font-size: 11.5px !important;
    line-height: 1.45 !important;
    color: #334155;
  }
  table.stack-table > tbody > tr > td::before {
    content: attr(data-label);
    display: block !important;
    margin-bottom: 2px;
    color: var(--muted-2) !important;
    font-size: 9px !important;
    font-weight: 600 !important;
    line-height: 1.3;
    white-space: normal !important;
  }

  /* 首列（标题）占满整行，不显示标签 */
  table.stack-table > tbody > tr > td:first-child {
    grid-column: 1 / -1 !important;
    padding-bottom: 8px !important;
    margin-bottom: 2px !important;
    border-bottom: 1px solid var(--line-soft) !important;
    width: 100% !important;
  }
  table.stack-table > tbody > tr > td:first-child::before { display: none !important; }

  /* 操作列占满整行 */
  table.stack-table > tbody > tr > td:last-child {
    grid-column: 1 / -1 !important;
    display: block !important;
    width: 100% !important;
    padding-top: 9px !important;
    margin-top: 2px !important;
    border-top: 1px solid var(--line-soft) !important;
  }
  table.stack-table > tbody > tr > td:last-child::before { display: none !important; }

  /* 首列/单元格内部元素允许换行 */
  table.stack-table > tbody > tr > td > * {
    max-width: 100% !important;
    min-width: 0 !important;
    white-space: normal !important;
    word-break: break-word !important;
    overflow-wrap: break-word !important;
  }
  table.stack-table > tbody > tr > td .row-title {
    font-size: 13px !important;
    font-weight: 700 !important;
    color: var(--ink-2) !important;
    line-height: 1.4 !important;
  }
  table.stack-table > tbody > tr > td .row-sub {
    font-size: 9.5px !important;
    color: var(--muted-2) !important;
    margin-top: 2px !important;
  }

  /* 隐藏首列里重复的快捷操作按钮 */
  table.stack-table > tbody > tr > td .row-quick-actions { display: none !important; }

  /* 金额/数字：左对齐，允许换行 */
  table.stack-table > tbody > tr > td.num,
  table.stack-table > tbody > tr > td.right {
    text-align: left !important;
  }

  /* 操作按钮铺开、易点 */
  table.stack-table > tbody > tr > td .inline-actions {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
    width: 100% !important;
  }
  table.stack-table > tbody > tr > td .btn {
    flex: 1 1 auto !important;
    min-height: 30px !important;
    justify-content: center !important;
  }

  /* ── 合计行：独立卡片 ── */
  table.stack-table > tfoot > tr {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    gap: 10px 12px !important;
    padding: 12px 14px !important;
    margin-top: 10px !important;
    overflow: hidden !important;
    background: #f8fafc !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 10px !important;
  }
  table.stack-table > tfoot > tr > td {
    display: block !important;
    position: static !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: 100% !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    text-align: left !important;
    white-space: normal !important;
    word-break: break-word !important;
    font-size: 11.5px !important;
  }
  table.stack-table > tfoot > tr > td::before {
    content: attr(data-label);
    display: block !important;
    margin-bottom: 2px;
    color: var(--muted-2) !important;
    font-size: 8.5px !important;
    font-weight: 600 !important;
  }
  table.stack-table > tfoot > tr > td[colspan] {
    grid-column: 1 / -1 !important;
    display: block !important;
    width: 100% !important;
    color: var(--muted) !important;
    font-size: 12px !important;
    padding-bottom: 4px !important;
  }
  table.stack-table > tfoot > tr > td[colspan]::before { display: none !important; }

  /* 空状态行不做卡片 */
  table.stack-table > tbody > tr > td[colspan] {
    grid-column: 1 / -1 !important;
    display: block !important;
    border: 0 !important;
  }
  table.stack-table > tbody > tr > td[colspan]::before { display: none !important; }
}

/* ══════════════════════════════════════════════════════════════
   手机端卡片化 · AM 补充修正（2026-10-29 20:58）
   截图显示仍有「文字显示不全」：首列标题被裁切、卡片内文字截断
   原因：td 改成 display:block 后，其内部 .row-title / .row-sub
        仍继承了 styles.css 里的 white-space:nowrap + overflow:hidden
        + text-overflow:ellipsis（这些是给表格单元格设计的省略规则），
        在卡片里就变成"文字被截断显示不全"。
   ══════════════════════════════════════════════════════════════ */
@media (max-width: 900px) {
  /* 首列及所有单元格内部的标题/副标题：彻底解除省略，允许换行 */
  table.stack-table > tbody > tr > td .row-title,
  table.stack-table > tbody > tr > td .row-sub,
  table.stack-table > tbody > tr > td > div,
  table.stack-table > tbody > tr > td > span,
  table.stack-table > tbody > tr > td > strong,
  table.stack-table > tbody > tr > td > a,
  table.stack-table > tbody > tr > td > b {
    display: block !important;
    width: auto !important;
    max-width: 100% !important;
    min-width: 0 !important;
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
    word-break: break-word !important;
    overflow-wrap: break-word !important;
    -webkit-line-clamp: unset !important;
    line-clamp: unset !important;
    -webkit-box-orient: initial !important;
    text-align: left !important;
  }
  /* 首列标题：字号加大、行高舒适 */
  table.stack-table > tbody > tr > td:first-child .row-title {
    font-size: 13.5px !important;
    font-weight: 700 !important;
    line-height: 1.4 !important;
    color: var(--ink) !important;
    letter-spacing: 0 !important;
  }
  /* 首列副标题（编号 · 类型 · 面积） */
  table.stack-table > tbody > tr > td:first-child .row-sub {
    font-size: 9.5px !important;
    line-height: 1.45 !important;
    color: var(--muted-2) !important;
    margin-top: 3px !important;
  }
  /* 单元格里的普通文本也解除省略 */
  table.stack-table > tbody > tr > td {
    text-overflow: clip !important;
    overflow: visible !important;
  }
  /* 卡片内所有文字：禁止任何截断 */
  table.stack-table > tbody > tr {
    word-break: break-word !important;
    overflow-wrap: break-word !important;
  }
}

/* 页面标题旁的版本号：极小、浅灰，只用于确认是否最新版 */
.app-ver {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 5px;
  border-radius: 4px;
  background: #f1f5f9;
  color: var(--muted-2);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: .02em;
  vertical-align: middle;
  cursor: help;
}
@media (max-width: 560px) {
  .app-ver { font-size: 8.5px; margin-left: 6px; padding: 1px 4px; }
}

/* ══════════════════════════════════════════════════════════════
   手机端卡片化 · 干净版（2026-10-29 21:00）
   前几版失败的真正原因清单（都已移除）：
     1) 在 html/body 上设 overflow-x:hidden
        → 移动端浏览器会因此错误计算宽度基准，内容被推左并裁切
     2) 给 .content/.page/.main-shell 加 overflow-x:hidden !important
        → 同理，且会破坏 position:sticky
     3) 依赖 :has() → 旧内核直接忽略整条规则
   现在的做法：
     ★ 不碰外层容器（不设 overflow、不设宽度）
     ★ 只精确控制表格、卡片、单元格本身
     ★ 用 min-width:0 + 合理的 grid 单位保证不溢出
   ══════════════════════════════════════════════════════════════ */
@media (max-width: 900px) {
  /* 表格容器：允许滚动作为最后兜底，但不改宽度 */
  .table-wrap { max-width: 100%; }

  /* 卡片表格：块级 + 满宽，不设 min-width */
  table.stack-table {
    display: block;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    table-layout: fixed;
    border-collapse: collapse;
  }
  table.stack-table > tbody,
  table.stack-table > tfoot {
    display: block;
    width: 100%;
    max-width: 100%;
  }
  table.stack-table > thead { display: none; }

  /* 卡片：两列网格 */
  table.stack-table > tbody > tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    gap: 10px 12px;
    padding: 13px 14px;
    margin: 0 0 10px 0;
    background: #fff;
    border: 1px solid #e5eaf1;
    border-radius: 12px;
    box-shadow: 0 4px 14px rgba(15, 23, 42, .04);
  }

  /* 单元格 */
  table.stack-table > tbody > tr > td {
    display: block;
    position: static;
    float: none;
    width: auto;
    min-width: 0;
    max-width: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
    text-align: left;
    vertical-align: top;
    font-size: 11.5px;
    line-height: 1.45;
    color: #334155;
    /* 解除一切截断与不换行 */
    white-space: normal;
    word-break: break-word;
    overflow-wrap: break-word;
    overflow: visible;
    text-overflow: clip;
  }
  table.stack-table > tbody > tr > td::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 2px;
    color: var(--muted-2);
    font-size: 9px;
    font-weight: 600;
    line-height: 1.3;
    white-space: normal;
  }

  /* 首列：整行、标题样式 */
  table.stack-table > tbody > tr > td:first-child {
    grid-column: 1 / -1;
    width: 100%;
    padding-bottom: 8px;
    margin-bottom: 2px;
    border-bottom: 1px solid var(--line-soft);
  }
  table.stack-table > tbody > tr > td:first-child::before { display: none; }

  /* 最后一列（操作）：整行 */
  table.stack-table > tbody > tr > td:last-child {
    grid-column: 1 / -1;
    width: 100%;
    padding-top: 9px;
    margin-top: 2px;
    border-top: 1px solid var(--line-soft);
  }
  table.stack-table > tbody > tr > td:last-child::before { display: none; }

  /* 单元格内部元素：解除截断 */
  table.stack-table > tbody > tr > td > div,
  table.stack-table > tbody > tr > td > span,
  table.stack-table > tbody > tr > td > strong,
  table.stack-table > tbody > tr > td > a,
  table.stack-table > tbody > tr > td .row-title,
  table.stack-table > tbody > tr > td .row-sub {
    display: block;
    max-width: 100%;
    min-width: 0;
    white-space: normal;
    word-break: break-word;
    overflow-wrap: break-word;
    overflow: visible;
    text-overflow: clip;
    -webkit-line-clamp: unset;
    text-align: left;
  }
  table.stack-table > tbody > tr > td .row-title {
    font-size: 13.5px;
    font-weight: 700;
    line-height: 1.4;
    color: var(--ink);
  }
  table.stack-table > tbody > tr > td .row-sub {
    font-size: 9.5px;
    line-height: 1.45;
    color: var(--muted-2);
    margin-top: 3px;
  }

  /* 隐藏首列里重复的快捷操作 */
  table.stack-table > tbody > tr > td .row-quick-actions { display: none; }

  /* 金额左对齐 */
  table.stack-table > tbody > tr > td.num,
  table.stack-table > tbody > tr > td.right { text-align: left; }

  /* 操作按钮 */
  table.stack-table > tbody > tr > td .inline-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    width: 100%;
  }
  table.stack-table > tbody > tr > td .btn {
    flex: 1 1 auto;
    min-height: 30px;
    justify-content: center;
  }

  /* 合计行 */
  table.stack-table > tfoot > tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    gap: 10px 12px;
    padding: 12px 14px;
    margin-top: 10px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
  }
  table.stack-table > tfoot > tr > td {
    display: block;
    position: static;
    width: auto;
    min-width: 0;
    max-width: 100%;
    padding: 0;
    border: 0;
    background: transparent;
    text-align: left;
    white-space: normal;
    word-break: break-word;
    overflow: visible;
    font-size: 11.5px;
  }
  table.stack-table > tfoot > tr > td::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 2px;
    color: var(--muted-2);
    font-size: 8.5px;
    font-weight: 600;
  }
  table.stack-table > tfoot > tr > td[colspan] {
    grid-column: 1 / -1;
    width: 100%;
    color: var(--muted);
    font-size: 12px;
  }
  table.stack-table > tfoot > tr > td[colspan]::before { display: none; }

  /* 空状态 */
  table.stack-table > tbody > tr > td[colspan] {
    grid-column: 1 / -1;
    display: block;
    border: 0;
  }
  table.stack-table > tbody > tr > td[colspan]::before { display: none; }
}

/* ══════════════════════════════════════════════════════════════
   手机端卡片化 · 越界修复（2026-10-29 21:06）★ 真正的元凶
   ─────────────────────────────────────────────────────────────
   styles.css:1366 有一条：
       .table-wrap { margin: 0 -16px; width: calc(100% + 32px); }
   作用是让「横向滑动的表格」向外撑开 32px，贴着屏幕边缘滑动。
   但它对卡片模式是灾难：卡片被拉出屏幕左右各 16px，
   表现为「左边内容被切掉、卡片贴边、文字显示不全」。

   为什么之前查不出来：
   我一直在查 td / tr / grid 的宽度，没查外层容器的**负边距**。

   修复：卡片模式下把负边距和撑宽全部还原。
   ══════════════════════════════════════════════════════════════ */
@media (max-width: 900px) {
  /* 含卡片表格的容器：还原负边距，宽度回归 100% */
  /* 原 :has() 选择器已删除，统一走 JS 打的 .stack-wrap 类名（见下方规则） */
  /* 不依赖 :has 的兜底：直接给表格父级 class 生效（JS 会给 table-wrap 加 stack-wrap） */
  .table-wrap.stack-wrap {
    margin-left: 0 !important;
    margin-right: 0 !important;
    width: auto !important;
    max-width: 100% !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
  }
  /* 首尾单元格的补偿内边距也一并还原（原本是给贴边滚动用的） */
  .table-wrap.stack-wrap table.stack-table > tbody > tr > td:first-child,
  .table-wrap.stack-wrap table.stack-table > tbody > tr > td:last-child {
    padding-left: 0 !important;
    padding-right: 0 !important;
  }
}

/* ══════════════════════════════════════════════════════════════
   手机端 · 第四轮修复（2026-10-29 21:35）
   逐页截图检查发现的问题：
     ① 空状态「没有匹配的业务」出现双重边框（表格行卡片的边框 + .empty 自带边框）
     ② 空状态下仍显示「← 左右滑动查看更多 →」，但根本没有数据可滑
     ③ 日常支出「输入新标签」的占位文字被右侧「+ 添加标签」按钮压住、显示不全
     ④ 首页横向滑动的 KPI 卡片第三张被切掉一半，且各卡片高度不齐
   ══════════════════════════════════════════════════════════════ */
@media (max-width: 900px) {
  /* ① 空状态行：取消行卡片的边框/背景/阴影，只留 .empty 自己的样式 */
  table.stack-table > tbody > tr > td[colspan] {
    grid-column: 1 / -1 !important;
    display: block !important;
    width: 100% !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    padding: 0 !important;
  }
  table.stack-table > tbody > tr > td[colspan]::before { display: none !important; }
  /* 整行只有 colspan 一格时，行本身也要去掉卡片外观 */
  table.stack-table > tbody > tr > td[colspan]:only-child {
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    padding: 0 !important;
  }
}

/* ④ 首页横向滑动 KPI 卡片：加大露出比例、统一高度 */
@media (max-width: 560px) {
  /* 让每张卡更宽一点，避免第三张只露一半看不清内容 */
  .kpi-scroll > .kpi-card,
  .kpi-strip > .kpi-card { flex: 0 0 78% !important; }
  /* 滑动容器内的卡片强制等高，避免底部灰条参差 */
  .kpi-scroll, .kpi-strip { align-items: stretch !important; }
  .kpi-scroll > .kpi-card, .kpi-strip > .kpi-card { height: auto !important; align-self: stretch !important; }
}

/* ③ 标签输入框 + 按钮同行时，给按钮留出空间，别压住占位文字 */
@media (max-width: 560px) {
  .tag-input-row,
  .tag-add-row,
  .expense-tag-input {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
    align-items: center !important;
    width: 100% !important;
  }
  .tag-input-row > .input,
  .tag-add-row > .input,
  .expense-tag-input > .input {
    flex: 1 1 100% !important;
    width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
  }
  .tag-input-row > .btn,
  .tag-add-row > .btn,
  .expense-tag-input > .btn {
    flex: 0 0 auto !important;
  }
}

/* ② 空状态时隐藏「左右滑动查看更多」提示条 */
@media (max-width: 900px) {
  /* .table-wrap 内只有空状态行时，不显示滚动提示 */
  .table-wrap.is-empty-table::after {
    display: none !important;
    content: none !important;
  }
}

/* ── 首页 KPI 卡片：按数量切换布局（纯类名，不依赖 :has） ── */
@media (max-width: 560px) {
  /* 5 张 / 6 张及以上 → 横向滑动，每张露出 78%，不会只露一半 */
  .kpi-grid.kpi-count-5,
  .kpi-grid.kpi-count-6 {
    display: flex !important;
    grid-template-columns: none !important;
    gap: 9px !important;
    overflow-x: auto !important;
    scroll-snap-type: x mandatory;
    align-items: stretch !important;
    padding-bottom: 6px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .kpi-grid.kpi-count-5::-webkit-scrollbar,
  .kpi-grid.kpi-count-6::-webkit-scrollbar { display: none; }
  .kpi-grid.kpi-count-5 > .kpi-card,
  .kpi-grid.kpi-count-6 > .kpi-card {
    flex: 0 0 78% !important;
    min-width: 0 !important;
    scroll-snap-align: start;
    height: auto !important;
    align-self: stretch !important;
    display: flex;
    flex-direction: column;
  }
  /* 卡片底部说明文字推到最底，保证多张卡对齐 */
  .kpi-grid.kpi-count-5 > .kpi-card .kpi-meta,
  .kpi-grid.kpi-count-6 > .kpi-card .kpi-meta { margin-top: auto; }

  /* 3 张：第一张满宽 + 后两张各半 */
  .kpi-grid.kpi-count-3 { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .kpi-grid.kpi-count-3 > .kpi-card:first-child { grid-column: 1 / -1; }
  /* 4 张：2×2 */
  .kpi-grid.kpi-count-4 { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
}

/* 空状态表格不显示滚动提示 */
@media (max-width: 900px) {
  .table-wrap.is-empty-table::after { display: none !important; content: none !important; }
}

/* ── 空状态行：彻底去掉卡片外观（用更高特异性压过 .stack-wrap 的 tr 规则） ──
   ⚠️ 这里只能靠 JS 打的 .is-empty-table 类判定，绝不能写 :last-child:first-child
   那类「看起来像唯一一行」的选择器 —— 台账只有 1 条业务时，那一行是正常卡片，
   会被误判成空状态，导致内边距被清零、文字贴边（2026-10-29 线上实际踩到）。 */
@media (max-width: 900px) {
  table.stack-table.is-empty-table > tbody > tr,
  .table-wrap.stack-wrap table.stack-table.is-empty-table > tbody > tr {
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    padding: 0 !important;
    gap: 0 !important;
    border-radius: 0 !important;
  }
  /* 空状态行里的单元格也不要卡片内边距 */
  table.stack-table.is-empty-table > tbody > tr > td {
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
  }
}

/* ── 标签输入行（实际类名 .tag-editor-add）：手机上输入框独占一行，按钮另起一行 ── */
@media (max-width: 560px) {
  .tag-editor-add {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }
  .tag-editor-add .input {
    flex: 1 1 100% !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
  .tag-editor-add .btn {
    flex: 0 0 auto !important;
    margin-left: auto !important;
  }
}

/* ══════════════════════════════════════════════════════════════
   手机端 · 底部导航遮挡修复（2026-10-29 21:50）
   问题：底部导航 .mobile-nav 固定定位，高度约 61px（含 iPhone 安全区约 95px），
        但 .content 的 padding-bottom 只有 32px，
        导致页面滚到最底时，最后一块内容/按钮被导航压住。
   修复：给内容区预留「导航高度 + 安全区 + 余量」，并用 CSS 变量统一，避免各处重复写死。
   ══════════════════════════════════════════════════════════════ */
:root { --mobile-nav-h: 61px; }

@media (max-width: 900px) {
  /* 内容区底部为底部导航让位：导航高度 + 安全区 + 16px 余量 */
  .content {
    padding-bottom: calc(var(--mobile-nav-h) + env(safe-area-inset-bottom, 0px) + 16px) !important;
  }
  /* 弹窗底部按钮也不能被导航盖住 */
  .modal { padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 8px); }
  /* 底部提示类文字（如「最多 100 个标签…」）不要贴到导航上沿 */
  .page > :last-child, .stack > :last-child { margin-bottom: 4px; }
}

/* ══════════════════════════════════════════════════════════════
   手机端台账卡片 · 徽章/标签被撑满整格修复（2026-10-29 22:50）
   ─────────────────────────────────────────────────────────────
   现象：卡片里「门店」「当前阶段」的值是一整条绿色长条，
        而不是一个小小的胶囊徽章，看起来像色块糊在卡片上。
   原因：卡片化时为了「解除文字截断」写过
        `table.stack-table > tbody > tr > td > span { display: block !important }`
        这条规则把 `.badge` / `.tag` 的 inline-flex 也改成了 block，
        块级元素在网格格里会占满整行宽度，于是徽章被拉成 157px 长的色条。
   修复：徽章、标签、按钮组单独恢复为「按内容宽度排列」。
   ══════════════════════════════════════════════════════════════ */
@media (max-width: 900px) {
  table.stack-table > tbody > tr > td > .badge,
  table.stack-table > tbody > tr > td > .tag,
  table.stack-table > tbody > tr > td > .pill,
  table.stack-table > tbody > tr > td > .chip {
    display: inline-flex !important;
    width: auto !important;
    max-width: 100% !important;
    align-self: flex-start !important;
    justify-self: start !important;
    vertical-align: middle;
  }
  /* 徽章/标签里的文字同样允许换行，但宽度跟着内容走 */
  table.stack-table > tbody > tr > td > .badge > span,
  table.stack-table > tbody > tr > td > .tag > span {
    display: inline !important;
    width: auto !important;
  }
  /* 操作按钮组：底部操作列按内容排列，不要铺满。
     注意不要在这里给 .row-quick-actions 设 display，
     它需要保持隐藏（首列里那组按钮和底部操作重复）。 */
  table.stack-table > tbody > tr > td > .inline-actions {
    display: flex !important;
    width: 100% !important;
  }
  /* 单元格内部的 div 仍然占满宽度（用于多行文字），但徽章类除外 */
  table.stack-table > tbody > tr > td > div.row-title,
  table.stack-table > tbody > tr > td > div.row-sub {
    width: 100% !important;
  }
}

/* ══════════════════════════════════════════════════════════════
   业务台账 · 紧凑列表样式（2026-10-29 23:30）
   用户要求：只显示「日期 / 客户名 / 小区房号 / 阶段」，点一行看详情。
   替代原来的宽表格 / 大卡片，好处是一屏能看更多条。
   电脑和手机共用一套样式，只调字号与间距。
   ══════════════════════════════════════════════════════════════ */
.ledger-list { display: flex; flex-direction: column; }

.ledger-row {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr) auto 16px;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line-soft);
  cursor: pointer;
  transition: background .14s ease;
  text-align: left;
}
.ledger-row:last-child { border-bottom: 0; }
.ledger-row:hover { background: #f8faff; }
.ledger-row:active { background: var(--brand-soft); }
.ledger-row:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.ledger-row.is-void { opacity: .5; }

/* 左：日期 + 编号 */
.ledger-row-date {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.ledger-row-date strong {
  color: var(--ink-2);
  font-family: var(--font-num);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
}
.ledger-row-date span {
  color: var(--muted-2);
  font-size: 9px;
  font-family: var(--font-num);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 中：客户名 + 小区房号 */
.ledger-row-main {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.ledger-row-title {
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 650;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ledger-row-sub {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 右：阶段徽章 */
.ledger-row-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex: 0 0 auto;
}
.ledger-row-right .badge { white-space: nowrap; }
.ledger-row > svg { color: var(--line-strong); flex: 0 0 16px; }
.ledger-row:hover > svg { color: var(--brand); }

/* ── 手机端：字号稍大一点，方便点 ── */
@media (max-width: 900px) {
  .ledger-row {
    grid-template-columns: 58px minmax(0, 1fr) auto 14px;
    gap: 10px;
    padding: 13px 14px;
  }
  .ledger-row-date strong { font-size: 14px; }
  .ledger-row-date span { font-size: 8.5px; }
  .ledger-row-title { font-size: 13.5px; }
  /* 手机上小区名允许显示两行，避免长名字全被省略号吃掉 */
  .ledger-row-sub {
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 11px;
  }
  .ledger-row-right .badge { font-size: 9px; height: 20px; }
}

/* ── 超窄屏（≤360）进一步压缩日期列 ── */
@media (max-width: 360px) {
  .ledger-row { grid-template-columns: 50px minmax(0, 1fr) auto 12px; gap: 8px; padding: 12px 12px; }
  .ledger-row-date strong { font-size: 13px; }
  .ledger-row-title { font-size: 13px; }
  .ledger-row-right .badge { font-size: 8.5px; padding: 0 6px; }
}

/* ── 电脑宽屏：列表内容限制最大宽度，避免日期和阶段被拉得太远 ── */
@media (min-width: 901px) {
  .ledger-row {
    grid-template-columns: 88px minmax(0, 1fr) minmax(120px, 200px) 16px;
    gap: 16px;
    padding: 13px 20px;
  }
  /* 客户名和小区名放在同一行显示，宽屏用一行更紧凑 */
  .ledger-row-main { flex-direction: row; align-items: baseline; gap: 14px; }
  .ledger-row-title { flex: 0 0 auto; max-width: 42%; }
  .ledger-row-sub { flex: 1 1 auto; min-width: 0; }
  .ledger-row-right { justify-content: flex-end; }
}

/* ══════════════════════════════════════════════════════════════
   工资结算 · 员工工资列表（2026-10-30）
   原来 14 列的宽表，手机上一屏只能看 1 个人。
   改成列表：一行显示「姓名 / 底薪 / 提成 / 扣款 / 实发」，点开看完整工资条。
   ══════════════════════════════════════════════════════════════ */
.pay-list { display: flex; flex-direction: column; }

.pay-row {
  display: grid;
  grid-template-columns: minmax(140px, 1.2fr) minmax(0, 1.6fr) auto 16px;
  align-items: center;
  gap: 16px;
  padding: 13px 18px;
  border-bottom: 1px solid var(--line-soft);
  cursor: pointer;
  transition: background .14s ease;
}
.pay-row:last-child { border-bottom: 0; }
.pay-row:hover { background: #f8faff; }
.pay-row:active { background: var(--brand-soft); }
.pay-row:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }

/* 姓名 + 门店角标 */
.pay-row-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.pay-row-name {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--ink-2);
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.3;
}
.pay-row-store {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 4px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 9px;
  font-weight: 700;
  flex: 0 0 auto;
}
.pay-row-sub {
  color: var(--muted-2);
  font-size: 10px;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 底薪 / 提成 / 扣款 */
.pay-row-figures { display: flex; gap: 18px; min-width: 0; }
.pay-fig {
  display: flex;
  flex-direction: column;
  gap: 2px;
  color: #334155;
  font-family: var(--font-num);
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
}
.pay-fig i {
  color: var(--muted-2);
  font-family: inherit;
  font-size: 9px;
  font-style: normal;
  font-weight: 600;
}
.pay-fig.is-deduct { color: #b95547; }

/* 实发 */
.pay-row-total {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  min-width: 86px;
  flex: 0 0 auto;
}
.pay-row-total strong {
  color: var(--ink);
  font-family: var(--font-num);
  font-size: 16px;
  font-weight: 750;
  line-height: 1.2;
}
.pay-row-total span { font-size: 9px; font-weight: 600; }
.pay-row > svg { color: var(--line-strong); flex: 0 0 16px; }
.pay-row:hover > svg { color: var(--brand); }

/* 合计条 */
.pay-list-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 18px;
  border-top: 1px solid #e2e8f0;
  background: #f8fafc;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
}
.pay-list-total strong {
  margin-left: 6px;
  color: var(--ink);
  font-family: var(--font-num);
  font-size: 15px;
  font-weight: 750;
}

/* ── 手机端：改成两行式，避免横向挤压 ── */
@media (max-width: 900px) {
  .pay-row {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "main total"
      "figs figs";
    gap: 9px 10px;
    padding: 13px 14px;
  }
  .pay-row-main { grid-area: main; }
  .pay-row-total { grid-area: total; align-items: flex-end; }
  .pay-row-total strong { font-size: 17px; }
  .pay-row-figures {
    grid-area: figs;
    gap: 0;
    justify-content: space-between;
    padding-top: 8px;
    border-top: 1px dashed var(--line-soft);
  }
  .pay-fig { flex: 1 1 0; font-size: 12.5px; }
  /* 手机上不需要箭头（整行都能点，且已有右侧金额） */
  .pay-row > svg { display: none; }
  .pay-list-total { padding: 12px 14px; }
  .pay-list-total strong { font-size: 16px; }
}

/* 超窄屏 */
@media (max-width: 360px) {
  .pay-fig { font-size: 11.5px; }
  .pay-row-total strong { font-size: 15.5px; }
  .pay-row-name { font-size: 13px; }
}

/* ── 工资列表：紧凑化（手机端一屏多看几人） ── */
@media (max-width: 900px) {
  .pay-row {
    gap: 6px 10px;
    padding: 11px 14px;
  }
  /* 三项数字直接排在副标题下方同一区，减少一条分隔线占位 */
  .pay-row-figures {
    padding-top: 6px;
    margin-top: 0;
  }
  .pay-fig { font-size: 12px; gap: 1px; }
  .pay-fig i { font-size: 8.5px; }
  .pay-row-total strong { font-size: 16.5px; }
  .pay-row-total span { font-size: 8.5px; }
  .pay-row-name { font-size: 13px; }
  .pay-row-sub { font-size: 9.5px; }
}

/* ══════════════════════════════════════════════════════════════
   日常支出 + 员工档案 · 列表样式（2026-10-30）
   与业务台账、工资结算统一为列表形式。
   ══════════════════════════════════════════════════════════════ */

/* ── 日常支出列表 ── */
.exp-list { display: flex; flex-direction: column; }
.exp-row {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr) auto 16px;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line-soft);
  cursor: pointer;
  transition: background .14s ease;
}
.exp-row:last-child { border-bottom: 0; }
.exp-row:hover { background: #f8faff; }
.exp-row:active { background: var(--brand-soft); }
.exp-row:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.exp-row.is-void { opacity: .55; cursor: default; }

.exp-row-date { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.exp-row-date strong {
  color: var(--ink-2); font-family: var(--font-num); font-size: 13px;
  font-weight: 700; line-height: 1.2; white-space: nowrap;
}
.exp-row-date span { color: var(--muted-2); font-size: 9px; white-space: nowrap; }

.exp-row-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.exp-row-title { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.exp-row-sub {
  color: var(--muted); font-size: 11px; line-height: 1.35;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.exp-row-amount { flex: 0 0 auto; min-width: 76px; text-align: right; }
.exp-row-amount strong {
  color: var(--ink); font-family: var(--font-num); font-size: 15px; font-weight: 750;
}
.exp-row.is-void .exp-row-amount strong { text-decoration: line-through; color: var(--muted-2); }
.exp-row > svg { color: var(--line-strong); flex: 0 0 16px; }
.exp-row:hover > svg { color: var(--brand); }

/* ── 员工档案列表 ── */
.emp-list { display: flex; flex-direction: column; }
.emp-row {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto 16px;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line-soft);
  cursor: pointer;
  transition: background .14s ease;
}
.emp-row:last-child { border-bottom: 0; }
.emp-row:hover { background: #f8faff; }
.emp-row:active { background: var(--brand-soft); }
.emp-row:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }

.emp-row-avatar {
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg, var(--brand-soft), #e0e7ff);
  color: var(--brand-hover); font-size: 15px; font-weight: 700; flex: 0 0 36px;
}

.emp-row-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.emp-row-name {
  display: flex; align-items: center; gap: 6px;
  color: var(--ink-2); font-size: 13.5px; font-weight: 700; line-height: 1.3;
}
.emp-row-store {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 16px; height: 16px; padding: 0 4px; border-radius: 4px;
  background: var(--brand-soft); color: var(--brand); font-size: 9px; font-weight: 700; flex: 0 0 auto;
}
.emp-row-sub {
  color: var(--muted-2); font-size: 10px; line-height: 1.35;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.emp-row-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.emp-row-tags .tag { font-size: 9px; padding: 1px 6px; }

.emp-row-right {
  display: flex; flex-direction: column; align-items: flex-end; gap: 3px;
  flex: 0 0 auto; min-width: 78px;
}
.emp-row-right strong {
  color: var(--ink); font-family: var(--font-num); font-size: 14px; font-weight: 750;
}
.emp-row > svg { color: var(--line-strong); flex: 0 0 16px; }
.emp-row:hover > svg { color: var(--brand); }

/* ── 手机端适配 ── */
@media (max-width: 900px) {
  .exp-row { grid-template-columns: 56px minmax(0, 1fr) auto; gap: 10px; padding: 12px 14px; }
  .exp-row > svg { display: none; }
  .exp-row-date strong { font-size: 13.5px; }
  .exp-row-amount { min-width: 68px; }
  .exp-row-amount strong { font-size: 14.5px; }
  .exp-row-sub { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; }

  .emp-row { grid-template-columns: 32px minmax(0, 1fr) auto; gap: 10px; padding: 12px 14px; }
  .emp-row > svg { display: none; }
  .emp-row-avatar { width: 32px; height: 32px; font-size: 14px; flex: 0 0 32px; }
  .emp-row-right { min-width: 70px; }
  .emp-row-right strong { font-size: 13.5px; }
}

@media (max-width: 360px) {
  .exp-row { grid-template-columns: 50px minmax(0, 1fr) auto; gap: 8px; padding: 11px 12px; }
  .exp-row-amount strong { font-size: 14px; }
  .emp-row-right strong { font-size: 13px; }
  .emp-row-tags .tag { font-size: 8.5px; }
}

/* ══════════════════════════════════════════════════════════════
   端口报销 + 返佣审批 · 列表样式（2026-10-30）
   ══════════════════════════════════════════════════════════════ */

/* ── 端口报销列表 ── */
.port-list { display: flex; flex-direction: column; }
.port-row {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr) auto 16px;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line-soft);
  cursor: pointer;
  transition: background .14s ease;
}
.port-row:last-child { border-bottom: 0; }
.port-row:hover { background: #f8faff; }
.port-row:active { background: var(--brand-soft); }
.port-row:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.port-row.is-void { opacity: .55; cursor: default; }

.port-row-date { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.port-row-date strong {
  color: var(--ink-2); font-family: var(--font-num); font-size: 13px;
  font-weight: 700; line-height: 1.2; white-space: nowrap;
}
.port-row-date span { color: var(--muted-2); font-size: 9px; white-space: nowrap; }

.port-row-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.port-row-title { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.port-row-sub {
  color: var(--muted); font-size: 11px; line-height: 1.35;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.port-row-amount {
  display: flex; flex-direction: column; align-items: flex-end; gap: 2px;
  flex: 0 0 auto; min-width: 82px;
}
.port-row-amount strong { color: var(--ink); font-family: var(--font-num); font-size: 15px; font-weight: 750; }
.port-row-amount span { color: var(--muted-2); font-size: 9px; white-space: nowrap; }
.port-row.is-void .port-row-amount strong { text-decoration: line-through; color: var(--muted-2); }
.port-row > svg { color: var(--line-strong); flex: 0 0 16px; }
.port-row:hover > svg { color: var(--brand); }

/* ── 返佣审批列表 ── */
.reb-list { display: flex; flex-direction: column; }
.reb-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  align-items: center;
  gap: 16px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line-soft);
  cursor: pointer;
  transition: background .14s ease;
}
.reb-row:last-child { border-bottom: 0; }
.reb-row:hover { background: #f8faff; }
.reb-row:active { background: var(--brand-soft); }
.reb-row:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }

.reb-row-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.reb-row-title {
  display: flex; align-items: center; gap: 6px;
  color: var(--ink-2); font-size: 13.5px; font-weight: 700; line-height: 1.35;
}
.reb-row-store {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 16px; height: 16px; padding: 0 4px; border-radius: 4px;
  background: var(--brand-soft); color: var(--brand); font-size: 9px; font-weight: 700; flex: 0 0 auto;
}
.reb-row-sub {
  color: var(--muted-2); font-size: 10px; line-height: 1.35;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.reb-row-reason {
  color: var(--muted); font-size: 11px; line-height: 1.4;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.reb-row-status {
  display: flex; flex-direction: column; align-items: flex-start; gap: 3px;
  flex: 0 0 auto; min-width: 96px;
}
.reb-row-node { color: var(--muted-2); font-size: 9px; white-space: nowrap; }

.reb-row-amount {
  display: flex; flex-direction: column; align-items: flex-end; gap: 2px;
  flex: 0 0 auto; min-width: 88px;
}
.reb-row-amount strong { color: var(--ink); font-family: var(--font-num); font-size: 15px; font-weight: 750; }
.reb-row-amount span { color: var(--muted-2); font-size: 9px; white-space: nowrap; }
.reb-row > svg { color: var(--line-strong); flex: 0 0 16px; }
.reb-row-btn { flex: 0 0 auto; white-space: nowrap; }

/* ── 手机端 ── */
@media (max-width: 900px) {
  .port-row { grid-template-columns: 56px minmax(0, 1fr) auto; gap: 10px; padding: 12px 14px; }
  .port-row > svg { display: none; }
  .port-row-date strong { font-size: 13.5px; }
  .port-row-amount { min-width: 72px; }
  .port-row-amount strong { font-size: 14.5px; }
  .port-row-sub { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; }

  /* 返佣：手机上改成两行 —— 上行标题+金额，下行状态+审批按钮 */
  .reb-row {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "main amount"
      "status btn";
    gap: 8px 10px;
    padding: 12px 14px;
  }
  .reb-row-main { grid-area: main; }
  .reb-row-amount { grid-area: amount; }
  .reb-row-status { grid-area: status; flex-direction: row; align-items: center; gap: 8px; min-width: 0; }
  .reb-row-btn { grid-area: btn; justify-self: end; }
  .reb-row > svg { grid-area: btn; justify-self: end; }
  .reb-row-title { font-size: 13px; }
  .reb-row-reason { display: none; }
  .reb-row-amount strong { font-size: 15.5px; }
}

@media (max-width: 360px) {
  .port-row { grid-template-columns: 50px minmax(0, 1fr) auto; gap: 8px; padding: 11px 12px; }
  .reb-row { gap: 7px 8px; padding: 11px 12px; }
  .reb-row-amount strong { font-size: 14.5px; }
  .reb-row-btn { font-size: 10px; padding: 0 8px; }
}

/* ══════════════════════════════════════════════════════════════
   登录账号 + 门店管理 · 列表样式（2026-10-30）
   ══════════════════════════════════════════════════════════════ */

/* ── 登录账号列表 ── */
.acc-list { display: flex; flex-direction: column; }
.acc-row {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line-soft);
}
.acc-row:last-child { border-bottom: 0; }
.acc-row:hover { background: #fafbff; }
.acc-row.is-off { opacity: .55; }

.acc-row-avatar {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 11px;
  background: linear-gradient(135deg, #f1f5ff, #e6ecff);
  color: var(--brand-hover); font-size: 15px; font-weight: 700; flex: 0 0 38px;
}
.acc-dot {
  position: absolute; right: -2px; bottom: -2px;
  width: 11px; height: 11px; border-radius: 50%;
  border: 2px solid #fff;
}
.acc-dot.admin { background: #7c3aed; }
.acc-dot.boss { background: #b95547; }
.acc-dot.finance { background: #1f6b58; }
.acc-dot.manager { background: #c58b29; }
.acc-dot.employee { background: #0e7490; }

.acc-row-main { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.acc-row-name {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  color: var(--ink-2); font-size: 13.5px; font-weight: 700; line-height: 1.3;
}
.acc-self {
  display: inline-flex; padding: 1px 5px; border-radius: 4px;
  background: var(--brand-soft); color: var(--brand); font-size: 8.5px; font-weight: 700;
}
.acc-row-sub {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  color: var(--muted-2); font-size: 10px; line-height: 1.4;
}
.acc-meta {
  display: inline-flex; align-items: center; gap: 3px;
  white-space: nowrap;
}
.acc-meta + .acc-meta::before {
  content: "·"; margin-right: 4px; color: var(--line-strong);
}
.acc-row-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; flex: 0 0 auto; }

/* ── 门店列表 ── */
.store-list { display: flex; flex-direction: column; }
.store-row {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 16px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line-soft);
}
.store-row:last-child { border-bottom: 0; }
.store-row:hover { background: #fafbff; }

.store-row-badge {
  display: flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: 12px;
  font-size: 17px; font-weight: 700; flex: 0 0 44px;
}
.store-row-badge.is-on { background: linear-gradient(135deg, #ecfdf5, #d1fae5); color: #047857; }
.store-row-badge.is-off { background: #f1f5f9; color: var(--muted-2); }

.store-row-main { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.store-row-name {
  display: flex; align-items: center; gap: 7px; flex-wrap: wrap;
  color: var(--ink-2); font-size: 14px; font-weight: 700; line-height: 1.3;
}
.store-row-id {
  display: inline-flex; padding: 1px 6px; border-radius: 4px;
  background: #f1f5f9; color: var(--muted); font-size: 9px; font-weight: 700;
  font-family: var(--font-num);
}
.store-row-sub {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  color: var(--muted-2); font-size: 10.5px; line-height: 1.4;
}
.store-meta { white-space: nowrap; }
.store-meta + .store-meta::before { content: "·"; margin-right: 4px; color: var(--line-strong); }

.store-row-stats { display: flex; gap: 16px; flex: 0 0 auto; }
.store-stat {
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  min-width: 40px;
}
.store-stat strong {
  color: var(--ink-2); font-family: var(--font-num); font-size: 15px; font-weight: 750;
}
.store-stat i { color: var(--muted-2); font-size: 9px; font-style: normal; }
.store-row-btn { flex: 0 0 auto; }

/* ── 手机端 ── */
@media (max-width: 900px) {
  .acc-row {
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 10px;
    padding: 12px 14px;
  }
  .acc-row-avatar { width: 34px; height: 34px; font-size: 14px; flex: 0 0 34px; }
  .acc-row-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
    padding-top: 8px;
    border-top: 1px dashed var(--line-soft);
  }
  .acc-row > svg { display: none; }
  .acc-row-name { font-size: 13px; }
  .acc-row-sub { gap: 6px; font-size: 9.5px; }
  .acc-meta + .acc-meta::before { display: none; }
  .acc-meta {
    padding: 1px 6px; border-radius: 4px; background: #f8fafc;
  }

  .store-row {
    grid-template-columns: 38px minmax(0, 1fr);
    grid-template-areas:
      "badge main"
      "stats stats"
      "btn btn";
    gap: 9px 10px;
    padding: 12px 14px;
  }
  .store-row-badge { grid-area: badge; width: 38px; height: 38px; font-size: 15px; flex: 0 0 38px; }
  .store-row-main { grid-area: main; }
  .store-row-name { font-size: 13.5px; }
  .store-row-stats {
    grid-area: stats;
    justify-content: flex-start;
    gap: 24px;
    padding-top: 8px;
    border-top: 1px dashed var(--line-soft);
  }
  .store-stat { flex-direction: row; align-items: baseline; gap: 4px; min-width: 0; }
  .store-stat strong { font-size: 13.5px; }
  .store-row-btn { grid-area: btn; justify-self: start; }
}

@media (max-width: 360px) {
  .acc-row-avatar { width: 30px; height: 30px; flex: 0 0 30px; font-size: 13px; }
  .store-row-name { font-size: 13px; }
  .acc-row-actions .btn, .store-row-btn { font-size: 10px; padding: 0 8px; }
}

/* ── 账号列表：压缩纵向空间，减少空白 ── */
@media (max-width: 900px) {
  .acc-row { gap: 8px 10px; padding: 11px 14px; }
  .acc-row-main { gap: 3px; }
  .acc-row-sub {
    gap: 4px 6px;
    font-size: 9px;
  }
  /* 手机上把两行副信息合并成一行流式排布 */
  .acc-row-sub + .acc-row-sub {
    margin-top: 0;
    gap: 4px 6px;
  }
  .acc-meta {
    padding: 0;
    background: transparent;
    font-size: 9px;
  }
  .acc-meta + .acc-meta::before { display: inline; color: var(--line-strong); margin-right: 2px; }
  .acc-row-actions { padding-top: 7px; gap: 5px; }
  .acc-row-actions .btn { height: 26px; font-size: 10px; padding: 0 9px; }
  .acc-row-name { font-size: 13px; gap: 5px; }
  .acc-row-name .badge { height: 17px; font-size: 8px; padding: 0 5px; }
  .acc-row-avatar { border-radius: 9px; }
}

/* ── 门店列表：压缩纵向空间 ── */
@media (max-width: 900px) {
  .store-row {
    gap: 7px 10px;
    padding: 11px 14px;
  }
  .store-row-main { gap: 3px; }
  /* 地址和开业月份合成一行，账号信息合成另一行 */
  .store-row-sub { gap: 4px 6px; font-size: 10px; }
  .store-meta + .store-meta::before { display: inline; margin-right: 2px; color: var(--line-strong); }
  .store-row-stats {
    padding-top: 7px;
    gap: 20px;
    border-top: 1px dashed var(--line-soft);
  }
  .store-stat strong { font-size: 13px; }
  .store-stat i { font-size: 8.5px; }
  .store-row-btn { height: 26px; font-size: 10px; padding: 0 10px; }
  .store-row-name { gap: 5px; }
  .store-row-name .badge { height: 17px; font-size: 8px; padding: 0 5px; }
}

/* ── 门店列表：编辑按钮移到右上角，去掉单独一行 ── */
@media (max-width: 900px) {
  .store-row {
    grid-template-columns: 38px minmax(0, 1fr) auto;
    grid-template-areas:
      "badge main btn"
      "stats stats stats";
    gap: 8px 10px;
  }
  .store-row-btn {
    grid-area: btn;
    align-self: start;
    justify-self: end;
  }
  .store-row-stats { grid-area: stats; }
}

/* ── 账号列表：删除按钮（红字，不抢编辑/改密码的视觉）── */
.acc-del-btn {
  color: #b91c1c;
  border-color: #fecaca;
}
.acc-del-btn:hover {
  background: #fef2f2;
}
.acc-del-btn svg {
  width: 12px;
  height: 12px;
}
@media (max-width: 900px) {
  /* 手机上三个按钮并排会挤，允许换行并保持左对齐 */
  .acc-row-actions {
    flex-wrap: wrap;
    row-gap: 6px;
  }
  .acc-del-btn { margin-left: 0; }
}

/* ── 账号回收站：手机端防止 .list-main 被压成竖排单字 ── */
.employee-recycle-row .list-main { flex: 1 1 auto; min-width: 0; }
.employee-recycle-row .list-sub,
.employee-recycle-row .list-title { overflow-wrap: anywhere; }

/* ══════════════════════════════════════════════════════════════
   双端视图切换：电脑端用原来的表格样式，手机端用紧凑列表。
   每个页面同时渲染「表格版(.view-desktop)」和「列表版(.view-mobile)」，
   由这里统一决定显示哪个 —— 只靠 CSS，不依赖 JS 判断，也不会漏切。
   断点与全站一致：900px（含）以下视为手机。
   ══════════════════════════════════════════════════════════════ */
.view-mobile { display: none; }
.view-desktop { display: block; }
.only-mobile { display: none !important; }
.only-desktop { display: block; }

@media (max-width: 900px) {
  /* 手机上：表格整体隐藏，列表显示 */
  .view-desktop { display: none !important; }
  .view-mobile { display: block; }
  .view-mobile.ledger-list,
  .view-mobile.pay-list,
  .view-mobile.exp-list,
  .view-mobile.emp-list,
  .view-mobile.port-list,
  .view-mobile.reb-list,
  .view-mobile.acc-list,
  .view-mobile.store-list { display: flex; }

  .only-mobile { display: block !important; }
  .only-desktop { display: none !important; }
}

/* 平板/中等屏（901–1100px）表格列多，允许横向滚动，不压缩变形 */
@media (min-width: 901px) and (max-width: 1100px) {
  .view-desktop.table-wrap { overflow-x: auto; }
}

/* ══════════════════════════════════════════════════════════════
   Step 4 · 手机端触控与底部导航统一
   ══════════════════════════════════════════════════════════════ */
@media (max-width: 900px) {
  .mobile-nav {
    background: rgba(255,255,255,.96);
    border-top: 1px solid var(--line);
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(20px);
  }
  .mobile-nav button {
    min-height: var(--touch-target);
    color: var(--muted);
    font-size: var(--fs-xs);
    font-weight: 600;
  }
  .mobile-nav button.active {
    color: var(--brand-hover);
    background: var(--brand-soft);
  }

  .page-head-actions .btn,
  .panel-actions .btn,
  .modal-foot .btn,
  .filter-bar .btn,
  .detail-actions .btn {
    min-height: var(--touch-target);
  }

  .field .input,
  .field .select {
    height: var(--touch-target);
  }
}


/* WorkBuddy mobile-prototype alignment (390px) */
@media (max-width: 900px) {
  body { background: #f4f6fb; }
  .topbar { background: rgba(255,255,255,.96); border-bottom: 1px solid var(--line); }
  .mobile-nav {
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom, 0px));
    background: #fff;
    border-top: 1px solid var(--line);
    box-shadow: 0 -10px 34px rgba(15,23,42,.08);
    backdrop-filter: none;
  }
  .mobile-nav button {
    flex: 0 0 62px;
    min-height: 52px;
    gap: 3px;
    color: var(--muted-2);
    font-size: 10.5px;
    font-weight: 600;
    border-radius: 10px;
  }
  .mobile-nav button svg { width: 18px; height: 18px; }
  .mobile-nav button.active { color: var(--brand); background: var(--brand-soft); font-weight: 700; }

  .modal-backdrop { padding: 0; align-items: flex-end; }
  .modal { max-height: 92vh; border-radius: 20px 20px 0 0; width: 100%; }
}

/* WorkBuddy mobile drawer + quick-create FAB */
.mobile-nav-plus,
.mobile-drawer,
.mobile-drawer-mask { display: none; }

@media (max-width: 900px) {
  .mobile-drawer-mask {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 90;
    background: rgba(15,23,42,.42);
    opacity: 0;
    pointer-events: none;
    transition: opacity .22s ease;
  }
  .mobile-drawer-mask.on { opacity: 1; pointer-events: auto; }

  .mobile-drawer {
    display: block;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 91;
    max-height: 82vh;
    overflow-y: auto;
    padding: 10px 14px calc(16px + env(safe-area-inset-bottom, 0px));
    background: #fff;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -10px 34px rgba(15,23,42,.18);
    transform: translateY(105%);
    transition: transform .24s cubic-bezier(.32,.72,0,1);
  }
  .mobile-drawer.on { transform: translateY(0); }
  .mobile-drawer-grip {
    width: 38px;
    height: 4px;
    border-radius: 99px;
    background: #dbe2ec;
    margin: 0 auto 12px;
  }
  .mobile-drawer h4 {
    margin: 0 0 9px;
    font-size: 13px;
    color: var(--muted-2);
    font-weight: 600;
  }
  .mobile-drawer-item {
    display: flex;
    align-items: center;
    gap: 11px;
    width: 100%;
    padding: 12px;
    margin-bottom: 10px;
    background: #f8fafc;
    border: 1px solid var(--line);
    border-radius: 12px;
    color: var(--ink);
    text-align: left;
    font-family: inherit;
    font-size: 13px;
    cursor: pointer;
  }
  .mobile-drawer-item:active { background: var(--brand-soft); }
  .mobile-drawer-item > svg { width: 18px; height: 18px; color: var(--brand); flex: 0 0 18px; }
  .mobile-drawer-item > span { flex: 1; min-width: 0; }
  .mobile-drawer-item b { display: block; font-size: 13.5px; font-weight: 600; }
  .mobile-drawer-item small { display: block; font-size: 11px; color: var(--muted-2); }
  .mobile-drawer-item i { color: var(--muted-2); font-style: normal; font-size: 18px; }

  .mobile-nav-plus {
    display: block;
    position: relative;
    flex: 0 0 64px !important;
    min-height: 52px !important;
  }
  .mobile-nav-plus::before {
    content: "";
    position: absolute;
    top: -16px;
    left: 50%;
    transform: translateX(-50%);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(180deg, #5b54ea, #4f46e5);
    box-shadow: 0 6px 16px rgba(79,70,229,.42);
  }
  .mobile-nav-plus svg {
    position: relative;
    z-index: 1;
    width: 20px;
    height: 20px;
    color: #fff;
    margin-top: -20px;
  }
  .mobile-nav-plus span {
    position: relative;
    z-index: 1;
    margin-top: 5px;
    color: var(--brand);
    font-weight: 700;
  }
}

/* Fix: bottom nav FAB clipping and icon centering */
@media (max-width: 900px) {
  .mobile-nav { overflow: visible !important; justify-content: space-around; }
  .mobile-nav-plus { overflow: visible; }
  .mobile-nav-plus::before { top: -16px; }
  .mobile-nav-plus svg {
    position: absolute;
    top: -4px;
    left: 50%;
    transform: translateX(-50%);
    margin-top: 0;
    width: 20px;
    height: 20px;
    color: #fff;
    z-index: 2;
  }
  .mobile-nav-plus span {
    position: absolute;
    bottom: 2px;
    left: 0;
    right: 0;
    margin-top: 0;
    text-align: center;
    color: var(--brand);
    font-weight: 700;
    z-index: 2;
  }
}

/* Mobile more page + nav badges */
.mobile-nav button { position: relative; }
.mobile-nav .nav-badge {
  position: absolute;
  top: 3px;
  right: 6px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--danger);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  display: grid;
  place-items: center;
  box-shadow: 0 0 0 2px #fff;
  z-index: 3;
}
.more-page { padding-bottom: 8px; }
.more-section { margin-bottom: 18px; }
.more-section-title { margin: 0 0 8px; font-size: 12px; color: var(--muted); font-weight: 700; letter-spacing: .04em; }
.more-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 9px; }
.more-item {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 11px 10px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  text-align: left;
  color: var(--ink);
  cursor: pointer;
}
.more-item:active { border-color: var(--brand); background: var(--brand-soft); }
.more-item > svg { width: 20px; height: 20px; color: var(--brand); flex: 0 0 20px; }
.more-item-copy { flex: 1; min-width: 0; }
.more-item b { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 650; }
.more-item small { display: block; margin-top: 2px; font-size: 10.5px; color: var(--muted-2); line-height: 1.4; }
.more-item i { color: var(--muted-2); font-style: normal; font-size: 16px; }
.more-badge {
  display: inline-block;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 10px;
  font-weight: 700;
}
@media (min-width: 901px) {
  .more-grid { grid-template-columns: repeat(3, minmax(0,1fr)); }
}

/* More page: single-column list */
.more-grid { display: flex; flex-direction: column; gap: 8px; }
.more-item { width: 100%; }

/* ── 历史工资面板头部 ──
   右上角有 3 个筛选控件（员工 / 账期 / 年份）+ 导出按钮。
   默认 .panel-head 是 space-between，标题占宽后右侧只剩很窄一条，
   导致每个控件各自换行、把表格顶出面板。这里让控件区整体换行而不是逐个换行。 */
.panel-head.hist-head { flex-wrap: wrap; align-items: center; }
.panel-head.hist-head > div:first-child { flex: 1 1 240px; min-width: 0; }
.panel-head.hist-head .panel-actions {
  flex: 0 1 auto;
  flex-wrap: nowrap;
  justify-content: flex-end;
  gap: 6px;
}
.panel-head.hist-head .panel-actions .select,
.panel-head.hist-head .panel-actions .input {
  max-width: 130px;
  height: 30px;
  font-size: 12px;
}
.panel-head.hist-head .panel-actions .btn { white-space: nowrap; height: 30px; }
@media (max-width: 1180px) {
  .panel-head.hist-head .panel-actions { flex-wrap: wrap; justify-content: flex-start; }
}

/* ── 可撤销提示条：普通 toast 右边多一个「撤销」按钮 ── */
.toast.toast-undo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-right: 8px;
}
.toast-undo-btn {
  flex: 0 0 auto;
  border: 1px solid rgba(255, 255, 255, .45);
  background: rgba(255, 255, 255, .14);
  color: #fff;
  font: inherit;
  font-weight: 600;
  font-size: 12px;
  padding: 4px 12px;
  border-radius: 7px;
  cursor: pointer;
  white-space: nowrap;
}
.toast-undo-btn:hover { background: rgba(255, 255, 255, .26); }
.toast-undo-btn:active { transform: scale(.97); }

/* ── 撤销提示条必须能点 ──
   styles.css 里给 #toast-root 设了 pointer-events:none（避免提示条挡住页面点击），
   但带「撤销」按钮的那种必须能接收点击，否则按钮看得见点不动。
   这里只放开带按钮的那条，普通提示条仍然不挡点击。 */
#toast-root .toast.toast-undo { pointer-events: auto; cursor: default; }
#toast-root .toast.toast-undo .toast-undo-btn { pointer-events: auto; }

/* ══════════════════════════════════════════════════════════
   操作手册页（2026-11-15）
   布局：左边固定目录 + 右边内容。内容很长，没有目录根本没法用。
   ══════════════════════════════════════════════════════════ */
.help-layout {
  display: grid;
  grid-template-columns: 216px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}
.help-toc {
  position: sticky;
  top: 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 12px 10px;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
}
.help-toc-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .13em;
  color: var(--muted-2);
  padding: 4px 8px 9px;
}
.help-toc-item {
  width: 100%;
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 8px 8px;
  border: none;
  background: none;
  border-radius: 8px;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: background .15s;
}
.help-toc-item:hover { background: #f8fafc; }
.help-toc-item.is-active { background: #eef2ff; }
.help-toc-no {
  flex: 0 0 auto;
  font-size: 9.5px;
  font-weight: 700;
  color: var(--muted-2);
  padding-top: 2px;
  font-variant-numeric: tabular-nums;
}
.help-toc-item.is-active .help-toc-no { color: var(--accent); }
.help-toc-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.help-toc-text b { font-size: 12px; font-weight: 550; color: var(--ink-2); line-height: 1.35; }
.help-toc-text small { font-size: 10px; color: var(--muted-2); line-height: 1.35; }

.help-content { min-width: 0; }
.help-chapter {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 20px 22px;
  margin-bottom: 14px;
  scroll-margin-top: 12px;
  transition: box-shadow .3s;
}
.help-chapter.is-flash { box-shadow: 0 0 0 3px rgba(79,70,229,.18); }
.help-chapter-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 16px;
}
.help-chapter-no {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: grid;
  place-items: center;
  font-variant-numeric: tabular-nums;
}
.help-chapter-head h3 { margin: 0; font-size: 15px; font-weight: 600; color: var(--ink); }
.help-chapter-head p { margin: 3px 0 0; font-size: 11.5px; color: var(--muted); }
.help-chapter-body { font-size: 12.5px; line-height: 1.7; color: var(--ink-2); }

.help-h4 {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  margin: 20px 0 9px;
  padding-left: 9px;
  border-left: 3px solid var(--accent);
  line-height: 1.4;
}
.help-h4:first-child { margin-top: 0; }
.help-h5 { font-size: 12px; font-weight: 600; color: var(--ink); margin: 16px 0 7px; }
.help-p { margin: 8px 0; }

.help-step {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 9px 0;
  border-bottom: 1px dashed var(--line);
}
.help-step:last-child { border-bottom: none; }
.help-step-no {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #eef2ff;
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  display: grid;
  place-items: center;
  margin-top: 1px;
}

.help-table-wrap { overflow-x: auto; margin: 10px 0; border: 1px solid var(--line); border-radius: 10px; }
.help-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.help-table th {
  background: #f8fafc;
  text-align: left;
  padding: 9px 11px;
  font-weight: 600;
  color: var(--ink-2);
  font-size: 11px;
  white-space: nowrap;
  border-bottom: 1px solid var(--line);
}
.help-table td {
  padding: 9px 11px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: top;
  color: var(--ink-2);
}
.help-table tr:last-child td { border-bottom: none; }
.help-table code {
  background: #f1f5f9;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 11.5px;
}

.help-warn {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 9px;
  padding: 10px 12px;
  margin: 10px 0;
  font-size: 12px;
  line-height: 1.65;
  color: #78350f;
}
.help-warn svg { flex: 0 0 auto; width: 15px; height: 15px; margin-top: 1px; }

.help-warn-big {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 10px;
  padding: 13px 15px;
  margin: 12px 0;
  font-size: 12.5px;
  line-height: 1.7;
  color: #991b1b;
}

.help-example {
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 9px;
  padding: 10px 12px;
  margin: 10px 0;
  font-size: 12px;
  line-height: 1.7;
  color: #075985;
}
.help-example strong { display: block; margin-bottom: 3px; color: #0c4a6e; }

.help-flow {
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 9px;
  padding: 13px 15px;
  margin: 10px 0;
  font-size: 12px;
  color: var(--ink-2);
  text-align: center;
  line-height: 1.9;
}
.help-flow-v { margin: 10px 0; }
.help-flow-v > div {
  position: relative;
  padding: 7px 12px 7px 26px;
  font-size: 12px;
  color: var(--ink-2);
  background: #f8fafc;
  border-radius: 7px;
  margin-bottom: 5px;
}
.help-flow-v > div::before {
  content: '';
  position: absolute;
  left: 11px;
  top: 15px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
}

.help-role-card {
  background: linear-gradient(135deg, #4f46e5, #7c6cf0);
  border-radius: 12px;
  padding: 16px 18px;
  color: #fff;
  margin-bottom: 12px;
}
.help-role-title { font-size: 12px; font-weight: 600; opacity: .9; margin-bottom: 10px; }
.help-ol { margin: 0; padding-left: 20px; font-size: 12.5px; line-height: 1.85; }
.help-ol li { margin-bottom: 3px; }

.help-foot { text-align: center; font-size: 10.5px; color: var(--muted-2); padding: 10px 0 20px; line-height: 1.7; }

.hl-req { color: #b45309; font-weight: 600; font-size: 11px; }
.hl-warn { color: #b91c1c; }
.hl-ok { color: #047857; }

@media (max-width: 1180px) {
  .help-layout { grid-template-columns: 1fr; }
  .help-toc { position: static; max-height: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 4px; }
  .help-toc-title { grid-column: 1 / -1; }
  .help-toc-text small { display: none; }
}
