/* Desk 2.0 — "control room" theme: top navigation, dense tables, neutral greys with one teal accent.
   Every colour is a token so light and dark share the same rules. */
:root {
  color-scheme: light;
  --bg: #f4f5f4;
  --panel: #ffffff;
  --panel-2: #f8f9f8;
  --hover: #f1f3f2;
  --line: #e2e5e3;
  --line-2: #eceeed;
  --text: #121614;
  --muted: #59625e;
  --faint: #8a938f;
  --brand: #0f766e;
  --brand-h: #115e59;
  --brand-2: #e6f4f2;
  --brand-ink: #0f5f58;
  --ok: #16a34a;
  --ok-bg: #eaf7ee;
  --ok-ink: #15803d;
  --warn: #d97706;
  --warn-bg: #fdf5e7;
  --warn-ink: #a35a04;
  --bad: #dc2626;
  --bad-bg: #fdeeee;
  --bad-line: #f6c9c9;
  --bad-ink: #b91c1c;
  --idle: #a1a9a5;
  --idle-bg: #eff1f0;
  --top: #0f1412;
  --top-ink: #c9d1cd;
  --top-line: #222a26;
  --code-bg: #0f1412;
  --code-ink: #d5ddd9;
  --shadow: 0 8px 28px rgba(15, 20, 18, .14);
  --radius: 8px;
  --radius-sm: 6px;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Noto Sans SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
:root[data-theme=dark] {
  color-scheme: dark;
  --bg: #0b0e0d;
  --panel: #131816;
  --panel-2: #171d1a;
  --hover: #1b2220;
  --line: #252e2a;
  --line-2: #1d2522;
  --text: #e3e8e5;
  --muted: #9aa49f;
  --faint: #6b7570;
  --brand: #2dd4bf;
  --brand-h: #5eead4;
  --brand-2: #10302c;
  --brand-ink: #7ee8da;
  --ok-bg: #0f2618;
  --ok-ink: #6ee79a;
  --warn-bg: #2a1f0c;
  --warn-ink: #f8c46a;
  --bad-bg: #2b1414;
  --bad-line: #5a2323;
  --bad-ink: #fca5a5;
  --idle-bg: #1c2320;
  --top: #070908;
  --top-line: #1b221f;
  --code-bg: #070908;
  --shadow: 0 10px 32px rgba(0, 0, 0, .5);
}
* { box-sizing: border-box; }
html { overflow-x: hidden; }
@supports (overflow: clip) { html { overflow-x: clip; } }
body { margin: 0; }
a { color: var(--brand); text-decoration: none; }
button { font: inherit; color: inherit; }
code, .mono { font-family: var(--mono); font-size: 12px; }
code { background: var(--idle-bg); padding: 1px 5px; border-radius: 4px; }
svg.i { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.err { color: var(--bad-ink); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }

/* ---------- top bar ---------- */
.topbar { position: sticky; top: 0; z-index: 20; }
.topbar-row { height: 48px; display: flex; align-items: center; gap: 20px; padding: 0 20px; background: var(--top); color: var(--top-ink); border-bottom: 1px solid var(--top-line); }
.brand { display: flex; align-items: center; gap: 9px; color: #fff; flex: none; }
.brand strong { font-size: 14px; font-weight: 600; letter-spacing: .02em; }
.brand-mark { width: 18px; height: 18px; border-radius: 4px; background: var(--brand); box-shadow: inset 0 0 0 4px var(--top), inset 0 0 0 9px var(--brand); }
.nav { display: flex; align-items: stretch; gap: 2px; height: 100%; overflow-x: auto; scrollbar-width: none; min-width: 0; }
.nav::-webkit-scrollbar { display: none; }
.nav a { display: inline-flex; align-items: center; gap: 6px; padding: 0 12px; color: var(--top-ink); font-size: 13px; white-space: nowrap; border-bottom: 2px solid transparent; border-top: 2px solid transparent; }
.nav a:hover { color: #fff; }
.nav a.on { color: #fff; border-bottom-color: var(--brand); font-weight: 500; }
.badge { min-width: 17px; height: 17px; padding: 0 5px; border-radius: 999px; background: var(--bad); color: #fff; font-size: 10.5px; font-weight: 600; display: inline-grid; place-items: center; font-variant-numeric: tabular-nums; }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 2px; flex: none; }
.top-right .icon-btn { color: var(--top-ink); }
.top-right .icon-btn:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.sync { font-size: 11.5px; color: #87918c; font-family: var(--mono); display: inline-flex; align-items: center; gap: 6px; margin-right: 8px; }
.sync::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--ok); }
.sync.stale::before { background: var(--warn); }

.subbar { height: 44px; display: flex; align-items: center; gap: 12px; padding: 0 20px; background: var(--panel); border-bottom: 1px solid var(--line); }
.crumbs { display: flex; align-items: center; gap: 8px; font-size: 13px; min-width: 0; overflow: hidden; }
.crumbs a { color: var(--muted); white-space: nowrap; }
.crumbs a:hover { color: var(--text); }
.crumbs .sep { color: var(--faint); }
.crumbs b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.switcher { position: relative; margin-left: auto; flex: none; }
.switch-btn { display: inline-flex; align-items: center; gap: 8px; height: 30px; padding: 0 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel); cursor: pointer; font-size: 13px; max-width: 260px; }
.switch-btn:hover { background: var(--hover); }
.switch-btn #switch-label { display: inline-flex; align-items: center; gap: 7px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.switch-btn .chev { width: 14px; height: 14px; color: var(--faint); }
.side-count { font-family: var(--mono); font-size: 11px; color: var(--faint); background: var(--idle-bg); padding: 0 6px; border-radius: 4px; }
.side-count:empty { display: none; }
.side-count.bad { background: var(--bad-bg); color: var(--bad-ink); }
.proj-pop { position: absolute; right: 0; top: calc(100% + 6px); width: 320px; max-height: min(480px, 70vh); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); display: none; flex-direction: column; overflow: hidden; z-index: 30; }
.proj-pop.open { display: flex; }
.proj-pop input { border: 0 !important; border-bottom: 1px solid var(--line) !important; border-radius: 0 !important; box-shadow: none !important; padding: 10px 12px !important; }
.proj-list { overflow-y: auto; padding: 4px; display: flex; flex-direction: column; }
.proj-list a { display: flex; align-items: center; gap: 9px; padding: 7px 9px; border-radius: var(--radius-sm); color: var(--text); }
.proj-list a:hover { background: var(--hover); }
.proj-list a.on { background: var(--brand-2); color: var(--brand-ink); }
.proj-list .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.proj-list .meta { font-size: 11.5px; color: var(--faint); }
.pop-empty { padding: 14px; text-align: center; }
.side-mask { display: none; }

.page { padding: 20px 20px 56px; max-width: 1480px; margin: 0 auto; width: 100%; }
.banner { max-width: 1480px; margin: 12px auto 0; padding: 9px 14px; border-radius: var(--radius-sm); background: var(--bad-bg); color: var(--bad-ink); border: 1px solid var(--bad-line); width: calc(100% - 40px); }
.banner.ok { background: var(--ok-bg); color: var(--ok-ink); border-color: transparent; }
.page-head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 20px; font-weight: 650; letter-spacing: -.01em; }
.page-head p { margin: 3px 0 0; color: var(--muted); font-size: 12.5px; }
.page-head .acts { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
/* ---------- status dot / pill ---------- */
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; flex: none; background: var(--idle); }
.dot.ok { background: var(--ok); }
.dot.degraded, .dot.warn, .dot.unknown { background: var(--warn); }
.dot.down, .dot.bad { background: var(--bad); }
.dot.paused { background: var(--idle); }
.dot.busy { background: var(--brand); animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { opacity: .3; } }
@media (prefers-reduced-motion: reduce) { .dot.busy { animation: none; } * { transition: none !important; animation: none !important; } }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 1px 7px; border-radius: 4px; font-size: 11.5px; font-weight: 500; background: var(--idle-bg); color: var(--muted); white-space: nowrap; line-height: 1.6; }
.pill .dot { width: 6px; height: 6px; }
.pill.ok { background: var(--ok-bg); color: var(--ok-ink); }
.pill.degraded, .pill.warn, .pill.unknown { background: var(--warn-bg); color: var(--warn-ink); }
.pill.down, .pill.bad { background: var(--bad-bg); color: var(--bad-ink); }
.pill.busy { background: var(--brand-2); color: var(--brand-ink); }

/* ---------- buttons & fields ---------- */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--panel); border-radius: var(--radius-sm); padding: 6px 12px; cursor: pointer; white-space: nowrap; font-size: 13px; font-weight: 500; transition: background .1s, border-color .1s; }
.btn:hover { background: var(--hover); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
:root[data-theme=dark] .btn.primary { color: #04201d; }
.btn.primary:hover { background: var(--brand-h); border-color: var(--brand-h); }
.btn.danger { color: var(--bad-ink); border-color: var(--bad-line); }
.btn.danger:hover { background: var(--bad-bg); }
.btn.danger.solid { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--hover); }
.btn.sm { padding: 3px 9px; font-size: 12px; }
.btn.block { width: 100%; justify-content: center; padding: 8px 12px; }
.icon-btn { border: 0; background: none; width: 30px; height: 30px; display: inline-grid; place-items: center; border-radius: var(--radius-sm); cursor: pointer; color: var(--muted); }
.icon-btn:hover { background: var(--hover); color: var(--text); }
.field { display: flex; flex-direction: column; gap: 5px; font-size: 12px; font-weight: 500; color: var(--muted); }
.field .hint { font-weight: 400; color: var(--faint); }
input:not([type=checkbox]):not([type=radio]):not([type=range]), select, textarea {
  font: inherit; font-size: 13px; color: var(--text); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 6px 9px; background: var(--panel); min-width: 0; width: 100%;
  transition: border-color .1s, box-shadow .1s;
}
.toolbar select, .row select { width: auto; }
input:disabled, input[readonly] { background: var(--panel-2); color: var(--muted); }
input::placeholder, textarea::placeholder { color: var(--faint); }
textarea { font-family: var(--mono); font-size: 12px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 16%, transparent); }
.input-group { display: flex; gap: 6px; align-items: stretch; }
.input-group input { flex: 1; font-family: var(--mono); font-size: 12px; }
.switch { position: relative; width: 32px; height: 18px; flex: none; display: inline-block; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; background: var(--line); border-radius: 999px; transition: .15s; }
.switch span::after { content: ""; position: absolute; left: 2px; top: 2px; width: 14px; height: 14px; background: #fff; border-radius: 50%; transition: .15s; box-shadow: 0 1px 2px rgba(0,0,0,.25); }
.switch input:checked + span { background: var(--brand); }
.switch input:checked + span::after { transform: translateX(14px); }
.switch input:focus-visible + span { box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 30%, transparent); }
.switch input:disabled + span { opacity: .5; }
.switch input:disabled { cursor: not-allowed; }

/* ---------- layout blocks ---------- */
.grid { display: grid; gap: 12px; }
.grid.kpi { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 0; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.grid.cards { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.grid.two { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.spacer { flex: 1; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); min-width: 0; }
.panel-head { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-bottom: 1px solid var(--line-2); flex-wrap: wrap; min-height: 46px; }
.panel-head h3 { margin: 0; font-size: 13px; font-weight: 600; }
.panel-head .sub { color: var(--faint); font-size: 12px; }
.panel-body { padding: 14px; }
.panel-body.flush { padding: 0; }
/* KPI strip: one bordered row of cells instead of floating cards. */
.kpi-card { padding: 12px 16px; border-right: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2); margin: 0 -1px -1px 0; min-width: 0; }
.kpi-card .lab { font-size: 11.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.kpi-card .val { font-size: 22px; font-weight: 600; margin-top: 2px; font-variant-numeric: tabular-nums; letter-spacing: -.02em; line-height: 1.3; font-family: var(--mono); }
.kpi-card .hint { font-size: 11.5px; color: var(--faint); margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kpi-card.bad .lab::before, .kpi-card.warn .lab::before, .kpi-card.ok .lab::before { content: ""; width: 6px; height: 6px; border-radius: 50%; }
.kpi-card.bad .lab::before { background: var(--bad); }
.kpi-card.warn .lab::before { background: var(--warn); }
.kpi-card.ok .lab::before { background: var(--ok); }
.kpi-card.bad .val { color: var(--bad-ink); }
.kpi-card.warn .val { color: var(--warn-ink); }
.kpi-card.dim .val { color: var(--faint); }
/* ---------- overview status board ---------- */
.board td.proj { min-width: 180px; }
.board td.proj a { color: var(--text); font-weight: 600; display: inline-flex; align-items: center; gap: 8px; }
.board td.proj a:hover { color: var(--brand); }
.board td.proj .faint { display: block; font-weight: 400; margin-left: 15px; }
.board td.reason { max-width: 420px; color: var(--bad-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; }
.board td.reason.warn { color: var(--warn-ink); }
.board tr.down td:first-child { box-shadow: inset 3px 0 0 var(--bad); }
.board tr.degraded td:first-child { box-shadow: inset 3px 0 0 var(--warn); }
.board tr.paused td { opacity: .6; }
.rate { display: inline-flex; align-items: center; gap: 8px; min-width: 110px; }
.rate i { width: 56px; height: 4px; border-radius: 2px; background: var(--line-2); overflow: hidden; display: block; }
.rate i b { display: block; height: 100%; background: var(--ok); }
.rate i b.warn { background: var(--warn); }
.rate i b.bad { background: var(--bad); }
.rate span { font-family: var(--mono); font-size: 12px; font-variant-numeric: tabular-nums; }

/* legacy overview cards (kept for any page still using them) */
.pcard { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; color: inherit; }
.pcard-head { display: flex; align-items: center; gap: 8px; }
.pcard-head .pill { margin-left: auto; }
.pcard-reason { font-size: 12px; color: var(--bad-ink); background: var(--bad-bg); padding: 6px 9px; border-radius: 4px; }
.pcard-reason.warn { color: var(--warn-ink); background: var(--warn-bg); }
.pcard-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.pcard-stats div { background: var(--panel-2); border-radius: 4px; padding: 6px 8px; }
.pcard-stats span { display: block; font-size: 11px; color: var(--faint); }
.pcard-foot { display: flex; gap: 6px; font-size: 12px; color: var(--muted); flex-wrap: wrap; align-items: center; }
.tag { font-size: 11px; padding: 0 6px; border-radius: 4px; background: var(--idle-bg); color: var(--muted); white-space: nowrap; line-height: 1.7; display: inline-block; }
.tag.on { background: var(--brand-2); color: var(--brand-ink); }
.tag.bad { background: var(--bad-bg); color: var(--bad-ink); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 13px; }
table.t th, table.t td { padding: 8px 12px; border-bottom: 1px solid var(--line-2); text-align: left; vertical-align: middle; }
table.t th { font-size: 11.5px; font-weight: 500; color: var(--faint); background: var(--panel-2); white-space: nowrap; position: sticky; top: 0; text-transform: none; }
table.t tr:last-child td { border-bottom: 0; }
table.t tbody tr:hover td { background: var(--hover); }
table.t tr.click { cursor: pointer; }
table.t td.wrap { max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
table.t td.mono, table.t td.faint { white-space: nowrap; }
.empty { padding: 36px 16px; text-align: center; color: var(--faint); font-size: 13px; }
.pager { display: flex; align-items: center; gap: 10px; padding: 8px 14px; border-top: 1px solid var(--line-2); font-size: 12.5px; color: var(--muted); }
.pager .spacer { flex: 1; }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 0; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { padding: 8px 14px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; font-weight: 500; }
.tabs a:hover { color: var(--text); }
.tabs a.on { color: var(--text); border-bottom-color: var(--brand); }
.tabs a .cnt { font-size: 11px; color: var(--faint); margin-left: 4px; font-family: var(--mono); }

/* ---------- project header ---------- */
.phead { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 14px; flex-wrap: wrap; }
.phead h1 { margin: 0; font-size: 20px; font-weight: 650; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.phead .sub { color: var(--muted); font-size: 12px; margin-top: 3px; font-family: var(--mono); overflow-wrap: anywhere; }
.phead .acts { margin-left: auto; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.fault-box { border: 1px solid var(--bad-line); border-left-width: 3px; border-left-color: var(--bad); background: var(--bad-bg); border-radius: var(--radius-sm); padding: 10px 14px; margin-bottom: 14px; color: var(--bad-ink); display: flex; gap: 10px; align-items: flex-start; }
.fault-box > div { min-width: 0; }
.fault-box > svg.i { margin-top: 2px; }
.fault-box.warn { border-color: transparent; border-left-color: var(--warn); background: var(--warn-bg); color: var(--warn-ink); }
.fault-box b { display: block; margin-bottom: 1px; }
.fault-box small { color: inherit; opacity: .85; font-family: var(--mono); }
.stack > .fault-box { margin-bottom: 0; }

/* ---------- checks ---------- */
.checks { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); overflow: hidden; }
.check { padding: 10px 14px; border-right: 1px solid var(--line-2); }
.check:last-child { border-right: 0; }
.check .k { font-size: 11.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.check .v { margin-top: 4px; font-size: 13px; }
.check .t { margin-top: 2px; font-size: 11px; color: var(--faint); font-family: var(--mono); }
.checks-inline { display: flex; gap: 18px; flex-wrap: wrap; padding: 9px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); font-size: 12px; color: var(--muted); }
.checks-inline span { display: inline-flex; align-items: center; gap: 6px; }
/* ---------- meters ---------- */
.meter { display: flex; align-items: center; gap: 8px; min-width: 120px; }
.meter i { flex: 1; height: 4px; border-radius: 2px; background: var(--line-2); overflow: hidden; display: block; min-width: 50px; }
.meter i b { display: block; height: 100%; background: var(--ok); }
.meter i b.warn { background: var(--warn); }
.meter i b.bad { background: var(--bad); }
.meter span { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; font-family: var(--mono); }
.prog { display: flex; align-items: center; gap: 8px; min-width: 130px; }
.prog i { flex: 1; height: 4px; border-radius: 2px; background: var(--line-2); overflow: hidden; display: block; }
.prog i b { display: block; height: 100%; background: var(--brand); }
.prog.ok i b { background: var(--ok); }
.prog.bad i b { background: var(--bad); }
.prog span { font-size: 11.5px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; font-family: var(--mono); }

/* ---------- toolbar ---------- */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.toolbar input[type=search] { width: 240px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel); overflow: hidden; }
.seg button { border: 0; background: none; padding: 5px 12px; cursor: pointer; font-size: 12.5px; color: var(--muted); }
.seg button + button { border-left: 1px solid var(--line); }
.seg button:hover { color: var(--text); background: var(--hover); }
.seg button.on { background: var(--brand-2); color: var(--brand-ink); font-weight: 500; }

/* ---------- forms ---------- */
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.form-grid .wide { grid-column: 1 / -1; }
.check-line { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); cursor: pointer; }
pre.log { margin: 0; padding: 12px 14px; background: var(--code-bg); color: var(--code-ink); border-radius: var(--radius-sm); max-height: 320px; overflow: auto; font-family: var(--mono); font-size: 12px; line-height: 1.6; white-space: pre-wrap; word-break: break-all; }
.code-block { position: relative; }
.code-block .btn { position: absolute; top: 8px; right: 8px; background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.12); color: var(--code-ink); }
.code-block .btn:hover { background: rgba(255,255,255,.16); }
.kv { display: grid; grid-template-columns: 100px 1fr; gap: 7px 12px; margin: 0; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-all; }

/* ---------- drawer & confirm ---------- */
.drawer-mask { position: fixed; inset: 0; background: rgba(5, 8, 7, .45); z-index: 40; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(600px, 100vw); background: var(--panel); z-index: 41; transform: translateX(100%); transition: transform .18s ease; display: flex; flex-direction: column; box-shadow: var(--shadow); border-left: 1px solid var(--line); visibility: hidden; }
.drawer.open { transform: none; visibility: visible; }
.drawer-head { display: flex; align-items: center; gap: 10px; padding: 12px 18px; border-bottom: 1px solid var(--line); min-height: 52px; }
.drawer-head h3 { margin: 0; font-size: 15px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drawer-body { padding: 16px 18px; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 14px; }
.drawer-foot { padding: 10px 18px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.modal-mask { position: fixed; inset: 0; background: rgba(5, 8, 7, .5); z-index: 70; display: grid; place-items: center; padding: 16px; }
.modal { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); width: min(420px, 100%); box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 12px; padding: 18px 20px; }
.modal h3 { margin: 0; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.modal.danger h3 { color: var(--bad-ink); }
.modal p { margin: 0; color: var(--muted); white-space: pre-line; font-size: 13px; }
.modal .row { justify-content: flex-end; margin-top: 4px; }
.media { display: flex; flex-direction: column; gap: 8px; }
.media video, .media img { max-width: 100%; border-radius: var(--radius-sm); background: #000; }
.section-k { font-size: 11.5px; color: var(--muted); margin-bottom: 5px; font-weight: 500; }
/* ---------- 模型映射（v2）：公共名列表 + 候选详情 ---------- */
.mr { display: flex; flex-direction: column; gap: 16px; }
.mr-head { align-items: flex-end; }
.mr-head p { max-width: 760px; overflow-wrap: anywhere; }
.mr-summary { display: flex; align-items: stretch; flex-wrap: wrap; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); overflow: hidden; }
.mr-stat { padding: 10px 16px; border-right: 1px solid var(--line-2); min-width: 112px; }
.mr-stat span { display: block; font-size: 11.5px; color: var(--muted); }
.mr-stat b { display: block; margin-top: 1px; font-size: 20px; font-weight: 600; letter-spacing: -.01em; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.mr-stat.warn b { color: var(--warn-ink); }
.mr-summary .spacer { flex: 1; min-width: 0; }
.mr-notice { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 14px; font-size: 12.5px; color: var(--warn-ink); background: var(--warn-bg); border-left: 3px solid var(--warn); }
.mr-split { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 16px; align-items: start; }
.mr-list { position: sticky; top: 104px; display: flex; flex-direction: column; min-width: 0; max-height: calc(100vh - 136px); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.mr-list-tools { display: flex; flex-direction: column; gap: 10px; padding: 12px; border-bottom: 1px solid var(--line-2); }
.mr-filters { display: flex; flex-wrap: wrap; gap: 6px; }
.mr-chip { border: 1px solid var(--line); background: var(--panel); border-radius: 999px; padding: 2px 10px; font-size: 12px; color: var(--muted); cursor: pointer; }
.mr-chip:hover { background: var(--hover); color: var(--text); }
.mr-chip.on { background: var(--brand-2); border-color: transparent; color: var(--brand-ink); font-weight: 500; }
.mr-rows { min-height: 0; overflow-y: auto; padding: 4px; }
.mr-row { display: flex; align-items: flex-start; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: var(--radius-sm); background: none; color: var(--text); text-align: left; cursor: pointer; }
.mr-row:hover { background: var(--hover); }
.mr-row.on { background: var(--brand-2); color: var(--brand-ink); }
.mr-row .dot { margin-top: 6px; }
.mr-row.is-hidden .mr-row-name { color: var(--faint); text-decoration: line-through; }
.mr-row-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.mr-row-name { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mr-row-meta { font-size: 11.5px; color: var(--faint); }
.mr-row.on .mr-row-meta { color: var(--brand-ink); opacity: .85; }
.mr-list-foot { padding: 8px 12px; border-top: 1px solid var(--line-2); font-size: 11.5px; color: var(--faint); }
.mr-detail { min-width: 0; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.mr-d { display: flex; flex-direction: column; }
.mr-d-head { display: flex; align-items: flex-start; flex-wrap: wrap; gap: 16px; padding: 16px 18px; border-bottom: 1px solid var(--line-2); }
.mr-d-title { flex: 1; min-width: 0; }
.mr-d-name { font-size: 17px; font-weight: 600; overflow-wrap: anywhere; }
.mr-d-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 6px; font-size: 12.5px; color: var(--muted); }
.mr-d-acts { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.mr-section { display: flex; flex-direction: column; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line-2); }
.mr-section-h { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.mr-section-h h2 { margin: 0; font-size: 13.5px; font-weight: 600; }
.mr-section-h .faint { font-size: 12px; }
.mr-section-h .spacer { flex: 1; }
.mr-cand-table th, .mr-cand-table td { white-space: nowrap; }
.mr-cand-table td.mr-prov-cell { white-space: normal; min-width: 180px; }
.mr-cand-table td.mono { font-size: 12px; }
.mr-prov { display: flex; flex-direction: column; gap: 1px; }
.mr-prov b { font-weight: 500; }
.mr-prov .faint { font-size: 11px; }
.mr-cool { font-size: 11px; }
.mr-cand-acts .check-line { margin: 0; }
.mr-share { display: flex; flex-direction: column; gap: 6px; }
.mr-bar { display: flex; height: 8px; border-radius: 999px; overflow: hidden; background: var(--line-2); }
.mr-seg { display: block; height: 100%; }
.mr-seg + .mr-seg { border-left: 2px solid var(--panel); }
.mr-bar-legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; color: var(--muted); }
.mr-dry-row { gap: 12px; }
.mr-dry-row input[type=text] { width: 300px; max-width: 100%; }
.mr-dry-empty { font-size: 12.5px; }
.mr-dry { display: flex; flex-direction: column; gap: 10px; }
.mr-dry-head { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12.5px; color: var(--muted); }
.mr-dry-head .mono { color: var(--text); }
.mr-order { display: flex; flex-direction: column; margin: 0; padding: 0; list-style: none; border: 1px solid var(--line-2); border-radius: var(--radius-sm); overflow: hidden; }
.mr-order li { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--line-2); font-size: 13px; }
.mr-order li:last-child { border-bottom: 0; }
.mr-order-n { font-family: var(--mono); font-size: 12px; color: var(--faint); text-align: center; }
.mr-order-main { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mr-order-meta { font-size: 12px; color: var(--muted); white-space: nowrap; }
.mr-skipped { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; }
.mr-skipped ul { display: flex; flex-direction: column; gap: 4px; margin: 0; padding: 0; list-style: none; }
.mr-d-foot { padding: 12px 18px; font-size: 12.5px; }
@media (max-width: 900px) {
  .mr-split { grid-template-columns: minmax(0, 1fr); }
  .mr-list { position: static; max-height: none; }
  .mr-rows { max-height: 280px; }
}
pre.prompt { margin: 0; padding: 10px 12px; background: var(--panel-2); border: 1px solid var(--line-2); border-radius: var(--radius-sm); white-space: pre-wrap; word-break: break-word; font-size: 13px; font-family: inherit; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--top); color: #fff; padding: 8px 14px; border-radius: var(--radius-sm); font-size: 12.5px; z-index: 80; box-shadow: var(--shadow); display: inline-flex; align-items: center; gap: 8px; }
.toast::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--ok); }
/* ---------- login ---------- */
.login-body { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); background: var(--bg); }
.login-side { background: var(--top); color: var(--top-ink); padding: 40px 48px; display: flex; flex-direction: column; justify-content: space-between; gap: 24px; }
.login-side .brand strong { font-size: 15px; }
.login-side h2 { margin: 0; color: #fff; font-size: 26px; font-weight: 600; line-height: 1.35; letter-spacing: -.01em; }
.login-side p { margin: 10px 0 0; color: #8d9792; max-width: 360px; }
.login-side ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 10px; font-family: var(--mono); font-size: 12px; color: #8d9792; }
.login-side li { display: flex; align-items: center; gap: 8px; }
.login-side li::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--brand); }
.login-main { display: grid; place-items: center; padding: 24px; }
.login-card { width: min(340px, 100%); display: flex; flex-direction: column; gap: 16px; }
.login-card h1 { margin: 0; font-size: 20px; font-weight: 650; }
.login-card .lead { margin: -8px 0 0; color: var(--muted); font-size: 13px; }

/* ---------- mail ---------- */
.mail-split { display: grid; grid-template-columns: minmax(280px, 360px) 1fr; gap: 12px; min-height: 520px; }
.mail-list, .mail-inbox { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); overflow: auto; display: flex; flex-direction: column; min-height: 520px; }
.mail-row { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-bottom: 1px solid var(--line-2); cursor: pointer; }
.mail-row:hover { background: var(--hover); }
.mail-row.on { background: var(--brand-2); }
.mail-row .who { flex: 1; min-width: 0; }
.mail-row .who b { display: block; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.otp-hero { padding: 14px 16px; border-bottom: 1px solid var(--line-2); display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.otp-hero b { font-size: 30px; letter-spacing: .14em; font-family: var(--mono); }
.mail-msg { padding: 11px 16px; border-bottom: 1px solid var(--line-2); }
.mail-msg .k { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-weight: 500; }
.mail-msg .p { margin-top: 4px; color: var(--muted); font-size: 13px; }
.mail-msg .t { margin-top: 4px; color: var(--faint); font-size: 12px; font-family: var(--mono); }

/* ---------- responsive ---------- */
.only-mobile { display: none !important; }
@media (max-width: 1000px) {
  .checks { grid-template-columns: 1fr; }
  .check { border-right: 0; border-bottom: 1px solid var(--line-2); }
  .check:last-child { border-bottom: 0; }
}
@media (max-width: 860px) {
  .topbar-row { padding: 0 8px 0 14px; gap: 10px; flex-wrap: wrap; height: auto; min-height: 48px; }
  .brand { height: 48px; }
  .nav { order: 3; width: 100%; height: 40px; margin: 0 -8px 0 -14px; padding: 0 6px; border-top: 1px solid var(--top-line); width: calc(100% + 22px); }
  .sync { display: none; }
  .subbar { padding: 0 12px; }
  .switch-btn { max-width: 170px; }
  .proj-pop { position: fixed; left: 8px; right: 8px; top: auto; width: auto; max-height: 70vh; }
  body.pop-open .side-mask { display: block; position: fixed; inset: 0; z-index: 25; background: rgba(5, 8, 7, .4); }
  .page { padding: 14px 12px 48px; }
  .banner { width: calc(100% - 24px); }
  .grid.two, .mail-split, .grid.cards { grid-template-columns: minmax(0, 1fr); }
  .grid.kpi { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-card { padding: 10px 12px; }
  .kpi-card .val { font-size: 18px; }
  .toolbar input[type=search] { width: 100%; }
  .phead { gap: 10px; }
  .phead .acts { margin-left: 0; width: 100%; }
  .phead .acts .btn:last-child { margin-left: auto; }
  .kv { grid-template-columns: 88px 1fr; }
  table.t th, table.t td { padding: 8px 10px; }
  .board .hide-m { display: none; }
  .modal-mask { place-items: end center; padding: 0; }
  .modal { border-radius: 12px 12px 0 0; width: 100%; padding-bottom: calc(18px + env(safe-area-inset-bottom)); }
  .login-body { grid-template-columns: minmax(0, 1fr); }
  .login-side { padding: 22px 20px; }
  .login-side h2 { font-size: 19px; }
  .login-side ul { display: none; }
}

/* ---------- 人脸处理：原图 / 处理后对照 ---------- */
.field-inline { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.field-inline select { width: auto; }
.fm-grid { grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); }
.fm-card { cursor: pointer; }
.fm-card:hover { border-color: var(--brand); }
.fm-pair { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
.fm-pair figure { margin: 0; }
.fm-pair img, .fm-compare img {
  width: 100%; height: 200px; object-fit: contain; display: block;
  border-radius: var(--radius-sm); background:
    repeating-conic-gradient(var(--line) 0% 25%, transparent 0% 50%) 50% / 12px 12px;
}
.fm-pair figcaption, .fm-compare figcaption { margin-top: 4px; font-size: 11px; color: var(--faint); text-align: center; }
.fm-card .kv { grid-template-columns: 76px 1fr; margin-top: 10px; font-size: 12px; }
.fm-card-foot { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--line); font-size: 11px; }
.fm-compare { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; }
.fm-compare figure { margin: 0; }
.fm-compare img { height: auto; max-height: 62vh; }
.fm-none { display: flex; align-items: center; justify-content: center; height: 200px; border: 1px dashed var(--line); border-radius: var(--radius-sm); color: var(--faint); font-size: 12px; }
@media (max-width: 760px) {
  .fm-grid { grid-template-columns: minmax(0, 1fr); }
  .fm-compare { grid-template-columns: minmax(0, 1fr); }
}
