/*
 * Site-wide design tokens — decoded from transvision.us's real compiled
 * CSS (a Tailwind/Material Design 3 build), not guessed. See plan §4:
 * /home/avivods/.claude/plans/cheeky-questing-gizmo.md
 *
 * Material Design 3 role names kept as the variable names (--tv-primary,
 * --tv-on-primary, --tv-surface-container, ...) so anyone cross-checking
 * against the source site's own --tv-* custom properties can match them
 * 1:1. Light theme only — transvision.us has no dark variant.
 */
:root {
  --tv-primary: #001f2b;
  /* Separate from --tv-primary (2026-07-20) — the header needs its OWN
     dark-mode value (a much deeper near-black navy) so it "suits" a
     genuinely dark page, while --tv-primary itself stays #001f2b
     everywhere it's used for other things (buttons, emphasis text). */
  --tv-header-bg: var(--tv-primary);
  --tv-primary-container: #023547;
  --tv-on-primary: #ffffff;
  --tv-on-primary-container: #a3cce3;
  --tv-primary-fixed: #c0e8ff;
  --tv-primary-fixed-dim: #a3cce3;

  --tv-secondary: #00696b;
  --tv-secondary-container: #93f2f4;
  --tv-on-secondary: #ffffff;
  --tv-on-secondary-container: #004f51;
  --tv-secondary-fixed-dim: #76d6d7;

  --tv-tertiary: #071e2b;
  --tv-tertiary-container: #1e3340;
  --tv-tertiary-fixed: #cfe5f7;

  --tv-accent: #00c2c4;
  --tv-accent-bright: #8be7ea;

  --tv-background: #fafaf4;
  --tv-surface: #fafaf4;
  --tv-surface-container-lowest: #ffffff;
  --tv-surface-container-low: #f4f4ee;
  --tv-surface-container: #eeeee8;
  --tv-surface-container-high: #e8e8e3;
  --tv-surface-container-highest: #e3e3dd;
  --tv-surface-variant: #e3e3dd;
  --tv-surface-dim: #dadad5;

  --tv-on-background: #1a1c19;
  --tv-on-surface: #1a1c19;
  --tv-on-surface-variant: #41484c;

  --tv-outline: #71787c;
  --tv-outline-variant: #c1c7cc;

  --tv-error: #ba1a1a;
  --tv-error-container: #ffdad6;
  --tv-on-error: #ffffff;
  --tv-on-error-container: #93000a;

  --tv-success: #146c2e;
  --tv-success-container: #d7f0dc;
  --tv-warning: #8a5300;

  --tv-font-display: "Manrope", "Inter", ui-sans-serif, system-ui, sans-serif;
  --tv-font-body: "Inter", ui-sans-serif, system-ui, sans-serif;
  --tv-font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  /* Soft, layered, navy-tinted shadows — the "elevated card" look real
     transvision.us uses, not the current app's harsh dark shadows. */
  --tv-shadow-sm: 0 12px 24px -18px rgba(0, 31, 43, 0.28);
  --tv-shadow-md: 0 14px 30px -18px rgba(0, 31, 43, 0.32), inset 0 1px rgba(255, 255, 255, 0.6);
  --tv-shadow-lg: 0 22px 48px -14px rgba(0, 31, 43, 0.22), 0 46px 100px -38px rgba(0, 31, 43, 0.38);

  --tv-radius-sm: 8px;
  --tv-radius-md: 14px;
  --tv-radius-lg: 20px;
}

/* Dark mode (2026-07-20, per direct instruction: "dark mode should also
   adapt it correctly") — theme.css previously had NO dark variant at
   all ("Light theme only" above was true when this was written, before
   the investigation screen grew a light/dark toggle). Components
   defined here in theme.css but ALSO used on the investigation screen
   — the profile dropdown is the concrete case — were reading these
   permanently-light tokens even when data-theme="dark" was active,
   so the dropdown popped up as a light card against a dark page.
   Mirrors the same dark palette dashboard.css's own :root[data-
   theme="dark"] block uses, so a component styled from either file
   reads as one consistent dark theme. */
:root[data-theme="dark"] {
  /* 2026-07-22 bugfix — --tv-primary/--tv-on-primary/--tv-primary-container
     had NO dark override at all (every other role token in this block
     does). --tv-primary (#001f2b, near-black navy) is what
     .tv-btn-primary's background, .tv-auth-brand's text color, and
     dashboard.css's --accent2 (12 call sites: log-entry.info, headline/
     CTA text, progress-bar gradients, etc.) all read directly — against
     a dark page (--tv-background #0a0d10 below), near-black-on-near-
     black is ~1:1 contrast, i.e. invisible. This is what made a fresh
     login (brand heading + submit button) and primary buttons/headline
     text throughout the rest of the app "lose visibility" in dark mode.
     Values below flip the pairing MD3-style (primary lightens, on-primary
     darkens in a dark scheme) by reusing the light theme's own already-
     defined --tv-primary-fixed-dim/-container tones rather than
     inventing new colors, so buttons/text/hover states all stay
     internally consistent and readable in both directions. */
  --tv-primary: #a3cce3;
  --tv-on-primary: #001f2b;
  --tv-primary-container: #7ba8c4;
  /* --tv-secondary (#00696b) is what every sitewide link (`a`), the nav
     underline, and dashboard.css's --accent (spinners, running-state
     badges, progress bars, log highlights) use — also unreadably dim
     against a dark page (~2.9:1, fails WCAG AA body-text contrast).
     Reuses the already-defined --tv-secondary-fixed-dim tone. */
  --tv-secondary: #76d6d7;
  /* Darker than the surface-container-* tones below on purpose
     (2026-07-20, per direct instruction: "make it darker than the grey
     on the cards") — matches dashboard.css's own --bg override. */
  --tv-background: #0a0d10;
  --tv-surface: #0a0d10;
  /* Deep near-black navy (2026-07-20, per direct instruction: "dark mode
     the header not suited") — the light theme's vivid #001f2b read as
     too bright/blue against a genuinely dark page; this keeps the same
     hue family (still recognizably navy, not neutral grey) but pulled
     much darker so it belongs with the rest of the dark palette instead
     of popping as a lighter patch. */
  --tv-header-bg: #050a0e;
  --tv-surface-container-lowest: #1c242c;
  --tv-surface-container-low: #161d23;
  --tv-surface-container: #232c35;
  --tv-surface-container-high: #29323c;
  --tv-surface-container-highest: #303a44;
  --tv-surface-variant: #232c35;
  --tv-surface-dim: #0d1215;

  --tv-on-background: #eef1f3;
  --tv-on-surface: #eef1f3;
  --tv-on-surface-variant: #9aa7b0;

  --tv-outline: #5a6670;
  --tv-outline-variant: #2b343d;

  --tv-secondary-container: #1c3634;
  --tv-on-secondary-container: #6fe0df;

  --tv-error-container: #4a1414;
  --tv-on-error-container: #ffb4a9;

  --tv-success: #4fcf82;
  --tv-success-container: #16351f;
  --tv-warning: #ffc266;

  --tv-shadow-sm: 0 12px 24px -18px rgba(0, 0, 0, 0.55);
  --tv-shadow-md: 0 14px 30px -18px rgba(0, 0, 0, 0.6), inset 0 1px rgba(255, 255, 255, 0.04);
  --tv-shadow-lg: 0 22px 48px -14px rgba(0, 0, 0, 0.5), 0 46px 100px -38px rgba(0, 0, 0, 0.65);
}

:root {
  /* Spacing scale (2026-07-20, "spacious modern SaaS" redesign, per
     direct instruction/choice) — every gap/padding in the redesigned
     screens should trace back to one of these rather than a one-off
     number, so the whole app reads as deliberately spaced rather than
     patched panel-by-panel. */
  --tv-space-1: 4px;
  --tv-space-2: 8px;
  --tv-space-3: 12px;
  --tv-space-4: 16px;
  --tv-space-5: 24px;
  --tv-space-6: 32px;
  --tv-space-7: 48px;
}

/* Material Symbols (2026-07-20) — the same icon font transvision.us
   itself loads. Icon-per-concept (module type, status, nav item) is one
   of the biggest single things separating a "designed app" from a
   text-and-color dashboard. */
.material-symbols-outlined {
  font-family: 'Material Symbols Outlined';
  font-weight: normal;
  font-style: normal;
  font-size: 20px;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  -webkit-font-smoothing: antialiased;
  font-variation-settings: 'FILL' 0, 'wght' 500, 'GRAD' 0, 'opsz' 24;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  font-family: var(--tv-font-body);
  background: var(--tv-background);
  color: var(--tv-on-surface);
  min-height: 100vh;
}

h1, h2, h3, h4, h5, h6 { font-family: var(--tv-font-display); font-weight: 700; }

a { color: var(--tv-secondary); }

/* ── Site shell (nav) ──
   Dark navy header / light body (2026-07-20, per direct instruction —
   "#001f2b for the header, all", "more advanced kind of application"):
   this is the same "rich dark chrome, light content" pattern used by
   Linear/Vercel/Stripe-style dashboards, and reads as a big step up from
   a flat white bar. Text/link colors below are white/translucent-white
   overrides specifically for this dark surface — the rest of the app
   stays on the light --tv-on-surface-variant etc. tokens. */
/* 2026-07-20: flat 2-stop navy read as plain/one-note — layered two soft
   glow spots (echoing the brand mark's cyan) over a richer 3-stop
   gradient, plus a thin gradient accent line along the bottom edge, so
   the header has some visual depth instead of being a solid color bar. */
/* Minimal solid navy (2026-07-20, per direct instruction — chose this
   over the earlier layered-glow gradient version, which "wasn't
   catchy"): flat fill, no radial glow spots, just one static 2px teal
   line along the bottom edge. Confident and quiet rather than busy.
   background: var(--tv-header-bg), not --tv-primary directly — #001f2b
   read as too light/blue once the rest of the page actually went dark
   (per direct instruction: "dark mode the header not suited"), so the
   header now gets its own darker value in dark mode via that token
   while staying #001f2b in light mode. */
.tv-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
  background: var(--tv-header-bg);
  box-shadow: 0 1px 0 rgba(255,255,255,0.06) inset, 0 4px 20px -8px rgba(0,31,43,0.45);
  position: relative;
  z-index: 10;
}
.tv-nav::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 2px;
  background: var(--tv-secondary);
}
.tv-nav-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--tv-font-display);
  font-weight: 800;
  font-size: 17px;
  color: #ffffff;
  letter-spacing: 0.01em;
  text-decoration: none;
}
/* Geometry only — no color here (2026-07-23 bugfix: used to hardcode
   #ffffff, written back when this was only ever used on the navy nav;
   every usage site already sets its own `color` on the wrapping element
   (.tv-nav-brand, .logo, .agent-badge, .tv-auth-brand) and the SVG's own
   stroke="currentColor" is what's supposed to pick that up — the
   hardcoded white here was silently overriding all of them, which is
   how .tv-auth-brand's icon ended up invisible: white-on-white against
   the light-mode card). */
.tv-brand-mark {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}
.tv-nav-right {
  display: flex;
  align-items: center;
  gap: 14px;
}
.tv-nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
}
/* Same look as the investigation screen's own copy of this button
   (investigations/static/investigations/dashboard.css's .theme-toggle-btn)
   — duplicated here rather than shared since dashboard.css isn't loaded
   on this nav's pages (login, history, user management). Fixed light-on-
   dark rather than themed, same reasoning as that copy: this nav stays
   navy regardless of theme. */
.theme-toggle-btn {
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.24);
  border-radius: 50%;
  color: #fff;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
}
.theme-toggle-btn:hover { background: rgba(255,255,255,0.22); }
/* Card-anchored use (2026-07-23 — replaces an earlier position:fixed
   viewport-corner version that sat alone with nothing else on the page
   to anchor it to, reading as bolted-on rather than designed). Sits
   inline in .tv-auth-head next to the brand instead, so theme-aware
   colors from the SURFACE below it (not the page background) are what
   need to contrast here. */
.theme-toggle-inline {
  flex-shrink: 0;
  background: var(--tv-surface-container-low);
  border: 1px solid var(--tv-outline-variant);
  color: var(--tv-on-surface-variant);
}
.theme-toggle-inline:hover { background: var(--tv-surface-container-high); color: var(--tv-on-surface); }
.tv-nav-links a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: rgba(255,255,255,0.62);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  padding: 7px 16px;
  border-radius: 999px;
  transition: background 0.15s ease, color 0.15s ease;
}
.tv-nav-links a .material-symbols-outlined { font-size: 18px; }
.tv-nav-links a:hover { color: #ffffff; background: rgba(255,255,255,0.08); }
.tv-nav-links a.active { color: #ffffff; background: rgba(255,255,255,0.16); }
/* Initials avatar — small but reads as a real app's account chip rather
   than plain text next to a logout button. */
.tv-nav-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(255,255,255,0.14);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0;
  flex-shrink: 0;
}

/* Profile dropdown (2026-07-20, per direct instruction — "modern UI
   should have profile option in the header") — plain <details>/
   <summary> gives free open/close with no JS beyond the one outside-
   click-closes listener in base.html. */
.tv-profile-menu { position: relative; }
.tv-profile-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: rgba(255,255,255,0.85);
  cursor: pointer;
  list-style: none;
  padding: 5px 10px 5px 5px;
  border-radius: 999px;
  transition: background 0.15s ease;
}
.tv-profile-trigger::-webkit-details-marker { display: none; }
.tv-profile-trigger:hover { background: rgba(255,255,255,0.1); }
.tv-profile-trigger .material-symbols-outlined { font-size: 18px; color: rgba(255,255,255,0.55); }
.tv-profile-menu[open] .tv-profile-trigger .material-symbols-outlined { transform: rotate(180deg); }
.tv-profile-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 210px;
  background: var(--tv-surface-container-lowest);
  border-radius: var(--tv-radius-md);
  box-shadow: var(--tv-shadow-lg);
  padding: var(--tv-space-2);
  z-index: 50;
}
.tv-profile-dropdown-header {
  padding: var(--tv-space-3) var(--tv-space-3) var(--tv-space-2);
  border-bottom: 1px solid var(--tv-outline-variant);
  margin-bottom: var(--tv-space-2);
}
.tv-profile-dropdown-name { font-weight: 700; font-size: 14px; color: var(--tv-on-surface); }
.tv-profile-dropdown-role { font-size: 12px; color: var(--tv-on-surface-variant); margin-top: 1px; }
.tv-profile-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  border-radius: var(--tv-radius-sm);
  font-family: var(--tv-font-body);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--tv-on-surface);
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  text-decoration: none;
}
.tv-profile-dropdown-item:hover { background: var(--tv-surface-container-low); }
.tv-profile-dropdown-item .material-symbols-outlined { font-size: 18px; color: var(--tv-on-surface-variant); }
.tv-profile-dropdown form { display: block; }
.tv-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: 999px;
  border: none;
  font-family: var(--tv-font-body);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease, opacity 0.15s ease, box-shadow 0.15s ease;
}
.tv-btn-primary { background: var(--tv-primary); color: var(--tv-on-primary); box-shadow: var(--tv-shadow-sm); }
.tv-btn-primary:hover { background: var(--tv-primary-container); }
.tv-btn-ghost { background: rgba(255,255,255,0.06); color: rgba(255,255,255,0.85); border: 1px solid rgba(255,255,255,0.22); }
.tv-btn-ghost:hover { background: rgba(255,255,255,0.14); }

.tv-page {
  max-width: 1240px;
  margin: 0 auto;
  padding: var(--tv-space-7) var(--tv-space-6) 72px;
}

.tv-card {
  background: var(--tv-surface-container-lowest);
  border-radius: var(--tv-radius-lg);
  border: none;
  box-shadow: var(--tv-shadow-sm);
  padding: var(--tv-space-6);
}

.tv-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.tv-badge .material-symbols-outlined { font-size: 14px; }
.tv-badge-running { background: var(--tv-secondary-container); color: var(--tv-on-secondary-container); }
.tv-badge-completed { background: var(--tv-success-container); color: var(--tv-success); }
.tv-badge-failed { background: var(--tv-error-container); color: var(--tv-on-error-container); }

/* ── Auth ── */
.tv-auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 20% 20%, rgba(0, 194, 196, 0.08), transparent 45%),
              radial-gradient(circle at 80% 80%, rgba(0, 105, 107, 0.08), transparent 45%),
              var(--tv-background);
}
.tv-auth-card {
  width: 380px;
  background: var(--tv-surface-container-lowest);
  border-radius: var(--tv-radius-lg);
  box-shadow: var(--tv-shadow-lg);
  padding: 40px 36px;
}
.tv-auth-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
}
.tv-auth-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--tv-font-display);
  font-weight: 800;
  font-size: 22px;
  color: var(--tv-primary);
}
.tv-auth-brand .tv-brand-mark { width: 19px; height: 19px; }
.tv-auth-sub { color: var(--tv-on-surface-variant); font-size: 13px; margin-bottom: 28px; }
.tv-field { margin-bottom: 18px; }
.tv-field label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--tv-on-surface-variant);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}
.tv-field input {
  width: 100%;
  padding: 11px 13px;
  border-radius: var(--tv-radius-sm);
  border: 1px solid var(--tv-outline-variant);
  background: var(--tv-surface-container-low);
  color: var(--tv-on-surface);
  font-family: var(--tv-font-body);
  font-size: 14px;
}
.tv-field input:focus {
  outline: none;
  border-color: var(--tv-secondary);
  box-shadow: 0 0 0 3px rgba(0, 105, 107, 0.15);
}
.tv-auth-error {
  background: var(--tv-error-container);
  color: var(--tv-on-error-container);
  border-radius: var(--tv-radius-sm);
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 18px;
}
.tv-auth-submit { width: 100%; justify-content: center; padding: 12px; font-size: 15px; }
