/* Fonts (self-hosted; aligned with coraly.ai) */
@font-face { font-family: "Inter"; src: url("/fonts/inter-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Inter"; src: url("/fonts/inter-latin-500-normal.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Inter"; src: url("/fonts/inter-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Schibsted"; src: url("/fonts/schibsted-grotesk-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Schibsted"; src: url("/fonts/schibsted-grotesk-latin-500-normal.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Schibsted"; src: url("/fonts/schibsted-grotesk-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "JBMono"; src: url("/fonts/jetbrains-mono-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "JBMono"; src: url("/fonts/jetbrains-mono-latin-500-normal.woff2") format("woff2"); font-weight: 500; font-display: swap; }

/* Tokens (coraly.ai) */
:root {
  --paper: #f7f8fb;
  --surface: #ffffff;
  --ink: #1a1a2e;
  --ink-2: #3d4454;
  --ink-3: #6b7280;
  --rule: #e7e8ee;
  --rule-soft: #f2f2f6;
  --accent: #c9413c;
  --accent-hover: #b23834;
  --accent-wash: #fdf0ef;
  --ai: #c9413c;
  --ai-wash: #fdf0ef;
  --real: #185fa5;
  --real-wash: #e8f1fa;
  --unsure: #9aa0b4;
  --good: #0a8a0a;
  --critical: #c23434;
  --critical-wash: #fbeaea;
  --warning: #b37a00;
  --warning-wash: #fdf3dc;
  --sidebar: #0f1526;
  --sidebar-2: #1a2035;
  --sidebar-ink: #c5cad6;
  --code-bg: #0f1526;

  --display: "Schibsted", "Inter", system-ui, sans-serif;
  --body: "Inter", "Schibsted", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JBMono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --shadow-pop: 0 16px 40px -16px rgba(15, 21, 31, 0.14);

  --brand-img-w: 100px;
  --brand-img-h: 32px;
  --brand-product-size: 9.5px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; height: 100%; }
body {
  margin: 0; min-height: 100%; min-height: 100dvh; background: var(--paper); color: var(--ink);
  font: 400 15px/1.55 var(--body);
  font-feature-settings: "tnum" 0;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { font-family: var(--display); font-weight: 600; letter-spacing: -0.01em; margin: 0; line-height: 1.2; }
p { margin: 0 0 0.75em; }
a { color: var(--accent); text-underline-offset: 2px; }
a:hover { color: var(--accent-hover); }
code, pre, kbd { font-family: var(--mono); font-size: 0.86em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
::selection { background: var(--accent-wash); }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-3); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
[hidden] { display: none !important; }

/* Buttons & inputs */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: var(--r-sm); border: 1px solid transparent;
  font: 600 14px/1 var(--body); cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background-color .15s, border-color .15s, color .15s;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); color: #fff; }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--rule); }
.btn-secondary:hover { border-color: var(--ink-3); color: var(--ink); }
.btn-ghost { background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--rule-soft); color: var(--ink); }
.btn-danger { background: var(--surface); color: var(--critical); border-color: #efc9c9; }
.btn-danger:hover { background: var(--critical-wash); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; flex: none; }

.field { display: grid; gap: 6px; margin-bottom: 16px; }
.field label { font-weight: 600; font-size: 13px; color: var(--ink-2); }
.input {
  width: 100%; height: 44px; padding: 0 14px; border-radius: var(--r-sm);
  border: 1px solid var(--rule); background: var(--surface); color: var(--ink);
  font: 400 15px var(--body); transition: border-color .15s, box-shadow .15s;
}
.input:hover { border-color: #c5cad8; }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-wash); }
.hint { font-size: 13px; color: var(--ink-3); }

.alert { padding: 12px 14px; border-radius: var(--r-sm); font-size: 14px; display: flex; gap: 10px; align-items: flex-start; }
.alert svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.alert-error { background: var(--critical-wash); color: #8f2222; }
.alert-ok { background: #e6f4e6; color: #145c14; }
.alert-warn { background: var(--warning-wash); color: #6e4b00; }

/* Login */
.login {
  min-height: 100dvh;
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}
.login-art {
  background: var(--sidebar); color: #fff; padding: 48px 56px; display: flex; flex-direction: column; justify-content: flex-start;
  min-height: 100dvh;
  position: relative; overflow: hidden;
}
.login-art::before {
  content: ""; position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 70% 50% at 12% 18%, rgba(201, 65, 60, 0.16), transparent 55%),
    radial-gradient(ellipse 55% 45% at 88% 72%, rgba(255, 255, 255, 0.04), transparent 50%);
  pointer-events: none;
}
.login-art-lead {
  position: relative; z-index: 1;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-top: 6vh;
  padding-bottom: 32px;
}
.login-art .login-foot { position: relative; z-index: 1; flex: none; margin-top: auto; }
.brand { display: flex; align-items: center; gap: 10px; font: 700 18px var(--display); color: inherit; text-decoration: none; }
.brand-mark { width: 28px; height: 28px; flex: none; }
.brand-lockup--stack {
  flex-direction: column;
  align-items: center;
  gap: 0;
  text-decoration: none;
  color: inherit;
  text-align: center;
}
.brand-mark-img {
  display: block;
  width: var(--brand-img-w);
  height: var(--brand-img-h);
  object-fit: cover;
  object-position: center top;
  flex: none;
}
.brand-product {
  display: block;
  margin-top: 4px;
  font: 500 var(--brand-product-size)/1.35 var(--body);
  letter-spacing: 0.03em;
  color: var(--ink-3);
  white-space: nowrap;
}
.brand-lockup--login-corner { align-items: flex-end; text-align: right; }
.brand-lockup--login-corner .brand-mark-img { margin-left: auto; }
.login-brand {
  position: absolute;
  top: 28px;
  right: clamp(28px, 5vw, 72px);
  z-index: 2;
  max-width: calc(var(--brand-img-w) + 32px);
}
.brand small { font: 500 13px var(--body); color: var(--sidebar-ink); padding-left: 10px; border-left: 1px solid #3a4060; }
.login-art h1 { font-size: clamp(34px, 3.6vw, 52px); font-weight: 600; line-height: 1.05; letter-spacing: -0.025em; max-width: 13ch; }
.login-art p { color: var(--sidebar-ink); max-width: 44ch; font-size: 16px; margin-top: 18px; }
.login-hero {
  width: min(480px, 100%);
  margin: 40px 0 8px;
}
.login-hero-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
  border-radius: var(--r-lg);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.35);
  background: #0a0e18;
}
.login-hero-pane { position: relative; margin: 0; }
.login-hero-pane img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  aspect-ratio: 1;
  vertical-align: middle;
}
.login-hero-pane--altered { box-shadow: inset 0 0 0 2px var(--accent); }
.login-hero-scan {
  position: absolute;
  inset: 8% 6%;
  border: 2px solid var(--accent);
  border-radius: 6px;
  pointer-events: none;
  box-shadow: inset 0 0 24px rgba(201, 65, 60, 0.12);
}
.login-flag {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 5px 9px;
  border-radius: 5px;
  background: var(--accent);
  color: #fff;
  font: 600 10.5px/1.2 var(--body);
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  z-index: 1;
}
.login-flag--muted { background: rgba(15, 21, 31, 0.82); color: #f2f3f6; }
.login-hero-cap {
  margin: 12px 0 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--sidebar-ink);
  max-width: 46ch;
}
.login-foot { color: #8f95b2; font-size: 13px; }
.login-form-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  min-height: 100dvh;
  width: 100%;
  padding: 88px clamp(28px, 5vw, 72px) 48px;
  background: linear-gradient(180deg, var(--surface) 0%, var(--paper) 100%);
}
.login-panel {
  width: 100%;
  display: flex;
  justify-content: center;
}
.login-form { width: 100%; max-width: min(560px, 100%); }
.login-form h2 { font-size: 28px; margin-bottom: 6px; margin-top: 0; }
.login-form .sub { color: var(--ink-2); margin-bottom: 28px; }
.login-form .btn { width: 100%; height: 46px; margin-top: 8px; }
.pw-wrap { position: relative; }
.pw-toggle { position: absolute; right: 6px; top: 6px; height: 32px; }
.login-terms {
  margin: 4px 0 16px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--ink-2);
  align-items: flex-start;
}
.login-terms input { margin-top: 2px; }
.login-terms a { color: var(--ink); font-weight: 500; text-decoration: underline; }
.login-terms a:hover { color: var(--accent); }
.login-help { margin-top: 20px; font-size: 14px; color: var(--ink-3); text-align: center; }

/* App shell */
body.app-dash { height: 100dvh; overflow: hidden; }
.shell {
  display: grid; grid-template-columns: 240px minmax(0, 1fr);
  height: 100dvh; width: 100%; overflow: hidden;
}
.sidebar {
  background: var(--surface);
  color: var(--ink-2);
  padding: 22px 14px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  height: 100%;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  border-right: 1px solid var(--rule);
}
.sidebar .brand { color: var(--ink); padding: 0 8px; }
.sidebar .brand.brand-lockup--stack {
  align-self: center;
  width: 100%;
  padding: 0 4px 8px;
}
.nav { display: grid; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: var(--r-sm);
  color: var(--ink-2); text-decoration: none; font-weight: 500; font-size: 14px;
}
.nav a svg { width: 18px; height: 18px; opacity: .9; }
.nav a:hover { background: var(--rule-soft); color: var(--ink); }
.nav a[aria-current="page"] { background: var(--accent-wash); color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }
.nav-label { font-size: 12px; color: var(--ink-3); padding: 0 10px; margin-bottom: 4px; }
.sidebar-foot { margin-top: auto; padding: 0 4px 6px; }
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 8px 8px 10px;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  box-shadow: 0 1px 2px rgba(15, 21, 31, 0.04);
}
.sidebar-user .who {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
  padding: 4px 6px 4px 2px;
  border-radius: var(--r-sm);
  text-decoration: none;
  color: inherit;
  transition: background-color .15s;
}
.sidebar-user .who:hover { background: var(--rule-soft); }
.sidebar-user .who[aria-current="page"] { background: var(--accent-wash); }
.who-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font: 600 12px var(--display); flex: none; letter-spacing: 0.02em; }
.who-name { color: var(--ink); font-weight: 600; font-size: 14px; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who-sub { font-size: 12px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1.3; }
.credits-overview-card .panel-head { align-items: center; }
.credits-overview-card.panel-gap { margin-bottom: 24px; }
.credits-overview-in { display: grid; gap: 14px; }
.credits-fraction {
  display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 10px;
  line-height: 1.2;
}
.credits-fraction--lg { margin-bottom: 6px; }
.credits-fraction--lg .credits-used { font-size: 36px; }
.credits-fraction--lg .credits-total { font-size: 28px; }
.credits-used { font: 600 32px var(--display); letter-spacing: -0.03em; color: var(--ink); }
.credits-slash { font: 500 22px var(--display); color: var(--ink-3); margin: 0 2px; }
.credits-total { font: 600 22px var(--display); color: var(--ink-2); letter-spacing: -0.02em; }
.credits-fraction-label { font-size: 14px; color: var(--ink-3); font-weight: 500; }
.credits-fraction-note { font-size: 14px; }
.credits-meta { margin: 0; font-size: 13px; color: var(--ink-3); line-height: 1.45; max-width: 52ch; }
.credits-hint { margin: 0; }
.credits-full { margin: 0; }
.credits-usage-panel .usage-dl { max-width: 520px; margin-top: 20px; }
.meter-lg { height: 10px; border-radius: 5px; }
.kpis.kpis-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 860px) { .kpis.kpis-3 { grid-template-columns: 1fr; } }
.sidebar-signout {
  display: grid;
  place-items: center;
  flex: none;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--ink-3);
  cursor: pointer;
  transition: background-color .15s, color .15s;
}
.sidebar-signout:hover { background: var(--rule-soft); color: var(--ink); }
.sidebar-signout svg { width: 18px; height: 18px; }

.main {
  padding: 32px clamp(20px, 4vw, 48px) 64px; width: 100%; max-width: none; min-width: 0; box-sizing: border-box;
  height: 100%; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
}
.badge.env-tier-sandbox { background: #f4f5f8; color: #4a5568; font-weight: 600; }
.badge.env-tier-production { background: #e8f5ee; color: #1a6b3d; font-weight: 600; }
.result-env { margin: 0 0 16px; }
.sidebar-workspace { display: block; margin-top: 10px; }
.sidebar .brand-lockup .sidebar-workspace { margin-left: 0; }
.workspace-tag {
  display: inline-block; font-size: 11px; font-weight: 600; letter-spacing: 0.03em;
  padding: 4px 10px; border-radius: 999px; background: #f4f5f8; color: #4a5568;
}
.workspace-tag--live { background: #e8f5ee; color: #1a6b3d; }
.workspace-panel { margin-bottom: 0; border-color: var(--rule); }
.workspace-panel--live .workspace-panel-in { border-left: 3px solid #3d9a62; }
.workspace-panel-in {
  display: grid; grid-template-columns: 1fr 1fr; gap: 28px; align-items: start;
}
@media (max-width: 768px) { .workspace-panel-in { grid-template-columns: 1fr; } }
.workspace-title { font-size: 18px; font-weight: 600; margin: 8px 0 6px; letter-spacing: -0.02em; }
.workspace-desc { margin: 0; font-size: 14px; color: var(--ink-2); line-height: 1.5; max-width: 42ch; }
.workspace-services { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0; border: 1px solid var(--rule); border-radius: var(--r-md, 10px); overflow: hidden; }
.workspace-services li {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 11px 14px; font-size: 13px; border-bottom: 1px solid var(--rule);
  background: var(--surface, #fff);
}
.workspace-services li:last-child { border-bottom: 0; }
.workspace-services li em { font-style: normal; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-3); }
.workspace-services li.on em { color: #1a6b3d; }
.workspace-services li.off { color: var(--ink-2); }
.workspace-services li.off span { opacity: 0.85; }

.access-pill { display: inline-block; font-size: 11px; font-weight: 600; letter-spacing: 0.02em; padding: 3px 8px; border-radius: 999px; white-space: nowrap; }
.access-pill--on { background: #e8f5ee; color: #1a6b3d; }
.access-pill--int { background: #eef3ff; color: #2b4c9e; }
.access-pill--lock { background: #f3f4f6; color: #5c6570; border: 1px solid var(--rule, #e2e5ea); }
.endpoint-avail { margin-left: 8px; vertical-align: middle; }
.endpoint-avail .access-pill { font-size: 10px; }
.endpoint--locked { opacity: 0.92; }
.ep-lock { margin-left: 8px; font-size: 11px; font-weight: 600; text-transform: uppercase; color: #8a5a00; }
.cap-docs-table .muted { font-size: 13px; }

.access-hero-in { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; }
@media (max-width: 720px) { .access-hero-in { grid-template-columns: 1fr; } }
.access-kicker { font-size: 13px; color: var(--ink-2); margin: 0 0 8px; text-transform: capitalize; }
.access-meter-line { margin: 0 0 10px; font-size: 15px; }
.access-meter { max-width: 280px; margin-top: 4px; }
.access-prod-url { display: block; margin: 8px 0; font-size: 13px; word-break: break-all; }
.access-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 20px; }
@media (max-width: 900px) { .access-cols { grid-template-columns: 1fr; } }
.access-locked-col { background: var(--rule-soft, #fafbfc); }
.cap-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.cap-card { border: 1px solid var(--rule); border-radius: var(--r-md, 10px); padding: 14px 16px; background: var(--surface, #fff); }
.cap-card--locked { background: #fafbfc; border-style: dashed; }
.cap-card--integration { border-color: #c5d4f5; }
.cap-card-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.cap-icon { display: inline-flex; width: 28px; height: 28px; color: var(--ink-2); }
.cap-icon svg { width: 22px; height: 22px; }
.cap-card--locked .cap-icon { color: #9aa3af; }
.cap-name { font-size: 15px; margin: 0 0 6px; }
.cap-route { display: block; font-size: 12px; margin-bottom: 8px; }
.cap-sum { font-size: 13px; color: var(--ink-2); margin: 0 0 8px; line-height: 1.45; }
.cap-note { font-size: 12px; margin: 0 0 8px; color: var(--ink-2); }
.cap-note--lock { color: #8a5a00; }
.cap-soon { font-size: 12px; font-weight: 400; }
.cap-docs { font-size: 12px; }
.access-matrix td { vertical-align: middle; }
.sub.block { display: block; margin-top: 4px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 28px; flex-wrap: wrap; }
.page-head h1 { font-size: 30px; letter-spacing: -0.02em; }
.page-head p { color: var(--ink-2); margin: 6px 0 0; }
.mobile-top { display: none; }

.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r-sm); padding: 3px; }
.seg button { border: 0; background: transparent; height: 32px; padding: 0 14px; border-radius: 4px; font: 600 13px var(--body); color: var(--ink-2); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--accent); color: #fff; }
.seg button:not([aria-pressed="true"]):hover { color: var(--ink); background: var(--rule-soft); }

.panel { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r-md); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px 0; flex-wrap: wrap; }
.panel-head h2 { font-size: 17px; }
.panel-head .muted { font-size: 13px; }
.panel-body { padding: 18px 22px 22px; }

/* Authenticity split (hero) */
.split { margin-bottom: 28px; }
.split-top { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; margin-bottom: 14px; }
.split-side .k { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; color: var(--ink-2); }
.split-side .v { font: 600 clamp(40px, 5vw, 64px)/1 var(--display); letter-spacing: -0.035em; margin-top: 6px; font-variant-numeric: tabular-nums; }
.split-side .v small { font: 500 16px var(--body); color: var(--ink-3); letter-spacing: 0; margin-left: 8px; }
.split-side.right { text-align: right; }
.split-side.right .k { justify-content: flex-end; }
.swatch { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.sw-ai { background: var(--ai); }
.sw-real { background: var(--real); }
.sw-unsure { background: var(--unsure); }
.split-bar { display: flex; gap: 3px; height: 22px; }
.split-bar span { display: block; height: 100%; min-width: 4px; transition: flex-grow .6s cubic-bezier(.2,.7,.2,1); }
.split-bar span:first-child { border-radius: 6px 0 0 6px; }
.split-bar span:last-child { border-radius: 0 6px 6px 0; }
.split-bar span:only-child { border-radius: 6px; }
.split-bar .ai { background: var(--ai); }
.split-bar .real { background: var(--real); }
.split-bar .unsure { background: var(--unsure); }
.split-bar.empty { background: var(--rule-soft); border-radius: 6px; }
.split-foot { display: flex; justify-content: space-between; margin-top: 10px; font-size: 13px; color: var(--ink-3); }

/* KPI row */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 20px; }
.kpi { padding: 18px 22px; border-left: 1px solid var(--rule); }
.kpi:first-child { border-left: 0; }
.kpi .k { font-size: 13px; color: var(--ink-2); font-weight: 500; }
.kpi .v { font: 600 28px/1.15 var(--display); margin-top: 6px; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.kpi .d { font-size: 12.5px; color: var(--ink-3); margin-top: 4px; }
.delta-up { color: var(--good); }
.delta-down { color: var(--critical); }
.meter { height: 6px; background: var(--rule-soft); border-radius: 3px; margin-top: 10px; overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.meter.warn i { background: var(--warning); }

.grid-2 { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(0, 1fr); gap: 20px; margin-bottom: 20px; }

/* Charts */
.legend { display: flex; gap: 16px; font-size: 13px; color: var(--ink-2); flex-wrap: wrap; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-wrap { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .grid line { stroke: var(--rule-soft); stroke-width: 1; }
.chart .axis text { fill: var(--ink-3); font: 400 11px var(--body); font-variant-numeric: tabular-nums; }
.chart .baseline { stroke: var(--rule); }
.chart .col:hover .hit, .chart .col.active .hit { fill: rgba(22, 26, 46, 0.05); }
.chart .hit { fill: transparent; cursor: default; }
.tooltip {
  position: absolute; pointer-events: none; background: var(--ink); color: #fff; border-radius: var(--r-sm);
  padding: 10px 12px; font-size: 12.5px; min-width: 150px; box-shadow: var(--shadow-pop); z-index: 5;
  transform: translate(-50%, calc(-100% - 10px));
}
.tooltip b { display: block; font-weight: 600; margin-bottom: 6px; }
.tooltip .row { display: flex; justify-content: space-between; gap: 16px; align-items: center; }
.tooltip .row span:first-child { display: inline-flex; align-items: center; gap: 6px; color: #c9cde0; }
.tooltip .num { font-weight: 600; }
.link-btn { background: none; border: 0; padding: 0; color: var(--accent); font: 500 13px var(--body); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }

.bars { display: grid; gap: 12px; }
.bar-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; font-size: 13.5px; }
.bar-row .name { color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-row .val { color: var(--ink-2); font-variant-numeric: tabular-nums; }
.bar-row .val b { color: var(--ink); font-weight: 600; margin-right: 6px; }
.bar-row .track { grid-column: 1 / -1; height: 8px; background: var(--rule-soft); border-radius: 4px; overflow: hidden; }
.bar-row .fill { height: 100%; background: var(--ai); border-radius: 4px; }

/* Tables */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
.t th { text-align: left; font-weight: 600; font-size: 12.5px; color: var(--ink-3); padding: 10px 14px; border-bottom: 1px solid var(--rule); white-space: nowrap; }
.t td { padding: 12px 14px; border-bottom: 1px solid var(--rule-soft); vertical-align: middle; white-space: nowrap; }
.t tr:last-child td { border-bottom: 0; }
.t tbody tr.clickable { cursor: pointer; }
.t tbody tr.clickable:hover td { background: #f8f9fb; }
.t .r { text-align: right; }
.t .file { max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.t .sub { display: block; font-size: 12px; color: var(--ink-3); }

.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; padding: 3px 9px 3px 7px; border-radius: 999px; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.b-ai { background: var(--ai-wash); color: #a33430; }
.b-real { background: var(--real-wash); color: #1d5ba6; }
.b-unsure { background: #eef0f4; color: #5b6178; }
.b-failed { background: var(--critical-wash); color: #a12a2a; }
.b-review { background: var(--warning-wash); color: #7a5300; }
.b-review::before { display: none; }
.tag { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 4px; background: var(--rule-soft); color: var(--ink-2); }

.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.pager { display: flex; justify-content: space-between; align-items: center; padding: 14px 22px; border-top: 1px solid var(--rule); font-size: 13px; color: var(--ink-3); }
.pager .btns { display: flex; gap: 8px; }

.empty { text-align: center; padding: 48px 24px; color: var(--ink-2); }
.empty h3 { font-size: 18px; margin-bottom: 6px; color: var(--ink); }
.empty .btn { margin-top: 14px; }

/* Test image */
.test-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 20px; align-items: start; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--rule); padding: 0 22px; }
.tabs button { border: 0; background: none; padding: 14px 4px 12px; margin-right: 18px; font: 600 14px var(--body); color: var(--ink-3); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.drop {
  border: 1.5px dashed #c5cad8; border-radius: var(--r-md); padding: 36px 20px; text-align: center; cursor: pointer;
  background: #fafbfc; transition: border-color .15s, background .15s; display: grid; gap: 6px; justify-items: center;
}
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-wash); }
.drop svg { width: 36px; height: 36px; color: var(--accent); margin-bottom: 6px; }
.drop strong { font-size: 15px; }
.preview { margin-top: 0; border-radius: var(--r-md); overflow: hidden; background: #e9ecf2; display: grid; place-items: center; max-height: none; }
.preview img { max-width: 100%; max-height: 360px; display: block; }
.preview-name { margin: 12px 16px 0; font-size: 14px; font-weight: 600; color: var(--ink); text-align: center; word-break: break-word; }
.preview-change { margin: 6px 16px 14px; justify-self: center; }
.result-verdict { display: flex; align-items: center; gap: 16px; padding-bottom: 18px; border-bottom: 1px solid var(--rule-soft); margin-bottom: 18px; }
.verdict-icon { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; flex: none; }
.verdict-icon svg { width: 26px; height: 26px; }
.verdict-icon.ai { background: var(--ai-wash); color: #c4501f; }
.verdict-icon.real { background: var(--real-wash); color: var(--real); }
.verdict-icon.unsure { background: #eef0f4; color: #5b6178; }
.result-verdict h3 { font-size: 22px; }
.result-verdict p { margin: 2px 0 0; color: var(--ink-2); font-size: 14px; }
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 24px; margin-bottom: 18px; }
.fact .k { font-size: 12.5px; color: var(--ink-3); }
.fact .v { font-weight: 600; font-size: 15px; margin-top: 2px; font-variant-numeric: tabular-nums; }
.score { display: flex; align-items: center; gap: 10px; }
.score .meter { flex: 1; margin: 0; height: 8px; }
.score .meter i { background: var(--ai); }
.alts { display: grid; gap: 8px; margin-bottom: 18px; }
.alts .bar-row .fill { background: #f3a57f; }

/* Code */
.code { position: relative; background: var(--code-bg); color: #e6e8f2; border-radius: var(--r-md); overflow: hidden; }
.code pre { margin: 0; padding: 18px 20px; overflow-x: auto; font-size: 13px; line-height: 1.65; }
.code .copy { position: absolute; top: 10px; right: 10px; background: #2b3150; color: #dfe2f0; border: 0; height: 28px; padding: 0 10px; border-radius: 5px; font: 500 12px var(--body); cursor: pointer; }
.code .copy:hover { background: #3a4168; }
.code-tabs { display: flex; gap: 2px; background: #1e2238; padding: 6px 6px 0; }
.code-tabs button { background: none; border: 0; color: #9aa0bd; font: 500 12.5px var(--body); padding: 8px 12px; border-radius: 6px 6px 0 0; cursor: pointer; }
.code-tabs button[aria-selected="true"] { background: var(--code-bg); color: #fff; }
.tok-k { color: #b3a8ff; } .tok-s { color: #9fe0b9; } .tok-n { color: #ffbf8a; } .tok-c { color: #7a819f; } .tok-p { color: #8fc5ff; }

/* Keys */
.key-new { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.key-new .input { max-width: 320px; height: 40px; }
.key-new--blocked .input { opacity: .55; }
.key-limit-note { flex: 1 1 100%; margin: 4px 0 0; }
.secret { display: flex; gap: 10px; align-items: center; background: var(--paper); border: 1px solid var(--rule); border-radius: var(--r-sm); padding: 10px 12px; margin-top: 12px; }
.secret code { flex: 1; overflow-x: auto; white-space: nowrap; font-size: 13px; }
.confirm { display: inline-flex; gap: 6px; align-items: center; }

/* Drawer */
.drawer-backdrop { position: fixed; inset: 0; background: rgba(22, 26, 46, .35); z-index: 20; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100%); background: var(--surface); z-index: 21;
  box-shadow: var(--shadow-pop); display: flex; flex-direction: column; animation: slidein .22s cubic-bezier(.2,.7,.2,1);
}
.drawer-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 22px; border-bottom: 1px solid var(--rule); }
.drawer-head h2 { font-size: 18px; }
.drawer-body { padding: 22px; overflow-y: auto; }
@keyframes slidein { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff;
  padding: 11px 16px; border-radius: var(--r-sm); font-size: 14px; z-index: 40; box-shadow: var(--shadow-pop);
}
.skeleton { background: linear-gradient(90deg, var(--rule-soft), #f6f7fa, var(--rule-soft)); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 6px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.spinner { width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; flex-shrink: 0; }
.spinner-lg { width: 40px; height: 40px; border-width: 3px; color: var(--accent); }
@keyframes spin { to { transform: rotate(360deg); } }
.result-loading {
  min-height: 220px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; text-align: center; padding: 32px 20px;
}
.result-loading-msg { margin: 0; font-weight: 600; font-size: 15px; color: var(--ink); }
.result-loading .hint { margin: 0; max-width: 28ch; }

.settings { display: grid; gap: 20px; max-width: 760px; }
.dl { display: grid; grid-template-columns: 160px 1fr; gap: 12px 16px; font-size: 14px; margin: 0; }
.dl dt { color: var(--ink-3); }
.dl dd { margin: 0; font-weight: 500; }

/* Docs */
.docs-page { background: var(--paper); }
.docs-top { position: sticky; top: 0; z-index: 10; background: rgba(255,255,255,.94); backdrop-filter: blur(10px); border-bottom: 1px solid var(--rule); }
.docs-top-in {
  max-width: 1240px; margin: 0 auto; min-height: 76px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px 28px;
}
.docs-top .brand { color: var(--ink); }
.docs-top-end { margin-left: auto; display: flex; align-items: center; gap: 16px; }
.docs-page-label {
  font: 600 14px var(--body);
  color: var(--ink-2);
  white-space: nowrap;
}
.docs { max-width: 1080px; margin: 0 auto; display: grid; grid-template-columns: 168px minmax(0, 1fr); gap: 48px; padding: 48px 28px 88px; }
.toc { position: sticky; top: 88px; align-self: start; font-size: 13px; display: flex; flex-direction: column; gap: 4px; }
.toc a { color: var(--ink-3); text-decoration: none; padding: 6px 0; border-left: 0; line-height: 1.35; transition: color .15s; }
.toc a:hover { color: var(--ink); }
.toc a.on { color: var(--ink); font-weight: 600; }
.doc { max-width: 640px; }
.doc section { padding-bottom: 40px; margin-bottom: 40px; border-bottom: 1px solid var(--rule-soft); scroll-margin-top: 84px; }
.doc section:last-child { border-bottom: 0; margin-bottom: 0; }
.doc h1 { font-size: 32px; letter-spacing: -0.04em; font-weight: 600; margin-bottom: 12px; }
.doc .lede { font-size: 17px; color: var(--ink-2); max-width: 56ch; line-height: 1.55; margin-bottom: 20px; }
.doc .hint { font-size: 14px; color: var(--ink-2); margin: 8px 0 12px; }
.doc .docs-env-blurb { font-size: 14px; line-height: 1.5; }
.doc .docs-base { display: flex; flex-direction: column; gap: 6px; margin: 20px 0 8px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r-md); }
.doc .docs-base code { font-size: 14px; word-break: break-all; }
.doc h2 { font-size: 20px; margin-bottom: 10px; letter-spacing: -0.02em; font-weight: 600; }
.doc h3 { font-size: 15px; margin: 24px 0 8px; font-weight: 600; color: var(--ink); }
.doc .steps-min { padding-left: 1.25rem; margin: 12px 0 20px; }
.doc .steps-min li { margin-bottom: 8px; color: var(--ink-2); }
.doc .field-list p { margin: 0 0 10px; font-size: 14px; color: var(--ink-2); line-height: 1.5; }
.doc .docs-errors-list { font-size: 14px; color: var(--ink-2); margin: 16px 0; padding-left: 1.1rem; }
.doc .t-compact td { font-size: 13px; padding: 8px 12px; }
.doc p, .doc li { color: #2b3048; max-width: 70ch; }
.doc ul, .doc ol { padding-left: 20px; }
.doc li { margin-bottom: 6px; }
.doc p code, .doc li code, .doc td code { background: var(--rule-soft); padding: 2px 6px; border-radius: 4px; color: var(--ink); }
.doc .code { margin: 16px 0; }
.endpoint { display: flex; align-items: center; gap: 12px; font-family: var(--mono); font-size: 14px; padding: 12px 14px; border: 1px solid var(--rule); border-radius: var(--r-sm); background: var(--surface); margin: 14px 0; overflow-x: auto; }
.method { font: 600 12px var(--mono); padding: 3px 8px; border-radius: 4px; background: var(--accent-wash); color: var(--accent); }
.method.get { background: #e6f4e6; color: #145c14; }
.doc table.t { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r-md); border-collapse: separate; border-spacing: 0; overflow: hidden; margin: 16px 0; }
.doc .t td { white-space: normal; vertical-align: top; font-size: 14px; }
.doc .t td:first-child { white-space: nowrap; }
.callout { border: 1px solid var(--rule); border-left: 3px solid var(--accent); background: var(--surface); border-radius: 0 var(--r-sm) var(--r-sm) 0; padding: 14px 16px; margin: 18px 0; font-size: 14.5px; }
.callout.warn { border-left-color: var(--warning); }
.callout p:last-child { margin: 0; }
.steps { counter-reset: s; list-style: none; padding: 0 !important; }
.steps li { counter-increment: s; position: relative; padding-left: 40px; margin-bottom: 18px; }
.steps li::before { content: counter(s); position: absolute; left: 0; top: -2px; width: 26px; height: 26px; border-radius: 50%; background: var(--ink); color: #fff; font: 600 13px/26px var(--display); text-align: center; }

/* Responsive */
@media (max-width: 1080px) {
  .grid-2, .test-grid { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi:nth-child(3) { border-left: 0; }
  .kpi:nth-child(n+3) { border-top: 1px solid var(--rule); }
}
@media (max-width: 860px) {
  .login { grid-template-columns: 1fr; }
  .login-art { padding: 32px 24px; order: 2; }
  .login-form-wrap { order: 1; padding: 88px 20px 24px; }
  .login-brand { top: 20px; right: 20px; max-width: calc(var(--brand-img-w) + 24px); }
  .docs-page-label { display: none; }
  .login-hero { display: none; }
  body.app-dash { display: grid; grid-template-rows: auto minmax(0, 1fr); }
  .shell { grid-template-columns: 1fr; min-height: 0; height: auto; }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 30;
    height: 100dvh;
    transform: translateX(-100%); transition: transform .2s;
    box-shadow: 12px 0 32px rgba(22, 26, 46, 0.12);
  }
  .sidebar.open { transform: none; }
  .mobile-top {
    display: flex; align-items: center; justify-content: space-between; padding: 12px 16px;
    background: var(--surface); color: var(--ink); z-index: 15;
    border-bottom: 1px solid var(--rule);
  }
  .mobile-top .brand { color: var(--ink); padding: 0; }
  .mobile-top button { background: none; border: 0; color: var(--ink); padding: 6px; cursor: pointer; }
  .main { padding: 24px 16px 48px; }
  .docs { grid-template-columns: 1fr; gap: 24px; padding: 24px 16px 64px; }
  .toc { position: static; display: none; }
  .doc h1 { font-size: 34px; }
  .split-side .v small { display: block; margin: 6px 0 0; }
  .facts { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
.page-404 { padding-top: 18vh; }
.login-form .alert + .field, .login-form .field:first-of-type { margin-top: 16px; }

/* Small utilities used by app.js */
.sk-hero { height: 128px; margin-bottom: 28px; }
.sk-row { height: 96px; margin-bottom: 20px; }
.sk-chart { height: 280px; }
.sk-result { height: 220px; }
.json-h, .sm-h { font-size: 14px; font-family: var(--body); font-weight: 600; color: var(--ink-2); margin: 22px 0 10px; }
.notes { margin: 0 0 12px; padding-left: 18px; color: var(--ink-2); font-size: 14px; }
.id-line { font-size: 13px; margin: 12px 0 0; }
.id-line code { color: var(--ink-2); }
.review-note { margin-bottom: 18px; }
.kpi-of { font: 500 15px var(--body); letter-spacing: 0; }
.panel-body.table-body { padding: 8px 8px 4px; }
.btn-run { margin-top: 16px; width: 100%; }
.empty-sm { padding: 40px 16px; color: var(--ink-3); }
.panel-gap { margin-top: 20px; }
.key-alert { margin-top: 16px; }
.profile-hint { margin: 16px 0 0; }
.pw-form { max-width: 420px; }
.admin-grid { align-items: start; }
.admin-form .btn { width: 100%; margin-top: 4px; }
.dl-compact { grid-template-columns: 1fr auto; gap: 6px 16px; margin: 0 0 16px; max-width: 360px; }
.dl-compact dt { font-size: 12px; }
.t-admin td .sub { display: block; margin-top: 2px; }
.t-admin-req { font-size: 13px; }
.t-admin-req th, .t-admin-req td { white-space: nowrap; }
.t-admin-req .file { white-space: normal; min-width: 120px; }
.admin-notes { margin: 0 0 16px; max-width: 56ch; }
.admin-metrics { margin-bottom: 16px; }
.chk { display: flex; align-items: center; gap: 10px; font-size: 14px; margin: 12px 0 4px; cursor: pointer; }
.chk input { width: 16px; height: 16px; accent-color: var(--accent); }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.pw-form #pw-msg .alert { margin-bottom: 16px; }
.tip-total { border-top: 1px solid #3a4060; margin-top: 6px; padding-top: 6px; }
.tip-total span:first-child { color: #fff !important; }
.drop + .preview { margin-top: 16px; }

/* Fixes after visual review */
.bar-row .fill, .meter i { display: block; }
.login-form .pw-toggle { position: absolute; right: 6px; top: 6px; width: auto; height: 32px; margin: 0; }
.login-form .pw-wrap .input { padding-right: 72px; }
#view:focus { outline: none; }
.main { min-width: 0; }
.grid-2 > .panel { display: flex; flex-direction: column; }
.grid-2 > .panel > .panel-body { flex: 1; display: flex; flex-direction: column; justify-content: center; }
@media (max-width: 860px) {
  .split-top { flex-wrap: wrap; }
}
@media (max-width: 520px) {
  .kpis { grid-template-columns: 1fr; }
  .kpi { border-left: 0 !important; border-top: 1px solid var(--rule); }
  .kpi:first-child { border-top: 0; }
  .page-head .seg { width: 100%; }
  .page-head .seg button { flex: 1; }
}
