/* Jev Bench Console — shared design system. Pages must use these tokens and components; do not add page-local colours. */
:root {
  --bg: #fafafa; --surface: #ffffff; --surface-2: #f4f4f5; --border: #e4e4e7; --border-strong: #d4d4d8;
  --text: #18181b; --text-2: #52525b; --text-3: #71717a;
  --accent: #1d4ed8; --accent-soft: #eff4ff; --accent-text: #ffffff;
  --good: #15803d; --good-soft: #f0fdf4; --warn: #a16207; --warn-soft: #fefce8; --bad: #b91c1c; --bad-soft: #fef2f2;
  --focus: #2563eb;
  --radius: 6px; --radius-sm: 4px;
  --gutter: clamp(12px, 2vw, 32px); --max: 1680px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a0a0b; --surface: #111113; --surface-2: #18181b; --border: #27272a; --border-strong: #3f3f46;
    --text: #fafafa; --text-2: #a1a1aa; --text-3: #8b8b94;
    --accent: #60a5fa; --accent-soft: #172033; --accent-text: #0a0a0b;
    --good: #4ade80; --good-soft: #0f2418; --warn: #facc15; --warn-soft: #262008; --bad: #f87171; --bad-soft: #2a1213;
    --focus: #93c5fd; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0a0a0b; --surface: #111113; --surface-2: #18181b; --border: #27272a; --border-strong: #3f3f46;
  --text: #fafafa; --text-2: #a1a1aa; --text-3: #8b8b94;
  --accent: #60a5fa; --accent-soft: #172033; --accent-text: #0a0a0b;
  --good: #4ade80; --good-soft: #0f2418; --warn: #facc15; --warn-soft: #262008; --bad: #f87171; --bad-soft: #2a1213;
  --focus: #93c5fd; color-scheme: dark;
}

/* Data series colours (categorical, fixed order, validated for colour-blind separation in both themes). Used by charts and signal meters; never for status. */
:root { --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100; --s5: #e87ba4; --s6: #008300; --s7: #4a3aa7; --s8: #e34948; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767; } }
:root[data-theme="dark"] { --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 13.5px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: 21px; letter-spacing: -0.02em; } h2 { font-size: 15px; } h3 { font-size: 13.5px; } h4 { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); font-weight: 600; }
p { margin: 0; } a { color: var(--accent); text-underline-offset: 2px; } a:hover { text-decoration-thickness: 2px; }
code, .mono { font-family: var(--mono); font-size: 0.92em; }
[id] { scroll-margin-top: 72px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 8px; top: -48px; background: var(--surface); border: 1px solid var(--border-strong); padding: 8px 12px; border-radius: var(--radius-sm); z-index: 100; }
.skip:focus { top: 8px; }

/* Shell */
.topbar { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); }
.topbar-inner { display: flex; align-items: center; gap: 16px; height: 42px; padding: 0 var(--gutter); max-width: var(--max); margin: 0 auto; }
.brand { font-weight: 650; letter-spacing: -0.01em; color: var(--text); text-decoration: none; white-space: nowrap; }
.brand span { color: var(--text-3); font-weight: 500; }
.nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.nav a { color: var(--text-2); text-decoration: none; padding: 4px 10px; border-radius: var(--radius-sm); font-weight: 500; white-space: nowrap; }
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a[aria-current="page"] { color: var(--text); background: var(--surface-2); }
.page { max-width: var(--max); margin: 0 auto; padding: 18px var(--gutter) 36px; }
.page-head { display: flex; flex-wrap: wrap; gap: 16px 32px; align-items: flex-end; justify-content: space-between; padding-bottom: 12px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.page-head p { color: var(--text-2); max-width: 90ch; margin-top: 4px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.section { margin-top: 24px; } .section > header { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.section > header p { color: var(--text-2); }
.footer { border-top: 1px solid var(--border); color: var(--text-3); font-size: 13px; }
.footer-inner { max-width: var(--max); margin: 0 auto; padding: 10px var(--gutter); display: flex; flex-wrap: wrap; gap: 6px 24px; justify-content: space-between; }

/* Layout helpers */
.grid { display: grid; gap: 10px; } .grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); } .grid.cols-4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr)); }
.stack > * + * { margin-top: 8px; } .row { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; } .spacer { flex: 1; }
.muted { color: var(--text-2); } .subtle { color: var(--text-3); } .small { font-size: 13px; }

/* Surfaces */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; }
.card > h3 + * { margin-top: 6px; }
.kpi .label { color: var(--text-3); font-size: 12px; } .kpi .value { font-size: 20px; font-weight: 650; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; margin-top: 2px; }
.kpi .note { color: var(--text-2); font-size: 12px; margin-top: 2px; }
.callout { border: 1px solid var(--border); border-left: 3px solid var(--accent); background: var(--surface); border-radius: var(--radius-sm); padding: 7px 12px; color: var(--text-2); font-size: 12.5px; }
.callout strong { color: var(--text); } .callout.warn { border-left-color: var(--warn); } .callout.bad { border-left-color: var(--bad); }

/* Controls */
.btn { font: inherit; font-weight: 500; display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); cursor: pointer; text-decoration: none; min-height: 30px; font-size: 13px; }
.btn:hover { background: var(--surface-2); } .btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); } .btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--text-2); } .btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.field { display: flex; flex-direction: column; gap: 4px; } .field > label { font-size: 12px; font-weight: 500; color: var(--text-2); }
.field .hint { font-size: 12px; color: var(--text-3); }
input[type=text], input[type=search], select, textarea { font: inherit; width: 100%; padding: 5px 8px; background: var(--surface); color: var(--text); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); min-height: 30px; }
textarea { resize: vertical; line-height: 1.5; } input::placeholder, textarea::placeholder { color: var(--text-3); }
.segmented { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface); }
.segmented button { font: inherit; font-size: 13px; font-weight: 500; border: 0; background: transparent; color: var(--text-2); padding: 4px 11px; cursor: pointer; }
.segmented button + button { border-left: 1px solid var(--border); } .segmented button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }
.segmented button:hover { color: var(--text); }

/* Tables */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th, table.data td { padding: 6px 12px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.data thead th { position: sticky; top: 0; background: var(--surface-2); color: var(--text-2); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }
table.data tbody tr:last-child td { border-bottom: 0; } table.data tbody tr:hover { background: var(--surface-2); }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; }
table.data th button { font: inherit; color: inherit; text-transform: inherit; letter-spacing: inherit; font-weight: inherit; background: none; border: 0; padding: 0; cursor: pointer; display: inline-flex; gap: 6px; align-items: center; }
table.data th button:hover { color: var(--text); } table.data th[aria-sort] button::after { content: "↕"; opacity: .4; } table.data th[aria-sort="ascending"] button::after { content: "↑"; opacity: 1; } table.data th[aria-sort="descending"] button::after { content: "↓"; opacity: 1; }
.rank { color: var(--text-3); font-variant-numeric: tabular-nums; width: 1%; }
.model-name { font-weight: 600; } .model-sub { color: var(--text-3); font-size: 11.5px; }

/* Meters and badges */
.meter { display: inline-flex; align-items: center; gap: 8px; min-width: 120px; width: 100%; }
.meter-track { flex: 1; height: 6px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 99px; overflow: hidden; }
.meter-fill { height: 100%; background: var(--accent); border-radius: 99px; } .meter-val { font-variant-numeric: tabular-nums; min-width: 48px; text-align: right; }
.badge { display: inline-block; font-size: 12px; font-weight: 500; padding: 2px 8px; border-radius: 99px; border: 1px solid var(--border-strong); color: var(--text-2); background: var(--surface); }
.badge.good { color: var(--good); background: var(--good-soft); border-color: transparent; } .badge.warn { color: var(--warn); background: var(--warn-soft); border-color: transparent; }
.badge.bad { color: var(--bad); background: var(--bad-soft); border-color: transparent; } .badge.accent { color: var(--accent); background: var(--accent-soft); border-color: transparent; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 99px; background: var(--text-3); margin-right: 6px; } .dot.up { background: var(--good); } .dot.down { background: var(--bad); }

/* Model codes and the site-wide models panel */
.mtag { display: inline-flex; align-items: baseline; gap: 6px; white-space: nowrap; }
.mcode { font-family: var(--mono); font-size: 0.86em; font-weight: 600; letter-spacing: .02em; padding: 0 5px; border-radius: 4px; background: var(--accent-soft); color: var(--accent); }
.mname { color: var(--text); }
.models-btn { gap: 8px; } .models-btn .dot { margin: 0; }
.models-panel { position: absolute; top: 46px; right: var(--gutter); width: min(760px, calc(100vw - 24px)); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius); box-shadow: 0 10px 32px rgba(0,0,0,.18); z-index: 40; padding: 12px 14px; }
.models-panel h3 { margin-bottom: 2px; } .models-panel .note { color: var(--text-3); font-size: 12px; margin-top: 8px; }
.models-panel table { margin-top: 8px; } .models-panel td.dim { color: var(--text-3); }
.opt-off { color: var(--text-3); }

/* States */
.skeleton { background: linear-gradient(90deg, var(--surface-2), var(--border), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; border-radius: var(--radius-sm); min-height: 16px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.state { text-align: center; padding: 24px 12px; color: var(--text-2); } .state h3 { color: var(--text); margin-bottom: 4px; }
.toast-region { position: fixed; right: 16px; bottom: 16px; display: grid; gap: 8px; z-index: 50; }
.toast { background: var(--text); color: var(--bg); padding: 10px 14px; border-radius: var(--radius-sm); font-size: 14px; box-shadow: 0 6px 24px rgba(0,0,0,.2); }
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; } * { scroll-behavior: auto !important; } }
@media (max-width: 640px) { h1 { font-size: 24px; } .topbar-inner { gap: 12px; } .brand span { display: none; } }
@media print {
  .topbar, .footer, .actions, .toast-region, .skip { display: none !important; }
  body { background: #fff; color: #000; font-size: 11pt; } .page { padding: 0; max-width: none; }
  .card, .table-wrap { break-inside: avoid; border-color: #ccc; } a { color: inherit; text-decoration: none; }
  .section { margin-top: 24px; } :root { --surface-2: #f3f3f3; }
}
