/* 诗尼曼家居 CRM 后台原型 — 共享样式（令牌源自 brand-spec.md / 参考截图） */
:root {
  --bg: oklch(97.2% 0.008 250);
  --surface: oklch(100% 0 0);
  --fg: oklch(31% 0.02 260);
  --muted: oklch(63% 0.02 260);
  --border: oklch(91.5% 0.01 250);
  --accent: oklch(64% 0.17 255);
  --accent-strong: oklch(57% 0.18 255);
  --accent-soft: oklch(95.5% 0.03 255);
  --accent-softer: oklch(97.5% 0.018 255);
  --sidebar-bg: oklch(96% 0.02 250);
  --success: oklch(63% 0.14 155);
  --success-soft: oklch(95.5% 0.04 155);
  --warn: oklch(70% 0.14 75);
  --warn-soft: oklch(96% 0.05 85);
  --orange: oklch(67% 0.16 55);
  --orange-soft: oklch(96% 0.045 60);
  --danger: oklch(60% 0.21 27);
  --danger-soft: oklch(96% 0.03 27);
  --info: oklch(66% 0.12 230);
  --info-soft: oklch(96% 0.03 230);
  --teal: oklch(66% 0.11 190);
  --teal-soft: oklch(96% 0.035 190);
  --neutral-soft: oklch(95.5% 0.008 250);
  --scrim: oklch(25% 0.03 260 / 0.45);
  --shadow-1: 0 1px 3px oklch(30% 0.05 260 / 0.07);
  --shadow-2: 0 8px 28px oklch(30% 0.05 260 / 0.16);
  --font-body: "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", system-ui, sans-serif;
  --font-mono: "SF Mono", "Cascadia Code", Consolas, "Courier New", monospace;
  --topbar-h: 56px;
  --tabbar-h: 44px;
  --sidebar-w: 208px;
  --radius: 6px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.7;
  color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 13px; color: var(--fg); }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
::selection { background: var(--accent-soft); }

/* 滚动条 — 与品牌同语言 */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: oklch(84% 0.03 250); border-radius: 6px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: oklch(74% 0.07 252); }
* { scrollbar-width: thin; scrollbar-color: oklch(84% 0.03 250) var(--bg); }

.num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--font-mono); font-size: 12.5px; letter-spacing: 0.01em; }

/* ============ 顶栏 ============ */
.topbar {
  position: fixed; inset: 0 0 auto 0; height: var(--topbar-h); z-index: 60;
  display: flex; align-items: center; gap: 14px; padding: 0 16px;
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.brand-name { font-size: 21px; font-weight: 700; color: var(--accent); letter-spacing: 0.02em; white-space: nowrap; }
.brand-name sup { font-size: 10px; font-weight: 500; }
.brand-sub { font-size: 11px; color: var(--muted); letter-spacing: 0.28em; white-space: nowrap; }
.topbar-menu-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 10px;
  background: none; border: none; border-radius: var(--radius); color: var(--fg); font-size: 14px; font-weight: 550;
}
.topbar-menu-btn:hover { background: var(--accent-softer); }
.topbar-search { position: relative; flex: 0 1 360px; margin-left: 6px; }
.topbar-search input {
  width: 100%; height: 36px; padding: 0 12px 0 34px;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg);
}
.topbar-search input::placeholder { color: var(--muted); }
.topbar-search input:focus { border-color: var(--accent); background: var(--surface); outline: none; box-shadow: 0 0 0 2px var(--accent-soft); }
.topbar-search .search-ic { position: absolute; left: 10px; top: 50%; translate: 0 -50%; color: var(--muted); pointer-events: none; display: flex; }
.search-panel {
  position: absolute; top: 42px; left: 0; width: 420px; max-height: 380px; overflow: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow-2);
  padding: 6px; display: none; z-index: 80;
}
.search-panel.open { display: block; }
.search-group-label { font-size: 11px; color: var(--muted); letter-spacing: 0.08em; padding: 8px 10px 4px; }
.search-item { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 8px 10px; border: none; background: none; border-radius: var(--radius); font-size: 13px; }
.search-item:hover { background: var(--accent-softer); }
.search-item .si-sub { margin-left: auto; color: var(--muted); font-size: 12px; flex-shrink: 0; }
.search-empty { padding: 18px 10px; color: var(--muted); font-size: 13px; text-align: center; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.version-chip {
  display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 14px 0 6px;
  border: 1px solid var(--border); border-radius: 999px; background: var(--surface); font-size: 12.5px; color: var(--fg);
  max-width: 260px;
}
.version-chip:hover { border-color: var(--accent); background: var(--accent-softer); }
.version-chip .v-badge { width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: oklch(100% 0 0); display: grid; place-items: center; font-size: 12px; font-weight: 700; flex-shrink: 0; }
.version-chip .v-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-btn { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 8px; background: none; border: none; border-radius: var(--radius); font-size: 14px; font-weight: 550; color: var(--fg); }
.user-btn:hover { background: var(--accent-softer); }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-strong); display: grid; place-items: center; }

/* ============ 框架 ============ */
.shell { display: flex; padding-top: var(--topbar-h); min-height: 100vh; }
.sidebar {
  position: fixed; top: var(--topbar-h); bottom: 0; left: 0; width: var(--sidebar-w); z-index: 50;
  background: var(--sidebar-bg); border-right: 1px solid var(--border);
  overflow-y: auto; overflow-x: hidden; padding: 8px 0 24px;
  transition: width 0.22s ease, translate 0.22s ease;
}
.main { flex: 1; min-width: 0; margin-left: var(--sidebar-w); transition: margin-left 0.22s ease; display: flex; flex-direction: column; }
body.nav-collapsed .sidebar { width: 64px; }
body.nav-collapsed .main { margin-left: 64px; }
body.nav-collapsed .nav-label, body.nav-collapsed .nav-caret, body.nav-collapsed .nav-sub, body.nav-collapsed .nav-group-title { display: none; }
body.nav-collapsed .nav-top > button { justify-content: center; padding: 0; }

.nav-top > button {
  display: flex; align-items: center; gap: 10px; width: 100%; height: 44px; padding: 0 16px;
  background: none; border: none; font-size: 14px; font-weight: 550; color: var(--fg); text-align: left;
}
.nav-top > button:hover { background: oklch(93% 0.03 250); }
.nav-top .nav-ic { display: flex; color: oklch(50% 0.08 255); flex-shrink: 0; }
.nav-caret { margin-left: auto; display: flex; color: var(--muted); transition: rotate 0.18s ease; }
.nav-top.open .nav-caret { rotate: 180deg; }
.nav-sub { display: none; padding: 2px 0 6px; }
.nav-top.open + .nav-sub { display: block; }
.nav-group-title { font-size: 12px; color: var(--muted); padding: 8px 16px 4px 20px; letter-spacing: 0.04em; }
.nav-item {
  display: flex; align-items: center; width: calc(100% - 12px); margin: 1px 6px; min-height: 36px; padding: 6px 10px 6px 24px;
  border: none; background: none; border-radius: var(--radius); font-size: 13.5px; color: var(--fg); text-align: left; line-height: 1.5;
}
.nav-item:hover { background: oklch(93% 0.03 250); }
.nav-item.active { background: var(--accent); color: oklch(100% 0 0); font-weight: 550; }
.nav-item.active:hover { background: var(--accent-strong); }

/* 页签条 */
.tabbar {
  position: sticky; top: var(--topbar-h); z-index: 40; height: var(--tabbar-h);
  display: flex; align-items: center; gap: 8px; padding: 0 16px;
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.tab-chip {
  display: inline-flex; align-items: center; gap: 8px; height: 30px; padding: 0 12px;
  border: 1px solid var(--border); border-radius: 4px; background: var(--surface);
  font-size: 13px; color: var(--fg); letter-spacing: 0.02em;
}
.tab-chip:hover { border-color: var(--accent); color: var(--accent-strong); }
.tab-chip.active { background: var(--accent); border-color: var(--accent); color: oklch(100% 0 0); font-weight: 550; }
.tab-chip.active:hover { background: var(--accent-strong); color: oklch(100% 0 0); }
.tab-x { display: inline-flex; border: none; background: none; color: inherit; padding: 2px; border-radius: 3px; line-height: 0; }
.tab-x:hover { background: oklch(100% 0 0 / 0.25); }
.tab-chip:not(.active) .tab-x:hover { background: var(--accent-soft); }

.page { padding: 16px; flex: 1; min-width: 0; }

/* ============ 卡片 / 筛选 ============ */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow-1); }
.filter-card { padding: 16px 16px 12px; margin-bottom: 14px; }
.filter-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; }
.filter-field { display: flex; align-items: center; gap: 10px; }
.filter-field > label { font-size: 13.5px; font-weight: 550; white-space: nowrap; }
.input, .select {
  height: 36px; padding: 0 12px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); min-width: 0;
}
.input::placeholder { color: var(--muted); }
.input:hover, .select:hover { border-color: oklch(80% 0.04 250); }
.input:focus, .select:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 2px var(--accent-soft); }
.filter-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }

/* 按钮 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 16px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--surface); color: var(--fg);
  font-size: 13.5px; font-weight: 550; letter-spacing: 0.02em; white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease, translate 0.06s ease;
}
.btn:hover { border-color: oklch(78% 0.06 252); background: var(--accent-softer); color: var(--accent-strong); }
.btn:active { translate: 0 1px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: oklch(100% 0 0); }
.btn-primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); color: oklch(100% 0 0); }
.btn-danger { color: var(--danger); }
.btn-danger:hover { border-color: var(--danger); background: var(--danger-soft); color: var(--danger); }
.btn-sm { height: 30px; padding: 0 12px; font-size: 12.5px; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.btn-link { border: none; background: none; height: auto; padding: 2px 4px; color: var(--accent-strong); font-weight: 550; }
.btn-link:hover { background: none; text-decoration: underline; color: var(--accent-strong); }

/* 门店多选 */
.multiselect { position: relative; }
.multiselect-trigger { min-width: 220px; justify-content: space-between; font-weight: 400; color: var(--muted); }
.multiselect-trigger.has-value { color: var(--fg); }
.multiselect-panel {
  position: absolute; top: 40px; left: 0; width: 280px; max-height: 320px; overflow: auto; z-index: 70;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow-2); padding: 8px; display: none;
}
.multiselect-panel.open { display: block; }
.ms-tools { display: flex; gap: 8px; padding: 2px 4px 8px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.ms-option { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: var(--radius); font-size: 13px; cursor: pointer; }
.ms-option:hover { background: var(--accent-softer); }
.checkbox { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; flex-shrink: 0; }

/* ============ 表格 ============ */
.table-card { overflow: hidden; }
.table-card:fullscreen { border-radius: 0; display: flex; flex-direction: column; background: var(--surface); padding: 12px; }
.table-card:fullscreen .table-scroll { flex: 1; max-height: none; }
.table-card.fs-fallback { position: fixed; inset: 0; z-index: 100; border-radius: 0; display: flex; flex-direction: column; padding: 12px; }
.table-card.fs-fallback .table-scroll { flex: 1; max-height: none; }
.table-meta { display: flex; align-items: center; gap: 14px; padding: 12px 16px; border-bottom: 1px solid var(--border); font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.table-meta strong { color: var(--fg); font-weight: 600; }
.table-meta .meta-danger strong { color: var(--danger); }
.filter-chip { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 999px; background: var(--warn-soft); color: oklch(50% 0.12 70); font-size: 12px; border: none; }
.filter-chip:hover { background: oklch(92% 0.07 80); }
.table-scroll { overflow: auto; max-height: calc(100vh - 320px); }
table.grid { border-collapse: separate; border-spacing: 0; width: 100%; min-width: 1480px; font-size: 13px; }
table.grid.compact { min-width: 1180px; }
.grid th, .grid td { border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 11px 14px; text-align: left; vertical-align: middle; }
.grid th:last-child, .grid td:last-child { border-right: none; }
.grid thead th {
  position: sticky; top: 0; z-index: 5; background: oklch(97.5% 0.008 250);
  font-weight: 600; font-size: 13px; color: var(--fg); white-space: nowrap; letter-spacing: 0.02em;
}
.grid th.sortable { cursor: pointer; user-select: none; }
.grid th.sortable:hover { background: var(--accent-soft); }
.grid th .sort-ic { display: inline-flex; vertical-align: -2px; margin-left: 4px; color: var(--muted); }
.grid th.sorted .sort-ic { color: var(--accent-strong); }
.grid tbody tr:hover td { background: var(--accent-softer); }
.grid td.group-cell { background: oklch(99% 0.004 250); font-weight: 550; }
.grid tbody tr:hover td.group-cell { background: var(--accent-softer); }
.grid tr.group-start td { border-top: 1px solid oklch(86% 0.02 250); }
.grid .cell-addr { max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.grid .cell-store { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grid .op-col { position: sticky; right: 0; background: var(--surface); z-index: 4; box-shadow: -6px 0 8px -6px oklch(30% 0.05 260 / 0.12); }
.grid thead .op-col { z-index: 6; background: oklch(97.5% 0.008 250); }
.grid tbody tr:hover .op-col { background: var(--accent-softer); }
.empty-cell { color: oklch(78% 0.015 250); }
.table-empty { padding: 56px 20px; text-align: center; color: var(--muted); }
.table-empty .te-ic { display: flex; justify-content: center; margin-bottom: 10px; color: oklch(80% 0.03 250); }

/* 状态徽标 */
.badge { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 550; letter-spacing: 0.02em; white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-neutral { background: var(--neutral-soft); color: oklch(50% 0.02 260); }
.badge-warn { background: var(--warn-soft); color: oklch(52% 0.13 70); }
.badge-orange { background: var(--orange-soft); color: oklch(54% 0.15 50); }
.badge-info { background: var(--info-soft); color: oklch(50% 0.12 235); }
.badge-process { background: var(--accent-soft); color: var(--accent-strong); }
.badge-teal { background: var(--teal-soft); color: oklch(48% 0.1 190); }
.badge-success { background: var(--success-soft); color: oklch(47% 0.12 155); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.days-warn { color: oklch(55% 0.14 70); font-weight: 600; }
.days-danger { color: var(--danger); font-weight: 600; }

/* 分页 */
.pager { display: flex; align-items: center; gap: 6px; padding: 12px 16px; flex-wrap: wrap; font-size: 13px; color: var(--fg); }
.pager-btn {
  min-width: 30px; height: 30px; padding: 0 8px; border: 1px solid var(--border); border-radius: 4px;
  background: var(--surface); color: var(--fg); font-size: 13px; display: inline-flex; align-items: center; justify-content: center;
}
.pager-btn:hover:not([disabled]) { border-color: var(--accent); color: var(--accent-strong); background: var(--accent-softer); }
.pager-btn.current { background: var(--accent); border-color: var(--accent); color: oklch(100% 0 0); font-weight: 600; }
.pager-btn[disabled] { opacity: 0.45; cursor: not-allowed; }
.pager-ellipsis { padding: 0 4px; color: var(--muted); }
.pager-jump { display: inline-flex; align-items: center; gap: 6px; margin-left: 8px; color: var(--muted); }
.pager-jump input { width: 48px; height: 30px; text-align: center; border: 1px solid var(--border); border-radius: 4px; }
.pager-total { margin-left: auto; color: var(--muted); }
.pager select { height: 30px; border: 1px solid var(--border); border-radius: 4px; background: var(--surface); padding: 0 6px; }

/* ============ 浮层：下拉菜单 / 抽屉 / 弹窗 / Toast ============ */
.float-menu {
  position: fixed; z-index: 160; min-width: 148px; padding: 5px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow-2);
}
.float-menu button { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 10px; border: none; background: none; border-radius: var(--radius); font-size: 13px; color: var(--fg); text-align: left; }
.float-menu button:hover { background: var(--accent-softer); color: var(--accent-strong); }
.float-menu button.menu-danger { color: var(--danger); }
.float-menu button.menu-danger:hover { background: var(--danger-soft); color: var(--danger); }
.float-menu .menu-sep { height: 1px; background: var(--border); margin: 5px 4px; }

.scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 130; opacity: 0; pointer-events: none; transition: opacity 0.2s ease; }
.scrim.show { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(480px, 94vw); z-index: 140;
  background: var(--surface); box-shadow: var(--shadow-2); translate: 100% 0; transition: translate 0.24s ease;
  display: flex; flex-direction: column;
}
.drawer.show { translate: 0 0; }
.drawer-head { display: flex; align-items: center; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.drawer-head h3 { font-size: 16px; font-weight: 600; line-height: 1.4; }
.drawer-close { margin-left: auto; width: 32px; height: 32px; border: none; background: none; border-radius: var(--radius); color: var(--muted); display: grid; place-items: center; }
.drawer-close:hover { background: var(--accent-softer); color: var(--fg); }
.drawer-body { flex: 1; overflow-y: auto; padding: 20px; }
.drawer-foot { display: flex; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--border); }

.info-grid { display: grid; grid-template-columns: 88px 1fr; row-gap: 10px; column-gap: 12px; font-size: 13.5px; }
.info-grid dt { color: var(--muted); }
.info-grid dd { min-width: 0; overflow-wrap: break-word; }
.drawer-section { margin-bottom: 22px; }
.drawer-section > h4 { font-size: 13px; font-weight: 600; color: var(--muted); letter-spacing: 0.06em; margin-bottom: 12px; }
.amount-line { font-size: 24px; font-weight: 700; color: var(--fg); font-variant-numeric: tabular-nums; }
.amount-line small { font-size: 12px; font-weight: 400; color: var(--muted); margin-left: 8px; }

/* 时间线 */
.timeline { list-style: none; }
.timeline li { position: relative; padding: 0 0 20px 26px; }
.timeline li::before { content: ""; position: absolute; left: 6px; top: 18px; bottom: -2px; width: 2px; background: var(--border); }
.timeline li:last-child::before { display: none; }
.timeline .tl-dot { position: absolute; left: 0; top: 4px; width: 14px; height: 14px; border-radius: 50%; border: 2px solid oklch(84% 0.02 250); background: var(--surface); }
.timeline li.done .tl-dot { border-color: var(--success); background: var(--success); }
.timeline li.current .tl-dot { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 3px var(--accent-soft); }
.timeline li.done::before { background: oklch(85% 0.08 155); }
.timeline .tl-title { font-size: 13.5px; font-weight: 550; line-height: 1.5; }
.timeline li.pending .tl-title { color: var(--muted); font-weight: 400; }
.timeline .tl-time { font-size: 12px; color: var(--muted); }

/* 弹窗 */
.modal-wrap { position: fixed; inset: 0; z-index: 150; display: none; grid-template-columns: minmax(0, 1fr); place-items: center; padding: 20px; background: var(--scrim); }
.modal-wrap.show { display: grid; animation: scrim-in 0.2s ease; }
@keyframes scrim-in { from { opacity: 0; } to { opacity: 1; } }
.modal {
  width: min(560px, 100%); max-height: 88vh; display: flex; flex-direction: column;
  background: var(--surface); border-radius: 10px; box-shadow: var(--shadow-2);
  animation: modal-in 0.18s ease;
}
@keyframes modal-in { from { opacity: 0; translate: 0 10px; } to { opacity: 1; translate: 0 0; } }
.modal-head { display: flex; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-head h3 { font-size: 16px; font-weight: 600; }
.modal-body { padding: 20px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--border); }
/* 弹窗内小表格 */
.mini-wrap { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
table.mini-grid { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 13px; }
.mini-grid th, .mini-grid td { border-bottom: 1px solid var(--border); padding: 9px 12px; text-align: left; vertical-align: middle; }
.mini-grid thead th { background: oklch(97.5% 0.008 250); font-weight: 600; font-size: 12.5px; white-space: nowrap; letter-spacing: 0.02em; }
.mini-grid tbody tr:last-child td { border-bottom: none; }
.mini-grid tbody tr:hover td { background: var(--accent-softer); }
/* 订单进度弹窗 */
.pm-section { margin-top: 24px; }
.pm-section:first-child { margin-top: 0; }
.pm-sec-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.pm-sec-head h4 { font-size: 14.5px; font-weight: 600; }
.pm-links { display: flex; align-items: center; gap: 16px; }
.pm-links .btn-link, .pm-sec-head > .btn-link { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; font-weight: 550; }
.pm-caret { display: inline-flex; transition: rotate 0.15s ease; }
.pm-caret.open { rotate: 180deg; }
.pm-meta { display: flex; flex-wrap: wrap; gap: 8px 28px; font-size: 13px; color: var(--muted); padding: 10px 14px; border: 1px solid var(--border); border-bottom: none; border-radius: 8px 8px 0 0; background: oklch(98.5% 0.005 250); }
.pm-meta b { color: var(--fg); font-weight: 600; }
.pm-meta + .mini-wrap { border-radius: 0 0 8px 8px; }
.mini-scroll { overflow-x: auto; }
.pm-stage .stage-name { font-weight: 550; white-space: nowrap; }
.pm-stage td.num { white-space: nowrap; }
.pm-info { display: inline-flex; vertical-align: -2px; margin-left: 4px; color: var(--accent-strong); cursor: help; }
.stage-done { color: var(--fg); }
.stage-current { color: var(--accent-strong); font-weight: 600; }
.stage-pending { color: var(--muted); }
.pm-stage tr.stage-total td { background: oklch(97.5% 0.008 250); font-weight: 600; }
/* 订单生产：一级环节 + 二级入库批次明细 */
/* 表头六列统一左缘与 40px 行高；一级环节名的缩进来自列内导轨，二级明细用 --stage-indent 对齐环节名 */
.pm-stage { --stage-indent: 50px; }
.pm-stage > thead > tr > th { height: 40px; padding-top: 0; padding-bottom: 0; }
.pm-stage > thead > tr > th:first-child, .pm-stage > tbody > tr:not(.stage-sub) > td:first-child { padding-left: 14px; }
.pm-stage .stage-name { display: flex; align-items: center; gap: 8px; }
.pm-stage tbody > tr:not(.stage-sub) > td { height: 40px; padding-top: 0; padding-bottom: 0; }
.pm-stage tr.stage-l1 > td { background: oklch(97.8% 0.008 250); }
.pm-stage tr.stage-l1 .stage-name { font-weight: 600; }
.pm-stage tr.stage-l1:hover > td { background: var(--accent-softer); }
.pm-stage tr.stage-expandable { cursor: pointer; }
.stage-rail { flex: none; width: 28px; }
.stage-toggle { flex: none; width: 28px; height: 22px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 6px; background: transparent; color: oklch(48% 0.02 260); cursor: pointer; transition: background 0.15s ease, color 0.15s ease; }
.stage-toggle svg { rotate: -90deg; transition: rotate 0.15s ease; }
.stage-toggle.open svg { rotate: 0deg; }
.stage-toggle:hover { background: var(--accent-soft); color: var(--accent-strong); }
.stage-toggle:focus-visible { outline: 2px solid var(--accent-strong); outline-offset: 1px; border-radius: 6px; }
.stage-label { min-width: 0; }
.stage-count { margin-left: 8px; font-size: 12px; color: oklch(48% 0.02 260); letter-spacing: 0.01em; font-variant-numeric: tabular-nums; }
.pm-stage tr.stage-sub > td { padding: 0; background: var(--surface); }
.pm-stage tr.stage-sub:hover > td { background: var(--surface); }
.sub-inner { padding: 12px 14px 14px var(--stage-indent); }
.sub-cap { display: flex; align-items: baseline; gap: 10px; font-size: 12.5px; font-weight: 600; margin-bottom: 8px; }
.sub-num { font-weight: 400; font-size: 12px; color: oklch(48% 0.02 260); letter-spacing: 0.01em; font-variant-numeric: tabular-nums; }
.sub-scroll { max-height: 286px; overflow: auto; }
.sub-scroll .mini-grid thead th { position: sticky; top: 0; z-index: 1; }
.sub-scroll .mini-grid td { white-space: nowrap; }
.pm-hint { font-size: 13px; color: var(--muted); padding: 14px; border: 1px dashed var(--border); border-radius: 8px; background: oklch(98.5% 0.005 250); }
.pack-layout { display: flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.pack-tree { width: 216px; flex: none; border-right: 1px solid var(--border); padding: 12px 10px; background: oklch(98.5% 0.005 250); overflow-y: auto; max-height: 340px; }
.pack-tree .input { width: 100%; margin-bottom: 8px; }
.pack-cat-row { display: flex; align-items: center; }
.pack-caret-btn { border: none; background: none; width: 22px; height: 28px; display: grid; place-items: center; color: var(--muted); cursor: pointer; flex: none; border-radius: 6px; }
.pack-caret-btn svg { rotate: -90deg; transition: rotate 0.15s ease; }
.pack-cat-row.open .pack-caret-btn svg { rotate: 0deg; }
.pack-cat, .pack-item { display: flex; align-items: center; gap: 6px; width: 100%; text-align: left; background: none; border: none; cursor: pointer; font-size: 13px; padding: 5px 8px; border-radius: 6px; color: var(--fg); letter-spacing: 0.01em; }
.pack-cat:hover, .pack-item:hover, .pack-caret-btn:hover { background: var(--accent-softer); }
.pack-cat-row.active .pack-cat, .pack-item.active, .pack-tree > .pack-cat.active { background: var(--accent-soft); color: var(--accent-strong); font-weight: 550; }
.pack-item { padding-left: 30px; font-size: 12.5px; color: var(--muted); }
.pack-item.active { color: var(--accent-strong); }
.pack-table { flex: 1; min-width: 0; overflow: auto; max-height: 340px; }
.pack-table .mini-grid thead th { position: sticky; top: 0; z-index: 1; }
.pack-table .mini-grid td { white-space: nowrap; }
.timeline .tl-desc { font-size: 12px; color: var(--muted); margin-top: 2px; line-height: 1.6; }
@media (max-width: 720px) {
  .pack-layout { flex-direction: column; }
  .pack-tree { width: 100%; max-height: 180px; border-right: none; border-bottom: 1px solid var(--border); }
}

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.form-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.form-field.full { grid-column: 1 / -1; }
.form-field label { font-size: 13px; font-weight: 550; }
.form-field label .req { color: var(--danger); margin-left: 2px; }
.form-field .input, .form-field .select, .form-field textarea { width: 100%; }
.form-field textarea { border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 12px; resize: vertical; min-height: 64px; }
.form-field textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 2px var(--accent-soft); }
.form-error { font-size: 12px; color: var(--danger); min-height: 18px; line-height: 1.5; }
.form-field.invalid .input, .form-field.invalid .select { border-color: var(--danger); }

/* Toast */
.toast-stack { position: fixed; top: 68px; left: 50%; translate: -50% 0; z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-radius: 8px;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-2);
  font-size: 13.5px; pointer-events: auto; animation: toast-in 0.2s ease; max-width: min(560px, 92vw);
}
@keyframes toast-in { from { opacity: 0; translate: 0 -8px; } to { opacity: 1; translate: 0 0; } }
.toast.out { opacity: 0; translate: 0 -8px; transition: all 0.2s ease; }
.toast .t-ic { display: flex; flex-shrink: 0; }
.toast-success .t-ic { color: var(--success); }
.toast-info .t-ic { color: var(--accent); }
.toast-warn .t-ic { color: var(--warn); }
.toast-danger .t-ic { color: var(--danger); }
.toast-action { border: none; background: none; color: var(--accent-strong); font-weight: 600; font-size: 13px; padding: 2px 4px; flex-shrink: 0; }
.toast-action:hover { text-decoration: underline; }

/* ============ 首页 widgets ============ */
.home-greet { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.home-greet h1 { font-size: 24px; font-weight: 600; line-height: 1.35; }
.home-greet .greet-sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 14px; }
.metric-card { padding: 18px 20px; position: relative; overflow: hidden; }
.metric-card .m-label { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.metric-card .m-ic { display: inline-flex; width: 28px; height: 28px; border-radius: 7px; place-items: center; justify-content: center; align-items: center; }
.metric-card .m-value { font-size: 32px; font-weight: 700; line-height: 1.3; font-variant-numeric: tabular-nums; margin-top: 6px; }
.metric-card .m-foot { font-size: 12px; color: var(--muted); margin-top: 2px; }
.metric-card .m-foot a { color: var(--accent-strong); font-weight: 550; }
.metric-card .m-foot a:hover { text-decoration: underline; }
.home-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 14px; margin-bottom: 14px; }
.widget { padding: 18px 20px; min-width: 0; }
.widget > header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 10px; }
.widget h2 { font-size: 15px; font-weight: 600; line-height: 1.4; }
.widget .w-link { font-size: 12.5px; color: var(--accent-strong); font-weight: 550; }
.widget .w-link:hover { text-decoration: underline; }
.chart-tip { position: fixed; z-index: 180; pointer-events: none; background: var(--fg); color: oklch(98% 0 0); font-size: 12px; padding: 6px 10px; border-radius: 6px; box-shadow: var(--shadow-2); display: none; white-space: nowrap; }
.legend-list { list-style: none; display: flex; flex-direction: column; gap: 8px; font-size: 13px; }
.legend-list li { display: flex; align-items: center; gap: 8px; }
.legend-list .lg-dot { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.legend-list .lg-count { margin-left: auto; font-weight: 600; font-variant-numeric: tabular-nums; }
.legend-list .lg-pct { color: var(--muted); width: 46px; text-align: right; font-variant-numeric: tabular-nums; }
.todo-list { list-style: none; }
.todo-list li + li { border-top: 1px solid var(--border); }
.todo-list a { display: flex; align-items: center; gap: 12px; padding: 12px 4px; }
.todo-list a:hover { background: var(--accent-softer); }
.todo-list .td-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.todo-list .td-label { font-size: 13.5px; }
.todo-list .td-count { margin-left: auto; font-weight: 700; font-size: 16px; font-variant-numeric: tabular-nums; }
.todo-list .td-arrow { color: var(--muted); display: flex; }
.notice-list { list-style: none; font-size: 13px; }
.notice-list li { display: flex; gap: 10px; padding: 9px 0; align-items: baseline; }
.notice-list li + li { border-top: 1px dashed var(--border); }
.notice-list .n-tag { flex-shrink: 0; font-size: 11px; font-weight: 600; padding: 1px 8px; border-radius: 4px; letter-spacing: 0.06em; }
.notice-list .n-date { margin-left: auto; color: var(--muted); font-size: 12px; flex-shrink: 0; }
.rank-list { list-style: none; display: flex; flex-direction: column; gap: 12px; }
.rank-list .rk-head { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 4px; }
.rank-list .rk-head .rk-val { font-weight: 600; font-variant-numeric: tabular-nums; }
.rank-list .rk-bar { height: 8px; border-radius: 4px; background: var(--neutral-soft); overflow: hidden; }
.rank-list .rk-fill { height: 100%; border-radius: 4px; background: linear-gradient(90deg, var(--accent), oklch(72% 0.13 230)); }
.rank-list .rk-idx { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 4px; font-size: 11px; font-weight: 700; background: var(--neutral-soft); color: var(--muted); margin-right: 8px; }
.rank-list li:first-child .rk-idx { background: var(--accent); color: oklch(100% 0 0); }

/* 状态筛选 chips（订单列表） */
.status-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.status-tab {
  display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 14px;
  border: 1px solid var(--border); border-radius: 999px; background: var(--surface); font-size: 13px; color: var(--fg);
}
.status-tab:hover { border-color: var(--accent); color: var(--accent-strong); background: var(--accent-softer); }
.status-tab.active { background: var(--accent); border-color: var(--accent); color: oklch(100% 0 0); font-weight: 550; }
.status-tab .st-count { font-size: 12px; font-variant-numeric: tabular-nums; opacity: 0.75; }
.bulk-bar {
  display: none; align-items: center; gap: 12px; padding: 10px 16px; margin-bottom: 14px;
  background: var(--accent-soft); border: 1px solid oklch(85% 0.06 255); border-radius: 8px; font-size: 13px;
}
.bulk-bar.show { display: flex; }
.bulk-bar strong { color: var(--accent-strong); }

/* ============ 响应式 ============ */
.nav-scrim { display: none; }
@media (max-width: 1100px) {
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .home-grid { grid-template-columns: 1fr; }
  .brand-sub { display: none; }
}
@media (max-width: 860px) {
  .sidebar { translate: -100% 0; width: var(--sidebar-w) !important; box-shadow: var(--shadow-2); }
  body.nav-open .sidebar { translate: 0 0; }
  body.nav-open .nav-scrim { display: block; position: fixed; inset: var(--topbar-h) 0 0 0; background: var(--scrim); z-index: 45; }
  .main { margin-left: 0 !important; }
  body.nav-collapsed .nav-label, body.nav-collapsed .nav-caret, body.nav-collapsed .nav-sub, body.nav-collapsed .nav-group-title { display: revert; }
  body.nav-collapsed .nav-top.open + .nav-sub { display: block; }
  body.nav-collapsed .nav-top > button { justify-content: flex-start; padding: 0 16px; }
  .topbar-search { flex: 1 1 120px; }
  .search-panel { width: min(420px, calc(100vw - 32px)); }
  .version-chip .v-text { display: none; }
  .version-chip { padding: 0 6px; }
  .user-btn .user-name { display: none; }
  .filter-actions { margin-left: 0; width: 100%; }
  .filter-field { flex: 1 1 100%; }
  .filter-field .input, .filter-field .multiselect { flex: 1; }
  .multiselect-trigger { width: 100%; }
  .table-scroll { max-height: none; }
  .form-grid { grid-template-columns: 1fr; }
  .pager-total { margin-left: 0; width: 100%; }
}
@media (max-width: 560px) {
  .metric-grid { grid-template-columns: 1fr; }
  .brand-name { font-size: 18px; }
  .page { padding: 12px; }
}

/* ============ 交期视图（只读） ============ */
.dl-kv {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px 20px; margin: 0;
  padding: 14px 16px; border: 1px solid var(--border); border-radius: 8px;
  background: oklch(98.5% 0.005 250);
}
.dl-kv .kv-item { min-width: 0; }
.dl-kv dt { font-size: 12px; color: var(--muted); letter-spacing: 0.01em; margin-bottom: 4px; }
.dl-kv dd { margin: 0; font-size: 13px; color: var(--fg); overflow-wrap: break-word; }
.dl-kv .pm-info { color: var(--muted); }
.dl-sec-note { font-size: 12px; color: var(--muted); }
.dl-updated { margin-top: 10px; font-size: 12px; color: var(--muted); text-align: right; }
@media (max-width: 900px) {
  .dl-kv { grid-template-columns: 1fr 1fr; }
}

/* ============ 外采查询（只读） ============ */
.pu-summary {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 24px;
  padding: 10px 14px; border: 1px solid var(--border); border-top: none;
  border-radius: 0 0 8px 8px; background: var(--surface); font-size: 13px; color: var(--muted);
}
.pu-summary b { color: var(--fg); font-weight: 600; font-variant-numeric: tabular-nums; }
.pu-summary-note { margin-left: auto; font-size: 12px; }
.pu-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 14px 0 10px; }
.pu-toolbar .input { width: 250px; }
.pu-toolbar .select { width: auto; min-width: 140px; }
.pu-export { margin-left: auto; }
.pu-grid-wrap { max-height: 56vh; overflow: auto; }
table.pu-grid { min-width: 2380px; }
.pu-grid td { white-space: nowrap; }
.pu-grid thead th { position: sticky; z-index: 3; }
.pu-grid thead tr.pu-groups th {
  top: 0; height: 30px; box-sizing: border-box; padding: 5px 12px; text-align: center;
  font-size: 12px; letter-spacing: 0.02em; color: var(--muted); background: oklch(96.5% 0.01 250);
}
.pu-grid thead tr.pu-cols th { top: 30px; }
.pu-grid .pu-gsep { border-left: 1px solid var(--border); }
.pu-grid th.pu-pin, .pu-grid td.pu-pin {
  position: sticky; left: 0; z-index: 2; min-width: 176px;
  background: var(--surface); box-shadow: 1px 0 0 var(--border);
}
.pu-grid thead th.pu-pin { z-index: 4; background: oklch(97.5% 0.008 250); }
.pu-grid thead tr.pu-groups th.pu-pin { background: oklch(96.5% 0.01 250); }
.pu-grid thead tr.pu-groups th.pu-corner { z-index: 5; }
.pu-grid tbody tr:hover td.pu-pin { background: var(--accent-softer); }
.pu-grid td.pu-color { max-width: 200px; overflow: hidden; text-overflow: ellipsis; }
.pu-grid td.pu-color span { display: block; overflow: hidden; text-overflow: ellipsis; }
.pu-caret {
  display: inline-flex; align-items: center; justify-content: center; vertical-align: middle;
  width: 22px; height: 22px; margin-right: 6px; padding: 0; border: none; border-radius: 5px;
  background: none; color: var(--muted); cursor: pointer; transition: rotate 0.15s, background 0.15s;
}
.pu-caret.open { rotate: 180deg; }
.pu-caret:hover { color: var(--fg); background: var(--accent-soft); }
.pu-caret:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.pu-grid tbody tr.pu-detail td, .pu-grid tbody tr.pu-detail:hover td {
  background: oklch(98.5% 0.005 250); padding: 14px 16px; white-space: normal;
}
.pu-detail-inner { position: sticky; left: 0; width: min(920px, calc(100vw - 150px)); }
.pu-detail-groups { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pu-detail-groups .dl-kv { grid-template-columns: 1fr 1fr; gap: 10px 16px; padding: 12px 14px; background: var(--surface); }
.pu-dg-title { font-size: 12px; font-weight: 600; letter-spacing: 0.02em; color: var(--muted); margin-bottom: 6px; }
.pu-delay-ok { color: var(--success); }
.pu-delay-bad { color: var(--danger); font-weight: 600; }
.pu-partial { color: oklch(54% 0.15 50); font-weight: 600; }
@media (max-width: 900px) {
  .pu-toolbar .input { width: 100%; }
  .pu-export { margin-left: 0; }
  .pu-detail-groups { grid-template-columns: 1fr; }
  .pu-summary-note { margin-left: 0; width: 100%; }
}
/* ============ 总交期 · 订单交期查询弹窗 ============ */
.tdq-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px 24px; }
.tdq-field { display: flex; align-items: center; gap: 10px; min-width: 0; }
.tdq-field > label { font-size: 13px; font-weight: 550; white-space: nowrap; flex-shrink: 0; }
.tdq-field .select, .tdq-field .input { flex: 1; width: 100%; }
.tdq-field .multiselect { flex: 1; min-width: 0; }
.tdq-field .multiselect-trigger { width: 100%; min-width: 0; }
.tdq-field .multiselect-panel { width: 260px; }
.tdq-range { display: flex; align-items: center; gap: 6px; flex: 1; min-width: 0; color: var(--muted); }
.tdq-range .input { flex: 1; padding: 0 8px; font-size: 12.5px; }
.tdq-actions-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; margin-top: 14px; }
.tdq-radios { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; }
.tdq-radio { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; }
.tdq-radio input { width: 15px; height: 15px; accent-color: var(--accent); cursor: pointer; }
.tdq-btns { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.tdq-meta { display: flex; align-items: center; gap: 14px; margin-top: 14px; font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.tdq-meta strong { color: var(--fg); font-weight: 600; }
.tdq-meta .tdq-meta-over strong { color: var(--danger); }
.tdq-meta-note { margin-left: auto; font-size: 12px; }
.tdq-scroll { overflow: auto; max-height: 44vh; border: 1px solid var(--border); border-radius: 8px; margin-top: 10px; }
.tdq-grid-table { min-width: 1560px; }
.tdq-grid-table th, .tdq-grid-table td { white-space: nowrap; }
.tdq-grid-table .tdq-pin { position: sticky; left: 0; z-index: 2; background: var(--surface); box-shadow: 6px 0 8px -6px oklch(30% 0.05 260 / 0.12); }
.tdq-grid-table thead .tdq-pin { z-index: 6; background: oklch(97.5% 0.008 250); }
.tdq-grid-table tbody tr:hover .tdq-pin { background: var(--accent-softer); }
.tdq-grid-table .tdq-sep { border-left: 1px solid oklch(82% 0.02 250); }
.tdq-over { font-weight: 600; }
.tdq-not-over { color: var(--muted); }
.modal-wrap.tdq-full { padding: 0; }
.modal-wrap.tdq-full .modal { width: 100%; height: 100vh; max-height: 100vh; border-radius: 0; }
.modal-wrap.tdq-full .modal-body { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.modal-wrap.tdq-full .tdq-scroll { flex: 1; max-height: none; min-height: 120px; }
@media (max-width: 1180px) { .tdq-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .tdq-grid { grid-template-columns: 1fr; } .tdq-btns { margin-left: 0; } }
