/* 清河网点毛利分析 — 视觉基调：中性灰阶 + 单一强调色，红绿只表达盈亏。
   不用渐变、不用大圆角、不用阴影堆砌。参照系是财务软件的表格，不是 SaaS 落地页。

   布局是「左侧导航 + 顶栏全局上下文 + 内容区」。
   期间和口径放顶栏不放侧栏：它们是全局上下文，跟着页面走会让人迷路。 */

:root {
  --bg: #f4f5f6;
  --surface: #ffffff;
  --border: #dde1e5;
  --border-strong: #c7ccd1;
  --text: #1c2024;
  --text-mid: #4b535b;
  --text-muted: #747d86;
  --accent: #1f4e79;
  --accent-weak: #eef2f6;
  --loss: #a32316;
  --loss-bg: #fbf0ef;
  --warn: #8a5300;
  --warn-bg: #fcf6e8;
  --good: #1a6b35;
  --good-bg: #eff6f1;
  --great-bg: #e2eee8;
  /* 矩阵格子配色比提示条更饱和：要的是扫一眼就看出哪块在亏 */
  --cell-loss-bg: #f8d8d4;
  --cell-low-bg: #fbeccb;
  --cell-good-bg: #dcece1;
  --cell-great-bg: #c3e0ce;
  --row-hover: #f7f9fa;
  --sidebar-bg: #1b2735;
  --sidebar-text: #aab6c4;
  --sidebar-active: #2b3f57;
  --sidebar-w: 192px;
  --font-num: "SF Mono", "DIN Alternate", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 13px;
  line-height: 1.5;
}

.hidden { display: none !important; }
.muted { color: var(--text-muted); }
.mono { font-family: var(--font-num); font-variant-numeric: tabular-nums; }
.num-strong { font-family: var(--font-num); font-variant-numeric: tabular-nums; font-size: 12px; }
.num-strong.neg { color: var(--loss); }

/* ---------------------------------------------------------- 外壳 */

.shell { display: flex; min-height: 100vh; }
.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 14px 16px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, .07);
}
.logo {
  width: 26px; height: 26px; flex: 0 0 26px;
  display: flex; align-items: center; justify-content: center;
  background: #e8552f; color: #fff;
  font-size: 14px; font-weight: 600; border-radius: 3px;
}
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-name { font-size: 12.5px; font-weight: 600; color: #fff; letter-spacing: .02em; }
.brand-sub { font-size: 10.5px; color: #7b8a9c; margin-top: 1px; }

.sidebar-nav { padding: 8px 0; flex: 1; overflow-y: auto; }
.nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 16px;
  font-size: 12.5px;
  color: var(--sidebar-text);
  text-decoration: none;
  border-left: 2px solid transparent;
}
.nav-item:hover { background: rgba(255, 255, 255, .05); color: #e4eaf1; }
.nav-item.active {
  background: var(--sidebar-active);
  color: #fff;
  border-left-color: #e8552f;
  font-weight: 600;
}
.nav-sep { height: 1px; background: rgba(255, 255, 255, .07); margin: 8px 16px; }
.nav-badge {
  min-width: 17px; padding: 0 5px;
  font-size: 10px; line-height: 16px; text-align: center;
  background: #e8552f; color: #fff; border-radius: 9px;
  font-family: var(--font-num);
}

.sidebar-foot {
  padding: 11px 16px 13px;
  border-top: 1px solid rgba(255, 255, 255, .07);
  font-size: 11px;
}
.foot-period { color: #7b8a9c; margin-bottom: 5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.foot-logout { color: var(--sidebar-text); text-decoration: none; }
.foot-logout:hover { color: #fff; text-decoration: underline; }

/* ---------------------------------------------------------- 顶栏 */

.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 50px;
  padding: 0 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}
.page-title { margin: 0; font-size: 14px; font-weight: 600; letter-spacing: .02em; flex: 1; }
.topbar-right { display: flex; align-items: flex-end; gap: 14px; }

.ctx-field { display: flex; flex-direction: column; gap: 2px; }
.ctx-label { font-size: 10px; color: var(--text-muted); letter-spacing: .03em; }

.icon-btn {
  height: 28px; width: 30px; padding: 0;
  font-size: 15px; line-height: 1;
  background: none; border: 1px solid var(--border-strong); border-radius: 3px;
  cursor: pointer; color: var(--text-mid);
}
.only-mobile { display: none; }

.content { flex: 1; padding: 16px 20px 48px; max-width: 1560px; width: 100%; }

/* ---------------------------------------------------------- 控件 */

.control {
  height: 28px;
  padding: 0 8px;
  font-size: 12px;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 3px;
}
.control:focus { outline: 2px solid var(--accent-weak); outline-offset: 0; border-color: var(--accent); }
select.control { min-width: 170px; cursor: pointer; }
input[type="search"].control { width: 180px; }

.segmented { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 3px; overflow: hidden; }
.segmented button {
  height: 26px;
  padding: 0 10px;
  font-size: 12px;
  font-family: inherit;
  color: var(--text-mid);
  background: var(--surface);
  border: 0;
  border-right: 1px solid var(--border);
  cursor: pointer;
}
.segmented button:last-child { border-right: 0; }
.segmented button.active { background: var(--accent); color: #fff; }

.btn {
  height: 28px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 3px;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: #183d5f; color: #fff; }
.btn-ghost { color: var(--text-mid); }
.btn:disabled { opacity: .5; cursor: default; }
.btn-link {
  background: none; border: 0; padding: 0;
  font-size: 12px; font-family: inherit; color: var(--accent);
  cursor: pointer; text-decoration: none;
}
.btn-link + .btn-link { margin-left: 10px; }
.btn-link:hover { text-decoration: underline; }
.btn-link.danger { color: var(--loss); }

/* ---------------------------------------------------------- 区块 */

.block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 3px;
  margin-bottom: 14px;
}
.block:empty { display: none; }

.block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
}
.block-head h2 { margin: 0; font-size: 13px; font-weight: 600; }
.block-head .count { margin-left: 8px; font-weight: 400; color: var(--text-muted); }
.block-tools { display: flex; align-items: flex-end; gap: 10px; }

.hint { margin: 0; padding: 10px 16px; font-size: 12px; color: var(--text-muted); border-bottom: 1px solid var(--border); }
.hint strong { color: var(--text-mid); font-weight: 600; }

/* ---------------------------------------------------------- KPI */

.kpi-strip {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 3px;
  margin-bottom: 14px;
}
.kpi-strip:empty { display: none; }
.kpi { padding: 13px 16px; border-right: 1px solid var(--border); }
.kpi:last-child { border-right: 0; }
.kpi-label { font-size: 11px; color: var(--text-muted); letter-spacing: .03em; }
.kpi-value {
  margin-top: 5px;
  font-family: var(--font-num);
  font-size: 20px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.01em;
}
.kpi-sub { margin-top: 3px; font-size: 11px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.kpi-value.pos { color: var(--good); }
.kpi-value.neg { color: var(--loss); }

/* ---------------------------------------------------------- 提示条 */

.notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  margin-bottom: 14px;
  font-size: 12px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--warn);
  border-radius: 3px;
  background: var(--warn-bg);
  color: var(--warn);
}
.notice > div { width: 100%; }
.notice-title { font-weight: 600; }
.notice ul { margin: 4px 0 0; padding-left: 16px; }
.notice li { margin-top: 2px; }
.notice p { margin: 4px 0 0; }
.notice.warn { border-left-color: #b45309; }
.notice.todo { background: var(--accent-weak); border-left-color: var(--accent); color: var(--text-mid); }

/* ---------------------------------------------------------- 初次配置引导

   全新装好时总览就是客户看到的第一屏。原先只有一条灰条加几行小字，
   八成屏幕空着，客户说「像是工程级别没做 ui 处理」。

   这块要占住视觉重心，但**基调不许破**：中性灰阶 + 单一强调色，
   参照系是财务软件不是 SaaS 落地页——不用插画、渐变、大圆角、emoji。
   靠的是留白、字号层级和一条进度条，不是装饰。 */

.setup-guide {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 3px;
  margin-bottom: 20px;
}
.setup-head { padding: 22px 26px 18px; border-bottom: 1px solid var(--border); }
.setup-head h2 { margin: 0; font-size: 17px; font-weight: 600; color: var(--text); }
.setup-head p { margin: 7px 0 0; font-size: 12.5px; color: var(--text-mid); line-height: 1.6; }
.setup-head strong { color: var(--text); font-weight: 600; }

.setup-progress { display: flex; align-items: center; gap: 10px; margin-top: 15px; }
.setup-count {
  font-family: var(--font-num); font-variant-numeric: tabular-nums;
  font-size: 12px; color: var(--text-mid); white-space: nowrap;
}
.setup-bar { flex: 1; max-width: 260px; height: 3px; background: var(--border); position: relative; }
.setup-bar i { position: absolute; left: 0; top: 0; height: 100%; background: var(--accent); }
.setup-left { font-size: 11.5px; color: var(--text-muted); white-space: nowrap; }

.setup-steps { list-style: none; margin: 0; padding: 0; }
.setup-step {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 26px;
  border-bottom: 1px solid var(--border);
}
.setup-step:last-child { border-bottom: 0; }

/* 序号用方块不用圆：圆点 + 大圆角是 SaaS 落地页的语言，这里要财务软件的 */
.step-no {
  flex: 0 0 24px; width: 24px; height: 24px; margin-top: 1px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-num); font-size: 12px; font-weight: 600;
  color: var(--text-muted);
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: 2px;
}
.setup-step.current .step-no {
  color: #fff; background: var(--accent); border-color: var(--accent);
}
.setup-step.done .step-no {
  color: var(--good); background: var(--good-bg); border-color: #a9cdb6;
}

.step-body { flex: 1; min-width: 0; }
.step-title {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 13px; font-weight: 600; color: var(--text);
}
.setup-step.done .step-title { color: var(--text-muted); font-weight: 500; }
.step-now {
  padding: 1px 7px; border-radius: 10px; font-size: 11px; font-weight: 500;
  color: var(--accent); background: var(--accent-weak); border: 1px solid #c3d2e0;
}
.step-ok {
  padding: 1px 7px; border-radius: 10px; font-size: 11px; font-weight: 500;
  color: var(--good); background: var(--good-bg); border: 1px solid #a9cdb6;
}
.step-why { margin: 5px 0 0; font-size: 12px; color: var(--text-mid); line-height: 1.6; }
/* 「为什么非要它」压一级：它是看一眼就够的后果说明，不该和操作说明抢 */
.step-weight { margin: 3px 0 0; font-size: 11.5px; color: var(--text-muted); line-height: 1.6; }
.setup-step.done .step-why,
.setup-step.done .step-weight { display: none; }

.step-go { flex: 0 0 auto; margin-top: 1px; white-space: nowrap; }

@media (max-width: 900px) {
  .setup-step { flex-wrap: wrap; }
  .step-go { margin-left: 38px; }
}

.todo-list { list-style: none; margin: 6px 0 0; padding: 0; }
.todo-list li { display: flex; align-items: center; gap: 7px; margin-top: 3px; }
.todo-list li.done { color: var(--text-muted); }
.todo-mark { font-family: var(--font-num); color: var(--accent); }
.todo-list li.done .todo-mark { color: var(--good); }
.todo-list a { color: var(--accent); }

.ex-list { list-style: none; padding-left: 0 !important; }
.ex-list > li { margin-top: 6px; }
.ex-line .btn-link { margin-left: 8px; color: var(--warn); text-decoration: underline; }
.ex-panel {
  margin-top: 7px;
  padding: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text);
}
.ex-panel .skip-note { margin-top: 6px; }

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

.table-wrap { overflow-x: auto; }

.data-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.data-table.narrow { width: auto; min-width: 380px; }

.data-table th {
  padding: 8px 12px;
  text-align: left;
  font-weight: 600;
  font-size: 11px;
  color: var(--text-mid);
  letter-spacing: .02em;
  background: #fafbfc;
  border-bottom: 1px solid var(--border-strong);
  white-space: nowrap;
}
/* 合计行。客户要求放顶部——1,856 行滚起来时合计还看得见才有意义，
   所以它在 thead 里跟着表头一起 sticky。跟着筛选和搜索走。 */
/* 表头 sticky **必须用 `>` 写死**：关联店铺展开后里面嵌着一张同样是
   `.data-table` 的店铺清单，用后代选择器会让那张表的表头也浮到滚动容器顶上，
   跟着页面滚、盖住内容。同一个坑矩阵那边踩过一次（见 .matrix-table 那条注释）。 */
.data-table > thead > tr > th { position: sticky; top: 0; z-index: 2; }
.data-table.shop-table > thead > tr > th { position: static; }
.data-table > thead > tr.sum-row > th {
  top: 29px;                       /* 压在表头那一行下面，别盖住它 */
  z-index: 1;
  background: #eef1f4;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  font-family: var(--font-num);
  border-bottom: 2px solid var(--border-strong);
}
.data-table > thead > tr.sum-row > th.col-name { font-family: inherit; }
.data-table > thead > tr.sum-row > th.profit-neg { color: var(--loss); }
.data-table > thead > tr.sum-row > th.profit-pos { color: var(--good); }
.data-table > thead > tr.sum-row > th.muted { color: var(--text-muted); font-weight: 400; }

.data-table td {
  padding: 7px 12px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table .num { text-align: right; font-family: var(--font-num); font-variant-numeric: tabular-nums; }
.data-table th.num { text-align: right; }
.data-table .col-name { min-width: 220px; white-space: normal; }

.data-table th.sortable { cursor: pointer; user-select: none; }
.data-table th.sortable:hover { color: var(--accent); }
.data-table th.sortable::after { content: " ↕"; color: var(--border-strong); }
.data-table th.sortable.asc::after { content: " ↑"; color: var(--accent); }
.data-table th.sortable.desc::after { content: " ↓"; color: var(--accent); }

tr.customer-row { cursor: pointer; }
tr.customer-row:hover td { background: var(--row-hover); }
tr.customer-row.open td { background: var(--accent-weak); }
tr.customer-row > .col-name::before {
  content: "▸";
  display: inline-block;
  width: 12px;
  color: var(--text-muted);
  font-size: 10px;
}
tr.customer-row.open > .col-name::before { content: "▾"; color: var(--accent); }

td.profit-pos { color: var(--good); }
td.profit-neg { color: var(--loss); font-weight: 600; }

.table-foot {
  padding: 9px 16px;
  font-size: 11px;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
}

.empty-state { padding: 36px 16px; text-align: center; color: var(--text-muted); font-size: 12px; }
.empty-state.good { color: var(--good); }
/* 没数据时别只扔一句小灰字：一句说清现状、一句说清下一步、一个能点的。
   **到此为止**——每页再搞一个大板块就过了，引导只在总览做一次。 */
.empty-title { font-size: 13px; font-weight: 600; color: var(--text-mid); }
.empty-sub { margin-top: 5px; font-size: 12px; color: var(--text-muted); }
.empty-go { display: inline-block; margin-top: 13px; }

/* ---------------------------------------------------------- 展开面板 */

/* `> td` 不是可有可无：展开行里嵌着整张店铺清单表，写成后代选择器会把
   清单里每一个单元格的内边距也清成 0，字就全挤在一起——
   和矩阵那条左对齐链是同一个坑。 */
tr.matrix-row > td { padding: 0; background: #fbfcfd; }
.matrix-panel { padding: 12px 16px 14px; border-top: 1px solid var(--border); }

.panel-tabs {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.panel-customer { font-size: 12px; font-weight: 600; color: var(--text-mid); }

/* ---------------------------------------------------- 政策分摊明细

   客户表「政策分摊」那一列只有一个总数，看不出是哪几条 K1/P1 摊来的。
   真实数据里每个客户只有 1-2 条，所以摆在展开面板顶部、不收起、不做成 tab。 */

.alloc-panel {
  margin-bottom: 11px;
  padding: 9px 12px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 3px;
}
.alloc-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}
.alloc-title { font-size: 11px; font-weight: 600; color: var(--text-mid); }
.alloc-total {
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums;
  font-size: 14px;
}
.alloc-total.pos, .alloc-amount.pos { color: var(--good); }
.alloc-total.neg, .alloc-amount.neg { color: var(--loss); }

.alloc-list { margin: 7px 0 0; padding: 0; list-style: none; font-size: 11px; }
.alloc-list li {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 3px 0;
  border-top: 1px solid var(--border);
}
.alloc-name { flex: 1; min-width: 0; color: var(--text-mid); }
/* 票数和金额各自占一条右对齐的等宽列，几行之间数位要对得齐 */
.alloc-tickets {
  width: 86px; flex: 0 0 86px; text-align: right;
  font-family: var(--font-num); font-variant-numeric: tabular-nums;
  color: var(--text-muted);
}
.alloc-amount {
  width: 96px; flex: 0 0 96px; text-align: right;
  font-family: var(--font-num); font-variant-numeric: tabular-nums;
}

/* 老报告拆不出明细：橙的，说清是「重算就有」而不是「没有分摊」 */
.alloc-panel.legacy { background: var(--warn-bg); border-color: #e2c48a; }
.alloc-legacy-note { margin-top: 5px; font-size: 11px; color: var(--warn); }

.matrix-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 9px;
}
.matrix-head-right { display: flex; align-items: center; gap: 14px; }
.matrix-title { font-size: 12px; font-weight: 600; }
.matrix-legend { display: flex; gap: 12px; font-size: 11px; color: var(--text-muted); }
.matrix-legend span { display: inline-flex; align-items: center; gap: 4px; }
/* 图例要说清「按什么染色」，否则颜色和数字对不上号 */
.matrix-legend .legend-label { color: var(--text-mid); font-weight: 600; }
.swatch { width: 10px; height: 10px; border: 1px solid var(--border-strong); display: inline-block; }
.swatch.loss { background: var(--cell-loss-bg); }
.swatch.low { background: var(--cell-low-bg); }
.swatch.good { background: var(--cell-good-bg); }
.swatch.great { background: var(--cell-great-bg); }

.matrix-table { width: 100%; border-collapse: collapse; font-size: 11px; }
.matrix-table th, .matrix-table td {
  padding: 7px 10px;
  border: 1px solid var(--border);
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-family: var(--font-num);
  white-space: nowrap;
}
.matrix-table th {
  background: #f3f5f7;
  font-family: inherit;
  font-weight: 600;
  color: var(--text-mid);
  text-align: center;
}
.matrix-table th.row-head, .matrix-table td.row-head {
  text-align: left;
  font-family: inherit;
  background: #f3f5f7;
  font-weight: 500;
}
/* 文字列（运单号、省份、流向…）左对齐。**这条链不能伤到省份矩阵**：
   矩阵里行尾的票数/毛利没有 .num 也没有 cell-* 类，会被它顺手左对齐，
   两列数字一左一右贴到一起就成了「104.490.117」。矩阵整张表都是数字，
   走基础规则的右对齐就对了，所以这里把 .matrix-grid 排除掉。

   **必须用 `>` 一级一级写死，不能用后代选择器**：关联店铺那边是
   「店铺清单表（.matrix-table）里嵌着一张矩阵表（.matrix-table.matrix-grid）」，
   写成后代选择器时外层这张表会把里层矩阵的 td 一起命中——
   `:not(.matrix-grid)` 挡的是外层表自己，挡不住它往里层伸手。 */
.matrix-table:not(.matrix-grid) > tbody > tr > td:not(.num):not([class*="cell-"]):not(.row-head) {
  text-align: left;
}
.matrix-table tr.total-row td { background: #eef1f4; font-weight: 600; }
.matrix-table td.total-col { background: #f7f8fa; font-weight: 600; }
.matrix-table td.empty { color: #9aa1a8; background: #fcfcfd; }
.matrix-table td.profit-neg { color: var(--loss); font-weight: 600; }
.matrix-table td.profit-pos { color: var(--good); }

/* 配色类放在 total-row / total-col 之后，盈亏着色要能盖过灰底 */
.matrix-table td.cell-loss { background: var(--cell-loss-bg); color: var(--loss); }
.matrix-table td.cell-low { background: var(--cell-low-bg); color: var(--warn); }
.matrix-table td.cell-good { background: var(--cell-good-bg); color: var(--good); }
.matrix-table td.cell-great { background: var(--cell-great-bg); color: var(--good); }

/* 关联店铺第二层：清单里的店铺名可点，点开出这家店的矩阵。
   客户要的就是「再点击店铺名字能看到省份和公斤段」，所以它必须看着能点。 */
/* 店铺清单现在和主客户表同一套 .data-table（客户要求字号样式一致），
   行样式跟着挂到 tr.shop-row 上，不再依赖 .matrix-table */
tr.shop-row { cursor: pointer; }
tr.shop-row:hover > td { background: var(--row-hover); }
tr.shop-row.open > td { background: var(--accent-weak); }
td.shop-name::before {
  content: "▸";
  display: inline-block;
  width: 12px;
  color: var(--text-muted);
  font-size: 10px;
}
tr.shop-row.open > td.shop-name::before { content: "▾"; color: var(--accent); }
tr.shop-matrix-row > td { padding: 0; background: #fbfcfd; }
.shop-matrix { padding: 10px 12px 12px; }

.cell-stack { display: block; line-height: 1.35; }
.cell-stack b { font-weight: 600; }
/* 两行字要有呼吸：原来 10px 的小字直接贴在大字下面，一格里读着像一串乱码 */
.cell-stack em {
  display: block;
  margin-top: 3px;
  font-style: normal;
  font-size: 10px;
  color: inherit;
  opacity: .72;
}

/* ------------------------------------------- 省份 × 重量段矩阵

   省份列横向滚动时要钉住，否则滑到右边就不知道这行是哪个省了。
   border-collapse 下 sticky 单元格的边框会跟着滚走，所以右边框用 inset 阴影补。 */

.matrix-grid th.row-head, .matrix-grid td.row-head {
  position: sticky;
  left: 0;
  z-index: 2;
  min-width: 86px;
  box-shadow: inset -1px 0 0 var(--border-strong);
}
.matrix-grid thead th.row-head { z-index: 3; }

/* 行尾三列是整行的汇总，和中间的格子之间留一道粗一点的界。
   分界线靠 JS 打的 .col-divider——`:first-of-type` 认的是「第一个 td」，
   而第一个 td 是省份名那格，选不到汇总列。 */
.matrix-grid th.total-col, .matrix-grid td.total-col { min-width: 76px; }
.matrix-grid .col-divider { border-left: 2px solid var(--border-strong); }

/* 表头跟着数据右对齐，居中的标题配右对齐的数字看着总差一口气 */
.matrix-grid th.total-col { text-align: right; }
.matrix-grid td.empty { text-align: center; }

/* 合计行的格子也要染色：那一格答的是「这个重量段整体赚不赚钱」，
   恰恰是最该一眼看出来的。`tr.total-row td` 的特异性压过 `td.cell-*`，所以这里单独提一级。
   合计行靠上面那道粗线和加粗字区分，不靠底色。 */
.matrix-grid tr.total-row td { border-top: 2px solid var(--border-strong); }
.matrix-grid tr.total-row td.cell-loss { background: var(--cell-loss-bg); }
.matrix-grid tr.total-row td.cell-low { background: var(--cell-low-bg); }
.matrix-grid tr.total-row td.cell-good { background: var(--cell-good-bg); }
.matrix-grid tr.total-row td.cell-great { background: var(--cell-great-bg); }

.matrix-grid th.sortable { cursor: pointer; user-select: none; }
.matrix-grid th.sortable:hover { color: var(--accent); }
.matrix-grid th.sortable::after { content: " ↕"; color: var(--border-strong); }
.matrix-grid th.sortable.asc::after { content: " ↑"; color: var(--accent); }
.matrix-grid th.sortable.desc::after { content: " ↓"; color: var(--accent); }

/* ---------------------------------------------------------- 阈值台阶 */

.threshold-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.threshold-item { padding: 12px 16px; border-right: 1px solid var(--border); }
.threshold-item:last-child { border-right: 0; }
.threshold-name { font-size: 12px; font-weight: 600; }
.threshold-tag {
  margin-left: 6px; padding: 1px 5px; font-size: 10px; font-weight: 400;
  border: 1px solid var(--border-strong); border-radius: 2px; color: var(--text-muted);
}
.threshold-tag.on { border-color: var(--good); color: var(--good); background: var(--good-bg); }
.threshold-amount {
  margin-top: 6px;
  font-family: var(--font-num);
  font-size: 17px;
  font-variant-numeric: tabular-nums;
}
.threshold-amount.pos { color: var(--good); }
.threshold-amount.neg { color: var(--loss); }
/* 「我的日均 vs 极兔门槛」做成并排对比，差额单独一格。
   这三个数原先挤在一行小字里，看不出谁跟谁比。 */
.threshold-compare {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  margin-top: 9px;
  padding-bottom: 7px;
}
.tc-col { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.tc-label { font-size: 10px; color: var(--text-muted); white-space: nowrap; }
.tc-value {
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums;
  font-size: 14px;
  line-height: 1.15;
  color: var(--text);
}
.tc-value.dim { color: var(--text-muted); }
.tc-blank { font-style: normal; font-size: 12px; color: var(--warn); }
.tc-vs { font-size: 10px; color: #9aa1a8; padding-bottom: 2px; }
.tc-gap {
  margin-left: auto;
  padding: 1px 6px;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: var(--text-mid);
  background: #eef1f4;
  border-radius: 2px;
  white-space: nowrap;
}
.tc-gap.over { color: var(--good); background: var(--good-bg); }
.tc-gap.warn { color: var(--warn); background: var(--warn-bg); }

/* 结算算式：弱一级。对照参考：再弱一级，压到几乎是背景 */
.threshold-note {
  margin-top: 6px;
  font-size: 11px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.threshold-ref {
  margin-top: 3px;
  font-size: 10px;
  color: #9aa1a8;
  font-variant-numeric: tabular-nums;
}
.cell-input::placeholder { color: #a7aeb5; font-family: inherit; font-size: 11px; }
.threshold-bar { margin-top: 7px; height: 3px; background: var(--border); position: relative; }
.threshold-bar i { position: absolute; left: 0; top: 0; height: 100%; background: var(--accent); }
.threshold-bar i.over { background: var(--good); }

/* ---------------------------------------------------------- 分区边界与状态

   政策与规则一页上有四类完全不同的东西，光靠白卡片之间 14px 的间距分不开。
   加左侧状态色条 + 外扩阴影，让「这是一块」和「传没传」一眼可见。 */

#page-rules > .block,
#block-analyze {
  margin-bottom: 20px;
  border-left-width: 3px;
  border-left-style: solid;
  border-left-color: var(--border-strong);
}
/* 费率条也走同一套红绿：它是 .version-bar 不是 .block，上面那条选不到它 */
#page-rules > .block.status-ok,
.version-bar.status-ok,
#block-analyze.status-ok {
  border-left-color: var(--good);
  box-shadow: 0 0 0 1px rgba(26, 107, 53, .12), 0 1px 6px rgba(26, 107, 53, .10);
}
#page-rules > .block.status-missing,
.version-bar.status-missing,
#block-analyze.status-missing {
  border-left-color: var(--loss);
  box-shadow: 0 0 0 1px rgba(163, 35, 22, .14), 0 1px 6px rgba(163, 35, 22, .10);
}

.status-chip {
  display: inline-block;
  margin-left: 9px;
  padding: 1px 8px;
  font-size: 11px;
  font-weight: 500;
  border-radius: 10px;
  vertical-align: 1px;
}
.status-chip.ok { background: var(--good-bg); color: var(--good); border: 1px solid #a9cdb6; }
.status-chip.missing { background: var(--loss-bg); color: var(--loss); border: 1px solid #e0a8a1; }
.status-chip::before { content: "● "; font-size: 9px; }

/* ---------------------------------------------------------- 费率版本条 */

.version-bar {
  background: #eef1f4;
  border: 1px solid var(--border-strong);
  border-left-width: 3px;
  border-left-style: solid;
  border-left-color: var(--border-strong);
  border-radius: 3px;
  margin-bottom: 20px;
}
.version-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
}
.version-inner.creating { background: var(--accent-weak); }
.version-label {
  font-size: 12px; font-weight: 600; color: var(--text-mid);
  padding-right: 4px; border-right: 1px solid var(--border-strong);
  margin-right: 2px;
}
.version-inner label {
  display: flex; align-items: center; gap: 5px;
  font-size: 11px; color: var(--text-muted);
}
.version-inner .grow { flex: 1; min-width: 160px; }
.version-inner label.grow .control { flex: 1; }
.control.wide { min-width: 280px; }
.version-note {
  padding: 0 14px 9px;
  font-size: 11px;
  color: var(--text-muted);
}

/* ---------------------------------------------------------- 操作费三档 */

.fee-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}
.fee-cell { padding: 14px 16px 15px; border-right: 1px solid var(--border); }
.fee-cell:last-child { border-right: 0; }
.fee-span { font-size: 11px; color: var(--text-muted); letter-spacing: .03em; }
.fee-input { display: flex; align-items: baseline; gap: 6px; margin-top: 6px; }
.big-input {
  width: 96px;
  height: 36px;
  padding: 0 9px;
  font-family: var(--font-num);
  font-size: 19px;
  font-variant-numeric: tabular-nums;
  text-align: right;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 3px;
}
.big-input:hover { border-color: var(--accent); }
.big-input:focus { border-color: var(--accent); outline: 2px solid var(--accent-weak); }
.fee-input .unit { font-size: 11px; color: var(--text-muted); }
.fee-bound {
  display: flex; align-items: center; gap: 5px;
  margin-top: 8px; font-size: 11px; color: var(--text-muted);
}
.fee-bound .cell-input { width: 62px; height: 22px; }

/* ---------------------------------------------------------- 政策返利子块 */

.sub-block { border-bottom: 1px solid var(--border); }
.sub-block:last-child { border-bottom: 0; }
.sub-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 11px 16px 8px;
}
.sub-head h3 { margin: 0; font-size: 12px; font-weight: 600; }
.sub-desc { font-size: 11px; color: var(--text-muted); flex: 1; }
/* 全量返利和 K1/P1 升成一级分区后，标题和说明由 block-head / hint 负责，
   这里只剩「+ 加一档」一个按钮，贴右上角别占一整行 */
.sub-head.bare { justify-content: flex-end; padding: 2px 16px 0; }
.sub-block .data-table { border-top: 1px solid var(--border); }

.save-state { font-size: 11px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.save-state.saved { color: var(--good); }
.save-state.dirty { color: var(--loss); }

/* 输入框平时也看得出能点：悬停描边变色，不用先进编辑态 */
.cell-input:hover { border-color: var(--border-strong); }

.todo-items { display: inline-flex; flex-wrap: wrap; gap: 12px; margin-left: 8px; font-size: 11.5px; }
.todo-items .done { color: var(--good); }

/* ---------------------------------------------------------- 对比 */

.compare-head {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 16px; border-bottom: 1px solid var(--border);
  font-size: 12px;
}
.compare-head .arrow { color: var(--text-muted); }
.pill {
  padding: 2px 9px; font-size: 12px; font-weight: 600;
  background: var(--accent-weak); color: var(--accent); border-radius: 10px;
}
.compare-head + .kpi-strip { border-radius: 0; border-left: 0; border-right: 0; margin-bottom: 0; }

.chip {
  display: inline-block; padding: 1px 7px;
  font-size: 10.5px; border-radius: 9px;
  border: 1px solid var(--border-strong); color: var(--text-muted);
  white-space: nowrap;
}
.chip + .btn-link { margin-left: 8px; }
.chip-down { border-color: #e0a8a1; background: var(--loss-bg); color: var(--loss); }
.chip-up { border-color: #a9cdb6; background: var(--good-bg); color: var(--good); }
.chip-new { border-color: #a8bcd4; background: var(--accent-weak); color: var(--accent); }
.chip-lost { border-color: var(--border-strong); background: #f1f2f3; color: var(--text-mid); }
.chip-warn { border-color: #e7d5a8; background: var(--warn-bg); color: var(--warn); margin-left: 6px; }

/* ---------------------------------------------------------- 留痕 */

.change-list { list-style: none; margin: 0; padding: 0; font-size: 11.5px; }
.change-list li { margin-bottom: 2px; }
.change-list .before { color: var(--text-muted); text-decoration: line-through; }
.change-list .after { color: var(--good); font-weight: 600; }
.change-list .arrow { color: var(--text-muted); margin: 0 3px; }
.data-table td:has(.change-list) { white-space: normal; max-width: 620px; }

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

.inline-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}
.inline-form label { display: flex; flex-direction: column; gap: 4px; font-size: 11px; color: var(--text-muted); }
.inline-form input[type="file"] { font-size: 11px; }
.file-label { max-width: 280px; }

.cell-input {
  width: 92px;
  height: 24px;
  padding: 0 6px;
  font-family: var(--font-num);
  font-size: 12px;
  text-align: right;
  border: 1px solid var(--border);
  border-radius: 2px;
  background: var(--surface);
}
.cell-input.wide { width: 170px; text-align: left; font-family: inherit; }
select.cell-input { width: 130px; text-align: left; font-family: inherit; }
.cell-input:focus { border-color: var(--accent); outline: none; }
.cell-input[readonly] { background: #f4f5f6; color: var(--text-muted); }

/* 核算进度条。15 万票约 4 秒、100 万票要几分钟，光写一句「正在算」看不出
   到底还要等多久，也分不清是卡住了还是在跑。宽度由后端报的真实进度驱动；
   打开大文件那一步数不出行数，这时走滚动条纹，不假装在前进。 */

.progress-box { padding: 12px 16px 2px; border-top: 1px solid var(--border); }
.progress-track {
  height: 6px;
  border-radius: 3px;
  background: #e6e9ec;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width .25s linear;
}
/* 2026-11-29 删掉了「说不准还要多久」的滚动条纹。客户原话「骗人的进度条」——
   真机实测那个状态占单日核算三成时间（9.4 秒 / 共 31 秒），条子在那儿空转。
   现在每一步都有真数字（打开阶段用文件读取偏移量，见 spool.OpenProgressWatcher），
   **不要再加回任何不确定态的动画**。 */
.progress-row { display: flex; align-items: center; gap: 10px; }
.progress-row .progress-track { flex: 1; }
.progress-num {
  min-width: 42px;
  text-align: right;
  font: 600 13px/1 var(--font-num);
  font-variant-numeric: tabular-nums;
  color: var(--text-mid);
}
.progress-text { padding: 6px 0 4px; font-size: 12px; color: var(--text-mid); }

.state-line { padding: 10px 16px; font-size: 12px; border-top: 1px solid var(--border); }
.state-line.error { color: var(--loss); }
.state-line.busy { color: var(--text-mid); }
.state-line.done { color: var(--good); }
/* 「有人正在算另一份账单」这类等一等就好的情况：橙的，不是红的 */
.state-line.warn { color: var(--warn); font-weight: 600; }
/* 算完那一行底下的补充说明（合了哪几张表），弱一级 */
.state-sub { margin-top: 4px; font-size: 11px; color: var(--text-muted); font-weight: 400; }

.skip-note { color: var(--text-muted); font-size: 11px; }
.skip-note strong { color: var(--text-mid); }

.tag-sifei {
  display: inline-block;
  margin-left: 6px;
  padding: 0 4px;
  font-size: 10px;
  font-family: var(--font-num);
  color: var(--warn);
  background: var(--warn-bg);
  border: 1px solid #e7d5a8;
  border-radius: 2px;
  vertical-align: 1px;
}

/* ---------------------------------------------------------- toast */

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%) translateY(8px);
  padding: 9px 16px;
  font-size: 12px;
  color: #fff;
  background: #2b3137;
  border-radius: 3px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s, transform .15s;
  z-index: 50;
  max-width: 70vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { background: var(--loss); }

.drawer-backdrop {
  position: fixed; inset: 0; background: rgba(12, 18, 26, .45);
  z-index: 29; display: none;
}
.drawer-backdrop.show { display: block; }

/* ---------------------------------------------------------- 自适配 */

@media (max-width: 1240px) {
  .kpi-strip { grid-template-columns: repeat(3, 1fr); }
  .kpi:nth-child(3n) { border-right: 0; }
  .kpi:nth-child(-n+3) { border-bottom: 1px solid var(--border); }
}

@media (max-width: 860px) {
  .only-mobile { display: inline-flex; align-items: center; justify-content: center; }
  .sidebar {
    position: fixed; left: 0; top: 0; z-index: 30;
    transform: translateX(-100%);
    transition: transform .18s ease;
  }
  .sidebar.open { transform: translateX(0); }
  .topbar { flex-wrap: wrap; padding: 9px 14px; gap: 10px; }
  .page-title { flex: 0 0 auto; }
  .topbar-right { flex-wrap: wrap; width: 100%; }
  .content { padding: 12px; }
  .kpi-strip { grid-template-columns: repeat(2, 1fr); }
  .kpi:nth-child(2n) { border-right: 0; }
  .kpi { border-bottom: 1px solid var(--border); }
  select.control { min-width: 140px; }
  input[type="search"].control { width: 140px; }
  .block-head { flex-wrap: wrap; }
}

/* ---------------------------------------------------------- 打印 / 存档 */

@media print {
  .sidebar, .topbar, .toast, .drawer-backdrop,
  .block-tools, .btn, .btn-link, .inline-form { display: none !important; }
  body { background: #fff; font-size: 11px; }
  .content { padding: 0; max-width: none; }
  .block, .kpi-strip { border-color: #999; break-inside: avoid; }
  .page.hidden { display: none !important; }
  .table-wrap { overflow: visible; }
}

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

.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  margin: 0;
}
.login-card {
  width: 320px;
  padding: 26px 24px 22px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 3px;
}
.login-brand { display: flex; align-items: baseline; gap: 8px; margin-bottom: 20px; }
.login-field { display: block; font-size: 11px; color: var(--text-muted); }
.login-field .control { width: 100%; height: 32px; margin-top: 5px; font-size: 13px; }
.login-remember {
  display: flex; align-items: center; gap: 6px;
  margin-top: 12px; font-size: 12px; color: var(--text-mid);
}
.login-submit { width: 100%; height: 32px; margin-top: 16px; justify-content: center; }
.login-error {
  margin-bottom: 14px; padding: 8px 10px;
  font-size: 12px; color: var(--loss);
  background: var(--loss-bg); border-left: 3px solid var(--loss); border-radius: 2px;
}

/* 一口价表里「没用上的行」展开后的清单。原先平铺成一长串把表格行撑高了。 */
.skip-list { margin: 0; padding-left: 16px; font-size: 11.5px; color: var(--text-mid); }
.skip-list li { margin-bottom: 2px; }
.skip-list b { color: var(--text); font-weight: 600; }

/* 核算记录里「这份账单合了哪几张表」：收在一行里点开，不另起一行撑高表格 */
.data-table td.cell-wrap { white-space: normal; }
.sheet-list {
  margin: 5px 0 0;
  padding: 0;
  list-style: none;
  font-size: 11px;
  color: var(--text-mid);
}
.sheet-list li { display: flex; align-items: baseline; gap: 6px; margin-top: 2px; }
.sheet-list li.skipped { color: var(--text-muted); }
.sheet-rows { font-family: var(--font-num); font-variant-numeric: tabular-nums; color: var(--text-muted); }
.sheet-list em { font-style: normal; color: var(--text-muted); }

/* 操作费：重量范围两头直接改，不另设「上限」输入框 */
.fee-range { display: flex; align-items: center; gap: 5px; font-size: 11px; color: var(--text-muted); }
.fee-range .dash { color: var(--border-strong); }
.fee-fixed {
  display: inline-block; min-width: 34px; height: 24px; line-height: 24px;
  text-align: center; font-family: var(--font-num); color: var(--text-mid);
}
.mid-input {
  width: 54px; height: 24px; padding: 0 5px;
  font-family: var(--font-num); font-size: 12px; font-variant-numeric: tabular-nums;
  text-align: right; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-radius: 2px;
}
.mid-input:hover { border-color: var(--border-strong); }
.mid-input:focus { border-color: var(--accent); outline: none; }

/* 表头里的小字注解，用来分清「门槛票量」和「本期票量」 */
.th-sub { font-weight: 400; color: var(--text-muted); font-size: 10px; }
.sub-desc b { color: var(--text-mid); font-weight: 600; }

/* ---------------------------------------------------------- 政策卡片

   原先 K1/P1 是 8 列的表格，窄屏要左右滑，录入时眼睛要来回找列。
   改成一policy一张卡，字段竖排，永远不横滑。 */

/* `min(330px, 100%)` 不是花活：写死 minmax(330px,1fr) 时，窄到 360px 的屏上
   一列就要 330 + 两边 16px 内边距 = 362，比容器还宽，**整个区块横向滚动、
   整页跟着横滑**（实测 360px 宽时 K1/P1 和这一页的加收块各溢出 14px）。
   这一页任何区块都不许出现横向滚动。宽屏上这么写和原来一个像素都不差。 */
.policy-grid, .band-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(330px, 100%), 1fr));
  gap: 12px;
  padding: 4px 16px 14px;
}
.band-grid { grid-template-columns: repeat(auto-fill, minmax(min(210px, 100%), 1fr)); }

.policy-card, .band-cell {
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 11px 13px 12px;
  background: #fcfdfe;
}
.policy-top { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; }
.policy-name {
  flex: 1; min-width: 0; height: 26px; padding: 0 7px;
  font-size: 12px; font-weight: 600; font-family: inherit; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-radius: 2px;
}
.policy-kind {
  height: 26px; padding: 0 4px; font-size: 11px; font-family: inherit;
  color: var(--text-mid); background: var(--surface);
  border: 1px solid var(--border); border-radius: 2px;
}
.policy-name:focus, .policy-kind:focus { border-color: var(--accent); outline: none; }

/* 「我的日均」还没填的那条：卡片本身就标出来，不然 3 张卡长得一样，
   胶囊说「有 2 条没填」人还得挨个找是哪两条 */
.policy-card.needs-input { border-color: #e2c48a; background: #fffdf7; }

.policy-row { display: flex; align-items: center; gap: 6px; margin-top: 7px; }
.policy-key {
  width: 68px; flex: 0 0 68px;
  font-size: 11px; color: var(--text-muted);
}
.policy-row .unit { font-size: 11px; color: var(--text-muted); }
.policy-row .unit em {
  display: block; font-style: normal; font-size: 10px; color: #9aa1a8;
}
.mid-input.w-wide { width: 86px; }

.policy-formula {
  padding: 0 16px 13px;
  font-size: 11.5px;
  color: var(--text-muted);
}
.policy-formula b { color: var(--text-mid); font-weight: 600; }

/* 全量返利：一档一行的紧凑列表。8 档以后卡片式会铺成两行、每张两行输入框，
   客户 2026-11-26 说「太臃肿」。竖着一列扫下来最省眼睛。 */
.band-list { padding: 4px 16px 12px; max-width: 430px; }
.band-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 0;
  border-bottom: 1px solid var(--border);
}
.band-row:last-child { border-bottom: 0; }
.band-row.band-head {
  padding-bottom: 5px;
  font-size: 11px;
  color: var(--text-muted);
  border-bottom-color: var(--border-strong);
}
.band-row.band-foot { padding-top: 7px; border-bottom: 0; }
.band-range { display: flex; align-items: center; gap: 5px; width: 190px; flex: 0 0 190px; }
.band-range .dash { color: var(--border-strong); }
.band-amount { display: flex; align-items: center; gap: 5px; width: 130px; flex: 0 0 130px; }
.band-amount .unit { font-size: 11px; color: var(--text-muted); }
/* **必须写在上面那两条 `flex: 0 0 …` 之后**：flex 简写会把 flex-shrink 重置成 0，
   写在前面等于没写。这两个死宽度在 390px 以下的屏上会把分区顶破
   （实测溢出 36px，整页跟着横滑）。留个 shrink 的口子，宽屏上一个像素不变。 */
.band-range, .band-amount, .band-list .mid-input { min-width: 0; flex-shrink: 1; }
.band-act { margin-left: auto; }
/* 返了钱的那几档描一下，8 档里哪几档真有钱一眼看出来 */
.band-row.has-money .band-amount .mid-input {
  border-color: var(--good); color: var(--good); font-weight: 600;
}

/* ------------------------------------------- 12 月三类加收（2026-11-30）

   复用现成的 .policy-card / .fee-grid / .band-list，不另造一套样式。
   唯一要补的是两件事：

   1. 省份、城市那种「一格里填好几个」的输入框要**能跟着卡片缩**。
      给死宽度的话窄屏上会把卡片顶破，整页跟着横向滚动——
      这一页任何区块都不许出现横向滚动。
   2. 比例加收的卡片里套着一张重量档清单（.band-list.inner）。
      默认那套 .band-range / .band-amount 是给 430px 宽的独立区块定的死宽度，
      塞进 330px 的卡片里同样会顶破，所以在卡片里改成按比例分。 */

.cell-input.grow { flex: 1 1 auto; width: auto; min-width: 0; text-align: left; font-family: inherit; }
.policy-row .mid-input { min-width: 0; }

.band-list.inner { padding: 9px 0 0; max-width: none; }
.band-list.inner .band-row { gap: 6px; }
.band-list.inner .band-range { width: auto; flex: 1 1 auto; min-width: 0; }
.band-list.inner .band-amount { width: auto; flex: 0 1 auto; min-width: 0; }
.band-list.inner .mid-input { min-width: 0; }
.band-list.inner .band-row.band-head { font-size: 10.5px; }

/* 出港派费被关掉时那句提示：它不是 .block 的直系 state-line，自己补上下边界 */
#dispatch-editor .state-line { border-bottom: 1px solid var(--border); }

/* 版本条瘦成一行 */
.version-inner { font-size: 12px; color: var(--text-mid); }
.version-inner .version-label { font-weight: 600; }

/* 日均没填的政策：不结算，但要显眼地说出来，不能静悄悄漏掉 */
.threshold-item.missing { background: var(--warn-bg); }
.threshold-item.missing .threshold-amount { color: var(--text-muted); }
.threshold-note.warn-text { color: var(--warn); font-weight: 600; }

/* ---------------------------------------------------------- 选完就传

   原先是「选择文件 → 再点上传」两步，还把结果摊成六列表格。
   现在选完即传，结果收成一行，生效日期点着就能改。 */

.drop-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 11px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}
.file-pick { position: relative; overflow: hidden; display: inline-flex; }
.file-pick input[type="file"] {
  position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%;
}
.file-pick-btn {
  display: inline-flex; align-items: center;
  height: 28px; padding: 0 14px;
  font-size: 12px; color: #fff;
  background: var(--accent); border-radius: 3px;
  pointer-events: none;
}
.file-pick:hover .file-pick-btn { background: #183d5f; }
.file-pick-note { font-size: 11px; color: var(--text-muted); }

.state-inline { font-size: 11.5px; margin-left: auto; }
.state-inline.busy { color: var(--text-mid); }
.state-inline.done { color: var(--good); }
.state-inline.error { color: var(--loss); }

.file-row { border-bottom: 1px solid var(--border); }
.file-row:last-child { border-bottom: 0; }
.file-main {
  display: flex; flex-wrap: wrap; align-items: center; gap: 9px;
  padding: 10px 16px;
  font-size: 12px;
}
.date-input {
  height: 26px; padding: 0 6px;
  font-family: var(--font-num); font-size: 12px;
  color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 2px;
}
.date-input:hover { border-color: var(--accent); }
.date-input:focus { border-color: var(--accent); outline: none; }
.file-sep { color: var(--text-muted); }
.file-fact { color: var(--text-mid); }
.file-fact b { font-family: var(--font-num); }
.file-name { color: var(--text-muted); font-size: 11px; margin-left: auto; }
.file-row .skip-list { padding: 0 16px 11px 34px; }

/* ---------------------------------------------------------- 四费表状态

   「这张表里有 31 个省」是误导：四费表只在一口价表查不到该省时才用，
   真正生效的是两者差集。所以第一行必须直接说「这次算账哪几个省走四费」。 */

.state-line.sifei-box { padding: 0; }
.sifei-verdict {
  padding: 10px 16px;
  font-size: 12px;
  border-left: 3px solid transparent;
}
.sifei-verdict.ok { background: var(--good-bg); color: var(--good); border-left-color: var(--good); }
.sifei-verdict.warn { background: var(--warn-bg); color: var(--warn); border-left-color: var(--warn); }
.sifei-verdict b { font-weight: 600; }
.sifei-verdict em { font-style: normal; opacity: .75; }
.sifei-detail {
  display: flex; flex-wrap: wrap; align-items: center; gap: 7px;
  padding: 9px 16px;
  font-size: 11px; color: var(--text-muted);
  border-top: 1px solid var(--border);
}
.sifei-detail b { color: var(--text-mid); font-weight: 600; }
.sifei-detail select.control { height: 24px; min-width: 150px; font-size: 11px; }
.sifei-detail #del-sifei { margin-left: auto; }
.version-hint { font-size: 11px; color: var(--text-muted); }
/* 生效日期必填：没填时这句是警告不是说明，日期框自己也要看得出缺东西 */
.version-hint.warn { color: var(--warn); font-weight: 600; }
.control.missing { border-color: var(--loss); background: var(--loss-bg); }

/* 总览「7个偏远加收」：按公斤段一行，超了的那段正常色，没超的压淡 */
.remote-head { border-top: 1px solid var(--border); }
.remote-bands { padding: 4px 16px 12px; }
.remote-band {
  display: grid; grid-template-columns: 120px 1fr auto; gap: 12px;
  padding: 6px 0; border-bottom: 1px solid var(--border);
  font-size: 13px; color: var(--text-muted);
}
.remote-band:last-child { border-bottom: 0; }
.remote-band.on { color: var(--text); }
.remote-band .rb-amount { font-family: var(--font-num); font-variant-numeric: tabular-nums; text-align: right; }
.remote-band.on .rb-amount { color: var(--loss); font-weight: 600; }

/* 12 月加了四项加收之后客户毛利表到了 16 列，1440 宽的屏上最右边「票均毛利」被挤出去
   （2026-11-30 截图实测）。数字列收窄左右内边距、表头允许折行（「出港派费加收」
   折成两行），店铺名列让出一点，**不靠横向滚动**解决。 */
.data-table th.num, .data-table td.num { padding-left: 6px; padding-right: 6px; }
.data-table th.num { white-space: normal; line-height: 1.3; }
.data-table .col-name { min-width: 180px; }

/* 期间对比的两个期间下拉 + 按钮在手机宽度挤成一行，溢出 90px（2026-11-30 实测），让它折行 */
#page-compare .block-tools { flex-wrap: wrap; min-width: 0; }
#page-compare .block-tools .control { max-width: 100%; }

/* 12 月四项加收：一行一项、只有金额框（2026-11-30 下午按客户反馈重做，照达量返利） */
.band-list.fixed-list { max-width: 520px; }
.fixed-label { flex: 1 1 auto; min-width: 0; font-size: 13px; color: var(--text); }
.band-head .fixed-label { font-size: 11px; color: var(--text-muted); }
