/* 同利 ERP · Claude 版设计系统
   单一样式入口：令牌 → 基础 → 外框 → 组件 → 页面模式 → 响应式 → 打印。
   旧模板沿用的类名（card / button / field / badge ...）在此统一重绘，业务模板无需逐页套壳。 */

/* ---------- 1. 设计令牌 ---------- */
:root {
  color-scheme: light;
  /* 品牌：取自同利标志的宝蓝与金色 */
  --brand-25: #f6f8ff; --brand-50: #eef2ff; --brand-100: #dfe7ff; --brand-200: #bfcffd;
  --brand-300: #93adf8; --brand-400: #5f84ef; --brand-500: #3563e3; --brand-600: #1f4fd1;
  --brand-700: #183eab; --brand-800: #163584; --brand-900: #0f245a;
  --gold-50: #fbf6ea; --gold-100: #f5e9cb; --gold-400: #d6aa55; --gold-500: #be8f36; --gold-700: #7d5b17;
  /* 中性色 */
  --n-0: #ffffff; --n-25: #fbfbfd; --n-50: #f5f6f9; --n-100: #eceef3; --n-150: #e3e6ed; --n-200: #d7dbe4;
  --n-300: #c0c6d2; --n-400: #959eaf; --n-500: #6a7385; --n-600: #4f5768; --n-700: #384050;
  --n-800: #242a36; --n-900: #151922;
  /* 语义 */
  --ok-50: #e9f7f0; --ok-200: #b6e3cb; --ok-600: #13805b; --ok-700: #0d6649;
  --warn-50: #fff5e3; --warn-200: #f4d79c; --warn-600: #a35f06; --warn-700: #7f4a05;
  --bad-50: #fdeeed; --bad-200: #f3c1bd; --bad-600: #c4372f; --bad-700: #9c2a23;
  --info-50: var(--brand-50); --info-600: var(--brand-600);
  /* 排版 */
  --font: "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei UI", "Microsoft YaHei", "Noto Sans SC", "Source Han Sans SC", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, "Liberation Mono", monospace;
  --fs-xs: 12px; --fs-sm: 13px; --fs-md: 14px; --fs-lg: 16px; --fs-xl: 20px; --fs-2xl: 24px;
  /* 形状与层次 */
  --r-sm: 6px; --r-md: 8px; --r-lg: 12px; --r-xl: 16px;
  --shadow-xs: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-sm: 0 1px 3px rgba(16, 24, 40, .08), 0 1px 2px rgba(16, 24, 40, .04);
  --shadow-md: 0 8px 24px rgba(16, 24, 40, .10), 0 2px 6px rgba(16, 24, 40, .05);
  --shadow-lg: 0 24px 48px rgba(16, 24, 40, .18);
  --ring: 0 0 0 3px rgba(31, 79, 209, .22);
  --appbar-h: 56px; --subnav-h: 44px; --content-max: 1680px; --gutter: 28px;
  --control-h: 36px;
  /* 兼容旧样式表与内联样式里的令牌名 */
  --navy: var(--brand-900); --navy-dark: #0b1b45; --blue: var(--brand-600); --blue-dark: var(--brand-700);
  --ink: var(--n-800); --muted: var(--n-500); --line: var(--n-150); --paper: var(--n-50); --white: #fff;
  --amber: var(--warn-600); --amber-bg: var(--warn-50); --green: var(--ok-600); --red: var(--bad-600);
  --radius: var(--r-lg); --border: var(--n-150); --text-secondary: var(--n-500); --brand-cyan: var(--gold-400);
}

/* ---------- 2. 基础 ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: var(--fs-md); line-height: 1.6; color: var(--ink); background: var(--paper); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
h1, h2, h3, h4 { color: var(--n-900); line-height: 1.35; }
h1 { font-size: var(--fs-2xl); } h2 { font-size: 18px; } h3 { font-size: var(--fs-lg); }
a { color: var(--brand-600); text-decoration: none; }
a:hover { color: var(--brand-700); text-decoration: underline; text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--brand-500); outline-offset: 2px; }
[hidden] { display: none !important; }
img { max-width: 100%; }
hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }
code, kbd, .code-value { font-family: var(--mono); }
.code-value { font-size: 12px; word-break: break-all; }
kbd { font-size: 11px; padding: 1px 5px; border: 1px solid var(--n-200); border-bottom-width: 2px; border-radius: 4px; background: var(--n-0); color: var(--n-600); }
.num, .amount, td.amount, .tabular { font-variant-numeric: tabular-nums; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 12px; top: -100px; z-index: 200; background: var(--n-0); padding: 10px 14px; border-radius: var(--r-md); box-shadow: var(--shadow-md); }
.skip-link:focus { top: 10px; }
.icon-definitions { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.muted { color: var(--muted); }
.small { font-size: var(--fs-sm); }
.caption { font-size: var(--fs-xs); color: var(--muted); }
.nowrap { white-space: nowrap; }
.breakable, .long-text { overflow-wrap: anywhere; }
.long-text { max-width: 460px; }
.read-only { color: var(--n-400); font-size: var(--fs-xs); }
.section-gap { margin-top: 20px; }
.inline-form { display: inline; margin: 0; }
.inline-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.screen-only { }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }

/* ---------- 3. 应用外框：顶部模块栏 + 子页签 ---------- */
.app-shell { min-height: 100vh; display: flex; flex-direction: column; }
.appbar { position: sticky; top: 0; z-index: 40; background: var(--n-0); border-bottom: 1px solid var(--line); }
.appbar-main { height: var(--appbar-h); display: flex; align-items: center; gap: 18px; padding: 0 var(--gutter); max-width: none; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--n-900); text-decoration: none; flex: none; }
.brand:hover { text-decoration: none; color: var(--n-900); }
.brand-mark { width: 34px; height: 27px; display: block; object-fit: contain; }
.brand-logo { display: block; width: 34px; height: 27px; flex: none; }
.brand-logo img { width: 100%; height: 100%; object-fit: contain; }
.brand-title { font-size: 17px; font-weight: 700; letter-spacing: .02em; white-space: nowrap; }
/* 360 宽左右的手机：「同利管理系统」六个字会把右上角账号菜单挤出屏幕，只在这里把顶栏名字缩小一点（Niar 2026-11-16）。 */
@media (max-width: 370px) { .appbar .brand-title { font-size: 15px; letter-spacing: 0; } }
.brand-sub { font-size: 11px; color: var(--muted); letter-spacing: .04em; line-height: 1.2; }
.brand-edition { margin-left: 4px; font-size: 11px; font-weight: 600; color: var(--gold-700); background: var(--gold-50); border: 1px solid var(--gold-100); padding: 1px 7px; border-radius: 999px; white-space: nowrap; }
.module-nav { display: flex; align-items: stretch; gap: 2px; height: 100%; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.module-nav::-webkit-scrollbar { display: none; }
.module-link { position: relative; display: flex; align-items: center; gap: 7px; padding: 0 12px; color: var(--n-600); font-weight: 500; font-size: var(--fs-md); white-space: nowrap; border-radius: 0; }
.module-link .icon { width: 17px; height: 17px; color: var(--n-400); }
.module-link:hover { color: var(--n-900); text-decoration: none; background: var(--n-50); }
.module-link.active { color: var(--brand-700); font-weight: 600; }
.module-link.active .icon { color: var(--brand-600); }
.module-link.active::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; border-radius: 2px 2px 0 0; background: var(--brand-600); }
.appbar-tools { margin-left: auto; display: flex; align-items: center; gap: 8px; flex: none; }
.search-trigger { display: inline-flex; align-items: center; gap: 8px; height: 34px; min-width: 210px; padding: 0 8px 0 10px; border: 1px solid var(--n-200); border-radius: var(--r-md); background: var(--n-25); color: var(--n-400); font-size: var(--fs-sm); }
.search-trigger:hover { border-color: var(--n-300); background: var(--n-0); color: var(--n-600); }
.search-trigger .icon { width: 16px; height: 16px; }
.search-trigger kbd { margin-left: auto; white-space: nowrap; flex: none; }
.menu { position: relative; }
.menu > summary { list-style: none; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-panel { position: absolute; right: 0; top: calc(100% + 6px); z-index: 60; min-width: min(220px, calc(100vw - 16px)); max-width: calc(100vw - 16px); background: var(--n-0); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-md); padding: 6px; }
.menu-panel a, .menu-panel button.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: var(--r-sm); background: none; color: var(--n-700); text-align: left; font-size: var(--fs-md); }
.menu-panel a:hover, .menu-panel button.menu-item:hover { background: var(--n-50); color: var(--n-900); text-decoration: none; }
.menu-panel .menu-label { padding: 8px 10px 4px; font-size: 11px; color: var(--n-400); font-weight: 600; letter-spacing: .04em; }
.menu-panel .menu-sep { height: 1px; background: var(--line); margin: 6px 4px; }
.menu-item small { margin-left: auto; color: var(--n-400); font-size: 11px; }
.create-menu > summary { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border-radius: var(--r-md); background: var(--brand-600); color: #fff; font-weight: 600; font-size: var(--fs-md); cursor: pointer; }
.create-menu > summary:hover { background: var(--brand-700); }
.create-menu .menu-panel { min-width: 240px; }
.account-menu > summary { display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 6px 0 4px; border-radius: 999px; cursor: pointer; }
.account-menu > summary:hover { background: var(--n-50); }
.account-avatar { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--brand-50); color: var(--brand-700); font-weight: 700; font-size: 13px; }
.account-name { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; max-width: 9em; }
/* 名字和岗位过长时省略（完整名字在账号菜单顶部），不挤掉左侧模块栏。 */
.user-name { font-weight: 600; color: var(--n-800); font-size: var(--fs-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.account-role { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-label-short { display: none; }
@media (max-width: 1520px) {
  /* 1440 宽时模块栏不挤（2026-10-20 第 38 条⑤）：搜索框只写“搜索”，不再显示被截断的长提示。 */
  .search-trigger { min-width: 0; max-width: 140px; }
  .search-trigger .search-label { display: none; }
  .search-trigger .search-label-short { display: inline; white-space: nowrap; }
  .appbar-main { gap: 14px; }
}
.account-menu .menu-panel { min-width: 230px; }
.account-head { padding: 10px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.account-head strong { display: block; }
.text-button { border: 0; background: transparent; color: var(--muted); padding: 0; font-size: var(--fs-sm); }
.text-button:hover { color: var(--brand-600); }
.subnav { display: flex; align-items: center; gap: 4px; height: var(--subnav-h); padding: 0 var(--gutter); border-top: 1px solid var(--n-100); background: var(--n-25); overflow-x: auto; scrollbar-width: thin; }
.subnav-title { font-size: var(--fs-sm); font-weight: 700; color: var(--n-800); margin-right: 10px; white-space: nowrap; display: flex; align-items: center; gap: 6px; }
.subnav-title .icon { width: 16px; height: 16px; color: var(--brand-600); }
.subnav a { display: inline-flex; align-items: center; height: 30px; padding: 0 12px; border-radius: var(--r-sm); color: var(--n-600); font-size: var(--fs-sm); white-space: nowrap; }
.subnav a:hover { background: var(--n-100); color: var(--n-900); text-decoration: none; }
.subnav a.active { background: var(--n-0); color: var(--brand-700); font-weight: 600; box-shadow: var(--shadow-xs), inset 0 0 0 1px var(--n-150); }
.version-banner { display: none; }
.workspace { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.main { width: 100%; max-width: var(--content-max); margin: 0 auto; padding: 24px var(--gutter) 40px; min-width: 0; flex: 1; }
.footer-note { font-size: var(--fs-xs); color: var(--n-400); margin-top: 28px; padding-top: 14px; border-top: 1px solid var(--n-100); display: flex; gap: 12px; flex-wrap: wrap; }
.mobile-toggle { display: none; align-items: center; justify-content: center; width: 38px; height: 38px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--n-0); color: var(--n-700); }
.mobile-scrim { display: none; }
/* 抽屉式完整导航（手机与窄屏） */
.drawer { position: fixed; inset: 0 auto 0 0; width: min(320px, 86vw); z-index: 90; background: var(--n-0); box-shadow: var(--shadow-lg); transform: translateX(-102%); transition: transform .2s ease; display: flex; flex-direction: column; visibility: hidden; }
.drawer.open { transform: none; visibility: visible; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.drawer-body { overflow-y: auto; padding: 8px 10px 24px; flex: 1; overscroll-behavior: contain; }
.drawer-group { margin-top: 10px; }
.drawer-group > .drawer-group-title { display: flex; align-items: center; gap: 8px; padding: 6px 8px; font-size: 12px; font-weight: 700; color: var(--n-500); }
.drawer-group a { display: flex; align-items: center; min-height: 42px; padding: 0 12px 0 34px; border-radius: var(--r-md); color: var(--n-700); }
.drawer-group a.active { background: var(--brand-50); color: var(--brand-700); font-weight: 600; }
.drawer-group a:hover { text-decoration: none; background: var(--n-50); }
.drawer-home { display: flex; align-items: center; gap: 8px; min-height: 42px; padding: 0 8px; border-radius: var(--r-md); color: var(--n-800); font-weight: 600; }
.nav-close { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--n-0); padding: 6px 10px; font-size: var(--fs-sm); color: var(--n-600); }
.scrim { position: fixed; inset: 0; z-index: 80; background: rgba(15, 23, 42, .38); opacity: 0; pointer-events: none; transition: opacity .2s; }
.scrim.open { opacity: 1; pointer-events: auto; }

/* ---------- 4. 页面标题 ---------- */
.page-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin: 4px 0 20px; }
.page-heading > div:first-child { min-width: 0; }
.page-heading h1 { font-size: 22px; font-weight: 700; letter-spacing: -.01em; margin: 0 0 4px; overflow-wrap: anywhere; }
.page-heading p { color: var(--muted); font-size: var(--fs-md); margin: 0; max-width: 820px; }
.eyebrow { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--brand-700); margin-bottom: 4px; letter-spacing: .02em; }
.heading-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; flex-shrink: 0; }
.subtitle { color: var(--muted); }

/* ---------- 5. 按钮 ---------- */
.button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: var(--control-h); padding: 0 14px; border: 1px solid var(--brand-600); border-radius: var(--r-md); background: var(--brand-600); color: #fff; font-weight: 600; font-size: var(--fs-md); line-height: 1.2; text-decoration: none; white-space: nowrap; transition: background .12s, border-color .12s, box-shadow .12s, color .12s; box-shadow: var(--shadow-xs); }
.button:hover { background: var(--brand-700); border-color: var(--brand-700); color: #fff; text-decoration: none; }
.button:active { transform: translateY(1px); }
.button:focus-visible { outline: none; box-shadow: var(--ring); }
.button .icon { width: 16px; height: 16px; }
.button.secondary, .button.ghost { background: var(--n-0); color: var(--n-700); border-color: var(--n-200); }
.button.secondary:hover { background: var(--n-50); border-color: var(--n-300); color: var(--n-900); }
.button.ghost { border-color: transparent; box-shadow: none; }
.button.ghost:hover { background: var(--n-100); }
.button.danger { background: var(--bad-600); border-color: var(--bad-600); color: #fff; }
.button.danger:hover { background: var(--bad-700); border-color: var(--bad-700); }
.button.secondary.danger { background: var(--n-0); color: var(--bad-600); border-color: var(--bad-200); }
.button.secondary.danger:hover { background: var(--bad-50); }
.button.success { background: var(--ok-600); border-color: var(--ok-600); }
.button.small { min-height: 28px; padding: 0 10px; font-size: var(--fs-sm); border-radius: var(--r-sm); }
.button.large { min-height: 44px; padding: 0 20px; font-size: var(--fs-lg); }
.button:disabled, .button[aria-disabled="true"] { opacity: .5; cursor: not-allowed; box-shadow: none; }
.button-group { display: inline-flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- 6. 卡片 / 面板 ---------- */
.card { background: var(--n-0); border: 1px solid var(--line); border-radius: var(--r-lg); margin-bottom: 20px; box-shadow: var(--shadow-xs); min-width: 0; }
.card > :first-child { border-top-left-radius: inherit; border-top-right-radius: inherit; }
.card > :last-child { border-bottom-left-radius: inherit; border-bottom-right-radius: inherit; }
.card + .card { margin-top: 0; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.card-head h2 { font-size: 15px; font-weight: 650; margin: 0; }
.card-head h2 + p, .card-head p { margin: 2px 0 0; font-size: var(--fs-sm); color: var(--muted); }
.card-body { padding: 18px; }
.card-body > :first-child { margin-top: 0; }
.card-body > :last-child { margin-bottom: 0; }
.two-col { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.two-col > .card { margin-bottom: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.stack > * + * { margin-top: 16px; }

/* ---------- 7. 表格 ---------- */
.table-wrap, .table-scroll { max-width: 100%; min-width: 0; overflow-x: auto; overscroll-behavior-x: contain; }
.table-scroll:focus-visible { outline: 2px solid var(--brand-500); outline-offset: -2px; }
table { width: 100%; border-collapse: separate; border-spacing: 0; text-align: left; font-size: var(--fs-md); }
th { position: sticky; top: 0; z-index: 1; background: var(--n-25); color: var(--n-500); font-size: var(--fs-xs); font-weight: 600; letter-spacing: .02em; padding: 10px 14px; white-space: nowrap; border-bottom: 1px solid var(--line); text-align: left; }
td { padding: 11px 14px; border-bottom: 1px solid var(--n-100); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .08s; }
tbody tr:hover { background: var(--brand-25); }
tr.row-link { cursor: pointer; }
td.amount, th.amount, td.num, th.num, .amount { text-align: right; }
tfoot td { background: var(--n-25); font-weight: 600; border-top: 1px solid var(--line); }
.cell-title { font-weight: 600; color: var(--n-900); overflow-wrap: anywhere; }
a.cell-title:hover { color: var(--brand-700); }
.cell-sub { display: block; font-size: var(--fs-xs); color: var(--muted); margin-top: 2px; }
.row-actions { display: flex; gap: 12px; white-space: nowrap; font-size: var(--fs-sm); align-items: center; }
.table-footer { padding: 10px 18px; border-top: 1px solid var(--line); font-size: var(--fs-sm); color: var(--muted); background: var(--n-25); display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.page-total { font-weight: 600; color: var(--n-700); }
.recent-table th, .recent-table td { white-space: nowrap; }
.recent-table td { vertical-align: middle; }
.recent-table .party-cell { max-width: 280px; white-space: normal; min-width: 160px; }
.recent-table .status-label { background: var(--n-100); color: var(--n-600); display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; }
.table-scroll[aria-label="销售订单明细，可横向滚动"] table { min-width: 780px; }
.table-scroll[aria-label="销售订单明细，可横向滚动"] th, .table-scroll[aria-label="销售订单明细，可横向滚动"] td { white-space: nowrap; }

/* ---------- 8. 筛选 / 工具栏 / 分页 ---------- */
.toolbar { display: flex; justify-content: space-between; gap: 16px; align-items: center; padding: 12px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.search-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.search-form input { width: 300px; margin: 0; }
.filter-bar, .order-filters, .party-filters { display: flex; flex-wrap: wrap; gap: 10px 12px; align-items: flex-end; width: 100%; }
.order-filters label, .party-filters label, .filter-bar label { display: block; font-size: var(--fs-xs); font-weight: 600; color: var(--n-500); margin-bottom: 4px; }
.order-filters input, .order-filters select { margin-top: 0; }
.order-filters > *, .party-filters > div, .filter-bar > div { min-width: 140px; flex: 1 1 140px; }
.order-filters .filter-search, .party-filters > div:first-child { flex: 2 1 240px; }
.party-filters .filter-actions, .filter-actions { display: flex; gap: 8px; align-items: center; flex: 0 0 auto; min-width: 0; }
.filter-context { font-size: var(--fs-sm); color: var(--muted); margin-top: 10px; }
.pagination { display: flex; align-items: center; gap: 12px; font-size: var(--fs-sm); flex-wrap: wrap; }
.pagination a, .page-number { display: inline-flex; align-items: center; min-height: 28px; padding: 0 8px; border-radius: var(--r-sm); }
.pagination a:hover { background: var(--n-100); text-decoration: none; }
.report-filter-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.report-filter-grid p { margin: 0; }
.report-filter-grid label { display: block; font-size: var(--fs-xs); font-weight: 600; color: var(--n-500); margin-bottom: 4px; }
.report-filter-actions { margin-top: 16px; display: flex; gap: 8px; flex-wrap: wrap; }
.report-export-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 16px 0; }
.report-export-actions p { width: 100%; margin: 0; font-size: var(--fs-sm); }

/* ---------- 9. 表单 ---------- */
.form-layout { max-width: 980px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; }
.form-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field { min-width: 0; }
.field.full, .form-grid > .full { grid-column: 1 / -1; }
.field label, .form-field > label { display: block; font-size: var(--fs-sm); font-weight: 600; color: var(--n-700); margin-bottom: 6px; }
.required { color: var(--bad-600); font-size: 12px; margin-left: 3px; font-weight: 600; }
input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=range]):not([type=color]), select, textarea {
  width: 100%; min-height: var(--control-h); padding: 6px 10px; border: 1px solid var(--n-200); border-radius: var(--r-md); background: var(--n-0); color: var(--n-900); box-shadow: var(--shadow-xs); transition: border-color .12s, box-shadow .12s; }
select { padding-right: 30px; appearance: none; -webkit-appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236a7385' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }
select[multiple] { background-image: none; padding-right: 10px; min-height: 96px; }
input::placeholder, textarea::placeholder { color: var(--n-400); }
input:hover, select:hover, textarea:hover { border-color: var(--n-300); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand-500); box-shadow: var(--ring); }
input:disabled, select:disabled, textarea:disabled, input[readonly], textarea[readonly] { background: var(--n-50); color: var(--n-500); }
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"], .field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--bad-600); }
input[type=file] { font-size: var(--fs-sm); padding: 6px; border: 1px dashed var(--n-300); border-radius: var(--r-md); background: var(--n-25); width: 100%; }
input[type=checkbox], input[type=radio] { accent-color: var(--brand-600); width: 16px; height: 16px; vertical-align: middle; flex-shrink: 0; }
textarea { resize: vertical; min-height: 88px; line-height: 1.55; }
.field.check { display: flex; flex-direction: column; justify-content: center; }
.check-line { display: flex; align-items: center; gap: 8px; min-height: var(--control-h); }
.check-line label { margin: 0; font-weight: 500; }
.helptext { display: block; color: var(--muted); font-size: var(--fs-xs); margin-top: 5px; line-height: 1.5; }
.helptext ul { margin: 4px 0; padding-left: 18px; }
.helptext.is-warning { color: var(--warn-700); font-weight: 600; }
/* 比重按材质固定（2026-11-06）：只显示数，不给输入框；珍珠膜两档下拉。版本表单、物料资料、快速收原膜共用。 */
.density-fixed, .calc-fixed-density { margin: 6px 0 0; padding: 7px 10px; border-radius: var(--r-sm, 6px); background: var(--n-50, #f5f6f8); color: var(--n-800, #222); font-weight: 600; font-variant-numeric: tabular-nums; }
.density-fixed[hidden], .calc-fixed-density[hidden], .density-choice[hidden], .calc-density-choice[hidden] { display: none; }
.errorlist { list-style: none; color: var(--bad-600); padding: 0; margin: 5px 0 0; font-size: var(--fs-sm); }
.errorlist li::before { content: "! "; font-weight: 700; }
.form-errors { border: 1px solid var(--bad-200); background: var(--bad-50); border-radius: var(--r-md); padding: 10px 14px; color: var(--bad-700); margin-bottom: 16px; font-size: var(--fs-md); }
.form-errors ul { margin: 0; padding-left: 18px; }
.form-errors .errorlist { margin: 0; }
.form-actions { display: flex; gap: 8px; border-top: 1px solid var(--line); padding-top: 16px; margin-top: 20px; align-items: center; flex-wrap: wrap; }
.form-actions .caption { margin-left: auto; }
.form-section { padding: 16px 0; border-bottom: 1px solid var(--n-100); }
.form-section:first-child { padding-top: 0; }
.form-section:last-child { border-bottom: 0; }
.form-section > h2, .form-section summary { font-size: 15px; font-weight: 650; color: var(--n-800); margin: 0 0 12px; }
.form-section summary { cursor: pointer; padding: 4px 0; margin: 0; list-style: none; display: flex; align-items: center; gap: 8px; }
.form-section summary::-webkit-details-marker { display: none; }
.form-section summary::before { content: ""; width: 7px; height: 7px; border-right: 2px solid var(--n-400); border-bottom: 2px solid var(--n-400); transform: rotate(-45deg); transition: transform .15s; margin: 0 4px 0 2px; }
.form-section[open] summary::before { transform: rotate(45deg); }
.form-section .form-grid { margin-top: 12px; }
.field-row { display: flex; gap: 10px; align-items: flex-end; }
.sticky-actions { position: sticky; bottom: 0; z-index: 20; background: rgba(255, 255, 255, .96); backdrop-filter: blur(6px); border-top: 1px solid var(--line); margin: 20px -18px -18px; padding: 12px 18px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; border-bottom-left-radius: var(--r-lg); border-bottom-right-radius: var(--r-lg); }

/* ---------- 10. 徽章与状态 ---------- */
.badge, .status-badge, .document-state { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; line-height: 1.5; background: var(--n-100); color: var(--n-600); }
.badge::before, .status-badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .75; }
.badge.plain::before { display: none; }
.badge.green, .badge.ok, .badge.success { background: var(--ok-50); color: var(--ok-700); }
.badge.blue, .badge.info { background: var(--brand-50); color: var(--brand-700); }
.badge.amber, .badge.warning, .badge.warn { background: var(--warn-50); color: var(--warn-700); }
.badge.red, .badge.danger, .badge.error { background: var(--bad-50); color: var(--bad-700); }
.badge.gray, .badge.muted { background: var(--n-100); color: var(--n-500); }
.badge.gold { background: var(--gold-50); color: var(--gold-700); }
.entry-tag { display: inline-flex; padding: 1px 7px; border-radius: 4px; background: var(--n-100); font-size: 12px; color: var(--n-600); }

/* ---------- 11. 提示 / 消息 ---------- */
.messages { margin-bottom: 16px; display: grid; gap: 8px; }
.message { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border: 1px solid var(--brand-100); border-radius: var(--r-md); background: var(--brand-50); color: var(--brand-800); font-size: var(--fs-md); }
/* 图标跟着提示条的颜色走（蓝 / 绿 / 红 / 黄）：圈和里面的字都用提示条的字色，不另写死颜色。 */
.message::before { content: "i"; flex: none; display: grid; place-items: center; box-sizing: border-box; width: 18px; height: 18px; margin-top: 1px; border-radius: 50%; border: 1.5px solid currentColor; background: transparent; color: inherit; font-size: 11px; font-weight: 700; line-height: 1; font-family: var(--mono); }
.message.success { background: var(--ok-50); border-color: var(--ok-200); color: var(--ok-700); }
.message.success::before { content: "✓"; }
.message.error { background: var(--bad-50); border-color: var(--bad-200); color: var(--bad-700); }
.message.error::before { content: "!"; }
.message.warning { background: var(--warn-50); border-color: var(--warn-200); color: var(--warn-700); }
.message.warning::before { content: "!"; }
.note, .notice, .entry-notice { padding: 10px 14px; border-radius: var(--r-md); background: var(--n-50); color: var(--n-600); font-size: var(--fs-sm); border: 1px solid var(--n-150); margin-top: 14px; overflow-wrap: anywhere; }
.note p, .notice p { margin: 0; }
.note p + p, .notice p + p { margin-top: 6px; }
.note.warning, .notice.warning, .notice, .entry-notice.warning { background: var(--warn-50); border-color: var(--warn-200); color: var(--warn-700); }
.note.info, .notice.info { background: var(--brand-50); border-color: var(--brand-100); color: var(--brand-800); }
.note.error, .notice.error { background: var(--bad-50); border-color: var(--bad-200); color: var(--bad-700); }
.note.success, .notice.success { background: var(--ok-50); border-color: var(--ok-200); color: var(--ok-700); }
.fixed-note { font-size: var(--fs-sm); color: var(--muted); }

/* ---------- 12. 明细 / 键值 ---------- */
.key-value { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 8px 16px; font-size: var(--fs-md); margin: 0; }
.key-value dt { color: var(--muted); }
.key-value dd { margin: 0; overflow-wrap: anywhere; color: var(--n-800); }
.detail-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px 20px; margin: 0; }
.detail-grid > div { min-width: 0; }
.detail-grid dt, .detail-grid .label { font-size: var(--fs-xs); color: var(--muted); margin-bottom: 2px; }
.detail-grid dd { margin: 0; overflow-wrap: anywhere; font-weight: 500; }
.party-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 20px; margin: 0; }
.party-facts dt { font-size: var(--fs-xs); color: var(--muted); }
.party-facts dd { margin: 3px 0 0; overflow-wrap: anywhere; }
.party-contact-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.party-contact { border: 1px solid var(--line); border-radius: var(--r-md); padding: 14px; overflow-wrap: anywhere; background: var(--n-25); }
.party-contact p { margin: 6px 0; }
.text-block { white-space: pre-wrap; overflow-wrap: anywhere; }
.detail-summary { background: var(--brand-50); border: 1px solid var(--brand-100); border-radius: var(--r-md); padding: 12px 16px; margin-bottom: 14px; font-size: var(--fs-md); }
.detail-summary strong { font-size: 22px; margin-left: 10px; color: var(--n-900); font-variant-numeric: tabular-nums; }
.metadata { font-size: var(--fs-xs); color: var(--muted); }

/* ---------- 13. 空状态 / 小部件状态 ---------- */
.empty-state { text-align: center; padding: 44px 24px; color: var(--muted); }
.empty-state .empty-icon { width: 44px; height: 44px; border-radius: 12px; margin: 0 auto 12px; display: grid; place-items: center; background: var(--n-50); color: var(--n-400); border: 1px solid var(--n-150); font-size: 20px; }
.empty-state h3 { font-size: 15px; color: var(--n-700); margin: 0 0 6px; font-weight: 600; }
.empty-state p { font-size: var(--fs-sm); margin: 0 auto 14px; max-width: 420px; }
.widget-state { padding: 40px 20px; min-height: 180px; text-align: center; color: var(--muted); }
.widget-state .icon { display: block; margin: 0 auto 10px; color: var(--n-300); width: 26px; height: 26px; }
.widget-state strong { font-size: 15px; color: var(--n-800); font-weight: 600; }
.widget-state p { font-size: var(--fs-sm); margin: 6px 0 0; }
.widget-state.error strong { color: var(--bad-600); }

/* ---------- 14. 工作台 ---------- */
.overview-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
.overview-card { position: relative; padding: 16px 18px; background: var(--n-0); border: 1px solid var(--line); border-radius: var(--r-lg); min-width: 0; box-shadow: var(--shadow-xs); }
.overview-label { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.overview-label h2 { font-size: var(--fs-md); font-weight: 600; margin: 0; color: var(--n-600); }
.overview-icon { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: var(--brand-50); color: var(--brand-600); }
.overview-icon .icon { width: 17px; height: 17px; }
.overview-value { display: flex; align-items: baseline; gap: 6px; font-size: 28px; font-weight: 700; line-height: 1.3; letter-spacing: -.02em; color: var(--n-900); margin: 10px 0 6px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
a.overview-value:hover { color: var(--brand-700); text-decoration: none; }
.overview-value .icon { margin-left: auto; align-self: center; width: 16px; color: var(--n-300); }
.overview-value .unit, .overview-value .currency { font-size: 15px; font-weight: 500; letter-spacing: 0; color: var(--muted); }
.overview-note { font-size: var(--fs-sm); color: var(--muted); line-height: 1.55; }
.overview-detail { display: inline-flex; gap: 12px; font-size: var(--fs-sm); margin-top: 10px; flex-wrap: wrap; }
.overview-empty { font-size: 20px; font-weight: 600; color: var(--n-400); margin: 12px 0 10px; }
.overview-card .widget-state { padding: 12px 0 2px; min-height: 90px; text-align: left; }
.overview-card .widget-state .icon { display: none; }
.dashboard-charts { display: grid; grid-template-columns: minmax(0, .95fr) minmax(0, 1.3fr); gap: 20px; }
.dashboard-charts > .card { margin: 0 0 20px; min-width: 0; }
.chart-heading-note { font-size: var(--fs-xs); color: var(--muted); white-space: nowrap; }
.order-chart-body { padding: 18px; }
.order-chart-layout { display: flex; align-items: center; gap: 24px; min-height: 210px; }
.donut { width: 176px; max-width: 45%; height: auto; flex-shrink: 0; }
.donut circle { fill: none; stroke-width: 16; }
.donut .ring-track { stroke: var(--n-100); }
.donut .ring-segment { transition: stroke-width .12s; transform: rotate(-90deg); transform-origin: 90px 90px; }
.donut a:hover circle, .donut a:focus circle { stroke-width: 20; }
.donut-count { font-size: 28px; font-weight: 700; fill: var(--n-900); font-variant-numeric: tabular-nums; }
.donut-label { font-size: 12px; fill: var(--muted); }
.chart-legend { flex: 1; min-width: 0; display: grid; gap: 12px; }
.chart-legend a { display: flex; align-items: center; gap: 8px; color: var(--n-700); font-size: var(--fs-md); padding: 4px 6px; border-radius: var(--r-sm); }
.chart-legend a:hover { color: var(--brand-700); background: var(--n-50); text-decoration: none; }
.legend-dot { width: 9px; height: 9px; display: inline-block; border-radius: 50%; flex: none; }
.chart-legend strong { margin-left: auto; font-variant-numeric: tabular-nums; font-size: 15px; }
.chart-footnote { font-size: var(--fs-xs); color: var(--muted); margin: 10px 0 0; line-height: 1.6; }
.cash-body { padding: 14px 18px 16px; }
.cash-key { display: flex; gap: 18px; font-size: var(--fs-xs); color: var(--muted); align-items: center; }
.cash-key span { display: flex; gap: 6px; align-items: center; }
.cash-key i { width: 10px; height: 10px; border-radius: 2px; background: var(--brand-600); }
.cash-key .out { background: var(--gold-400); }
.cash-plot { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; position: relative; margin-top: 6px; }
.cash-month { min-width: 0; text-align: center; }
.cash-bars { height: 180px; position: relative; border-bottom: 1px solid var(--line); background: linear-gradient(to top, transparent 49.5%, var(--n-100) 50%, transparent 50.5%); }
.cash-bars::after { content: ""; position: absolute; top: var(--baseline); left: 0; right: 0; border-top: 1px solid var(--n-300); pointer-events: none; }
.cash-bar { display: block; position: absolute; left: calc(50% - 19px); width: 16px; background: var(--brand-600); border-radius: 3px 3px 0 0; min-height: 1px; z-index: 1; }
.cash-bar.out { left: calc(50% + 3px); background: var(--gold-400); }
/* 只有实收一根柱（看不到采购价的人，第 63 条）：放在正中。 */
.cash-plot[data-flows="receipts"] .cash-bar { left: calc(50% - 8px); }
.cash-bar.negative { border-radius: 0 0 3px 3px; }
.cash-bar:hover, .cash-bar:focus { opacity: .8; outline: 2px solid var(--brand-300); outline-offset: 2px; }
.cash-month-label { font-size: var(--fs-xs); color: var(--muted); margin: 6px 0 0; }
.cash-values { margin-top: 12px; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; border-top: 1px solid var(--line); padding-top: 10px; }
.cash-value-month { font-size: 11px; color: var(--muted); margin-bottom: 2px; }
.cash-values a { display: block; font-size: var(--fs-sm); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.cash-values .cash-out-value { color: var(--gold-700); }
/* 工作台：待办 / 快捷 */
.hello { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 4px 0 18px; flex-wrap: wrap; }
.hello h1 { font-size: 22px; margin: 0 0 2px; }
.hello p { margin: 0; color: var(--muted); }
.quick-actions { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-bottom: 20px; }
.quick-action { display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: var(--n-0); border: 1px solid var(--line); border-radius: var(--r-lg); color: var(--n-800); box-shadow: var(--shadow-xs); transition: border-color .12s, box-shadow .12s, transform .12s; min-width: 0; }
.quick-action:hover { border-color: var(--brand-300); box-shadow: var(--shadow-sm); text-decoration: none; color: var(--n-900); }
.quick-action .qa-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: var(--brand-50); color: var(--brand-600); flex: none; }
.quick-action .qa-icon .icon { width: 18px; height: 18px; }
.quick-action strong { display: block; font-size: var(--fs-md); font-weight: 600; }
.quick-action span.qa-sub { display: block; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.todo-list { list-style: none; margin: 0; padding: 0; }
.todo-list li { border-bottom: 1px solid var(--n-100); }
.todo-list li:last-child { border-bottom: 0; }
.todo-list a { display: flex; align-items: center; gap: 12px; padding: 11px 18px; color: var(--n-800); }
.todo-list a:hover { background: var(--brand-25); text-decoration: none; }
.todo-count { margin-left: auto; min-width: 32px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; padding: 1px 8px; border-radius: 999px; background: var(--n-100); color: var(--n-700); }
.todo-count.hot { background: var(--warn-50); color: var(--warn-700); }
.todo-count.zero { color: var(--n-400); background: transparent; font-weight: 500; }
.todo-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--n-300); flex: none; }
.todo-dot.hot { background: var(--warn-600); }
.todo-dot.ok { background: var(--ok-600); }
/* 拆成两句的那行（已发货没定价 / 另有几张等会计核价）：第二句小一号，接在第一句下面，单独能点。 */
.todo-list a.todo-follow { gap: 4px; margin-top: -8px; padding: 6px 18px 10px 38px; font-size: 12.5px; color: var(--muted); }
.todo-list a.todo-follow:hover { color: var(--n-800); }
@media (pointer: coarse) { .todo-list a.todo-follow { min-height: 40px; } }

/* ---------- 15. 单据头 / 流程进度 / 关联单据 ---------- */
.doc-header { display: flex; gap: 20px; align-items: flex-start; justify-content: space-between; padding: 18px 20px; background: var(--n-0); border: 1px solid var(--line); border-radius: var(--r-lg); margin-bottom: 16px; box-shadow: var(--shadow-xs); flex-wrap: wrap; }
.doc-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.doc-title h1 { margin: 0; font-size: 21px; }
.doc-meta { display: flex; gap: 6px 18px; flex-wrap: wrap; margin-top: 6px; font-size: var(--fs-sm); color: var(--muted); }
.doc-meta strong { color: var(--n-800); font-weight: 600; }
.stepper { display: flex; align-items: center; gap: 0; margin: 14px 0 0; padding: 0; list-style: none; flex-wrap: wrap; row-gap: 8px; }
.stepper li { display: flex; align-items: center; gap: 6px; font-size: var(--fs-sm); color: var(--n-400); white-space: nowrap; }
.stepper li + li::before { content: ""; width: 28px; height: 2px; background: var(--n-150); margin: 0 8px; border-radius: 2px; }
.stepper .step-dot { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--n-200); background: var(--n-0); font-size: 11px; font-weight: 700; }
.stepper li.done { color: var(--n-700); }
.stepper li.done .step-dot { background: var(--ok-600); border-color: var(--ok-600); color: #fff; }
.stepper li.done + li::before, .stepper li.current + li::before { }
.stepper li.done + li.done::before, .stepper li.done + li.current::before { background: var(--ok-600); }
.stepper li.current { color: var(--brand-700); font-weight: 600; }
.stepper li.current .step-dot { border-color: var(--brand-600); background: var(--brand-600); color: #fff; box-shadow: 0 0 0 4px var(--brand-100); }
.stepper li.void { color: var(--bad-600); }
.stepper li.void .step-dot { border-color: var(--bad-600); background: var(--bad-600); color: #fff; }
.flow-chain { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 0; padding: 0; list-style: none; }
.flow-chain li { display: flex; align-items: center; gap: 8px; }
.flow-chain li + li::before { content: "→"; color: var(--n-300); }
.flow-chain a, .flow-chain span.flow-node { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--n-0); font-size: var(--fs-sm); color: var(--n-700); }
.flow-chain a:hover { border-color: var(--brand-300); color: var(--brand-700); text-decoration: none; }
.flow-chain .current { border-color: var(--brand-600); background: var(--brand-50); color: var(--brand-700); font-weight: 600; }
/* 单据记录（谁建的单、谁确认的；发货单、订单、生产工艺单、收货单共用，U02） */
.record-inline { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 28px; margin: 0; padding: 12px 18px; font-size: var(--fs-sm); }
.record-inline .record-title { font-weight: 650; color: var(--n-700); }
.record-inline > div { display: flex; gap: 8px; align-items: baseline; }
.record-inline dt { color: var(--muted); }
.record-inline dd { margin: 0; color: var(--n-700); font-variant-numeric: tabular-nums; }
.record-inline .record-log { margin-left: auto; }
.next-step { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: var(--r-md); border: 1px solid var(--brand-100); background: linear-gradient(90deg, var(--brand-50), var(--n-0)); margin-bottom: 16px; flex-wrap: wrap; }
.next-step strong { color: var(--brand-800); }
.next-step .button { margin-left: auto; }

/* ---------- 16. 命令面板 / 对话框 ---------- */
.cmdk { position: fixed; inset: 0; z-index: 120; display: none; align-items: flex-start; justify-content: center; padding: 10vh 16px 16px; background: rgba(15, 23, 42, .42); }
.cmdk.open { display: flex; }
.cmdk-panel { width: min(640px, 100%); max-height: 70vh; display: flex; flex-direction: column; background: var(--n-0); border-radius: var(--r-xl); box-shadow: var(--shadow-lg); overflow: hidden; border: 1px solid var(--line); }
.cmdk-input { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.cmdk-input .icon { color: var(--n-400); }
.cmdk-input input { border: 0 !important; box-shadow: none !important; padding: 4px 0 !important; font-size: 16px; min-height: 32px !important; background: transparent !important; }
.cmdk-results { overflow-y: auto; padding: 6px; }
.cmdk-group { padding: 8px 10px 4px; font-size: 11px; font-weight: 700; color: var(--n-400); letter-spacing: .04em; }
.cmdk-item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--r-md); color: var(--n-800); cursor: pointer; }
.cmdk-item small { color: var(--muted); margin-left: auto; font-size: 12px; white-space: nowrap; }
.cmdk-item .cmdk-sub { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmdk-item.active, .cmdk-item:hover { background: var(--brand-50); color: var(--brand-800); text-decoration: none; }
.cmdk-empty { padding: 28px 16px; text-align: center; color: var(--muted); font-size: var(--fs-sm); }
.cmdk-foot { display: flex; gap: 14px; padding: 8px 14px; border-top: 1px solid var(--line); font-size: 11px; color: var(--n-400); background: var(--n-25); }
dialog.confirm-dialog { border: 0; padding: 0; border-radius: var(--r-xl); box-shadow: var(--shadow-lg); width: min(460px, calc(100vw - 32px)); }
dialog.confirm-dialog::backdrop { background: rgba(15, 23, 42, .45); }
.confirm-dialog .dialog-body { padding: 20px 22px 8px; }
.confirm-dialog h2 { margin: 0 0 8px; font-size: 17px; }
.confirm-dialog p { margin: 0 0 10px; color: var(--n-600); }
.confirm-dialog .dialog-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px 18px; }

/* ---------- 17. 登录 ---------- */
.login-screen { min-height: 100vh; display: grid; grid-template-columns: minmax(340px, .95fr) minmax(0, 1.05fr); background: var(--n-0); }
/* 左边：蓝金配色的公司门面，只放标志、同利 ERP、公司名（Niar 2026-11-11：不写宣传语）。 */
.login-brand-pane { position: relative; overflow: hidden; display: flex; align-items: center; justify-content: center; padding: 48px 9%; color: #fff;
  background: radial-gradient(900px 560px at -12% 112%, rgba(214, 170, 85, .30), transparent 60%), radial-gradient(760px 520px at 112% -12%, rgba(95, 132, 239, .38), transparent 62%), linear-gradient(150deg, var(--brand-700), var(--brand-900)); }
.login-brand-pane::before { content: ""; position: absolute; inset: 0; background-image: radial-gradient(rgba(255, 255, 255, .09) 1px, transparent 1.4px); background-size: 22px 22px; -webkit-mask-image: linear-gradient(to bottom, #000, transparent 75%); mask-image: linear-gradient(to bottom, #000, transparent 75%); }
.login-brand-pane::after { content: ""; position: absolute; right: -140px; top: -140px; width: 440px; height: 440px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .12); box-shadow: 0 0 0 64px rgba(255, 255, 255, .03), 0 0 0 128px rgba(255, 255, 255, .02); }
.login-art { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.login-mark { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; text-align: center; margin-top: -4vh; }
.login-logo { display: grid; place-items: center; width: 136px; height: 112px; padding: 14px 16px; background: #fff; border-radius: 24px; box-shadow: 0 20px 44px rgba(6, 16, 48, .38), 0 0 0 1px rgba(214, 170, 85, .55), 0 0 0 10px rgba(255, 255, 255, .06); }
.login-logo img { width: 104px; height: auto; display: block; }
.login-mark .brand-title { color: #fff; font-size: 38px; font-weight: 700; letter-spacing: .06em; margin-top: 30px; white-space: nowrap; }
.login-rule { display: block; width: 64px; height: 2px; margin: 16px 0 14px; background: linear-gradient(90deg, transparent, var(--gold-400), transparent); }
.login-mark .brand-sub { display: block; color: rgba(255, 255, 255, .8); font-size: 16px; letter-spacing: .32em; padding-left: .32em; line-height: 1.4; }
.login-form-pane { display: flex; align-items: center; justify-content: center; padding: 48px 32px; }
.login-card { width: 100%; max-width: 380px; }
.login-card h1 { font-size: 26px; margin: 0 0 22px; }
.login-card .field { margin: 0 0 16px; }
.login-card input:not([type=checkbox]) { min-height: 42px; }
.login-card .button { width: 100%; min-height: 44px; margin-top: 4px; font-size: var(--fs-lg); }
.login-help { font-size: var(--fs-xs); color: var(--muted); margin-top: 12px; }
.error-page { max-width: 620px; margin: 12vh auto; padding: 32px; background: var(--n-0); border: 1px solid var(--line); border-radius: var(--r-xl); box-shadow: var(--shadow-sm); }

/* ---------- 18. 杂项页面 ---------- */
.network-results { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 16px 0; }
.network-stat { padding: 14px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--n-25); }
.network-stat strong { display: block; font-size: 22px; margin-top: 2px; font-variant-numeric: tabular-nums; }
.network-stat span { color: var(--muted); font-size: var(--fs-xs); }
.progress-track { height: 6px; border-radius: 6px; background: var(--n-100); overflow: hidden; margin: 14px 0; }
.progress-fill { height: 100%; width: 0; background: var(--brand-600); transition: width .2s; }
.guide-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.guide-grid h3 { font-size: 15px; margin: 10px 0 6px; }
.guide-grid p { font-size: var(--fs-md); }
.permission-group { margin: 12px 0; border: 1px solid var(--line); padding: 10px 14px; border-radius: var(--r-md); background: var(--n-0); }
.permission-group summary { cursor: pointer; font-weight: 600; padding: 4px; }
.permission-row { display: grid; grid-template-columns: minmax(170px, 1fr) minmax(100px, 180px) minmax(150px, 1fr); gap: 12px; align-items: center; padding: 8px 4px; border-bottom: 1px solid var(--n-100); }
.permission-row[hidden] { display: none; }
#generated-password { display: inline-block; padding: 12px 16px; font-family: var(--mono); overflow-wrap: anywhere; background: var(--n-50); border-radius: var(--r-md); border: 1px dashed var(--n-300); }
.mapping-select { min-width: 210px; }
.activity-row { padding: 12px 18px; border-bottom: 1px solid var(--n-100); }
.activity-row:last-child { border-bottom: 0; }
.activity-row p { font-size: var(--fs-sm); margin: 0 0 4px; }
.activity-row small { font-size: 11px; color: var(--muted); }
.stats-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat-card { padding: 16px 18px; background: var(--n-0); border: 1px solid var(--line); border-radius: var(--r-lg); }
.stat-top { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: var(--fs-sm); }
.stat-value { font-size: 28px; font-weight: 700; margin: 8px 0 2px; font-variant-numeric: tabular-nums; }
.stat-note { font-size: var(--fs-xs); color: var(--muted); }
.mobile-bottom { display: none; }
.title-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.identity { display: flex; align-items: center; gap: 10px; }
.totals { font-variant-numeric: tabular-nums; }
.square { aspect-ratio: 1; }

/* ---------- 19. 响应式 ---------- */
@media (max-width: 1280px) {
  :root { --gutter: 20px; }
  .search-trigger { min-width: 0; width: 38px; padding: 0; justify-content: center; }
  .search-trigger .search-label, .search-trigger .search-label-short, .search-trigger kbd { display: none; }
  .module-link { padding: 0 9px; }
  .module-link .icon { display: none; }
}
@media (max-width: 1080px) {
  .module-nav { display: none; }
  .mobile-toggle { display: inline-flex; }
  .two-col, .dashboard-charts { grid-template-columns: 1fr; }
  .overview-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .report-filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  :root { --gutter: 14px; --control-h: 42px; }
  .record-inline { padding: 12px 14px; gap: 4px 18px; }
  .record-inline .record-title { flex-basis: 100%; }
  .record-inline .record-log { margin-left: 0; }
  body { font-size: 15px; }
  .appbar-main { gap: 10px; }
  .brand-sub, .brand-edition { display: none; }
  .account-name { display: none; }
  .create-menu > summary { padding: 0 10px; }
  .create-menu .create-label { display: none; }
  .main { padding: 16px var(--gutter) 32px; }
  .subnav { padding: 0 var(--gutter); }
  .subnav-title { display: none; }
  .page-heading { flex-direction: column; align-items: stretch; gap: 12px; }
  .page-heading h1 { font-size: 20px; }
  .heading-actions { justify-content: flex-start; }
  .heading-actions .button { flex: 1 1 auto; }
  /* 字宽的手机（字体各家不一样）一行放不下整个按钮时：小字说明先整段换到下一行，还不够再在字间折行，
     按钮不比屏幕宽。放得下的按钮照旧一行。 */
  .heading-actions .button { max-width: 100%; flex-wrap: wrap; white-space: normal; text-align: center; }
  .overview-grid, .grid-2, .grid-3, .stats-grid { grid-template-columns: 1fr; }
  .card-head { padding: 12px 14px; flex-wrap: wrap; }
  .card-body { padding: 14px; }
  .sticky-actions { margin: 16px -14px -14px; padding: 10px 14px; }
  .toolbar { padding: 12px 14px; }
  .search-form, .search-form input { width: 100%; }
  .search-form input { flex: 1; min-width: 0; }
  th, td { padding: 10px 12px; }
  .form-grid, .form-grid.three { grid-template-columns: 1fr; gap: 14px; }
  .field.full { grid-column: auto; }
  .form-actions .caption { width: 100%; margin: 0; }
  .form-actions .button { flex: 1 1 auto; }
  .key-value { grid-template-columns: 1fr; gap: 2px; }
  .key-value dd { margin-bottom: 8px; }
  .party-facts, .party-contact-grid { grid-template-columns: 1fr; }
  .network-results { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .guide-grid { grid-template-columns: 1fr; gap: 0; }
  .order-filters, .party-filters, .filter-bar { display: grid; grid-template-columns: 1fr; }
  .order-filters .button, .party-filters .filter-actions .button { width: 100%; }
  .report-filter-grid { grid-template-columns: 1fr; }
  .order-chart-layout { gap: 14px; min-height: 180px; }
  .donut { width: 140px; }
  .cash-values { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .cash-bar { width: 12px; left: calc(50% - 14px); }
  .cash-bar.out { left: calc(50% + 2px); }
  .button.small, .row-actions a { min-height: 40px; display: inline-flex; align-items: center; }
  .responsive-records, .responsive-records tbody, .responsive-records tr, .responsive-records td { display: block; width: auto; min-width: 0; }
  .responsive-records thead { display: none; }
  .responsive-records tr { padding: 10px 14px; border-bottom: 1px solid var(--line); }
  .responsive-records td { padding: 4px 0; border: 0; white-space: normal; overflow-wrap: anywhere; text-align: left; }
  .responsive-records td[data-label]::before { content: attr(data-label); display: block; font-size: 11px; color: var(--muted); }
  .responsive-records .long-text { max-width: none; }
  .permission-row { grid-template-columns: 1fr; }
  .doc-header { padding: 14px; }
  .stepper li + li::before { width: 14px; margin: 0 4px; }
  /* 手机：蓝色只留顶上一条（标志 + 同利 ERP），下面马上就是登录框。 */
  .login-screen { display: block; }
  .login-brand-pane { justify-content: flex-start; padding: 14px 16px; background: linear-gradient(120deg, var(--brand-700), var(--brand-900)); }
  .login-brand-pane::before { display: none; }
  .login-brand-pane::after { width: 220px; height: 220px; right: -90px; top: -110px; box-shadow: none; }
  .login-mark { flex-direction: row; align-items: center; gap: 12px; margin: 0; text-align: left; }
  .login-logo { width: 46px; height: 38px; padding: 5px 6px; border-radius: 10px; box-shadow: 0 0 0 1px rgba(214, 170, 85, .55); }
  .login-logo img { width: 34px; }
  .login-mark .brand-title { font-size: 20px; margin: 0; }
  .login-rule, .login-mark .brand-sub { display: none; }
  .login-form-pane { padding: 24px 16px 40px; align-items: flex-start; }
  .error-page { margin: 32px 16px; padding: 22px; }
  .hello h1 { font-size: 20px; }
}
@media (pointer: coarse) {
  .button { min-height: 42px; }
  .subnav a { height: 36px; }
}

/* ---------- 19b. 手机三行列表（table.responsive-records.m3，Niar 2026-11-14 小改） ----------
   只在窄屏（和 responsive-records 同一个 760 断点）生效，电脑宽屏的表格一点不变：一条记录排三行，不要灰色栏名。
   位置写在 data-m3 上：1l / 1r 是第 1 行左右，2l / 2r 第 2 行，3l / 3r 第 3 行；act 是另起一行的操作按钮（真有按钮才写）；
   pick 是最左边的勾选框。整格放进去就写在 <td data-m3="…"> 上；一格里的东西要分到几处时，td 写 data-m3="split"，
   里面的元素各写各的位置，没写位置的不显示。.m3-only 只在手机三行里出现（电脑上不显示）；.m3-hide 只在手机三行里不显示。
   放不下的字段只是手机上不显示，数据照旧在页面里，详情页里都有。
   每行左右各自分宽度（flex 换行，tr::before / ::after 是两处换行）：左边占剩下的，右边按内容、最多一半多一点，放不下的省略号。 */
.m3-only { display: none; }
@media (max-width: 760px) {
  .subnav { height: auto; flex-wrap: wrap; overflow: visible; gap: 4px 2px; padding: 6px var(--gutter); }
  .subnav a { padding: 0 7px; }
  table.responsive-records.m3 > :is(tbody, tfoot) > tr { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 12px; row-gap: 0; padding: 9px 14px; position: relative; }
  table.responsive-records.m3 > :is(tbody, tfoot) > tr::before, table.responsive-records.m3 > :is(tbody, tfoot) > tr::after { content: ""; flex: 0 0 100%; height: 3px; order: 3; }
  table.responsive-records.m3 > :is(tbody, tfoot) > tr::after { order: 6; }
  table.responsive-records.m3 > :is(tbody, tfoot) > tr:has(> td[data-m3="pick"]) { padding-left: 46px; }
  table.responsive-records.m3 > tfoot { display: block; }
  table.responsive-records.m3 > tfoot > tr { background: var(--n-25); border-top: 1px solid var(--line); }
  table.responsive-records.m3 > :is(tbody, tfoot) > tr > td { display: none; }
  table.responsive-records.m3 > :is(tbody, tfoot) > tr > td[colspan]:not([data-m3]) { display: block; flex: 0 0 100%; order: 9; padding: 0; border: 0; }
  table.responsive-records.m3 > :is(tbody, tfoot) > tr > td[data-m3] { display: block; }
  table.responsive-records.m3 > :is(tbody, tfoot) > tr > td[data-m3]:empty:not([data-m3="pick"]) { display: none; }
  table.responsive-records.m3 > :is(tbody, tfoot) > tr > td[data-m3="split"] { display: contents; }
  table.responsive-records.m3 > :is(tbody, tfoot) > tr > td[data-m3="split"] > :not([data-m3]), table.responsive-records.m3 .m3-hide { display: none; }
  table.responsive-records.m3 > :is(tbody, tfoot) > tr > td[data-m3]::before { content: none; display: none; }
  table.responsive-records.m3 .m3-only { display: inline; }
  table.responsive-records.m3 > :is(tbody, tfoot) > tr [data-m3]:not([data-m3="split"], [data-m3="pick"]) { min-width: 0; width: auto; padding: 0; margin: 0; border: 0; background: none; position: static; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; }
  table.responsive-records.m3 > :is(tbody, tfoot) > tr [data-m3$="l"] { flex: 1 1 0; }
  table.responsive-records.m3 > :is(tbody, tfoot) > tr [data-m3$="r"]:not([data-m3="split"], [data-m3="pick"]) { flex: 0 1 auto; max-width: 55%; margin-left: auto; text-align: right; }
  table.responsive-records.m3 > :is(tbody, tfoot) > tr [data-m3="3r"]:not([data-m3="split"], [data-m3="pick"]) { max-width: 64%; }
  table.responsive-records.m3 > :is(tbody, tfoot) > tr [data-m3="1l"] { order: 1; }
  table.responsive-records.m3 > :is(tbody, tfoot) > tr [data-m3="1r"] { order: 2; }
  table.responsive-records.m3 > :is(tbody, tfoot) > tr [data-m3="2l"] { order: 4; }
  table.responsive-records.m3 > :is(tbody, tfoot) > tr [data-m3="2r"] { order: 5; }
  table.responsive-records.m3 > :is(tbody, tfoot) > tr [data-m3="3l"] { order: 7; }
  table.responsive-records.m3 > :is(tbody, tfoot) > tr [data-m3="3r"] { order: 8; }
  /* 操作按钮另起一行，几个按钮并排、放不下就换行（GPT-1162-L12-11：原来这条被上面那条“一行不换、超出藏掉”压住，第二个按钮被裁掉）。 */
  table.responsive-records.m3 > :is(tbody, tfoot) > tr [data-m3="act"]:not([data-m3="split"], [data-m3="pick"]) { order: 9; flex: 0 0 100%; display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; white-space: normal; overflow: visible; text-overflow: clip; }
  table.responsive-records.m3 > :is(tbody, tfoot) > tr [data-m3="act"] .button { flex: 1 1 140px; width: auto; min-width: 0; margin: 0; }
  table.responsive-records.m3 > :is(tbody, tfoot) > tr > td[data-m3="pick"] { position: absolute; left: 6px; top: 0; bottom: 0; width: 36px; padding: 0; border: 0; background: none; display: flex; align-items: center; justify-content: center; }
  table.responsive-records.m3 [data-m3] :is(.cell-sub, .cell-line, .print-flag) { display: inline; margin: 0 0 0 6px; }
  table.responsive-records.m3 [data-m3] :is(.cell-sub, .cell-line) + :is(.cell-sub, .cell-line)::before { content: "· "; }
  table.responsive-records.m3 [data-m3] .m3-hide { display: none; }
  table.responsive-records.m3 .m3-label { font-size: var(--fs-xs); font-weight: 400; color: var(--muted); }
  /* 字号、颜色照现在：第 1 行正文（单号蓝色、数加粗），第 2 行小一号，第 3 行最小的灰字；单元格自己的颜色（收款绿色等）优先。 */
  :where(table.responsive-records.m3) [data-m3="1l"] { font-weight: 600; }
  :where(table.responsive-records.m3) [data-m3="1r"] { font-weight: 650; font-variant-numeric: tabular-nums; }
  :where(table.responsive-records.m3) :is([data-m3="2l"], [data-m3="2r"]) { font-size: var(--fs-sm); font-weight: 400; color: var(--n-700); }
  :where(table.responsive-records.m3) [data-m3="2r"] { color: var(--muted); }
  :where(table.responsive-records.m3) :is([data-m3="3l"], [data-m3="3r"]) { font-size: var(--fs-xs); color: var(--muted); }
  :where(table.responsive-records.m3) a:is([data-m3="3l"], [data-m3="3r"]) { font-size: var(--fs-sm); color: var(--brand-600); }
}

/* ---------- 20. 打印 ---------- */
@media print {
  .appbar, .subnav, .drawer, .scrim, .cmdk, .heading-actions, .footer-note, .skip-link, .sticky-actions, .no-print { display: none !important; }
  body { background: #fff; }
  .main { padding: 0; max-width: none; }
  .card, .overview-card, .doc-header { box-shadow: none; break-inside: avoid; }
  .dashboard-charts { display: block; }
  .table-scroll, .table-wrap { overflow: visible; }
  th { position: static; }
}

/* ---------- 21. 经营概览（工作台图表区） ---------- */
:root { --series-1: #1f4fd1; --series-2: #c08a2e; --age-1: #e8a565; --age-2: #d27f36; --age-3: #b45d1d; --age-4: #843f12; --age-none: #c0c6d2; --age-unknown: #dde1e8; --grid: #eceef3; }
.insight { margin-bottom: 20px; }
.insight-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 12px; flex-wrap: wrap; }
.insight-head h2 { margin: 0; font-size: 17px; }
.insight-head p { margin: 2px 0 0; color: var(--muted); font-size: var(--fs-sm); }
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
.kpi-tile, .overview-card.kpi { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; background: var(--n-0); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-xs); color: var(--n-800); min-width: 0; margin: 0; }
a.kpi-tile[href]:hover { border-color: var(--brand-300); box-shadow: var(--shadow-sm); text-decoration: none; color: var(--n-900); }
.kpi-label { font-size: var(--fs-sm); color: var(--n-500); font-weight: 600; }
.kpi-value { font-size: 26px; font-weight: 700; letter-spacing: -.01em; color: var(--n-900); line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-value small { font-size: 15px; font-weight: 500; color: var(--n-400); margin-right: 3px; }
.kpi-delta { font-size: var(--fs-sm); font-weight: 600; color: var(--n-500); display: flex; flex-direction: column; gap: 2px; }
.kpi-delta.up.good { color: var(--ok-600); }
.kpi-delta.down.bad { color: var(--bad-600); }
.kpi-sub { font-weight: 400; color: var(--muted); font-size: 12px; }
.kpi-warn { color: var(--warn-700); font-weight: 600; }
.overview-card.kpi .overview-label h2 { font-size: var(--fs-sm); color: var(--n-500); }
.overview-card.kpi .overview-icon { display: none; }
.overview-card.kpi .overview-value { font-size: 26px; margin: 0; }
.overview-card.kpi .overview-value .icon { display: none; }
.overview-card.kpi .overview-note { font-size: 12px; }
.overview-card.kpi .overview-detail { margin-top: 2px; font-size: 12px; }
.overview-card.kpi .widget-state { min-height: 0; padding: 8px 0; }
.insight-charts { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); gap: 16px; }
.insight-charts > .card { margin: 0; }
.chart-legend-inline { display: flex; gap: 14px; font-size: var(--fs-sm); color: var(--n-600); }
.chart-legend-inline span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend-inline i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.trend-chart { position: relative; height: 260px; }
.trend-chart svg { display: block; width: 100%; height: 100%; overflow: visible; }
.trend-chart .axis text { font-size: 11px; fill: var(--n-400); font-variant-numeric: tabular-nums; }
.trend-chart .grid line { stroke: var(--grid); stroke-width: 1; }
.trend-chart .band { fill: transparent; }
.trend-chart .band:hover, .trend-chart .band.active { fill: rgba(31, 79, 209, .05); }
.chart-tooltip { position: absolute; pointer-events: none; z-index: 5; min-width: 168px; padding: 8px 10px; background: var(--n-0); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow-md); font-size: 12px; color: var(--n-700); transform: translate(-50%, -100%); white-space: nowrap; }
.chart-tooltip strong { display: block; margin-bottom: 4px; color: var(--n-900); }
.chart-tooltip span { display: flex; align-items: center; gap: 6px; justify-content: space-between; font-variant-numeric: tabular-nums; }
.chart-tooltip i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.chart-table { margin-top: 8px; font-size: var(--fs-sm); }
.chart-table summary { cursor: pointer; color: var(--brand-600); }
.chart-table table { margin-top: 8px; }
.hbars { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.hbars li { display: grid; grid-template-columns: 96px minmax(0, 1fr) 72px; align-items: center; gap: 10px; font-size: var(--fs-sm); }
.hbar-label { color: var(--n-600); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbar-track { height: 10px; background: var(--n-50); border-radius: 0 4px 4px 0; overflow: hidden; }
.hbar-fill { display: block; height: 100%; background: var(--series-1); border-radius: 0 4px 4px 0; }
.hbar-value { text-align: right; font-variant-numeric: tabular-nums; color: var(--n-800); font-weight: 600; }
.hbars.aging [data-aging="not_due"] .hbar-fill { background: var(--age-none); }
.hbars.aging [data-aging="age30"] .hbar-fill { background: var(--age-1); }
.hbars.aging [data-aging="age60"] .hbar-fill { background: var(--age-2); }
.hbars.aging [data-aging="age90"] .hbar-fill { background: var(--age-3); }
.hbars.aging [data-aging="older"] .hbar-fill { background: var(--age-4); }
.hbars.aging [data-aging="unknown"] .hbar-fill { background: repeating-linear-gradient(45deg, var(--age-unknown) 0 3px, var(--n-0) 3px 5px); }
.mini-head { font-size: var(--fs-sm); color: var(--n-500); margin: 18px 0 10px; font-weight: 600; }
.ops-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; background: var(--n-100); border-top: 1px solid var(--n-100); }
.ops-grid a, .ops-grid div { background: var(--n-0); padding: 12px 16px; color: var(--n-700); display: flex; flex-direction: column; gap: 2px; }
.ops-grid a:hover { background: var(--brand-25); text-decoration: none; }
.ops-grid strong { font-size: 22px; color: var(--n-900); font-variant-numeric: tabular-nums; }
.ops-grid span { font-size: 12px; color: var(--muted); }
@media (max-width: 1280px) { .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 1080px) { .insight-charts { grid-template-columns: 1fr; } }
@media (max-width: 760px) { .kpi-grid { grid-template-columns: 1fr; } .kpi-value { font-size: 22px; } .ops-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.must-reset-note { color: var(--warn-700); background: var(--warn-50); border: 1px solid var(--warn-200); border-radius: 999px; padding: 4px 12px; font-size: var(--fs-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- 22. 手机：底部操作条只留一行、列表筛选收起（对比 C02 / C03，phone-compact.js；桌面不变） ---------- */
.bar-more-toggle, .phone-flow-action, .filter-toggle-row { display: none; }
@media (max-width: 760px) {
  .sticky-actions.bar-compact { flex-wrap: wrap; gap: 8px; padding-top: 8px; padding-bottom: 8px; }
  .sticky-actions.bar-compact:not(.bar-open) > .bar-tuck, .sticky-actions.bar-compact > [data-bar-flow-after] { display: none !important; }
  .sticky-actions.bar-compact > .button { flex: 1 1 auto; min-width: 0; white-space: normal; padding-left: 10px; padding-right: 10px; }
  /* 留着的提示（选中合计、核对没通过）：有字时在按钮上面占一行，空着时不占地方。 */
  .sticky-actions.bar-compact > :not(.button):not(.bar-tuck):not(:empty) { order: -1; flex: 1 1 100%; margin: 0; }
  .sticky-actions.bar-compact > :is(span, p, div):empty { display: none; }
  .sticky-actions.bar-compact > .bar-more-toggle { display: inline-flex; flex: 0 0 auto; gap: 2px; padding: 0 8px; color: var(--n-600); }
  .bar-more-toggle .icon { transition: transform .15s; }
  .sticky-actions.bar-compact.bar-open > .bar-more-toggle .icon { transform: rotate(180deg); }
  .sticky-actions.bar-compact.bar-open > .bar-tuck { order: -1; flex: 1 1 100%; width: 100%; margin: 0; }
  .sticky-actions.bar-compact.bar-open > .bar-tuck:is(.caption, p, span) { padding: 2px 2px 8px; border-bottom: 1px solid var(--line); line-height: 1.6; }
  .phone-flow-action { display: flex; width: 100%; justify-content: center; margin: 10px 0 0; }
  .filter-collapsible > .filter-toggle-row { display: flex; align-items: center; gap: 10px; grid-column: 1 / -1; min-width: 0; }
  .filter-collapsible:not(.filters-open) > .filter-fold { display: none !important; }
  .filter-toggle { flex: 0 0 auto; }
  .filter-count { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; margin-left: 4px; border-radius: 999px; background: var(--brand-600); color: #fff; font-size: 11px; font-weight: 700; }
  .filter-summary { flex: 1 1 0; min-width: 0; font-size: var(--fs-sm); color: var(--n-600); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .filter-clear { flex: 0 0 auto; margin-left: auto; font-size: var(--fs-sm); white-space: nowrap; }
}

/* 第 66 条②：欠款 / 已开票 / 未开票三个数。默认一行一个数（往来单位资料页侧栏窄）；.is-wide 三格并排（收付款与对账）。 */
.invoice-figures { display: grid; gap: 6px; min-width: 0; }
.invoice-figures + .invoice-figures { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--n-100); }
.invoice-figures-title { margin: 0; font-size: var(--fs-sm); font-weight: 650; color: var(--n-700); }
.invoice-figures dl { display: grid; gap: 0; margin: 0; }
.invoice-figures dl > div { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; min-width: 0; padding: 6px 0; border-bottom: 1px dashed var(--n-150); }
.invoice-figures dt { font-size: var(--fs-sm); color: var(--n-600); font-weight: 600; white-space: nowrap; }
.invoice-figures dd { margin: 0; font-size: 17px; font-weight: 700; color: var(--n-900); font-variant-numeric: tabular-nums; white-space: nowrap; }
.invoice-figures dd small { font-size: 12px; font-weight: 500; color: var(--n-400); margin-right: 1px; }
.invoice-figures.is-wide dl { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.invoice-figures.is-wide dl > div { display: block; padding: 8px 12px; border: 1px solid var(--n-100); border-radius: 8px; background: var(--n-25); }
.invoice-figures.is-wide dt { font-size: var(--fs-xs); color: var(--n-500); }
.invoice-figures.is-wide dd { margin-top: 2px; overflow-wrap: anywhere; white-space: normal; }
.invoice-figures .is-open dd { color: var(--warn-700); }
.invoice-figures .is-neg dd { color: var(--bad-700); }
.invoice-figures .caption { margin: 0; }
.invoice-figures .invoice-pending { color: var(--warn-700); }
@media (max-width: 520px) { .invoice-figures.is-wide dl { grid-template-columns: 1fr; gap: 0; } .invoice-figures.is-wide dl > div { display: flex; align-items: baseline; justify-content: space-between; border: 0; border-bottom: 1px dashed var(--n-150); border-radius: 0; background: none; padding: 6px 0; } }

/* ---------- 22. 「?」问号说明（Niar 2026-11-11）----------
   蓝色圆圈，点开在旁边弹一个白底蓝边的小框（带小尖角、右上角 ✕）。颜色只用品牌蓝；红色留给删除、撤销、出错。
   框用 fixed 定位（help-tip.js 按按钮位置算，贴着屏幕边留 8px），不会被卡片、表格的滚动框裁掉，手机上也不出屏。 */
.help-tip { display: inline-flex; vertical-align: middle; line-height: 1; font-weight: 400; letter-spacing: 0; text-transform: none; }
.help-tip-btn { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; padding: 0; border: 1.5px solid var(--brand-600); border-radius: 50%; background: var(--brand-50); color: var(--brand-600); font-size: 12px; font-weight: 700; line-height: 1; font-family: var(--font); cursor: pointer; flex-shrink: 0; transition: background .12s, color .12s; }
.help-tip-btn:hover, .help-tip-btn[aria-expanded="true"] { background: var(--brand-600); color: #fff; }
.help-tip-btn:focus-visible { outline: none; box-shadow: var(--ring); }
/* 手机上手指点得到：按钮外面再多一圈看不见的点击范围。 */
.help-tip-btn::after { content: ""; position: absolute; inset: -8px; }
.help-tip-lg .help-tip-btn { width: 24px; height: 24px; border-width: 2px; font-size: 15px; }
.help-tip-pop { position: fixed; z-index: 120; top: 0; left: 0; width: min(340px, calc(100vw - 16px)); padding: 12px 36px 12px 14px; background: var(--n-0); border: 1.5px solid var(--brand-600); border-radius: var(--r-md); box-shadow: var(--shadow-md); color: var(--n-800); font-size: var(--fs-md); font-weight: 400; line-height: 1.65; text-align: left; white-space: normal; overflow-wrap: anywhere; --tip-arrow-x: 50%; }
.help-tip-pop[hidden] { display: none; }
.help-tip-pop:not([hidden]) { display: block; }
.help-tip-pop::before, .help-tip-pop::after { content: ""; position: absolute; left: var(--tip-arrow-x); width: 0; height: 0; border: 8px solid transparent; transform: translateX(-50%); }
.help-tip-pop::before { top: -17px; border-bottom-color: var(--brand-600); }
.help-tip-pop::after { top: -14px; border-bottom-color: var(--n-0); }
.help-tip-pop.above::before { top: auto; bottom: -17px; border-bottom-color: transparent; border-top-color: var(--brand-600); }
.help-tip-pop.above::after { top: auto; bottom: -14px; border-bottom-color: transparent; border-top-color: var(--n-0); }
.help-tip-close { position: absolute; top: 4px; right: 4px; width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center; padding: 0; border: 0; border-radius: var(--r-sm); background: transparent; color: var(--n-500); font-size: 14px; line-height: 1; cursor: pointer; }
.help-tip-close:hover { background: var(--brand-50); color: var(--brand-700); }
.help-tip-close:focus-visible { outline: none; box-shadow: var(--ring); }
.help-tip-body, .help-tip-line { display: block; }
.help-tip-line + .help-tip-line { margin-top: 6px; }
.help-tip-line strong { color: var(--n-900); }
/* 宽框（框里放一整张图的说明，例如放卷方向对照图）：电脑上宽一点，图看得清；手机上贴着屏幕两边。
   太高时框里自己上下滚，不出屏；上下都放不下时 help-tip.js 把整框挪进屏幕（squeezed，箭头不画）。 */
.help-tip-wide .help-tip-pop { width: min(860px, calc(100vw - 16px)); }
.help-tip-wide .help-tip-body { max-height: calc(100vh - 48px); max-height: calc(100dvh - 48px); overflow-y: auto; overscroll-behavior: contain; }
.help-tip-pop.squeezed::before, .help-tip-pop.squeezed::after { display: none; }
.help-tip-pop img { display: block; width: 100%; height: auto; border: 1px solid var(--n-200); border-radius: var(--r-sm); background: #fff; }
/* 标题和问号排一行：页面标题、卡片标题、按钮组小标题、栏位名。 */
.title-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.title-line > h1, .title-line > h2, .title-line > h3, .title-line > label { margin: 0; }
.page-heading .title-line { margin-bottom: 4px; }
.field .field-label-line { gap: 6px; margin-bottom: 6px; flex-wrap: nowrap; }
.field .field-label-line > label { margin: 0; }
/* 撤不回来的动作：页面上留一句看得见的红字短话，细节放进问号。 */
.irreversible-line { margin: 4px 0 0; color: var(--bad-600); font-weight: 600; font-size: var(--fs-md); }
.page-heading p.irreversible-line { color: var(--bad-600); }
/* 不是撤不回来、但容易办错的：留一句看得见的提醒（琥珀色，不用红）。 */
.page-heading p.heading-warning { margin: 4px 0 0; color: var(--warn-700); }
.button-group .help-tip, .next-actions .help-tip, .heading-actions .help-tip { align-self: center; }
@media print { .help-tip { display: none !important; } }
