/* Nalvera — Shared Design System */
/* Fonts: system stack only — no external requests, fully GDPR-compliant */

:root {
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, 'Noto Sans', sans-serif;
  --font-mono: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, 'Courier New', monospace;
  --bg:            #060d1c;
  --surface:       #0a1525;
  --card:          #0e1e38;
  --card-hover:    #122445;
  --border:        #173058;
  --border-light:  #1f3d72;

  --blue:          #3b82f6;
  --blue-bright:   #60a5fa;
  --blue-dim:      #1d4ed8;
  --blue-glow:     rgba(59,130,246,0.14);
  --cyan:          #22d3ee;
  --cyan-glow:     rgba(34,211,238,0.10);

  --text-1:        #f8fafc;
  --text-2:        #c8d8e8;
  --text-3:        #8aa0b8;

  --green:         #10b981;
  --green-bg:      rgba(16,185,129,0.10);
  --amber:         #f59e0b;
  --amber-bg:      rgba(245,158,11,0.10);
  --red:           #ef4444;
  --red-bg:        rgba(239,68,68,0.10);
  --purple:        #8b5cf6;
  --purple-bg:     rgba(139,92,246,0.10);
  /* Partner Console accent — distinct from cyan (default), purple (lab),
     amber (admin), green-success, red-danger. */
  --teal:          #14b8a6;
  --teal-bright:   #2dd4bf;
  --teal-bg:       rgba(20,184,166,0.10);
  --teal-glow:     rgba(20,184,166,0.18);

  --radius-xs:     4px;
  --radius-sm:     6px;
  --radius:        10px;
  --radius-lg:     16px;
  --nav-h:         62px;
  --sidebar-w:     220px;

  --shadow:        0 4px 20px rgba(0,0,0,0.55);
  --shadow-lg:     0 8px 40px rgba(0,0,0,0.65);
  --glow-blue:     0 0 28px rgba(59,130,246,0.18);

  /* ── Type scale ─────────────────────────────────────────────────────────
     App chrome is data-dense: 13.5px body, 11.5px absolute floor. The two
     largest steps are public-page display sizes only. */
  --fs-xs:   11.5px;   /* table meta, captions, badges — the floor */
  --fs-sm:   12.5px;   /* secondary UI, hints */
  --fs-md:   13.5px;   /* app body default */
  --fs-lg:   15px;     /* panel/section titles */
  --fs-xl:   18px;     /* page titles */
  --fs-2xl:  24px;     /* dashboard headline numbers */
  --fs-3xl:  32px;     /* public pages */
  --fs-4xl:  44px;     /* public hero */
  --lh-tight:  1.25;
  --lh-data:   1.4;
  --lh-prose:  1.6;

  /* ── Spacing — 4px grid ─────────────────────────────────────────────── */
  --sp-1:  4px;  --sp-2:  8px;  --sp-3: 12px; --sp-4: 16px;
  --sp-5: 20px;  --sp-6: 24px;  --sp-7: 32px; --sp-8: 40px;
  --sp-9: 48px;  --sp-10: 64px;

  /* ── Semantic surfaces ──────────────────────────────────────────────────
     --bg-stage: the viewer canvas surround — darkest layer so grayscale
     tissue reads brighter than any chrome. */
  --bg-stage:      #04080f;
  --text-4:        #5f7390;   /* true-muted; placeholders, disabled copy */
  --border-focus:  var(--blue-bright);

  /* ── Job-status quartets (fg / bg / border / dot) ───────────────────────
     queued      neutral — waiting is not urgent
     processing  accent blue — the ONLY badge allowed a pulsing dot
     completed   green | failed red | cancelled flat gray (closed, calm)
     unknown     loud amber — an unrecognised status must look wrong  */
  --status-queued-fg:        #9bb0c9;
  --status-queued-bg:        rgba(116,143,176,0.12);
  --status-queued-border:    rgba(116,143,176,0.28);
  --status-processing-fg:    #60a5fa;
  --status-processing-bg:    rgba(59,130,246,0.12);
  --status-processing-border: rgba(59,130,246,0.30);
  --status-completed-fg:     #34d399;
  --status-completed-bg:     rgba(16,185,129,0.12);
  --status-completed-border: rgba(16,185,129,0.30);
  --status-failed-fg:        #f87171;
  --status-failed-bg:        rgba(239,68,68,0.12);
  --status-failed-border:    rgba(239,68,68,0.30);
  --status-cancelled-fg:     #8aa0b8;
  --status-cancelled-bg:     rgba(74,96,128,0.15);
  --status-cancelled-border: rgba(74,96,128,0.25);
  --status-unknown-fg:       #fbbf24;
  --status-unknown-bg:       rgba(245,158,11,0.14);
  --status-unknown-border:   rgba(245,158,11,0.40);

  /* ── Elevation (border-led on dark; shadows only for overlay layers) ── */
  --elev-popover:  0 8px 24px rgba(0,0,0,0.45);
  --elev-modal:    0 16px 48px rgba(0,0,0,0.6);

  /* ── Motion ─────────────────────────────────────────────────────────────
     Animate opacity/transform only; nothing animates inside the viewer
     panes during interaction. All of it is gated by the reduced-motion
     kill switch at the end of this file. */
  --dur-1: 80ms;    /* state flips: toggles, checks */
  --dur-2: 140ms;   /* hover / focus */
  --dur-3: 220ms;   /* panel & dialog enter */
  --dur-4: 360ms;   /* public-page reveals only */
  --ease-out:    cubic-bezier(0.2, 0, 0, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
}

:root { color-scheme: dark; }

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  scrollbar-gutter: stable;
  /* Force the vertical scrollbar to render unconditionally. This is the
     belt-and-braces fix for the dashboard width-flicker: even with
     scrollbar-gutter:stable, Chrome can briefly drop the gutter during a
     same-origin navigation when the new document's initial paint sees no
     overflow yet (dashboard renders with placeholders, then async API data
     pushes height above the viewport and the scrollbar appears — width
     visibly shrinks by ~15 px and snaps back). Always-on scrollbar means
     the gutter is reserved from the very first paint, no flicker. */
  overflow-y: scroll;
}

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text-1);
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  padding-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;

  scrollbar-gutter: stable;
  /* Suppress horizontal scrollbar that some pages (dashboard membership-
     overview grid, model-info popover) can transiently trigger as their
     content settles after first paint. Without this, navigating from
     submit-job → dashboard produced a sub-second "width-shrinks-then-snaps-
     back" flicker as the body briefly carried a horizontal scrollbar. */
  overflow-x: clip;
}

/* ─── SIDEBAR ─── */
.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; width: var(--sidebar-w); z-index: 100;
  background: #06101f;
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.sidebar-brand {
  padding: 20px 16px 16px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; flex-shrink: 0;
}
.sidebar-brand-icon {
  width: 34px; height: 34px; border-radius: 9px;
  background: linear-gradient(135deg, var(--blue-dim), var(--cyan));
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 12px; color: #fff; flex-shrink: 0;
  letter-spacing: -0.5px;
}
.sidebar-brand-name { font-size: 14px; font-weight: 700; color: var(--text-1); letter-spacing: -0.3px; }
.sidebar-brand-sub  { font-size: 10px; color: var(--text-3); margin-top: 1px; }

.sidebar-section-label {
  padding: 14px 16px 6px;
  font-size: 9px; font-weight: 700; color: var(--text-3);
  text-transform: uppercase; letter-spacing: 0.09em;
}
.sidebar-items { flex: 1; padding: 6px 8px; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.sidebar-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--radius-sm);
  color: var(--text-2); font-size: 13px; font-weight: 500;
  text-decoration: none; cursor: pointer; transition: all 0.15s;
  border-left: 2px solid transparent;
}
.sidebar-item:hover { color: var(--text-1); background: rgba(255,255,255,0.04); }
.sidebar-item.active {
  color: var(--blue-bright); background: var(--blue-glow);
  border-left-color: var(--blue);
}
.sidebar-item.admin-item { color: var(--amber); }
.sidebar-item.admin-item:hover { background: var(--amber-bg); }
.sidebar-item.admin-item.active { background: var(--amber-bg); border-left-color: var(--amber); }
.sidebar-item.lab-item   { color: var(--purple); }
.sidebar-item.lab-item:hover   { background: var(--purple-bg); }
.sidebar-item.lab-item.active  { background: var(--purple-bg); border-left-color: var(--purple); }
.sidebar-item.partner-item        { color: var(--teal-bright); }
.sidebar-item.partner-item:hover  { background: var(--teal-bg); }
.sidebar-item.partner-item.active { background: var(--teal-bg); border-left-color: var(--teal); }
.sidebar-item svg { flex-shrink: 0; opacity: 0.75; }
.sidebar-item.active svg, .sidebar-item.admin-item svg { opacity: 1; }

.sidebar-divider { height: 1px; background: var(--border); margin: 8px 10px; }

/* ── Sidebar credit cards ────────────────────────────────────────────────
   Minimalist refinement of the Monthly + Top-Up panels: thinner border,
   tighter padding, a subtle one-time inset gradient that gives quiet depth
   without adding visual weight. Number sits inline with its denominator
   instead of being pushed to opposite ends of the card — reads as one
   coherent figure rather than two competing data points. */
.sidebar-quota {
  margin: 8px 10px 0;
  background: linear-gradient(180deg, rgba(34,211,238,0.04) 0%, transparent 100%), var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius); padding: 10px 12px;
  transition: border-color .15s, background .15s;
}
.sidebar-quota-label {
  font-size: 9px; font-weight: 700; color: var(--text-3);
  text-transform: uppercase; letter-spacing: 0.08em;
  margin-bottom: 8px;
}
.sidebar-quota-nums {
  /* Inline figure: large remaining number sits flush with the small "/ max"
     suffix, no flex-space-between push. Reads as one numeral group. */
  display: flex; align-items: baseline; gap: 4px; margin-bottom: 8px;
}
.sidebar-quota-main {
  font-size: 18px; font-weight: 700; color: var(--cyan);
  font-family: var(--font-mono); letter-spacing: -0.5px; line-height: 1;
}
.sidebar-quota-of {
  font-size: 11px; color: var(--text-3); font-weight: 500;
}
.sidebar-quota-bar {
  height: 4px; background: rgba(74,96,128,0.18); border-radius: 99px; overflow: hidden;
}
.sidebar-quota-fill {
  height: 100%; border-radius: 99px;
  background: linear-gradient(90deg, var(--blue-dim), var(--cyan));
  transition: width .35s ease;
}
/* Top-up card-specific tweak: clickable, so add a subtle hover affordance
   and switch its accent gradient from cyan to a warmer amber-ish tint to
   visually differentiate "buy more credits" from "your monthly bucket". */
#sq-topup-wrap {
  background: linear-gradient(180deg, rgba(245,158,11,0.04) 0%, transparent 100%), var(--card);
}
#sq-topup-wrap:hover {
  border-color: var(--border-light);
  background: linear-gradient(180deg, rgba(245,158,11,0.08) 0%, transparent 100%), var(--card-hover);
}
#sq-topup-wrap .sidebar-quota-main { color: var(--amber); }

.sidebar-user {
  min-height: 61px;
  padding: 12px 14px; border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 9; flex-shrink: 0;
}
.sidebar-user-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(135deg, var(--blue-dim), var(--purple));
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; color: #fff; flex-shrink: 0;
}
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-email { font-size: 11px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user-tier  { font-size: 9px; color: var(--amber); margin-top: 1px; }
.sidebar-logout {
  background: none; border: none; color: var(--text-3); cursor: pointer;
  padding: 4px; border-radius: 4px; transition: color 0.15s; flex-shrink: 0;
  display: flex; align-items: center;
}
.sidebar-logout:hover { color: var(--red); }

/* ─── SCROLLBAR ─── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--surface); }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 99px; }

/* (topnav removed — sidebar layout used instead) */

/* ─── PAGE LAYOUT ─── */
.page { max-width: 1200px; margin: 0 auto; padding: 32px 24px 64px; width: 100%; box-sizing: border-box; }
.page-wide { max-width: 1200px; margin: 0 auto; padding: 32px 24px 64px; width: 100%; box-sizing: border-box; }

/* ─── PAGE BANNER ─────────────────────────────────────────────────────────
   Fixed height across every navigable page (dashboard, submit-job, queue,
   results, docs, faq, membership) so the page-shell doesn't visibly jump
   when the user switches tabs quickly. Dashboard's natural banner with
   just a title is ~92 px tall; we standardise on 82 px (≈ 90 % of that).
   `height` (not `min-height`) is deliberate: it makes the banner an
   immutable layout anchor regardless of inner content. Padding drops to
   0 vertical — flex align-items:center handles the spacing inside the
   fixed 82 px so the 44 px icon + 18 px title always sit dead-centre. */
.page-banner {
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, #0e1e38 0%, #0d1d40 50%, #0a1830 100%);
  border: 1px solid var(--border);
  height: 82px;
  padding: 0 28px;
  margin-bottom: 28px;
  position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  max-width: 100%;
}
.page-banner::before {
  content: '';
  position: absolute; top: -1px; left: -1px; right: -1px; height: 2px;
  background: linear-gradient(90deg, var(--blue-dim), var(--cyan), transparent);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.page-banner-grid {
  position: absolute; inset: 0; opacity: 0.03;
  background-image: linear-gradient(var(--text-1) 1px, transparent 1px),
                    linear-gradient(90deg, var(--text-1) 1px, transparent 1px);
  background-size: 32px 32px;
}
.page-banner-left { display: flex; align-items: center; gap: 16px; position: relative; }
.page-banner-icon {
  width: 44px; height: 44px; border-radius: var(--radius);
  background: var(--blue-glow); border: 1px solid var(--border-light);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.page-banner-title { font-size: 18px; font-weight: 700; color: var(--text-1); letter-spacing: -0.3px; margin: 0; line-height: 1.3; }
.page-banner-desc { font-size: 13px; color: var(--text-2); margin-top: 2px; }
.page-banner-right { position: relative; }

/* ─── CARDS ─── */
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px;
}
.card-sm { padding: 16px; }
/* Owl rule: when cards stack vertically with no parent layout, the second
   card needs breathing room. This selector intentionally targets every .card
   whose previous DOM sibling is a .card — which silently includes grid /
   flex children, where the parent's `gap` already handles spacing and the
   margin-top here ends up *shrinking* the cell's visible content area by
   16 px. The override rules below cancel the owl rule for any .card whose
   parent is a grid or flex container, regardless of whether the layout is
   declared via class or inline style. */
.card + .card { margin-top: 16px; }
.quick-actions-grid .card { margin-top: 0; }
[style*="display:grid"]  > .card + .card,
[style*="display: grid"] > .card + .card,
[style*="display:flex"]  > .card + .card,
[style*="display: flex"] > .card + .card,
.grid > .card + .card,
.flex > .card + .card { margin-top: 0; }
.card-title { font-size: 13px; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 14px; }

/* ─── STAT CARDS ─── */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
  display: flex; flex-direction: column; gap: 6px;
  transition: border-color 0.2s, background 0.2s;
}
.stat-card:hover { border-color: var(--border-light); background: var(--card-hover); }
.stat-label { font-size: 11px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.07em; }
.stat-value { font-size: 28px; font-weight: 700; color: var(--text-1); letter-spacing: -0.5px; line-height: 1; }
.stat-sub   { font-size: 12px; color: var(--text-2); }
.stat-icon  { width: 32px; height: 32px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; margin-bottom: 8px; }

/* ─── BUTTONS ─── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 18px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all 0.15s; border: none; text-decoration: none;
  white-space: nowrap; font-family: inherit;
}
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-bright); box-shadow: var(--glow-blue); }
.btn-secondary { background: var(--card); border: 1px solid var(--border); color: var(--text-2); }
.btn-secondary:hover { border-color: var(--border-light); color: var(--text-1); background: var(--card-hover); }
.btn-danger { background: var(--red-bg); border: 1px solid var(--red); color: var(--red); }
.btn-danger:hover { background: var(--red); color: #fff; }
.btn-success { background: var(--green-bg); border: 1px solid var(--green); color: var(--green); }
.btn-success:hover { background: var(--green); color: #fff; }
.btn-warning { background: var(--amber-bg); border: 1px solid var(--amber); color: var(--amber); }
.btn-warning:hover { background: var(--amber); color: #000; }
.btn-lg { padding: 12px 24px; font-size: 14px; border-radius: var(--radius); }
.btn-sm { padding: 5px 12px; font-size: 12px; }

/* ── Guest-state body class ───────────────────────────────────────────────
   `body.is-guest` is the canonical "no session cookie" flag, set by
   shared.js. Replaces the per-page `*-guest` classes (plat-guest,
   mod-guest, docs-guest, faq-guest, memb-guest, contact-guest) — those
   stay around as aliases for the moment, but new code should target
   `.is-guest`. Behaviour matches what the old classes did: zero body
   padding-left (no sidebar), hide the logged-in nav root, and reveal
   the injected guest topbar via the .plat-topbar selector (topbar.js
   mounts a <header class="plat-topbar"> in #guest-topbar). */
body.is-guest               { padding-left: 0 !important; }
body.is-guest #nav-root     { display: none; }

/* ── Guest topbar component (mounted by topbar.js into #guest-topbar) ────
   Canonical styling for the marketing-page topbar. The element is
   injected with `class="plat-topbar"`; per-page <style> blocks used to
   define their own `.mod-topbar` / `.docs-topbar` / `.faq-topbar` /
   `.memb-topbar` / `.contact-topbar` with identical rules — those are
   now dormant aliases (kept until a follow-up cleanup). Keeping the
   canonical rules here means a new page only needs the placeholder
   `<header id="guest-topbar">` plus `<script src="/topbar.js">` to get
   a working topbar — no per-page CSS required. */
.plat-topbar {
  display: none;
  min-height: 76px; background: rgba(6,13,28,0.95); backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  align-items: center; padding: 12px 40px;
  justify-content: space-between; flex-shrink: 0;
  position: sticky; top: 0; z-index: 10;
  /* Allow the bar to wrap onto a second row on narrower viewports rather
     than letting the rightmost items (Lab / Partner / Sign In / Create
     Account) overflow off the right edge unseen. */
  flex-wrap: wrap; row-gap: 8px;
}
body.is-guest .plat-topbar,
body.auth-body .plat-topbar { display: flex; }
.plat-topbar-brand   { display: flex; align-items: center; gap: 13px; text-decoration: none; }
.plat-topbar-actions {
  display: flex; gap: 8px; align-items: center;
  /* Same reason as above — let the action group itself wrap so each button
     stays clickable even when the topbar gets crowded. */
  flex-wrap: wrap; row-gap: 8px;
}
.plat-topbar-actions .btn {
  font-size: 13px; padding: 9px 14px; height: auto;
  display: inline-flex; align-items: center; gap: 7px;
}
.plat-topbar-actions .btn svg     { flex-shrink: 0; }
.plat-topbar-actions .nav-divider { width: 1px; height: 22px; background: var(--border); margin: 0 6px; }

/* On medium viewports the topbar can still get crowded once the Lab and
   Partner dropdowns are present. Shrink the tab labels first (the user-
   most-needed entry-points — Lab, Partner, Sign In, Create Account — stay
   at full size) so everything fits on a single row. */
@media (max-width: 1280px) {
  .plat-topbar { padding: 12px 24px; }
  .plat-topbar-actions .btn { padding: 8px 11px; font-size: 12.5px; gap: 6px; }
}

/* ── Floating "Return to Platform" CTA ─────────────────────────────────────
   Guest-only escape hatch on the marketing pages (platform, mission,
   models, docs, plans & pricing, faq). Mirrors the small ✕ in the topbar
   but bigger and harder to miss — so a first-time visitor never feels
   stranded on a subpage. Visibility is gated on each page's `*-guest`
   body class so logged-in users (who already have the sidebar nav) don't
   see it. */
.nv-return-fab {
  position: fixed; bottom: 24px; z-index: 50;
  /* Anchor so the button's LEFT edge sits 16 px to the right of the
     1200 px content column's right edge. Half-column = 600 px; button
     width ≈ 180 px. On viewports too narrow for the button to fit in
     that gutter the max() falls back to a 20 px gap from the viewport
     edge so it never escapes off-screen. */
  right: max(20px, calc(50% - 600px - 180px - 16px));
  display: none; align-items: center; gap: 8px;
  background: var(--blue); color: #fff;
  font-size: 13px; font-weight: 600;
  padding: 12px 18px; border-radius: 99px;
  text-decoration: none; cursor: pointer; border: 0;
  box-shadow: 0 10px 28px rgba(29,78,216,0.45),
              0 0 0 1px rgba(96,165,250,0.30);
  transition: transform 0.15s, box-shadow 0.15s, background 0.15s;
}
.nv-return-fab:hover {
  background: var(--blue-bright);
  transform: translateY(-2px);
  box-shadow: 0 14px 32px rgba(29,78,216,0.55),
              0 0 0 1px rgba(96,165,250,0.40);
}
.nv-return-fab svg { flex-shrink: 0; }
/* Canonical selector — `body.is-guest` is set by shared.js when no
   session cookie is present. The legacy per-page selectors below are
   kept as aliases until every page has fully migrated. */
body.is-guest   .nv-return-fab,
body.is-guest .nv-return-fab,
body.is-guest  .nv-return-fab,
body.is-guest .nv-return-fab,
body.is-guest  .nv-return-fab,
body.is-guest .nv-return-fab { display: inline-flex; }
@media (max-width: 520px) {
  .nv-return-fab { right: 14px !important; bottom: 14px; padding: 10px 14px; font-size: 12px; }
}
.btn-full { width: 100%; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* ─── FORMS ─── */
.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.form-label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.form-input, .form-select, .form-textarea {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 9px 13px;
  color: var(--text-1); font-size: 13px; font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s; width: 100%;
  appearance: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none; border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-glow);
}
.form-input::placeholder, .form-textarea::placeholder { color: var(--text-3); }
.form-select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpolyline points='6,9 12,15 18,9'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; cursor: pointer; }
.form-select option { background: var(--surface); }
.form-help { font-size: 11px; color: var(--text-3); }
.form-error { font-size: 11px; color: var(--red); }

.checkbox-row { display: flex; align-items: center; gap: 9px; cursor: pointer; }
.checkbox-row input[type=checkbox] { width: 15px; height: 15px; accent-color: var(--blue); cursor: pointer; }
.checkbox-row span { font-size: 13px; color: var(--text-2); }

/* ─── TABLES ─── */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; }
thead tr { background: rgba(23,48,88,0.5); }
th { padding: 11px 16px; text-align: left; font-size: 11px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.07em; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 12px 16px; font-size: 13px; color: var(--text-2); border-bottom: 1px solid rgba(23,48,88,0.5); }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: rgba(23,48,88,0.2); }
td.mono { font-family: var(--font-mono); font-size: 12px; color: var(--text-2); }
td.primary { color: var(--text-1); font-weight: 500; }

/* ─── STATUS BADGES ─── */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 99px; font-size: 11px; font-weight: 600;
}
.badge-dot { width: 5px; height: 5px; border-radius: 50%; flex-shrink: 0; }
.badge-completed { background: var(--status-completed-bg); color: var(--status-completed-fg); border: 1px solid var(--status-completed-border); }
.badge-completed .badge-dot { background: var(--status-completed-fg); }
/* Queued = calm neutral: waiting is normal, not a warning. */
.badge-queued { background: var(--status-queued-bg); color: var(--status-queued-fg); border: 1px solid var(--status-queued-border); }
.badge-queued .badge-dot { background: var(--status-queued-fg); }
/* Processing is the single state allowed an animated dot. */
.badge-processing { background: var(--status-processing-bg); color: var(--status-processing-fg); border: 1px solid var(--status-processing-border); }
.badge-processing .badge-dot { background: var(--status-processing-fg); animation: pulse 1s infinite; }
.badge-failed { background: var(--status-failed-bg); color: var(--status-failed-fg); border: 1px solid var(--status-failed-border); }
.badge-failed .badge-dot { background: var(--status-failed-fg); }
.badge-cancelled { background: var(--status-cancelled-bg); color: var(--status-cancelled-fg); border: 1px solid var(--status-cancelled-border); }
.badge-cancelled .badge-dot { background: var(--status-cancelled-fg); }
/* An unrecognised status must LOOK wrong — never silently styled as a
   benign state (it used to fall back to the cancelled style). */
.badge-unknown { background: var(--status-unknown-bg); color: var(--status-unknown-fg); border: 1px solid var(--status-unknown-border); }
.badge-unknown .badge-dot { background: var(--status-unknown-fg); }
.badge-tier { background: var(--blue-glow); color: var(--blue-bright); border: 1px solid rgba(59,130,246,0.3); font-size: 11px; padding: 3px 10px; border-radius: 99px; font-weight: 600; }
.badge-tier.tier4 { background: var(--amber-bg); color: var(--amber); border-color: rgba(245,158,11,0.3); }
.badge-tier.tier3 { background: rgba(16,185,129,0.12); color: #10b981; border-color: rgba(16,185,129,0.3); }
.badge-tier.tier2 { background: var(--blue-glow); color: var(--blue-bright); border-color: rgba(59,130,246,0.3); }
.badge-tier.tier1 { background: rgba(74,96,128,0.15); color: var(--text-3); border-color: rgba(74,96,128,0.25); }

/* Partner role pill — used in dashboard / admin rows / nav. Same shape as
   .badge-tier but the teal accent is exclusive to the affiliate program. */
.badge.partner {
  background: var(--teal-bg); color: var(--teal-bright);
  border: 1px solid rgba(20,184,166,0.32);
}

/* ─── PROGRESS BAR ─── */
.progress-bar { height: 5px; background: var(--border); border-radius: 99px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--blue-dim), var(--cyan)); transition: width 0.4s ease; }
.progress-fill.warn { background: linear-gradient(90deg, var(--amber), #f97316); }
.progress-fill.danger { background: linear-gradient(90deg, var(--red), #f97316); }

/* ─── TABS ─── */
.tab-bar { display: flex; flex-wrap: wrap; gap: 0; border-bottom: 1px solid var(--border); margin-bottom: 24px; }
.tab {
  padding: 10px 18px; font-size: 15px; font-weight: 500; cursor: pointer;
  color: var(--text-3); border-bottom: 2px solid transparent; margin-bottom: -1px;
  transition: all 0.15s; background: none; border-top: none; border-left: none; border-right: none;
  font-family: inherit; white-space: nowrap;
}
.tab:hover { color: var(--text-2); }
.tab.active { color: var(--blue-bright); border-bottom-color: var(--blue); }

/* ─── ACCORDION / COLLAPSIBLE ─── */
.accordion { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; margin-bottom: 12px; }
.accordion-header {
  padding: 14px 18px; display: flex; align-items: center; justify-content: space-between;
  cursor: pointer; font-size: 13px; font-weight: 600; color: var(--text-2);
  background: var(--card); transition: background 0.15s;
  user-select: none;
}
.accordion-header:hover { background: var(--card-hover); }
.accordion-header .chevron { transition: transform 0.2s; color: var(--text-3); }
.accordion-header.open .chevron { transform: rotate(180deg); }
.accordion-body { background: var(--surface); border-top: 1px solid var(--border); padding: 20px 18px; display: none; }
.accordion-body.open { display: block; }

/* ─── DROPZONE ─── */
.dropzone {
  border: 2px dashed var(--border-light); border-radius: var(--radius-lg);
  padding: 19px 32px; text-align: center; cursor: pointer;
  transition: all 0.2s; background: var(--surface); position: relative;
}
.dropzone:hover, .dropzone.drag-over {
  border-color: var(--blue); background: var(--blue-glow);
}
.dropzone-icon { margin-bottom: 4px; color: var(--text-3); }
.dropzone-title { font-size: 15px; font-weight: 600; color: var(--text-1); margin-bottom: 2px; }
.dropzone-sub { font-size: 13px; color: var(--text-3); }
.dropzone-file-types { display: inline-flex; gap: 6px; margin-top: 5px; }
.dropzone-tag { padding: 3px 10px; border-radius: 99px; font-size: 11px; font-weight: 600; font-family: var(--font-mono); background: var(--card); border: 1px solid var(--border-light); color: var(--cyan); }

/* ─── QUOTA BLOCK ─── */
.quota-block { padding: 16px 0 8px; }
.quota-header { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.quota-label { font-size: 12px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.06em; }
.quota-count { font-size: 13px; font-weight: 600; color: var(--text-2); }
.quota-count strong { color: var(--text-1); }

/* ─── ALERT BANNERS ─── */
.alert { padding: 12px 16px; border-radius: var(--radius-sm); font-size: 13px; display: flex; align-items: flex-start; gap: 10px; margin-bottom: 16px; }
.alert-info    { background: var(--blue-glow); border: 1px solid rgba(59,130,246,0.25); color: var(--blue-bright); }
.alert-success { background: var(--green-bg); border: 1px solid rgba(16,185,129,0.25); color: var(--green); }
.alert-warning { background: var(--amber-bg); border: 1px solid rgba(245,158,11,0.25); color: var(--amber); }
.alert-danger  { background: var(--red-bg); border: 1px solid rgba(239,68,68,0.25); color: var(--red); }

/* ─── MISC ─── */
.section-title { font-size: 18px; font-weight: 700; color: var(--text-1); letter-spacing: -0.3px; margin-bottom: 4px; }
.section-desc  { font-size: 13px; color: var(--text-2); margin-bottom: 20px; }
.divider { border: none; border-top: 1px solid var(--border); margin: 24px 0; }
.mono { font-family: var(--font-mono); font-size: 12px; }
.text-muted { color: var(--text-3); }
.text-dim    { color: var(--text-2); }
.text-green  { color: var(--green); }
.text-amber  { color: var(--amber); }
.text-red    { color: var(--red); }
.text-blue   { color: var(--blue-bright); }
.text-cyan   { color: var(--cyan); }

.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }

.empty-state { text-align: center; padding: 56px 32px; color: var(--text-3); }
.empty-state-icon { font-size: 36px; margin-bottom: 12px; opacity: 0.4; }
.empty-state-text { font-size: 14px; }

/* ─── FILTER STRIP ─── Shared "card with header + grid of filters + chips". */
/* Tint the accent hairline via `--fs-accent` (default blue). */
.filter-strip {
  --fs-accent: var(--blue-bright);
  --fs-accent-glow: rgba(59,130,246,0.35);
  background: linear-gradient(180deg, var(--card) 0%, rgba(14,30,56,0.6) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px 12px;
  margin-bottom: 14px;
  position: relative;
}
.filter-strip::before {
  content: '';
  position: absolute; top: -1px; left: -1px; right: -1px; height: 1px;
  background: linear-gradient(90deg, transparent, var(--fs-accent-glow), transparent);
  border-radius: var(--radius) var(--radius) 0 0;
  pointer-events: none;
}
.filter-strip.fs-purple { --fs-accent: var(--purple); --fs-accent-glow: rgba(139,92,246,0.4); }
.filter-strip.fs-cyan   { --fs-accent: var(--cyan);   --fs-accent-glow: rgba(34,211,238,0.4); }
.filter-strip.fs-teal   { --fs-accent: var(--teal-bright); --fs-accent-glow: rgba(20,184,166,0.4); }

.filter-strip-head {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 12px;
}
/* Title sits to the right of the chevron; actions go to the far right. */
.filter-strip-actions { margin-left: auto; }
.filter-strip.collapsed .filter-strip-head { margin-bottom: 0; }
.filter-strip-title {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 11px; font-weight: 700; color: var(--text-3);
  text-transform: uppercase; letter-spacing: 0.08em;
  cursor: pointer; user-select: none;
  transition: color 0.15s;
}
.filter-strip-title:hover { color: var(--text-1); }
.filter-strip-title svg { color: var(--fs-accent); }
.filter-strip-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 6px;
  background: var(--fs-accent); color: #fff;
  border-radius: 99px; font-size: 10px; font-weight: 700;
}
.filter-strip-actions { display: inline-flex; gap: 6px; align-items: center; }
.filter-strip-reset {
  display: inline-flex; align-items: center; gap: 5px;
  background: transparent; border: 1px solid transparent;
  color: var(--text-3); cursor: pointer;
  padding: 4px 10px; border-radius: var(--radius-sm);
  font-size: 11px; font-weight: 600; font-family: inherit;
  transition: all 0.15s;
}
.filter-strip-reset:hover { color: var(--red); border-color: rgba(239,68,68,0.3); background: var(--red-bg); }
.filter-strip-reset:disabled { opacity: 0.4; cursor: not-allowed; }
.filter-strip-reset:disabled:hover { color: var(--text-3); border-color: transparent; background: transparent; }
/* Collapse / expand toggle — chevron rotates when collapsed */
.filter-strip-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px;
  background: transparent; border: 1px solid var(--border);
  color: var(--text-3); cursor: pointer;
  border-radius: var(--radius-sm);
  transition: color 0.15s, background 0.15s, border-color 0.15s, transform 0.2s;
}
.filter-strip-toggle:hover { color: var(--text-1); background: var(--card-hover); border-color: var(--border-light); }
.filter-strip-toggle svg { transition: transform 0.25s ease; }
.filter-strip.collapsed .filter-strip-toggle svg { transform: rotate(-90deg); }

/* Smooth collapse: hide the grid + chips when .collapsed */
.filter-strip .filter-strip-grid,
.filter-strip .filter-strip-chips {
  overflow: hidden;
  transition: max-height 0.28s ease, opacity 0.18s ease, margin-top 0.2s ease;
  max-height: 1000px; opacity: 1;
}
.filter-strip.collapsed .filter-strip-grid,
.filter-strip.collapsed .filter-strip-chips {
  max-height: 0; opacity: 0; margin-top: 0;
  pointer-events: none;
}
.filter-strip.collapsed { padding-bottom: 12px; }

.filter-strip-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px 12px;
}
.fs-field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.fs-field.fs-span-2 { grid-column: span 2; }
.fs-field.fs-span-3 { grid-column: span 3; }
@media (max-width: 720px) { .fs-field.fs-span-2, .fs-field.fs-span-3 { grid-column: auto; } }
.fs-label { font-size: 10px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.07em; }
.fs-select { height: 30px; font-size: 12px; padding: 0 30px 0 10px; background-color: var(--surface); }
.fs-range { display: grid; grid-template-columns: 1fr auto 1fr; gap: 6px; align-items: center; }
.fs-range-sep { color: var(--text-3); font-size: 11px; text-align: center; }
.fs-num, .fs-date {
  height: 30px; padding: 0 8px; font-size: 12px;
  font-family: var(--font-mono);
}
.fs-date { color-scheme: dark; }
.fs-date::-webkit-calendar-picker-indicator { filter: invert(0.7); cursor: pointer; opacity: 0.7; }
.fs-date:hover::-webkit-calendar-picker-indicator { opacity: 1; }

/* Inline search box (icon + input + clear button + optional spinner) */
.fs-search { position: relative; display: inline-flex; align-items: center; width: 100%; }
.fs-search > svg.fs-search-ico {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  color: var(--text-3); pointer-events: none;
}
.fs-search input {
  width: 100%; height: 30px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-1); font-size: 12px; font-family: inherit;
  padding: 0 30px 0 30px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.fs-search input::placeholder { color: var(--text-3); }
.fs-search input:focus {
  outline: none; border-color: var(--fs-accent, var(--blue));
  box-shadow: 0 0 0 3px rgba(59,130,246,0.18);
}
.filter-strip.fs-purple .fs-search input:focus { box-shadow: 0 0 0 3px rgba(139,92,246,0.20); }
.filter-strip.fs-cyan   .fs-search input:focus { box-shadow: 0 0 0 3px rgba(34,211,238,0.18); }
.fs-search .fs-search-clear {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  background: transparent; border: 0; color: var(--text-3);
  width: 22px; height: 22px; border-radius: 4px; cursor: pointer;
  display: none; align-items: center; justify-content: center;
}
.fs-search .fs-search-clear:hover { color: var(--text-1); background: var(--card-hover); }
.fs-search.has-text .fs-search-clear { display: flex; }
.fs-search .fs-search-spinner {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  width: 12px; height: 12px; border-radius: 50%;
  border: 2px solid var(--border-light); border-top-color: var(--fs-accent, var(--blue-bright));
  animation: spin 0.8s linear infinite;
  display: none;
}
.fs-search.is-loading .fs-search-spinner { display: block; }
.fs-search.is-loading .fs-search-clear { display: none; }

/* Active-filter chip strip */
.filter-strip-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.filter-strip-chips:empty { display: none; }
.fs-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 4px 3px 10px;
  background: var(--blue-glow); color: var(--blue-bright);
  border: 1px solid rgba(59,130,246,0.3);
  border-radius: 99px;
  font-size: 11px; font-weight: 600;
}
.filter-strip.fs-purple .fs-chip { background: var(--purple-bg); color: var(--purple); border-color: rgba(139,92,246,0.3); }
.filter-strip.fs-cyan   .fs-chip { background: var(--cyan-glow); color: var(--cyan); border-color: rgba(34,211,238,0.3); }
.fs-chip-key { color: var(--text-3); font-weight: 500; }
.fs-chip-value { color: var(--text-1); max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fs-chip button {
  background: rgba(59,130,246,0.18); border: 0; color: inherit;
  width: 18px; height: 18px; border-radius: 50%; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background 0.15s, color 0.15s;
}
.filter-strip.fs-purple .fs-chip button { background: rgba(139,92,246,0.22); }
.filter-strip.fs-cyan   .fs-chip button { background: rgba(34,211,238,0.18); }
.fs-chip button:hover { background: var(--red); color: #fff; }

/* Substring-match highlight inside table cells */
mark.fs-hit {
  background: rgba(34,211,238,0.18); color: var(--cyan);
  padding: 0 2px; border-radius: 3px; font-weight: 600;
}
.filter-strip.fs-purple ~ * mark.fs-hit { background: rgba(139,92,246,0.20); color: var(--purple); }

/* ─── PAGINATION ─── */
.pagination { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-top: 1px solid var(--border); font-size: 12px; color: var(--text-3); }
.pagination-btns { display: flex; gap: 4px; }
.page-btn { padding: 4px 10px; border-radius: var(--radius-xs); border: 1px solid var(--border); background: none; color: var(--text-3); font-size: 12px; cursor: pointer; font-family: inherit; transition: all 0.15s; }
.page-btn:hover { border-color: var(--blue); color: var(--blue-bright); }
.page-btn.active { background: var(--blue); border-color: var(--blue); color: #fff; }

/* ─── ANIMATIONS ─── */
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.35} }
@keyframes spin { to{transform:rotate(360deg)} }
@keyframes fadeIn { from{opacity:0;transform:translateY(8px)} to{opacity:1;transform:none} }

.spin { animation: spin 1s linear infinite; display: inline-block; }
.fade-in { animation: fadeIn 0.3s ease; }

/* ─── USER POPUP MENU ─── */
.user-popup {
  position: fixed;
  background: #0d1b35;
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 300;
  min-width: 196px;
  overflow: hidden;
  animation: fadeIn 0.15s ease;
}
.user-popup-header {
  padding: 10px 14px 8px;
  font-size: 11px;
  color: var(--text-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}
.user-popup-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 14px;
  font-size: 13px; color: var(--text-2);
  text-decoration: none; cursor: pointer;
  transition: background 0.12s, color 0.12s;
  background: none; border: none; width: 100%;
  font-family: inherit; text-align: left;
}
.user-popup-item:hover { background: rgba(255,255,255,0.06); color: var(--text-1); }
.user-popup-item.danger:hover { background: var(--red-bg); color: var(--red); }
.user-popup-divider { height: 1px; background: var(--border); margin: 4px 0; }

/* ─── FOOTER ─── */
.site-footer { min-height: 61px; box-sizing: border-box; border-top: 1px solid var(--border); padding: 20px 24px; margin-top: auto; display: flex; align-items: center; justify-content: space-between; }
.footer-left { font-size: 12px; color: var(--text-3); }
.footer-right { font-size: 11px; color: var(--text-3); display: flex; gap: 16px; }
.footer-right a { color: var(--text-3); text-decoration: none; transition: color 0.15s; }
.footer-right a:hover { color: var(--text-2); }

/* ─── MARKETING HERO + CTA ────────────────────────────────────────────────
   Shared building blocks used by the guest-facing pages (platform, mission,
   models, contact). Each page can layer page-specific overrides (e.g.
   different padding, a wider desc max-width) on top by re-declaring the
   same property on a sibling class such as `.plat-hero` after this file.
   The `pg-` prefix is deliberate: it marks the class as a generic "page"
   primitive shared across guest pages, distinct from `.plat-*` (originally
   platform-specific). Use both classes together to keep alias selectors
   alive while the rule lives here. */
.pg-hero {
  padding: 48px 36px 20px;
  text-align: center; max-width: 880px; margin: 0 auto;
}
.pg-hero-eyebrow {
  font-size: 11px; font-weight: 700; color: var(--cyan); text-transform: uppercase;
  letter-spacing: 0.12em; margin-bottom: 16px;
}
.pg-hero-headline {
  font-size: clamp(34px, 4.5vw, 56px); font-weight: 800; color: var(--text-1);
  line-height: 1.08; letter-spacing: -1.5px; margin: 0 0 18px;
}
.pg-hero-headline em { font-style: normal; color: var(--blue-bright); }
.pg-hero-desc {
  font-size: 16px; color: var(--text-2); line-height: 1.7;
  max-width: 640px; margin: 0 auto 28px;
}

/* Bottom-of-page CTA strip — centred row of buttons inside the 1200px
   container. Replaces the duplicated `.plat-cta-row` rule that existed
   on platform.html and mission.html. */
.pg-cta-row {
  display: flex; justify-content: center; gap: 10px; flex-wrap: wrap;
  padding: 24px 22px 56px;
  max-width: 1200px; margin: 0 auto;
}

/* Tiny "scroll down" affordance — used in the right edge of a sticky TOC,
   below a hero, etc. Generalised from `.plat-scroll-hint`. */
.scroll-hint {
  display: inline-flex; align-items: center; gap: 5px;
  flex-shrink: 0;
  font-size: 11px; font-weight: 500; letter-spacing: 0.02em;
  color: var(--text-3); text-decoration: none;
  padding: 0 4px; border: none; background: transparent;
  transition: color 0.15s;
}
.scroll-hint:hover { color: var(--blue-bright); }
.scroll-hint svg { animation: scroll-bounce 1.8s ease-in-out infinite; }
@keyframes scroll-bounce {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(3px); }
}
@media (prefers-reduced-motion: reduce) {
  .scroll-hint svg { animation: none; }
}

/* Sticky table-of-contents / filter bar — used on platform, mission, and
   models. The wrapper provides the same sticky chrome (blurred dark
   background, hairline bottom border, top-of-viewport pin) on every page;
   the inner contents vary (section pills vs search bar). On guest pages
   the bar sits below the 76px .plat-topbar; for logged-in users it pins
   to top:0 since there's no topbar above it. */
.pg-toc {
  position: sticky; top: 0; z-index: 9;
  background: rgba(6,13,28,0.92);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}
body.is-guest .pg-toc { top: 76px; }

/* Default pill-row TOC inner (used by platform + mission). Models uses
   its own inner layout for the search bar — see .mod-toc-inner there. */
.pg-toc-inner {
  max-width: 1200px; margin: 0 auto;
  display: flex; gap: 6px;
  padding: 10px 22px;
  overflow-x: auto;
  scrollbar-width: none;
}
.pg-toc-inner::-webkit-scrollbar { display: none; }
.pg-toc-inner a {
  flex-shrink: 0;
  font-size: 13px; font-weight: 600; letter-spacing: 0.02em;
  color: var(--text-3); text-decoration: none;
  padding: 7px 14px; border-radius: 99px;
  white-space: nowrap;
  border: 1px solid transparent;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}
.pg-toc-inner a:hover { color: var(--text-1); background: var(--surface); }
.pg-toc-inner a.active {
  color: var(--blue-bright);
  background: var(--blue-glow);
  border-color: rgba(59,130,246,0.30);
}

/* Marketing-page section + section title. Used inside the 1200px content
   column with horizontal padding matching .pg-toc-inner. scroll-margin
   leaves room for the sticky .pg-toc when an anchor scroll lands here
   (64px TOC alone for logged-in users; +76px for guests' .plat-topbar). */
.pg-section {
  padding: 20px 22px;
  max-width: 1200px; margin: 0 auto;
  scroll-margin-top: 64px;
}
body.is-guest .pg-section { scroll-margin-top: 140px; }
.pg-section-title {
  font-size: 11px; font-weight: 700; color: var(--text-3);
  text-transform: uppercase; letter-spacing: 0.12em;
  margin-bottom: 18px; display: flex; align-items: center; gap: 10px;
}
.pg-section-title::before {
  content: ''; width: 22px; height: 2px; background: var(--cyan); border-radius: 99px;
}

/* ─── AUTH PAGE ─── */
body.auth-body { padding-left: 0; background: var(--bg); display: flex; flex-direction: column; min-height: 100vh; }
.auth-shell { display: flex; min-height: 100vh; }
.auth-left {
  flex: 0 0 480px; background: linear-gradient(160deg, #081226 0%, #0c1a36 50%, #07102a 100%);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 40px;
  position: relative; overflow: hidden;
}
.auth-left-grid {
  position: absolute; inset: 0; opacity: 0.04;
  background-image: linear-gradient(var(--blue-bright) 1px, transparent 1px),
                    linear-gradient(90deg, var(--blue-bright) 1px, transparent 1px);
  background-size: 40px 40px;
}
.auth-logo { display: flex; align-items: center; gap: 12px; margin-bottom: 48px; position: relative; }
.auth-logo-icon {
  width: 44px; height: 44px; border-radius: 12px;
  background: linear-gradient(135deg, var(--blue-dim), var(--cyan));
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 16px; color: #fff;
}
.auth-logo-name { font-size: 20px; font-weight: 800; color: var(--text-1); letter-spacing: -0.4px; }
.auth-logo-sub  { font-size: 11px; color: var(--text-3); }
.auth-tagline { font-size: 28px; font-weight: 700; color: var(--text-1); line-height: 1.3; letter-spacing: -0.5px; margin-bottom: 16px; position: relative; }
.auth-tagline span { color: var(--cyan); }
.auth-desc { font-size: 14px; color: var(--text-2); line-height: 1.7; position: relative; margin-bottom: 40px; }
.auth-features { display: flex; flex-direction: column; gap: 12px; position: relative; }
.auth-feature { display: flex; align-items: center; gap: 12px; }
.auth-feature-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--cyan); flex-shrink: 0; box-shadow: 0 0 8px rgba(34,211,238,0.4); }
.auth-feature-text { font-size: 13px; color: var(--text-2); }
.auth-institution { margin-top: auto; padding-top: 32px; font-size: 12px; color: var(--text-3); display: flex; align-items: center; gap: 8px; position: relative; }

.auth-right {
  flex: 1; display: flex; align-items: center; justify-content: center;
  padding: 40px; background: var(--surface);
}
.auth-card {
  width: 100%; max-width: 440px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 36px;
  box-shadow: var(--shadow-lg);
}
.auth-tab-bar { display: flex; gap: 0; margin-bottom: 28px; border-bottom: 1px solid var(--border); }
.auth-tab {
  flex: 1; padding: 10px; text-align: center; font-size: 13px; font-weight: 600;
  cursor: pointer; color: var(--text-3); border-bottom: 2px solid transparent; margin-bottom: -1px;
  transition: all 0.15s; background: none; border-top: none; border-left: none; border-right: none;
  font-family: inherit;
}
.auth-tab:hover { color: var(--text-2); }
.auth-tab.active { color: var(--blue-bright); border-bottom-color: var(--blue); }

.auth-form { display: none; }
.auth-form.active { display: block; animation: fadeIn 0.25s ease; }
.auth-form-title { font-size: 20px; font-weight: 700; color: var(--text-1); margin-bottom: 4px; letter-spacing: -0.3px; }
.auth-form-sub   { font-size: 13px; color: var(--text-2); margin-bottom: 24px; }
.auth-link { color: var(--blue-bright); text-decoration: none; font-size: 12px; cursor: pointer; }
.auth-link:hover { text-decoration: underline; }
.auth-divider { display: flex; align-items: center; gap: 12px; margin: 16px 0; }
.auth-divider-line { flex: 1; height: 1px; background: var(--border); }
.auth-divider-text { font-size: 11px; color: var(--text-3); }

/* ─── SCAN VIEWER ─── */
.viewer-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 20px; }
.viewer-pane {
  background: #000; border-radius: var(--radius); border: 1px solid var(--border);
  overflow: hidden; position: relative;
}
.viewer-label {
  position: absolute; top: 10px; left: 10px; z-index: 2;
  padding: 3px 10px; border-radius: 99px; font-size: 11px; font-weight: 600;
  background: rgba(0,0,0,0.7); color: var(--text-2);
  backdrop-filter: blur(4px);
}
.viewer-img { width: 100%; display: block; }
.viewer-controls { padding: 10px 12px; background: rgba(0,0,0,0.4); display: flex; align-items: center; gap: 10px; }
.viewer-controls label { font-size: 11px; color: var(--text-3); white-space: nowrap; }
.viewer-controls input[type=range] { flex: 1; accent-color: var(--blue); cursor: pointer; }
.viewer-controls span { font-size: 11px; color: var(--text-2); font-family: var(--font-mono); white-space: nowrap; min-width: 40px; text-align: right; }

/* ─── LABELS LEGEND ─── */
.seg-labels { border-radius: var(--radius); border: 1px solid var(--border); overflow: hidden; }
.seg-label-row { display: flex; align-items: center; gap: 10px; padding: 8px 14px; border-bottom: 1px solid rgba(23,48,88,0.4); font-size: 13px; color: var(--text-2); }
.seg-label-row:last-child { border-bottom: none; }
.seg-label-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.seg-label-name { flex: 1; }
.seg-label-num { font-family: var(--font-mono); font-size: 11px; color: var(--text-3); }

/* ─── MEMBERSHIP CARDS ─── */
.pricing-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; margin-bottom: 32px; }
.pricing-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 24px;
  display: flex; flex-direction: column; gap: 0;
  transition: border-color 0.2s, transform 0.2s;
  position: relative; overflow: hidden;
}
.pricing-card:hover { border-color: var(--border-light); transform: translateY(-2px); }
.pricing-card.featured { border-color: var(--blue); }
.pricing-card.featured::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px; background: linear-gradient(90deg, var(--blue-dim), var(--cyan)); }
.pricing-tier { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-3); margin-bottom: 6px; }
.pricing-name { font-size: 17px; font-weight: 700; color: var(--text-1); margin-bottom: 14px; }
.pricing-price { font-size: 30px; font-weight: 800; color: var(--text-1); letter-spacing: -1px; }
.pricing-price sup { font-size: 16px; font-weight: 600; vertical-align: super; }
.pricing-price span { font-size: 14px; font-weight: 400; color: var(--text-3); }
.pricing-quota { margin: 14px 0; font-size: 22px; font-weight: 700; color: var(--cyan); }
.pricing-quota span { font-size: 13px; font-weight: 400; color: var(--text-2); }
.pricing-desc { font-size: 12px; color: var(--text-2); line-height: 1.6; margin-top: 8px; flex: 1; }
.pricing-note { font-size: 11px; color: var(--text-3); margin-top: 12px; font-style: italic; }

/* ─── ADMIN OVERVIEW ─── */
.admin-stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 14px; margin-bottom: 20px; }
.admin-stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.admin-stat-label { font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 6px; }
.admin-stat-val { font-size: 24px; font-weight: 700; color: var(--text-1); }
.admin-stat-sub { font-size: 11px; color: var(--text-3); margin-top: 2px; }

.system-status { display: flex; align-items: center; gap: 8px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 8px rgba(16,185,129,0.5); }
.status-dot.stopped { background: var(--red); box-shadow: 0 0 8px rgba(239,68,68,0.5); animation: none; }
.status-dot.running { animation: pulse 2s infinite; }

/* ─── Settings Modal ──────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 9000;
  background: rgba(2, 8, 20, 0.72);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  display: none; align-items: center; justify-content: center;
  padding: 24px;
  animation: modalFadeIn 0.16s ease-out;
}
.modal-overlay.open { display: flex; }
@keyframes modalFadeIn { from { opacity: 0 } to { opacity: 1 } }

.modal-window {
  width: 760px; max-width: 100%;
  height: 560px; max-height: 92vh;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 30px 80px rgba(0,0,0,0.6);
  display: flex; flex-direction: row;
  overflow: hidden;
  position: relative;
  animation: modalScaleIn 0.18s ease-out;
}
@keyframes modalScaleIn {
  from { transform: scale(0.96); opacity: 0 }
  to   { transform: scale(1);    opacity: 1 }
}

.modal-close {
  position: absolute; top: 14px; right: 14px;
  width: 30px; height: 30px;
  background: transparent; border: 0;
  color: var(--text-3); cursor: pointer;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
  z-index: 2;
}
.modal-close:hover { background: var(--card-hover); color: var(--text-1); }

.modal-tabs {
  width: 200px; flex-shrink: 0;
  padding: 56px 10px 16px 10px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 2px;
}
.modal-tab {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  border: 0; background: transparent;
  border-radius: var(--radius-sm);
  color: var(--text-2); font-size: 13px; font-weight: 500;
  cursor: pointer; text-align: left;
  transition: all 0.15s;
}
.modal-tab:hover { background: var(--card-hover); color: var(--text-1); }
.modal-tab.active { background: var(--blue-glow); color: var(--blue-bright); }
.modal-tab.active svg { color: var(--blue-bright); }

/* Visual separator between the core settings tabs (Account/Billing/…/Privacy)
   and the "extras" group below it. Uses a thin border + a small uppercase
   label so the section feels structurally distinct without shouting. */
.modal-tab-divider {
  position: relative;
  margin: 14px 4px 6px;
  border-top: 1px solid var(--border);
  height: 0;
}
.modal-tab-divider > span {
  position: absolute;
  top: -7px; left: 8px;
  padding: 0 6px;
  background: var(--surface);
  font-size: 9.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.10em;
  color: var(--text-3);
}

.modal-body {
  flex: 1; min-width: 0;
  padding: 24px 28px;
  overflow-y: auto;
}
.modal-body-title {
  font-size: 18px; font-weight: 700; color: var(--text-1);
  margin: 0 0 4px 0; letter-spacing: -0.2px;
}
.modal-body-desc {
  font-size: 12px; color: var(--text-3); margin-bottom: 22px;
}

.modal-section {
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  margin-bottom: 12px;
}
.modal-section-row {
  display: flex; align-items: center; gap: 14px;
}
.modal-section-row > div:first-child { flex: 1; min-width: 0; }
.modal-section-title {
  font-size: 13px; font-weight: 600; color: var(--text-1);
}
.modal-section-sub {
  font-size: 11px; color: var(--text-3); margin-top: 3px;
}

/* Toggle switch */
.toggle-switch {
  position: relative;
  width: 36px; height: 20px;
  background: var(--border-light);
  border-radius: 11px;
  cursor: pointer; flex-shrink: 0;
  border: 0; padding: 0;
  transition: background 0.18s;
}
.toggle-switch::after {
  content: ''; position: absolute;
  top: 2px; left: 2px;
  width: 16px; height: 16px;
  border-radius: 50%; background: #fff;
  transition: transform 0.18s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.toggle-switch.on { background: var(--blue); }
.toggle-switch.on::after { transform: translateX(16px); }
.toggle-switch:disabled { opacity: 0.55; cursor: not-allowed; }

/* Modal form fields */
.modal-field { margin-bottom: 10px; }
.modal-field-label {
  display: block; font-size: 11px; color: var(--text-3);
  margin-bottom: 4px; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.05em;
}
.modal-field input[type="password"],
.modal-field input[type="text"],
.modal-field input[type="email"] {
  width: 100%; padding: 9px 12px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text-1);
  font-size: 13px; font-family: inherit;
  transition: border-color 0.15s;
}
.modal-field input:focus {
  outline: 0; border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-glow);
}

/* Action button row */
.modal-section .btn { font-size: 12px; padding: 7px 14px; }
.modal-section-actions {
  display: flex; gap: 8px; justify-content: flex-end;
  margin-top: 10px;
}

/* Danger section (delete account) */
.modal-section.danger {
  border-color: rgba(239, 68, 68, 0.35);
  background: rgba(239, 68, 68, 0.05);
}
.modal-section.danger .modal-section-title { color: #f87171; }

.btn-danger {
  background: rgba(239, 68, 68, 0.12);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.35);
  padding: 7px 14px; font-size: 12px; font-weight: 600;
  border-radius: var(--radius-sm); cursor: pointer;
  transition: all 0.15s;
}
.btn-danger:hover { background: rgba(239, 68, 68, 0.2); color: #fff; }
.btn-danger:disabled { opacity: 0.5; cursor: not-allowed; }

.modal-status {
  font-size: 12px; padding: 7px 10px;
  border-radius: var(--radius-sm);
  margin-top: 8px;
}
.modal-status.error   { background: rgba(239,68,68,0.1);  color: #fca5a5; }
.modal-status.success { background: var(--green-bg);      color: var(--green); }

/* ─── Guest topbar: active-tab highlight + close button ───────────────────
   These selectors target every variant of the public-page topbar so the
   active state and close button look identical across pages. Each variant
   uses its own class prefix (.auth-topbar, .faq-topbar, .docs-topbar,
   .plat-topbar, .mod-topbar) — listed explicitly here rather than via a
   shared class so each page stays self-contained and we don't have to
   change every <header> markup at once. */
.auth-topbar-actions .btn[aria-current="page"],
.faq-topbar-actions  .btn[aria-current="page"],
.docs-topbar-actions .btn[aria-current="page"],
.plat-topbar-actions .btn[aria-current="page"],
.mod-topbar-actions  .btn[aria-current="page"],
.memb-topbar-actions .btn[aria-current="page"] {
  background: var(--blue-glow);
  color: var(--blue-bright);
  border-color: rgba(59,130,246,0.45);
  cursor: default;
  /* Subtle elevation cue so the active button reads above its neighbours. */
  box-shadow: inset 0 0 0 1px rgba(59,130,246,0.10);
}
.auth-topbar-actions .btn[aria-current="page"]:hover,
.faq-topbar-actions  .btn[aria-current="page"]:hover,
.docs-topbar-actions .btn[aria-current="page"]:hover,
.plat-topbar-actions .btn[aria-current="page"]:hover,
.mod-topbar-actions  .btn[aria-current="page"]:hover,
.memb-topbar-actions .btn[aria-current="page"]:hover {
  /* Don't shift on hover for the current page — feels broken otherwise. */
  background: var(--blue-glow);
}

/* Icon-only close button. Used on every secondary page to return to /
   with one click and minimal mouse travel — sits at the right edge,
   inside the action group, next to Sign In / Create Account so the user
   doesn't have to track back across the topbar to the brand link. */
.auth-topbar-actions .btn-topbar-close,
.faq-topbar-actions  .btn-topbar-close,
.docs-topbar-actions .btn-topbar-close,
.plat-topbar-actions .btn-topbar-close,
.mod-topbar-actions  .btn-topbar-close,
.memb-topbar-actions .btn-topbar-close {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-3);
  width: 34px; height: 34px; padding: 0;
  border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; transition: color .12s, border-color .12s, background .12s;
  text-decoration: none;
}
.auth-topbar-actions .btn-topbar-close:hover,
.faq-topbar-actions  .btn-topbar-close:hover,
.docs-topbar-actions .btn-topbar-close:hover,
.plat-topbar-actions .btn-topbar-close:hover,
.mod-topbar-actions  .btn-topbar-close:hover,
.memb-topbar-actions .btn-topbar-close:hover {
  color: var(--text-1);
  border-color: var(--border-light);
  background: var(--card-hover);
}

/* Brand link sits flush in the topbar — no padding, border-radius, or hover
   background. The logo itself is the affordance; wrapping it in a button-like
   chip made the area read as a clickable control rather than the brand mark. */
.auth-topbar-brand,
.faq-topbar-brand,
.docs-topbar-brand,
.plat-topbar-brand,
.mod-topbar-brand,
.memb-topbar-brand {
  padding: 0; border-radius: 0;
}
.auth-topbar-brand:hover,
.faq-topbar-brand:hover,
.docs-topbar-brand:hover,
.plat-topbar-brand:hover,
.mod-topbar-brand:hover,
.memb-topbar-brand:hover {
  background: transparent;
}

/* ─── Brand logo image (replaces the old "N" square + "Nalvera" wordmark) ───
   Sized to fit inside the 76 px topbar (52 px content area between the
   12 px top/bottom padding) with a small breathing margin. */
.auth-topbar-logo,
.faq-topbar-logo,
.docs-topbar-logo,
.plat-topbar-logo,
.mod-topbar-logo,
.memb-topbar-logo {
  display: block;
  height: 48px; width: auto;
  max-height: 48px; max-width: 220px;
  /* Keep crisp rendering on retina + protect against unwanted blur. */
  image-rendering: -webkit-optimize-contrast;
  /* Bring the logo above the topbar's backdrop-filter so it isn't tinted. */
  position: relative; z-index: 1;
}
/* Make sure none of the topbars clip the overflow. */
.auth-topbar, .faq-topbar, .docs-topbar,
.plat-topbar, .mod-topbar, .memb-topbar {
  overflow: visible;
}
.priv-logo-img       { display: block; height: 44px; width: auto; max-height: 44px; max-width: 140px; }
.sidebar-brand-logo { display: block; height: 48px; width: auto; max-height: 48px; max-width: 200px; }

/* ─── Brand-logo toggle ──────────────────────────────────────────────────
   When `branding.js` declares showLogo: false, an inline <script> in the
   page <head> adds the .brand-logo-off class to <html> BEFORE first paint.
   This rule hides every brand-logo variant — topbars (auth/faq/docs/plat/
   mod/memb), sidebar, and the privacy-page header logo — without affecting
   the surrounding click target (the anchor collapses to zero width but
   stays in the DOM, so future toggles back to true don't need markup
   changes). */
html.brand-logo-off .auth-topbar-logo,
html.brand-logo-off .faq-topbar-logo,
html.brand-logo-off .docs-topbar-logo,
html.brand-logo-off .plat-topbar-logo,
html.brand-logo-off .mod-topbar-logo,
html.brand-logo-off .memb-topbar-logo,
html.brand-logo-off .sidebar-brand-logo,
html.brand-logo-off .priv-logo-img {
  display: none;
}

/* ─── Role-scoped login dropdowns (Lab + Partner) ─────────────────────────────
   Visual entry-points in the guest topbar for users who already know they
   are a lab manager or a partner. The auth itself is identical to the main
   "Sign In" flow — only the post-login redirect differs. Rendered both by
   index.html's static topbar and by topbar.js on every marketing page. */
.role-login { position: relative; display: inline-flex; }
.role-login-btn { display: inline-flex; align-items: center; gap: 6px; }
.role-login-btn .chev { width: 10px; height: 10px; transition: transform .15s ease; }
.role-login.open .role-login-btn .chev { transform: rotate(180deg); }

.role-login[data-role="lab"]     .role-login-btn .role-icon { color: var(--purple); }
.role-login[data-role="partner"] .role-login-btn .role-icon { color: var(--teal-bright); }

.role-login-panel {
  position: absolute; top: calc(100% + 8px); right: 0;
  width: 340px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 18px 40px rgba(0,0,0,0.45);
  padding: 16px;
  z-index: 60;
  display: none;
}
.role-login.open .role-login-panel { display: block; }
.role-login-panel::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  border-radius: var(--radius) var(--radius) 0 0;
}
.role-login[data-role="lab"]     .role-login-panel::before {
  background: linear-gradient(90deg, var(--purple), transparent);
}
.role-login[data-role="partner"] .role-login-panel::before {
  background: linear-gradient(90deg, var(--teal), transparent);
}

.role-login-title {
  font-size: 13px; font-weight: 700; color: var(--text-1);
  margin: 0 0 2px;
  display: flex; align-items: center; gap: 7px;
}
.role-login[data-role="lab"]     .role-login-title .role-icon { color: var(--purple); }
.role-login[data-role="partner"] .role-login-title .role-icon { color: var(--teal-bright); }
.role-login-sub { font-size: 11px; color: var(--text-3); margin: 0 0 12px; }
.role-login-panel .form-input { font-size: 13px; }
.role-login-panel .form-group { margin-bottom: 10px; }

.role-login-submit { width: 100%; }
.role-login[data-role="lab"]     .role-login-submit {
  background: var(--purple); border-color: var(--purple); color: #fff;
}
.role-login[data-role="lab"]     .role-login-submit:hover:not(:disabled) {
  filter: brightness(1.1);
}
.role-login[data-role="partner"] .role-login-submit {
  background: var(--teal); border-color: var(--teal); color: #022322;
}
.role-login[data-role="partner"] .role-login-submit:hover:not(:disabled) {
  background: var(--teal-bright);
}

.role-login-foot { margin-top: 10px; font-size: 11px; color: var(--text-3); text-align: center; }
.role-login-foot a { color: var(--text-2); text-decoration: none; }
.role-login-foot a:hover { color: var(--text-1); }

.role-login-alert {
  display: none;
  background: rgba(239,68,68,0.10);
  border: 1px solid rgba(239,68,68,0.35);
  color: #fca5a5;
  font-size: 12px;
  padding: 7px 9px;
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
}

/* ─── Role-entry sidebar (Lab / Partner login) ────────────────────────────────
   Rendered by nav.js when localStorage.nalvera_role_entry is set, meaning the
   user signed in via the Lab or Partner button in the topbar rather than
   the normal Sign-In flow. Layout: consoles first, then a chevron-toggle
   that expands the rest of the platform nav. Dual-role users see both
   consoles up-front. State persists per browser. */
.sidebar.sidebar-role-entry .sidebar-section-label {
  color: var(--text-2);
}

.sidebar-platform-toggle {
  margin: 10px 8px 4px;
  padding: 8px 10px;
  display: flex; align-items: center; gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-family: inherit; font-size: 12px; font-weight: 600;
  cursor: pointer;
  transition: background .12s, border-color .12s, color .12s;
  text-align: left;
}
.sidebar-platform-toggle:hover {
  background: var(--card-hover);
  border-color: var(--border-light);
  color: var(--text-1);
}
.sidebar-platform-chev {
  transition: transform .18s ease;
  color: var(--text-3); flex-shrink: 0;
}
.sidebar-platform-hint {
  margin-left: auto;
  font-size: 10px; font-weight: 500;
  color: var(--text-3);
  /* Truncate on narrow sidebars (mobile-collapsed). */
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 120px;
}

/* Collapsible container. When .open is present, items render; otherwise the
   block is fully removed from the layout (no height, no padding) so the
   sidebar reads as console-only by default. */
.sidebar-platform-wrap {
  display: none;
  flex-direction: column; gap: 2px;
  padding: 4px 0 2px;
}
.sidebar-platform-wrap.open { display: flex; }

/* Chevron points right when collapsed, down when expanded. The .open
   class is mirrored onto the toggle by _navTogglePlatform() in nav.js so
   we never depend on :has() / sibling-state CSS. */
.sidebar-platform-toggle.open .sidebar-platform-chev { transform: rotate(90deg); }


/* ─── TEMPLATE UTILITY CLASSES ───
   Extracted from repeated inline style="" strings inside JS-built templates.
   Convention going forward: JS templates use these (or component classes) —
   new inline styles in innerHTML are a review flag. */
.row-name-ellipsis {
  flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.muted   { color: var(--text-3); }
.muted-2 { color: var(--text-2); }
.link-accent { color: var(--blue-bright); text-decoration: none; }
.link-accent:hover { text-decoration: underline; }
.flex-center-2 { display: flex; align-items: center; gap: var(--sp-2); }

/* ─── LOADING SKELETONS ─── */
.skeleton {
  display: inline-block; height: 12px; border-radius: var(--radius-xs);
  background: linear-gradient(90deg, var(--card) 25%, var(--card-hover) 50%, var(--card) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.4s var(--ease-in-out) infinite;
}
.skeleton-row td { padding-top: var(--sp-3); padding-bottom: var(--sp-3); }
@keyframes skeleton-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ─── FAILED-JOB EXPLANATION ROW ───
   Rendered directly under a failed job's row: the server-sanitised reason
   plus what to do next. Calm severity styling — the red is a hairline
   accent, not a alarm panel. */
.job-error-row td { padding-top: 0; border-top: none; }
.job-error-note {
  margin: 0 0 var(--sp-2);
  padding: var(--sp-2) var(--sp-3);
  border-left: 2px solid var(--status-failed-border);
  background: var(--status-failed-bg);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: var(--fs-sm); line-height: var(--lh-prose);
  color: var(--text-2);
}
.job-error-note strong { color: var(--status-failed-fg); font-weight: 600; }
.job-error-note .job-error-hint { color: var(--text-3); }
.job-error-note a { color: var(--blue-bright); text-decoration: none; }
.job-error-note a:hover { text-decoration: underline; }
.job-retry-btn { margin-left: var(--sp-3); vertical-align: middle; }

/* ═══════════════════════════════════════════════════════════════════════════
   GLOBAL ACCESSIBILITY PRIMITIVES (keep at end of sheet — must win cascade)
   ═══════════════════════════════════════════════════════════════════════════ */

/* Keyboard focus: one visible, consistent ring everywhere. :focus-visible
   only — pointer clicks don't paint rings, keyboard navigation always does. */
:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
  border-radius: var(--radius-xs);
}
/* Inputs already carry their own focus treatment; keep the ring tight. */
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline-offset: 0;
}

/* Reduced motion: a global kill switch, not per-rule opt-ins. Everything
   stops; the .motion-essential allowlist preserves determinate progress
   indicators whose motion IS the information (e.g. upload spinners). */
@media (prefers-reduced-motion: reduce) {
  *:not(.motion-essential),
  *:not(.motion-essential)::before,
  *:not(.motion-essential)::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  html { scroll-behavior: auto; }
}
