/* ───────── tokens ───────── */
:root {
  --bg: #f5f5f3;
  --surface: #ffffff;
  --surface-2: #f8f8f6;
  --text: #0e0e10;
  --muted: #6e6e73;
  --faint: #a3a3a8;
  --line: #e8e8e5;
  --line-strong: #d6d6d2;
  --primary: #0e0e10;
  --on-primary: #ffffff;
  --accent: #3d5afe;
  --ok: #148a50;  --ok-bg: #e8f5ee;
  --warn: #b26b00; --warn-bg: #fbf2e2;
  --err: #d23b3b;  --err-bg: #fcecec;
  --info: #3d5afe; --info-bg: #eef0ff;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 12px 32px -16px rgba(0,0,0,.10);
  --font: "Inter", -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --mono: "JetBrains Mono", "SF Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #09090a;
    --surface: #121214;
    --surface-2: #18181b;
    --text: #f2f2f0;
    --muted: #9b9ba1;
    --faint: #5c5c63;
    --line: #232327;
    --line-strong: #34343a;
    --primary: #f2f2f0;
    --on-primary: #09090a;
    --accent: #8696ff;
    --ok: #3fcf8a;  --ok-bg: rgba(63,207,138,.12);
    --warn: #e6ab45; --warn-bg: rgba(230,171,69,.12);
    --err: #ff6f6f;  --err-bg: rgba(255,111,111,.12);
    --info: #8696ff; --info-bg: rgba(134,150,255,.13);
    --shadow: 0 0 0 1px rgba(255,255,255,.02), 0 16px 40px -20px rgba(0,0,0,.7);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #09090a;
  --surface: #121214;
  --surface-2: #18181b;
  --text: #f2f2f0;
  --muted: #9b9ba1;
  --faint: #5c5c63;
  --line: #232327;
  --line-strong: #34343a;
  --primary: #f2f2f0;
  --on-primary: #09090a;
  --accent: #8696ff;
  --ok: #3fcf8a;  --ok-bg: rgba(63,207,138,.12);
  --warn: #e6ab45; --warn-bg: rgba(230,171,69,.12);
  --err: #ff6f6f;  --err-bg: rgba(255,111,111,.12);
  --info: #8696ff; --info-bg: rgba(134,150,255,.13);
  --shadow: 0 0 0 1px rgba(255,255,255,.02), 0 16px 40px -20px rgba(0,0,0,.7);
  color-scheme: dark;
}

/* ───────── theme toggle ───────── */
.theme-btn {
  width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); color: var(--muted); cursor: pointer;
  display: inline-grid; place-items: center; transition: color .15s, border-color .15s;
}
.theme-btn:hover { color: var(--text); border-color: var(--line-strong); }
.theme-btn svg { width: 17px; height: 17px; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.theme-fixed { position: fixed; top: 18px; right: 18px; }

/* ───────── base ───────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body { background: var(--bg); color: var(--text); font: 14px/1.6 var(--font); -webkit-font-smoothing: antialiased; min-height: 100vh; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }
.mono { font-family: var(--mono); letter-spacing: .02em; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
::selection { background: color-mix(in srgb, var(--accent) 22%, transparent); }

/* ───────── brand ───────── */
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 15px; letter-spacing: .01em; }
.mark { width: 22px; height: 22px; border-radius: 7px; background: var(--primary); position: relative; flex: none; }
.mark::after { content: ""; position: absolute; left: 6px; top: 6px; width: 7px; height: 7px; border-radius: 2px; background: var(--bg); }
.mark::before { content: ""; position: absolute; right: 5px; bottom: 5px; width: 4px; height: 4px; border-radius: 1px; background: var(--bg); opacity: .55; }

/* ───────── controls ───────── */
.field { display: block; margin-bottom: 16px; }
.field > span { display: flex; justify-content: space-between; align-items: center; min-height: 20px; font-size: 12px; color: var(--muted); margin-bottom: 7px; font-weight: 500; letter-spacing: .02em; }
.input {
  width: 100%; height: 46px; padding: 0 14px;
  border: 1px solid var(--line-strong); border-radius: 12px; background: var(--surface);
  outline: none; transition: border-color .15s, box-shadow .15s;
}
.input::placeholder { color: var(--faint); }
.input:focus { border-color: var(--text); box-shadow: 0 0 0 4px color-mix(in srgb, var(--text) 7%, transparent); }
textarea.input { height: auto; min-height: 110px; padding: 12px 14px; resize: vertical; line-height: 1.6; }
select.input { appearance: none; padding-right: 34px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
input[type=number]::-webkit-inner-spin-button, input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type=number] { -moz-appearance: textfield; }

.btn {
  height: 38px; padding: 0 15px; border-radius: 10px; border: 1px solid var(--line-strong);
  background: var(--surface); cursor: pointer; font-weight: 500; white-space: nowrap;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  transition: border-color .15s, background .15s, opacity .15s, transform .05s;
}
.btn:hover { border-color: var(--text); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn.primary { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.btn.primary:hover { opacity: .86; }
.btn.block { width: 100%; height: 48px; border-radius: 12px; font-size: 15px; }

/* 开关 */
.switch-wrap { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; color: var(--muted); font-weight: 500; letter-spacing: 0; }
.switch { appearance: none; -webkit-appearance: none; margin: 0; width: 34px; height: 20px; border-radius: 99px; background: var(--line-strong); position: relative; cursor: pointer; transition: background .18s; flex: none; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--surface); box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .18s cubic-bezier(.2,.7,.2,1); }
.switch:checked { background: var(--text); }
.switch:checked::after { transform: translateX(14px); }
.switch:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch-wrap:has(.switch:checked) { color: var(--text); }

/* 上游卡密选择 */
.picker { display: grid; gap: 8px; max-height: 268px; overflow-y: auto; }
.pick {
  position: relative; display: grid; grid-template-columns: 16px minmax(0, 1fr) auto; align-items: center; gap: 8px 12px;
  padding: 12px 14px; border: 1px solid var(--line-strong); border-radius: 12px; cursor: pointer;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.pick:hover { border-color: color-mix(in srgb, var(--text) 45%, var(--line-strong)); }
.pick input { position: absolute; opacity: 0; pointer-events: none; }
.pick .radio { width: 16px; height: 16px; border-radius: 50%; border: 1.5px solid var(--line-strong); position: relative; transition: border-color .15s; }
.pick .radio::after { content: ""; position: absolute; inset: 3px; border-radius: 50%; background: var(--text); transform: scale(0); transition: transform .15s; }
.pick:has(input:checked) { border-color: var(--text); box-shadow: inset 0 0 0 1px var(--text); background: var(--surface-2); }
.pick:has(input:checked) .radio { border-color: var(--text); }
.pick:has(input:checked) .radio::after { transform: scale(1); }
.pick:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.pick-code { font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick-num { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.pick-num b { color: var(--text); font-weight: 600; font-size: 13px; }
.pick-bar { grid-column: 2 / -1; height: 3px; border-radius: 9px; background: var(--line); overflow: hidden; }
.pick-bar i { display: block; height: 100%; background: var(--text); border-radius: inherit; }
.pick.off { opacity: .45; cursor: not-allowed; }
.pick-empty { padding: 18px; text-align: center; color: var(--faint); font-size: 13px; border: 1px dashed var(--line-strong); border-radius: 12px; }
.pick-empty a { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }
.input:disabled { background: var(--surface-2); color: var(--faint); cursor: not-allowed; }
.input[readonly] { background: var(--surface-2); cursor: default; }
.input[readonly]:focus { box-shadow: none; border-color: var(--line); }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12px; border-radius: 8px; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--text); background: var(--surface-2); }
.btn.danger { color: var(--err); }
.btn.danger:hover { border-color: var(--err); }
.btn svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; padding: 2px 9px; border-radius: 999px; font-weight: 500; white-space: nowrap; line-height: 1.7; }
.badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.b-ok { background: var(--ok-bg); color: var(--ok); }
.b-err { background: var(--err-bg); color: var(--err); }
.b-warn { background: var(--warn-bg); color: var(--warn); }
.b-info { background: var(--info-bg); color: var(--info); }
.b-mute { background: var(--surface-2); color: var(--muted); box-shadow: inset 0 0 0 1px var(--line); }

.bar { height: 4px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); border-radius: 99px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--text); border-radius: inherit; transition: width .6s cubic-bezier(.2,.7,.2,1); }
.bar.live i { background: linear-gradient(90deg, var(--text) 0%, color-mix(in srgb, var(--text) 45%, transparent) 50%, var(--text) 100%); background-size: 200% 100%; animation: flow 1.4s linear infinite; }
@keyframes flow { to { background-position: -200% 0; } }

.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); position: relative; flex: none; }
.dot::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 1px solid var(--ok); opacity: 0; animation: ping 2s ease-out infinite; }
.off .dot { background: var(--faint); } .off .dot::after { display: none; }
@keyframes ping { 0% { transform: scale(.4); opacity: .8; } 100% { transform: scale(1.4); opacity: 0; } }

.msg { font-size: 13px; margin-top: 12px; text-align: center; color: var(--muted); }
.msg:empty { display: none; }
.msg.err { color: var(--err); } .msg.ok { color: var(--ok); }

/* ───────── user site ───────── */
.topbar { max-width: 1080px; margin: 0 auto; padding: 22px 24px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.pill { display: inline-flex; align-items: center; gap: 9px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; font-size: 12px; color: var(--muted); background: var(--surface); }
.wrap { max-width: 520px; margin: 0 auto; padding: 48px 16px 72px; }
.page-title { text-align: center; font-size: 26px; font-weight: 650; letter-spacing: -.02em; line-height: 1.25; margin-bottom: 22px; }
.notice { color: var(--muted); font-size: 14px; margin-bottom: 18px; white-space: pre-line; text-align: center; }
.hero { margin-bottom: 28px; }
.eyebrow { font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); font-weight: 500; margin-bottom: 14px; }
.hero h1 { font-size: 34px; line-height: 1.22; font-weight: 650; letter-spacing: -.025em; }
.hero p { color: var(--muted); margin-top: 12px; font-size: 14.5px; white-space: pre-line; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); padding: 6px 24px 24px; }
.seg { display: grid; grid-template-columns: 1fr 1fr; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 3px; margin: 18px 0 22px; }
.seg button { border: 0; background: none; padding: 7px; border-radius: 9px; color: var(--muted); cursor: pointer; font-weight: 500; transition: color .15s, background .15s; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.06), 0 0 0 1px var(--line); }
.field .hint { font-style: normal; font-weight: 400; color: var(--muted); letter-spacing: 0; font-variant-numeric: tabular-nums; }
.field .hint b { color: var(--text); font-weight: 600; }
.field .hint.err { color: var(--err); }
.meta { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; color: var(--muted); margin: -6px 0 16px; padding: 10px 12px; background: var(--surface-2); border-radius: 10px; border: 1px solid var(--line); }
.meta b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.meta.err { color: var(--err); background: var(--err-bg); border-color: transparent; }
.stepper { display: flex; gap: 8px; }
.stepper .input { text-align: center; flex: 1; font-variant-numeric: tabular-nums; font-weight: 500; }
.stepper .sq { width: 46px; height: 46px; padding: 0; border-radius: 12px; font-size: 18px; font-weight: 400; }
.stepper .all { height: 46px; border-radius: 12px; }

.result { margin-top: 40px; animation: rise .35s cubic-bezier(.2,.7,.2,1); }
.result-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 14px; gap: 12px; }
.result-head .mono { font-size: 13px; color: var(--muted); }
.result-head h2 { font-size: 15px; font-weight: 600; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.stat { background: var(--surface); padding: 16px 16px 14px; }
.stat b { display: block; font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -.02em; line-height: 1.3; }
.stat span { font-size: 12px; color: var(--muted); }
.stat.hl b { color: var(--text); }
.sec-title { font-size: 12px; font-weight: 500; margin: 28px 0 12px; color: var(--muted); letter-spacing: .08em; }
.list { list-style: none; padding: 0; display: grid; gap: 10px; }
.order { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }
.o-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.o-sub .o-time { margin-left: auto; }
.o-code { font-size: 15px; font-weight: 600; }
.o-time { font-size: 12px; color: var(--faint); margin-top: 1px; }
.o-sub { font-size: 12px; color: var(--muted); display: flex; gap: 6px 14px; flex-wrap: wrap; margin-top: 10px; font-variant-numeric: tabular-nums; }
.o-msg { font-size: 12px; color: var(--warn); margin-top: 6px; }
.empty { padding: 44px 16px; text-align: center; color: var(--faint); font-size: 13px; }
.foot { text-align: center; color: var(--faint); font-size: 12px; padding: 0 16px 40px; white-space: pre-line; }

@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* ───────── admin ───────── */
.admin { display: flex; min-height: 100vh; }
.side { width: 228px; flex: none; border-right: 1px solid var(--line); background: var(--surface); padding: 20px 12px; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.side .brand { padding: 4px 10px 24px; }
.side .brand small { font-weight: 400; color: var(--faint); font-size: 12px; margin-left: 2px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 9px; color: var(--muted); font-weight: 500; margin-bottom: 2px; transition: background .12s, color .12s; }
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a.on { background: var(--surface-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--line); }
.nav svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.side-foot { margin-top: auto; padding: 0 2px; }
.side-foot .btn { width: 100%; justify-content: flex-start; }
.main { flex: 1; min-width: 0; padding: 28px 36px 64px; }
.main-inner { max-width: 1180px; margin: 0 auto; }
.head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 22px; min-height: 38px; flex-wrap: wrap; }
.head h1 { font-size: 22px; font-weight: 650; letter-spacing: -.015em; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 20px; min-width: 0; }
.card-title { font-size: 13.5px; font-weight: 600; margin-bottom: 14px; display: flex; justify-content: space-between; align-items: center; gap: 10px; min-height: 28px; }
.grid { display: grid; gap: 16px; margin-bottom: 16px; }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3-1 { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); }
.kpi .label { font-size: 12px; color: var(--muted); }
.kpi .value { font-size: 28px; font-weight: 600; letter-spacing: -.025em; margin-top: 8px; font-variant-numeric: tabular-nums; line-height: 1.2; }
.kpi .hint { font-size: 12px; color: var(--faint); margin-top: 4px; }
.kv { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; background: var(--line); border-radius: 12px; overflow: hidden; border: 1px solid var(--line); }
.kv > div { background: var(--surface); padding: 12px 14px; }
.kv span { display: block; font-size: 12px; color: var(--muted); }
.kv b { font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .input { height: 38px; width: auto; min-width: 0; border-radius: 10px; }
.toolbar .grow { flex: 1 1 240px; }
.table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; overflow-x: auto; }
.card .table-wrap { border: 0; border-radius: 0; margin: 0 -20px -20px; border-top: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; font-weight: 500; color: var(--muted); font-size: 12px; padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--surface-2); }
td { padding: 11px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; vertical-align: middle; font-variant-numeric: tabular-nums; }
tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .1s; }
tbody tr:hover td { background: var(--surface-2); }
td.actions { text-align: right; }
td.actions .btn + .btn { margin-left: 4px; }
td .sub { display: block; font-size: 11.5px; color: var(--faint); }
.copy { cursor: pointer; border-bottom: 1px dashed transparent; }
.copy:hover { border-bottom-color: var(--faint); }
.mini { display: inline-block; width: 56px; height: 4px; border-radius: 9px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); overflow: hidden; vertical-align: middle; margin-left: 8px; }
.mini i { display: block; height: 100%; background: var(--text); }
.pager { display: flex; justify-content: space-between; align-items: center; padding: 12px 2px 0; color: var(--muted); font-size: 12px; gap: 12px; }
.pager .btns { display: flex; gap: 6px; }
.banner { padding: 11px 14px; border-radius: 12px; font-size: 13px; margin-bottom: 16px; display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.banner.warn { background: var(--warn-bg); color: var(--warn); }
.banner.err { background: var(--err-bg); color: var(--err); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; }
.form-grid .full { grid-column: 1 / -1; }
.help { font-size: 12px; color: var(--faint); margin-top: -8px; margin-bottom: 14px; }

.mask { position: fixed; inset: 0; background: rgba(8,8,10,.38); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); display: grid; place-items: center; z-index: 50; padding: 16px; animation: fade .15s; }
.modal { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; width: 100%; max-width: 440px; padding: 24px; box-shadow: 0 30px 80px -20px rgba(0,0,0,.35); animation: pop .18s cubic-bezier(.2,.7,.2,1); max-height: calc(100vh - 32px); overflow: auto; }
.modal.wide { max-width: 560px; }
.modal h2 { font-size: 17px; font-weight: 600; margin-bottom: 6px; letter-spacing: -.01em; }
.modal .desc { color: var(--muted); font-size: 13px; margin-bottom: 18px; }
.modal .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.toast { position: fixed; left: 50%; top: 20px; transform: translateX(-50%); background: var(--primary); color: var(--on-primary); padding: 9px 16px; border-radius: 10px; font-size: 13px; z-index: 60; box-shadow: 0 10px 30px -10px rgba(0,0,0,.4); animation: pop .18s; max-width: calc(100vw - 32px); }
.toast.err { background: var(--err); color: #fff; }

.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login .panel { width: 100%; max-width: 384px; padding: 34px 30px 28px; }
.login .brand { margin-bottom: 30px; }
.login h1 { font-size: 22px; font-weight: 650; letter-spacing: -.015em; }
.login p.lead { color: var(--muted); margin: 6px 0 26px; font-size: 13.5px; }
.login .back { display: block; text-align: center; margin-top: 18px; font-size: 12px; color: var(--faint); }
.login .back:hover { color: var(--muted); }

@media (max-width: 960px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g2, .g3-1 { grid-template-columns: 1fr; }
  .g2:has(> .kpi) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .admin { flex-direction: column; }
  /* 手机：上排品牌 + 主题/退出，下排可横滑的导航 */
  .side { width: auto; height: auto; position: sticky; top: 0; z-index: 10; display: grid; grid-template-columns: 1fr auto;
          grid-template-areas: "brand foot" "nav nav"; align-items: center; padding: 10px 16px 0; border-right: 0; border-bottom: 1px solid var(--line); }
  .side .brand { grid-area: brand; padding: 0; }
  .side .brand small { display: none; }
  .side-foot { grid-area: foot; margin: 0; padding: 0; display: flex; gap: 4px; }
  .side-foot .btn { width: 38px; height: 38px; padding: 0; justify-content: center; }
  .side-foot .btn span { display: none; }
  .nav { grid-area: nav; display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; margin: 8px -16px 0; padding: 0 16px 10px; }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { white-space: nowrap; margin: 0; padding: 7px 12px; }
  .nav a svg { display: none; }
  .main { padding: 20px 16px 48px; }
  .head h1 { font-size: 20px; }
  .form-grid { grid-template-columns: 1fr; }
  .input { font-size: 16px; } /* 小于 16px 时 iPhone 聚焦会自动放大页面 */

  /* 表格 → 卡片：每行一张卡，左边列名、右边内容（列名由 admin.js 写到 data-label） */
  .table-wrap { background: none; border: 0; border-radius: 0; overflow: visible; }
  .table-wrap table, .table-wrap tbody, .table-wrap tr, .table-wrap td { display: block; width: 100%; }
  .table-wrap thead { display: none; }
  .table-wrap tr { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 4px 14px; margin-bottom: 10px; }
  .table-wrap td { padding: 7px 0; border: 0; line-height: 24px; white-space: normal; text-align: right; word-break: break-all; overflow: hidden; }
  .table-wrap td::before { content: attr(data-label); float: left; margin-right: 14px; color: var(--muted); font-size: 12px; word-break: normal; }
  .table-wrap td:not([data-label])::before { content: none; }
  .table-wrap td:not([data-label]) { text-align: center; }
  .table-wrap td.actions { text-align: right; border-top: 1px solid var(--line); margin-top: 4px; padding: 10px 0 8px; }
  .table-wrap td.actions:not(:has(*)) { display: none; }
  .table-wrap td.actions .btn + .btn { margin-left: 6px; }
  tbody tr:hover td { background: none; }
  .table-wrap tr:has(.empty) { background: none; border: 0; }
  /* 卡片里的表格：行之间只用细线分隔，不再套卡片 */
  .card .table-wrap { margin: 0; border-top: 0; }
  .card .table-wrap tr { background: none; border: 0; border-top: 1px solid var(--line); border-radius: 0; padding: 4px 0; margin: 0; }
  .modal { padding: 20px; }
}
@media (max-width: 520px) {
  .topbar { padding: 18px 16px; }
  .wrap { padding-top: 16px; }
  .result { margin-top: 28px; }
  .hero h1 { font-size: 28px; }
  .panel { padding: 4px 18px 20px; border-radius: 18px; }
  .kpi .value { font-size: 24px; }
}
