/* Base: tokens, reset, keyframes, top bar, buttons, shell, page head, panels and grids. Shared by the panel and the docs. */
/* ============ tokens ============
   Flat system: warm paper, ink, one orange. Elevation is a 1px border, never a shadow.
   Colour is reserved for meaning: tiers (t*), series (c*), verdicts (v*). */
:root {
  --bg: #f4f2ec;
  --surface: #ffffff;
  --raised: #f8f6f1;
  --ink: #191713;
  --ink-2: #45413a;
  --muted: #68635a;
  --line: #e0dcd2;
  --line-strong: #c4bfb2;
  --primary: #f0590e;
  --primary-hover: #ff6f2a;
  --primary-soft: #fdeadd;
  --primary-ink: #a83a00;
  --on-primary: #ffffff;
  --side-bg: #191713; --side-ink: #f1eee7; --side-muted: #aaa397; --side-line: #35322c; --side-hover: #2a2722;
  --c1: #f0590e; --c1-soft: #fdeadd; --c1-ink: #a83a00;
  --c2: #2456d6; --c2-soft: #e6edfc; --c2-ink: #1c47b8;
  --c3: #6d3bd1; --c3-soft: #eee7fb; --c3-ink: #5a2bb8;
  --c4: #0a8577; --c4-soft: #dcf2ee; --c4-ink: #076a5f;
  --c5: #c2256e;
  --t0: #9a958a; --t1: #e3a008; --t2: #2456d6; --t3: #0a8577; --t4: #23923f;
  --ti0: #545048; --ti1: #7a5300; --ti2: #1c47b8; --ti3: #076a5f; --ti4: #176b2c;
  --v-ok: #1a7f37; --v-warn: #f0b400; --v-risk: #e8590c; --v-spam: #b3141f;
  --vi-ok: #14652b; --vi-warn: #765300; --vi-risk: #a23a00; --vi-spam: #9d1019;
  --von-ok: #ffffff; --von-warn: #191713; --von-risk: #191713; --von-spam: #ffffff;
  --good: #14652b; --good-soft: #e0f1e4;
  --bad: #9d1019; --bad-soft: #fbe6e7;
  --warn: #765300; --warn-soft: #fbf0cf;
  --gold: #e3a008; --silver: #a8a396; --bronze: #c0763c;
  --grid: #ece8df;
  --shadow: none;
  --radius: 8px;
  --ease: cubic-bezier(.16, 1, .3, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  --font: "Hanken Grotesk", "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
  --display: "Bricolage Grotesque", "Hanken Grotesk", "Segoe UI", system-ui, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #100f0d;
  --surface: #191816;
  --raised: #211f1c;
  --ink: #f1eee7;
  --ink-2: #cbc6bb;
  --muted: #a09a8e;
  --line: #302d28;
  --line-strong: #4a463f;
  --primary: #ff7a33;
  --primary-hover: #ff9154;
  --primary-soft: #3a2010;
  --primary-ink: #ffa26b;
  --on-primary: #ffffff;
  --side-bg: #0a0908; --side-ink: #f1eee7; --side-muted: #a09a8e; --side-line: #2a2723; --side-hover: #1d1b18;
  --c1: #ff7a33; --c1-soft: #3a2010; --c1-ink: #ffa26b;
  --c2: #6a98ff; --c2-soft: #17264a; --c2-ink: #93b4ff;
  --c3: #a985ff; --c3-soft: #281c4a; --c3-ink: #c3a9ff;
  --c4: #2fc4b2; --c4-soft: #0d302c; --c4-ink: #62d9ca;
  --c5: #f472b6;
  --t0: #7b766b; --t1: #f2c230; --t2: #6a98ff; --t3: #2fc4b2; --t4: #4cc764;
  --ti0: #c0baad; --ti1: #f2c230; --ti2: #93b4ff; --ti3: #62d9ca; --ti4: #6edc84;
  --v-ok: #4cc764; --v-warn: #f2c230; --v-risk: #ff7b3d; --v-spam: #ff5c66;
  --vi-ok: #6edc84; --vi-warn: #f2c230; --vi-risk: #ff9a68; --vi-spam: #ff8990;
  --von-ok: #10140f; --von-warn: #191713; --von-risk: #191713; --von-spam: #190a0b;
  --good: #6edc84; --good-soft: #12301a;
  --bad: #ff8990; --bad-soft: #3b1517;
  --warn: #f2c230; --warn-soft: #382c08;
  --gold: #f2c230; --silver: #b5afa2; --bronze: #dc955d;
  --grid: #2b2823;
  color-scheme: dark;
}

/* ============ base ============ */
* { box-sizing: border-box; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
html { height: 100%; }
body { margin: 0; min-height: 100%; background: var(--bg); color: var(--ink); font: 400 14px/1.45 var(--font); font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased; }
::selection { background: var(--primary); color: var(--on-primary); }
input, textarea, select, button { font: inherit; color: inherit; caret-color: var(--primary); }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 4px; }
svg { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
h1, h2, h3, p, ul, dl, dd { margin: 0; }
ul { padding: 0; list-style: none; }
a { color: inherit; }
[hidden] { display: none !important; }
kbd.key { font: 600 11px/1 var(--font); color: var(--ink-2); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 4px; padding: 4px 6px; flex: none; }
mark { background: color-mix(in srgb, var(--v-warn) 45%, transparent); color: inherit; border-radius: 2px; padding: 0 1px; }

@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes grow { from { width: 0; } }
@keyframes growY { from { transform: scaleY(0); } }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: scale(.6); } to { opacity: 1; transform: none; } }
@keyframes sweep { from { stroke-dasharray: 0 999; } }
@keyframes shine { to { background-position: -200% 0; } }
@keyframes pulse { 50% { opacity: .35; } }
@keyframes slide { from { transform: translateX(-100%); } to { transform: translateX(350%); } }
@keyframes spin { to { transform: rotate(360deg); } }
/* ============ top bar ============ */
.loadbar { position: fixed; inset: 0 0 auto 0; height: 2px; z-index: 60; overflow: hidden; opacity: 0; transition: opacity .3s .15s; pointer-events: none; }
.loadbar::before { content: ""; position: absolute; inset: 0; width: 30%; background: var(--primary); }
.loadbar.on { opacity: 1; transition-delay: 0s; }
.loadbar.on::before { animation: slide 1.1s ease-in-out infinite; }
.top { position: sticky; top: 0; z-index: 20; height: 56px; display: flex; align-items: center; gap: 16px; padding: 0 20px 0 0; background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; width: 224px; height: 100%; padding: 0 16px; flex: none; background: var(--side-bg); color: var(--side-ink); text-decoration: none; font: 700 22px/1 var(--display); letter-spacing: -0.02em; }
.brand img { width: 32px; height: 32px; flex: none; transition: transform .5s var(--spring); }
.brand:hover img { transform: rotate(-8deg) scale(1.06); }
.brand span { color: var(--side-ink); padding-bottom: 2px; }
.brand:focus-visible { outline-color: var(--side-ink); outline-offset: -4px; }
.search { display: flex; align-items: center; gap: 8px; flex: 1; max-width: 640px; background: var(--raised); border: 1px solid var(--line-strong); border-radius: 6px; padding: 3px 3px 3px 12px; transition: border-color .15s, background .15s; }
.search:focus-within { border-color: var(--ink); background: var(--surface); }
.search > svg { width: 17px; height: 17px; color: var(--muted); flex: none; }
.search input { flex: 1; min-width: 0; border: 0; background: none; outline: 0; padding: 7px 4px; font-size: 14.5px; }
.search kbd { transition: opacity .15s; }
.search:focus-within kbd { opacity: 0; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.icon-btn { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 6px; border: 1px solid var(--line-strong); background: var(--surface); cursor: pointer; color: var(--ink-2); transition: background .15s, color .15s, transform .12s; }
.icon-btn:hover { background: var(--raised); color: var(--ink); }
.icon-btn:active { transform: scale(.94); }
.icon-btn svg { width: 17px; height: 17px; transition: transform .4s var(--spring); }
.icon-btn:hover svg { transform: rotate(24deg); }
:root[data-theme="dark"] .moon, :root:not([data-theme="dark"]) .sun { display: none; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; white-space: nowrap; text-decoration: none; padding: 7px 12px; border-radius: 6px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); font-weight: 600; font-size: 13px; line-height: 1.35; cursor: pointer; transition: background .15s, border-color .15s, transform .12s; }
.btn svg { width: 15px; height: 15px; flex: none; transition: transform .2s var(--ease); }
.btn:hover { background: var(--raised); border-color: var(--ink); }
.btn:hover svg:last-child:not(:first-child) { transform: translateX(3px); }
.btn:active { transform: scale(.97); }
.btn.small { padding: 5px 10px; font-size: 12.5px; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); font-weight: 700; padding: 8px 16px; font-size: 13.5px; }
.btn.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn:disabled { opacity: .6; cursor: progress; transform: none; }
.btn.wide { width: 100%; padding: 10px 14px; }
.btn[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.ghost-btn { width: 28px; height: 28px; display: grid; place-items: center; border: 0; background: none; border-radius: 6px; color: inherit; opacity: .7; cursor: pointer; transition: opacity .15s, transform .12s; flex: none; }
.ghost-btn:hover { opacity: 1; }
.ghost-btn:active { transform: scale(.88); }
.ghost-btn svg { width: 16px; height: 16px; }
.ghost-btn.done { opacity: 1; color: #4cc764; }
.text-btn { border: 0; background: none; padding: 2px 4px; border-radius: 4px; color: var(--primary-ink); font-weight: 600; font-size: 12.5px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: color-mix(in srgb, currentColor 40%, transparent); }
.text-btn:hover { text-decoration-color: currentColor; }
/* ============ shell ============ */
.shell { display: grid; grid-template-columns: 224px minmax(0, 1fr); align-items: start; }
.side { position: sticky; top: 56px; height: calc(100vh - 56px); padding: 10px 10px 12px; display: flex; flex-direction: column; gap: 16px; background: var(--side-bg); color: var(--side-ink); overflow-y: auto; scrollbar-color: var(--side-line) transparent; }
.nav { display: grid; gap: 1px; }
.nav-label { font-size: 10.5px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--side-muted); padding: 14px 10px 6px; }
.nav a { position: relative; display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 6px; color: var(--side-ink); text-decoration: none; font-weight: 500; white-space: nowrap; transition: background .15s, color .15s; }
.nav a svg { width: 17px; height: 17px; flex: none; color: var(--side-muted); transition: color .15s; }
.nav a:hover { background: var(--side-hover); }
.nav a:hover svg { color: var(--side-ink); }
.nav a:focus-visible { outline-color: var(--side-ink); }
.nav a[aria-current="page"], .nav a.active { background: var(--primary); color: var(--on-primary); font-weight: 700; }
.nav a[aria-current="page"] svg, .nav a.active svg { color: var(--on-primary); }
.badge { margin-left: auto; font-size: 11px; font-weight: 700; background: var(--side-hover); color: var(--side-ink); border-radius: 4px; padding: 1px 6px; }
.nav a[aria-current="page"] .badge, .nav a.active .badge { background: var(--on-primary); color: var(--primary); }
.side-card { margin-top: auto; border-top: 1px solid var(--side-line); padding-top: 4px; }
.sources { padding: 0 10px; display: grid; gap: 7px; font-size: 12px; }
.sources div { display: flex; justify-content: space-between; gap: 8px; }
.sources dt { color: var(--side-muted); }
.sources dd { color: var(--side-ink); font-weight: 600; text-align: right; }
.sources dd.ok::before, .sources dd.wait::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 6px; background: #4cc764; }
.sources dd.wait::before { background: #f2c230; animation: pulse 1.2s ease-in-out infinite; }
.side-hint { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--side-muted); margin: 12px 10px 0; }
.side-hint kbd.key { background: var(--side-hover); border-color: var(--side-line); color: var(--side-ink); }

.main { padding: 20px 24px 56px; min-width: 0; max-width: 1480px; display: grid; }
.view { display: grid; gap: 14px; }
.notice { display: flex; gap: 10px; align-items: center; background: var(--warn-soft); color: var(--ink); border: 1px solid color-mix(in srgb, var(--v-warn) 50%, transparent); border-radius: 6px; padding: 9px 12px; margin-bottom: 14px; font-size: 13px; }
.notice svg { width: 17px; height: 17px; color: var(--warn); flex: none; }

/* ============ page head ============ */
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.page-title { margin-right: auto; min-width: 0; }
h1 { font: 700 26px/1.15 var(--display); letter-spacing: -0.02em; overflow-wrap: anywhere; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.page-title p { color: var(--muted); font-size: 13px; margin-top: 3px; }
h2 { font: 700 15px/1.3 var(--display); letter-spacing: -0.005em; }
.favicon { width: 52px; height: 52px; border-radius: 8px; display: grid; place-items: center; flex: none; background: #fff; color: #191713; font: 700 22px/1 var(--display); text-transform: uppercase; overflow: hidden; border: 1px solid var(--line); }
.favicon img { width: 30px; height: 30px; animation: pop .3s var(--spring); }
.favicon.sm { width: 40px; height: 40px; font-size: 17px; }
.favicon.sm img { width: 24px; height: 24px; }
.tag { font: 600 11.5px/1.4 var(--font); letter-spacing: 0; color: var(--ink-2); background: var(--raised); border: 1px solid var(--line); border-radius: 4px; padding: 1px 7px; white-space: nowrap; }
.tag:empty { display: none; }
.tag.on { background: var(--good-soft); color: var(--good); border-color: transparent; }
.hint { color: var(--muted); font-size: 12px; }
.link { color: var(--primary-ink); font-weight: 600; font-size: 13px; text-decoration: none; display: inline-flex; align-items: center; gap: 2px; white-space: nowrap; }
.link svg { width: 15px; height: 15px; transition: transform .2s var(--ease); }
.link:hover { text-decoration: underline; text-underline-offset: 3px; }
.link:hover svg { transform: translateX(3px); }

/* ============ panels & grids ============ */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; min-width: 0; }
.card.flush { padding: 0; overflow: hidden; }
.pad { padding: 12px 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: -16px -18px 14px; padding: 9px 18px; min-height: 46px; border-bottom: 1px solid var(--line); }
.card-head.wrap { flex-wrap: wrap; }
.card-head.pad, .card.flush > .card-head { margin: 0; }
.card-title { display: flex; align-items: baseline; gap: 10px; min-width: 0; flex-wrap: wrap; }
.card-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 9px 18px; border-top: 1px solid var(--line); background: var(--raised); color: var(--muted); font-size: 12.5px; }
.card-foot:has(> span:empty):not(:has(> .btn:not([hidden]))) { display: none; }
.grid { display: grid; gap: 14px; }
.g-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.g-main { grid-template-columns: minmax(340px, 5fr) minmax(0, 7fr); }
.g-wide { grid-template-columns: minmax(0, 7fr) minmax(300px, 5fr); }
.g-main > .card, .g-wide > .card { display: flex; flex-direction: column; }

.ico { width: 30px; height: 30px; border-radius: 6px; display: grid; place-items: center; flex: none; }
.ico svg { width: 17px; height: 17px; }
.ico.c1 { background: var(--c1-soft); color: var(--c1-ink); } .ico.c2 { background: var(--c2-soft); color: var(--c2-ink); } .ico.c3 { background: var(--c3-soft); color: var(--c3-ink); } .ico.c4 { background: var(--c4-soft); color: var(--c4-ink); }
/* ============ theme switch ============ */
::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
::view-transition-new(root) { z-index: 2; }

/* ============ responsive ============ */
@media (max-width: 1100px) {
  .g-main, .g-wide { grid-template-columns: minmax(0, 1fr); }
}
.nav-burger, .nav-scrim { display: none; }
@media (max-width: 920px) {
  .top { padding-right: 10px; gap: 8px; }
  .nav-burger { display: grid; flex: none; margin-left: 10px; }
  .brand { width: auto; padding: 0 6px; background: transparent; }
  .brand-word { display: none; }
  .brand span, .search kbd { display: none; }
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; top: 0; left: 0; bottom: 0; z-index: 70; width: min(290px, 84vw); height: auto; padding: 16px 12px; transform: translateX(-102%); transition: transform .26s var(--ease); box-shadow: none; }
  body.nav-open .side { transform: none; box-shadow: 0 0 60px rgba(0, 0, 0, .45); }
  body.nav-open { overflow: hidden; }
  .nav-scrim { display: block; position: fixed; inset: 0; z-index: 65; background: rgba(18, 14, 8, .5); animation: fade .2s ease both; }
  .nav-scrim[hidden] { display: none; }
  .main { padding: 14px 12px 40px; }
}
@media (max-width: 700px) {
  .g-2 { grid-template-columns: minmax(0, 1fr); }
  h1 { font-size: 22px; }
}
@media (max-width: 640px) {
  .top { flex-wrap: wrap; height: auto; position: relative; padding: 0 10px 10px 0; row-gap: 6px; }
  .brand { height: 52px; }
  .top-right { order: 2; margin-left: auto; height: 52px; }
  .top-right .icon-btn, .top-right .um-btn { align-self: center; }
  .search { order: 3; flex: 1 0 calc(100% - 10px); max-width: none; margin: 0 0 0 10px; }
  .um-btn .um-plan { display: none; }
}
@media (max-width: 520px) {
  .search .btn { padding: 8px 10px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: .01ms !important; }
  .chart .line, .spark .line, .chart .fit { stroke-dashoffset: 0; }
}

/* Sidebar brand: the wordmark with the mole as its "o"; the round emblem takes over where the sidebar collapses. */
.brand img.brand-word { width: auto; height: 46px; }
.brand:hover img.brand-word { transform: none; }
.brand img.brand-badge { display: none; }
@media (max-width: 900px) {
  .brand img.brand-word { display: none; }
  .brand img.brand-badge { display: block; }
}

/* Digging pose in motion: the body rocks into the soil and two clumps fly off behind it. */
.kosto-digging { position: relative; }
.kosto-digging .kosto-img { transform-origin: 55% 88%; animation: kosto-dig .62s cubic-bezier(.45, 0, .55, 1) infinite alternate; }
.kosto-digging::before, .kosto-digging::after {
  content: ""; position: absolute; left: 6%; top: 46%; width: calc(var(--ks, 96px) * .07); height: calc(var(--ks, 96px) * .07);
  border-radius: 45% 55% 50% 50%; background: var(--primary, #f0590e); opacity: 0; pointer-events: none;
  animation: kosto-clump 1.24s cubic-bezier(.2, .7, .4, 1) infinite;
}
.kosto-digging::after { left: 14%; top: 52%; width: calc(var(--ks, 96px) * .05); height: calc(var(--ks, 96px) * .05); animation-delay: .62s; }
@keyframes kosto-dig {
  from { transform: rotate(-3.5deg) translateY(0); }
  to { transform: rotate(3deg) translateY(calc(var(--ks, 96px) * .035)); }
}
@keyframes kosto-clump {
  0% { opacity: 0; transform: translate(0, 0) scale(.6); }
  15% { opacity: 1; }
  100% { opacity: 0; transform: translate(calc(var(--ks, 96px) * -.28), calc(var(--ks, 96px) * -.34)) scale(1.1) rotate(160deg); }
}
@media (prefers-reduced-motion: reduce) {
  .kosto-digging .kosto-img, .kosto-digging::before, .kosto-digging::after { animation: none; }
}
.notice.notice-ok { background: color-mix(in srgb, var(--v-ok) 14%, var(--surface)); border-color: color-mix(in srgb, var(--v-ok) 50%, transparent); }
.notice.notice-ok svg { color: var(--v-ok); fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* Phones: a wide table scrolls inside its own box (core/scrollwrap.js); the faded edge shows there is more. */
.tscroll { position: relative; max-width: 100%; }
.tscroll-in { overflow-x: auto; overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch; }
.tscroll::before, .tscroll::after { content: ""; position: absolute; top: 0; bottom: 0; width: 28px; z-index: 2; pointer-events: none; opacity: 0; transition: opacity .2s; }
.tscroll::before { left: 0; background: linear-gradient(to right, var(--surface, #fff), transparent); }
.tscroll::after { right: 0; background: linear-gradient(to left, var(--surface, #fff), transparent); }
.tscroll.can-l::before, .tscroll.can-r::after { opacity: 1; }
