/* ADG LLM Data Hub — design tokens + layout. Light/dark from the same ramps. */
:root {
  color-scheme: light;
  --page: #f3f4f1;
  --surface: #fcfcfb;
  --surface-2: #f6f6f3;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #898781;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --ring: rgba(11, 11, 11, 0.10);
  --accent: #2a78d6;          /* categorical slot 1 — crawler / primary series */
  --accent-soft: #cde2fb;     /* sequential step 100 — meter track */
  --accent-ink: #1c5cab;
  --series-2: #eb6834;        /* categorical slot 2 — API feeds */
  --good: #0ca30c; --good-text: #006300;
  --warning: #fab219;
  --serious: #ec835a;
  --critical: #d03b3b;
  --shadow: 0 1px 2px rgba(11,11,11,.05), 0 8px 24px -16px rgba(11,11,11,.25);
  --radius: 14px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --page: #0d0d0d; --surface: #1a1a19; --surface-2: #222221;
    --ink: #ffffff; --ink-2: #c3c2b7; --muted: #898781; --grid: #2c2c2a; --axis: #383835;
    --ring: rgba(255,255,255,0.10);
    --accent: #3987e5; --accent-soft: #184f95; --accent-ink: #86b6ef; --series-2: #d95926;
    --good-text: #0ca30c;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 10px 30px -18px rgba(0,0,0,.8);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0d0d0d; --surface: #1a1a19; --surface-2: #222221;
  --ink: #ffffff; --ink-2: #c3c2b7; --muted: #898781; --grid: #2c2c2a; --axis: #383835;
  --ring: rgba(255,255,255,0.10);
  --accent: #3987e5; --accent-soft: #184f95; --accent-ink: #86b6ef; --series-2: #d95926;
  --good-text: #0ca30c;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 10px 30px -18px rgba(0,0,0,.8);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font); color: var(--ink); background: var(--page);
  -webkit-font-smoothing: antialiased; line-height: 1.45; min-height: 100vh;
}
a { color: var(--accent-ink); text-decoration: none; }
button { font: inherit; color: inherit; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Login ---------- */
.login {
  min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr;
}
.login__brand {
  position: relative; overflow: hidden; padding: 48px; color: #fff;
  background:
    radial-gradient(1200px 600px at -10% -20%, rgba(57,135,229,.55), transparent 60%),
    radial-gradient(800px 500px at 110% 110%, rgba(27,175,122,.35), transparent 60%),
    linear-gradient(160deg, #0f1f3d 0%, #0b1730 55%, #0a1226 100%);
  display: flex; flex-direction: column; justify-content: space-between;
}
.login__brand h1 { font-size: 40px; line-height: 1.1; margin: 0 0 12px; letter-spacing: -0.02em; }
.login__brand p { color: rgba(255,255,255,.78); max-width: 46ch; margin: 0; font-size: 16px; }
.login__facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 40px; }
.login__fact { border: 1px solid rgba(255,255,255,.14); border-radius: 12px; padding: 14px 16px; background: rgba(255,255,255,.06); }
.login__fact b { display: block; font-size: 24px; font-weight: 600; }
.login__fact span { font-size: 12.5px; color: rgba(255,255,255,.7); }
.login__panel { display: grid; place-items: center; padding: 40px 24px; background: var(--page); }
.card {
  background: var(--surface); border: 1px solid var(--ring); border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.login__card { width: min(420px, 100%); padding: 36px 32px; }
.login__card h2 { margin: 0 0 4px; font-size: 22px; }
.login__card p.sub { margin: 0 0 24px; color: var(--ink-2); font-size: 14px; }
.field { display: grid; gap: 6px; margin-bottom: 16px; }
.field label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field input {
  font: inherit; padding: 11px 12px; border-radius: 10px; border: 1px solid var(--axis);
  background: var(--surface); color: var(--ink); outline: none;
}
.field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer;
  border-radius: 10px; border: 1px solid transparent; padding: 10px 16px; font-weight: 600; font-size: 14px;
  background: var(--surface-2); color: var(--ink); border-color: var(--ring);
}
.btn--primary { background: var(--accent); color: #fff; border-color: transparent; width: 100%; padding: 12px; }
.btn--primary:hover { filter: brightness(1.05); }
.btn--ghost { background: transparent; }
.btn--sm { padding: 6px 10px; font-size: 12.5px; border-radius: 8px; }
.form-error { display: none; margin: 0 0 14px; padding: 10px 12px; border-radius: 10px; font-size: 13px;
  background: color-mix(in srgb, var(--critical) 12%, var(--surface)); color: var(--critical); }
.form-error.is-visible { display: block; }
.login__foot { margin-top: 20px; font-size: 12.5px; color: var(--muted); text-align: center; }

/* ---------- App shell ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--ring);
}
.topbar__in { max-width: none; margin: 0; padding: 0 28px; height: 60px; display: flex; align-items: center; gap: 18px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: -0.01em; }
.brand__mark { width: 28px; height: 28px; border-radius: 8px; background: linear-gradient(135deg, var(--accent), #1baf7a); display: grid; place-items: center; color: #fff; font-size: 13px; }
.nav { display: flex; gap: 2px; margin-left: 8px; }
.nav button { background: none; border: 0; padding: 8px 12px; border-radius: 8px; color: var(--ink-2); cursor: pointer; font-weight: 500; font-size: 14px; }
.nav button[aria-selected="true"] { background: var(--surface-2); color: var(--ink); }
.topbar__right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.user { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--ink-2); }
.user__avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 12px; }
.icon-btn { width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--ring); background: var(--surface); cursor: pointer; display: grid; place-items: center; }

.page { max-width: none; margin: 0; padding: 22px 28px 64px; }
.page__head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.page__head h1 { margin: 0; font-size: 24px; letter-spacing: -0.01em; }
.page__head p { margin: 4px 0 0; color: var(--ink-2); font-size: 14px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { border: 1px solid var(--ring); background: var(--surface); border-radius: 999px; padding: 6px 12px; font-size: 13px; cursor: pointer; color: var(--ink-2); }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--surface); border-color: var(--ink); }

.grid { display: grid; gap: 16px; align-items: start; }
.brand { white-space: nowrap; }
.grid--kpi { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid--2 { grid-template-columns: 1.4fr 1fr; }
.grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.section { margin-top: 20px; }
.section > h2 { font-size: 15px; margin: 0 0 10px; color: var(--ink-2); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }

.tile { padding: 16px 18px; }
.tile__label { font-size: 13px; color: var(--ink-2); }
.tile__value { font-size: 28px; font-weight: 600; margin-top: 4px; letter-spacing: -0.01em; }
.tile__delta { font-size: 12.5px; margin-top: 4px; color: var(--ink-2); }
.tile__delta b { color: var(--good-text); font-weight: 600; }
.tile__spark { margin-top: 10px; height: 34px; overflow: hidden; } .tile__spark svg { display: block; width: 100%; height: 34px; }

.hero { padding: 22px 24px; display: grid; grid-template-columns: 1fr auto; gap: 24px; align-items: center; }
.hero__num { font-size: 56px; font-weight: 600; letter-spacing: -0.02em; line-height: 1; }
.hero__num small { font-size: 18px; font-weight: 500; color: var(--ink-2); margin-left: 6px; }
.hero__label { color: var(--ink-2); font-size: 14px; margin-top: 8px; }
.meter { margin-top: 14px; height: 10px; border-radius: 999px; background: var(--accent-soft); overflow: hidden; }
.meter > span { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.hero__side { display: grid; gap: 10px; min-width: 240px; }
.kv { display: flex; justify-content: space-between; gap: 16px; font-size: 13.5px; border-top: 1px solid var(--grid); padding-top: 8px; }
.kv:first-child { border-top: 0; padding-top: 0; }
.kv span { color: var(--ink-2); }
.kv b { font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------- Charts ---------- */
.chart { padding: 16px 18px 12px; }
.chart__head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.chart__title { font-size: 14.5px; font-weight: 600; margin: 0; }
.chart__sub { color: var(--muted); font-size: 12.5px; margin: 2px 0 0; }
.chart__tools { display: flex; gap: 6px; }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart text { font-family: var(--font); fill: var(--muted); font-size: 11.5px; }
.chart .tick text { font-variant-numeric: tabular-nums; }
.chart .grid-line { stroke: var(--grid); stroke-width: 1; }
.chart .axis-line { stroke: var(--axis); stroke-width: 1; }
.chart .label { fill: var(--ink-2); font-weight: 600; }
.chart .label--inside { fill: #fff; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-2); margin: 8px 0 2px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.chart table { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 8px; }
.chart table th, .chart table td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--grid); }
.chart table td.num, .chart table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.chart table { display: none; } .chart.is-table table { display: table; } .chart.is-table svg, .chart.is-table .legend { display: none; }
.hit { fill: transparent; cursor: crosshair; }
.tooltip {
  position: fixed; z-index: 50; pointer-events: none; background: var(--ink); color: var(--surface);
  padding: 8px 10px; border-radius: 8px; font-size: 12.5px; box-shadow: var(--shadow); opacity: 0; transition: opacity .08s;
  max-width: 260px;
}
.tooltip.is-on { opacity: 1; }
.tooltip b { font-weight: 600; }
.tooltip .row { display: flex; justify-content: space-between; gap: 14px; }
.tooltip i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; }

/* ---------- Tables / lists ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; font-weight: 600; color: var(--ink-2); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; padding: 10px 12px; border-bottom: 1px solid var(--grid); }
.table td { padding: 11px 12px; border-bottom: 1px solid var(--grid); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table .sub { color: var(--muted); font-size: 12px; display: block; }
.card--table { overflow: hidden; }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; }
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.status--good { color: var(--good-text); } .status--warning { color: #8a5a00; } .status--serious { color: var(--serious); } .status--paused { color: var(--muted); }
:root[data-theme="dark"] .status--warning { color: var(--warning); }
@media (prefers-color-scheme: dark) { :root:where(:not([data-theme="light"])) .status--warning { color: var(--warning); } }
.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--ring); }
.pill--crawler { color: var(--accent-ink); } .pill--api { color: #8a3a12; }
:root[data-theme="dark"] .pill--api { color: #f0a080; }
@media (prefers-color-scheme: dark) { :root:where(:not([data-theme="light"])) .pill--api { color: #f0a080; } }
.bar-mini { height: 6px; border-radius: 999px; background: var(--accent-soft); overflow: hidden; width: 120px; display: inline-block; vertical-align: middle; margin-right: 8px; }
.bar-mini > span { display: block; height: 100%; background: var(--accent); }

/* ---------- Category cards ---------- */
.cat { padding: 18px; cursor: pointer; transition: transform .12s, box-shadow .12s; border: 1px solid var(--ring); }
.cat:hover { transform: translateY(-1px); }
.cat.is-active { outline: 2px solid var(--accent); outline-offset: -1px; }
.cat__top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.cat__name { font-weight: 600; font-size: 15px; }
.cat__icon { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-2); font-size: 18px; }
.cat__gb { font-size: 26px; font-weight: 600; margin-top: 10px; }
.cat__gb small { font-size: 13px; color: var(--ink-2); font-weight: 500; }
.cat__meta { display: flex; justify-content: space-between; color: var(--ink-2); font-size: 12.5px; margin-top: 4px; }
.cat__bar { margin-top: 10px; height: 6px; border-radius: 999px; background: var(--accent-soft); overflow: hidden; }
.cat__bar > span { display: block; height: 100%; background: var(--accent); }

.detail { padding: 18px 20px; }
.detail__head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.detail__head h3 { margin: 0; font-size: 18px; }
.tags { display: flex; gap: 6px; flex-wrap: wrap; }
.study { display: grid; grid-template-columns: 1fr auto; gap: 12px; padding: 12px 0; border-top: 1px solid var(--grid); }
.study:first-child { border-top: 0; }
.study__title { font-weight: 600; font-size: 14px; }
.study__meta { color: var(--ink-2); font-size: 12.5px; margin-top: 2px; }
.study__right { text-align: right; font-size: 12px; color: var(--muted); white-space: nowrap; }

/* ---------- Pipeline ---------- */
.steps { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; }
.step { padding: 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--ring); }
.step__n { font-size: 11px; color: var(--muted); font-weight: 600; letter-spacing: .04em; }
.step__name { font-weight: 600; margin-top: 2px; font-size: 14px; }
.step__val { font-size: 20px; font-weight: 600; margin-top: 8px; }
.step__state { font-size: 12px; margin-top: 2px; }
.step.is-done .step__state { color: var(--good-text); }
.step.is-running .step__state { color: var(--accent-ink); }
.step.is-pending .step__state { color: var(--muted); }

.foot { margin-top: 36px; color: var(--muted); font-size: 12px; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* ---------- Live / motion layer ---------- */
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--good) 55%, transparent); } 70% { box-shadow: 0 0 0 7px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes slidein { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@keyframes spin { to { transform: rotate(360deg); } }
.live-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--good); animation: pulse 1.6s ease-out infinite; vertical-align: 1px; margin-right: 6px; }
.badge { display: inline-flex; align-items: center; gap: 2px; padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--ring); vertical-align: middle; white-space: nowrap; }
.badge--live { color: var(--good-text); background: color-mix(in srgb, var(--good) 10%, var(--surface)); border-color: color-mix(in srgb, var(--good) 30%, transparent); }
/* live status bar */
@keyframes sweep { from { transform: translateX(-100%); } to { transform: translateX(200%); } }
.strip { position: relative; overflow: hidden; color: #fff; background: linear-gradient(90deg, #0b1730 0%, #10264f 48%, #0d3b5e 100%); border-bottom: 1px solid rgba(255,255,255,.08); box-shadow: inset 0 -1px 0 rgba(255,255,255,.04); }
.strip::after { content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: 34%; background: linear-gradient(90deg, transparent, rgba(255,255,255,.07), transparent); animation: sweep 7s linear infinite; pointer-events: none; }
#statusStrip { display: flex; align-items: center; gap: 6px; padding: 10px 28px; overflow-x: auto; scrollbar-width: none; position: relative; z-index: 1; }
#statusStrip::-webkit-scrollbar { display: none; }
.strip__live { display: inline-flex; align-items: center; gap: 9px; padding: 9px 16px; border-radius: 999px; background: rgba(12,163,12,.16); border: 1px solid rgba(12,163,12,.5); font-weight: 800; letter-spacing: .08em; font-size: 12.5px; text-transform: uppercase; margin-right: 10px; white-space: nowrap; flex: 0 0 auto; }
.strip__live .live-dot { width: 10px; height: 10px; margin: 0; }
.strip__item { flex: 0 0 auto; display: flex; flex-direction: column; justify-content: center; gap: 1px; padding: 4px 18px; border-left: 1px solid rgba(255,255,255,.12); min-width: 128px; }
.strip__k { font-size: 10.5px; text-transform: uppercase; letter-spacing: .07em; color: rgba(255,255,255,.62); white-space: nowrap; }
.strip__v { font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; line-height: 1.15; }
.strip__v small { font-size: 12px; font-weight: 500; color: rgba(255,255,255,.72); margin-left: 4px; }
.strip__bar { height: 4px; width: 96px; border-radius: 999px; background: rgba(255,255,255,.18); overflow: hidden; margin-top: 5px; }
.strip__bar > span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #3987e5, #1baf7a); transition: width .5s ease; }
.strip__spacer { flex: 1; }
.strip__time { font-size: 12px; color: rgba(255,255,255,.7); white-space: nowrap; padding-left: 12px; }
.strip__time b { color: #fff; font-weight: 600; }
.page .card { animation: rise .5s cubic-bezier(.2,.7,.2,1) backwards; }
.grid > .card:nth-child(2), .grid > div:nth-child(2) > .card { animation-delay: .06s; } .grid > .card:nth-child(3) { animation-delay: .12s; } .grid > .card:nth-child(4) { animation-delay: .18s; }
.card:hover { box-shadow: 0 2px 4px rgba(11,11,11,.06), 0 14px 32px -18px rgba(11,11,11,.35); }
.hero { background: linear-gradient(135deg, var(--surface) 0%, var(--surface) 55%, color-mix(in srgb, var(--accent) 9%, var(--surface)) 100%); }
.hero__num { font-variant-numeric: tabular-nums; }
.meter > span { transition: width .6s ease; background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 70%, #1baf7a)); }

/* feed */
.feed { padding: 16px 18px; }
.feed__list { list-style: none; margin: 6px 0 0; padding: 0; max-height: 300px; overflow: hidden; }
.feed__item { display: grid; grid-template-columns: 64px 180px 1fr; gap: 10px; padding: 8px 0; border-top: 1px solid var(--grid); font-size: 13px; animation: slidein .35s ease backwards; align-items: baseline; }
.feed__item:first-child { border-top: 0; }
.feed__time { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 12px; }
.feed__who { font-weight: 600; display: flex; align-items: center; gap: 6px; }
.feed__who::before { content: ""; width: 7px; height: 7px; border-radius: 2px; background: var(--accent); flex: none; }
.feed__item--api .feed__who::before { background: var(--series-2); }
.feed__item--pipe .feed__who::before { background: var(--muted); }
.feed__item--warn .feed__who::before { background: var(--warning); }
.feed__what { color: var(--ink-2); } .feed__cat { color: var(--muted); font-size: 12px; }

/* monitor */
.monitor { padding: 16px 18px 10px; background: var(--surface); }
.monitor__head { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 8px; }
.monitor__title { font-weight: 600; font-size: 14.5px; }
.monitor__sub { color: var(--muted); font-size: 12.5px; }
.monitor__val b { font-size: 30px; font-weight: 600; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.monitor__val span { color: var(--muted); font-size: 12.5px; margin-left: 6px; }
.monitor__svg { width: 100%; height: auto; display: block; border-radius: 10px; background: color-mix(in srgb, var(--accent) 5%, var(--surface-2)); }
.monitor__grid { stroke: var(--grid); stroke-width: 1; }
.monitor__line { stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.monitor__glow { stroke: var(--accent); stroke-width: 7; opacity: .14; stroke-linejoin: round; }
.monitor__dot { fill: var(--accent); stroke: var(--surface); stroke-width: 2; }

/* training */
.train { padding: 18px 20px; }
.train__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.train__eta { color: var(--ink-2); font-size: 13px; } .train__eta b { font-size: 18px; font-weight: 600; color: var(--ink); margin-left: 4px; }
.train__bar { margin-top: 14px; height: 10px; border-radius: 999px; background: var(--accent-soft); overflow: hidden; }
.train__bar > span { display: block; height: 100%; width: 0; border-radius: 999px; background: linear-gradient(90deg, var(--accent) 0%, color-mix(in srgb, var(--accent) 60%, #fff) 50%, var(--accent) 100%); background-size: 200% 100%; animation: shimmer 2.2s linear infinite; transition: width .4s ease; }
.train__stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 14px; }
.train__stats div { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; }
.train__stats span { display: block; font-size: 12px; color: var(--ink-2); } .train__stats b { font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; }
.train__grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 16px; margin-top: 16px; align-items: center; }
.train__loss svg { width: 100%; height: auto; display: block; }
.gauges { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.gauge { text-align: center; padding: 6px 4px; }
.gauge svg { width: 100%; max-width: 110px; height: auto; display: block; margin: 0 auto; }
.gauge b { display: block; font-size: 18px; font-weight: 600; margin-top: -8px; font-variant-numeric: tabular-nums; } .gauge b small { font-size: 11px; color: var(--ink-2); margin-left: 2px; }
.gauge span { font-size: 11.5px; color: var(--ink-2); }
.spin { display: inline-block; width: 10px; height: 10px; border: 2px solid var(--accent-soft); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -1px; }
.status--sync { color: var(--accent-ink); } .status--sync::before { display: none; }

/* studies */
.study__link { color: var(--ink); display: inline-block; }
.study__link:hover { color: var(--accent-ink); text-decoration: underline; text-underline-offset: 3px; }
.study__link .ext { color: var(--muted); font-size: 12px; margin-left: 2px; }
.study__right a { color: var(--accent-ink); }

/* ---------- v3: search, real-data badges, library, drawer ---------- */
.search { display: flex; align-items: center; gap: 6px; margin-left: 12px; flex: 1; max-width: 360px; background: var(--surface-2); border: 1px solid var(--ring); border-radius: 10px; padding: 0 10px; height: 36px; }
.search__icon { color: var(--muted); font-size: 16px; }
.search input { flex: 1; border: 0; background: transparent; outline: none; font: inherit; font-size: 13.5px; color: var(--ink); min-width: 0; }
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.section__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 10px; }
.section__head h2 { font-size: 15px; margin: 0; color: var(--ink-2); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.badge--real { color: var(--accent-ink); background: color-mix(in srgb, var(--accent) 10%, var(--surface)); border-color: color-mix(in srgb, var(--accent) 30%, transparent); }
.tile--real { border-left: 3px solid var(--accent); }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11.5px; background: var(--surface-2); padding: 2px 6px; border-radius: 6px; color: var(--ink-2); }
.pill--oa { color: var(--good-text); border-color: color-mix(in srgb, var(--good) 35%, transparent); background: color-mix(in srgb, var(--good) 8%, var(--surface)); }
.pill--pubmed { color: var(--accent-ink); } .pill--trial { color: #8a3a12; } .pill--preprint { color: #6b5bd6; }
:root[data-theme="dark"] .pill--trial { color: #f0a080; } :root[data-theme="dark"] .pill--preprint { color: #b3a8ff; }
@media (prefers-color-scheme: dark) { :root:where(:not([data-theme="light"])) .pill--trial { color: #f0a080; } :root:where(:not([data-theme="light"])) .pill--preprint { color: #b3a8ff; } }
.cat__real { display: flex; gap: 10px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--grid); font-size: 12px; color: var(--ink-2); flex-wrap: wrap; }
.cat__real b { color: var(--ink); font-weight: 600; margin-right: 3px; }
.realrow { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 14px; }
.realrow > div { background: var(--surface-2); border-radius: 12px; padding: 12px 14px; border-left: 3px solid var(--accent); }
.realrow span { display: block; font-size: 12px; color: var(--ink-2); } .realrow b { display: block; font-size: 20px; font-weight: 600; margin-top: 2px; font-variant-numeric: tabular-nums; }
.realrow small { display: block; color: var(--muted); font-size: 11.5px; margin-top: 2px; overflow-wrap: anywhere; }
.study[data-open] { cursor: pointer; } .study[data-open]:hover { background: color-mix(in srgb, var(--accent) 4%, transparent); margin: 0 -8px; padding-left: 8px; padding-right: 8px; border-radius: 8px; }
.libbar { display: grid; grid-template-columns: 2fr repeat(5, 1fr); gap: 8px; padding: 12px; margin-bottom: 14px; }
.libbar input, .libbar select { font: inherit; font-size: 13.5px; padding: 9px 10px; border-radius: 9px; border: 1px solid var(--axis); background: var(--surface); color: var(--ink); min-width: 0; }
.libbar input:focus, .libbar select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.table--lib tbody tr { cursor: pointer; transition: background .12s; } .table--lib tbody tr:hover, .table--lib tbody tr:focus { background: color-mix(in srgb, var(--accent) 5%, transparent); outline: none; }
.table--lib td:first-child { max-width: 520px; } .table--lib .study__link { font-weight: 600; }
.table--lib td.num { white-space: nowrap; }
.pager { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; font-size: 13px; color: var(--ink-2); border-top: 1px solid var(--grid); }
.drawer-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 60; opacity: 0; transition: opacity .2s; } .drawer-backdrop.is-open { opacity: 1; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100%); background: var(--surface); z-index: 70; box-shadow: -12px 0 40px -20px rgba(0,0,0,.5); transform: translateX(100%); transition: transform .22s cubic-bezier(.2,.7,.2,1); display: flex; flex-direction: column; }
.drawer.is-open { transform: none; }
.drawer__head { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--grid); }
.drawer__body { padding: 18px 20px 32px; overflow-y: auto; }
.drawer__title { font-size: 19px; line-height: 1.3; margin: 0 0 8px; } .drawer__title a { color: var(--ink); } .drawer__title a:hover { color: var(--accent-ink); }
.drawer__meta { color: var(--ink-2); font-size: 13px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.drawer__authors { color: var(--ink-2); font-size: 13.5px; margin: 12px 0 0; }
.drawer__body h4 { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 18px 0 6px; }
.abstract { font-size: 14px; line-height: 1.55; margin: 0; color: var(--ink); }
.drawer__links { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 18px; }
.drawer .kv b { text-align: right; overflow-wrap: anywhere; }
@media (max-width: 1024px) { .realrow { grid-template-columns: 1fr 1fr; } .libbar { grid-template-columns: 1fr 1fr 1fr; } .search { display: none; } }
@media (max-width: 760px) { .realrow { grid-template-columns: 1fr; } .libbar { grid-template-columns: 1fr; } .table--lib td:nth-child(4), .table--lib th:nth-child(4), .table--lib td:nth-child(5), .table--lib th:nth-child(5) { display: none; } }

@media (prefers-reduced-motion: reduce) {
  .page .card, .feed__item { animation: none; } .live-dot, .train__bar > span, .spin, .strip::after { animation: none; } .drawer, .drawer-backdrop { transition: none; }
}
@media (max-width: 760px) {
  .feed__item { grid-template-columns: 56px 1fr; } .feed__what { grid-column: 2; }
  .train__stats { grid-template-columns: 1fr 1fr; } .train__grid { grid-template-columns: 1fr; }
  #statusStrip { padding: 8px 14px; } .strip__item { padding: 2px 12px; min-width: 104px; } .strip__v { font-size: 16px; } .strip__spacer, .strip__time { display: none; }
}

@media (max-width: 1024px) {
  .grid--kpi { grid-template-columns: repeat(2, 1fr); }
  .grid--2, .grid--3 { grid-template-columns: 1fr; }
  .steps { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 760px) {
  .login { grid-template-columns: 1fr; } .login__brand { min-height: 42vh; padding: 28px 20px; }
  .login__brand h1 { font-size: 30px; } .login__facts { grid-template-columns: 1fr 1fr; }
  .nav { display: none; } .hero { grid-template-columns: 1fr; } .hero__num { font-size: 44px; }
  .brand { font-size: 14px; } .user span:not(.user__avatar) { display: none; } .topbar__in { gap: 10px; }
  .chart { overflow-x: auto; } .chart svg { min-width: 560px; }
  .grid--kpi { grid-template-columns: 1fr 1fr; } .steps { grid-template-columns: repeat(2, 1fr); }
  .page { padding: 16px 16px 48px; }
}
