/* 布局：左侧深色导航，右侧内容区；内容区是“筛选条 + 表格”，记录详情从右侧抽屉打开。 */
:root {
  color-scheme: light;
  --ground: #F4F4F1;
  --panel: #FFFFFF;
  --ink: #15171C;
  --muted: #5B616E;
  --line: #DEDED8;
  --line-soft: #ECECE8;
  --accent: #2346D5;
  --nav: #15171C;
  --nav-text: #C4C8D0;
  --nav-active: #2B2F3A;
  --warn-bg: #FBEBD0; --warn-fg: #7A4200;
  --info-bg: #E3E8FB; --info-fg: #1E3FAE;
  --ok-bg: #DCEFE3; --ok-fg: #1B5733;
  --bad-bg: #FBE4E1; --bad-fg: #941B1B;
  --mute-bg: #ECECE8; --mute-fg: #3F4550;
  --font: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--ground); color: var(--ink); font: 14px/1.5 var(--font); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
a { color: var(--accent); }
h1, h2, h3, p { margin: 0; }
.boot { padding: 48px; color: var(--muted); }

#app { min-height: 100%; }
.shell { min-height: 100vh; display: flex; flex-wrap: wrap; align-items: stretch; }
.nav { flex: 1 1 220px; max-width: 100%; background: var(--nav); color: var(--nav-text); padding: 20px 12px; display: flex; flex-direction: column; gap: 16px; }
.brand { padding: 0 12px; display: flex; flex-direction: column; gap: 2px; }
.brand b { color: #fff; font-size: 16px; }
.brand span, .nav-group, .nav-foot { font-size: 12px; color: #A3A8B3; }
.nav-list { display: flex; flex-direction: column; gap: 4px; }
.nav-group { padding: 12px 12px 4px; }
.nav-btn { min-height: 44px; display: flex; align-items: center; gap: 12px; padding: 0 12px; border: 0; border-radius: 4px; background: transparent; color: var(--nav-text); text-align: left; }
.nav-btn.on { background: var(--nav-active); color: #fff; }
.nav-btn span:first-child { flex: 1; }
.nav-btn .count { font-family: var(--mono); font-size: 12px; }
.nav-foot { margin-top: auto; padding: 0 12px; display: flex; flex-direction: column; gap: 8px; }
.nav-foot button { background: transparent; border: 1px solid #3A3F4B; color: var(--nav-text); border-radius: 4px; min-height: 36px; }

.main { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 12px 28px; background: var(--panel); border-bottom: 1px solid var(--line); }
.shops { display: flex; flex-wrap: wrap; gap: 4px; flex: 1 1 auto; }
.shop-btn { min-height: 40px; padding: 0 14px; border: 1px solid #C9C9C2; border-radius: 4px; background: var(--panel); font-weight: 500; }
.shop-btn.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.topbar .who { color: var(--muted); font-size: 13px; }
.page { width: 100%; max-width: 1280px; padding: 28px; display: flex; flex-direction: column; gap: 24px; }
.head { display: flex; flex-direction: column; gap: 4px; }
.head h1 { font-size: 26px; line-height: 1.25; }
.head p, .hint { color: var(--muted); max-width: 680px; }
.hint { font-size: 12px; }
h2 { font-size: 16px; }
h3 { font-size: 14px; }

.tabs { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--line); }
.tab { min-height: 44px; padding: 0 16px; background: transparent; border: 0; border-bottom: 3px solid transparent; color: var(--muted); font-weight: 500; }
.tab.on { border-bottom-color: var(--accent); color: var(--ink); font-weight: 700; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tile { min-width: 104px; min-height: 60px; display: flex; flex-direction: column; justify-content: center; gap: 2px; padding: 6px 14px; background: var(--panel); border: 2px solid var(--line); border-radius: 4px; text-align: left; }
.tile.on { border-color: var(--accent); }
.tile b { font-family: var(--mono); font-size: 20px; font-weight: 500; line-height: 1.1; }
.tile span { font-size: 12px; color: var(--muted); }
.spacer { flex: 1; }
.btn { min-height: 40px; padding: 0 14px; border-radius: 4px; border: 1px solid var(--ink); background: var(--panel); font-weight: 500; white-space: nowrap; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.danger { border-color: var(--bad-fg); color: var(--bad-fg); }
.btn.small { min-height: 34px; padding: 0 10px; }
.btn:disabled { opacity: 0.5; cursor: default; }

.box { background: var(--panel); border: 1px solid var(--line); border-radius: 4px; overflow-x: auto; }
table { width: 100%; min-width: 760px; border-collapse: collapse; }
th { text-align: left; font-size: 12px; font-weight: 400; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 10px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; overflow-wrap: anywhere; }
td.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
td.long { max-width: 320px; color: var(--muted); font-size: 13px; }
tr:last-child td { border-bottom: 0; }
.link { padding: 0; border: 0; background: transparent; color: var(--accent); font-weight: 500; text-align: left; text-decoration: underline; text-underline-offset: 3px; min-height: 28px; }
.empty { padding: 32px 16px; color: var(--muted); }
.badge { display: inline-block; font-size: 12px; font-weight: 500; padding: 2px 8px; border-radius: 4px; white-space: nowrap; }
.tone-warn { background: var(--warn-bg); color: var(--warn-fg); }
.tone-info { background: var(--info-bg); color: var(--info-fg); }
.tone-ok { background: var(--ok-bg); color: var(--ok-fg); }
.tone-bad { background: var(--bad-bg); color: var(--bad-fg); }
.tone-mute { background: var(--mute-bg); color: var(--mute-fg); }
.alert { color: var(--bad-fg); font-weight: 500; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(170px, 100%), 1fr)); gap: 12px; }
.card { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; text-align: left; padding: 16px; background: var(--panel); border: 1px solid var(--line); border-radius: 4px; }
.card small { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.card b { font-family: var(--mono); font-size: 34px; font-weight: 500; line-height: 1; color: var(--accent); }
.split { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; }
.split > section { min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.grow2 { flex: 2 1 480px; }
.grow1 { flex: 1 1 340px; }
.rowbtn { width: 100%; min-height: 52px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; padding: 8px 16px; background: transparent; border: 0; border-bottom: 1px solid var(--line-soft); text-align: left; }
.rowbtn .mod { flex: 0 0 44px; font-size: 12px; color: var(--muted); }
.rowbtn .txt { flex: 1 1 200px; min-width: 0; font-weight: 500; }
.rowbtn .meta { font-size: 12px; color: var(--muted); }
section.stack { display: flex; flex-direction: column; gap: 12px; }

.drawer-back { position: fixed; inset: 0; background: rgba(21, 23, 28, 0.35); display: flex; justify-content: flex-end; z-index: 10; }
.drawer { width: min(640px, 100%); height: 100%; overflow-y: auto; background: var(--panel); padding: 24px; display: flex; flex-direction: column; gap: 20px; }
.drawer-head { display: flex; align-items: flex-start; gap: 12px; }
.drawer-head h2 { flex: 1; font-size: 18px; overflow-wrap: anywhere; }
.form { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); gap: 12px 16px; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field.wide { grid-column: 1 / -1; }
.field label, .field .lbl { font-size: 12px; color: var(--muted); }
.field input, .field select, .field textarea { width: 100%; min-height: 40px; padding: 8px 10px; border: 1px solid #C9C9C2; border-radius: 4px; background: var(--panel); }
.field textarea { min-height: 72px; resize: vertical; }
.field input:disabled, .field select:disabled, .field textarea:disabled { background: var(--ground); color: var(--muted); }
.checks { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr)); gap: 8px; }
.check { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 10px; border: 1px solid var(--line); border-radius: 4px; }
.check input { width: 18px; height: 18px; min-height: 0; accent-color: var(--accent); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.links { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); gap: 8px; }
.linkbtn { min-height: 48px; display: flex; align-items: center; gap: 12px; padding: 8px 12px; background: var(--ground); border: 1px solid var(--line); border-radius: 4px; text-align: left; }
.linkbtn .mod { flex: 0 0 64px; font-size: 12px; color: var(--muted); }
.linkbtn .txt { flex: 1; min-width: 0; font-weight: 500; overflow-wrap: anywhere; }
.foot { font-size: 12px; color: var(--muted); }

.auth { min-height: 100%; display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth form { width: min(400px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 4px; padding: 28px; display: flex; flex-direction: column; gap: 16px; }
.auth h1 { font-size: 22px; }
.error { color: var(--bad-fg); }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); max-width: min(520px, calc(100% - 32px)); background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 4px; z-index: 20; }
.toast.bad { background: var(--bad-fg); }
.inline-form { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; padding: 16px; background: var(--panel); border: 1px solid var(--line); border-radius: 4px; }
.inline-form .field { flex: 1 1 180px; }
.pick { display: flex; flex-wrap: wrap; gap: 8px; }
.pick label { display: flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 10px; border: 1px solid var(--line); border-radius: 4px; font-size: 13px; color: var(--ink); }
.pick input { width: 16px; height: 16px; min-height: 0; }

.chart { padding: 16px; overflow: hidden; }
.bars { height: 140px; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; align-items: end; gap: 3px; border-bottom: 1px solid var(--ink); }
.bar { background: var(--accent); min-height: 1px; }
.axis { display: flex; justify-content: space-between; gap: 12px; padding-top: 6px; font-family: var(--mono); font-size: 12px; color: var(--muted); }
.bar.low { background: var(--bad-fg); }
