:root {
  --paper: #F5F6F4; --surface: #FFFFFF; --ink: #18212B; --muted: #5D6972; --line: #DBE0DC;
  --accent: #1F5D8A; --accent-soft: #E4EEF5; --hl: #FFE07A; --ok: #1E7A54; --warn: #A86300; --bad: #B3432D;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #12171C; --surface: #1A2128; --ink: #E5E9EC; --muted: #98A4AC; --line: #2B353D;
    --accent: #86BCE4; --accent-soft: #1E2E3B; --hl: #6E5C14; --ok: #5BC596; --warn: #E3A74A; --bad: #E27C67;
    color-scheme: dark;
  }
}
*, *::before, *::after { box-sizing: border-box }
[hidden] { display: none !important }
body {
  margin: 0; min-height: 100vh; background: var(--paper); color: var(--ink);
  font: 15px/1.6 "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  font-variant-numeric: tabular-nums;
}
button, input, select, textarea { font: inherit; color: inherit }
button { cursor: pointer }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px }

.app { display: grid; grid-template-columns: 216px 1fr; min-height: 100vh }
.side {
  position: sticky; top: 0; align-self: start; height: 100vh; overflow: auto; border-right: 1px solid var(--line);
  background: var(--surface); padding: 20px 14px; display: flex; flex-direction: column; gap: 20px;
}
.brand { font-weight: 700; font-size: 17px; letter-spacing: .02em }
.pick { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted) }
.pick select { padding: 7px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); font-size: 14px; color: var(--ink) }
nav { display: flex; flex-direction: column; gap: 2px }
nav a { text-decoration: none; padding: 8px 10px; border-radius: 6px; color: var(--muted) }
nav a:hover { color: var(--ink) }
nav a.on { background: var(--accent-soft); color: var(--accent); font-weight: 600 }
.content { min-width: 0 }
.topbar { display: flex; justify-content: flex-end; align-items: center; gap: 12px; padding: 14px clamp(16px, 4vw, 44px) 0; max-width: 1180px }
main { padding: 12px clamp(16px, 4vw, 44px) 60px; min-width: 0; max-width: 1180px }

h1 { font-size: 22px; margin: 0 0 4px }
h2 { font-size: 16px; margin: 32px 0 10px }
.sub { color: var(--muted); margin: 0 0 24px; max-width: 64ch }
.tbl { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; background: var(--surface) }
table { border-collapse: collapse; width: 100%; min-width: 620px }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle }
th { font-size: 13px; color: var(--muted); font-weight: 500; background: var(--paper); white-space: nowrap }
select.f { min-width: 72px }
tr:last-child td { border-bottom: 0 }
tr.off td { color: var(--muted) }
td.pre { white-space: pre-wrap }

.btn { border: 0; background: var(--accent); color: var(--surface); padding: 7px 14px; border-radius: 6px; font-size: 14px; white-space: nowrap }
.btn.ghost { background: none; color: var(--ink); border: 1px solid var(--line) }
.btn.sm { padding: 4px 10px; font-size: 13px }
.btn:disabled { opacity: .45; cursor: not-allowed }
.link { border: 0; background: none; color: var(--accent); padding: 0; font-size: 13px; text-decoration: none }
.link.danger { color: var(--bad) }
.link.muted { color: var(--muted); margin-left: 4px }
.link.muted:hover { color: var(--ink) }
a.btn { display: inline-block; text-decoration: none }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center }
.between { justify-content: space-between }
.nowrap { white-space: nowrap }
input[type=text], input[type=password], input[type=number], input[type=url], textarea, select.f {
  border: 1px solid var(--line); border-radius: 6px; padding: 7px 9px; background: var(--surface); min-width: 0;
}
textarea { width: 100%; resize: vertical }
.full { width: 100% }
.tag { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 10px; border: 1px solid var(--line); color: var(--muted); white-space: nowrap }
.muted { color: var(--muted) }
.small { font-size: 13px }
.ok { color: var(--ok) }
.warn { color: var(--warn) }
.bad { color: var(--bad) }
.note { font-size: 13px; color: var(--muted); border-left: 3px solid var(--line); padding: 4px 0 4px 12px; margin: 14px 0; max-width: 72ch }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 16px }
.panel + .panel, .panel + .tbl, .tbl + .panel { margin-top: 16px }
.form { display: flex; flex-direction: column; gap: 14px; max-width: 560px }
.form label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted) }
.form label > input, .form label > textarea { color: var(--ink); font-size: 15px }
mark { background: var(--hl); color: inherit; padding: 0 3px; border-radius: 2px }

.login { min-height: 100vh; display: grid; place-items: center; padding: 16px }
.login-box { width: min(340px, 100%); display: flex; flex-direction: column; gap: 14px }
.login-box label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted) }
.login-box input { color: var(--ink); font-size: 15px }
.login-box p { margin: 0; min-height: 1.4em }

#toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); max-width: calc(100% - 32px);
  background: var(--ink); color: var(--paper); padding: 8px 16px; border-radius: 6px; font-size: 14px;
  opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 30;
}
#toast.show { opacity: 1 }

.overlay { position: fixed; inset: 0; background: rgba(10, 15, 20, .38); display: flex; justify-content: flex-end; z-index: 20 }
.drawer { background: var(--surface); width: min(640px, 100%); height: 100%; overflow: auto; padding: 22px 22px 40px }
.drawer h2 { margin-top: 0 }
.drawer .form { max-width: none }
.answer { background: var(--paper); border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; line-height: 1.8; white-space: pre-wrap; max-height: 360px; overflow: auto }
.bar { height: 6px; background: var(--line); border-radius: 3px; width: 160px; display: inline-block; vertical-align: middle; margin-right: 8px; overflow: hidden }
.bar i { display: block; height: 100%; background: var(--accent) }
.checks { display: flex; flex-wrap: wrap; gap: 8px 20px; font-size: 14px }
.checks label { display: flex; flex-direction: row; gap: 6px; align-items: center; color: var(--ink); font-size: 14px }
.cn-off { color: var(--bad); font-weight: 600 }
.meta { font-size: 13px; color: var(--muted); margin: 0 0 12px }
td .small { display: block }

.strip { display: flex; flex-wrap: wrap; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); overflow: hidden }
.tile { flex: 1 1 150px; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 14px 16px; border: 0; border-right: 1px solid var(--line); background: none; text-align: left }
.tile:last-child { border-right: 0 }
.tile:hover { background: var(--accent-soft) }
.tile.on { background: var(--accent-soft); box-shadow: inset 0 -3px 0 var(--accent) }
.tile strong { font-size: 24px; font-weight: 600 }
.tile span { font-size: 13px; color: var(--muted) }
.tile small { font-size: 12px; color: var(--muted) }
.matrix td { padding: 6px 8px }
.cell { display: flex; flex-direction: column; align-items: flex-start; width: 100%; border: 0; border-left: 3px solid var(--line); background: none; padding: 4px 8px; font-size: 13px; text-align: left; color: var(--ink) }
.cell small { font-size: 11px; color: var(--muted) }
.cell small.bad { color: var(--bad) }
.cell.ok { border-left-color: var(--ok); color: var(--ok); font-weight: 600 }
.cell.no { color: var(--muted) }
.cell.warn { border-left-color: var(--warn); color: var(--warn) }
.cell:hover { background: var(--accent-soft) }
tr.click { cursor: pointer }
tr.click:hover td { background: var(--accent-soft) }
.facts { margin: 0; padding-left: 20px; font-size: 14px }
td strong + .small { display: block }

@media (max-width: 820px) {
  .app { grid-template-columns: 1fr }
  .side { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); gap: 12px }
  nav { flex-direction: row; overflow-x: auto }
  nav a { white-space: nowrap }
}
@media (prefers-reduced-motion: reduce) { #toast { transition: none } }
