/* Layout: top bar + single column of cards, max 1180px; ledger-like tables, numbers right-aligned. */
:root {
  --bg: #f3f5f7; --panel: #ffffff; --ink: #14212b; --muted: #5b6b78; --line: #dde3e8;
  --accent: #0f5c7a; --accent-ink: #ffffff; --accent-soft: #e2eef3; --sun: #f0b429;
  --ok: #1d7a4c; --warn: #a15c00; --bad: #b42318;
  --font: "Be Vietnam Pro", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --radius: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0e151b; --panel: #151f27; --ink: #e6edf2; --muted: #93a4b1; --line: #26343f;
    --accent: #5cb6d9; --accent-ink: #06202b; --accent-soft: #173341; --sun: #f5c451;
    --ok: #55c58c; --warn: #f0a94a; --bad: #f2776c; color-scheme: dark; }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 15px; line-height: 1.5; -webkit-text-size-adjust: 100%; }
a { color: var(--accent); text-underline-offset: 2px; }
.wrap { max-width: 1180px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }

.top { background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.top-in { display: flex; align-items: center; gap: 20px; padding-block: 10px; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; color: var(--ink); text-decoration: none; letter-spacing: -.01em; }
.brand em { font-style: normal; font-weight: 500; color: var(--muted); }
.brand.big { font-size: 20px; }
.logo { width: 30px; height: 30px; border-radius: 8px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-weight: 700; position: relative; }
.logo::after { content: ""; position: absolute; width: 8px; height: 8px; border-radius: 50%; background: var(--sun); top: 5px; right: 5px; }
.nav { display: flex; gap: 2px; align-items: center; overflow-x: auto; flex: 1; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a, .linkbtn { padding: 7px 11px; border-radius: 8px; color: var(--muted); text-decoration: none; white-space: nowrap; font: inherit; font-size: 14px; font-weight: 500; }
.nav a:hover { background: var(--accent-soft); color: var(--ink); }
.nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
.nav form { margin-left: auto; }
.linkbtn { background: none; border: 0; cursor: pointer; color: var(--accent); padding: 0 4px; }
.nav .linkbtn { color: var(--muted); padding: 7px 11px; }

.main { padding-block: 24px 40px; display: flex; flex-direction: column; gap: 18px; }
.head { display: flex; flex-direction: column; gap: 6px; }
h1 { font-size: 28px; line-height: 1.2; margin: 0; letter-spacing: -.02em; text-wrap: balance; }
h2 { font-size: 16px; margin: 0; font-weight: 600; }
.lead { margin: 0; color: var(--muted); max-width: 72ch; }
.meta { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
.lead b { color: var(--ink); font-variant-numeric: tabular-nums; }
.crumb { margin: 0; font-size: 13px; }
.muted { color: var(--muted); } .small { font-size: 13px; } .strong { font-weight: 600; }
.ok-t { color: var(--ok); } .bad-t { color: var(--bad); }
.inline { display: inline; }
.foot { color: var(--muted); font-size: 12px; padding-block: 0 24px; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr)); gap: 12px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tile .lbl { font-size: 13px; color: var(--muted); }
.tile .num { font-size: 30px; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.2; }
.tile .sub { font-size: 12px; color: var(--muted); }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.card.danger { border-color: color-mix(in srgb, var(--bad) 35%, var(--line)); }
.cardhead { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.note { margin: 0; color: var(--muted); font-size: 13px; }
.empty { margin: 0; color: var(--muted); font-size: 14px; padding: 12px 0; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 18px; }
.chartbox { position: relative; height: 260px; }

.tscroll { overflow-x: auto; margin: 0 -4px; }
.tscroll.short { max-height: 320px; overflow-y: auto; }
.tbl { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: 14px; }
.tbl th { text-align: left; font-size: 12px; font-weight: 500; color: var(--muted); padding: 8px; border-bottom: 1px solid var(--line); white-space: nowrap; position: sticky; top: 0; background: var(--panel); }
.tbl td { padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .r { text-align: right; }
.tbl td.title { min-width: 200px; }
.tbl td:first-child { min-width: 8.5rem; }
.tbl .nowrap { white-space: nowrap; }

.pill { display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: 12px; font-weight: 500; white-space: nowrap; border: 1px solid currentColor; }
.pill.ok { color: var(--ok); } .pill.warn { color: var(--warn); } .pill.bad { color: var(--bad); } .pill.plan { color: var(--muted); }
.plat { display: inline-block; padding: 1px 8px; border-radius: 6px; font-size: 12px; font-weight: 600; background: var(--accent-soft); color: var(--accent); white-space: nowrap; }
.plat.youtube { background: color-mix(in srgb, var(--bad) 14%, transparent); color: var(--bad); }

.flash { padding: 10px 14px; border-radius: 8px; font-size: 14px; border: 1px solid; }
.flash.ok { color: var(--ok); background: color-mix(in srgb, var(--ok) 10%, var(--panel)); }
.flash.bad { color: var(--bad); background: color-mix(in srgb, var(--bad) 10%, var(--panel)); }
.flash.warn { color: var(--warn); background: color-mix(in srgb, var(--warn) 10%, var(--panel)); }

.form { display: flex; flex-direction: column; gap: 14px; align-items: flex-start; }
.fgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 12px; width: 100%; }
.fgrid .span2 { grid-column: span 2; }
@media (max-width: 520px) { .fgrid .span2 { grid-column: auto; } }
label { display: block; font-size: 13px; font-weight: 500; color: var(--muted); margin-bottom: 4px; }
input, select, textarea { width: 100%; font: inherit; font-size: 15px; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; }
input:focus, select:focus, textarea:focus, .btn:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.check { display: flex; gap: 8px; align-items: center; color: var(--ink); font-size: 14px; }
.check input { width: auto; }
.filters { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.filters label { margin: 0; }
.filters select { width: auto; }
.btn { display: inline-flex; align-items: center; gap: 6px; font: inherit; font-weight: 500; font-size: 14px; padding: 9px 16px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); cursor: pointer; text-decoration: none; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.bad { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.small { padding: 6px 12px; font-size: 13px; }
details summary { cursor: pointer; color: var(--accent); font-size: 14px; }
.steps { margin: 10px 0 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
code { font-size: 13px; background: var(--accent-soft); padding: 1px 5px; border-radius: 4px; }
.log { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 14px; max-height: 320px; overflow-y: auto; }

.login-body { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login { width: 100%; max-width: 380px; gap: 14px; }
.login p { margin: 0; }
.login .btn { width: 100%; justify-content: center; }

@media (max-width: 640px) {
  .hide-sm { display: none; }
  h1 { font-size: 24px; }
  .tile .num { font-size: 26px; }
  .top-in { gap: 8px; }
  .nav { flex-basis: 100%; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
