:root {
  --bg: #f6f7f9; --surface: #ffffff; --text: #1a1a2e; --muted: #6b7080; --line: #e3e5ea;
  --accent: #2f6fdf; --accent-ink: #ffffff; --soft: #eef2fb;
  --go: #1f8a4c; --maybe: #b7791f; --nogo: #c53030; --warn-bg: #fff6e5;
  --radius: 10px; --mono: ui-monospace, SFMono-Regular, Menlo, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111318; --surface: #1a1d24; --text: #e8e9ee; --muted: #9398a6; --line: #2b2f39;
    --accent: #6b9bff; --accent-ink: #0d1020; --soft: #1f2636;
    --go: #4cc47f; --maybe: #e0a84a; --nogo: #f07171; --warn-bg: #2b2415;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif; }
[hidden] { display: none !important; }
h1 { font-size: 20px; margin: 0 0 4px; }
h2 { font-size: 17px; margin: 0 0 10px; }
h3 { font-size: 14px; margin: 16px 0 8px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
a { color: var(--accent); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.err { color: var(--nogo); min-height: 1.2em; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
input[type=text], input[type=password], input[type=number], textarea {
  font: inherit; color: inherit; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; width: 100%;
}
.row input[type=text] { flex: 1; min-width: 180px; width: auto; }
textarea { resize: vertical; }
label { display: block; font-weight: 600; margin-bottom: 6px; }
label.check { display: inline-flex; gap: 6px; font-weight: 400; margin: 0; }
button { font: inherit; cursor: pointer; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--text); padding: 8px 14px; }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
button:disabled { opacity: .55; cursor: default; }
button.link { border: 0; background: none; color: var(--accent); padding: 0; }
button.x { border: 0; background: none; padding: 0 0 0 6px; color: var(--muted); }

.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: 100%; max-width: 360px; }
.login-card button { width: 100%; margin-top: 12px; }

.top { position: sticky; top: 0; z-index: 5; background: var(--surface); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 16px; padding: 10px 16px; flex-wrap: wrap; }
.brand { font-weight: 700; }
.tabs { display: flex; gap: 4px; flex: 1; overflow-x: auto; }
.tab { border: 0; background: none; padding: 6px 10px; color: var(--muted); white-space: nowrap; }
.tab.active { color: var(--text); background: var(--soft); }
main { max-width: 1100px; margin: 0 auto; padding: 16px; }
footer { max-width: 1100px; margin: 0 auto; padding: 8px 16px 32px; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.chip { display: inline-flex; align-items: center; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 3px 10px; font-size: 13px; }
button.chip { cursor: pointer; }

.scores { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.tile .label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.tile .val { font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; }
.tile .sub { font-size: 12px; color: var(--muted); }
.meter { height: 4px; background: var(--line); border-radius: 2px; margin-top: 6px; overflow: hidden; }
.meter > i { display: block; height: 100%; background: var(--accent); }

.band { display: inline-block; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; font-size: 13px; padding: 3px 10px; border-radius: 6px; border: 1.5px solid currentColor; }
.band.go { color: var(--go); } .band.maybe { color: var(--maybe); } .band.no-go { color: var(--nogo); }
.warn { background: var(--warn-bg); border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; font-size: 13px; margin: 8px 0; }
.flag { font-size: 12px; font-weight: 600; border-radius: 6px; padding: 2px 8px; background: var(--soft); }

.tables { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 1000px) { .tables { grid-template-columns: 1fr 1fr; } }
.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 600; font-size: 12px; white-space: nowrap; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td.name { min-width: 160px; }
td.price { white-space: nowrap; }
td.name img { width: 22px; height: 22px; border-radius: 5px; vertical-align: middle; margin-right: 6px; }
tr.hi td { background: var(--warn-bg); }
.yes { color: var(--go); font-weight: 600; }

details summary { cursor: pointer; color: var(--muted); font-size: 13px; }
dl.kv { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; font-size: 13px; margin: 8px 0 0; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; font-variant-numeric: tabular-nums; }

.theme { border-left: 3px solid var(--accent); padding: 4px 0 4px 12px; margin: 12px 0; }
.theme .t { font-weight: 600; }
.theme blockquote { margin: 6px 0 0; font-size: 13px; color: var(--muted); }
.verdict p { margin: 6px 0; }
.verdict ul { margin: 4px 0 8px; padding-left: 20px; }

.progress { font-size: 13px; }
.progress li.done { color: var(--muted); }
.progress li.run { font-weight: 600; }
.progress li.fail { color: var(--nogo); }

svg.chart { width: 100%; height: 220px; display: block; }
svg.chart .axis { stroke: var(--line); }
svg.chart text { fill: var(--muted); font-size: 11px; }
.legend { display: flex; gap: 14px; font-size: 12px; flex-wrap: wrap; }
.legend i { display: inline-block; width: 10px; height: 3px; vertical-align: middle; margin-right: 4px; }
.spin { display: inline-block; width: 12px; height: 12px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: s 0.8s linear infinite; vertical-align: -2px; }
@keyframes s { to { transform: rotate(360deg); } }

.savebox { border: 1px solid var(--line); border-radius: 8px; padding: 12px; margin: 10px 0; background: var(--bg); }
.saved-ok { margin: 10px 0; font-size: 13px; color: var(--go); }
.snapshot { border-left: 4px solid var(--accent); }
.snapshot h1 { font-size: 22px; }
.note { margin-top: 10px; padding: 8px 12px; background: var(--soft); border-radius: 8px; white-space: pre-wrap; font-size: 14px; }

.kind { display: inline-block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: 1px 7px; border-radius: 5px; vertical-align: 1px; }
.kind.build { color: var(--go); border: 1px solid var(--go); }
.kind.avoid { color: var(--nogo); border: 1px solid var(--nogo); }
.theme.avoid { border-left-color: var(--nogo); }
.theme.build { border-left-color: var(--go); }
.lesson { font-size: 13px; margin-top: 4px; font-weight: 600; }
.plan { white-space: pre-wrap; font-size: 14px; }

.call { display: inline-block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; padding: 1px 7px; border-radius: 5px; border: 1px solid currentColor; }
.call.target { color: var(--go); } .call.disclaim { color: var(--maybe); } .call.skip { color: var(--nogo); }
ul.calls li { margin: 4px 0; }

.viewtabs { display: inline-flex; gap: 2px; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 2px; margin: 10px 0 4px; flex-wrap: wrap; }
.viewtabs .vt { border: 0; background: none; padding: 5px 12px; border-radius: 6px; font-size: 13px; color: var(--muted); }
.viewtabs .vt.on { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: 0 0 0 1px var(--line); }
.printonly { display: none; }
input.pop { width: 70px; padding: 4px 6px; text-align: right; }
select { font: inherit; color: inherit; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }

@media print {
  .printonly { display: block !important; }
  :root { --bg: #fff; --surface: #fff; --text: #111; --muted: #555; --line: #ccc; --soft: #f1f3f7; --warn-bg: #fff6e5; --accent: #2f6fdf; --go: #1f7a45; --maybe: #9a6512; --nogo: #b02a2a; }
  body { background: #fff; font-size: 12px; }
  .top, footer, .noprint, #tab-reports #reportsList, button { display: none !important; }
  main { padding: 0; max-width: none; }
  .card { break-inside: avoid; border-color: #ccc; }
  .tables { grid-template-columns: 1fr; }
  .scroll { overflow: visible; }
  a { color: inherit; text-decoration: none; }
  details { display: none; }
  button.link[data-frozen], button.link[data-open] { display: inline !important; color: inherit; }
}
