/* ============================================================
   行政费用分析 · 设计系统
   ------------------------------------------------------------
   与切店系统同一取向：Apple。纯色底 + 大圆角白卡 + 毛玻璃导航，
   丝绸流光落在页面顶端右侧。颜色用 iOS 系统色。
   图表色经 dataviz 六检验证（明暗各一组，见 --ch-*）。
   ============================================================ */

:root {
  --bg:        #f5f5f7;
  --panel:     #ffffff;
  --panel-2:   #f5f5f7;
  --panel-3:   #ececf0;
  --hairline:  rgba(0,0,0,.08);
  --hairline-2:rgba(0,0,0,.055);

  --text:      #1d1d1f;
  --text-2:    #424245;
  --muted:     #6e6e73;
  --faint:     #a1a1a6;

  --accent:    #0071e3;
  --accent-2:  rgba(0,113,227,.10);
  --accent-3:  rgba(0,113,227,.16);

  --ok:        #248a3d;  --ok-b:   #34c759;  --ok-bg:   rgba(52,199,89,.14);
  --doing:     #0a6ed1;  --doing-b:#0a84ff;  --doing-bg:rgba(10,132,255,.13);
  --review:    #b25000;  --review-b:#ff9500; --review-bg:rgba(255,149,0,.15);
  --external:  #6e6e73;  --ext-b:  #8e8e93;  --ext-bg:  rgba(142,142,147,.15);
  --blocked:   #b3005e;  --blocked-b:#ff2d92;--blocked-bg:rgba(255,45,146,.13);
  --danger:    #d70015;  --danger-b:#ff3b30; --danger-bg:rgba(255,59,48,.13);
  --pending:   #86868b;                      --pending-bg:rgba(120,120,128,.10);
  --critical:  #7d3ac9;  --critical-b:#af52de;--critical-bg:rgba(175,82,222,.14);

  /* 图表分类色（validate_palette 明模式全过；固定跟实体走，不跟名次走） */
  --ch-1: #0a84ff;   /* 仓宿/主系列 */
  --ch-2: #ff9500;   /* 电费/次系列 */
  --ch-3: #af52de;   /* 办公 */
  --ch-4: #00c7be;   /* 通讯 */
  --ch-5: #ff375f;   /* 其他合并 */

  --r-sm: 8px;
  --r:    14px;
  --r-lg: 20px;
  --pill: 980px;

  --sh-1: 0 1px 2px rgba(0,0,0,.04), 0 4px 12px rgba(0,0,0,.05);
  --sh-2: 0 2px 6px rgba(0,0,0,.05), 0 12px 32px -8px rgba(0,0,0,.12);
  --sh-3: 0 30px 80px -20px rgba(0,0,0,.32);

  --nav-h: 54px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000; --panel: #1c1c1e; --panel-2: #2c2c2e; --panel-3: #3a3a3c;
    --hairline: rgba(255,255,255,.10); --hairline-2: rgba(255,255,255,.07);
    --text: #f5f5f7; --text-2: #d1d1d6; --muted: #98989d; --faint: #6e6e73;
    --accent: #0a84ff; --accent-2: rgba(10,132,255,.18); --accent-3: rgba(10,132,255,.26);
    --ok: #30d158; --review: #ff9f0a; --danger: #ff453a; --blocked: #ff375f;
    --external: #98989d; --doing: #409cff; --pending: #8e8e93; --critical: #bf5af2;
    /* 暗色图表色是单独选的深阶（validate 暗模式全过），不是明色直接翻转 */
    --ch-2: #d17400;
    --ch-4: #009e97;
    --sh-1: 0 1px 2px rgba(0,0,0,.5); --sh-2: 0 12px 32px -8px rgba(0,0,0,.6);
    --sh-3: 0 30px 80px -20px rgba(0,0,0,.8);
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 13.5px/1.55 -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
        "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.005em;
}

/* ——— 丝绸流光：铺在纯色底右上，透过毛玻璃导航隐隐透出来 ——— */
body::before {
  content: ''; position: fixed; inset: 0 0 auto 0; height: 520px; z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(46% 76% at 84% 4%,   rgba(94,92,230,.78),  transparent 62%),
    radial-gradient(40% 64% at 102% 40%, rgba(255,45,110,.55), transparent 64%),
    radial-gradient(50% 72% at 66% -8%,  rgba(64,200,255,.66), transparent 60%),
    radial-gradient(34% 56% at 98% -6%,  rgba(255,170,20,.50), transparent 62%),
    radial-gradient(30% 48% at 118% 18%, rgba(0,220,180,.42),  transparent 64%);
  filter: blur(30px) saturate(1.35);
  -webkit-mask-image: linear-gradient(180deg, #000 0%, rgba(0,0,0,.70) 40%, transparent 100%);
          mask-image: linear-gradient(180deg, #000 0%, rgba(0,0,0,.70) 40%, transparent 100%);
  opacity: .78;
}
body::after {
  content: ''; position: fixed; inset: 0 0 auto 0; height: 520px; z-index: 0;
  pointer-events: none; mix-blend-mode: soft-light;
  background: linear-gradient(104deg, transparent 34%, rgba(255,255,255,.5) 52%, transparent 68%);
  -webkit-mask-image: linear-gradient(180deg, #000 0%, transparent 100%);
          mask-image: linear-gradient(180deg, #000 0%, transparent 100%);
}
@media (prefers-color-scheme: dark) { body::before { opacity: .55; } }
body > * { position: relative; z-index: 1; }

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; font-variant-numeric: tabular-nums; }
h1, h2, h3, h4 { letter-spacing: -.022em; }

/* ============ 顶栏（毛玻璃） ============ */
.topbar {
  display: flex; align-items: center; gap: 10px;
  height: var(--nav-h); padding: 0 20px;
  background: color-mix(in srgb, var(--panel) 72%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(22px);
          backdrop-filter: saturate(180%) blur(22px);
  border-bottom: 1px solid var(--hairline-2);
  position: sticky; top: 0; z-index: 40;
}
.topbar .logo {
  font-weight: 600; font-size: 14.5px; letter-spacing: -.02em;
  white-space: nowrap; display: flex; align-items: center; gap: 9px;
}
.topbar .logo::before {
  content: ''; width: 17px; height: 17px; border-radius: 6px;
  background: linear-gradient(140deg, #0a84ff, #5e5ce6 52%, #ff375f);
  box-shadow: 0 1px 4px rgba(10,132,255,.4);
}
.topbar .logo span { color: var(--faint); font-weight: 400; font-size: 11.5px; letter-spacing: .02em; }
.topbar nav { display: flex; gap: 2px; margin-left: 18px; }
.topbar nav a {
  padding: 6px 13px; border-radius: var(--pill); color: var(--muted);
  white-space: nowrap; font-weight: 500; transition: color .18s, background .18s;
}
.topbar nav a:hover { color: var(--text); background: color-mix(in srgb, var(--text) 6%, transparent); }
.topbar nav a.on { color: #fff; background: var(--accent); font-weight: 500; }
.topbar .spacer { flex: 1; }
.topbar .who {
  max-width: 190px; padding: 5px 9px; border: 0; border-radius: var(--pill);
  background: transparent; color: var(--muted); white-space: nowrap; font-size: 12.5px;
  overflow: hidden; text-overflow: ellipsis; cursor: pointer;
  transition: color .18s, background .18s;
}
.topbar .who b { color: var(--text); font-weight: 600; }
.topbar .who:hover { color: var(--text); background: color-mix(in srgb, var(--text) 7%, transparent); }

/* ============ 布局 ============ */
.wrap { max-width: 1560px; margin: 0 auto; padding: 26px 22px 60px; }
.page-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { font-size: 27px; margin: 0; font-weight: 700; letter-spacing: -.03em; }
.page-head .sub { color: var(--muted); font-size: 13px; }
.page-head .spacer { flex: 1; }

.panel {
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
          backdrop-filter: saturate(180%) blur(20px);
  border-radius: var(--r); box-shadow: var(--sh-1); overflow: hidden;
}
.panel-head {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 13px 18px; border-bottom: 1px solid var(--hairline-2); font-weight: 600;
}
.panel-head .note { color: var(--faint); font-weight: 400; font-size: 12px; }
.panel-head .spacer { flex: 1; }
.panel-body { padding: 16px 18px; }

.grid-2 { display: grid; grid-template-columns: 5fr 7fr; gap: 14px; margin-top: 14px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; margin-top: 14px; }

/* ============ KPI ============ */
.kpis { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; }
.kpi {
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  border-radius: var(--r); box-shadow: var(--sh-1); padding: 15px 18px 13px;
  display: flex; flex-direction: column; gap: 3px; min-width: 0;
}
.kpi .l { color: var(--muted); font-size: 12px; display: flex; align-items: center; gap: 6px; }
.kpi .l .dot { width: 8px; height: 8px; border-radius: 3px; flex: none; }
.kpi .n {
  font-size: 25px; font-weight: 650; letter-spacing: -.04em; line-height: 1.1;
  font-variant-numeric: normal; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.kpi.hero .n { font-size: 31px; }
.kpi .d { color: var(--faint); font-size: 11.5px; }
.kpi .d b { font-weight: 600; }
.kpi .d.up { color: var(--danger); }     /* 费用上涨=红 */
.kpi .d.down { color: var(--ok); }
.kpi.warn .n { color: var(--danger); }

/* ============ 控件 ============ */
.field { display: inline-flex; align-items: center; gap: 7px; }
.field > label { color: var(--muted); white-space: nowrap; font-size: 12.5px; }
input[type=text], input[type=password], input[type=search], input[type=month],
input[type=date], input[type=number], select, textarea {
  background: var(--panel); border: 1px solid var(--hairline);
  border-radius: var(--r-sm); padding: 7px 11px; outline: none; min-width: 0;
  transition: border-color .18s, box-shadow .18s;
}
input:hover, select:hover { border-color: color-mix(in srgb, var(--text) 22%, transparent); }
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3.5px var(--accent-2); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 6.5px 15px; border: 1px solid var(--hairline); background: var(--panel);
  border-radius: var(--pill); cursor: pointer; white-space: nowrap; font-weight: 500;
  transition: background .18s, border-color .18s, transform .08s, box-shadow .18s, opacity .18s;
}
.btn:hover { background: var(--panel-2); }
.btn:active { transform: scale(.975); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn.primary {
  background: var(--accent); border-color: transparent; color: #fff;
  box-shadow: 0 1px 3px rgba(0,113,227,.3);
}
.btn.primary:hover { background: color-mix(in srgb, var(--accent) 88%, #fff); }
.btn.danger { border-color: transparent; color: var(--danger); background: var(--danger-bg); }
.btn.danger:hover { background: color-mix(in srgb, var(--danger) 20%, transparent); }
.btn.sm { padding: 4px 11px; font-size: 12px; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--accent); }
.btn.ghost:hover { background: var(--accent-2); }

.check { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; color: var(--muted); }
.check input { accent-color: var(--accent); width: 15px; height: 15px; margin: 0; }

/* ============ chip ============ */
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2.5px 9px; border-radius: var(--pill); font-size: 11.5px; font-weight: 600;
  white-space: nowrap; letter-spacing: -.005em;
}
.chip::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip.plain    { color: var(--muted); background: var(--pending-bg); }
.chip.plain::before { display: none; }
.chip.dup      { color: var(--review); background: var(--review-bg); }
.chip.missing  { color: var(--danger); background: var(--danger-bg); }
.chip.cross    { color: var(--doing); background: var(--doing-bg); }
.chip.jump     { color: var(--critical); background: var(--critical-bg); }
.chip.unknown  { color: var(--blocked); background: var(--blocked-bg); }
.chip.ok       { color: var(--ok); background: var(--ok-bg); }
.chip.warn     { color: var(--danger); background: var(--danger-bg); }

/* ============ 表格 ============ */
table.grid { width: 100%; border-collapse: collapse; }
table.grid th, table.grid td {
  padding: 11px 18px; border-bottom: 1px solid var(--hairline-2); text-align: left; vertical-align: middle;
}
table.grid th {
  background: color-mix(in srgb, var(--panel) 90%, transparent);
  -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
  color: var(--faint); font-weight: 600; font-size: 11.5px;
  letter-spacing: .02em; white-space: nowrap; position: sticky; top: var(--nav-h); z-index: 2;
  padding-top: 10px; padding-bottom: 10px;
}
table.grid tbody tr { transition: background .15s; }
table.grid tbody tr:hover { background: color-mix(in srgb, var(--accent) 4%, transparent); }
table.grid tbody tr:last-child td { border-bottom: none; }
table.grid tbody tr.rowlink { cursor: pointer; }
table.grid td.num, table.grid th.num { text-align: right; }
/* overflow 容器会把 sticky 表头往下顶 54px 压住首行（Chromium 以容器为粘滞参照），
   容器内 top 归零：表头回到自然位置，不再吃掉第一行 */
.table-scroll { overflow-x: auto; }
.table-scroll table.grid th { top: 0; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.nowrap { white-space: nowrap; }

/* ============ 图表 ============ */
.chart-box { position: relative; }
.chart-box svg { display: block; width: 100%; height: auto; }
.chart-tip {
  position: fixed; z-index: 120; pointer-events: none; max-width: 260px;
  background: color-mix(in srgb, var(--panel) 94%, transparent);
  -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
  border-radius: 10px; box-shadow: var(--sh-2); padding: 9px 12px;
  font-size: 12px; opacity: 0; transition: opacity .12s;
}
.chart-tip.show { opacity: 1; }
.chart-tip .t { color: var(--faint); font-size: 11px; margin-bottom: 4px; }
.chart-tip .row { display: flex; align-items: center; gap: 7px; padding: 1.5px 0; }
.chart-tip .key { width: 12px; height: 2.5px; border-radius: 2px; flex: none; }
.chart-tip .v { font-weight: 650; margin-left: auto; padding-left: 12px; }

/* 环形图 + 图例行（图例带数值：橙/青对比度 WARN 的救济） */
.donut-wrap { display: flex; align-items: center; gap: 20px; }
.donut-center { pointer-events: none; }
.donut-center b { font-size: 21px; font-weight: 650; letter-spacing: -.03em; font-variant-numeric: normal; }
.donut-center span { font-size: 10.5px; fill: var(--faint); }
.legend-rows { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.legend-row {
  display: flex; align-items: center; gap: 9px; padding: 6px 9px; border-radius: var(--r-sm);
  cursor: default; transition: background .15s;
}
.legend-row:hover, .legend-row.on { background: color-mix(in srgb, var(--text) 5%, transparent); }
.legend-row .sw { width: 10px; height: 10px; border-radius: 3.5px; flex: none; }
.legend-row .nm { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.legend-row .pc { color: var(--faint); font-size: 11.5px; }
.legend-row .amt { margin-left: auto; font-weight: 600; padding-left: 10px; }

/* 横条榜 */
.hbar-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; }
.hbar-row .nm {
  width: 84px; flex: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 12.5px;
}
.hbar-row .track { flex: 1; height: 14px; border-radius: 4px; background: var(--pending-bg); overflow: hidden; }
.hbar-row .track i {
  display: block; height: 100%; border-radius: 0 4px 4px 0; background: var(--ch-1);
  transition: width .5s cubic-bezier(.32,.72,0,1); min-width: 2px;
}
.hbar-row .val { flex: none; min-width: 76px; text-align: right; font-weight: 600; font-size: 12.5px; }
.hbar-row .ct { flex: none; color: var(--faint); font-size: 11px; min-width: 38px; text-align: right; }
.hbar-row.link { cursor: pointer; border-radius: var(--r-sm); }
.hbar-row.link:hover { background: color-mix(in srgb, var(--accent) 5%, transparent); }

/* 100% 分块条 */
.stackbar { display: flex; gap: 2px; height: 18px; border-radius: 5px; overflow: hidden; }
.stackbar i { display: block; height: 100%; min-width: 3px; }
.stack-legend { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 9px; }
.stack-legend .it { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.stack-legend .sw { width: 10px; height: 10px; border-radius: 3.5px; }
.stack-legend b { color: var(--text); font-weight: 600; }

/* 异常卡 */
.anomaly {
  display: flex; align-items: flex-start; gap: 10px; padding: 11px 14px;
  border-radius: var(--r-sm); background: var(--panel-2); margin-bottom: 8px;
}
.anomaly:last-child { margin-bottom: 0; }
.anomaly .ic { font-size: 15px; line-height: 1.4; }
.anomaly .bd { flex: 1; min-width: 0; }
.anomaly .bd b { font-weight: 600; }
.anomaly .bd .m { color: var(--muted); font-size: 12px; margin-top: 2px; line-height: 1.5; }

/* ============ 抽屉 ============ */
.drawer-mask {
  position: fixed; inset: 0; background: rgba(0,0,0,.28); z-index: 60;
  opacity: 0; pointer-events: none; transition: opacity .3s;
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
}
.drawer-mask.open { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 8px; right: 8px; bottom: 8px; width: min(460px, calc(100% - 16px));
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(30px); backdrop-filter: saturate(180%) blur(30px);
  border-radius: var(--r-lg); z-index: 61; box-shadow: var(--sh-3);
  transform: translateX(calc(100% + 16px)); transition: transform .38s cubic-bezier(.32,.72,0,1);
  display: flex; flex-direction: column; overflow: hidden;
}
.drawer.open { transform: translateX(0); }
.drawer-head { padding: 18px 22px 14px; border-bottom: 1px solid var(--hairline-2); display: flex; align-items: flex-start; gap: 12px; }
.drawer-head h3 { margin: 5px 0 8px; font-size: 18px; font-weight: 600; letter-spacing: -.028em; line-height: 1.3; }
.drawer-head .crumb { font-size: 11.5px; color: var(--faint); font-weight: 500; }
.drawer-head .close {
  cursor: pointer; color: var(--muted); font-size: 14px; line-height: 1; width: 28px; height: 28px;
  display: grid; place-items: center; border-radius: 50%; flex-shrink: 0; border: 0;
  background: var(--pending-bg); transition: background .18s, color .18s; margin-left: auto;
}
.drawer-head .close:hover { color: var(--text); background: var(--panel-3); }
.drawer-body { flex: 1; overflow-y: auto; }
.sec { padding: 15px 22px; border-bottom: 1px solid var(--hairline-2); }
.sec:last-child { border-bottom: none; }
.sec h4 { margin: 0 0 11px; font-size: 11.5px; color: var(--faint); font-weight: 600; }
.kv { display: grid; grid-template-columns: 84px 1fr; gap: 8px 12px; align-items: baseline; }
.kv > .k { color: var(--faint); font-size: 12.5px; }
.kv > .v { min-width: 0; overflow-wrap: anywhere; }

/* ============ 空 / 错 / 载 ============ */
.empty { padding: 56px 20px; text-align: center; color: var(--faint); }
.empty .big { font-size: 32px; margin-bottom: 12px; opacity: .5; }
.empty .t { color: var(--muted); font-size: 14.5px; margin-bottom: 14px; }
.errbar {
  display: none; align-items: center; gap: 12px;
  background: var(--danger-bg); color: var(--danger);
  padding: 12px 16px; border-radius: var(--r); margin-bottom: 14px;
}
.errbar.show { display: flex; }
.skeleton {
  background: linear-gradient(90deg, var(--pending-bg) 25%, color-mix(in srgb, var(--text) 3%, transparent) 37%, var(--pending-bg) 63%);
  background-size: 400% 100%; animation: sk 1.4s ease infinite; border-radius: var(--r-sm);
}
@keyframes sk { 0% { background-position: 100% 50% } 100% { background-position: 0 50% } }
.sk-row { height: 34px; margin: 10px 18px; }
.sk-kpi { height: 84px; border-radius: var(--r); }

/* ============ 弹窗 ============ */
.modal-mask {
  position: fixed; inset: 0; background: rgba(0,0,0,.3); z-index: 80;
  display: none; align-items: center; justify-content: center; padding: 20px;
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
}
.modal-mask.open { display: flex; }
.modal {
  background: color-mix(in srgb, var(--panel) 94%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(30px); backdrop-filter: saturate(180%) blur(30px);
  border-radius: var(--r-lg); width: min(480px, 100%);
  max-height: 90vh; overflow-y: auto; box-shadow: var(--sh-3);
  animation: pop .3s cubic-bezier(.32,.72,0,1);
}
.modal.wide { width: min(660px, 100%); }
@keyframes pop { from { opacity: 0; transform: translateY(-8px) scale(.97); } }
.modal h3 { margin: 0; padding: 18px 24px 14px; border-bottom: 1px solid var(--hairline-2); font-size: 17px; font-weight: 600; letter-spacing: -.02em; }
.modal .m-body { padding: 18px 24px; display: grid; gap: 14px; }
.modal .m-body label { display: block; color: var(--muted); margin-bottom: 6px; font-size: 12.5px; }
.modal .m-body input, .modal .m-body select { width: 100%; }
.modal .m-foot { padding: 14px 24px; border-top: 1px solid var(--hairline-2); display: flex; justify-content: flex-end; gap: 10px; align-items: center; }
.modal .m-foot .left { margin-right: auto; color: var(--faint); font-size: 12px; }
.modal-error { display: none; color: var(--danger); font-size: 12.5px; }
.modal-error.show { display: block; }

/* 导入流程 */
.dropzone {
  border: 1.5px dashed var(--hairline); border-radius: var(--r); padding: 34px 20px;
  text-align: center; color: var(--muted); cursor: pointer; transition: border-color .18s, background .18s;
}
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: var(--accent-2); }
.dropzone .big { font-size: 26px; margin-bottom: 8px; opacity: .6; }
.dropzone .hint { color: var(--faint); font-size: 11.5px; margin-top: 5px; }
.recon-line { display: flex; align-items: baseline; gap: 8px; padding: 5px 0; font-size: 12.5px; }
.recon-line .nm { color: var(--muted); }
.recon-line .fill { flex: 1; border-bottom: 1px dotted var(--hairline); }
.recon-line b { font-weight: 600; }

/* 表单两列 */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.form-grid label { display: block; color: var(--muted); margin-bottom: 6px; font-size: 12.5px; }
.form-grid input, .form-grid select { width: 100%; }

/* iOS 分段控件（管理页 tab） */
.segmented {
  display: inline-flex; background: var(--pending-bg); border-radius: var(--r-sm);
  padding: 2px; gap: 2px;
}
.segmented .btn {
  border: none; background: transparent; box-shadow: none; color: var(--muted);
  padding: 5px 15px; border-radius: 6px; font-weight: 500;
}
.segmented .btn:hover { background: transparent; color: var(--text); }
.segmented .btn.on {
  background: var(--panel); color: var(--text); font-weight: 600;
  box-shadow: 0 1px 3px rgba(0,0,0,.12), 0 0 0 .5px rgba(0,0,0,.04);
}

/* 作废行 & 来源 chip */
tr.rowvoid td { opacity: .48; }
tr.rowvoid td b { text-decoration: line-through; }
.chip.manual { color: var(--doing); background: var(--doing-bg); }
.chip.editedmark { color: var(--critical); background: var(--critical-bg); }
.chip.voidmark { color: var(--danger); background: var(--danger-bg); }
.chip.voidmark::before { display: none; }

/* 附件缩略图 */
.thumbs { display: flex; flex-wrap: wrap; gap: 8px; }
.thumb {
  position: relative; width: 76px; height: 76px; border-radius: var(--r-sm);
  background: var(--panel-2); border: 1px solid var(--hairline); overflow: hidden;
  cursor: zoom-in; display: grid; place-items: center; flex: none;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .pdfmark {
  font-size: 11px; font-weight: 700; color: var(--danger);
  background: var(--danger-bg); padding: 3px 8px; border-radius: var(--pill);
}
.thumb-del {
  position: absolute; top: 3px; right: 3px; width: 20px; height: 20px; border: 0;
  border-radius: 50%; background: rgba(0,0,0,.55); color: #fff; font-size: 10px;
  cursor: pointer; display: grid; place-items: center; line-height: 1;
}
.thumb-del:hover { background: var(--danger-b); }
.thumb-add {
  cursor: pointer; border-style: dashed; color: var(--muted); background: transparent;
  display: flex; flex-direction: column; gap: 2px; align-items: center; justify-content: center;
}
.thumb-add:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-2); }
.thumb-add span { font-size: 19px; line-height: 1; }
.thumb-add small { font-size: 10px; }
.thumbs.mini .thumb { width: 52px; height: 52px; cursor: zoom-in; }

.cat-info { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.cat-info:empty { display: none; }
.cat-note {
  background: var(--review-bg); color: var(--review); border-radius: var(--r-sm);
  padding: 8px 11px; font-size: 12px; line-height: 1.55;
}

.lightbox {
  position: fixed; inset: 0; background: rgba(0,0,0,.72); z-index: 300;
  -webkit-backdrop-filter: blur(24px); backdrop-filter: blur(24px);
  display: none; align-items: center; justify-content: center; padding: 40px; cursor: zoom-out;
}
.lightbox.open { display: flex; animation: pop .28s cubic-bezier(.32,.72,0,1); }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: var(--r); box-shadow: var(--sh-3); }

/* 费用类型点选药丸 */
.sub-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.sub-chips:empty { display: none; }
.sub-chips .chipbtn.on {
  background: var(--accent); border-color: transparent; color: #fff;
  box-shadow: 0 1px 3px rgba(0,113,227,.3);
}

/* 变更记录 */
.trace { display: flex; flex-direction: column; gap: 8px; }
.trace .tr-item { font-size: 12.5px; line-height: 1.6; }
.trace .tr-item .when { color: var(--faint); font-size: 11.5px; margin-right: 8px; }
.trace .tr-item .who { font-weight: 600; }
.trace .tr-item .act {
  font-size: 10.5px; padding: 1.5px 7px; border-radius: var(--pill);
  background: var(--pending-bg); color: var(--muted); margin: 0 6px; white-space: nowrap;
}
.trace .diff { color: var(--muted); }
.trace .diff b { color: var(--text); font-weight: 600; }

.toast {
  position: fixed; left: 50%; bottom: 42px; transform: translateX(-50%) translateY(10px) scale(.97);
  background: rgba(28,28,30,.86); color: #fff; padding: 11px 22px; border-radius: var(--pill);
  -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
  z-index: 200; opacity: 0; transition: opacity .28s, transform .28s; pointer-events: none;
  box-shadow: var(--sh-3); font-weight: 500;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
.toast.bad { background: rgba(255,59,48,.92); }

/* ============ 移动端 ============ */
@media (max-width: 900px) {
  .wrap { padding: 16px 12px 90px; }
  .topbar { gap: 8px; padding: 0 14px; }
  .topbar nav { display: none; }
  .topbar .logo span { display: none; }
  .page-head h1 { font-size: 22px; }
  .kpis { display: flex; overflow-x: auto; gap: 10px; padding-bottom: 4px;
          scroll-snap-type: x mandatory; }
  .kpi { flex: 0 0 46%; scroll-snap-align: start; }
  .kpi.hero { flex-basis: 74%; }
  .kpi .n { font-size: 21px; }
  .kpi.hero .n { font-size: 24px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .donut-wrap { flex-direction: column; align-items: stretch; }
  table.grid th { top: 0; padding: 9px 12px; }
  table.grid td { padding: 11px 12px; }
  .hide-sm { display: none !important; }
  .drawer { top: 0; right: 0; bottom: 0; width: 100%; border-radius: 0; transform: translateX(100%); }
  .tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; height: 62px; z-index: 50;
    background: color-mix(in srgb, var(--panel) 78%, transparent);
    -webkit-backdrop-filter: saturate(180%) blur(24px); backdrop-filter: saturate(180%) blur(24px);
    border-top: 1px solid var(--hairline-2); display: flex; align-items: stretch;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .tabbar a {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 3px; color: var(--faint); font-size: 10.5px; font-weight: 500;
  }
  .tabbar a.on { color: var(--accent); font-weight: 600; }
  .tabbar a .ic { font-size: 18px; line-height: 1; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
}
@media (min-width: 901px) { .tabbar { display: none; } .hide-lg { display: none !important; } }
