/*
 * Finance Workspace — embedded module styles.
 *
 * This module renders INSIDE the Building OS shell (Module Federation),
 * which already supplies the app chrome (sidebar, header, page padding).
 * Surfaces, tabs, tables, badges, KPI tiles, banners and empty states come
 * from @tv/ui (which imports its own @tv/design-tokens stylesheet), so what
 * is left here is layout only:
 *   1. Content-only  — no global body/:root/html resets, no own sidebar.
 *   2. Scoped        — every rule lives under `.fw-root` so nothing
 *                      leaks into the host or sibling remotes.
 *   3. Token-driven  — the few colours set here are design-token slots
 *                      (`hsl(var(--…))`), never literals.
 *
 * Do not restyle a @tv/ui component's padding, background or border from
 * here: the `.tv-*` layer is unlayered and wins over anything set on the
 * component's own class. Style the layout around it instead.
 */

/* The .tv-* component layer the @tv/ui components render into. @tv/ui's
   JavaScript does not import a stylesheet, and the shell's copy may be a
   different design-tokens release, so the remote bundles its own — the
   same three imports every sibling module carries. tokens.css also defines
   the `--background` / `--foreground` / ... slots used below, so the module
   renders standalone without hard-coded fallbacks. */

/*
 * Tango Vision Design Tokens — v2
 * Single source of truth for all platform colors, spacing, typography.
 *
 * Brand: AI-native building management OS — digital twins for malls,
 * offices, campuses. Dark-first product. Orange (#F8A324) on deep
 * purple (#5B407F). Montserrat for display/UI, Open Sans Light for
 * long-form body. The wordmark is TANGO.VISION with 0.10em tracking.
 *
 * THREE layers of tokens live here:
 *  1) Brand ramp           --tv-*        (hex; constant across themes)
 *  2) shadcn semantic slots --primary, --background, --border, …
 *     as HSL channels (no hsl() wrapper) consumed via hsl(var(--…)).
 *     These drive every @tv/ui React component and the Tailwind preset.
 *  3) v2 semantic tokens   --bg, --fg, --accent-hover, --hairline,
 *     surface tints, status pairs, focus ring — DIRECT values consumed
 *     by the .tv-* component layer in components.css. These are NOT
 *     HSL channels; reference them bare, e.g. background: var(--bg).
 *
 * Theming: the platform toggles dark mode with the `.dark` class
 * (shadcn / next-themes convention). The v2 handoff toggles with
 * [data-theme]. BOTH are supported — `.dark, [data-theme="dark"]`
 * share one block, `:root, [data-theme="light"]` share the other.
 *
 * See CHANGES.md (handoff) + README for the v1 → v2 migration notes.
 *
 * Note: this file intentionally does NOT @import Google Fonts — a
 * nested @import mid-file violates the CSS spec once bundlers inline
 * stylesheets. Import "@tv/design-tokens/fonts.css" first instead.
 */

/* ------------------------------------------------------------------ */
/* 1 · BRAND RAMP — constant across light/dark                         */
/* ------------------------------------------------------------------ */
:root {
  /* ---------- Orange family ----------
     #F8A324 is canonical for digital surfaces (matches the SVG
     logomark). #FFBA07 is the print-stock equivalent and is also the
     focus ring (higher luminance → more visible on dark + purple).
     Never use both within the same UI element. */
  --tv-orange:       #F8A324;   /* CTAs, eyebrows, accents (canonical) */
  --tv-orange-warm:  #FFBA07;   /* print fill, focus ring, logomark fill */
  --tv-orange-soft:  #FECF6E;   /* radar rings, illustration strokes */
  --tv-orange-deep:  #D28D05;   /* pressed/hover-dark, printed ink */

  /* ---------- Purple / blue ---------- */
  --tv-purple-light: #8869AF;   /* top of gradient, lift on dark */
  --tv-purple-mid:   #6B4D93;   /* gradient mid (was --tv-purple-deep in v1) */
  --tv-purple:       #5B407F;   /* brand surface, card bg */
  --tv-purple-deep:  #3F2B5C;   /* deep brand shadow (genuinely darker — v2) */
  --tv-blue-mid:     #2661AF;   /* business-card gradient bottom */
  --tv-blue:         #0D46AB;   /* polygraphy accent, secondary action */

  /* ---------- Data / realtime ---------- */
  --tv-teal:         #2A7884;   /* chart series 04 */
  --tv-teal-bright:  #11DDDB;   /* live/info, chart series 02 */

  /* ---------- Neutrals (warm sand + cool dark) ---------- */
  --tv-black:        #111523;   /* primary ink, dark text on light */
  --tv-ink:          #322927;   /* warm ink, body on paper */
  --tv-gray-500:     #6A6B7A;   /* neutral mid, default icon on light */
  --tv-gray-300:     #9D9386;   /* warm gray, print secondary */
  --tv-gray-200:     #BDBDBD;
  --tv-cool-100:     #D7E4E5;   /* cool tint, dividers on print */
  --tv-sand-100:     #E0DAD3;
  --tv-sand-200:     #CFC8B9;
  --tv-sand-300:     #B5AB9B;
  --tv-white:        #FFFFFF;

  /* ---------- v1 ALIASES (deprecated — remove in v3) ---------- */
  --tv-gray-900:     var(--tv-black);     /* was #17171C — collapsed */
  --tv-gray-700:     var(--tv-ink);       /* was a dup of --tv-ink */
  --tv-gray-100:     var(--tv-cool-100);  /* was cool, mislabeled gray */

  /* ---------- Signature gradients ---------- */
  --tv-gradient-brand:  linear-gradient(180deg, var(--tv-purple) 0%, var(--tv-blue-mid) 100%);
  --tv-gradient-purple: linear-gradient(180deg, color-mix(in srgb, var(--tv-purple-light) 85%, transparent) 0%, color-mix(in srgb, var(--tv-purple-mid) 95%, transparent) 100%);
  --tv-gradient-warm:   linear-gradient(180deg, var(--tv-orange) 0%, var(--tv-orange-deep) 100%);

  /* ---------- Typography ---------- */
  /* --font-display and --font-sans intentionally alias the same family
     (Montserrat). They stay separate so swapping in Gotham Pro for
     display surfaces is a one-token change. */
  --font-display: "Montserrat", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --font-sans:    "Montserrat", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --font-body:    "Open Sans", "Montserrat", ui-sans-serif, system-ui, sans-serif;
  --font-mono:    "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --step--2: 0.75rem;     /* 12 — captions, eyebrows */
  --step--1: 0.875rem;    /* 14 — small UI */
  --step-0:  1rem;        /* 16 — body */
  --step-1:  1.125rem;    /* 18 */
  --step-2:  1.5rem;      /* 24 — subhead */
  --step-3:  2rem;        /* 32 — H3 */
  --step-4:  2.5rem;      /* 40 — H2 */
  --step-5:  3rem;        /* 48 — H1 */
  --step-6:  4.5rem;      /* 72 — roll-up headline */
  --step-7:  6rem;        /* 96 — hero display */

  --leading-tight: 1.05;
  --leading-snug:  1.2;
  --leading-body:  1.55;
  --leading-loose: 1.7;

  --tracking-tight:  -0.02em;
  --tracking-normal: 0;
  --tracking-wide:   0.10em;      /* TANGO.VISION wordmark */
  --tracking-xwide:  0.24em;      /* DIGITAL TWINS tag, eyebrows */

  /* ---------- Shape ---------- */
  --radius-xs:   4px;
  --radius-sm:   8px;
  --radius-md:   12px;            /* default card */
  --radius-lg:   20px;            /* QR tiles, flyer cards */
  --radius-xl:   28px;            /* hero panels */
  --radius-2xl:  40px;
  --radius-pill: 999px;

  /* ---------- Elevation ---------- */
  --shadow-sm: 0 1px 2px rgba(17,21,35,0.06), 0 1px 1px rgba(17,21,35,0.04);
  --shadow-md: 0 6px 18px rgba(17,21,35,0.10), 0 2px 4px rgba(17,21,35,0.05);
  --shadow-lg: 0 20px 40px rgba(17,21,35,0.16), 0 6px 12px rgba(17,21,35,0.08);
  --shadow-glow-orange: 0 0 0 1px rgba(248,163,36,0.35), 0 10px 30px rgba(248,163,36,0.25);
  --shadow-glow-purple: 0 0 0 1px rgba(91,64,128,0.40), 0 12px 36px rgba(91,64,128,0.30);
  --shadow-glow-teal:   0 0 0 1px rgba(17,221,219,0.30), 0 8px 24px rgba(17,221,219,0.20);

  /* ---------- Spacing (8-point) ---------- */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;
  --space-9: 96px;

  /* ---------- Motion ---------- */
  --ease-out:   cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in:    cubic-bezier(0.64, 0, 0.78, 0);
  --ease-inout: cubic-bezier(0.65, 0, 0.35, 1);
  --dur-fast:   140ms;
  --dur-base:   240ms;
  --dur-slow:   420ms;

  /* ---------- v2 semantic: theme-INVARIANT direct values ---------- */
  /* Always-light surfaces (docs, auth, print) regardless of theme. */
  --bg-page:   #FAFAF7;
  --bg-paper:  #F4F3EE;
  --surface:   #FFFFFF;          /* negative-space white, used sparingly */

  /* Ink for content that always sits on a light surface. */
  --fg-on-light:        #111523;
  --fg-on-light-body:   #322927; /* warm ink for body copy on paper */
  --fg-on-light-muted:  #6A6B7A;
  --fg-mono-light:      rgba(17,21,35,0.55);
  --border-on-light:    rgba(17,21,35,0.08);

  /* Accent companions (the canonical --accent stays HSL for shadcn). */
  --accent-hover: var(--tv-orange-deep);

  /* Status hues. --warning / --info collide with shadcn's HSL slots,
     so they are NOT redefined here as direct values — the .tv-*
     component layer uses --tv-orange / --tv-teal-bright + the tint
     pairs below. --danger is free (shadcn uses --destructive). */
  --danger: #E2533A;

  /* Status tint pairs (background + foreground for badges/banners).
     The -fg-on-dark variants flip per theme further down. */
  --success-bg: rgba(59,181,138,0.16);
  --success-fg: #3BB58A;
  --warning-bg: rgba(248,163,36,0.18);
  --warning-fg: #8A5A07;
  --danger-bg:  rgba(226,83,58,0.16);
  --danger-fg:  #9E3C28;
  --info-bg:    rgba(17,221,219,0.18);
  --info-fg:    #0B8684;
  --neutral-bg: rgba(17,21,35,0.08);
  --neutral-fg: #111523;

  /* Merge-conflict encoding (two-sided, NOT a status).
     The revision-review screens in tv-module-map-editor and tv-module-bim
     show "ours" (the graph edit someone made here) against "theirs" (what
     the re-imported model file says) side by side. That needs two hues far
     enough apart to read at a glance in a dense 10px diff table.

     --primary cannot carry one of the sides: it is 35 94% 56%, and the
     amber the screens use today is 7 degrees away from it, so mapping one
     side onto primary makes the two choices near-identical in the one
     screen whose whole job is telling them apart.

     So the pair aliases two hues that are already in the brand ramp —
     orange for ours, teal for theirs, 136 degrees apart — and gets its own
     names rather than borrowing --warning-* / --info-*: these screens are
     not warnings or information, and sharing the names would mean a future
     restyle of "warning" silently restyles half the merge UI.

     Four tokens, following the status-pair shape above: a theme-invariant
     tint for the chip fill, and a foreground that flips per theme and
     carries BOTH the text and the border (keeping them equal avoids pairing
     #F8A324 with #FFBA07 inside one element, which the brand rules forbid).

     Contrast, measured: tint fills 5.01 / 5.44 on light, 6.47 / 6.15 on
     dark; foregrounds 5.66 / 6.06 on #FAFAF7 and 9.11 / 9.19 on #1F223A —
     AA everywhere, including as 3:1 non-text borders. The two sides are
     near-isoluminant by design, so hue does the work; every consumer must
     also carry a non-colour cue (the screens use font-weight plus a text
     label), because orange-vs-teal survives deuteranopia but nothing
     survives a greyscale print. */
  --conflict-ours-bg:   rgba(248,163,36,0.18);   /* --tv-orange   @18% */
  --conflict-theirs-bg: rgba(17,221,219,0.18);   /* --tv-teal-bright @18% */

  /* Light-surface tint ramp (constant; used by .tv-on-light wrappers). */
  --surface-l-1: rgba(17,21,35,0.03);  /* hover on light */
  --surface-l-2: rgba(17,21,35,0.06);  /* selected on light */
  --surface-l-3: rgba(17,21,35,0.10);  /* heavy fill on light */
}

/* ------------------------------------------------------------------ */
/* 2 + 3 · LIGHT THEME (default) — shadcn HSL slots + v2 direct values */
/*   :root and [data-theme="light"] share this block.                  */
/* ------------------------------------------------------------------ */
:root,
[data-theme="light"] {
  /* --- shadcn HSL channels (consumed via hsl(var(--…))) --- */
  --primary: 35 94% 56%;              /* #F8A324 — Tango orange */
  --primary-foreground: 232 35% 11%;  /* #111523 — ink on orange */

  --background: 60 27% 98%;           /* #FAFAF7 — warm off-white */
  --foreground: 232 35% 11%;          /* #111523 */
  --card: 0 0% 100%;
  --card-foreground: 232 35% 11%;
  --popover: 0 0% 100%;
  --popover-foreground: 232 35% 11%;

  --secondary: 266 33% 38%;           /* #5B407F — deep purple */
  --secondary-foreground: 0 0% 100%;
  --muted: 40 10% 90%;                /* warm gray */
  --muted-foreground: 236 6% 45%;     /* #6A6B7A */
  --accent: 35 94% 56%;               /* same as primary on light */
  --accent-foreground: 232 35% 11%;

  --destructive: 9 73% 55%;           /* #E2533A */
  --destructive-foreground: 0 0% 100%;
  --success: 158 51% 47%;             /* #3BB58A */
  --success-foreground: 0 0% 100%;
  --warning: 35 94% 56%;              /* brand orange */
  --warning-foreground: 232 35% 11%;
  --info: 179 86% 47%;                /* #11DDDB */
  --info-foreground: 232 35% 11%;

  --border: 232 35% 11% / 0.10;       /* rgba(17,21,35,0.10) */
  --input: 232 35% 11% / 0.10;
  --ring: 43 100% 51%;                /* #FFBA07 — focus */

  --sidebar-background: 60 27% 98%;
  --sidebar-foreground: 232 35% 11%;
  --sidebar-primary: 35 94% 56%;
  --sidebar-primary-foreground: 232 35% 11%;
  --sidebar-accent: 40 10% 90%;
  --sidebar-accent-foreground: 232 35% 11%;
  --sidebar-border: 232 35% 11% / 0.10;
  --sidebar-ring: 43 100% 51%;

  --chart-1: 35 94% 56%;              /* orange */
  --chart-2: 188 52% 34%;             /* teal */
  --chart-3: 266 33% 38%;             /* purple */
  --chart-4: 218 85% 36%;             /* blue */
  --chart-5: 179 86% 47%;             /* teal-bright */

  --radius: 0.75rem;                  /* 12px — default card */

  /* --- v2 direct semantic tokens (light) --- */
  --bg:          #FAFAF7;
  --bg-elevated: #FFFFFF;
  --bg-panel:    #F4F3EE;

  --fg:          #111523;
  --fg-muted:    rgba(17,21,35,0.68);
  --fg-subtle:   rgba(17,21,35,0.45);
  --fg-mono-dark: rgba(17,21,35,0.55);  /* JetBrains on light */

  --hairline:      rgba(17,21,35,0.08); /* card / table hairline border */
  --border-strong: rgba(17,21,35,0.16);

  /* Ink on orange in both themes. White was 2.05:1 on --tv-orange and
     2.78:1 on the hover --tv-orange-deep, under AA's 4.5:1 for the
     button's 12-16px text; ink is 8.88 / 6.54. test/contrast.test.js. */
  --accent-on-accent: #111523;

  /* Focus ring needs darker amber on light (#FFBA07 fails contrast). */
  --focus:            var(--tv-orange-deep);
  --focus-ring:       0 0 0 2px var(--bg-page), 0 0 0 4px var(--tv-orange-deep);
  --focus-ring-light: 0 0 0 2px var(--bg-page), 0 0 0 4px var(--tv-orange-deep);

  /* Status fg-on-dark variants flip to their light-on-light tints. */
  --success-fg-on-dark: var(--success-fg);
  --warning-fg-on-dark: var(--warning-fg);
  --danger-fg-on-dark:  var(--danger-fg);
  --info-fg-on-dark:    var(--info-fg);
  --neutral-bg-on-dark: var(--neutral-bg);
  --neutral-fg-on-dark: var(--neutral-fg);

  /* Merge-conflict foregrounds — text AND border. Darker than --info-fg
     (#0B8684, only 4.22 here) because the diff cells are 10px mono. */
  --conflict-ours-fg:   #8A5A07;
  --conflict-theirs-fg: #076B69;

  /* Surface tints resolve to the dark-on-light ramp. */
  --surface-d-1: var(--surface-l-1);
  --surface-d-2: var(--surface-l-2);
  --surface-d-3: var(--surface-l-3);
  --surface-d-4: rgba(17,21,35,0.14);

  color-scheme: light;
}

/* ------------------------------------------------------------------ */
/* DARK THEME — the primary product surface.                           */
/*   .dark (shadcn/next-themes) and [data-theme="dark"] share this.    */
/*   App chrome #0E1020, elevated panels #181A2E.                      */
/* ------------------------------------------------------------------ */
.dark,
[data-theme="dark"] {
  /* --- shadcn HSL channels --- */
  --primary: 35 94% 56%;
  --primary-foreground: 232 35% 11%;

  --background: 233 38% 9%;           /* #0E1020 — app bg */
  --foreground: 0 0% 100%;
  --card: 233 31% 14%;                /* #181A2E — elevated */
  --card-foreground: 0 0% 100%;
  --popover: 233 31% 14%;
  --popover-foreground: 0 0% 100%;

  --secondary: 266 33% 38%;
  --secondary-foreground: 0 0% 100%;
  --muted: 233 28% 17%;               /* #1F223A — panel */
  --muted-foreground: 0 0% 100% / 0.68;
  --accent: 35 94% 56%;
  --accent-foreground: 232 35% 11%;

  --destructive: 9 73% 55%;
  --destructive-foreground: 0 0% 100%;
  --success: 158 51% 47%;
  --success-foreground: 0 0% 100%;
  --warning: 35 94% 56%;
  --warning-foreground: 232 35% 11%;
  --info: 179 86% 47%;
  --info-foreground: 232 35% 11%;

  --border: 0 0% 100% / 0.10;         /* rgba(255,255,255,0.10) */
  --input: 0 0% 100% / 0.10;
  --ring: 43 100% 51%;                /* #FFBA07 focus */

  --sidebar-background: 233 38% 9%;
  --sidebar-foreground: 0 0% 100%;
  --sidebar-primary: 35 94% 56%;
  --sidebar-primary-foreground: 232 35% 11%;
  --sidebar-accent: 233 28% 17%;
  --sidebar-accent-foreground: 0 0% 100%;
  --sidebar-border: 0 0% 100% / 0.10;
  --sidebar-ring: 43 100% 51%;

  --chart-1: 35 94% 58%;
  --chart-2: 179 86% 47%;
  --chart-3: 270 41% 60%;
  --chart-4: 218 85% 56%;
  --chart-5: 158 51% 55%;

  --radius: 0.75rem;

  /* --- v2 direct semantic tokens (dark) --- */
  --bg:          #0E1020;
  --bg-elevated: #181A2E;
  --bg-panel:    #1F223A;

  --fg:          #FFFFFF;
  --fg-muted:    rgba(255,255,255,0.68);
  --fg-subtle:   rgba(255,255,255,0.45);
  --fg-mono-dark: rgba(255,255,255,0.55);

  --hairline:      rgba(255,255,255,0.10);
  --border-strong: rgba(255,255,255,0.22);

  --accent-on-accent: #111523;          /* ink on orange, 8.88:1 (AAA) */

  --focus:      #FFBA07;
  --focus-ring: 0 0 0 2px var(--bg), 0 0 0 4px var(--focus);
  --focus-ring-light: 0 0 0 2px var(--bg-page), 0 0 0 4px var(--tv-orange-deep);

  /* Status fg-on-dark variants brighten for dark surfaces. */
  --success-fg-on-dark: #5BD0A4;
  --warning-fg-on-dark: var(--tv-orange-warm);
  --danger-fg-on-dark:  #F0816B;
  --info-fg-on-dark:    var(--tv-teal-bright);
  --neutral-bg-on-dark: rgba(255,255,255,0.10);
  --neutral-fg-on-dark: var(--fg);

  /* Merge-conflict foregrounds — text AND border, brightened for dark. */
  --conflict-ours-fg:   var(--tv-orange-warm);
  --conflict-theirs-fg: var(--tv-teal-bright);

  /* Surface tints resolve to the white-on-dark ramp. */
  --surface-d-1: rgba(255,255,255,0.04);
  --surface-d-2: rgba(255,255,255,0.06);
  --surface-d-3: rgba(255,255,255,0.10);
  --surface-d-4: rgba(255,255,255,0.14);

  color-scheme: dark;
}

/* ------------------------------------------------------------------ */
/* Reduced motion — system default (v2).                               */
/* Zeroes the duration tokens + forces single-iteration animations.    */
/* The radar pulse re-enables itself inside a no-preference gate.       */
/* ------------------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  :root {
    --dur-fast: 0ms;
    --dur-base: 0ms;
    --dur-slow: 0ms;
  }
  *, *::before, *::after {
    animation-duration: 0ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0ms !important;
  }
}

/* ------------------------------------------------------------------ */
/* Base resets                                                         */
/* ------------------------------------------------------------------ */
*,
*::before,
*::after {
  border-color: hsl(var(--border));
}

body {
  background-color: hsl(var(--background));
  color: hsl(var(--foreground));
  font-family: var(--font-sans);
}

/* Keyboard focus — always visible, always brand amber. The .tv-*
   component layer additionally renders a 2-ring box-shadow focus ring
   via var(--focus-ring); this outline is the platform-wide default for
   everything else. */
:where(*):focus-visible {
  outline: 2px solid hsl(var(--ring));
  outline-offset: 2px;
}
/*
 * Tango Vision — Brand semantic classes
 *
 * Opt-in helpers for marketing surfaces, brand lockups, and the
 * signature orange accent rule. Import this alongside tokens.css on
 * any surface that shows brand identity (homepage, auth, pricing,
 * about, onboarding, kiosks, signage). Product UIs that live entirely
 * inside tv-console / Building OS typically only need tokens.css.
 *
 *   import '@tv/design-tokens/tokens.css';
 *   import '@tv/design-tokens/brand.css';
 *
 * Voice — taken from the brand guide:
 *   - Never cheerful. Quietly confident, systems-minded.
 *   - No emoji. No exclamation marks.
 *   - Headlines are blunt manifestos, not claims.
 *   - ALL-CAPS for mission statements + eyebrow labels (wide tracking).
 *   - Title Case is almost never used.
 */

/* ------------------------------------------------------------------ */
/* Display / heading classes                                           */
/* ------------------------------------------------------------------ */
.tv-display,
h1.tv {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--step-7);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  color: hsl(var(--foreground));
  text-wrap: balance;
}

.tv-h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--step-5);
  line-height: var(--leading-tight);
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.tv-h2 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--step-4);
  line-height: var(--leading-snug);
  text-wrap: balance;
}

.tv-h3 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--step-3);
  line-height: var(--leading-snug);
  text-wrap: balance;
}

.tv-subhead {
  font-family: var(--font-display);
  font-weight: 500;            /* Montserrat Medium — brand subhead */
  font-size: var(--step-2);
  line-height: var(--leading-snug);
  color: var(--tv-orange);
}
/* On dark surfaces the subhead uses the warmer orange for legibility. */
.tv-on-dark .tv-subhead { color: var(--tv-orange-warm); }

.tv-eyebrow {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--step--2);
  letter-spacing: var(--tracking-xwide);
  text-transform: uppercase;
  color: var(--tv-orange);
}

.tv-wordmark {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
}

/* ------------------------------------------------------------------ */
/* Body / content classes                                              */
/* ------------------------------------------------------------------ */
.tv-body {
  font-family: var(--font-body);
  font-weight: 300;            /* Open Sans Light — brand voice */
  font-size: var(--step-0);
  line-height: var(--leading-body);
  text-wrap: pretty;
}

/* Open Sans Light gets fuzzy at small sizes on Windows ClearType.
   Anything 14px or smaller bumps to Regular (400). */
.tv-body-sm {
  font-family: var(--font-body);
  font-weight: 400;
  font-size: var(--step--1);
  line-height: var(--leading-body);
  text-wrap: pretty;
}

.tv-body-strong {
  font-weight: 500;
}

.tv-caption {
  font-family: var(--font-display);
  font-size: var(--step--2);
  font-weight: 500;
  color: hsl(var(--muted-foreground));
  letter-spacing: 0.02em;
}

.tv-code {
  font-family: var(--font-mono);
  font-size: 0.92em;
}

/* ------------------------------------------------------------------ */
/* Signature accent — the 64×6 orange bar under hero headlines         */
/* ------------------------------------------------------------------ */
.tv-accent-rule::after {
  content: "";
  display: block;
  width: 64px;
  height: 6px;
  border-radius: 999px;
  background: var(--tv-orange);
  margin-top: 18px;
}

/* ------------------------------------------------------------------ */
/* Surface helpers                                                     */
/* ------------------------------------------------------------------ */
.tv-surface-brand {
  background: var(--tv-gradient-brand);
  color: #FFFFFF;
}

.tv-surface-purple {
  background: var(--tv-purple);
  color: #FFFFFF;
}

.tv-surface-dark {
  background: #0E1020;
  color: #FFFFFF;
}

.tv-surface-panel {
  background: #181A2E;
  color: #FFFFFF;
}

.tv-surface-sand {
  background: #FAFAF7;
  color: var(--tv-black);
}

/* ------------------------------------------------------------------ */
/* Radar-ring motif — the signature background treatment               */
/* Faint concentric rings radiating from top-right at 10% opacity.     */
/* Apply `.tv-radar-bg` to any dark surface for brand ambience.        */
/* ------------------------------------------------------------------ */
.tv-radar-bg {
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

.tv-radar-bg::before {
  content: "";
  position: absolute;
  top: -40%;
  right: -20%;
  width: 120%;
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(circle at center,
      transparent 0%, transparent 20%,
      rgba(255,255,255,0.02) 22%, rgba(255,255,255,0.02) 24%,
      transparent 26%, transparent 34%,
      rgba(255,255,255,0.03) 36%, rgba(255,255,255,0.03) 38%,
      transparent 40%, transparent 48%,
      rgba(255,255,255,0.04) 50%, rgba(255,255,255,0.04) 52%,
      transparent 54%, transparent 62%,
      rgba(255,255,255,0.06) 64%, rgba(255,255,255,0.06) 66%,
      transparent 68%, transparent 76%,
      rgba(255,255,255,0.08) 78%, rgba(255,255,255,0.08) 80%,
      transparent 82%
    );
  pointer-events: none;
  z-index: -1;
}

/* Radar pulse — used on live indicators, map sensors, loading spinners */
.tv-radar-pulse {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.tv-radar-pulse::before,
.tv-radar-pulse::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px solid var(--tv-orange);
  animation: tv-radar-pulse 2s var(--ease-out) infinite;
}

.tv-radar-pulse::after {
  animation-delay: 1s;
}

@keyframes tv-radar-pulse {
  0%   { transform: scale(0.6); opacity: 0.9; }
  100% { transform: scale(2.4); opacity: 0;   }
}

/* ------------------------------------------------------------------ */
/* Utility: brand-aligned focus ring for non-shadcn elements           */
/* ------------------------------------------------------------------ */
.tv-focus-ring:focus-visible {
  outline: 2px solid var(--tv-orange-warm);
  outline-offset: 2px;
}
/*
 * Tango Vision — Component Layer (v2 + v3)
 *
 * The .tv-* component classes from the design-system handoff: the v2
 * layer ported 1:1 from `colors_and_type.css`, then the v3 layer
 * (overlays, navigation, feedback, selection) from the handoff's own
 * `components.css` — see the "COMPONENT LAYER v3" banner below.
 * Import after tokens.css:
 *
 *   import "@tv/design-tokens/tokens.css";
 *   import "@tv/design-tokens/components.css";
 *
 * These are framework-agnostic CSS classes. The @tv/ui React package
 * wraps the JS-bearing ones (menu keyboard nav, autosize textarea,
 * file drag/drop, table sort/virtualization); everything here ships
 * APPEARANCE ONLY.
 *
 * Token notes (where this differs from the raw handoff):
 *   - The handoff component layer references --accent / --border /
 *     --info / --success as DIRECT values. In this package those names
 *     are shadcn HSL channels (consumed via hsl(var(--…))), so the
 *     component layer instead references the equivalent DIRECT tokens:
 *       --accent  → --tv-orange          --border  → --hairline
 *       --info    → --tv-teal-bright      --success → --success-fg
 *     --danger and --border-strong are direct values in tokens.css and
 *     are used as-is.
 *   - Components follow the active theme (:root light / .dark dark).
 *     Wrap a subtree in .tv-on-dark / .tv-on-light to force a palette
 *     locally (e.g. a dark hero band on a light marketing page).
 */

/* ------------------------------------------------------------------ */
/* Local palette wrappers — force a surface palette on a subtree.      */
/* ------------------------------------------------------------------ */
.tv-on-dark {
  --bg:          #0E1020;
  --bg-elevated: #181A2E;
  --bg-panel:    #1F223A;
  --fg:          #FFFFFF;
  --fg-muted:    rgba(255,255,255,0.68);
  --fg-subtle:   rgba(255,255,255,0.45);
  --hairline:      rgba(255,255,255,0.10);
  --border-strong: rgba(255,255,255,0.22);
  --accent-on-accent: #111523;
  --focus:      #FFBA07;
  --focus-ring: 0 0 0 2px var(--bg), 0 0 0 4px var(--focus);
  --surface-d-1: rgba(255,255,255,0.04);
  --surface-d-2: rgba(255,255,255,0.06);
  --surface-d-3: rgba(255,255,255,0.10);
  --surface-d-4: rgba(255,255,255,0.14);
  --success-fg-on-dark: #5BD0A4;
  --warning-fg-on-dark: var(--tv-orange-warm);
  --danger-fg-on-dark:  #F0816B;
  --info-fg-on-dark:    var(--tv-teal-bright);
  --neutral-bg-on-dark: rgba(255,255,255,0.10);
  --neutral-fg-on-dark: var(--fg);
  color: var(--fg);
}
.tv-on-light {
  --bg:          #FAFAF7;
  --bg-elevated: #FFFFFF;
  --bg-panel:    #F4F3EE;
  --fg:          #111523;
  --fg-muted:    rgba(17,21,35,0.68);
  --fg-subtle:   rgba(17,21,35,0.45);
  --hairline:      rgba(17,21,35,0.08);
  --border-strong: rgba(17,21,35,0.16);
  --accent-on-accent: #111523;
  --focus:      var(--tv-orange-deep);
  --focus-ring: var(--focus-ring-light);
  --surface-d-1: var(--surface-l-1);
  --surface-d-2: var(--surface-l-2);
  --surface-d-3: var(--surface-l-3);
  --surface-d-4: rgba(17,21,35,0.14);
  --success-fg-on-dark: var(--success-fg);
  --warning-fg-on-dark: var(--warning-fg);
  --danger-fg-on-dark:  var(--danger-fg);
  --info-fg-on-dark:    var(--info-fg);
  --neutral-bg-on-dark: var(--neutral-bg);
  --neutral-fg-on-dark: var(--neutral-fg);
  color: var(--fg);
}

/* ------------------------------------------------------------------ */
/* Button                                                              */
/* ------------------------------------------------------------------ */
.tv-btn {
  --_btn-bg: transparent;
  --_btn-fg: var(--fg);
  --_btn-border: transparent;
  --_btn-shadow: none;

  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--step--1);
  letter-spacing: 0.01em;
  padding: 10px 18px;
  border-radius: 10px;
  border: 1px solid var(--_btn-border);
  background: var(--_btn-bg);
  color: var(--_btn-fg);
  box-shadow: var(--_btn-shadow);
  cursor: pointer;
  text-decoration: none;
  transition: background var(--dur-fast) var(--ease-out),
              box-shadow var(--dur-fast) var(--ease-out),
              transform var(--dur-fast) var(--ease-out);
  min-height: 36px;
}
.tv-btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.tv-btn[disabled], .tv-btn.is-disabled { opacity: 0.4; cursor: not-allowed; }
.tv-btn[aria-busy="true"], .tv-btn.is-loading { cursor: progress; }

.tv-btn--primary {
  --_btn-bg: var(--tv-orange);
  --_btn-fg: var(--accent-on-accent);
  --_btn-border: var(--tv-orange);
  --_btn-shadow: var(--shadow-glow-orange);
}
.tv-btn--primary:hover { --_btn-bg: var(--tv-orange-deep); --_btn-border: var(--tv-orange-deep); }
.tv-btn--primary:active { transform: scale(0.98); }

.tv-btn--secondary {
  --_btn-bg: var(--surface-d-2);
  --_btn-fg: var(--fg);
  --_btn-border: var(--hairline);
}
.tv-btn--secondary:hover { --_btn-bg: var(--surface-d-3); }

.tv-btn--ghost {
  --_btn-bg: transparent;
  --_btn-fg: var(--fg);
  --_btn-border: var(--border-strong);
}
.tv-btn--ghost:hover { --_btn-bg: var(--surface-d-2); }

.tv-btn--danger {
  --_btn-bg: var(--danger);
  --_btn-fg: #fff;
  --_btn-border: var(--danger);
}
.tv-btn--danger:hover { --_btn-bg: #C84226; --_btn-border: #C84226; }

.tv-btn--link {
  --_btn-bg: transparent;
  --_btn-fg: var(--tv-orange);
  padding: 10px 0;
  border: 0;
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-thickness: 1px;
  box-shadow: none;
}

.tv-btn--sm { padding: 6px 12px; font-size: 12px; min-height: 28px; border-radius: 8px; }
.tv-btn--lg { padding: 14px 24px; font-size: var(--step-0); min-height: 44px; }
.tv-btn--pill { border-radius: var(--radius-pill); }

/* ------------------------------------------------------------------ */
/* Input / Field                                                       */
/* ------------------------------------------------------------------ */
.tv-input {
  font-family: var(--font-display);
  font-size: var(--step--1);
  color: var(--fg);
  background: var(--surface-d-1);
  border: 1px solid var(--border-strong);
  padding: 10px 14px;
  border-radius: 10px;
  outline: none;
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
  min-height: 40px;
  width: 100%;
}
.tv-input::placeholder { color: var(--fg-subtle); }
.tv-input:hover { border-color: var(--border-strong); }
.tv-input:focus-visible {
  border-color: var(--focus);
  box-shadow: 0 0 0 3px rgba(255,186,7,0.20);
}
.tv-input[aria-invalid="true"], .tv-input.is-error {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(226,83,58,0.18);
}
.tv-input[disabled], .tv-input.is-disabled { opacity: 0.4; cursor: not-allowed; }

.tv-field { display: flex; flex-direction: column; gap: 6px; }
.tv-field-label {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-muted);
}
.tv-field-hint { font-size: 11px; color: var(--fg-subtle); }
.tv-field-hint.is-error { color: var(--danger); }

/* ------------------------------------------------------------------ */
/* Badge                                                               */
/* ------------------------------------------------------------------ */
.tv-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
}
.tv-badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}
.tv-badge--bare::before { display: none; }

.tv-badge--success { background: var(--success-bg); color: var(--success-fg-on-dark); }
.tv-badge--warning { background: var(--warning-bg); color: var(--warning-fg-on-dark); }
.tv-badge--danger  { background: var(--danger-bg);  color: var(--danger-fg-on-dark);  }
.tv-badge--info    { background: var(--info-bg);    color: var(--info-fg-on-dark);    }
.tv-badge--neutral { background: var(--neutral-bg-on-dark); color: var(--neutral-fg-on-dark); }

/* ------------------------------------------------------------------ */
/* Card                                                                */
/* ------------------------------------------------------------------ */
.tv-card {
  background: var(--bg-elevated);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-md);
  padding: var(--space-5);
}

/* ------------------------------------------------------------------ */
/* KPI tile                                                            */
/* ------------------------------------------------------------------ */
.tv-kpi {
  background: var(--bg-elevated);
  border: 1px solid var(--hairline);
  border-radius: 14px;
  padding: 18px;
  color: var(--fg);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.tv-kpi-label {
  font-family: var(--font-display);
  font-size: 10px;
  letter-spacing: 0.14em;
  font-weight: 700;
  color: var(--fg-subtle);
  text-transform: uppercase;
}
.tv-kpi-value {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--step-3);
  line-height: 1;
  letter-spacing: -0.02em;
}
.tv-kpi-delta {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--success-fg);
}
.tv-kpi-delta.is-down { color: var(--danger); }

/* ------------------------------------------------------------------ */
/* Segmented control                                                   */
/* ------------------------------------------------------------------ */
.tv-segmented {
  display: inline-flex;
  background: var(--surface-d-1);
  border: 1px solid var(--hairline);
  border-radius: 10px;
  padding: 3px;
  gap: 2px;
}
.tv-segmented button {
  background: transparent;
  border: 0;
  color: var(--fg-muted);
  padding: 6px 12px;
  border-radius: 7px;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}
.tv-segmented button[aria-selected="true"],
.tv-segmented button.is-active {
  background: var(--surface-d-3);
  color: var(--fg);
}

/* ------------------------------------------------------------------ */
/* Toggle                                                              */
/* ------------------------------------------------------------------ */
.tv-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  cursor: pointer;
  user-select: none;
}
.tv-toggle-switch {
  width: 36px;
  height: 20px;
  background: var(--surface-d-3);
  border-radius: var(--radius-pill);
  position: relative;
  transition: background var(--dur-fast);
  flex-shrink: 0;
}
.tv-toggle-switch::after {
  content: "";
  position: absolute;
  inset-block-start: 2px;
  inset-inline-start: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  transition: inset-inline-start var(--dur-fast) var(--ease-out);
}
.tv-toggle[aria-checked="true"] .tv-toggle-switch,
.tv-toggle.is-on .tv-toggle-switch { background: var(--tv-orange); }
.tv-toggle[aria-checked="true"] .tv-toggle-switch::after,
.tv-toggle.is-on .tv-toggle-switch::after { inset-inline-start: 18px; }

/* ------------------------------------------------------------------ */
/* Pulse (live indicator)                                              */
/* Teal for data, orange for action, danger for incident. Pulse = live.*/
/* ------------------------------------------------------------------ */
.tv-pulse {
  position: relative;
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--tv-teal-bright);
  box-shadow: 0 0 0 3px rgba(17,221,219,0.25);
}
.tv-pulse::after {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  background: currentColor;
  color: var(--tv-teal-bright);
  opacity: 0.3;
  animation: tv-pulse 2s var(--ease-out) infinite;
}
.tv-pulse--action  { background: var(--tv-orange); box-shadow: 0 0 0 3px rgba(248,163,36,0.25); }
.tv-pulse--action::after  { color: var(--tv-orange); }
.tv-pulse--danger  { background: var(--danger); box-shadow: 0 0 0 3px rgba(226,83,58,0.25); }
.tv-pulse--danger::after  { color: var(--danger); }
@keyframes tv-pulse {
  0%   { transform: scale(1);   opacity: 0.3; }
  100% { transform: scale(2.2); opacity: 0;   }
}

/* ------------------------------------------------------------------ */
/* Select                                                              */
/* ------------------------------------------------------------------ */
.tv-select {
  font-family: var(--font-display);
  font-size: var(--step--1);
  color: var(--fg);
  background:
    var(--surface-d-1)
    linear-gradient(45deg, transparent 50%, currentColor 50%) calc(100% - 18px) 50% / 6px 6px no-repeat,
    var(--surface-d-1)
    linear-gradient(-45deg, transparent 50%, currentColor 50%) calc(100% - 12px) 50% / 6px 6px no-repeat;
  background-color: var(--surface-d-1);
  border: 1px solid var(--border-strong);
  padding-block: 10px;
  padding-inline: 14px 36px;
  border-radius: 10px;
  outline: none;
  min-height: 40px;
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}
.tv-select:focus-visible {
  border-color: var(--focus);
  box-shadow: 0 0 0 3px rgba(255,186,7,0.20);
}
.tv-select[aria-invalid="true"], .tv-select.is-error {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(226,83,58,0.18);
}
.tv-select[disabled], .tv-select.is-disabled { opacity: 0.4; cursor: not-allowed; }

/* ------------------------------------------------------------------ */
/* Menu (portal target for select / dropdown / combobox)               */
/* ------------------------------------------------------------------ */
.tv-menu {
  background: var(--bg-elevated);
  border: 1px solid var(--hairline);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  padding: 6px;
  min-width: 200px;
  font-family: var(--font-display);
  font-size: var(--step--1);
  color: var(--fg);
}
.tv-menu-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  user-select: none;
  color: var(--fg);
}
.tv-menu-item:hover,
.tv-menu-item[aria-selected="true"] { background: var(--surface-d-2); }
.tv-menu-item[aria-checked="true"] { color: var(--tv-orange); }
.tv-menu-separator {
  height: 1px;
  background: var(--hairline);
  margin: 6px 4px;
  border: 0;
}

/* ------------------------------------------------------------------ */
/* Textarea                                                            */
/* ------------------------------------------------------------------ */
.tv-textarea {
  font-family: var(--font-body);
  font-weight: 400;
  font-size: var(--step--1);
  line-height: var(--leading-body);
  color: var(--fg);
  background: var(--surface-d-1);
  border: 1px solid var(--border-strong);
  padding: 10px 14px;
  border-radius: 10px;
  outline: none;
  min-height: 96px;
  width: 100%;
  resize: vertical;
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}
.tv-textarea::placeholder { color: var(--fg-subtle); }
.tv-textarea:focus-visible {
  border-color: var(--focus);
  box-shadow: 0 0 0 3px rgba(255,186,7,0.20);
}
.tv-textarea[aria-invalid="true"], .tv-textarea.is-error {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(226,83,58,0.18);
}
.tv-textarea[disabled], .tv-textarea.is-disabled { opacity: 0.4; cursor: not-allowed; }

/* ------------------------------------------------------------------ */
/* File drop                                                           */
/* ------------------------------------------------------------------ */
.tv-file {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-6);
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--surface-d-1);
  color: var(--fg-muted);
  text-align: center;
  cursor: pointer;
  transition: border-color var(--dur-fast), background var(--dur-fast);
  min-height: 140px;
}
.tv-file:hover { border-color: var(--tv-orange); background: var(--surface-d-2); }
.tv-file:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.tv-file[data-dragging="true"], .tv-file.is-dragging {
  border-color: var(--tv-orange);
  background: color-mix(in srgb, var(--tv-orange) 8%, transparent);
  color: var(--fg);
}
.tv-file[aria-invalid="true"], .tv-file.is-error {
  border-color: var(--danger);
  color: var(--danger);
}
.tv-file-title { font-weight: 600; color: var(--fg); }
.tv-file-hint { font-size: 11px; color: var(--fg-subtle); }

/* ------------------------------------------------------------------ */
/* Table primitive — sticky header, hairline rows, declarative sort    */
/* ------------------------------------------------------------------ */
.tv-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-family: var(--font-display);
  font-size: var(--step--1);
  color: var(--fg);
}
.tv-table thead th {
  position: sticky;
  inset-block-start: 0;
  z-index: 1;
  background: var(--bg);
  text-align: start;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--fg-subtle);
  padding: 10px 14px;
  border-block-end: 1px solid var(--hairline);
  white-space: nowrap;
  cursor: default;
}
.tv-table thead th[aria-sort] { cursor: pointer; }
.tv-table thead th[aria-sort]::after {
  content: "\2195";
  margin-inline-start: 6px;
  opacity: 0.4;
  font-size: 12px;
}
.tv-table thead th[aria-sort="ascending"]::after  { content: "\2191"; opacity: 1; color: var(--tv-orange); }
.tv-table thead th[aria-sort="descending"]::after { content: "\2193"; opacity: 1; color: var(--tv-orange); }
.tv-table tbody td {
  padding: 12px 14px;
  border-block-end: 1px solid var(--hairline);
  vertical-align: middle;
}
.tv-table tbody tr { transition: background var(--dur-fast); }
.tv-table tbody tr:hover { background: var(--surface-d-1); }
.tv-table tbody tr[aria-selected="true"] { background: var(--surface-d-2); }
.tv-table tbody tr[aria-selected="true"] td { color: var(--fg); }
.tv-table tbody tr:last-child td { border-block-end: 0; }
.tv-table .tv-table-num {
  font-family: var(--font-mono);
  text-align: end;
  font-variant-numeric: tabular-nums;
}

/* ------------------------------------------------------------------ */
/* DENSITY · [data-density="compact"]                                  */
/* Tighter padding for tables / side panels / data-dense dashboards.   */
/* Touch-target floor: 30px compact / 36px default / 44px on --lg.     */
/* Do NOT use compact on primary mobile actions.                       */
/* ------------------------------------------------------------------ */
[data-density="compact"] .tv-btn {
  padding: 6px 12px;
  min-height: 30px;
  font-size: 12px;
  border-radius: 8px;
}
[data-density="compact"] .tv-btn--lg {
  padding: 10px 18px;
  min-height: 36px;
  font-size: var(--step--1);
}
[data-density="compact"] .tv-input {
  padding: 6px 10px;
  min-height: 30px;
  font-size: 12px;
  border-radius: 8px;
}
[data-density="compact"] .tv-field { gap: 4px; }
[data-density="compact"] .tv-field-label { font-size: 10px; }
[data-density="compact"] .tv-badge { padding: 2px 8px; font-size: 10px; }
[data-density="compact"] .tv-kpi { padding: 12px; gap: 6px; }
[data-density="compact"] .tv-kpi-value { font-size: var(--step-2); }
[data-density="compact"] .tv-segmented { padding: 2px; }
[data-density="compact"] .tv-segmented button { padding: 4px 10px; font-size: 11px; }
[data-density="compact"] .tv-card { padding: var(--space-4); }
[data-density="compact"] .tv-select {
  padding-block: 6px;
  padding-inline: 10px 30px;
  min-height: 30px;
  font-size: 12px;
  border-radius: 8px;
}
[data-density="compact"] .tv-table thead th { padding: 6px 10px; }
[data-density="compact"] .tv-table tbody td { padding: 8px 10px; font-size: 12px; }

/* ------------------------------------------------------------------ */
/* i18n WIDTH SAFETY                                                   */
/* Russian / German / Finnish labels run ~20% wider than English.      */
/* Buttons and badges keep their label on one line while there is      */
/* room and wrap when there is not, instead of running out of their    */
/* container. Until 3.6.0 they were `min-width: max-content;           */
/* white-space: nowrap`, which no Tailwind utility can undo (this file */
/* is unlayered): a long Russian label pushed sibling buttons out of a */
/* card. Segments and field labels keep their width; a segmented       */
/* control that does not fit should scroll, not wrap.                  */
/* ------------------------------------------------------------------ */
.tv-segmented button { min-width: max-content; }
.tv-btn { text-align: center; overflow-wrap: break-word; }
.tv-badge { overflow-wrap: break-word; }
.tv-field-label { min-width: max-content; }

/* Use when a label must wrap rather than scroll. */
.tv-i18n-fluid {
  min-width: 0;
  white-space: normal;
  overflow-wrap: anywhere;
  hyphens: auto;
}

/* ================================================================== */
/* COMPONENT LAYER v3                                                 */
/* ------------------------------------------------------------------ */
/* Overlays (dialog, drawer, tooltip, menu), navigation (tabs,        */
/* breadcrumbs, pagination), feedback (toast, banner, progress,       */
/* spinner, skeleton, empty state), selection (checkbox, radio, chip, */
/* slider), identity (avatar) and disclosure (accordion). Ported from */
/* the design system's `components.css`; @tv/ui wraps every class.    */
/*                                                                    */
/* Port notes (where this differs from the handoff file):             */
/*   - `--border` -> `--hairline` and `--success` -> `--success-fg`,   */
/*     for the same shadcn-HSL reason as the v2 layer above.          */
/*   - The handoff is dark-first and overrides for                    */
/*     `[data-theme="light"]`. This package is light-first (:root),   */
/*     so each of those overrides is inverted: the light value is the */
/*     base rule and the dark value is scoped to `.dark`,             */
/*     `[data-theme="dark"]` and `.tv-on-dark`, followed by a         */
/*     `.tv-on-light` / `[data-theme="light"]` rule so a light island  */
/*     inside a dark tree still renders light.                        */
/* ================================================================== */

/* ---------- Utilities ---------- */
.tv-sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}

/* ---------- Icon button ---------- */
.tv-icon-btn{display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;width:32px;height:32px;padding:0;border-radius:8px;border:1px solid transparent;background:var(--surface-d-2);color:var(--fg-muted);cursor:pointer;transition:background var(--dur-fast) var(--ease-out),color var(--dur-fast) var(--ease-out)}
.tv-icon-btn:hover{background:var(--surface-d-3);color:var(--fg)}
.tv-icon-btn:focus-visible{outline:none;box-shadow:var(--focus-ring)}
.tv-icon-btn[disabled]{opacity:.4;cursor:not-allowed}
.tv-icon-btn svg{width:16px;height:16px;flex-shrink:0}
.tv-icon-btn--ghost{background:transparent;border-color:var(--border-strong)}
.tv-icon-btn--ghost:hover{background:var(--surface-d-2)}
.tv-icon-btn--bare{background:transparent}
.tv-icon-btn--bare:hover{background:var(--surface-d-2)}
.tv-icon-btn--sm{width:28px;height:28px;border-radius:7px}
.tv-icon-btn--lg{width:44px;height:44px;border-radius:10px}
.tv-icon-btn--lg svg{width:20px;height:20px}
[data-density="compact"] .tv-icon-btn{width:28px;height:28px;border-radius:7px}

/* ---------- Scrim (shared by Dialog + modal Drawer) ---------- */
.tv-scrim{position:fixed;inset:0;z-index:1000;background:rgba(17,21,35,.36);animation:tv-fade-in var(--dur-base) var(--ease-out)}
.dark .tv-scrim,[data-theme="dark"] .tv-scrim,.tv-on-dark .tv-scrim{background:rgba(8,9,18,.62)}
.tv-on-light .tv-scrim,[data-theme="light"] .tv-scrim{background:rgba(17,21,35,.36)}
.tv-scrim--center{display:grid;place-items:center;padding:var(--space-5);overflow-y:auto}
.tv-scrim--contained{position:absolute}
@keyframes tv-fade-in{from{opacity:0}to{opacity:1}}

/* ---------- Dialog ---------- */
.tv-dialog{position:relative;width:min(460px,100%);max-height:calc(100vh - 48px);overflow-y:auto;padding:28px;border-radius:18px;background:var(--surface);color:var(--fg);border:1px solid var(--hairline);box-shadow:var(--shadow-lg);font-family:var(--font-display);outline:none;animation:tv-dialog-in var(--dur-base) var(--ease-out)}
.dark .tv-dialog,[data-theme="dark"] .tv-dialog,.tv-on-dark .tv-dialog{background:var(--bg-panel);box-shadow:0 24px 60px rgba(0,0,0,.5)}
.tv-on-light .tv-dialog,[data-theme="light"] .tv-dialog{background:var(--surface);box-shadow:var(--shadow-lg)}
.tv-scrim--contained .tv-dialog{max-height:100%}
.tv-dialog--sm{width:min(380px,100%)}
.tv-dialog--lg{width:min(640px,100%)}
.tv-dialog-close{position:absolute;inset-block-start:16px;inset-inline-end:16px}
.tv-dialog-icon{width:46px;height:46px;border-radius:12px;display:flex;align-items:center;justify-content:center;margin-block-end:18px;background:var(--surface-d-2);border:1px solid var(--hairline);color:var(--fg-muted)}
.tv-dialog-icon svg{width:22px;height:22px}
.tv-dialog--action .tv-dialog-icon{background:rgba(248,163,36,.15);border-color:rgba(248,163,36,.4);color:var(--warning-fg-on-dark)}
.tv-dialog--danger .tv-dialog-icon{background:var(--danger-bg);border-color:rgba(226,83,58,.4);color:var(--danger-fg-on-dark)}
.tv-dialog--info .tv-dialog-icon{background:var(--info-bg);border-color:rgba(17,221,219,.35);color:var(--info-fg-on-dark)}
.tv-dialog--success .tv-dialog-icon{background:var(--success-bg);border-color:rgba(59,181,138,.4);color:var(--success-fg-on-dark)}
.tv-dialog-title{margin:0 0 8px;padding-inline-end:36px;font-family:var(--font-display);font-weight:700;font-size:20px;line-height:1.25;letter-spacing:-.01em;color:var(--fg);text-wrap:balance}
.tv-dialog-desc{margin:0;font-family:var(--font-body);font-weight:300;font-size:14px;line-height:var(--leading-body);color:var(--fg-muted);text-wrap:pretty}
.tv-dialog-content{margin-block-start:20px}
.tv-dialog-actions{display:flex;flex-wrap:wrap;justify-content:flex-end;gap:10px;margin-block-start:24px}
@keyframes tv-dialog-in{from{opacity:0;transform:translateY(8px) scale(.98)}to{opacity:1;transform:none}}

/* ---------- Drawer (side sheet) ---------- */
/* Shadow: light theme uses --shadow-lg regardless of side; the dark   */
/* theme casts a directional shadow away from the edge it sits on.     */
.tv-drawer{position:fixed;inset-block:0;inset-inline-end:0;z-index:1001;width:min(440px,100%);display:flex;flex-direction:column;background:var(--bg-elevated);color:var(--fg);border-inline-start:1px solid var(--hairline);box-shadow:var(--shadow-lg);font-family:var(--font-display);outline:none;animation:tv-drawer-in-end var(--dur-base) var(--ease-inout)}
.tv-drawer--sm{width:min(360px,100%)}
.tv-drawer--lg{width:min(640px,100%)}
.tv-drawer--xl{width:min(880px,100%)}
.tv-drawer--start{inset-inline-end:auto;inset-inline-start:0;border-inline-start:0;border-inline-end:1px solid var(--hairline);animation-name:tv-drawer-in-start}
[dir="rtl"] .tv-drawer{animation-name:tv-drawer-in-start}
[dir="rtl"] .tv-drawer--start{animation-name:tv-drawer-in-end}
.dark .tv-drawer,[data-theme="dark"] .tv-drawer,.tv-on-dark .tv-drawer{box-shadow:-20px 0 60px rgba(0,0,0,.5)}
.dark .tv-drawer--start,[data-theme="dark"] .tv-drawer--start,.tv-on-dark .tv-drawer--start{box-shadow:20px 0 60px rgba(0,0,0,.5)}
.dark [dir="rtl"] .tv-drawer,[dir="rtl"].dark .tv-drawer,[data-theme="dark"][dir="rtl"] .tv-drawer,[dir="rtl"] [data-theme="dark"] .tv-drawer,[data-theme="dark"] [dir="rtl"] .tv-drawer{box-shadow:20px 0 60px rgba(0,0,0,.5)}
.dark [dir="rtl"] .tv-drawer--start,[dir="rtl"].dark .tv-drawer--start,[data-theme="dark"][dir="rtl"] .tv-drawer--start,[dir="rtl"] [data-theme="dark"] .tv-drawer--start,[data-theme="dark"] [dir="rtl"] .tv-drawer--start{box-shadow:-20px 0 60px rgba(0,0,0,.5)}
.tv-on-light .tv-drawer,[data-theme="light"] .tv-drawer{box-shadow:var(--shadow-lg)}
.tv-drawer--contained{position:absolute}
.tv-drawer--inline,.dark .tv-drawer--inline,[data-theme="dark"] .tv-drawer--inline,.tv-on-dark .tv-drawer--inline{position:relative;inset:auto;z-index:auto;height:100%;box-shadow:none;animation:none}
.tv-drawer-header{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;padding:20px 24px 16px;border-block-end:1px solid var(--hairline)}
.tv-drawer-heading{display:flex;flex-direction:column;gap:4px;min-width:0}
.tv-drawer-icon{width:46px;height:46px;border-radius:12px;display:flex;align-items:center;justify-content:center;margin-block-end:10px;background:var(--tv-gradient-brand);color:var(--tv-orange-warm)}
.tv-drawer-icon svg{width:22px;height:22px}
.tv-drawer-title{margin:0;font-family:var(--font-display);font-weight:700;font-size:22px;line-height:1.2;letter-spacing:-.01em;color:var(--fg);overflow-wrap:anywhere}
.tv-drawer-meta{font-family:var(--font-mono);font-size:11px;font-weight:600;letter-spacing:.08em;text-transform:uppercase;color:var(--fg-mono-dark)}
.tv-drawer-tabs{padding-inline:24px;border-block-end:1px solid var(--hairline)}
.tv-drawer-tabs .tv-tabs{border-block-end:0}
.tv-drawer-body{flex:1;min-height:0;overflow-y:auto;padding:20px 24px}
.tv-drawer-footer{display:flex;flex-wrap:wrap;justify-content:flex-end;gap:10px;padding:16px 24px;border-block-start:1px solid var(--hairline)}
.tv-drawer-section{margin:24px 0 12px;padding-block-end:8px;border-block-end:1px solid var(--hairline);font-family:var(--font-display);font-size:11px;font-weight:700;letter-spacing:.14em;text-transform:uppercase;color:var(--fg-subtle)}
.tv-drawer-section:first-child{margin-block-start:0}
@keyframes tv-drawer-in-end{from{transform:translateX(100%)}to{transform:none}}
@keyframes tv-drawer-in-start{from{transform:translateX(-100%)}to{transform:none}}
[data-density="compact"] .tv-drawer-header{padding:14px 18px 12px}
[data-density="compact"] .tv-drawer-body{padding:14px 18px}
[data-density="compact"] .tv-drawer-footer{padding:12px 18px}
[data-density="compact"] .tv-drawer-tabs{padding-inline:18px}

/* ---------- Description list (key / value rows in drawers + cards) ---------- */
.tv-dl{display:grid;grid-template-columns:minmax(0,1fr) auto;margin:0;font-family:var(--font-display);font-size:13px}
.tv-dl dt,.tv-dl dd{padding:10px 0;border-block-end:1px solid var(--hairline)}
.tv-dl dt{color:var(--fg-muted)}
.tv-dl dd{margin:0;padding-inline-start:16px;text-align:end;font-family:var(--font-mono);color:var(--fg)}
.tv-dl dt:last-of-type,.tv-dl dd:last-of-type{border-block-end:0}

/* ---------- Tabs ---------- */
.tv-tabs{display:flex;gap:4px;border-block-end:1px solid var(--hairline);font-family:var(--font-display);overflow-x:auto;scrollbar-width:none}
.tv-tabs::-webkit-scrollbar{display:none}
.tv-tab{position:relative;display:inline-flex;align-items:center;gap:8px;padding:12px 14px;background:none;border:0;border-radius:8px 8px 0 0;color:var(--fg-muted);font-family:var(--font-display);font-size:13px;font-weight:600;letter-spacing:.01em;white-space:nowrap;min-width:max-content;cursor:pointer;transition:color var(--dur-fast) var(--ease-out),background var(--dur-fast) var(--ease-out)}
.tv-tab:hover{color:var(--fg);background:var(--surface-d-1)}
.tv-tab::after{content:"";position:absolute;inset-inline:10px;inset-block-end:0;height:2px;border-radius:2px 2px 0 0;background:var(--tv-orange);transform:scaleX(0);transition:transform var(--dur-base) var(--ease-out)}
.tv-tab[aria-selected="true"],.tv-tab.is-active{color:var(--fg)}
.tv-tab[aria-selected="true"]::after,.tv-tab.is-active::after{transform:scaleX(1)}
.tv-tab:focus-visible{outline:none;box-shadow:var(--focus-ring)}
.tv-tab[disabled]{opacity:.4;cursor:not-allowed}
.tv-tab[disabled]:hover{background:none;color:var(--fg-muted)}
.tv-tab svg{width:16px;height:16px;flex-shrink:0}
.tv-tab-count{padding:1px 7px;border-radius:var(--radius-pill);background:var(--surface-d-3);color:var(--fg-muted);font-family:var(--font-mono);font-size:10px;font-weight:500;line-height:1.6}
.tv-tab[aria-selected="true"] .tv-tab-count{background:rgba(248,163,36,.18);color:var(--warning-fg-on-dark)}
.tv-tabs--sm .tv-tab,[data-density="compact"] .tv-tab{padding:8px 10px;font-size:12px}
.tv-tabs--vertical{flex-direction:column;gap:2px;border-block-end:0;border-inline-end:1px solid var(--hairline);overflow:visible}
.tv-tabs--vertical .tv-tab{justify-content:flex-start;padding:10px 14px;margin-inline-end:-1px;border-radius:0;border-start-start-radius:8px;border-end-start-radius:8px}
.tv-tabs--vertical .tv-tab::after{inset-inline-start:auto;inset-inline-end:0;inset-block:8px;width:2px;height:auto;border-radius:2px;transform:scaleY(0)}
.tv-tabs--vertical .tv-tab[aria-selected="true"]{background:var(--surface-d-2)}
.tv-tabs--vertical .tv-tab[aria-selected="true"]::after{transform:scaleY(1)}
.tv-tabs--vertical .tv-tab-count{margin-inline-start:auto}
.tv-tab-panel{padding-block-start:var(--space-5)}
.tv-tab-panel:focus-visible{outline:none;box-shadow:var(--focus-ring);border-radius:8px}
.tv-tab-panel[hidden]{display:none}

/* ---------- Toast ---------- */
.tv-toast-region{position:fixed;inset-block-end:24px;inset-inline-end:24px;z-index:1100;display:flex;flex-direction:column;gap:10px;width:min(380px,calc(100vw - 32px));pointer-events:none}
.tv-toast-region--top-end{inset-block-end:auto;inset-block-start:24px}
.tv-toast-region--bottom-center{inset-inline-end:auto;left:50%;transform:translateX(-50%)}
.tv-toast-region--contained{position:absolute;inset-block-end:16px;inset-inline-end:16px}
.tv-toast-region--contained.tv-toast-region--top-end{inset-block-end:auto;inset-block-start:16px}
.tv-toast{pointer-events:auto;display:flex;gap:14px;align-items:flex-start;padding:14px 16px;border-radius:12px;background:var(--surface);color:var(--fg);border:1px solid var(--hairline);box-shadow:var(--shadow-lg);font-family:var(--font-display);animation:tv-toast-in var(--dur-base) var(--ease-out)}
.dark .tv-toast,[data-theme="dark"] .tv-toast,.tv-on-dark .tv-toast{background:var(--bg-panel);box-shadow:0 12px 30px rgba(0,0,0,.4)}
.tv-on-light .tv-toast,[data-theme="light"] .tv-toast{background:var(--surface);box-shadow:var(--shadow-lg)}
.tv-toast-icon{width:32px;height:32px;border-radius:8px;display:flex;align-items:center;justify-content:center;flex-shrink:0;background:var(--neutral-bg-on-dark);color:var(--fg-muted)}
.tv-toast-icon svg{width:18px;height:18px}
.tv-toast--success .tv-toast-icon{background:var(--success-bg);color:var(--success-fg-on-dark)}
.tv-toast--warning .tv-toast-icon{background:var(--warning-bg);color:var(--warning-fg-on-dark)}
.tv-toast--danger .tv-toast-icon{background:var(--danger-bg);color:var(--danger-fg-on-dark)}
.tv-toast--info .tv-toast-icon{background:var(--info-bg);color:var(--info-fg-on-dark)}
.tv-toast--live .tv-toast-icon{background:var(--tv-orange);color:#111523}
.tv-toast-copy{flex:1;min-width:0}
.tv-toast-title{margin:0 0 2px;font-family:var(--font-display);font-weight:600;font-size:14px;line-height:1.35;color:var(--fg)}
.tv-toast-desc{margin:0;font-family:var(--font-body);font-weight:400;font-size:13px;line-height:1.5;color:var(--fg-muted)}
.tv-toast-action{display:inline-block;margin-block-start:6px;padding:0;background:none;border:0;font-family:var(--font-display);font-size:12px;font-weight:600;color:var(--tv-orange-deep);cursor:pointer;text-underline-offset:4px;text-decoration-thickness:1px}
.dark .tv-toast-action,[data-theme="dark"] .tv-toast-action,.tv-on-dark .tv-toast-action{color:var(--tv-orange)}
.tv-on-light .tv-toast-action,[data-theme="light"] .tv-toast-action{color:var(--tv-orange-deep)}
.tv-toast-action:hover{text-decoration:underline}
.tv-toast-action:focus-visible{outline:none;box-shadow:var(--focus-ring);border-radius:4px}
.tv-toast .tv-icon-btn{margin:-4px;margin-inline-start:0}
@keyframes tv-toast-in{from{opacity:0;transform:translateY(12px)}to{opacity:1;transform:none}}

/* ---------- Banner (page-level, persistent) ---------- */
.tv-banner{display:flex;flex-wrap:wrap;gap:14px;align-items:center;padding:14px 18px;border-radius:12px;border:1px solid var(--hairline);background:var(--surface-d-1);color:var(--fg);font-family:var(--font-display)}
.tv-banner-icon{width:36px;height:36px;border-radius:10px;display:flex;align-items:center;justify-content:center;flex-shrink:0;background:var(--surface-d-2);color:var(--fg-muted)}
.tv-banner-icon svg{width:20px;height:20px}
.tv-banner-copy{flex:1 1 240px;min-width:0}
.tv-banner-title{margin:0;font-family:var(--font-display);font-weight:700;font-size:14px;line-height:1.35;color:inherit}
.tv-banner-desc{margin:2px 0 0;font-family:var(--font-body);font-weight:400;font-size:13px;line-height:1.5;color:var(--fg-muted)}
.tv-banner-actions{display:flex;align-items:center;gap:8px;flex-shrink:0}
.tv-banner--warning{background:rgba(248,163,36,.08);border-color:rgba(248,163,36,.35)}
.tv-banner--warning .tv-banner-icon{background:rgba(248,163,36,.2);color:var(--warning-fg-on-dark)}
.tv-banner--danger{background:rgba(226,83,58,.08);border-color:rgba(226,83,58,.35)}
.tv-banner--danger .tv-banner-icon{background:rgba(226,83,58,.2);color:var(--danger-fg-on-dark)}
.tv-banner--success{background:rgba(59,181,138,.08);border-color:rgba(59,181,138,.35)}
.tv-banner--success .tv-banner-icon{background:rgba(59,181,138,.2);color:var(--success-fg-on-dark)}
.tv-banner--info{background:rgba(17,221,219,.06);border-color:rgba(17,221,219,.3)}
.tv-banner--info .tv-banner-icon{background:rgba(17,221,219,.16);color:var(--info-fg-on-dark)}
.tv-banner--brand{background:var(--tv-gradient-brand);border-color:transparent;color:#fff}
.tv-banner--brand .tv-banner-desc{color:rgba(255,255,255,.82)}
.dark .tv-banner--brand,[data-theme="dark"] .tv-banner--brand,.tv-on-dark .tv-banner--brand{background:linear-gradient(180deg,rgba(91,64,128,.4),rgba(38,97,175,.4));border-color:rgba(248,163,36,.3);color:var(--fg)}
.dark .tv-banner--brand .tv-banner-desc,[data-theme="dark"] .tv-banner--brand .tv-banner-desc,.tv-on-dark .tv-banner--brand .tv-banner-desc{color:var(--fg-muted)}
.tv-on-light .tv-banner--brand,[data-theme="light"] .tv-banner--brand{background:var(--tv-gradient-brand);border-color:transparent;color:#fff}
.tv-on-light .tv-banner--brand .tv-banner-desc,[data-theme="light"] .tv-banner--brand .tv-banner-desc{color:rgba(255,255,255,.82)}
.tv-banner--brand .tv-banner-icon{background:rgba(255,186,7,.2);color:var(--tv-orange-warm)}

/* ---------- Tooltip ---------- */
.tv-tooltip-anchor{position:relative;display:inline-flex}
.tv-tooltip{position:absolute;z-index:1200;left:50%;inset-block-end:calc(100% + 8px);width:max-content;max-width:240px;padding:6px 10px;border-radius:6px;background:var(--tv-black);color:#fff;border:1px solid rgba(255,255,255,.12);box-shadow:0 8px 20px rgba(0,0,0,.35);font-family:var(--font-display);font-size:12px;font-weight:500;line-height:1.4;text-align:center;white-space:normal;pointer-events:none;opacity:0;visibility:hidden;transform:translateX(-50%) translateY(4px);transition:opacity var(--dur-fast) var(--ease-out),transform var(--dur-fast) var(--ease-out),visibility 0s linear var(--dur-fast)}
.tv-tooltip[data-open="true"]{opacity:1;visibility:visible;transform:translateX(-50%);transition-delay:0s}
.tv-tooltip--bottom{inset-block-end:auto;inset-block-start:calc(100% + 8px);transform:translateX(-50%) translateY(-4px)}
.tv-tooltip--start,.tv-tooltip--end{left:auto;top:50%;inset-block-end:auto;transform:translateY(-50%)}
.tv-tooltip--end{inset-inline-start:calc(100% + 8px)}
.tv-tooltip--start{inset-inline-end:calc(100% + 8px)}
.tv-tooltip--start[data-open="true"],.tv-tooltip--end[data-open="true"]{transform:translateY(-50%)}
.tv-tooltip kbd{margin-inline-start:6px;padding:0 4px;border-radius:3px;background:rgba(255,255,255,.12);font-size:11px}

/* ---------- Menu v3 additions (dropdown behaviour on .tv-menu) ---------- */
.tv-menu-anchor{position:relative;display:inline-flex}
.tv-menu--popover{position:absolute;z-index:1150;width:max-content;max-width:320px;inset-block-start:calc(100% + 6px);inset-inline-start:0;animation:tv-menu-in var(--dur-fast) var(--ease-out)}
.tv-menu--align-end{inset-inline-start:auto;inset-inline-end:0}
.tv-menu--up{inset-block-start:auto;inset-block-end:calc(100% + 6px)}
button.tv-menu-item{width:100%;background:none;border:0;font:inherit;text-align:start}
.tv-menu-item:focus-visible{outline:none;background:var(--surface-d-2);box-shadow:inset 0 0 0 1px var(--focus)}
.tv-menu-item[disabled],.tv-menu-item[aria-disabled="true"]{opacity:.4;cursor:not-allowed}
.tv-menu-item[disabled]:hover{background:none}
.tv-menu-item svg{width:16px;height:16px;flex-shrink:0;color:var(--fg-muted)}
.tv-menu-item[aria-checked="true"] svg{color:inherit}
.tv-menu .tv-menu-item--danger{color:var(--danger-fg-on-dark)}
.tv-menu .tv-menu-item--danger svg{color:inherit}
.tv-menu-item-label{flex:1;min-width:0;white-space:nowrap}
.tv-menu-shortcut{margin-inline-start:auto;padding-inline-start:16px;font-family:var(--font-mono);font-size:11px;color:var(--fg-subtle)}
.tv-menu-label{padding:8px 10px 4px;font-family:var(--font-display);font-size:10px;font-weight:700;letter-spacing:.14em;text-transform:uppercase;color:var(--fg-subtle)}
@keyframes tv-menu-in{from{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:none}}

/* ---------- Checkbox + Radio ---------- */
.tv-check{position:relative;display:inline-flex;align-items:flex-start;gap:10px;font-family:var(--font-display);font-size:13px;line-height:1.45;color:var(--fg);cursor:pointer;user-select:none}
.tv-check input{position:absolute;inset-block-start:1px;inset-inline-start:0;width:18px;height:18px;margin:0;opacity:0;cursor:inherit}
.tv-check-box,.tv-radio-dot{position:relative;flex-shrink:0;width:18px;height:18px;margin-block-start:1px;border:1.5px solid var(--fg-subtle);border-radius:5px;background:var(--surface-d-1);transition:background var(--dur-fast) var(--ease-out),border-color var(--dur-fast) var(--ease-out)}
.tv-radio-dot{border-radius:50%}
.tv-check:hover .tv-check-box,.tv-check:hover .tv-radio-dot{border-color:var(--fg-muted)}
.tv-check input:checked + .tv-check-box,.tv-check input:indeterminate + .tv-check-box{background:var(--tv-orange);border-color:var(--tv-orange)}
.tv-check-box::after{content:"";position:absolute;left:50%;top:45%;width:5px;height:9px;border:solid var(--accent-on-accent);border-width:0 2px 2px 0;transform:translate(-50%,-50%) rotate(45deg) scale(0);transition:transform var(--dur-fast) var(--ease-out)}
.tv-check input:checked + .tv-check-box::after{transform:translate(-50%,-50%) rotate(45deg) scale(1)}
.tv-check input:indeterminate + .tv-check-box::after{top:50%;width:8px;height:0;border-width:0 0 2px 0;transform:translate(-50%,-50%) scale(1)}
.tv-check input:checked + .tv-radio-dot{border-color:var(--tv-orange)}
.tv-radio-dot::after{content:"";position:absolute;inset:3px;border-radius:50%;background:var(--tv-orange);transform:scale(0);transition:transform var(--dur-fast) var(--ease-out)}
.tv-check input:checked + .tv-radio-dot::after{transform:scale(1)}
.tv-check input:focus-visible + .tv-check-box,.tv-check input:focus-visible + .tv-radio-dot{box-shadow:var(--focus-ring)}
.tv-check input[aria-invalid="true"] + .tv-check-box,.tv-check input[aria-invalid="true"] + .tv-radio-dot{border-color:var(--danger)}
.tv-check.is-disabled{opacity:.4;cursor:not-allowed}
.tv-check-text{display:flex;flex-direction:column;gap:2px;min-width:0}
.tv-check-desc{font-family:var(--font-body);font-weight:400;font-size:13px;line-height:1.5;color:var(--fg-muted)}
.tv-choice-group{display:flex;flex-direction:column;gap:12px;margin:0;padding:0;border:0;min-width:0}
.tv-choice-group--horizontal{flex-direction:row;flex-wrap:wrap;gap:20px}
.tv-choice-group > legend{padding:0;margin-block-end:10px}
[data-density="compact"] .tv-check{font-size:12px;gap:8px}
[data-density="compact"] .tv-choice-group{gap:8px}

/* ---------- Chip (filter / removable token) ---------- */
.tv-chip{display:inline-flex;align-items:center;gap:6px;min-height:28px;min-width:max-content;padding:4px 12px;border-radius:var(--radius-pill);border:1px solid var(--border-strong);background:transparent;color:var(--fg-muted);font-family:var(--font-display);font-size:12px;font-weight:500;white-space:nowrap;transition:background var(--dur-fast) var(--ease-out),color var(--dur-fast) var(--ease-out),border-color var(--dur-fast) var(--ease-out)}
button.tv-chip{cursor:pointer}
button.tv-chip:hover{background:var(--surface-d-2);color:var(--fg)}
.tv-chip[aria-pressed="true"]{background:rgba(248,163,36,.14);border-color:rgba(248,163,36,.55);color:var(--fg)}
.tv-chip[disabled]{opacity:.4;cursor:not-allowed}
.tv-chip svg{width:16px;height:16px;flex-shrink:0}
.tv-chip-count{font-family:var(--font-mono);font-size:11px;color:var(--fg-subtle)}
.tv-chip--removable{padding-inline-end:4px;background:var(--surface-d-2);border-color:var(--hairline);color:var(--fg)}
.tv-chip-remove{display:inline-flex;align-items:center;justify-content:center;width:20px;height:20px;padding:0;border:0;border-radius:50%;background:transparent;color:var(--fg-muted);cursor:pointer}
.tv-chip-remove:hover{background:var(--surface-d-3);color:var(--fg)}
.tv-chip:focus-visible,.tv-chip-remove:focus-visible{outline:none;box-shadow:var(--focus-ring)}
.tv-chip-group{display:flex;flex-wrap:wrap;gap:8px}

/* ---------- Slider (range) ---------- */
.tv-slider{display:flex;flex-direction:column;gap:8px;width:100%;font-family:var(--font-display)}
.tv-slider-head{display:flex;justify-content:space-between;align-items:baseline;gap:12px}
.tv-slider-value{font-family:var(--font-mono);font-size:12px;color:var(--fg)}
.tv-slider-marks{display:flex;justify-content:space-between;font-family:var(--font-mono);font-size:11px;color:var(--fg-subtle)}
.tv-range{-webkit-appearance:none;appearance:none;width:100%;height:20px;margin:0;padding-block:8px;border-radius:var(--radius-pill);background:linear-gradient(var(--tv-orange),var(--tv-orange)) 0 0/50% 100% no-repeat content-box,var(--surface-d-3) content-box;cursor:pointer}
[dir="rtl"] .tv-range{background-position:100% 0,0 0}
.tv-range::-webkit-slider-runnable-track{height:4px;background:transparent}
.tv-range::-moz-range-track{height:4px;background:transparent}
.tv-range::-webkit-slider-thumb{-webkit-appearance:none;width:16px;height:16px;margin-top:-6px;border:0;border-radius:50%;background:#fff;box-shadow:0 0 0 4px rgba(248,163,36,.35),0 1px 3px rgba(0,0,0,.4)}
.tv-range::-moz-range-thumb{width:16px;height:16px;border:0;border-radius:50%;background:#fff;box-shadow:0 0 0 4px rgba(248,163,36,.35),0 1px 3px rgba(0,0,0,.4)}
.tv-range:focus-visible{outline:none}
.tv-range:focus-visible::-webkit-slider-thumb{box-shadow:var(--focus-ring)}
.tv-range:focus-visible::-moz-range-thumb{box-shadow:var(--focus-ring)}
.tv-range[disabled]{opacity:.4;cursor:not-allowed}
.tv-slider--data .tv-range{background-image:linear-gradient(var(--tv-teal-bright),var(--tv-teal-bright))}

/* ---------- Avatar ---------- */
.tv-avatar{position:relative;display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;width:32px;height:32px;border-radius:50%;background:var(--tv-purple);color:#fff;font-family:var(--font-display);font-size:12px;font-weight:700;letter-spacing:.02em;text-transform:uppercase;user-select:none}
.tv-avatar img{width:100%;height:100%;border-radius:inherit;object-fit:cover}
.tv-avatar--sm{width:24px;height:24px;font-size:10px}
.tv-avatar--lg{width:44px;height:44px;font-size:15px}
.tv-avatar--xl{width:64px;height:64px;font-size:20px}
.tv-avatar--blue{background:var(--tv-blue-mid)}
.tv-avatar--teal{background:var(--tv-teal)}
.tv-avatar--plum{background:var(--tv-purple-mid)}
.tv-avatar--orange{background:var(--tv-orange);color:#111523}
.tv-avatar--more{background:var(--bg-panel);color:var(--fg-muted);font-family:var(--font-mono);font-weight:500;letter-spacing:0;border:1px solid var(--hairline)}
.tv-avatar-status{position:absolute;inset-block-end:-1px;inset-inline-end:-1px;width:10px;height:10px;border-radius:50%;border:2px solid var(--bg);background:var(--fg-subtle)}
.tv-avatar--lg .tv-avatar-status,.tv-avatar--xl .tv-avatar-status{width:13px;height:13px}
.tv-avatar-status--online{background:var(--success-fg)}
.tv-avatar-status--away{background:var(--tv-orange)}
.tv-avatar-group{display:inline-flex;align-items:center}
.tv-avatar-group .tv-avatar{box-shadow:0 0 0 2px var(--bg)}
.tv-avatar-group .tv-avatar + .tv-avatar{margin-inline-start:-8px}

/* ---------- Progress ---------- */
.tv-progress{display:flex;flex-direction:column;gap:6px;width:100%;font-family:var(--font-display)}
.tv-progress-head{display:flex;justify-content:space-between;gap:12px;font-size:12px;font-weight:500;color:var(--fg-muted)}
.tv-progress-value{font-family:var(--font-mono);color:var(--fg)}
.tv-progress-track{position:relative;height:6px;border-radius:var(--radius-pill);background:var(--surface-d-3);overflow:hidden}
.tv-progress-bar{height:100%;border-radius:inherit;background:var(--tv-orange);transition:width var(--dur-base) var(--ease-out)}
.tv-progress--data .tv-progress-bar{background:var(--tv-teal-bright)}
.tv-progress--success .tv-progress-bar{background:var(--success-fg)}
.tv-progress--danger .tv-progress-bar{background:var(--danger)}
.tv-progress--sm .tv-progress-track{height:4px}
.tv-progress.is-indeterminate .tv-progress-bar{position:absolute;inset-block:0;width:40%;animation:tv-progress-indeterminate 1.4s var(--ease-inout) infinite}
@keyframes tv-progress-indeterminate{from{transform:translateX(-100%)}to{transform:translateX(250%)}}

/* ---------- Spinner (radar pulse) ---------- */
.tv-spinner{position:relative;display:inline-block;flex-shrink:0;width:24px;height:24px;color:var(--tv-orange)}
.tv-spinner::before{content:"";position:absolute;inset:36%;border-radius:50%;background:currentColor}
.tv-spinner-ring{position:absolute;inset:0;border-radius:50%;border:2px solid currentColor;opacity:0;animation:tv-spinner-ring 1.6s var(--ease-out) infinite}
.tv-spinner-ring + .tv-spinner-ring{animation-delay:.8s}
.tv-spinner--sm{width:16px;height:16px}
.tv-spinner--sm .tv-spinner-ring{border-width:1.5px}
.tv-spinner--lg{width:40px;height:40px}
.tv-spinner--data{color:var(--tv-teal-bright)}
.tv-spinner--inherit{color:currentColor}
@keyframes tv-spinner-ring{0%{transform:scale(.35);opacity:1}100%{transform:scale(1);opacity:0}}
@media (prefers-reduced-motion: reduce){.tv-spinner-ring{animation:none;opacity:.45;transform:scale(.8)}.tv-spinner-ring + .tv-spinner-ring{display:none}}

/* ---------- Skeleton ---------- */
.tv-skeleton{display:block;border-radius:6px;background:linear-gradient(90deg,var(--surface-d-2) 0%,var(--surface-d-3) 50%,var(--surface-d-2) 100%) 0 0/200% 100%;animation:tv-skeleton 1.6s linear infinite}
.tv-skeleton--text{height:12px;border-radius:4px}
.tv-skeleton--title{height:20px;border-radius:5px}
.tv-skeleton--circle{border-radius:50%}
.tv-skeleton--block{border-radius:var(--radius-md)}
.tv-skeleton-stack{display:flex;flex-direction:column;gap:10px}
@keyframes tv-skeleton{from{background-position:100% 0}to{background-position:-100% 0}}

/* ---------- Empty state ---------- */
.tv-empty{display:flex;flex-direction:column;align-items:center;gap:12px;padding:var(--space-7) var(--space-5);text-align:center;font-family:var(--font-display);color:var(--fg)}
.tv-empty-icon{width:56px;height:56px;margin-block-end:4px;border-radius:16px;display:flex;align-items:center;justify-content:center;background:var(--surface-d-2);border:1px solid var(--hairline);color:var(--tv-orange-deep)}
.dark .tv-empty-icon,[data-theme="dark"] .tv-empty-icon,.tv-on-dark .tv-empty-icon{color:var(--tv-orange)}
.tv-on-light .tv-empty-icon,[data-theme="light"] .tv-empty-icon{color:var(--tv-orange-deep)}
.tv-empty-icon svg{width:24px;height:24px}
.tv-empty-title{width:100%;margin:0;font-family:var(--font-display);font-size:16px;font-weight:700;line-height:1.3;letter-spacing:-.005em;color:var(--fg);text-wrap:balance}
.tv-empty-desc{margin:0;max-width:44ch;font-family:var(--font-body);font-weight:400;font-size:14px;line-height:var(--leading-body);color:var(--fg-muted);text-wrap:pretty}
.tv-empty-actions{width:100%;display:flex;flex-wrap:wrap;justify-content:center;gap:10px;margin-block-start:8px}
.tv-empty--sm{gap:8px;padding:var(--space-5)}
.tv-empty--sm .tv-empty-icon{width:40px;height:40px;border-radius:12px}
.tv-empty--sm .tv-empty-icon svg{width:20px;height:20px}
.tv-empty--sm .tv-empty-title{font-size:14px}
.tv-empty--sm .tv-empty-desc{font-size:13px}

/* ---------- Breadcrumbs ---------- */
.tv-breadcrumbs ol{display:flex;flex-wrap:wrap;align-items:center;gap:6px;margin:0;padding:0;list-style:none;font-family:var(--font-display);font-size:12px;font-weight:500;color:var(--fg-muted)}
.tv-breadcrumbs li{display:inline-flex;align-items:center;gap:6px;min-width:0}
.tv-breadcrumbs li + li::before{content:"/";color:var(--fg-subtle)}
.tv-breadcrumbs a,.tv-breadcrumbs button{padding:2px 0;border:0;border-radius:4px;background:none;color:inherit;font:inherit;text-decoration:none;cursor:pointer;transition:color var(--dur-fast) var(--ease-out)}
.tv-breadcrumbs a:hover,.tv-breadcrumbs button:hover{color:var(--tv-orange-deep)}
.dark .tv-breadcrumbs a:hover,.dark .tv-breadcrumbs button:hover,[data-theme="dark"] .tv-breadcrumbs a:hover,[data-theme="dark"] .tv-breadcrumbs button:hover,.tv-on-dark .tv-breadcrumbs a:hover,.tv-on-dark .tv-breadcrumbs button:hover{color:var(--tv-orange)}
.tv-on-light .tv-breadcrumbs a:hover,.tv-on-light .tv-breadcrumbs button:hover,[data-theme="light"] .tv-breadcrumbs a:hover,[data-theme="light"] .tv-breadcrumbs button:hover{color:var(--tv-orange-deep)}
.tv-breadcrumbs a:focus-visible,.tv-breadcrumbs button:focus-visible{outline:none;box-shadow:var(--focus-ring)}
.tv-breadcrumbs [aria-current="page"]{color:var(--fg);font-weight:600}

/* ---------- Pagination ---------- */
.tv-pagination{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:16px;font-family:var(--font-display)}
.tv-pagination-summary{font-family:var(--font-mono);font-size:12px;color:var(--fg-muted)}
.tv-pagination-pages{display:flex;align-items:center;gap:4px;margin:0;padding:0;list-style:none}
.tv-page{display:inline-flex;align-items:center;justify-content:center;min-width:32px;height:32px;padding:0 8px;border-radius:8px;border:1px solid transparent;background:transparent;color:var(--fg-muted);font-family:var(--font-mono);font-size:12px;cursor:pointer;transition:background var(--dur-fast) var(--ease-out),color var(--dur-fast) var(--ease-out)}
.tv-page:hover{background:var(--surface-d-2);color:var(--fg)}
.tv-page[aria-current="page"]{background:var(--surface-d-3);border-color:var(--border-strong);color:var(--fg);font-weight:500}
.tv-page:focus-visible{outline:none;box-shadow:var(--focus-ring)}
.tv-page[disabled]{opacity:.35;cursor:not-allowed}
.tv-page[disabled]:hover{background:transparent;color:var(--fg-muted)}
.tv-page svg{width:16px;height:16px}
[dir="rtl"] .tv-page svg{transform:scaleX(-1)}
.tv-page-gap{min-width:24px;text-align:center;font-family:var(--font-mono);font-size:12px;color:var(--fg-subtle)}
[data-density="compact"] .tv-page{min-width:28px;height:28px;font-size:11px}

/* ---------- Accordion ---------- */
.tv-accordion{border:1px solid var(--hairline);border-radius:var(--radius-md);background:var(--bg-elevated);font-family:var(--font-display);overflow:hidden}
.tv-accordion-item + .tv-accordion-item{border-block-start:1px solid var(--hairline)}
.tv-accordion-item > summary{display:flex;align-items:center;gap:12px;padding:14px 18px;list-style:none;font-size:14px;font-weight:600;color:var(--fg);cursor:pointer;transition:background var(--dur-fast) var(--ease-out)}
.tv-accordion-item > summary::-webkit-details-marker{display:none}
.tv-accordion-item > summary:hover{background:var(--surface-d-1)}
.tv-accordion-item > summary:focus-visible{outline:none;box-shadow:inset 0 0 0 2px var(--focus)}
.tv-accordion-title{flex:1;min-width:0}
.tv-accordion-meta{font-family:var(--font-mono);font-size:11px;font-weight:500;color:var(--fg-subtle)}
.tv-accordion-chevron{width:16px;height:16px;flex-shrink:0;color:var(--fg-muted);transition:transform var(--dur-base) var(--ease-inout)}
.tv-accordion-item[open] > summary .tv-accordion-chevron{transform:rotate(180deg)}
.tv-accordion-body{padding:0 18px 18px;font-size:13px;line-height:1.55;color:var(--fg-muted)}
.tv-accordion--flush{border:0;border-radius:0;background:transparent}
.tv-accordion--flush .tv-accordion-item > summary{padding-inline:0}
.tv-accordion--flush .tv-accordion-body{padding-inline:0}
[data-density="compact"] .tv-accordion-item > summary{padding:10px 14px;font-size:13px}
[data-density="compact"] .tv-accordion-body{padding:0 14px 14px}
.fw-root {
  color: hsl(var(--foreground));
  max-width: 1400px;
  margin: 0 auto;
  padding: 4px;
}

/* ── Header ──────────────────────────────────────────────────────────── */

.fw-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.fw-header__title {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: hsl(var(--foreground));
  margin: 0;
}

.fw-header__subtitle {
  font-size: 14px;
  color: hsl(var(--muted-foreground));
  margin: 4px 0 0;
}

/* ── KPI grid ────────────────────────────────────────────────────────── */

.fw-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.fw-text-danger {
  color: hsl(var(--destructive));
}

/* ── Table panel ─────────────────────────────────────────────────────── */

.fw-panel__title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  color: hsl(var(--foreground));
  margin: 0 0 12px;
}

.fw-table-scroll {
  overflow-x: auto;
}

.fw-cell-id {
  font-family: var(--font-mono);
  font-size: 13px;
  color: hsl(var(--muted-foreground));
}

.fw-cell-muted {
  color: hsl(var(--muted-foreground));
}

/* `.tv-badge` sets no text-transform; status labels arrive lowercase. */
.fw-root .fw-status {
  text-transform: capitalize;
}

/* ── Responsive ──────────────────────────────────────────────────────── */

@media (max-width: 640px) {
  .fw-header__title {
    font-size: 20px;
  }
}
/*$vite$:1*/