/* Crash&Learn Leaderboard — single stylesheet, light/dark. */

:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --surface-3: #e7eaef;
  --border: #e2e5ea;
  --border-strong: #cfd4dc;
  --text: #11151c;
  --text-2: #4a5263;
  --text-3: #7b8394;
  --accent: #e10600;
  --accent-hover: #c00500;
  --accent-soft: #fdecea;
  --accent-text: #b80500;
  --good: #0c8a4f;
  --good-soft: #e3f5ec;
  --warn: #b26a00;
  --warn-soft: #fff3df;
  --bad: #c62828;
  --bad-soft: #fdecec;
  --info: #2459d6;
  --info-soft: #e8eefc;
  --grid: #eceef2;
  --axis: #c3c8d1;
  --zone: rgba(12, 138, 79, 0.07);
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 1px 3px rgba(16, 24, 40, 0.06);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, 0.14);
  --radius: 12px;
  --radius-sm: 8px;
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b0e13;
    --surface: #12161e;
    --surface-2: #181d27;
    --surface-3: #212835;
    --border: #232a37;
    --border-strong: #323b4b;
    --text: #e9ecf2;
    --text-2: #a9b1bf;
    --text-3: #7b8496;
    --accent: #ff3b30;
    --accent-hover: #ff5a50;
    --accent-soft: rgba(255, 59, 48, 0.13);
    --accent-text: #ff7a72;
    --good: #34c37f;
    --good-soft: rgba(52, 195, 127, 0.13);
    --warn: #f0a63a;
    --warn-soft: rgba(240, 166, 58, 0.13);
    --bad: #ff6b6b;
    --bad-soft: rgba(255, 107, 107, 0.13);
    --info: #6f9bff;
    --info-soft: rgba(111, 155, 255, 0.13);
    --grid: #1e2531;
    --axis: #3a4456;
    --zone: rgba(52, 195, 127, 0.07);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.5);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0b0e13;
  --surface: #12161e;
  --surface-2: #181d27;
  --surface-3: #212835;
  --border: #232a37;
  --border-strong: #323b4b;
  --text: #e9ecf2;
  --text-2: #a9b1bf;
  --text-3: #7b8496;
  --accent: #ff3b30;
  --accent-hover: #ff5a50;
  --accent-soft: rgba(255, 59, 48, 0.13);
  --accent-text: #ff7a72;
  --good: #34c37f;
  --good-soft: rgba(52, 195, 127, 0.13);
  --warn: #f0a63a;
  --warn-soft: rgba(240, 166, 58, 0.13);
  --bad: #ff6b6b;
  --bad-soft: rgba(255, 107, 107, 0.13);
  --info: #6f9bff;
  --info-soft: rgba(111, 155, 255, 0.13);
  --grid: #1e2531;
  --axis: #3a4456;
  --zone: rgba(52, 195, 127, 0.07);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.5);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button, input, textarea, select { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.2; letter-spacing: -0.01em; }
p { margin: 0; }
.num, td.num, .tabular { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); font-size: 0.92em; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.hidden { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.icon { width: 16px; height: 16px; flex: none; vertical-align: -3px; }

/* ---------- layout ---------- */
.app { min-height: 100vh; display: flex; flex-direction: column; }
.boot { flex: 1; display: grid; place-items: center; }
.container { width: 100%; max-width: 1240px; margin: 0 auto; padding: 0 24px; }
main.container { padding-top: 28px; padding-bottom: 64px; flex: 1; }
@media (max-width: 640px) {
  .container { padding: 0 16px; }
  main.container { padding-top: 20px; }
}

/* ---------- header ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar .container { display: flex; align-items: center; gap: 24px; height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 700; white-space: nowrap; }
.brand-mark { width: 28px; height: 28px; flex: none; }
.brand small { display: block; font-size: 11px; font-weight: 600; color: var(--text-3); letter-spacing: 0.06em; text-transform: uppercase; line-height: 1; }
.brand span { line-height: 1.1; }
.nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a {
  text-decoration: none; color: var(--text-2); font-weight: 500;
  padding: 7px 12px; border-radius: 8px; white-space: nowrap;
}
.nav a:hover { color: var(--text); background: var(--surface-2); }
.nav a.active { color: var(--text); background: var(--surface-3); }
.userbox { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.userbox .who { color: var(--text-2); font-size: 13px; max-width: 180px; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 860px) {
  .topbar .container { flex-wrap: wrap; height: auto; padding-top: 10px; padding-bottom: 6px; gap: 8px 16px; }
  .nav { order: 3; flex-basis: 100%; }
  .userbox { margin-left: auto; }
  .userbox .who { display: none; }
}

/* ---------- buttons & inputs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 36px; padding: 0 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font-weight: 600; font-size: 13.5px; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .12s, border-color .12s, color .12s;
}
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.danger { color: var(--bad); }
.btn.danger:hover { background: var(--bad-soft); border-color: var(--bad); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12.5px; }
.btn.lg { height: 44px; padding: 0 20px; font-size: 15px; }
.btn.icon { width: 36px; padding: 0; }
.btn svg { width: 16px; height: 16px; flex: none; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.input, .textarea, .select {
  width: 100%; border: 1px solid var(--border-strong); background: var(--surface);
  border-radius: var(--radius-sm); padding: 8px 12px; outline: none;
  transition: border-color .12s, box-shadow .12s;
}
.input, .select { height: 38px; }
.textarea { min-height: 88px; resize: vertical; line-height: 1.5; }
.input:focus, .textarea:focus, .select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.select { padding-right: 32px; appearance: none; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%), linear-gradient(135deg, var(--text-3) 50%, transparent 50%);
  background-position: calc(100% - 17px) 16px, calc(100% - 12px) 16px; background-size: 5px 5px; background-repeat: no-repeat; }
.hint { font-size: 12px; color: var(--text-3); }
.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.check input { margin-top: 3px; accent-color: var(--accent); width: 16px; height: 16px; flex: none; }

.switch { position: relative; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; color: var(--text-2); user-select: none; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track { width: 34px; height: 20px; border-radius: 999px; background: var(--surface-3); border: 1px solid var(--border-strong); position: relative; transition: background .15s; flex: none; }
.switch .track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .15s; }
.switch input:checked + .track { background: var(--accent); border-color: var(--accent); }
.switch input:checked + .track::after { transform: translateX(14px); }
.switch input:focus-visible + .track { outline: 2px solid var(--accent); outline-offset: 2px; }

.segmented { display: inline-flex; padding: 3px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; gap: 2px; }
.segmented button { border: 0; background: transparent; padding: 6px 14px; border-radius: 7px; font-weight: 600; font-size: 13px; color: var(--text-2); cursor: pointer; white-space: nowrap; }
.segmented button:hover { color: var(--text); }
.segmented button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

/* ---------- cards & sections ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 20px 22px; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 18px 22px 0; flex-wrap: wrap; }
.card-head h2 { font-size: 16px; font-weight: 700; }
.card-head p { color: var(--text-2); font-size: 13px; margin-top: 3px; }
.card-body { padding: 14px 22px 20px; }
.eyebrow { font-size: 11.5px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent-text); }
.stack { display: flex; flex-direction: column; gap: 20px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }
@media (max-width: 640px) {
  .card-pad { padding: 16px; }
  .card-head { padding: 16px 16px 0; }
  .card-body { padding: 12px 16px 16px; }
}

.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head h1 { font-size: 30px; font-weight: 800; letter-spacing: -0.02em; margin-top: 4px; }
.page-head .lead { color: var(--text-2); max-width: 680px; margin-top: 8px; font-size: 14.5px; }
@media (max-width: 640px) { .page-head h1 { font-size: 24px; } }

.kpis { display: flex; gap: 10px; flex-wrap: wrap; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 8px 14px; min-width: 96px; }
.kpi b { display: block; font-size: 18px; font-weight: 750; font-variant-numeric: tabular-nums; }
.kpi span { font-size: 11.5px; color: var(--text-3); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }

.toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 20px; }
.toolbar .spacer { flex: 1; }
.toolbar .select { width: auto; min-width: 200px; }

/* ---------- badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 11.5px; font-weight: 650; white-space: nowrap; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); }
.badge.good { background: var(--good-soft); color: var(--good); border-color: transparent; }
.badge.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.badge.info { background: var(--info-soft); color: var(--info); border-color: transparent; }
.badge.accent { background: var(--accent-soft); color: var(--accent-text); border-color: transparent; }
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge .dot.pulse { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .3; } }
.tag-bot { font-size: 10px; font-weight: 800; letter-spacing: .06em; padding: 1px 5px; border-radius: 4px; background: var(--surface-3); color: var(--text-3); vertical-align: 1px; }
.tag-ref { font-size: 10px; font-weight: 800; letter-spacing: .06em; padding: 1px 5px; border-radius: 4px; background: rgba(201, 154, 6, 0.16); color: #a17a00; vertical-align: 1px; }
:root[data-theme="dark"] .tag-ref { color: #e8b923; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tag-ref { color: #e8b923; } }
.tag-me { font-size: 10px; font-weight: 800; letter-spacing: .04em; padding: 1px 5px; border-radius: 4px; background: var(--accent-soft); color: var(--accent-text); vertical-align: 1px; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data th, table.data td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.data th { font-size: 11.5px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: .05em; background: var(--surface); position: sticky; top: 0; }
table.data th.sortable { cursor: pointer; user-select: none; }
table.data th.sortable:hover { color: var(--text); }
table.data th .arrow { opacity: .8; margin-left: 4px; }
table.data td.num, table.data th.num { text-align: right; }
table.data tbody tr:hover td { background: var(--surface-2); }
table.data tbody tr.me td { background: color-mix(in srgb, var(--accent-soft) 55%, transparent); }
table.data tr:last-child td { border-bottom: 0; }
table.data a { text-decoration: none; font-weight: 650; }
table.data a:hover { color: var(--accent-text); }
.pos { display: inline-grid; place-items: center; min-width: 26px; height: 24px; padding: 0 6px; border-radius: 6px; font-weight: 750; font-size: 12.5px; background: var(--surface-2); font-variant-numeric: tabular-nums; }
.pos.p1 { background: #f6c945; color: #4a3500; }
.pos.p2 { background: #d4d9e1; color: #2b3240; }
.pos.p3 { background: #e3a777; color: #4a2508; }
.model-cell { display: flex; align-items: center; gap: 10px; }
.swatch { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.model-cell .names { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.model-cell .names small { color: var(--text-3); font-size: 12px; }
.bar-cell { display: flex; align-items: center; gap: 10px; min-width: 150px; }
.bar-cell .bar { flex: 1; height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; min-width: 60px; }
.bar-cell .bar i { display: block; height: 100%; border-radius: 3px; background: var(--accent); }
.dnf { color: var(--bad); font-weight: 600; }

/* ---------- charts ---------- */
.chart { width: 100%; position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { fill: var(--text-2); font-family: var(--font); }
.chart .val { fill: var(--text); font-weight: 700; font-variant-numeric: tabular-nums; }
.chart .lbl { fill: var(--text-2); font-weight: 550; }
.chart .lbl.me { fill: var(--accent-text); font-weight: 750; }
.chart .sub { fill: var(--text-3); }
.chart .grid { stroke: var(--grid); }
.chart .bg { fill: var(--surface-2); }
.chart .axis { stroke: var(--axis); }
.chart .axis-title { fill: var(--text-3); font-weight: 650; font-size: 11.5px; }
.chart .zone { fill: var(--zone); }
.chart .zone-label { fill: var(--good); font-weight: 700; font-size: 11px; opacity: .8; }
.chart .bar-me { stroke: var(--text); stroke-width: 1.5; }
.chart .pt { stroke: var(--surface); stroke-width: 1.5; }
.chart .pt.me { stroke: var(--text); stroke-width: 2; }
.chart-empty { padding: 48px 16px; text-align: center; color: var(--text-3); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 12px; font-size: 12.5px; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }

.track-svg path { fill: none; stroke: currentColor; stroke-linejoin: round; stroke-linecap: round; }
.track-svg circle { fill: var(--accent); }
.track-hero { display: flex; gap: 22px; align-items: center; flex-wrap: wrap; }
.track-hero .track-svg { width: 128px; height: 128px; color: var(--text); flex: none; }
.track-hero h2 { font-size: 22px; font-weight: 800; }
.track-facts { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 10px; color: var(--text-2); font-size: 13px; }
.track-facts b { color: var(--text); font-variant-numeric: tabular-nums; }

/* ---------- circuits grid (model page) ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.tile { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; background: var(--surface); position: relative; overflow: hidden; }
.tile .head { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.tile .name { font-weight: 650; font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile .track-svg { width: 34px; height: 34px; color: var(--text-3); flex: none; }
.tile .main { font-size: 17px; font-weight: 750; font-variant-numeric: tabular-nums; margin-top: 6px; }
.tile .meta { font-size: 11.5px; color: var(--text-3); margin-top: 1px; }
.tile .meter { position: absolute; left: 0; bottom: 0; height: 3px; background: var(--accent); }
.tile.dnf-tile .main { color: var(--bad); font-size: 14px; }

/* ---------- library ---------- */
.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
@media (max-width: 400px) { .lib-grid { grid-template-columns: 1fr; } }
.model-card { display: flex; flex-direction: column; gap: 12px; padding: 18px; }
.model-card .top { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.model-card h3 { font-size: 16px; font-weight: 750; word-break: break-word; }
.model-card h3 a { text-decoration: none; }
.model-card h3 a:hover { color: var(--accent-text); }
.model-card .by { font-size: 12.5px; color: var(--text-3); margin-top: 2px; }
.model-card .desc { color: var(--text-2); font-size: 13px; white-space: pre-wrap; text-align: left; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.model-card .desc.empty { color: var(--text-3); font-style: italic; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-family: var(--mono); font-size: 11.5px; padding: 2px 7px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); }
.scores { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.score-box { background: var(--surface-2); border-radius: 8px; padding: 8px 10px; }
.score-box .k { font-size: 11px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: .05em; }
.score-box .v { font-size: 15px; font-weight: 750; font-variant-numeric: tabular-nums; }
.score-box .v small { font-size: 12px; font-weight: 600; color: var(--text-3); }
.model-card .actions { display: flex; gap: 8px; align-items: center; margin-top: auto; flex-wrap: wrap; }
.locked { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-3); }
.locked svg { width: 14px; height: 14px; }

/* ---------- model page ---------- */
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); text-decoration: none; font-weight: 600; font-size: 13px; margin-bottom: 14px; }
.back:hover { color: var(--text); }
.model-head { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.model-head h1 { font-size: 28px; font-weight: 800; letter-spacing: -0.02em; word-break: break-word; }
.model-head .by { color: var(--text-2); margin-top: 4px; }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; margin-top: 18px; }
.fact { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; }
.fact .k { font-size: 11px; color: var(--text-3); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.fact .v { font-size: 17px; font-weight: 750; font-variant-numeric: tabular-nums; margin-top: 2px; }
.description { white-space: pre-wrap; color: var(--text-2); line-height: 1.6; }
.files-list { display: flex; flex-direction: column; gap: 0; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.files-list div { display: flex; justify-content: space-between; padding: 8px 12px; font-size: 13px; border-bottom: 1px solid var(--border); }
.files-list div:last-child { border-bottom: 0; }

/* ---------- upload ---------- */
.dropzone {
  border: 1.5px dashed var(--border-strong); border-radius: var(--radius); padding: 26px 18px; text-align: center;
  background: var(--surface-2); cursor: pointer; transition: border-color .12s, background .12s;
}
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone svg { width: 28px; height: 28px; color: var(--text-3); }
.dropzone b { display: block; margin-top: 6px; }
.dropzone .hint { margin-top: 4px; }
.dropzone .row { display: flex; gap: 8px; justify-content: center; margin-top: 12px; flex-wrap: wrap; }
.picked { display: flex; flex-direction: column; gap: 4px; margin-top: 12px; }
.picked .f { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 10px; border-radius: 8px; background: var(--surface-2); font-size: 13px; }
.picked .f .n { display: flex; align-items: center; gap: 8px; min-width: 0; }
.picked .f .n span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picked .f.ignored { opacity: .55; text-decoration: line-through; }
.picked .ok { color: var(--good); }
.picked .ko { color: var(--bad); }
.form-grid { display: grid; gap: 16px; }
.quota { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.meter-line { height: 8px; border-radius: 4px; background: var(--surface-3); overflow: hidden; margin-top: 6px; }
.meter-line i { display: block; height: 100%; background: var(--accent); border-radius: 4px; transition: width .3s; }
.progress { height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--info); border-radius: 3px; transition: width .4s; }

.mine-list { display: flex; flex-direction: column; gap: 14px; }
.mine-item { padding: 18px 20px; display: flex; flex-direction: column; gap: 12px; }
.mine-item .row1 { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: center; }
.mine-item h3 { font-size: 16px; font-weight: 750; }
.mine-item h3 a { text-decoration: none; }
.mine-item h3 a:hover { color: var(--accent-text); }
.mine-item .row3 { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; justify-content: space-between; }
.error-box { background: var(--bad-soft); color: var(--bad); border-radius: 8px; padding: 10px 12px; font-family: var(--mono); font-size: 12px; white-space: pre-wrap; word-break: break-word; max-height: 240px; overflow: auto; }
.note { background: var(--info-soft); color: var(--info); border-radius: 8px; padding: 10px 12px; font-size: 13px; }

/* ---------- login ---------- */
.auth-wrap { flex: 1; display: grid; place-items: center; padding: 40px 16px; }
.auth-card { width: 100%; max-width: 420px; padding: 32px; }
.auth-card .brand { margin-bottom: 26px; font-size: 16px; }
.auth-card h1 { font-size: 22px; font-weight: 800; }
.auth-card p.lead { color: var(--text-2); margin: 8px 0 22px; }
.auth-card form { display: flex; flex-direction: column; gap: 12px; }
.auth-card .sent { text-align: center; }
.auth-card .sent svg { width: 44px; height: 44px; color: var(--good); }
.auth-foot { margin-top: 18px; font-size: 12.5px; color: var(--text-3); text-align: center; }

/* ---------- docs page ---------- */
.prose { color: var(--text-2); line-height: 1.65; }
.prose h3 { color: var(--text); font-size: 15px; margin: 20px 0 6px; }
.prose h3:first-child { margin-top: 0; }
.prose p + p { margin-top: 10px; }
.prose ul { margin: 6px 0; padding-left: 20px; }
.prose li { margin: 3px 0; }
.prose code { font-family: var(--mono); font-size: 12.5px; background: var(--surface-2); border: 1px solid var(--border); padding: 1px 5px; border-radius: 5px; color: var(--text); }
.prose b { color: var(--text); }
pre.code { margin: 10px 0 0; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; font-family: var(--mono); font-size: 12.5px; overflow-x: auto; color: var(--text); line-height: 1.55; }
.formula { font-family: var(--mono); font-size: 12.5px; background: var(--surface-2); border-radius: 8px; padding: 10px 12px; color: var(--text); margin-top: 6px; overflow-x: auto; }
.download-hero { display: flex; gap: 20px; align-items: center; justify-content: space-between; flex-wrap: wrap; }

/* ---------- misc ---------- */
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 2.5px solid var(--border-strong); border-top-color: var(--accent); animation: spin .7s linear infinite; display: inline-block; }
.spinner.sm { width: 14px; height: 14px; border-width: 2px; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading { display: grid; place-items: center; padding: 60px 0; }
.empty { padding: 40px 16px; text-align: center; color: var(--text-3); }
.empty b { display: block; color: var(--text-2); font-size: 15px; margin-bottom: 4px; }
.footer { border-top: 1px solid var(--border); padding: 18px 0; color: var(--text-3); font-size: 12.5px; }
.footer .container { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.footer a { color: var(--text-2); }

.toasts { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 100; max-width: calc(100vw - 40px); }
.toast { background: var(--text); color: var(--bg); padding: 10px 14px; border-radius: 10px; box-shadow: var(--shadow-lg); font-size: 13.5px; font-weight: 550; max-width: 420px; animation: toast-in .18s ease-out; }
.toast.bad { background: var(--bad); color: #fff; }
.toast.good { background: var(--good); color: #fff; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }

.dialog { border: 1px solid var(--border); border-radius: 14px; padding: 0; background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); width: min(440px, calc(100vw - 32px)); }
.dialog::backdrop { background: rgba(10, 12, 16, 0.45); }
.dialog .body { padding: 22px 22px 8px; }
.dialog h3 { font-size: 17px; font-weight: 750; }
.dialog p { color: var(--text-2); margin-top: 8px; }
.dialog .foot { display: flex; justify-content: flex-end; gap: 8px; padding: 16px 22px 20px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
