/* ===========================================================================
   AvertGate — shared theme  (spec: DESIGN.md)
   Loaded by the app pages via <link href="/static/theme.css">.
   Owns: tokens, type scale, reset, motion primitives, and the component
   classes every page shares (.btn .input .label .badge .card .table .tabs
   .modal .toast .skeleton .empty-state). Page-specific layout stays in each
   page's own <style> block, but reads its colours from here.
   Single theme: white. No dark mode, no data-theme, no OS-preference switch.
   =========================================================================== */

/* --- tokens ---------------------------------------------------------------
   Semantic names are the source of truth. The legacy names further down
   (--ink-*, --royal-*, --gold-*, --hairline*, --text-*) are ALIASES that keep
   every page not yet migrated rendering exactly as before; they are removed
   page by page and must not be used in new code. */
:root {
  /* neutral primitives (only for values that have no semantic role) */
  --neutral-900: #171717;
  --neutral-700: #404040;
  --neutral-500: #737373;

  /* surfaces */
  --bg: #FFFFFF;              /* page background */
  --surface: #FAFAFA;         /* card / panel */
  --surface-2: #F2F2F2;       /* input / hover / inset chip */
  --surface-3: #F5F5F5;       /* alternate section band; sidebar ground */
  --sidebar-bg: var(--surface-3);

  /* lines */
  --line: #E5E5E5;            /* standard 1px border */
  --line-strong: #C7C7C7;     /* emphasised border / divider */

  /* text */
  --fg: #000000;              /* headings, primary text */
  --fg-2: #525252;            /* secondary text */
  --fg-3: #6B6B6B;            /* helper text, placeholder (14px+ only) */
  --fg-hover: var(--neutral-700);
  --on-fg: #FFFFFF;           /* text on a --fg fill (primary button) */
  --ring: rgba(0, 0, 0, 0.12); /* focus halo on inputs */
  --shadow-pop: 0 8px 24px rgba(0, 0, 0, 0.12); /* menus, tooltips, toasts */
  --shadow-modal: 0 16px 48px rgba(0, 0, 0, 0.16);

  /* decision / system status — the only colours in the product */
  --allow: #12794A;
  --allow-bg: rgba(18, 121, 74, 0.10);
  --block: #B42318;
  --block-bg: rgba(180, 35, 24, 0.10);
  --block-strong: #8F1C12;     /* pressed/hover on a --block fill */
  --escalate: #A15C00;
  --escalate-bg: rgba(161, 92, 0, 0.10);

  /* type */
  --font-display: 'Space Grotesk', 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'Cascadia Code', monospace;

  /* shape */
  --radius: 6px;
  --radius-sm: 4px;
  --max-w: 1120px;

  /* motion (see DESIGN.md §6) */
  --dur-fast: 120ms;
  --dur-base: 200ms;
  --dur-slow: 300ms;
  --dur-scene: 600ms;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --ease-in: cubic-bezier(0.5, 0, 0.75, 0);
  --stagger: 60ms;

  /* --- legacy aliases (do not use in new code) --- */
  --ink-900: var(--bg);
  --ink-800: var(--surface-3);
  --ink-700: var(--surface);
  --ink-600: var(--surface-2);

  --royal-900: var(--surface);
  --royal-800: var(--surface-2);
  --royal-600: var(--line);
  --royal-500: var(--neutral-500);
  --royal-400: var(--fg-3);
  --royal-300: var(--neutral-700);

  --gold-600: var(--fg);       /* was the ember accent; now plain black */
  --gold-500: var(--fg);
  --gold-400: var(--neutral-700);
  --gold-200: var(--line);
  --gold-text: var(--fg);

  --text-primary: var(--fg);
  --text-secondary: var(--fg-2);
  --text-muted: var(--fg-3);

  --hairline: var(--line);
  --hairline-strong: var(--line-strong);
  --hairline-cool: var(--line);

  --on-gold: var(--on-fg);
  --inset-highlight: transparent;
  --hero-glow: transparent;
  --grid-line: transparent;

  color-scheme: light;
}

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

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--fg);
  font-size: 1rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* Page transition: fade in only (opacity, no movement). `backwards` so no
     animation state lingers after it ends. */
  animation: pageIn var(--dur-slow) var(--ease-out) backwards;
}
@keyframes pageIn { from { opacity: 0; } }

a { color: var(--neutral-700); text-decoration: none; }
a:hover { color: var(--neutral-700); }

.wrap { max-width: var(--max-w); margin: 0 auto; padding: 0 1.5rem; }

/* --- typography ----------------------------------------------------------
   Space Grotesk for headings and logo only; Inter everywhere else. */
h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.15;
  text-wrap: balance;
}
h2 { font-size: clamp(1.75rem, 3.5vw, 2.25rem); }
h3 { font-size: 1.0625rem; }

.tabular { font-variant-numeric: tabular-nums; }

/* Small uppercase label that sits above a section heading. */
.eyebrow {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg);
  margin-bottom: 0.75rem;
}

/* Thin rule under a section heading. */
.section-rule {
  width: 48px;
  height: 1px;
  background: var(--fg);
  border: 0;
  margin: 1rem 0 0;
}
.text-center .section-rule,
.section-head.text-center .section-rule { margin-left: auto; margin-right: auto; }

.section-sub {
  color: var(--fg-2);
  font-size: 1rem;
  max-width: 660px;
  line-height: 1.7;
}
.text-center { text-align: center; }
.text-center .section-sub { margin-left: auto; margin-right: auto; }

/* --- sections ------------------------------------------------------------ */
section { padding: 7rem 0; border-top: 1px solid var(--line); }
section:nth-of-type(even) { background: var(--surface-3); }

@media (max-width: 720px) {
  section { padding: 4.5rem 0; }
}

/* --- interactive transitions ----------------------------------------------
   One rule for every interactive control: colour/border/shadow changes take
   --dur-fast, movement (press, lift) rides the same curve. Single theme, so
   there is no token-flip repaint problem to dodge any more. */
.btn, .pill, .field, .input, .form-input, .copy-btn, .lang-toggle, .avatar, .tab,
.card, a.session-row, a.evt, .user-dropdown button, .user-dropdown a {
  transition:
    background-color var(--dur-fast) var(--ease-out),
    border-color var(--dur-fast) var(--ease-out),
    color var(--dur-fast) var(--ease-out),
    box-shadow var(--dur-fast) var(--ease-out),
    transform var(--dur-fast) var(--ease-out);
}

/* --- buttons ------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  padding: 0.9rem 1.9rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1;
  cursor: pointer;
  text-decoration: none;
}
.btn:active:not(:disabled) { transform: scale(0.98); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* primary: black fill */
.btn-primary { background: var(--fg); color: var(--on-fg); }
.btn-primary:hover { background: var(--neutral-700); color: var(--on-fg); }
.btn-primary:disabled { background: var(--fg); }

/* secondary: outlined (.btn-outline is the legacy name) */
.btn-secondary,
.btn-outline {
  background: transparent;
  border-color: var(--line-strong);
  color: var(--fg);
}
.btn-secondary:hover,
.btn-outline:hover { background: var(--surface-2); border-color: var(--line-strong); color: var(--fg); }

/* ghost: no border until hover */
.btn-ghost { background: transparent; color: var(--fg-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--fg); }

.btn-lg { padding: 1rem 2.25rem; font-size: 1rem; }

/* --- cards --------------------------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 2rem 1.75rem;
}
.card:hover { border-color: var(--line-strong); }
.card h3 { margin-bottom: 0.5rem; }
.card p { color: var(--fg-2); font-size: 0.9375rem; }
/* Showcase only (landing): lift on hover. Not for app screens. */
.card-lift:hover { transform: translateY(-2px); }

/* --- forms: input + label -------------------------------------------------
   .form-input / .form-label are the legacy names; same rules. */
.label,
.form-label {
  display: block;
  margin-bottom: 0.4rem;
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--fg-2);
}
.input,
.form-input {
  width: 100%;
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  padding: 0.7rem 0.9rem;
  border-radius: var(--radius);
  border: 1px solid var(--line-strong);
  background: var(--bg);
  color: var(--fg);
}
.input::placeholder,
.form-input::placeholder { color: var(--fg-3); }
.input:hover:not(:disabled):not(:focus),
.form-input:hover:not(:disabled):not(:focus) { border-color: var(--fg-3); }
.input:focus,
.form-input:focus { outline: none; border-color: var(--fg); box-shadow: 0 0 0 2px var(--ring); }
.input:disabled,
.form-input:disabled { opacity: 0.6; cursor: not-allowed; }
.input.invalid,
.form-input.invalid { border-color: var(--block); }

/* --- badge: decision / status chip -----------------------------------------
   Always carries its text label; colour is never the only signal. Legacy
   .decision-badge.badge-ALLOW markup keeps working (see dashboard layer). */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 500;
  line-height: 1.4;
  padding: 0.22rem 0.6rem;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border: 1px solid var(--line-strong);
  color: var(--fg-2);
  background: transparent;
}
.badge-allow    { background: var(--allow-bg);    color: var(--allow);    border-color: var(--allow); }
.badge-block    { background: var(--block-bg);    color: var(--block);    border-color: var(--block); }
.badge-escalate { background: var(--escalate-bg); color: var(--escalate); border-color: var(--escalate); }
.badge-neutral  { background: var(--surface-2);   color: var(--fg-2);     border-color: var(--line); }

/* --- table ----------------------------------------------------------------
   1px row dividers, no zebra, hover = --surface-2. Wrap in .table-wrap for
   horizontal scroll on narrow screens. */
.table-wrap { overflow-x: auto; }
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
}
.table th {
  text-align: left;
  padding: 0.65rem 1rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg-3);
  border-bottom: 1px solid var(--line-strong);
  white-space: nowrap;
}
.table td {
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--line);
  color: var(--fg);
  vertical-align: middle;
}
.table tbody tr { transition: background-color var(--dur-fast) var(--ease-out); }
.table tbody tr:hover { background: var(--surface-2); }
.table td.mono, .table .mono { font-family: var(--font-mono); font-size: 0.8125rem; }
.table td.num, .table th.num { text-align: right; }

/* --- tabs: thin underline --------------------------------------------------
   Active = black underline + --fg text. Panels fade in on switch. */
.tabs {
  display: flex;
  gap: 1.5rem;
  padding-bottom: 1px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}
.tab {
  flex-shrink: 0;
  padding: 0.65rem 0;
  margin-bottom: -1px;
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--fg-2);
  cursor: pointer;
}
.tab:hover { color: var(--fg); }
.tab.active,
.tab[aria-selected="true"] { color: var(--fg); border-bottom-color: var(--fg); }
.tab-panel { animation: tabIn var(--dur-base) var(--ease-out); }
.tab-panel[hidden] { display: none; }
@keyframes tabIn { from { opacity: 0; } }

/* --- skeleton: placeholder while data loads --------------------------------
   Same footprint as the real content to avoid layout shift. Size it with
   width/height or the .skeleton-text / .skeleton-block helpers. */
.skeleton {
  position: relative;
  display: block;
  overflow: hidden;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  color: transparent;
  user-select: none;
  pointer-events: none;
}
.skeleton::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.75), transparent);
  transform: translateX(-100%);
  animation: skeletonSweep 1.4s var(--ease-in-out) infinite;
}
@keyframes skeletonSweep { to { transform: translateX(100%); } }
.skeleton-text  { height: 0.875rem; width: 100%; margin: 0.35rem 0; }
.skeleton-block { height: 5rem; width: 100%; }

/* --- motion utilities (driven by motion.js) --------------------------------
   Hidden state applies only once motion.js has marked <html> with
   .motion-ready, so a page without JS (or with it failing) stays visible. */
.motion-ready [data-reveal]:not(.is-visible) {
  opacity: 0;
  transform: translateY(8px);
}
/* An animation (not a transition) so it never replaces the element's own
   transition list, and the element keeps its own opacity afterwards. */
.motion-ready [data-reveal].is-visible {
  animation: revealUp var(--dur-slow) var(--ease-out) var(--reveal-delay, 0ms) backwards;
}
@keyframes revealUp { from { opacity: 0; transform: translateY(8px); } }
[data-count] { font-variant-numeric: tabular-nums; }

/* --- signal path — the signature element ----------------------------------
   A live diagram of the product's own runtime loop: a call travels through
   Intercept -> Policy -> Inspect and resolves to a decision. Showcase layer:
   the travelling pulse is the one place a soft glow is justified, because it
   is the mechanism being demonstrated. Frozen under reduced motion. */
.signal-path {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 1.35rem 1.75rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.sp-track {
  position: relative;
  flex: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-width: 0;
  height: 1px;
  background: var(--line-strong);
  margin: 0 0.25rem;
}
.sp-station {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.sp-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 2px solid var(--fg);
  box-shadow: 0 0 0 4px var(--surface);
  z-index: 1;
}
.sp-label {
  position: absolute;
  top: 16px;
  font-family: var(--font-mono);
  font-size: 0.625rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-3);
  white-space: nowrap;
}
.sp-pulse {
  position: absolute;
  top: 50%;
  left: 0%;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--fg);
  box-shadow: 0 0 10px 2px var(--neutral-700);
  transform: translate(-50%, -50%);
  opacity: 0;
  animation: spTravel 3.4s cubic-bezier(0.45, 0, 0.55, 1) infinite;
}
@keyframes spTravel {
  0%   { left: 0%;   opacity: 0; }
  6%   { opacity: 1; }
  90%  { opacity: 1; }
  100% { left: 100%; opacity: 0; }
}
.sp-decision {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--allow);
  background: var(--allow-bg);
  color: var(--allow);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  flex-shrink: 0;
}
.sp-decision-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 6px currentColor;
}
.sp-decision.is-block    { border-color: var(--block);    background: var(--block-bg);    color: var(--block); }
.sp-decision.is-escalate { border-color: var(--escalate); background: var(--escalate-bg); color: var(--escalate); }

@media (max-width: 620px) {
  .signal-path { flex-direction: column; align-items: stretch; gap: 1.75rem; padding: 1.5rem; }
  .sp-track { margin: 0; }
  .sp-label { top: 14px; font-size: 0.5625rem; }
  .sp-decision { align-self: center; }
}

/* --- icons --------------------------------------------------------------- */
.icon { width: 22px; height: 22px; flex-shrink: 0; display: block; }
.icon-sm { width: 16px; height: 16px; }
.icon-gold { color: var(--fg); }
.icon-royal { color: var(--neutral-700); }

/* --- focus --------------------------------------------------------------- */
:focus-visible {
  outline: 2px solid var(--fg);
  outline-offset: 2px;
}

/* --- reduced motion --------------------------------------------------------
   Mandatory (DESIGN.md §6). Every transition and animation collapses to an
   instant state change; reveal targets are simply shown; nothing conveys
   information through motion alone. motion.js checks the same preference. */
/* Exception: the sidebar rail and the content margin that follows it keep
   their own timing (owner decision: the hover-expand is the product's
   signature interaction and its reduced-motion rule was removed on purpose).
   Everything else collapses. */
/* user switch (html.motion-off); the OS setting is not consulted */
html.motion-off *:not(.sidebar):not(.sidebar *):not(.dash-main), html.motion-off *:not(.sidebar):not(.sidebar *):not(.dash-main)::before, html.motion-off *:not(.sidebar):not(.sidebar *):not(.dash-main)::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0s !important;
    scroll-behavior: auto !important;
  }
html.motion-off.motion-ready [data-reveal]:not(.is-visible) { opacity: 1; transform: none; }
html.motion-off .sp-pulse { animation: none; }
html.motion-off .skeleton::after { animation: none; display: none; }


/* ===========================================================================
   DASHBOARD LAYER
   Shared by dashboard.html, audit.html and policy.html. Landing and demo do
   not use these classes; where a name is shared (.stat, .decision-badge,
   .verdict-chip) those pages declare their own copy in a later <style> block,
   so their rendering is unaffected.
   =========================================================================== */

/* --- sidebar navigation --------------------------------------------------
   Port of the 21st.dev "Sidebar" component (animated, hover-expand): a
   60px icon rail on desktop that widens to 240px while hovered (or while a
   child has keyboard focus), on a neutral-100 ground with icon + label links,
   the logo on top and the account at the bottom. The rail is position:fixed
   and .dash-main is margined to match it: 60px collapsed, 240px while the
   rail is hovered/focused, animated with the same duration and easing so the
   content slides right and back in step with the rail.
   Below 861px it becomes the component's mobile pattern: a slim top bar with
   a menu button and a full-screen overlay menu (.sidebar.open). */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 60px;
  z-index: 30;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 2.5rem;
  padding: 1rem;
  background: var(--ink-800);
  border-right: 1px solid var(--hairline);
  overflow-y: auto;
  overflow-x: hidden;
  /* Closing waits 150ms (so a brief mouse slip doesn't snap it shut), then
     glides over 400ms; opening is immediate. dash-main uses the same timing. */
  transition: width 400ms ease-in-out 150ms;
}
.sidebar:hover,
.sidebar:has(:focus-visible) { width: 240px; transition-delay: 0s; }

.sb-main { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.sb-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.9375rem;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  text-decoration: none;
  white-space: nowrap;
}
.sb-brand:hover { color: var(--text-primary); }
.sb-icon { display: flex; align-items: center; justify-content: center; width: 24px; height: 24px; flex-shrink: 0; color: var(--fg); }
.sb-icon .brand { --brand-h: 22px; }

.sb-nav { margin-top: 2rem; display: flex; flex-direction: column; gap: 0.5rem; }

/* Links: icon + label; label nudges right on hover (translate-x-1). */
.sb-link {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.5rem;
  width: 100%;
  padding: 0.5rem 0;
  background: transparent;
  border: 0;
  font-family: var(--font-sans);
  font-size: 0.875rem;
  text-align: left;
  color: var(--neutral-700);
  text-decoration: none;
  cursor: pointer;
}
.sb-link:hover { color: var(--neutral-700); }
.sb-link-icon { width: 20px; height: 20px; flex-shrink: 0; color: var(--neutral-700); }
.sb-link-icon svg { width: 100%; height: 100%; display: block; }
.sb-link-label {
  display: inline-block;
  white-space: pre;
  transition: transform 150ms, opacity 150ms;
}
.sb-link:hover .sb-link-label { transform: translateX(4px); }
.sb-link.active,
.sb-link.active .sb-link-icon { color: var(--fg); }
.sb-link.active .sb-link-label { font-weight: 600; }

/* Labels are only visible while the rail is open. */
.sb-fade { opacity: 0; transition: opacity 250ms; }
.sidebar:hover .sb-fade,
.sidebar:has(:focus-visible) .sb-fade,
.sidebar.open .sb-fade { opacity: 1; }
.sb-link .sb-fade { transition: transform 150ms, opacity 150ms; }

/* Account-menu preferences: language switch (black & white). */
.sb-pref-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.4rem 0.5rem;
}
.sb-pref-title { display: flex; align-items: center; gap: 0.5rem; font-size: 0.8125rem; color: var(--fg-2); }
.sb-pref-title svg { width: 16px; height: 16px; }
.sb-switch {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  width: 72px;
  padding: 2px;
  background: var(--bg);
  border: 1px solid var(--fg);
  border-radius: 999px;
}
.sb-switch-thumb {
  position: absolute;
  top: 2px;
  bottom: 2px;
  left: 2px;
  width: calc(50% - 2px);
  background: var(--fg);
  border-radius: 999px;
  transition: transform 200ms cubic-bezier(0.4, 0, 0.2, 1);
}
.sb-switch:has(button[data-val="en"][aria-checked="true"]) .sb-switch-thumb,
.sb-switch:has(button[data-val="dark"][aria-checked="true"]) .sb-switch-thumb { transform: translateX(100%); }
.sb-dropdown .sb-switch button {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: auto;
  padding: 0.2rem 0;
  border-radius: 999px;
  color: var(--fg);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  transition: color 200ms;
}
.sb-dropdown .sb-switch button svg { width: 14px; height: 14px; }
.sb-dropdown .sb-switch button[aria-checked="true"] { color: var(--on-fg); }
.sb-dropdown .sb-switch button:hover { background: transparent; }
/* user switch (html.motion-off); the OS setting is not consulted */
html.motion-off .sb-switch-thumb { transition: none; } 

/* Account: avatar + name, dropdown opens upward. */
.sb-bottom { display: flex; flex-direction: column; gap: 0.25rem; }
.sb-user-menu { position: relative; }
.sb-avatar-circle {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  margin-left: -4px;   /* 28px avatar centred on the 20px icon column */
  border-radius: 50%;
  background: var(--fg);
  color: var(--on-fg);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.03em;
}
.sb-account-info { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.sb-account-info strong { font-size: 0.8125rem; font-weight: 500; color: var(--neutral-700); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-account-info span { font-size: 0.6875rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.sb-dropdown {
  display: none;
  position: absolute;
  left: 0;
  /* Açık sidebar genişliği (240px) − yatay padding (2 × 1rem): dropdown
     sidebar'ın iç alanıyla birebir hizalanır, overflow ile kırpılmaz. */
  width: calc(240px - 2rem);
  bottom: calc(100% + 0.5rem);
  z-index: 40;
  padding: 0.5rem;
  background: var(--bg);
  border: 1px solid var(--hairline-strong);
  border-radius: var(--radius-sm);
  animation: sbDropdownIn 150ms ease-out;
}
.sb-dropdown.open { display: block; }
@keyframes sbDropdownIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: none; }
}
.sb-who {
  padding: 0.4rem 0.5rem 0.55rem;
  border-bottom: 1px solid var(--hairline);
  margin-bottom: 0.4rem;
}
.sb-who strong { display: block; font-size: 0.8125rem; font-weight: 600; color: var(--text-primary); }
.sb-who span { font-size: 0.6875rem; color: var(--text-secondary); word-break: break-all; }
.sb-dropdown a,
.sb-dropdown button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.4rem 0.5rem;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  cursor: pointer;
  text-decoration: none;
}
.sb-dropdown a:hover,
.sb-dropdown button:hover { background: var(--ink-600); color: var(--text-primary); }

/* Mobile: slim top bar (menu button on the right) + full-screen overlay. */
.sb-mobile-toggle,
.sb-close { display: none; }

/* --- page shell ----------------------------------------------------------
   Fills the space beside the fixed sidebar. No max-width/auto-centering on
   the base — a fixed max-width combined with a left margin overflows the
   viewport on anything narrower than (margin + max-width). Pages that want a
   narrow reading column (e.g. Connect) opt in via their own .guide max-width. */
.dash-main { margin-left: 60px; padding: 2rem 2rem 5rem 2rem; transition: margin-left 400ms ease-in-out 150ms; }
/* Content moves in lockstep with the rail (same duration + easing as
   .sidebar's width), like the in-flow layout of the 21st.dev component. */
@media (min-width: 861px) {
  body:has(.sidebar:hover) .dash-main,
  body:has(.sidebar :focus-visible) .dash-main { margin-left: 240px; transition-delay: 0s; }
}
.dash-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}
.dash-head h1 { font-size: 1.25rem; font-weight: 500; }
.dash-head h2 { font-size: 1.0625rem; font-weight: 500; }
.dash-head-btn { padding: 0.55rem 1.15rem; font-size: 0.875rem; }
.dash-section { margin-top: 2.5rem; }

/* --- stat cards ---------------------------------------------------------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1rem;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 1rem 1.25rem;
  text-align: center;
}
.stat-value {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 500;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
  color: var(--fg);
}
.stat-label {
  font-size: 0.6875rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg-3);
  margin-top: 0.35rem;
}
.stat-allow    .stat-value { color: var(--allow); }
.stat-block    .stat-value { color: var(--block); }
.stat-escalate .stat-value { color: var(--escalate); }

/* --- decision badges ----------------------------------------------------- */
.decision-badge {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 500;
  padding: 0.22rem 0.6rem;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border: 1px solid;
  flex-shrink: 0;
}
.badge-ALLOW    { background: var(--allow-bg);    color: var(--allow);    border-color: var(--allow); }
.badge-BLOCK    { background: var(--block-bg);    color: var(--block);    border-color: var(--block); }
.badge-ESCALATE { background: var(--escalate-bg); color: var(--escalate); border-color: var(--escalate); }
/* Shadow mode (audit-only POC): what the gate WOULD have done; the call ran. Dashed = not enforced. */
.badge-SHADOW_BLOCK, .badge-SHADOW_ESCALATE { background: transparent; color: var(--fg-2); border: 1px dashed var(--fg-2); }

/* --- verdict chips ------------------------------------------------------- */
.verdict-chip {
  font-size: 0.75rem;
  font-family: var(--font-mono);
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-sm);
  border: 1px solid;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  line-height: 1.5;
}
.verdict-flagged { background: var(--block-bg); color: var(--block); border-color: var(--block); }
.verdict-clean   { background: var(--allow-bg); color: var(--allow); border-color: var(--allow); }

/* --- event rows ---------------------------------------------------------- */
.evt-list { display: flex; flex-direction: column; gap: 0.65rem; }
.evt {
  display: block;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 2px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1.1rem;
  color: inherit;
  animation: dashFadeIn var(--dur-slow) var(--ease-out) both;
}
a.evt:hover { border-color: var(--line-strong); background: var(--surface-2); color: inherit; }
.evt-ALLOW    { border-left-color: var(--allow); }
.evt-BLOCK    { border-left-color: var(--block); }
.evt-ESCALATE { border-left-color: var(--escalate); }
.evt-SHADOW_BLOCK, .evt-SHADOW_ESCALATE { border-left-color: var(--fg-3); }
.evt-top {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.evt-tool {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 0.875rem;
  color: var(--fg);
}
.evt-meta {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--fg-3);
  display: flex;
  gap: 0.9rem;
  flex-wrap: wrap;
}
.evt-reason {
  color: var(--fg-2);
  font-size: 0.8125rem;
  line-height: 1.6;
  margin-top: 0.4rem;
}
.evt-label {
  color: var(--fg-3);
  font-size: 0.625rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 0.75rem 0 0.35rem;
}
.evt pre {
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--fg-2);
  padding: 0.6rem 0.8rem;
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-x: auto;
}
.evt-verdicts { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.75rem; }

/* Fade-up entrance (DESIGN.md section 6): 8px rise over --dur-slow.
   Reduced motion is handled by the global rule near the top of this file. */
@keyframes dashFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* --- session rows -------------------------------------------------------- */
.session-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 0.8rem 1.1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  color: inherit;
}
a.session-row:hover { border-color: var(--fg); color: inherit; }
.mono-id {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--fg-hover);
  background: var(--surface-2);
  border: 1px solid var(--line);
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-sm);
}

/* --- filters / controls -------------------------------------------------- */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}
.pill {
  font-size: 0.8125rem;
  font-family: var(--font-sans);
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--fg-2);
  cursor: pointer;
}
.pill:hover { border-color: var(--line-strong); color: var(--fg); }
.pill.active {
  /* Selected = inverted neutral. Status colours are never decorative. */
  border-color: var(--fg);
  color: var(--on-fg);
  background: var(--fg);
  font-weight: 500;
}
.field {
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  padding: 0.45rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--fg);
}
.field:focus { border-color: var(--fg); outline: none; box-shadow: 0 0 0 2px var(--ring); }

/* Switch-style toggle used for auto-refresh. */
.switch {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8125rem;
  color: var(--fg-2);
  cursor: pointer;
  user-select: none;
}
.switch input { accent-color: var(--fg); cursor: pointer; }
.live-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--allow);
  box-shadow: 0 0 0 0 var(--allow);
  animation: livePulse 2s ease-out infinite;
}
@keyframes livePulse {
  0%   { box-shadow: 0 0 0 0 rgba(18, 121, 74, 0.45); }
  70%  { box-shadow: 0 0 0 7px rgba(18, 121, 74, 0); }
  100% { box-shadow: 0 0 0 0 rgba(18, 121, 74, 0); }
}

/* --- empty state --------------------------------------------------------- */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.empty-state .icon { width: 34px; height: 34px; color: var(--fg); margin: 0 auto 1.1rem; }
.empty-state h3 { font-size: 1.0625rem; margin-bottom: 0.5rem; }
.empty-state p { color: var(--fg-2); font-size: 0.9375rem; max-width: 440px; margin: 0 auto; }
.empty-actions { margin-top: 1.75rem; display: flex; flex-direction: column; align-items: center; gap: 0.85rem; }
.empty-actions .hint { font-size: 0.8125rem; color: var(--fg-3); }
code {
  font-family: var(--font-mono);
  font-size: 0.8125em;
  /* Explicit colour: inheriting --fg-3 from a hint drops to 4.3:1 on
     the light-mode chip background. */
  color: var(--fg);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.1rem 0.4rem;
}

/* --- toast --------------------------------------------------------------- */
.toast {
  position: fixed;
  right: 1.5rem;
  bottom: 1.5rem;
  z-index: 50;
  max-width: 420px;
  padding: 0.85rem 1.15rem;
  border-radius: var(--radius-sm);
  border: 1px solid;
  font-size: 0.875rem;
  background: var(--surface);
  box-shadow: var(--shadow-pop);
  animation: dashFadeIn var(--dur-base) var(--ease-out) both;
}
.toast-ok    { border-color: var(--allow); color: var(--allow); }
.toast-error { border-color: var(--block); color: var(--block); }

/* --- responsive ---------------------------------------------------------- */
@media (max-width: 1000px) {
  .stat-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 860px) {
  /* Mobile pattern from the component: top bar + full-screen overlay. */
  .sidebar {
    display: none;
    width: 100%;
    padding: 2.5rem;
    border-right: 0;
    background: var(--bg);
    z-index: 100;
    transition: none;
  }
  .sidebar:hover,
  .sidebar:has(:focus-visible) { width: 100%; }
  .sidebar.open { display: flex; }
  .sb-dropdown { width: 100%; }
  .sb-close {
    display: flex;
    position: absolute;
    top: 2.5rem;
    right: 2.5rem;
    padding: 0;
    background: transparent;
    border: 0;
    color: var(--fg);
    cursor: pointer;
  }
  .sb-close svg { width: 24px; height: 24px; }
  .sb-mobile-toggle {
    display: flex;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 31;
    height: 40px;
    padding: 0 1rem;
    align-items: center;
    justify-content: flex-end;
    background: var(--ink-800);
    border: 0;
    border-bottom: 1px solid var(--hairline);
    color: var(--fg);
    cursor: pointer;
  }
  .sb-mobile-toggle svg { width: 24px; height: 24px; }
  .dash-main { margin-left: 0; padding: 3.5rem 1.1rem 4rem; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .evt-meta { margin-left: 0; width: 100%; }
}

/* ===========================================================================
   APPLICATION LAYER
   Forms, modals, the signed-in user menu, code blocks, agent and key rows.
   Used by login, signup, agents, settings and connect.
   =========================================================================== */

/* --- forms ---------------------------------------------------------------
   .form-label / .form-input are aliases of .label / .input (top of file). */
.form-group { margin-bottom: 1.15rem; }
.form-error {
  display: none;
  margin-top: 0.4rem;
  font-size: 0.8125rem;
  color: var(--block);
}
.form-error.show { display: block; }

/* Form-level error banner, above the fields. */
.form-banner {
  display: none;
  margin-bottom: 1.15rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--block);
  background: var(--block-bg);
  color: var(--block);
  font-size: 0.875rem;
}
.form-banner.show { display: block; }

.form-hint { margin-top: 0.4rem; font-size: 0.75rem; color: var(--fg-3); }
.btn-block { width: 100%; }

/* --- auth shell -----------------------------------------------------------
   Shared by login / invite / forgot-password / reset-password.
   Left: centred card. Right (>=960px): thin brand panel with a slow grid. */
.auth-controls { position: fixed; top: 1.25rem; right: 1.25rem; display: flex; gap: 0.5rem; z-index: 10; }
.auth-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr); background: var(--bg); }
.auth-main { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 4rem 1.25rem 3rem; }
.auth-card {
  width: 100%; max-width: 24rem; padding: 2rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  animation: auth-rise var(--dur-scene) var(--ease-out) both;
}
@keyframes auth-rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.auth-brand { display: flex; justify-content: center; margin-bottom: 1.75rem; color: var(--fg); }
.auth-card h1 { font-family: var(--font-display); font-size: 1.5rem; font-weight: 500; letter-spacing: -0.02em; text-wrap: balance; text-align: center; margin: 0 0 0.5rem; }
.auth-sub { text-align: center; color: var(--fg-2); font-size: 0.875rem; line-height: 1.6; margin: 0 0 1.5rem; }
.auth-alt { margin: 1.25rem 0 0; text-align: center; font-size: 0.875rem; color: var(--fg-2); }
.auth-alt a { color: var(--fg); font-weight: 500; text-decoration: none; }
.auth-alt a:hover { text-decoration: underline; }
.auth-foot { margin-top: 1.5rem; text-align: center; font-size: 0.8125rem; }
.auth-foot a { color: var(--fg-2); text-decoration: none; }
.auth-foot a:hover { color: var(--fg); }
.auth-divider { display: flex; align-items: center; margin: 1.5rem 0 1rem; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; border-top: 1px dashed var(--line-strong); }
.auth-divider span { margin: 0 0.5rem; font-size: 0.75rem; color: var(--fg-2); }
.auth-link { font-size: 0.75rem; font-weight: 500; color: var(--fg-2); text-decoration: none; }
.auth-link:hover { color: var(--fg); text-decoration: underline; }
.auth-row { display: flex; justify-content: flex-end; margin: -0.25rem 0 0.9rem; }

/* fields: leading icon + optional trailing password toggle */
.auth-card .form-group { margin-bottom: 0.9rem; }
.auth-field { position: relative; }
.auth-field .auth-ico { position: absolute; left: 0.75rem; top: 50%; width: 1rem; height: 1rem; transform: translateY(-50%); color: var(--fg-3); pointer-events: none; transition: color var(--dur-base) var(--ease-out); }
.auth-field:focus-within .auth-ico { color: var(--fg); }
.auth-field .form-input { padding-left: 2.5rem; background: var(--surface-2); transition: border-color var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out), background var(--dur-base) var(--ease-out); }
.auth-field .form-input:focus { background: var(--bg); box-shadow: 0 0 0 2px var(--ring); }
.auth-field .form-input.has-toggle { padding-right: 2.75rem; }
.auth-field .form-input.otp-input { padding-left: 0.9rem; text-align: center; font-size: 1.25rem; letter-spacing: 0.5rem; font-family: var(--font-mono); }
.pw-toggle { position: absolute; right: 0.25rem; top: 50%; transform: translateY(-50%); width: 2.25rem; height: 2.25rem; display: grid; place-items: center; background: none; border: 0; border-radius: var(--radius-sm); color: var(--fg-3); cursor: pointer; transition: color var(--dur-fast) var(--ease-out); }
.pw-toggle:hover { color: var(--fg); }
.pw-toggle:focus-visible, .auth-card .btn:focus-visible, .auth-link:focus-visible, .resend-btn:focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; }
.pw-toggle .eye-off { display: none; }
.pw-toggle[aria-pressed="true"] .eye { display: none; }
.pw-toggle[aria-pressed="true"] .eye-off { display: block; }

/* strength meter */
.pw-meter { display: none; margin-top: 0.5rem; }
.pw-meter.show { display: block; }
.pw-meter-bars { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.pw-meter-bars i { height: 3px; border-radius: 2px; background: var(--line); transition: background var(--dur-base) var(--ease-out); }
.pw-meter[data-level="1"] i:nth-child(-n+1) { background: var(--block); }
.pw-meter[data-level="2"] i:nth-child(-n+2) { background: var(--escalate); }
.pw-meter[data-level="3"] i:nth-child(-n+3) { background: var(--allow); }
.pw-meter[data-level="4"] i { background: var(--allow); }
.pw-meter-label { margin-top: 0.35rem; font-size: 0.75rem; color: var(--fg-3); }

/* banner: soft fade instead of shake */
.auth-card .form-banner { display: block; max-height: 0; margin: 0; padding: 0 0.75rem; overflow: hidden; opacity: 0; border-width: 0; font-size: 0.8125rem; line-height: 1.5; transition: opacity var(--dur-slow) var(--ease-out), max-height var(--dur-slow) var(--ease-out), margin var(--dur-slow) var(--ease-out), padding var(--dur-slow) var(--ease-out); }
.auth-card .form-banner.show { max-height: 9rem; margin-bottom: 0.9rem; padding: 0.625rem 0.75rem; opacity: 1; border-width: 1px; }
.auth-card .form-banner.ok { color: var(--allow); background: var(--allow-bg); border-color: var(--allow); }
.auth-card .form-banner.warn { color: var(--escalate); background: var(--escalate-bg); border-color: var(--escalate); }

/* button loading */
.auth-card .btn-block { margin-top: 0.5rem; }
.btn.is-loading { pointer-events: none; }
.btn.is-loading::before { content: ""; width: 0.875rem; height: 0.875rem; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: auth-spin 0.7s linear infinite; }
.btn-primary.is-loading:disabled { opacity: 0.8; }
@keyframes auth-spin { to { transform: rotate(360deg); } }

/* result states (success / invalid / expired) */
.auth-state { text-align: center; }
.auth-state .auth-state-icon { display: grid; place-items: center; width: 3rem; height: 3rem; margin: 0 auto 1rem; border-radius: 50%; border: 1px solid var(--line-strong); color: var(--fg); }
.auth-state.is-bad .auth-state-icon { color: var(--block); border-color: var(--block); background: var(--block-bg); }
.auth-state.is-ok .auth-state-icon { color: var(--allow); border-color: var(--allow); background: var(--allow-bg); }
.auth-state p { font-size: 0.9375rem; color: var(--fg-2); line-height: 1.6; margin: 0 0 1.5rem; }
.auth-state h1 { margin-bottom: 0.5rem; }
.auth-state .btn { width: 100%; }
.invite-for { margin: 0 0 1.25rem; padding: 0.6rem 0.9rem; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-sm); font-family: var(--font-mono); font-size: 0.8125rem; color: var(--fg-2); word-break: break-all; text-align: center; }
.invite-loading { text-align: center; padding: 1rem 0; color: var(--fg-3); font-size: 0.875rem; }
.otp-sent-msg { text-align: center; font-size: 0.875rem; color: var(--fg-2); margin: 0 0 1.25rem; }
.resend-btn { background: none; border: 0; color: var(--fg-3); font-size: 0.8125rem; cursor: pointer; font-family: var(--font-sans); }
.resend-btn:hover { color: var(--fg); text-decoration: underline; }
.fade-in { animation: auth-rise var(--dur-slow) var(--ease-out) both; }

/* brand panel — the landing's B/W fog photo, static (auth is app layer:
   no parallax, no looping motion). Dark photo => white text, AA on the scrim. */
.auth-aside {
  display: none; position: relative; overflow: hidden; flex-direction: column; justify-content: flex-end; padding: 3rem;
  color: #fff; background: #111 url(/static/assets/photos/fog-forest.jpg) 50% 70% / cover no-repeat;
}
.auth-aside::before { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,.05) 0%, rgba(0,0,0,.35) 45%, rgba(0,0,0,.82) 100%); }
.auth-aside > * { position: relative; }
.auth-aside h2 { font-family: var(--font-display); font-size: 2rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; text-wrap: balance; margin: 0 0 1.25rem; color: #fff; }
.auth-aside ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.6rem; font-size: 0.875rem; color: rgba(255,255,255,.86); }
.auth-aside li { display: flex; gap: 0.6rem; align-items: baseline; }
.auth-aside li::before { content: ""; flex: none; width: 0.4rem; height: 0.4rem; background: #fff; transform: translateY(-1px); }
@media (min-width: 960px) { .auth-shell { grid-template-columns: minmax(0, 1fr) 26rem; } .auth-aside { display: flex; } }
@media (min-width: 1280px) { .auth-shell { grid-template-columns: minmax(0, 1fr) 32rem; } }
@media (max-width: 480px) { .auth-card { padding: 1.5rem 1.25rem; } .auth-main { padding-top: 4.5rem; } }
/* login — split layout. Left: card on a faded dot grid (fills the empty
   field without adding colour). Right: a static "what the gate sees" feed,
   the product's own artefact instead of a photo. Auth stays app layer:
   one-shot stagger on load, no looping motion. */
.auth-shell--login { background: var(--bg); }
.auth-shell--login .auth-main {
  position: relative;
  background-image: radial-gradient(var(--line-strong) 1px, transparent 1px);
  background-size: 20px 20px;
  -webkit-mask-image: none; mask-image: none;
}
.auth-shell--login .auth-main::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse 60% 55% at 50% 50%, var(--bg) 35%, transparent 100%);
}
.auth-shell--login .auth-main > * { position: relative; }
.auth-shell--login .auth-card { background: var(--bg); box-shadow: 0 1px 2px rgba(0,0,0,.04), 0 12px 32px -16px rgba(0,0,0,.12); }
.auth-shell--login .auth-field .form-input { background: var(--surface); }
.auth-shell--login .auth-field .form-input:focus { background: var(--bg); }

.auth-aside--feed {
  background: var(--surface); color: var(--fg); border-left: 1px solid var(--line);
  justify-content: space-between; gap: 2.5rem; padding: 3rem;
}
.auth-aside--feed::before { content: none; }
.auth-aside--feed h2 { color: var(--fg); font-size: 1.75rem; margin-bottom: 1rem; }
.auth-aside--feed ul { color: var(--fg-2); }
.auth-aside--feed li::before { background: var(--fg); }
.gate-feed { display: flex; flex-direction: column; gap: 0.75rem; margin: auto 0; }
.gate-feed-head { display: flex; align-items: center; justify-content: space-between; font-size: 0.75rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--fg-2); }
.gate-feed-head .gate-feed-live { display: inline-flex; align-items: center; gap: 0.5rem; }
.gate-feed-head .gate-feed-live::before { content: ""; width: 0.4rem; height: 0.4rem; border-radius: 50%; background: var(--allow); }
.gate-feed-list { list-style: none; margin: 0; padding: 0; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: block; }
.auth-aside--feed .gate-feed-list li { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.75rem 1rem; border-top: 1px solid var(--line); animation: auth-rise var(--dur-slow) var(--ease-out) both; animation-delay: calc(var(--i, 0) * 60ms + 200ms); }
.auth-aside--feed .gate-feed-list li:first-child { border-top: 0; }
.auth-aside--feed .gate-feed-list li::before { content: none; }
.gate-feed-call { min-width: 0; display: grid; gap: 0.125rem; }
.gate-feed-tool { font-family: var(--font-mono); font-size: 0.8125rem; font-weight: 500; color: var(--fg); }
.gate-feed-arg { font-family: var(--font-mono); font-size: 0.75rem; color: var(--fg-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gate-feed-meta { flex: none; display: flex; align-items: center; gap: 0.625rem; }
.gate-feed-ms { font-family: var(--font-mono); font-size: 0.75rem; color: var(--fg-3); font-variant-numeric: tabular-nums; }
@media (min-width: 960px) { .auth-shell--login { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
@media (min-width: 1280px) { .auth-shell--login { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }

/* user switch (html.motion-off); the OS setting is not consulted */
html.motion-off .auth-aside--feed .gate-feed-list li { animation: none; }
html.motion-off .auth-card,html.motion-off .fade-in, html.motion-off .btn.is-loading::before { animation: none; }
html.motion-off .auth-card .form-banner, html.motion-off .auth-field .form-input, html.motion-off .pw-meter-bars i { transition: none; }


/* --- landing nav --------------------------------------------------------- */
.landing-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 1.25rem 1.5rem;
}
.landing-nav .nav-brand { color: var(--fg); font-size: 0.9375rem; }
.landing-nav .nav-brand .icon { color: var(--fg); }
.landing-nav-links {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
  font-size: 0.875rem;
}
/* :not(.btn) matters — a bare `.landing-nav-links a` rule outranks
   `.btn-primary` on specificity and would repaint the CTA's label. */
.landing-nav-links a:not(.btn) { color: var(--fg-2); }
.landing-nav-links a:not(.btn):hover { color: var(--fg-hover); }
.landing-nav-links .btn { padding: 0.55rem 1.15rem; font-size: 0.875rem; }
@media (max-width: 620px) {
  .landing-nav { justify-content: center; }
  .landing-nav-links { gap: 1rem; justify-content: center; }
}

/* --- user menu ----------------------------------------------------------- */
.user-menu { position: relative; display: inline-flex; align-items: center; margin-left: 0.5rem; }
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--fg);
  background: var(--surface-2);
  color: var(--fg);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  padding: 0;
}
.avatar:hover { border-color: var(--fg-hover); }
.user-dropdown {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 0.6rem);
  z-index: 40;
  min-width: 200px;
  padding: 0.6rem;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-pop);
}
.user-dropdown.open { display: block; }
.user-dropdown .who {
  padding: 0.4rem 0.55rem 0.65rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 0.5rem;
}
.user-dropdown .who strong { display: block; font-size: 0.875rem; font-weight: 600; }
.user-dropdown .who span { font-size: 0.75rem; color: var(--fg-2); word-break: break-all; }
.user-dropdown button,
.user-dropdown a {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.45rem 0.55rem;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--fg-2);
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  cursor: pointer;
}
.user-dropdown button:hover,
.user-dropdown a:hover { background: var(--surface-2); color: var(--fg); }

/* --- modal --------------------------------------------------------------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: rgba(0, 0, 0, 0.45);
  /* Always display:flex (not none) so opacity can transition — display
     can't animate, and jumping straight to/from none made the backdrop snap
     in instantly instead of fading with the card. visibility rides along so
     it's non-interactive and out of the tab order while closed. */
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--dur-base) var(--ease-out), visibility 0s linear var(--dur-base);
}
.modal-overlay.open {
  opacity: 1;
  visibility: visible;
  transition: opacity var(--dur-base) var(--ease-out);
}
.modal {
  width: 100%;
  max-width: 520px;
  max-height: 88vh;
  overflow-y: auto;
  padding: 1.85rem;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-modal);
}
/* .modal itself never toggles display — only the .modal-overlay ancestor
   does (via .open) — so the animation has to key off that ancestor class
   rather than live unconditionally on .modal. animation-name going from
   unset to modalPopIn each time .open is added is what makes it replay on
   every open instead of only once on page load. */
.modal-overlay.open .modal {
  animation: modalPopIn var(--dur-slow) var(--ease-out);
}
@keyframes modalPopIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}
.modal h2 { font-size: 1.125rem; margin-bottom: 0.4rem; }
.modal .modal-sub { color: var(--fg-2); font-size: 0.875rem; margin-bottom: 1.5rem; }
.modal-actions { display: flex; gap: 0.7rem; justify-content: flex-end; margin-top: 1.5rem; }
.modal-actions .btn { padding: 0.65rem 1.35rem; font-size: 0.875rem; }

/* --- code blocks + copy -------------------------------------------------- */
.code-block { position: relative; margin: 0.85rem 0; }
.code-block pre {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 1rem 3.25rem 1rem 1rem;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  line-height: 1.7;
  color: var(--fg);
  white-space: pre;
}
.copy-btn {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.3rem 0.6rem;
  border-radius: var(--radius);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--fg-2);
  font-family: var(--font-sans);
  font-size: 0.6875rem;
  cursor: pointer;
}
.copy-btn:hover { border-color: var(--fg); color: var(--fg); }
.copy-btn.copied { border-color: var(--allow); color: var(--allow); }

/* --- copy button states, copy row, danger buttons (shared: agents, settings) */
.copy-btn .ic-done { display: none; }
.copy-btn.copied .ic-copy { display: none; }
.copy-btn.copied .ic-done { display: inline; }
.copy-btn.copied { animation: copyPop var(--dur-base) var(--ease-out); }
@keyframes copyPop { 0% { transform: scale(0.94); } 60% { transform: scale(1.04); } 100% { transform: none; } }
.copy-btn svg { width: 12px; height: 12px; }
.copy-row .copy-btn { position: static; flex-shrink: 0; min-width: 5.25rem; justify-content: center; }
.copy-row .copy-val { flex: 1; min-width: 0; font-family: var(--font-mono); font-size: 0.8125rem; color: var(--fg); word-break: break-all; white-space: pre-wrap; }
.btn-ghost-danger { background: transparent; color: var(--fg-2); }
.btn-ghost-danger:hover { background: var(--block-bg); color: var(--block); }
.btn-confirm-danger { background: var(--block); border-color: var(--block); color: var(--on-fg); }
.btn-confirm-danger:hover { background: var(--block-strong); border-color: var(--block-strong); color: var(--on-fg); }
.btn-confirm-danger:disabled { background: var(--block); }

/* --- step guide ---------------------------------------------------------- */
.guide-step {
  display: flex;
  gap: 1.15rem;
  align-items: flex-start;
  padding: 1.75rem 0;
  border-top: 1px solid var(--line);
}
.guide-step:first-of-type { border-top: 0; padding-top: 0.5rem; }
.guide-step > .body { flex: 1; min-width: 0; }
.guide-step h2 { font-size: 1.0625rem; font-weight: 600; margin-bottom: 0.35rem; }
.guide-step p { color: var(--fg-2); font-size: 0.9375rem; }
.step-num-badge {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--fg);
  color: var(--on-fg);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 600;
}

/* --- key rows ------------------------------------------------------------ */
.key-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 0.85rem 1.1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
}
.key-row .key-prefix {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--fg);
}
.key-row .key-label { color: var(--fg); font-weight: 500; }
.key-row .key-dates { margin-left: auto; display: flex; gap: 1.15rem; color: var(--fg-3); font-size: 0.75rem; flex-wrap: wrap; }
@media (max-width: 720px) {
  /* Same fix as .evt-meta's own 720px override above: margin-left: auto
     only makes sense while everything fits on one line. Once a long label
     wraps .key-dates onto its own line, the auto margin still applies
     within that line and shoves it to the right, leaving a lopsided empty
     gap on the left instead of a clean, flush-left stacked row. */
  .key-row .key-dates { margin-left: 0; width: 100%; }
}
.btn-danger {
  background: transparent;
  border-color: var(--block);
  color: var(--block);
}
.btn-danger:hover { background: var(--block-bg); color: var(--block); }

/* A key shown once, at creation. */
.secret-reveal {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  background: var(--bg);
  border: 1px solid var(--fg);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  word-break: break-all;
}
.warn-note {
  margin-top: 0.85rem;
  padding: 0.7rem 0.9rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: var(--escalate-bg);
  color: var(--fg-2);
  font-size: 0.8125rem;
}

/* --- misc ---------------------------------------------------------------- */
.section-card {
  padding: 1.75rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.stack { display: flex; flex-direction: column; gap: 0.75rem; }
.row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

/* --- language toggle ----------------------------------------------------- */
.lang-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0;
  padding: 0;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--fg-3);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  cursor: pointer;
  height: 38px;
  padding: 0 0.7rem;
}
.lang-toggle:hover { border-color: var(--fg); color: var(--fg); }
.lang-active { color: var(--fg); font-weight: 600; }

/* --- animated dropdown (select.js) ------------------------------------------
   Every <select> is enhanced into this. The trigger button borrows the
   select's own classes (.field / .input), so sizing stays per-page; the menu is
   one shared look: white surface, hairline border, --shadow-pop, selected row
   inverted to neutral. Chevron flips on open; menu expands from the trigger. */
.dd { position: relative; display: inline-block; max-width: 100%; vertical-align: middle; }
.dd:has(> .dd-btn.input), .dd:has(> .dd-btn.form-input) { display: block; }
.dd .dd-native {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: 0; border: 0;
  opacity: 0; pointer-events: none; overflow: hidden; clip-path: inset(50%);
}
.dd-btn {
  display: inline-flex; align-items: center; justify-content: space-between; gap: 0.5rem;
  width: 100%; text-align: left; cursor: pointer;
  font-family: var(--font-sans); font-size: 0.8125rem; font-weight: 500; line-height: 1.3;
  padding: 0.45rem 0.65rem 0.45rem 0.75rem;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--bg); color: var(--fg);
}
.dd-btn.input, .dd-btn.form-input { font-size: 0.9375rem; font-weight: 400; padding: 0.7rem 0.75rem 0.7rem 0.9rem; border-radius: var(--radius); }
.dd-btn:hover:not(:disabled) { background: var(--surface-2); }
.dd-btn:focus-visible, .dd-btn[aria-expanded="true"] { outline: none; border-color: var(--fg); box-shadow: 0 0 0 2px var(--ring); }
.dd-btn:disabled { opacity: 0.6; cursor: not-allowed; }
.dd-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dd-chev { flex: none; width: 15px; height: 15px; color: var(--fg-3); transition: transform var(--dur-base) var(--ease-out); }
.dd.is-open .dd-chev { transform: rotate(180deg); color: var(--fg); }

.dd-menu {
  display: none; position: absolute; z-index: 60; top: calc(100% + 4px); left: 0;
  min-width: 100%; width: max-content; max-width: min(24rem, 90vw); max-height: 260px; overflow-y: auto;
  margin: 0; padding: 4px; list-style: none;
  background: var(--bg); border: 1px solid var(--line-strong); border-radius: var(--radius);
  box-shadow: var(--shadow-pop);
  opacity: 0; transform: translateY(-4px); clip-path: inset(0 0 100% 0 round var(--radius));
  transform-origin: top; pointer-events: none;
  transition: opacity var(--dur-fast) var(--ease-out), transform var(--dur-base) var(--ease-out), clip-path var(--dur-base) var(--ease-out);
}
.dd.dd-up .dd-menu { top: auto; bottom: calc(100% + 4px); transform: translateY(4px); transform-origin: bottom; clip-path: inset(100% 0 0 0 round var(--radius)); }
.dd-menu.is-open { opacity: 1; transform: none; clip-path: inset(0 round var(--radius)); pointer-events: auto; }
.dd-opt {
  padding: 0.45rem 0.6rem; border-radius: var(--radius-sm); cursor: pointer;
  font-size: 0.8125rem; color: var(--fg-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.dd-opt + .dd-opt { margin-top: 2px; }
.dd-opt.is-active { background: var(--surface-2); color: var(--fg); }
.dd-opt[aria-selected="true"] { background: var(--fg); color: var(--on-fg); font-weight: 500; }
.dd-opt[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; }

/* EN / TR segmented switch (wired by i18n.js via [data-set-lang]).
   Selected = inverted neutral, never a status colour. */
.lang-switch { display: inline-flex; padding: 2px; gap: 2px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--bg); }
.lang-switch button {
  min-width: 34px; min-height: 30px; padding: 0 .5rem; border: 0; border-radius: var(--radius-sm);
  background: transparent; color: var(--fg-2);
  font: 600 .75rem/1 var(--font-sans); letter-spacing: .08em; cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.lang-switch button:hover { color: var(--fg); background: var(--surface-2); }
.lang-switch button[aria-pressed="true"] { background: var(--fg); color: var(--on-fg); }
.lang-switch button:focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; }

/* Footer tools: animation switch next to the EN/TR switch (wired by i18n.js). */
.foot-tools { display: inline-flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.motion-toggle {
  min-height: 34px; padding: 0 0.75rem; border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: var(--bg); color: var(--fg-2); font: 500 0.8125rem var(--font-sans); cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.motion-toggle:hover { background: var(--surface-2); color: var(--fg); }
.motion-toggle:focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; }

/* Animations off: reveal targets are simply there, with no transition to wait for. */
html.motion-off [data-reveal] { opacity: 1 !important; transform: none !important; transition: none !important; }
