/* EVA OS v2 — app styles.
   Semantic three-theme token system per docs/design/UI_REDESIGN_SCHEMATIC.md §5
   and the token tables in docs/design/SOURCE_SPEC_external_untrusted.md §6–§8.

   Structure:
     1. Theme token blocks (midnight-frost default, midnight-studio, gallery-clay)
        — each block defines the full semantic token set PLUS backward-compat
          aliases so every pre-existing class keeps working in all three themes.
     2. Accessibility overrides (reduce-transparency, reduced-motion, compact).
     3. Base / reset.
     4. Components, in the original file order.

   Rule: no raw hex/rgba colors outside the three token blocks. Components
   consume tokens only. */

/* EVA_VISUAL_LOCK:THEME_TOKENS:START
   Owner-approved visual contract v2026-07-24.2. Do not change theme palettes,
   canvas light, material, icon, or EVA core tokens without explicit approval.
   scripts/verify-visual-lock.mjs enforces this region at launch.
   2026-07-24.2: card radius/blur/shadow updated to match v1's glass-card
   recipe (--r-card 8px→18px, frost --glass-blur gains saturate(150%), all
   three themes' --panel-shadow gain a mid-distance layer) — owner-approved. */
/* ============================================================
   1a. Midnight Frost — DEFAULT (charcoal-blue, teal, frosted glass)
   ============================================================ */
:root,
[data-theme="midnight-frost"] {
  color-scheme: dark;

  /* semantic tokens (spec §7.2, complete) */
  --bg-canvas: #172033;
  --bg-sidebar: #121A2A;
  --surface-1: rgba(255, 255, 255, 0.065);
  --surface-1-solid: #202B3E;
  --surface-2: rgba(255, 255, 255, 0.10);
  --surface-3: #2B3850;
  --border-subtle: rgba(226, 232, 240, 0.14);
  --border-strong: rgba(226, 232, 240, 0.28);
  --text-primary: #F1F5F9;
  --text-secondary: #B3C0D1;
  --text-muted: #8FA0B7;
  --accent-primary: #35E4CC;
  --accent-primary-hover: #18C9B4;
  --accent-secondary: #AA86FF;
  --accent-tertiary: #48C9FF;
  --accent-warm: #FF7F98;
  --focus-ring: #5EEAD4;
  --success: #54EC8C;
  --warning: #FFC83D;
  --danger: #FF7F98;
  --text-on-danger: #2A0711;
  --info: #48C9FF;
  --overlay: rgba(8, 15, 27, 0.68);
  --shadow-color: rgba(2, 8, 23, 0.28);
  --canvas-background:
    radial-gradient(82% 64% at 8% 0%, rgba(73, 95, 255, 0.22) 0%, rgba(23, 32, 51, 0) 64%),
    radial-gradient(80% 70% at 96% 8%, rgba(45, 228, 204, 0.18) 0%, rgba(23, 32, 51, 0) 62%),
    radial-gradient(92% 64% at 52% -24%, rgba(170, 134, 255, 0.20) 0%, rgba(23, 32, 51, 0) 60%),
    linear-gradient(145deg, #10192B 0%, #192640 49%, #101B2E 100%);
  --panel-background: linear-gradient(145deg, rgba(255, 255, 255, 0.095) 0%, rgba(255, 255, 255, 0.050) 48%, rgba(53, 228, 204, 0.035) 100%);
  --panel-border: rgba(226, 232, 240, 0.22);
  --panel-ambient:
    radial-gradient(85% 72% at 0% 0%, rgba(170, 134, 255, 0.09) 0%, rgba(23, 32, 51, 0) 64%),
    radial-gradient(82% 78% at 100% 100%, rgba(53, 228, 204, 0.08) 0%, rgba(23, 32, 51, 0) 66%);
  --panel-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.075), 0 2px 3px rgba(2, 8, 23, 0.32), 0 6px 16px -6px var(--shadow-color), 0 18px 42px rgba(2, 8, 23, 0.26);
  --tile-background: linear-gradient(145deg, rgba(255, 255, 255, 0.105), rgba(255, 255, 255, 0.055));
  --data-field:
    linear-gradient(180deg, rgba(23, 32, 51, 0), rgba(53, 228, 204, 0.055)),
    repeating-linear-gradient(90deg, rgba(170, 134, 255, 0) 0 27px, rgba(170, 134, 255, 0.10) 28px 29px),
    repeating-linear-gradient(0deg, rgba(53, 228, 204, 0) 0 19px, rgba(53, 228, 204, 0.08) 20px 21px);
  --icon-violet: #B28CFF;
  --icon-blue: #54A4FF;
  --icon-teal: #35E4CC;
  --icon-rose: #FF7FBA;
  --icon-amber: #FFC44D;
  --hero-grid: rgba(53, 228, 204, 0.12);
  --hero-orb-core: #35E4CC;
  --hero-orb-mid: #AA86FF;
  --hero-orb-edge: #4B91FF;
  --hero-orb-glow: rgba(170, 134, 255, 0.46);

  /* frost is the only theme with real glass */
  --glass-blur: blur(20px) saturate(150%);

  /* shared, theme-independent tokens (inherited by the other theme blocks
     via :root; radii updated 2026-07-24.2 to match v1's glass-card recipe —
     cards 18px, matching v1's --r-card) */
  --font-sans: "Inter", "Manrope", -apple-system, "SF Pro Display", "Helvetica Neue", ui-sans-serif, system-ui, sans-serif;
  --font-mono: "SF Mono", "JetBrains Mono", ui-monospace, monospace;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --eva-core-size: calc(var(--space-10) * 3 + var(--space-3));
  --eva-core-size-mobile: calc(var(--space-10) * 3);
  --eva-core-cycle: 32s;
  --eva-mesh-top: calc(var(--space-10) * 2 + var(--space-6));
  --eva-mesh-height: calc(var(--space-10) * 16);
  --eva-mesh-perspective: calc(var(--space-10) * 17);
  --eva-mesh-cell-x: var(--space-5);
  --eva-mesh-cell-y: var(--space-4);
  --eva-field-glow-top: calc(var(--space-10) * 3 - var(--space-1));
  --eva-field-glow-height: calc(var(--space-10) * 10 + var(--space-5));
  --eva-field-glow-blur: calc(var(--space-8) - var(--space-1));
  --eva-hero-padding: var(--space-6) var(--space-5) var(--space-5);
  --eva-hero-shadow-y: calc(var(--space-2) * -1);
  --eva-hero-shadow-blur: var(--space-8);
  --eva-hero-shadow-spread: calc(var(--space-8) * -1);
  --eva-hero-glow-blur: var(--space-5);
  --eva-chip-gap: var(--space-2);
  --eva-chip-margin: var(--space-3) 0 var(--space-1);
  --eva-chip-padding: var(--space-1) var(--space-2);
  --eva-core-art-inset: var(--space-2);
  --eva-core-halo-inset: calc(var(--space-2) * -1);
  --eva-core-perspective: calc(var(--space-10) * 6 + var(--space-5));
  --eva-core-control-size: var(--space-10);
  --eva-core-icon-size: var(--space-5);
  --eva-core-glow-near: var(--space-6);
  --eva-core-glow-far: calc(var(--space-10) + var(--space-6));
  --eva-core-form-glow: var(--space-2);
  --eva-status-height: var(--space-4);
  --eva-thread-max-height: calc(var(--space-10) * 3);
  /* Fixed frame for the EVA card. The conversation scrolls inside this — it
     never stretches the card, and the card never stretches the dashboard row. */
  --eva-card-min-height: 380px;
  --eva-input-gap: var(--space-2);
  --eva-input-margin: var(--space-3);
  --r-card: 18px;
  --r-control: 6px;
  --r-pill: 999px;
  --shadow-card: 0 1px 2px var(--shadow-color), 0 8px 24px -8px var(--shadow-color);

  /* backward-compat aliases (names web/app.js markup + legacy rules rely on) */
  --bg-void: var(--bg-canvas);
  --bg-deep: var(--bg-sidebar);
  --bg-panel: var(--surface-1-solid);
  --surface-glass: var(--surface-1);
  --surface-glass-hover: var(--surface-2);
  --surface-glass-strong: var(--surface-3);
  --border-glass: var(--border-subtle);
  --border-glass-strong: var(--border-strong);
  --mint: var(--accent-primary);
  --teal: var(--accent-primary-hover);
  --blue: var(--accent-tertiary);
  --purple: var(--accent-secondary);
  --accent-grad: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-primary-hover) 100%);
  --text-on-accent: #08201B;
}

/* ============================================================
   1b. Midnight Studio (deep navy, slate, violet + electric blue)
   ============================================================ */
[data-theme="midnight-studio"] {
  color-scheme: dark;

  /* semantic tokens (spec §6.2, complete) */
  --bg-canvas: #0F172A;
  --bg-sidebar: #0B1220;
  --surface-1: #1E293B;
  --surface-1-solid: #1E293B;
  --surface-2: #263449;
  --surface-3: #334155;
  --border-subtle: #334155;
  --border-strong: #475569;
  --text-primary: #F8FAFC;
  --text-secondary: #A8B4C5;
  --text-muted: #7F8EA3;
  --accent-primary: #9C6CFF;
  --accent-primary-hover: #8B4EFF;
  --accent-secondary: #4B91FF;
  --focus-ring: #B496FF;
  --success: #3DE4AA;
  --warning: #FFC43A;
  --danger: #FF7E9A;
  --text-on-danger: #260711;
  --info: #70B2FF;
  --overlay: rgba(2, 6, 23, 0.72);
  --shadow-color: rgba(0, 0, 0, 0.36);
  --accent-tertiary: #4B91FF;
  --canvas-background:
    radial-gradient(80% 70% at 5% 0%, rgba(59, 92, 246, 0.25) 0%, rgba(15, 23, 42, 0) 66%),
    radial-gradient(78% 72% at 98% 5%, rgba(23, 196, 177, 0.17) 0%, rgba(15, 23, 42, 0) 64%),
    radial-gradient(92% 64% at 54% -28%, rgba(156, 108, 255, 0.24) 0%, rgba(15, 23, 42, 0) 60%),
    linear-gradient(148deg, #060C1A 0%, #111C34 52%, #071221 100%);
  --panel-background: linear-gradient(145deg, #202D45 0%, #18263B 54%, #13283A 100%);
  --panel-border: #3A4B66;
  --panel-ambient:
    radial-gradient(86% 74% at 0% 0%, rgba(156, 108, 255, 0.12) 0%, rgba(30, 41, 59, 0) 64%),
    radial-gradient(82% 78% at 100% 100%, rgba(61, 228, 170, 0.08) 0%, rgba(30, 41, 59, 0) 68%);
  --panel-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.055), 0 2px 3px rgba(0, 0, 0, 0.34), 0 6px 16px -6px var(--shadow-color), 0 20px 44px rgba(0, 0, 0, 0.30);
  --tile-background: linear-gradient(145deg, #293851, #233149);
  --data-field:
    linear-gradient(180deg, rgba(15, 23, 42, 0), rgba(75, 145, 255, 0.055)),
    repeating-linear-gradient(90deg, rgba(156, 108, 255, 0) 0 27px, rgba(156, 108, 255, 0.10) 28px 29px),
    repeating-linear-gradient(0deg, rgba(75, 145, 255, 0) 0 19px, rgba(75, 145, 255, 0.08) 20px 21px);
  --icon-violet: #AD84FF;
  --icon-blue: #58A0FF;
  --icon-teal: #3DE4C5;
  --icon-rose: #FF7EB7;
  --icon-amber: #FFC14B;
  --hero-grid: rgba(112, 178, 255, 0.12);
  --hero-orb-core: #70B2FF;
  --hero-orb-mid: #9C6CFF;
  --hero-orb-edge: #4B91FF;
  --hero-orb-glow: rgba(156, 108, 255, 0.56);

  /* solid surfaces — no glass */
  --glass-blur: none;

  /* backward-compat aliases */
  --bg-void: var(--bg-canvas);
  --bg-deep: var(--bg-sidebar);
  --bg-panel: var(--surface-1);
  --surface-glass: var(--surface-1);
  --surface-glass-hover: var(--surface-2);
  --surface-glass-strong: var(--surface-3);
  --border-glass: var(--border-subtle);
  --border-glass-strong: var(--border-strong);
  --mint: var(--accent-primary);
  --teal: var(--accent-primary-hover);
  --blue: var(--accent-secondary);
  --purple: var(--accent-primary);
  --accent-grad: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-primary-hover) 100%);
  --text-on-accent: #FFFFFF;
}

/* ============================================================
   1c. Gallery Clay (warm cream, white, ink, burnt orange — LIGHT)
   ============================================================ */
[data-theme="gallery-clay"] {
  color-scheme: light;

  /* semantic tokens (spec §8.2, complete) */
  --bg-canvas: #F7F3E8;
  --bg-sidebar: #FDFCF6;
  --surface-1: #FFFFFF;
  --surface-1-solid: #FFFFFF;
  --surface-2: #F3EFE6;
  --surface-3: #EAE4D8;
  --border-subtle: #DDD7CC;
  --border-strong: #BEB5A8;
  --text-primary: #211C18;
  --text-secondary: #665F58;
  --text-muted: #817971;
  --accent-primary: #D64B0B;
  --accent-primary-hover: #B83B0D;
  --accent-secondary: #087356;
  --accent-tertiary: #2A5FE6;
  --focus-ring: #D64B0B;
  --success: #168B43;
  --warning: #B46D05;
  --danger: #CF2525;
  --text-on-danger: #FFFFFF;
  --info: #2A5FE6;
  --overlay: rgba(33, 28, 24, 0.42);
  --shadow-color: rgba(69, 26, 3, 0.10);
  --canvas-background:
    radial-gradient(78% 70% at 4% 0%, rgba(42, 95, 230, 0.13) 0%, rgba(247, 243, 232, 0) 64%),
    radial-gradient(74% 70% at 98% 4%, rgba(8, 115, 86, 0.12) 0%, rgba(247, 243, 232, 0) 64%),
    radial-gradient(88% 62% at 54% -30%, rgba(214, 75, 11, 0.15) 0%, rgba(247, 243, 232, 0) 62%),
    linear-gradient(155deg, #FFF9EE 0%, #F7F1E4 56%, #EEE7D9 100%);
  --panel-background: linear-gradient(145deg, #FFFFFF 0%, #FFFCF7 56%, #F6F0E5 100%);
  --panel-border: #D6C9B8;
  --panel-ambient:
    radial-gradient(84% 72% at 0% 0%, rgba(42, 95, 230, 0.075) 0%, rgba(255, 255, 255, 0) 64%),
    radial-gradient(82% 78% at 100% 100%, rgba(8, 115, 86, 0.07) 0%, rgba(255, 255, 255, 0) 68%);
  --panel-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.90), 0 2px 3px rgba(69, 26, 3, 0.10), 0 6px 16px -6px var(--shadow-color), 0 18px 40px rgba(69, 26, 3, 0.09);
  --tile-background: linear-gradient(145deg, #FFFDFC, #F2ECE1);
  --data-field:
    linear-gradient(180deg, rgba(247, 243, 232, 0), rgba(8, 115, 86, 0.045)),
    repeating-linear-gradient(90deg, rgba(42, 95, 230, 0) 0 27px, rgba(42, 95, 230, 0.075) 28px 29px),
    repeating-linear-gradient(0deg, rgba(8, 115, 86, 0) 0 19px, rgba(8, 115, 86, 0.065) 20px 21px);
  --icon-violet: #7C3AED;
  --icon-blue: #2A5FE6;
  --icon-teal: #087356;
  --icon-rose: #D8356F;
  --icon-amber: #C97908;
  --hero-grid: rgba(8, 115, 86, 0.10);
  --hero-orb-core: #2A5FE6;
  --hero-orb-mid: #D64B0B;
  --hero-orb-edge: #087356;
  --hero-orb-glow: rgba(214, 75, 11, 0.27);

  /* crisp solid surfaces — no glass */
  --glass-blur: none;

  /* backward-compat aliases */
  --bg-void: var(--bg-canvas);
  --bg-deep: var(--surface-2);
  --bg-panel: var(--surface-1);
  --surface-glass: var(--surface-1);
  --surface-glass-hover: var(--surface-2);
  --surface-glass-strong: var(--surface-3);
  --border-glass: var(--border-subtle);
  --border-glass-strong: var(--border-strong);
  --mint: var(--accent-primary);
  --teal: var(--accent-secondary);
  --blue: var(--accent-tertiary);
  --purple: var(--accent-secondary);
  --accent-grad: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-primary-hover) 100%);
  --text-on-accent: #FFFFFF;
}

/* ============================================================
   1d. Executive Glass — Mission Control redesign, DARK
   Palette is verbatim from docs/design/MISSION_CONTROL_CLAUDE_HANDOFF.md §6
   ("Dark Mode: Executive Glass"). Every hex below either appears in that
   table or is derived from one with color-mix — no invented colors.

   Role assignment follows handoff §7 "Visual Rules":
     - EVA teal   -> --eva-accent + the orb/EVA-only surfaces
     - Violet     -> --accent-primary (strategic actions, premium emphasis)
     - Blue       -> --accent-secondary (selected/informational)
     - Rose/amber -> review, risk, warning only
   ============================================================ */
[data-theme="executive-glass"] {
  color-scheme: dark;

  --bg-canvas: #0B1020;
  --bg-sidebar: #080D18;
  --surface-1: rgba(21, 31, 51, 0.72);
  --surface-1-solid: #151F33;
  --surface-2: #1B2942;
  --surface-3: #24334F;
  --border-subtle: #33435F;
  --border-strong: color-mix(in srgb, #33435F 76%, #F6F8FC);
  --text-primary: #F6F8FC;
  --text-secondary: #AAB7C8;
  --text-muted: #75849B;
  --accent-primary: #8B6CFF;
  --accent-primary-hover: #A78BFA;
  --accent-secondary: #4B91FF;
  --accent-tertiary: #35E4CC;
  --accent-warm: #F26D7D;
  --eva-accent: #35E4CC;
  --field-black: #020617;
  --focus-ring: #A78BFA;
  --success: #35D08A;
  --warning: #F5B84B;
  --danger: #F26D7D;
  --text-on-danger: #2A0711;
  --info: #4B91FF;
  --overlay: rgba(2, 6, 23, 0.74);
  --shadow-color: rgba(2, 6, 23, 0.46);
  --canvas-background:
    radial-gradient(84% 62% at 6% 0%, rgba(139, 108, 255, 0.20) 0%, rgba(11, 16, 32, 0) 62%),
    radial-gradient(78% 66% at 97% 5%, rgba(75, 145, 255, 0.16) 0%, rgba(11, 16, 32, 0) 60%),
    radial-gradient(92% 60% at 52% -24%, rgba(53, 228, 204, 0.11) 0%, rgba(11, 16, 32, 0) 58%),
    linear-gradient(150deg, #080D18 0%, #0E1526 52%, #070B16 100%);
  --panel-background: linear-gradient(145deg, rgba(255, 255, 255, 0.075) 0%, rgba(255, 255, 255, 0.032) 48%, rgba(139, 108, 255, 0.038) 100%);
  --panel-border: rgba(51, 67, 95, 0.92);
  --panel-ambient:
    radial-gradient(85% 72% at 0% 0%, rgba(139, 108, 255, 0.10) 0%, rgba(11, 16, 32, 0) 64%),
    radial-gradient(82% 78% at 100% 100%, rgba(75, 145, 255, 0.08) 0%, rgba(11, 16, 32, 0) 66%);
  --panel-shadow: inset 0 1px 0 rgba(246, 248, 252, 0.070), 0 2px 3px rgba(2, 6, 23, 0.42), 0 8px 20px -8px var(--shadow-color), 0 22px 48px rgba(2, 6, 23, 0.34);
  --tile-background: linear-gradient(145deg, rgba(27, 41, 66, 0.94), rgba(21, 31, 51, 0.94));
  --data-field:
    linear-gradient(180deg, rgba(11, 16, 32, 0), rgba(139, 108, 255, 0.055)),
    repeating-linear-gradient(90deg, rgba(167, 139, 250, 0) 0 27px, rgba(167, 139, 250, 0.10) 28px 29px),
    repeating-linear-gradient(0deg, rgba(75, 145, 255, 0) 0 19px, rgba(75, 145, 255, 0.08) 20px 21px);
  --icon-violet: #A78BFA;
  --icon-blue: #4B91FF;
  --icon-teal: #35E4CC;
  --icon-rose: #F26D7D;
  --icon-amber: #F5B84B;
  --hero-grid: rgba(53, 228, 204, 0.13);
  --hero-orb-core: #35E4CC;
  --hero-orb-mid: #8B6CFF;
  --hero-orb-edge: #4B91FF;
  --hero-orb-glow: rgba(139, 108, 255, 0.46);

  /* the executive glass command layer */
  --glass-blur: blur(22px) saturate(145%);

  /* backward-compat aliases */
  --bg-void: var(--bg-canvas);
  --bg-deep: var(--field-black);
  --bg-panel: var(--surface-1-solid);
  --surface-glass: var(--surface-1);
  --surface-glass-hover: var(--surface-2);
  --surface-glass-strong: var(--surface-3);
  --border-glass: var(--border-subtle);
  --border-glass-strong: var(--border-strong);
  --mint: var(--eva-accent);
  --teal: var(--eva-accent);
  --blue: var(--accent-secondary);
  --purple: var(--accent-primary);
  --accent-grad: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-primary-hover) 100%);
  --text-on-accent: #0B1020;
}

/* ============================================================
   1e. Executive Daylight — Mission Control redesign, LIGHT
   Palette is verbatim from docs/design/MISSION_CONTROL_CLAUDE_HANDOFF.md §6
   ("Light Mode: Executive Daylight"). Same information architecture and the
   same token roles as Executive Glass — a theme switch is a token swap.
   ============================================================ */
[data-theme="executive-daylight"] {
  color-scheme: light;

  --bg-canvas: #F6F8FC;
  --bg-sidebar: #FFFFFF;
  --surface-1: rgba(255, 255, 255, 0.78);
  --surface-1-solid: #FFFFFF;
  --surface-2: #EAF1FA;
  --surface-3: color-mix(in srgb, #EAF1FA 62%, #B9C7DA);
  --border-subtle: #D8E1EE;
  --border-strong: #B9C7DA;
  --text-primary: #172033;
  --text-secondary: #526174;
  --text-muted: #7A8798;
  --accent-primary: #7057FF;
  --accent-primary-hover: color-mix(in srgb, #7057FF 82%, #172033);
  --accent-secondary: #2563EB;
  --accent-tertiary: #00A99D;
  --accent-warm: #D84F68;
  --eva-accent: #00A99D;
  --field-black: #EEF3FA;
  --focus-ring: #7057FF;
  --success: #168B5B;
  --warning: #B7791F;
  --danger: #D84F68;
  --text-on-danger: #FFFFFF;
  --info: #2563EB;
  --overlay: rgba(23, 32, 51, 0.42);
  --shadow-color: rgba(23, 32, 51, 0.12);
  --canvas-background:
    radial-gradient(80% 64% at 5% 0%, rgba(112, 87, 255, 0.13) 0%, rgba(246, 248, 252, 0) 62%),
    radial-gradient(76% 66% at 98% 4%, rgba(37, 99, 235, 0.11) 0%, rgba(246, 248, 252, 0) 62%),
    radial-gradient(90% 58% at 52% -26%, rgba(0, 169, 157, 0.10) 0%, rgba(246, 248, 252, 0) 58%),
    linear-gradient(152deg, #FFFFFF 0%, #F2F6FC 54%, #E9F0F9 100%);
  --panel-background: linear-gradient(145deg, rgba(255, 255, 255, 0.92) 0%, rgba(255, 255, 255, 0.72) 48%, rgba(234, 241, 250, 0.66) 100%);
  --panel-border: #D8E1EE;
  --panel-ambient:
    radial-gradient(84% 72% at 0% 0%, rgba(112, 87, 255, 0.075) 0%, rgba(255, 255, 255, 0) 64%),
    radial-gradient(82% 78% at 100% 100%, rgba(37, 99, 235, 0.065) 0%, rgba(255, 255, 255, 0) 68%);
  --panel-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.92), 0 2px 3px rgba(23, 32, 51, 0.07), 0 8px 20px -10px var(--shadow-color), 0 22px 46px rgba(23, 32, 51, 0.08);
  --tile-background: linear-gradient(145deg, #FFFFFF, #EAF1FA);
  --data-field:
    linear-gradient(180deg, rgba(246, 248, 252, 0), rgba(112, 87, 255, 0.05)),
    repeating-linear-gradient(90deg, rgba(112, 87, 255, 0) 0 27px, rgba(112, 87, 255, 0.075) 28px 29px),
    repeating-linear-gradient(0deg, rgba(37, 99, 235, 0) 0 19px, rgba(37, 99, 235, 0.065) 20px 21px);
  --icon-violet: #7057FF;
  --icon-blue: #2563EB;
  --icon-teal: #00A99D;
  --icon-rose: #D84F68;
  --icon-amber: #B7791F;
  --hero-grid: rgba(37, 99, 235, 0.11);
  --hero-orb-core: #00A99D;
  --hero-orb-mid: #7057FF;
  --hero-orb-edge: #2563EB;
  --hero-orb-glow: rgba(112, 87, 255, 0.30);

  /* daylight glass: frosted white command layer, still legible */
  --glass-blur: blur(18px) saturate(125%);

  /* backward-compat aliases */
  --bg-void: var(--bg-canvas);
  --bg-deep: var(--field-black);
  --bg-panel: var(--surface-1-solid);
  --surface-glass: var(--surface-1);
  --surface-glass-hover: var(--surface-2);
  --surface-glass-strong: var(--surface-3);
  --border-glass: var(--border-subtle);
  --border-glass-strong: var(--border-strong);
  --mint: var(--eva-accent);
  --teal: var(--eva-accent);
  --blue: var(--accent-secondary);
  --purple: var(--accent-primary);
  --accent-grad: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-primary-hover) 100%);
  --text-on-accent: #FFFFFF;
}
/* EVA_VISUAL_LOCK:THEME_TOKENS:END */

/* Fallback for the EVA-only accent introduced by the Mission Control redesign.
   `html` (0,0,1) is deliberately weaker than any [data-theme] block (0,1,0) and
   than :root (0,1,0), so the Executive themes' own value always wins and the
   three legacy themes fall back to their primary accent. */
html { --eva-accent: var(--accent-primary); }

/* ============================================================
   2. Accessibility + density overrides
   ============================================================ */
/* Reduce transparency (spec §11.4): swap frosted surfaces for the solid
   fallback and drop the blur. html.* beats [data-theme] on specificity. */
html.reduce-transparency {
  --surface-1: var(--surface-1-solid);
  --glass-blur: none;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition: none !important;
    animation: none !important;
    scroll-behavior: auto !important;
  }
}

/* Compact density: tighter paddings, never smaller touch targets. */
html.compact .card, html.compact .module-card { padding: 14px; }
html.compact .kpi { padding: 12px 14px; }
html.compact .setting-row { padding: 10px 0; }
html.compact main.content { padding: 18px 22px 44px; }
html.compact .nav-item { padding: 7px 11px; }

/* ============================================================
   3. Base / reset
   ============================================================ */
* { box-sizing: border-box; }
html, body { min-height: 100%; }
html { background: var(--bg-canvas); }
body {
  margin: 0;
  min-width: 0;
  overflow-x: hidden;
  background: var(--canvas-background);
  background-attachment: fixed;
  color: var(--text-primary);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: inherit; }
button, input, select, textarea { font: inherit; }
.ui-icon { width: 18px; height: 18px; display: block; flex: none; }
.skip-link {
  position: fixed; left: var(--space-4); top: var(--space-4); z-index: 120;
  transform: translateY(-140%); padding: 10px 14px;
  background: var(--surface-1-solid); color: var(--text-primary);
  border: 1px solid var(--focus-ring); border-radius: var(--r-control);
}
.skip-link:focus { transform: translateY(0); }

/* visible keyboard focus, every theme (spec §13.3) */
.btn:focus-visible,
.field:focus-visible,
.nav-item:focus-visible,
.iconbtn:focus-visible,
.userbtn:focus-visible,
.mobile-menu-btn:focus-visible,
.mobile-bottom-nav button:focus-visible,
.hv-orb:focus-visible,
.wrow[role="button"]:focus-visible,
[data-open]:focus-visible,
a:focus-visible,
select:focus-visible,
input:focus-visible,
[role="radio"]:focus-visible,
[role="switch"]:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

/* ---------- utility ---------- */
/* v1's glass card layers a soft top-highlight ("sheen") over the translucent
   panel color; --panel-background is the already-approved per-theme
   equivalent, just not previously wired into the generic card surface. */
.glass {
  background: var(--panel-background), var(--surface-1);
  border: 1px solid var(--panel-border, var(--border-subtle));
  border-radius: var(--r-card);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  box-shadow: var(--panel-shadow, var(--shadow-card));
}
.muted { color: var(--text-secondary); }
.dim { color: var(--text-muted); }
.mono { font-family: var(--font-mono); }
.row { display: flex; align-items: center; gap: 10px; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.hidden { display: none !important; }

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 12px; border-radius: var(--r-pill);
  font-size: 12px; font-weight: 600; letter-spacing: 0.2px;
}
.pill-live {
  background: color-mix(in srgb, var(--success) 14%, transparent);
  color: var(--success);
  border: 1px solid color-mix(in srgb, var(--success) 34%, transparent);
}
.pill-soon {
  background: color-mix(in srgb, var(--warning) 14%, transparent);
  color: var(--warning);
  border: 1px solid color-mix(in srgb, var(--warning) 34%, transparent);
}
.pill-dim {
  background: var(--surface-2);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}

.btn {
  border: 1px solid var(--border-subtle);
  background: var(--surface-2);
  color: var(--text-primary);
  border-radius: var(--r-control);
  padding: 10px 16px; font-size: 14px; font-weight: 600; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  transition: background .12s, border-color .12s, transform .05s;
}
.btn:hover { background: var(--surface-3); border-color: var(--border-strong); }
.btn:active { transform: translateY(1px); }
.btn.accent {
  border: none; color: var(--text-on-accent); font-weight: 700;
  background: var(--accent-grad);
}
.btn.accent:hover { background: var(--accent-primary-hover); }
.btn.danger {
  border: 1px solid var(--danger); color: var(--danger); background: transparent;
}
.btn.danger:hover { background: var(--danger); color: var(--text-on-danger); }
.btn.sm { padding: 7px 12px; font-size: 13px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* icon + label rows for card/section headers (matches Mission Control's
   icon(sparkles)+text pattern, e.g. .dash-foot) */
.ico-row { display: flex; align-items: center; gap: 8px; }
.ico-sm { width: 15px; height: 15px; }

input.field, select.field, textarea.field {
  width: 100%;
  background: var(--bg-deep);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-control);
  color: var(--text-primary);
  padding: 11px 13px; font-size: 14px; outline: none;
  transition: border-color .12s, box-shadow .12s;
}
input.field:focus, select.field:focus, textarea.field:focus {
  border-color: var(--focus-ring);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus-ring) 14%, transparent);
}
/* Textareas were falling back to raw browser chrome (no bg/border/padding) —
   this is the fix. min-height makes the primary-input textareas (Quick Idea,
   Blog topics, etc.) read as generously-sized, not a cramped afterthought. */
textarea.field {
  min-height: 120px;
  line-height: 1.55;
  font-family: inherit;
}
/* Native select arrows read as cheap browser chrome — draw our own chevron
   and hide the default one. */
select.field {
  appearance: none; -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-secondary) 50%),
    linear-gradient(135deg, var(--text-secondary) 50%, transparent 50%);
  background-position: calc(100% - 18px) calc(50% - 2px), calc(100% - 13px) calc(50% - 2px);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 34px;
  cursor: pointer;
}
select.field::-ms-expand { display: none; }
label.lbl { display: block; font-size: 12px; color: var(--text-secondary); margin: 0 0 6px 2px; letter-spacing: .3px; }

/* ---------- auth screen ---------- */
#auth {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px;
}
.auth-card { width: 100%; max-width: 420px; padding: 32px; }
.auth-logo { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.logo-badge {
  width: 40px; height: 40px; border-radius: var(--r-card); display: grid; place-items: center;
  background: var(--accent-grad); color: var(--text-on-accent); font-weight: 800; font-size: 20px;
  box-shadow: 0 0 24px color-mix(in srgb, var(--accent-primary) 25%, transparent);
}
.auth-title { font-size: 22px; font-weight: 800; letter-spacing: -.3px; }
.auth-sub { color: var(--text-secondary); font-size: 13px; margin: 4px 0 22px; }
.auth-toggle { display: flex; gap: 4px; background: var(--bg-deep); border-radius: var(--r-control); padding: 4px; margin-bottom: 20px; }
.auth-toggle button {
  flex: 1; border: none; background: transparent; color: var(--text-secondary);
  padding: 9px; border-radius: var(--r-control); font-weight: 600; cursor: pointer; font-size: 13px;
}
.auth-toggle button.on { background: var(--surface-3); color: var(--text-primary); }
.auth-form > * + * { margin-top: 14px; }
.auth-err { color: var(--danger); font-size: 13px; min-height: 18px; margin-top: 6px; }

/* ---------- app shell ---------- */
#app { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
aside.sidebar {
  border-right: 1px solid var(--border-subtle);
  background: var(--bg-sidebar);
  padding: 18px 12px; display: flex; flex-direction: column; gap: 4px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto; z-index: 45;
}
.brand { display: flex; align-items: center; gap: 11px; min-height: 44px; padding: 2px 8px 16px; }
.brand .name { font-weight: 700; font-size: 17px; letter-spacing: -.3px; }
.brand .name small { display: block; font-size: 11px; color: var(--text-secondary); font-weight: 500; letter-spacing: .3px; }
.eva-mark {
  position: relative; width: 34px; height: 34px; flex: none; border-radius: 50%;
  background: conic-gradient(from 210deg, var(--accent-tertiary), var(--accent-secondary), var(--accent-primary), var(--accent-tertiary));
  box-shadow: 0 0 20px color-mix(in srgb, var(--accent-secondary) 24%, transparent);
}
.eva-mark::before {
  content: ""; position: absolute; inset: 5px; border-radius: inherit;
  background: var(--bg-sidebar); box-shadow: inset 0 0 10px var(--shadow-color);
}
.eva-mark span {
  position: absolute; width: 8px; height: 8px; right: 3px; top: 3px; border-radius: 50%;
  background: var(--text-primary); filter: blur(.2px); opacity: .8;
}
.primary-nav { display: flex; flex-direction: column; gap: 4px; }
.nav-group { font-size: 10px; text-transform: uppercase; letter-spacing: 1.2px; color: var(--text-muted); margin: 16px 10px 6px; }
.nav-item {
  width: 100%; min-height: 42px; display: flex; align-items: center; gap: 11px; padding: 9px 11px; border-radius: var(--r-control);
  color: var(--text-secondary); cursor: pointer; font-size: 14px; font-weight: 600;
  text-align: left; background: transparent;
  border: 1px solid transparent; transition: background .12s, color .12s, border-color .12s;
}
.nav-item .ico { width: 18px; display: grid; place-items: center; }
.nav-item .tag { margin-left: auto; }
.nav-item:hover { background: var(--surface-2); color: var(--text-primary); }
.nav-item.active {
  background: var(--surface-3); color: var(--text-primary); border-color: var(--border-subtle);
  box-shadow: inset 3px 0 0 0 var(--accent-primary);
}
.sidebar-foot { margin-top: auto; padding: 12px 10px 4px; border-top: 1px solid var(--border-subtle); }
.sidebar-foot .plan { font-size: 12px; color: var(--text-secondary); }
.sidebar-foot .plan b { color: var(--text-primary); }

main.content { min-width: 0; padding: 0 20px 48px; overflow: visible; }
.topbar {
  min-height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 16px;
  margin-bottom: 12px; border-bottom: 1px solid var(--border-subtle);
}
.topbar .agency { display: flex; align-items: center; gap: 12px; }
.avatar {
  width: 34px; height: 34px; border-radius: var(--r-pill); display: grid; place-items: center;
  background: radial-gradient(circle at 30% 24%, var(--accent-tertiary), var(--accent-secondary) 42%, var(--surface-3) 78%);
  border: 1px solid var(--border-strong); font-weight: 700; font-size: 13px;
  box-shadow: inset 0 0 12px var(--shadow-color);
}
.h1 { font-size: 28px; line-height: 36px; font-weight: 700; letter-spacing: 0; margin: 0; }
.sub { color: var(--text-secondary); font-size: 14px; margin: 4px 0 0; }

/* ---------- cards / grids ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 22px; }
.kpi { padding: 18px; }
.kpi .k { font-size: 12px; color: var(--text-secondary); letter-spacing: .3px; }
.kpi .v { font-size: 28px; font-weight: 700; margin-top: 8px; letter-spacing: 0; font-variant-numeric: tabular-nums; }
.kpi .v.mint { color: var(--accent-primary); }

.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: 1px; color: var(--text-muted); margin: 26px 0 12px; }
.card { padding: 20px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } }

.module-card { padding: 20px; display: flex; flex-direction: column; gap: 10px; }
.module-card .mhead { display: flex; align-items: center; justify-content: space-between; }
.module-card .mico { font-size: 22px; }
.module-card .mname { font-weight: 600; font-size: 16px; }
.module-card .mdesc { color: var(--text-secondary); font-size: 13px; line-height: 1.5; }

.client-list { display: flex; flex-direction: column; gap: 8px; }
.module-card.client-row-wrap { padding: 0; gap: 0; }
.client-row-wrap .client-row { padding: 14px 20px; cursor: pointer; }
.client-row-wrap .client-row:hover { background: var(--surface-2); }
.client-row-wrap .client-detail { padding: 0 20px 20px; }

.empty {
  padding: 40px 24px; text-align: center; color: var(--text-secondary); font-size: 14px;
  border: 1px dashed var(--border-subtle); border-radius: var(--r-card);
}

/* ---------- settings / toggles ---------- */
.setting-row {
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
  padding: 16px 0; border-bottom: 1px solid var(--border-subtle);
}
.setting-row:last-child { border-bottom: none; }
.setting-row .st-label { font-weight: 600; font-size: 14px; }
.setting-row .st-desc { color: var(--text-secondary); font-size: 12.5px; margin-top: 3px; line-height: 1.45; max-width: 520px; }

.switch { position: relative; width: 46px; height: 26px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
  position: absolute; inset: 0; cursor: pointer; border-radius: var(--r-pill);
  background: var(--bg-deep); border: 1px solid var(--border-subtle); transition: .2s;
}
.switch .slider::before {
  content: ""; position: absolute; height: 18px; width: 18px; left: 3px; top: 3px;
  background: var(--text-secondary); border-radius: 50%; transition: .2s;
}
.switch input:checked + .slider {
  background: color-mix(in srgb, var(--accent-primary) 22%, transparent);
  border-color: color-mix(in srgb, var(--accent-primary) 55%, transparent);
}
.switch input:checked + .slider::before { transform: translateX(20px); background: var(--accent-primary); }
.switch input:focus-visible + .slider { outline: 2px solid var(--focus-ring); outline-offset: 2px; }

.seg { display: inline-flex; background: var(--bg-deep); border-radius: var(--r-control); padding: 4px; gap: 3px; }
.seg button { border: none; background: transparent; color: var(--text-secondary); padding: 7px 13px; border-radius: var(--r-control); cursor: pointer; font-size: 13px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
.seg button.on { background: var(--surface-3); color: var(--text-primary); }

.conn-row { display: flex; align-items: center; justify-content: space-between; padding: 16px; }
.conn-row + .conn-row { margin-top: 12px; }
.conn-left { display: flex; align-items: center; gap: 14px; }
.conn-ico { width: 40px; height: 40px; border-radius: var(--r-card); display: grid; place-items: center; font-size: 20px; background: var(--surface-3); border: 1px solid var(--border-subtle); }

.saved-flash { color: var(--success); font-size: 12px; opacity: 0; transition: opacity .2s; }
.saved-flash.show { opacity: 1; }

/* ---------- modal ---------- */
.modal-back { position: fixed; inset: 0; background: var(--overlay); display: grid; place-items: center; z-index: 50; padding: 20px; }
.modal {
  width: 100%; max-width: 560px; padding: 26px;
  backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur);
}
.modal h3 { margin: 0 0 6px; font-size: 18px; }
.modal .u { word-break: break-all; font-size: 12px; background: var(--bg-deep); border: 1px solid var(--border-subtle); border-radius: var(--r-control); padding: 12px; margin: 14px 0; color: var(--text-secondary); }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--surface-1-solid); border: 1px solid var(--border-strong); border-radius: var(--r-control);
  backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur);
  padding: 12px 18px; font-size: 14px; box-shadow: var(--shadow-card); opacity: 0; transition: .2s; z-index: 60;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- settings: theme selector (web/views/settings.js) ---------- */
.theme-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px; margin: 6px 0 8px;
}
.theme-tile {
  position: relative; cursor: pointer; text-align: left;
  background: var(--surface-2); border: 1px solid var(--border-subtle);
  border-radius: var(--r-card); padding: 12px;
  transition: border-color .12s, background .12s;
}
.theme-tile:hover { border-color: var(--border-strong); }
.theme-tile[aria-checked="true"] {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 1px var(--accent-primary), var(--shadow-card);
}
.theme-tile .tt-name { font-weight: 600; font-size: 14px; margin-top: 10px; }
.theme-tile .tt-desc { color: var(--text-secondary); font-size: 12px; margin-top: 2px; }
.theme-tile .tt-check {
  position: absolute; top: 10px; right: 10px;
  width: 20px; height: 20px; border-radius: 50%;
  display: grid; place-items: center; font-size: 12px;
  background: var(--accent-primary); color: var(--text-on-accent);
  opacity: 0; transition: opacity .12s;
}
.theme-tile[aria-checked="true"] .tt-check { opacity: 1; }
/* miniature mock — its colors are the target theme's literal palette,
   set inline in settings.js (the one sanctioned hardcoded-color exception) */
.theme-mini {
  display: flex; height: 72px; border-radius: var(--r-control);
  overflow: hidden; border: 1px solid var(--border-subtle);
}
.theme-mini .tm-side { width: 22%; flex: none; }
.theme-mini .tm-canvas { flex: 1; display: flex; flex-direction: column; gap: 6px; padding: 8px; }
.theme-mini .tm-chip { height: 26px; border-radius: 4px; }
.theme-mini .tm-dots { display: flex; gap: 5px; }
.theme-mini .tm-dot { width: 10px; height: 10px; border-radius: 50%; }

/* ============================================================
   5. Mission Control dashboard grid (schematic §3 — 12-col, spec §3.1)
   ============================================================ */
.dash-head { min-height: 80px; display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.dash-eyebrow { font-size: 12px; font-weight: 500; color: var(--text-muted); letter-spacing: .3px; margin-bottom: 4px; }
.dash-status { font-size: 14px; color: var(--text-secondary); margin-top: 4px; }

.dash-grid { display: grid; grid-template-columns: repeat(24, minmax(0, 1fr)); gap: 16px; }
.dash-grid > * { min-width: 0; }
.sp2 { grid-column: span 4; } .sp3 { grid-column: span 6; } .sp4 { grid-column: span 8; } .sp5 { grid-column: span 10; }
.sp7 { grid-column: span 14; } .sp8 { grid-column: span 16; } .sp12 { grid-column: span 24; }
.dash-grid > :nth-child(2) { grid-column: span 7; }
.dash-grid > :nth-child(4) { grid-column: span 5; }
@media (max-width: 1439px) {
  .sp2, .sp3, .sp4, .sp5, .sp7, .sp8,
  .dash-grid > :nth-child(2) { grid-column: span 24; }
  .dash-grid > :nth-child(3),
  .dash-grid > :nth-child(4) { grid-column: span 12; }
}
@media (max-width: 640px) { .sp3 { grid-column: span 24; } }

.panel {
  --panel-accent: var(--accent-primary);
  position: relative; isolation: isolate; overflow: hidden;
  padding: 16px; display: flex; flex-direction: column; min-height: 0;
  background: var(--panel-background);
  border-color: color-mix(in srgb, var(--panel-accent) 20%, var(--panel-border));
  box-shadow: var(--panel-shadow), 0 0 30px -26px var(--panel-accent);
}
.panel:not(.hero-voice)::before {
  content: ""; position: absolute; z-index: 0; inset: 0; pointer-events: none;
  background: var(--panel-ambient);
}
.panel > * { position: relative; z-index: 1; }
.dash-grid > .panel:nth-child(5n + 1) { --panel-accent: var(--icon-violet); }
.dash-grid > .panel:nth-child(5n + 2) { --panel-accent: var(--icon-blue); }
.dash-grid > .panel:nth-child(5n + 3) { --panel-accent: var(--icon-teal); }
.dash-grid > .panel:nth-child(5n + 4) { --panel-accent: var(--icon-rose); }
.dash-grid > .panel:nth-child(5n + 5) { --panel-accent: var(--icon-amber); }
.overview-panel::after,
.analytics-panel::after {
  content: ""; position: absolute; z-index: 0; left: 0; right: 0; bottom: 0;
  height: 48%; pointer-events: none; background: var(--data-field);
  opacity: .72; mask-image: linear-gradient(to bottom, transparent, black 38%);
}
.overview-progress {
  margin-top: auto; padding-top: 22px;
}
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.panel-title { font-size: 15px; font-weight: 600; }
.panel-link { font-size: 12px; font-weight: 600; color: var(--accent-primary); cursor: pointer; background: none; border: none; padding: 4px 6px; border-radius: var(--r-control); }
.panel-link:hover { background: var(--surface-2); }
.panel-scroll { overflow-y: auto; max-height: 320px; }

/* compact work/job rows inside panels (spec §10.7 dense lists) */
.wrow { display: flex; align-items: center; gap: 10px; padding: 9px 6px; border-bottom: 1px solid var(--border-subtle); cursor: pointer; border-radius: var(--r-control); }
.wrow:last-child { border-bottom: none; }
.wrow:hover { background: var(--surface-2); }
.wrow .wico {
  --icon-tone: var(--icon-violet);
  width: 30px; height: 30px; flex: none; display: grid; place-items: center;
  border-radius: var(--r-control);
  color: var(--icon-tone);
  background: color-mix(in srgb, var(--icon-tone) 13%, var(--surface-2));
  border: 1px solid color-mix(in srgb, var(--icon-tone) 34%, var(--border-subtle));
  box-shadow: inset 0 1px 0 color-mix(in srgb, var(--text-primary) 8%, transparent), 0 0 18px -12px var(--icon-tone);
  font-size: 14px;
}
.wrow:nth-child(5n + 2) .wico { --icon-tone: var(--icon-blue); }
.wrow:nth-child(5n + 3) .wico { --icon-tone: var(--icon-teal); }
.wrow:nth-child(5n + 4) .wico { --icon-tone: var(--icon-rose); }
.wrow:nth-child(5n + 5) .wico { --icon-tone: var(--icon-amber); }
.primary-nav .nav-item:nth-of-type(5n + 1) .ico { color: var(--icon-violet); }
.primary-nav .nav-item:nth-of-type(5n + 2) .ico { color: var(--icon-blue); }
.primary-nav .nav-item:nth-of-type(5n + 3) .ico { color: var(--icon-teal); }
.primary-nav .nav-item:nth-of-type(5n + 4) .ico { color: var(--icon-rose); }
.primary-nav .nav-item:nth-of-type(5n + 5) .ico { color: var(--icon-amber); }
.wrow .wmain { flex: 1; min-width: 0; }
.wrow .wtitle { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wrow .wsub { font-size: 11.5px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.activity-panel .wrow { align-items: flex-start; flex-wrap: wrap; gap: 6px 8px; }
.activity-panel .wrow .wmain { flex: 1 0 calc(100% - 38px); }
.activity-panel .wrow .wtitle {
  display: -webkit-box; white-space: normal; line-height: 1.3;
  -webkit-box-orient: vertical; -webkit-line-clamp: 2;
}
.activity-panel .wrow > .pill { margin-left: 38px; }
.pbar { height: 4px; border-radius: 999px; background: var(--surface-3); overflow: hidden; width: 74px; flex: none; }
.pbar > i { display: block; height: 100%; background: var(--accent-primary); border-radius: 999px; }

/* content pipeline columns (spec §4.6 — unframed column groups, no nested cards) */
.pipe-cols { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 900px) { .pipe-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.pipe-col-head { display: flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: .6px; padding-bottom: 8px; border-bottom: 2px solid var(--border-subtle); margin-bottom: 10px; }
.pipe-count { font-size: 11px; font-weight: 700; color: var(--text-primary); background: var(--surface-3); border-radius: 999px; padding: 1px 8px; }
.pipe-item { padding: 9px 10px; border: 1px solid var(--border-subtle); border-radius: var(--r-card); background: var(--surface-2); cursor: pointer; margin-bottom: 8px; }
.pipe-item:hover { border-color: var(--border-strong); }
.pipe-item .pt { font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pipe-item .pm { font-size: 11px; color: var(--text-muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* dashboard asset tiles + schedule rows reuse module styles; small variants */
.dash-assets { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
@media (max-width: 900px) { .dash-assets { grid-template-columns: repeat(2, 1fr); } }
.dash-asset { border: 1px solid var(--border-subtle); border-radius: var(--r-card); overflow: hidden; background: var(--surface-2); cursor: pointer; }
.dash-asset .da-prev { aspect-ratio: 4 / 3; background: var(--bg-deep); display: grid; place-items: center; font-size: 26px; overflow: hidden; }
.dash-asset .da-prev img { width: 100%; height: 100%; object-fit: cover; display: block; }
.dash-asset .da-meta { padding: 8px 10px; }
.dash-asset .da-t { font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-asset .da-s { font-size: 10.5px; color: var(--text-muted); margin-top: 2px; }

/* ============================================================
   6. Full-replication shell: topbar, palette, rail, hero, charts
   ============================================================ */
/* --- topbar (search · quick create · bell · user) --- */
.topbar { gap: 14px; }
.mobile-shell-brand { display: none; align-items: center; gap: 9px; white-space: nowrap; }
.mobile-shell-brand .eva-mark { width: 28px; height: 28px; }
.mobile-shell-brand .eva-mark::before { inset: 4px; }
.mobile-shell-brand b { font-size: 14px; letter-spacing: -.2px; }
.mobile-menu-btn { display: none; }
.tb-search { flex: 1; max-width: 520px; min-width: 200px; position: relative; }
.tb-search input {
  width: 100%; height: 40px; background: color-mix(in srgb, var(--bg-sidebar) 84%, transparent);
  border: 1px solid var(--border-subtle); border-radius: var(--r-control);
  color: var(--text-primary); padding: 9px 64px 9px 38px; font-size: 13.5px; outline: none;
}
.tb-search input:focus { border-color: var(--accent-primary); }
.tb-search .tb-ico { position: absolute; left: 11px; top: 11px; color: var(--text-muted); }
.tb-search .tb-kbd { position: absolute; right: 9px; top: 10px; font-size: 10.5px; color: var(--text-muted); border: 1px solid var(--border-subtle); border-radius: 4px; padding: 2px 6px; font-family: var(--font-mono); }
.tb-btns { display: flex; align-items: center; gap: 10px; }
.quick-create { min-height: 40px; display: inline-flex; align-items: center; gap: 8px; }
.quick-create .ui-icon { width: 16px; height: 16px; }
.topbar .quick-create.btn.accent {
  color: var(--text-primary); background: var(--surface-1); border: 1px solid var(--border-strong);
}
.topbar .quick-create.btn.accent:hover { background: var(--surface-2); }
.iconbtn { position: relative; width: 40px; height: 40px; display: grid; place-items: center; border-radius: var(--r-control); border: 1px solid var(--border-subtle); background: var(--surface-1); cursor: pointer; color: var(--text-secondary); }
.iconbtn:hover { background: var(--surface-2); color: var(--text-primary); }
.badge-dot { position: absolute; top: 1px; right: 1px; min-width: 17px; max-width: 28px; height: 17px; border-radius: 999px; background: var(--danger); color: var(--text-on-danger); font-size: 10px; font-weight: 700; display: grid; place-items: center; padding: 0 4px; overflow: hidden; }
.userbtn { display: flex; align-items: center; gap: 9px; padding: 5px 10px 5px 5px; border-radius: var(--r-control); border: 1px solid var(--border-subtle); background: var(--surface-1); cursor: pointer; }
.userbtn:hover { background: var(--surface-2); }
.userbtn .un { font-size: 12.5px; font-weight: 700; }
.userbtn .ur { font-size: 10.5px; color: var(--text-muted); }

/* dropdown menus (spec §10.6) */
.dd { position: absolute; top: calc(100% + 6px); right: 0; min-width: 210px; max-height: 70vh; overflow: auto; z-index: 60; padding: 6px; }
.dd-item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--r-control); cursor: pointer; font-size: 13px; font-weight: 600; }
.dd-item:hover { background: var(--surface-2); }
.dd-item .di { width: 20px; text-align: center; }
.dd-sep { height: 1px; background: var(--border-subtle); margin: 6px 4px; }
.dd-note { font-size: 11px; color: var(--text-muted); padding: 6px 10px; }
.has-dd { position: relative; }

/* --- command palette (spec §4.1) --- */
.pal-back { position: fixed; inset: 0; background: var(--overlay); z-index: 80; display: flex; justify-content: center; padding-top: 9vh; }
.pal { width: 640px; max-width: 94vw; max-height: 70vh; display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.pal input { border: none; outline: none; background: transparent; color: var(--text-primary); font-size: 15px; padding: 16px 18px; border-bottom: 1px solid var(--border-subtle); width: 100%; }
.pal-list { overflow: auto; padding: 8px; }
.pal-group { font-size: 10.5px; text-transform: uppercase; letter-spacing: 1px; color: var(--text-muted); padding: 10px 10px 4px; }
.pal-item { display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: var(--r-control); cursor: pointer; font-size: 13.5px; }
.pal-item .pi { width: 22px; text-align: center; }
.pal-item .pm2 { margin-left: auto; font-size: 11px; color: var(--text-muted); }
.pal-item.sel, .pal-item:hover { background: var(--surface-2); }

/* --- sidebar rail collapse --- */
.nav-collapse { margin-left: auto; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 6px; border: 1px solid var(--border-subtle); background: transparent; color: var(--text-muted); cursor: pointer; font-size: 12px; }
.nav-collapse:hover { background: var(--surface-2); color: var(--text-primary); }
html.nav-rail aside.sidebar { width: 80px; padding: 18px 12px; }
html.nav-rail #app { grid-template-columns: 80px minmax(0, 1fr); }
html.nav-rail .sidebar .name, html.nav-rail .nav-group, html.nav-rail .nav-item > span:not(.ico),
html.nav-rail .nav-item .tag, html.nav-rail .sidebar-foot, html.nav-rail .sysstat { display: none; }
html.nav-rail .nav-item { justify-content: center; padding: 10px 0; }
html.nav-rail .brand { position: relative; justify-content: center; padding-inline: 0; }
html.nav-rail .brand .eva-mark { display: block; width: 30px; height: 30px; }
html.nav-rail .nav-collapse {
  position: absolute; right: -7px; bottom: 8px; width: 20px; height: 20px;
  margin: 0; background: var(--bg-sidebar); transform: rotate(180deg);
}

/* --- system status widget (real service health) --- */
.sysstat { margin-top: auto; border: 1px solid var(--border-subtle); border-radius: var(--r-card); background: var(--surface-1); padding: 12px; font-size: 11.5px; }
.sysstat .ss-line { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; color: var(--text-secondary); }
.sysstat .ss-line b { color: var(--text-primary); font-weight: 600; }
.ss-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); display: inline-block; margin-right: 6px; }
.ss-dot.bad { background: var(--warning); }
.ss-meter { height: 4px; border-radius: 999px; background: var(--surface-3); overflow: hidden; margin-top: 4px; }
.ss-meter > i { display: block; height: 100%; background: var(--accent-primary); }
.sysstat svg { display: block; margin-top: 6px; }
.sysstat .btn { width: 100%; margin-top: 10px; }

/* EVA_VISUAL_LOCK:EVA_EFFECTS:START
   Owner-approved EVA core, mesh, depth, and motion contract v2026-07-24.1. */
.mission-control {
  position: relative;
  isolation: isolate;
  overflow-x: clip;
}
.mission-control::before {
  content: "";
  position: absolute;
  z-index: 0;
  pointer-events: none;
  top: var(--eva-mesh-top);
  left: -7%;
  width: 114%;
  height: var(--eva-mesh-height);
  background:
    radial-gradient(circle at center, var(--hero-grid) 0 1px, transparent 1.5px) 0 0 / var(--eva-mesh-cell-x) var(--eva-mesh-cell-y),
    repeating-linear-gradient(14deg, transparent 0 34px, color-mix(in srgb, var(--hero-grid) 68%, transparent) 35px 36px),
    repeating-linear-gradient(166deg, transparent 0 46px, color-mix(in srgb, var(--hero-grid) 48%, transparent) 47px 48px);
  transform: perspective(var(--eva-mesh-perspective)) rotateX(63deg) scale(1.18);
  transform-origin: 50% 54%;
  opacity: .7;
  mask-image:
    radial-gradient(ellipse 72% 56% at 50% 48%, black 0 34%, transparent 78%),
    linear-gradient(to bottom, transparent 2%, black 28%, black 70%, transparent 98%);
  mask-composite: intersect;
}
.mission-control::after {
  content: "";
  position: absolute;
  z-index: 0;
  pointer-events: none;
  top: var(--eva-field-glow-top);
  left: 22%;
  width: 38%;
  height: var(--eva-field-glow-height);
  background: radial-gradient(ellipse, var(--hero-orb-glow), transparent 70%);
  filter: blur(var(--eva-field-glow-blur));
  opacity: .58;
}
.mission-control > * { position: relative; z-index: 1; }

/* --- EVA Voice hero --- */
.hero-voice {
  isolation: isolate; display: flex; flex-direction: column; align-items: center; text-align: center;
  padding: var(--eva-hero-padding); position: relative; overflow: visible;
  border-color: transparent;
  background:
    linear-gradient(
      180deg,
      color-mix(in srgb, var(--surface-1-solid) 94%, transparent) 0%,
      color-mix(in srgb, var(--surface-1-solid) 78%, transparent) 46%,
      color-mix(in srgb, var(--surface-1-solid) 24%, transparent) 78%,
      transparent 100%
    );
  box-shadow:
    inset 0 1px 0 color-mix(in srgb, var(--text-primary) 7%, transparent),
    0 var(--eva-hero-shadow-y) var(--eva-hero-shadow-blur) var(--eva-hero-shadow-spread) var(--panel-accent);
}
.hero-voice::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  pointer-events: none;
  border: 1px solid color-mix(in srgb, var(--panel-accent) 24%, var(--panel-border));
  border-radius: inherit;
  mask-image: linear-gradient(to bottom, black 0 42%, transparent 90%);
}
.hero-voice::after {
  content: ""; position: absolute; z-index: -1; width: 92%; height: 72%; left: 4%; top: 23%;
  background: radial-gradient(ellipse, var(--hero-orb-glow), transparent 68%);
  filter: blur(var(--eva-hero-glow-blur)); opacity: .82;
}
.hero-voice .hv-title { font-size: 24px; font-weight: 800; letter-spacing: -.3px; }
.hero-voice .hv-sub { color: var(--text-secondary); font-size: 13px; margin-top: var(--space-1); }
/* .hv-chips/.hv-chip and .hv-thread/.hv-u/.hv-e were removed here: orphaned
   since an earlier redesign, emitted by no JS in the app. The card's real
   transcript is .eva-card-thread, styled in section 9. */
.hv-orb {
  /* This is a <button>. WebKit (Safari, Tauri's WKWebView) paints its native
     push-button chrome — a rounded-rect background — underneath author styles
     unless appearance is explicitly reset; background:transparent alone does
     not reliably suppress it on WebKit the way it does on Chromium. That
     native rect is what was showing as a square behind the circular graphic
     in the desktop app. */
  appearance: none; -webkit-appearance: none;
  position: relative; width: var(--eva-core-size); height: var(--eva-core-size); border-radius: 44% 56% 51% 49% / 56% 42% 58% 44%;
  border: 1px solid transparent;
  margin: var(--space-4) auto var(--space-2); display: grid; place-items: center; cursor: pointer;
  background: transparent;
  color: var(--text-primary);
  box-shadow:
    0 0 var(--eva-core-glow-near) color-mix(in srgb, var(--hero-orb-glow) 78%, transparent),
    0 0 var(--eva-core-glow-far) var(--hero-orb-glow);
  /* The two orb drop-shadows and the float animation moved here from
     .hv-liquid-orb — see the WebKit clipping constraint documented there. */
  filter:
    drop-shadow(0 0 calc(var(--space-5) - var(--space-1)) color-mix(in srgb, var(--hero-orb-edge) 74%, transparent))
    drop-shadow(0 0 calc(var(--space-10) + var(--space-2)) color-mix(in srgb, var(--hero-orb-glow) 92%, transparent));
  animation: hv-body-float 6.2s ease-in-out infinite;
  transition: transform .12s ease-out, filter .12s ease-out;
}
.hv-orb::before { content: ""; position: absolute; width: 138%; height: 30%; left: -19%; bottom: -6%;
  background: radial-gradient(ellipse, color-mix(in srgb, var(--hero-orb-edge) 70%, transparent), color-mix(in srgb, var(--hero-orb-core) 24%, transparent) 42%, transparent 72%);
  filter: blur(var(--eva-hero-glow-blur)); opacity: .72; z-index: 0; animation: hv-floor-breathe 5.6s ease-in-out infinite; }
.hv-orb::after {
  content: ""; position: absolute; inset: calc(var(--space-1) * -1); border-radius: inherit;
  border: 1px solid color-mix(in srgb, var(--hero-orb-mid) 44%, transparent);
  box-shadow: 0 0 var(--eva-core-glow-near) color-mix(in srgb, var(--hero-orb-glow) 70%, transparent);
  opacity: .54; pointer-events: none; z-index: 1;
}
.hv-liquid-orb {
  /* HARD CONSTRAINT (WebKit — Safari and the Tauri desktop WKWebView): this is
     the element whose overflow:hidden + animated organic border-radius clips
     the oversized ::before into the orb shape. WebKit silently downgrades that
     clip to a plain RECTANGLE when the clipping element itself also carries a
     filter or a transform — which showed as a hard square (rect-clipped
     content corners + a square drop-shadow computed from the rect alpha)
     behind the orb in the desktop app. So: no filter, no transform, and no
     transform-animating keyframes (hv-body-float) on THIS element — the glow
     drop-shadows and the float animation live on the parent .hv-orb instead,
     which is not the clipping element. Same owner-approved shape, different
     property placement. */
  position: relative;
  z-index: 2; width: calc(var(--eva-core-size) - var(--space-3)); aspect-ratio: 1;
  border-radius: 43% 57% 48% 52% / 56% 41% 59% 44%; overflow: hidden;
  /* clip-path duplicates the border-radius shape, and is NOT redundant:
     the ::before/veil/flow children are composited layers (they carry blur
     filters + transform animations), and WebKit approximates an ancestor's
     overflow+border-radius clip on composited children as a plain RECT —
     the square that kept showing behind the orb in the desktop app's
     WKWebView. clip-path applies at compositing time and clips those
     layers correctly. Keep the two radii in sync if the shape ever changes.
     Also keep this element free of its own filter/transform/animations —
     each of those independently re-breaks the clip (verified live). */
  clip-path: inset(0 round 43% 57% 48% 52% / 56% 41% 59% 44%);
  -webkit-clip-path: inset(0 round 43% 57% 48% 52% / 56% 41% 59% 44%);
}
.hv-liquid-orb::before {
  /* This layer deliberately overshoots the parent (-12% inset) and relies on
     the parent's clip for its final shape. border-radius: inherit + the 4th
     gradient fading to transparent by 100% (instead of ending opaque
     bg-sidebar) mean its own corners paint nothing even on an engine that
     mis-clips — everything inside the visible circle (≲80% of that
     gradient's radius) renders identically. */
  content: ""; position: absolute; inset: -12%; border-radius: inherit;
  background:
    radial-gradient(circle at 27% 31%, color-mix(in srgb, var(--text-primary) 30%, transparent) 0 4%, transparent 15%),
    radial-gradient(circle at 28% 72%, color-mix(in srgb, var(--hero-orb-core) 90%, transparent), transparent 34%),
    radial-gradient(circle at 72% 36%, color-mix(in srgb, var(--hero-orb-mid) 82%, transparent), transparent 38%),
    radial-gradient(circle at 52% 52%, color-mix(in srgb, var(--hero-orb-edge) 70%, transparent), color-mix(in srgb, var(--bg-sidebar) 54%, var(--hero-orb-edge)) 48%, color-mix(in srgb, var(--bg-sidebar) 86%, transparent) 78%, transparent 100%);
  filter: blur(calc(var(--space-2) + 2px)) saturate(1.3); animation: hv-chroma-flow 14s ease-in-out infinite alternate; z-index: 0;
}
.hv-liquid-orb::after {
  content: ""; position: absolute; inset: -1px; border-radius: inherit;
  border: 2px solid color-mix(in srgb, var(--hero-orb-edge) 58%, var(--text-primary));
  box-shadow:
    inset 0 0 var(--space-8) color-mix(in srgb, var(--text-primary) 11%, transparent),
    inset 0 calc(var(--space-5) * -1) calc(var(--space-10) + var(--space-1)) color-mix(in srgb, var(--hero-orb-core) 26%, transparent),
    0 0 calc(var(--space-6) + var(--space-1)) color-mix(in srgb, var(--hero-orb-edge) 80%, transparent),
    0 0 calc(var(--space-10) * 2 - var(--space-1)) var(--hero-orb-glow);
  animation: hv-rim-shift 7.2s ease-in-out infinite; z-index: 5; pointer-events: none;
}
.hv-liquid-veil { position: absolute; inset: 4%; border-radius: inherit; overflow: hidden; opacity: .92; mix-blend-mode: screen; filter: drop-shadow(0 0 var(--space-3) color-mix(in srgb, var(--hero-orb-core) 36%, transparent)); animation: hv-veil-warp 9s ease-in-out infinite; z-index: 3; }
.hv-flow { position: absolute; border-radius: 45% 55% 52% 48% / 55% 44% 56% 45%; filter: blur(var(--space-4)); opacity: .68; will-change: transform, opacity, border-radius; }
.hv-flow-1 { width: 72%; height: 48%; left: 4%; top: 14%; background: radial-gradient(ellipse, color-mix(in srgb, var(--hero-orb-core) 72%, transparent), color-mix(in srgb, var(--hero-orb-core) 18%, transparent) 48%, transparent 76%); animation: hv-flow-one 13.4s cubic-bezier(.45, 0, .2, 1) infinite; }
.hv-flow-2 { width: 58%; height: 66%; right: 1%; top: 9%; background: radial-gradient(ellipse, color-mix(in srgb, var(--hero-orb-mid) 72%, transparent), color-mix(in srgb, var(--hero-orb-mid) 20%, transparent) 48%, transparent 78%); animation: hv-flow-two 11.2s cubic-bezier(.4, 0, .25, 1) infinite reverse; }
.hv-flow-3 { width: 70%; height: 46%; left: 18%; bottom: 2%; background: radial-gradient(ellipse, color-mix(in srgb, var(--hero-orb-edge) 70%, transparent), color-mix(in srgb, var(--hero-orb-edge) 20%, transparent) 52%, transparent 80%); animation: hv-flow-three 15.6s cubic-bezier(.5, 0, .18, 1) infinite; }
.hv-flow-4 { width: 44%; height: 44%; left: 28%; top: 30%; background: radial-gradient(circle, color-mix(in srgb, var(--text-primary) 18%, transparent), color-mix(in srgb, var(--hero-orb-core) 22%, transparent) 38%, transparent 72%); filter: blur(var(--space-5)); opacity: .54; animation: hv-flow-four 9.8s ease-in-out infinite alternate; }
.hv-edge-sheen { position: absolute; inset: calc(var(--space-1) * -1); border-radius: inherit; background:
    radial-gradient(ellipse at 12% 62%, color-mix(in srgb, var(--hero-orb-core) 76%, transparent), transparent 24%),
    radial-gradient(ellipse at 82% 28%, color-mix(in srgb, var(--hero-orb-mid) 66%, transparent), transparent 28%),
    radial-gradient(ellipse at 62% 91%, color-mix(in srgb, var(--hero-orb-edge) 68%, transparent), transparent 25%);
  filter: blur(calc(var(--space-1) + 1px)); opacity: .74; animation: hv-edge-swim 10.6s ease-in-out infinite alternate; z-index: 4; pointer-events: none; }
.hv-liquid-core { position: absolute; inset: 18%; border-radius: 44% 56% 52% 48% / 55% 42% 58% 45%; background: radial-gradient(circle at 42% 38%, color-mix(in srgb, var(--hero-orb-core) 52%, transparent), color-mix(in srgb, var(--hero-orb-mid) 28%, transparent) 48%, transparent 72%); filter: blur(calc(var(--space-4) - 1px)); animation: hv-core-pulse 7.4s ease-in-out infinite; z-index: 2; }
.hv-orb:hover { transform: scale(1.04); }
.hv-orb.listening {
  outline: 3px solid var(--focus-ring);
  outline-offset: 5px;
  /* Listening drop-shadows replace the base .hv-orb ones here, NOT on
     .hv-liquid-orb — that element must stay filter-free (see its comment). */
  filter: saturate(1.18) brightness(1.12) drop-shadow(0 0 var(--space-5) color-mix(in srgb, var(--focus-ring) 82%, transparent)) drop-shadow(0 0 calc(var(--space-10) + var(--space-6)) color-mix(in srgb, var(--hero-orb-glow) 100%, transparent));
}
@keyframes hv-floor-breathe { 50% { transform: scale(1.12, .86); opacity: .94; } }
@keyframes hv-body-morph { 0%,100% { border-radius: 47% 53% 51% 49% / 51% 45% 55% 49%; } 14% { border-radius: 43% 57% 49% 51% / 56% 40% 60% 44%; } 28% { border-radius: 53% 47% 56% 44% / 45% 55% 44% 56%; } 42% { border-radius: 50% 50% 42% 58% / 58% 47% 53% 42%; } 58% { border-radius: 56% 44% 51% 49% / 48% 58% 42% 52%; } 74% { border-radius: 45% 55% 58% 42% / 44% 52% 48% 56%; } 88% { border-radius: 52% 48% 46% 54% / 54% 43% 57% 46%; } }
@keyframes hv-body-float { 50% { transform: translateY(calc(var(--space-2) * -1)) scale(1.018); } }
@keyframes hv-chroma-flow { 0% { transform: translate(-5%, -3%) scale(1.08) skewX(-2deg); } 35% { transform: translate(4%, 2%) scale(1.14) skewY(3deg); } 68% { transform: translate(-2%, 5%) scale(1.10) skewX(2deg); } 100% { transform: translate(3%, -1%) scale(1.16) skewY(-2deg); } }
@keyframes hv-rim-shift { 0%,100% { opacity: .82; transform: rotate(0deg) scale(1); } 50% { opacity: 1; transform: rotate(4deg) scale(1.035); } }
@keyframes hv-veil-warp { 0%,100% { border-radius: 48% 52% 50% 50% / 50% 48% 52% 50%; transform: rotateZ(0deg) scale(1); } 33% { border-radius: 44% 56% 54% 46% / 56% 43% 57% 44%; transform: rotateZ(3deg) scale(1.025); } 66% { border-radius: 55% 45% 47% 53% / 44% 57% 43% 56%; transform: rotateZ(-3deg) scale(.992); } }
@keyframes hv-flow-one { 0%,100% { transform: translate(-8%, -4%) scale(.92, 1.08); border-radius: 48% 52% 60% 40% / 42% 54% 46% 58%; opacity: .54; } 28% { transform: translate(16%, 10%) scale(1.18, .86); border-radius: 62% 38% 46% 54% / 52% 42% 58% 48%; opacity: .76; } 57% { transform: translate(4%, 26%) scale(.98, 1.14); border-radius: 39% 61% 54% 46% / 59% 48% 52% 41%; opacity: .62; } 82% { transform: translate(22%, -2%) scale(1.08, .96); border-radius: 53% 47% 43% 57% / 44% 60% 40% 56%; opacity: .72; } }
@keyframes hv-flow-two { 0%,100% { transform: translate(8%, 4%) scale(1.10, .90); border-radius: 43% 57% 48% 52% / 57% 41% 59% 43%; opacity: .52; } 31% { transform: translate(-18%, 18%) scale(.86, 1.22); border-radius: 57% 43% 59% 41% / 46% 62% 38% 54%; opacity: .80; } 63% { transform: translate(-4%, -14%) scale(1.16, .92); border-radius: 38% 62% 44% 56% / 61% 43% 57% 39%; opacity: .64; } 88% { transform: translate(-24%, 3%) scale(.98, 1.10); border-radius: 59% 41% 52% 48% / 40% 56% 44% 60%; opacity: .70; } }
@keyframes hv-flow-three { 0%,100% { transform: translate(0%, 12%) scale(.96, 1.06); border-radius: 52% 48% 41% 59% / 45% 56% 44% 55%; opacity: .50; } 25% { transform: translate(-14%, -10%) scale(1.18, .88); border-radius: 40% 60% 57% 43% / 60% 44% 56% 40%; opacity: .78; } 55% { transform: translate(18%, -4%) scale(.90, 1.24); border-radius: 61% 39% 47% 53% / 42% 61% 39% 58%; opacity: .66; } 79% { transform: translate(6%, 18%) scale(1.08, .94); border-radius: 47% 53% 62% 38% / 56% 40% 60% 44%; opacity: .74; } }
@keyframes hv-flow-four { 0% { transform: translate(-10%, -4%) scale(.86); opacity: .34; } 38% { transform: translate(22%, 14%) scale(1.22); opacity: .62; } 71% { transform: translate(-3%, 28%) scale(.96); opacity: .48; } 100% { transform: translate(16%, -16%) scale(1.12); opacity: .56; } }
@keyframes hv-edge-swim { 0% { transform: translate(-2%, 1%) scale(.98); opacity: .62; } 35% { transform: translate(3%, -2%) scale(1.04); opacity: .84; } 70% { transform: translate(-1%, 3%) scale(1.01); opacity: .70; } 100% { transform: translate(2%, -1%) scale(1.06); opacity: .88; } }
@keyframes hv-core-pulse { 0%,100% { transform: translate(calc(var(--space-2) * -1), var(--space-1)) scale(.92); opacity: .54; } 50% { transform: translate(var(--space-2), calc(var(--space-2) * -1)) scale(1.18); opacity: .82; } }
@media (prefers-reduced-motion: reduce) {
  .hv-orb,
  .hv-orb::before,
  .hv-liquid-orb,
  .hv-liquid-orb::before,
  .hv-liquid-orb::after,
  .hv-liquid-veil,
  .hv-flow,
  .hv-edge-sheen,
  .hv-liquid-core { animation: none !important; }
  .hv-orb { border-radius: 44% 56% 51% 49% / 56% 42% 58% 44%; }
  .hv-liquid-orb { border-radius: 43% 57% 48% 52% / 56% 41% 59% 44%; transform: none; }
}
.hv-state { font-size: 11.5px; color: var(--text-muted); min-height: var(--eva-status-height); margin-bottom: var(--space-2); }
.hv-inrow { display: flex; gap: var(--eva-input-gap); width: 100%; margin-top: var(--eva-input-margin); }
.hv-inrow input { flex: 1; }
.icon-only { width: var(--eva-core-control-size); height: var(--eva-core-control-size); padding: 0; display: grid; place-items: center; }
.icon-only.is-muted { color: var(--text-muted); opacity: .7; }
/* EVA_VISUAL_LOCK:EVA_EFFECTS:END */

/* --- stat tiles / charts --- */
.stat-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat-tile {
  --tile-tone: var(--icon-violet);
  position: relative; overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--tile-tone) 22%, var(--border-subtle));
  border-radius: var(--r-card); background: var(--tile-background); padding: 11px 12px;
  box-shadow: inset 0 1px 0 color-mix(in srgb, var(--text-primary) 6%, transparent);
}
.stat-tile::before {
  content: ""; position: absolute; inset: 0 auto 0 0; width: 2px;
  background: linear-gradient(to bottom, var(--tile-tone), transparent 78%);
}
.stat-tile:nth-child(2) { --tile-tone: var(--icon-teal); }
.stat-tile:nth-child(3) { --tile-tone: var(--icon-blue); }
.stat-tile:nth-child(4) { --tile-tone: var(--icon-amber); }
.stat-tile .st-v { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
.stat-tile .st-k { font-size: 11px; color: var(--text-secondary); margin-top: 1px; }
.trend-up { color: var(--success); font-size: 11px; font-weight: 700; }
.trend-flat { color: var(--text-muted); font-size: 11px; font-weight: 700; }
.chart-tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
@media (max-width: 1000px) { .chart-tiles { grid-template-columns: repeat(2, 1fr); } }
.chart-tile {
  --tile-tone: var(--icon-violet);
  position: relative; overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--tile-tone) 22%, var(--border-subtle));
  border-radius: var(--r-card); background: var(--tile-background); padding: 12px;
  box-shadow: inset 0 1px 0 color-mix(in srgb, var(--text-primary) 6%, transparent);
}
.chart-tile::after {
  content: ""; position: absolute; inset: auto -12% -44% 20%; height: 70%;
  background: radial-gradient(ellipse, color-mix(in srgb, var(--tile-tone) 14%, transparent), transparent 70%);
  pointer-events: none;
}
.chart-tile:nth-child(2) { --tile-tone: var(--icon-blue); }
.chart-tile:nth-child(3) { --tile-tone: var(--icon-amber); }
.chart-tile:nth-child(4) { --tile-tone: var(--icon-teal); }
.chart-tile .ct-k { font-size: 11.5px; color: var(--text-secondary); }
.chart-tile .ct-v { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; margin: 2px 0 6px; }
.spark { display: block; flex: none; }
.chart-tile .spark { width: 100%; }
.donut-row { display: flex; align-items: center; gap: 12px; }
.donut-leg { font-size: 10.5px; color: var(--text-secondary); line-height: 1.7; }
.donut-leg i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; }
.analytics-panel .chart-tiles { flex: 1; align-items: stretch; }
.analytics-panel .chart-tile { min-height: 150px; display: flex; flex-direction: column; }
.analytics-panel .chart-tile .spark { margin-top: auto; min-height: 52px; }
.analytics-panel .chart-tile .donut-row { margin: auto 0; }
.analytics-note { font-size: 10.5px; margin-top: 10px; }

/* --- task queue table (spec §10.7) --- */
.tq { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.tq th { text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: .8px; color: var(--text-muted); font-weight: 600; padding: 6px 8px; border-bottom: 1px solid var(--border-subtle); }
.tq td { padding: 9px 8px; border-bottom: 1px solid var(--border-subtle); vertical-align: middle; }
.tq tr:last-child td { border-bottom: none; }
.tq tbody tr:hover td { background: var(--surface-2); }
.tq-open {
  display: inline-flex; align-items: center; gap: 5px; max-width: 100%;
  border: 0; padding: 0; background: transparent; color: var(--text-primary);
  text-align: left; cursor: pointer;
}
.tq-open span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tq .mono { font-variant-numeric: tabular-nums; }

/* --- assets library tabs + timeline --- */
.lib-tabs { display: inline-flex; gap: 2px; background: var(--bg-deep); border-radius: var(--r-control); padding: 3px; margin-bottom: 12px; }
.lib-tabs button { border: none; background: transparent; color: var(--text-secondary); padding: 6px 12px; border-radius: 5px; font-size: 12px; font-weight: 600; cursor: pointer; }
.lib-tabs button.on { background: var(--surface-3); color: var(--text-primary); }
.tl-player { border-radius: var(--r-card); overflow: hidden; background: var(--bg-deep); border: 1px solid var(--border-subtle); }
.tl-player video { display: block; width: 100%; aspect-ratio: 16 / 9; background: #000; }
.tl-tracks { margin-top: 10px; font-size: 11.5px; }
.tl-track { display: flex; gap: 8px; align-items: baseline; padding: 5px 2px; border-bottom: 1px solid var(--border-subtle); color: var(--text-secondary); }
.tl-track:last-child { border-bottom: none; }
.tl-track .tt { flex: none; width: 44px; font-family: var(--font-mono); font-size: 10.5px; color: var(--text-muted); }

/* --- footer strip --- */
.dash-foot { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 13px; font-size: 12.5px; color: var(--text-secondary); }
.dash-foot .panel-link { font-size: 12.5px; }

/* ============================================================
   7. Campaign intake form + Kanban board (v1 layout parity)
   ============================================================ */
.intake-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 14px; }
.intake-grid.two { grid-template-columns: 1fr 1fr 1fr 1fr; }
@media (max-width: 900px) { .intake-grid, .intake-grid.two { grid-template-columns: 1fr 1fr; } }
.intake-ask { width: 100%; min-height: 64px; resize: vertical; background: var(--bg-deep); border: 1px solid var(--border-subtle); border-radius: var(--r-control); color: var(--text-primary); padding: 11px 13px; font-size: 14px; font-family: var(--font-sans); outline: none; }
.intake-ask:focus { border-color: var(--accent-primary); }
.intake-check { display: flex; align-items: flex-start; gap: 9px; font-size: 12.5px; color: var(--text-secondary); cursor: pointer; }
.intake-check input { margin-top: 2px; accent-color: var(--accent-primary); }
.intake-check b { color: var(--text-primary); }

.kan-board { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; align-items: start; }
@media (max-width: 1100px) { .kan-board { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .kan-board { grid-template-columns: 1fr; } }
.kan-col-head { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 700; color: var(--text-secondary); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 10px; }
.kan-col-count { font-size: 11px; font-weight: 700; background: var(--surface-3); color: var(--text-primary); border-radius: 999px; padding: 1px 9px; }
.kan-col-body { display: flex; flex-direction: column; gap: 10px; min-height: 60px; }
.kan-card { border: 1px solid var(--border-subtle); border-radius: var(--r-card); background: var(--surface-1); padding: 13px 14px; cursor: pointer; position: relative; }
.kan-card:hover { border-color: var(--border-strong); }
.kan-type { display: inline-block; font-size: 9.5px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: var(--accent-secondary); background: color-mix(in srgb, var(--accent-secondary) 14%, transparent); border-radius: 4px; padding: 2px 7px; margin-bottom: 8px; }
.kan-client { font-weight: 700; font-size: 14px; }
.kan-sub { font-size: 11.5px; color: var(--text-muted); margin-top: 1px; }
.kan-statusrow { display: flex; align-items: center; gap: 7px; font-size: 12px; margin: 10px 0 8px; }
.kan-dot { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.kan-dot.ok { background: var(--success); } .kan-dot.warn { background: var(--warning); } .kan-dot.bad { background: var(--danger); } .kan-dot.off { background: var(--border-strong); }
.kan-pbar { height: 4px; border-radius: 999px; background: var(--surface-3); overflow: hidden; margin-bottom: 10px; }
.kan-pbar > i { display: block; height: 100%; background: var(--accent-primary); }
.kan-actions { display: flex; gap: 7px; flex-wrap: wrap; }
.kan-actions .btn { flex: 1; min-width: 0; padding: 7px 8px; font-size: 12px; }
.kan-empty { font-size: 12px; color: var(--text-muted); padding: 14px 0; text-align: center; border: 1px dashed var(--border-subtle); border-radius: var(--r-card); }

/* Complete / Archive / Delete row — a second, visually quieter action row
   under the pipeline actions (Approve/Revise/etc). */
.kan-lifecycle-actions { margin-top: 7px; padding-top: 9px; border-top: 1px solid var(--border-glass); }
.kan-lifecycle-actions .btn { flex: 1; min-width: 0; padding: 6px 6px; font-size: 11.5px; }
.kan-lifecycle-tag { position: absolute; top: 13px; right: 14px; font-size: 9.5px; font-weight: 700; letter-spacing: .4px;
  color: var(--success); background: color-mix(in srgb, var(--success) 16%, transparent); border-radius: 4px; padding: 2px 7px; }

/* ---- campaign deck pipeline-stage cards (enterprise-grade hierarchy: bolder
   head, quieter meta, clear separation between the head and its expanded
   body) — replaces the old fully-inline-styled stage row. ---- */
.stage-card-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px;
  background: var(--surface-glass); border: 1px solid var(--border-glass); border-radius: 10px; transition: border-color .12s, background .12s; }
.stage-card-head:hover { border-color: var(--border-glass-strong); background: var(--surface-glass-hover); }
.stage-card-ico { font-size: 15px; flex: none; }
.stage-card-label { font-weight: 700; font-size: 13.5px; flex: 1; letter-spacing: .1px; }
.stage-card-meta { font-size: 10.5px; font-weight: 600; letter-spacing: .3px; text-transform: uppercase; color: var(--text-muted); }
.stage-card-body { padding: 14px 16px; border: 1px solid var(--border-glass); border-top: none; border-radius: 0 0 10px 10px; max-height: 380px; overflow: auto; background: var(--surface-glass); }

/* ---- rendered markdown (agent/campaign stage output) — ported verbatim from
   v1's dashboard/index.html mdToHtml() output classes (.md/.mdp/.mdh*/.mdul/
   table.mdt), remapped onto v2's design tokens. Do not rename these classes —
   mdToHtml() in app.js emits them by name. ---- */
.md > *:first-child { margin-top: 0; } .md > *:last-child { margin-bottom: 0; }
.mdp { margin: 0 0 10px; font-size: 13px; line-height: 1.6; color: var(--text-secondary); }
.mdh { font-weight: 700; color: var(--text-primary); letter-spacing: .2px; margin: 16px 0 8px; line-height: 1.3; }
.mdh:first-child { margin-top: 0; }
.mdh1 { font-size: 15.5px; }
.mdh2 { font-size: 14px; }
.mdh3 { font-size: 12.5px; color: var(--mint); text-transform: uppercase; letter-spacing: .6px; }
.mdh4 { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .6px; }
.mdul { margin: 0 0 12px; padding-left: 2px; list-style: none; display: flex; flex-direction: column; gap: 6px; }
.mdul li { position: relative; padding-left: 16px; font-size: 13px; line-height: 1.55; color: var(--text-secondary); }
.mdul li::before { content: ""; position: absolute; left: 2px; top: 7px; width: 5px; height: 5px; border-radius: 50%; background: var(--mint); opacity: .85; }
.md b { color: var(--text-primary); font-weight: 700; }
.md i { color: var(--text-secondary); font-style: italic; }
.md code { background: var(--surface-3); border: 1px solid var(--border-glass); border-radius: 4px; padding: 1px 5px; font-family: var(--font-mono); font-size: 12px; color: var(--mint); }
table.mdt { width: 100%; border-collapse: collapse; margin: 6px 0 12px; font-size: 12px; border: 1px solid var(--border-glass); border-radius: 8px; overflow: hidden; }
table.mdt th { background: var(--surface-3); color: var(--text-muted); text-align: left; padding: 7px 10px; font-size: 10px; letter-spacing: .5px; text-transform: uppercase; border-bottom: 1px solid var(--border-glass); }
table.mdt td { padding: 7px 10px; border-bottom: 1px solid var(--border-glass); vertical-align: top; color: var(--text-secondary); }
table.mdt tr:last-child td { border-bottom: none; }
table.mdt tbody tr:nth-child(even) { background: color-mix(in srgb, var(--accent-tertiary) 5%, transparent); }

.nav-scrim,
.mobile-bottom-nav { display: none; }

@media (min-width: 1024px) and (max-width: 1439px) {
  main.content { padding-inline: 20px; }
}

@media (max-width: 1023px) {
  #app,
  html.nav-rail #app { grid-template-columns: minmax(0, 1fr); }
  main.content { width: 100%; padding: 0 16px 44px; }
  aside.sidebar,
  html.nav-rail aside.sidebar {
    position: fixed; inset: 0 auto 0 0; width: 248px; height: 100vh;
    padding: 18px 12px; transform: translateX(-102%); transition: transform .2s ease-out;
    box-shadow: 18px 0 48px var(--shadow-color);
  }
  html.mobile-nav-open aside.sidebar { transform: translateX(0); }
  html.nav-rail .sidebar .name,
  html.nav-rail .nav-group,
  html.nav-rail .nav-item > span:not(.ico),
  html.nav-rail .nav-item .tag,
  html.nav-rail .sidebar-foot,
  html.nav-rail .sysstat { display: initial; }
  html.nav-rail .primary-nav { display: flex; }
  html.nav-rail .nav-item { justify-content: flex-start; padding: 9px 11px; }
  html.nav-rail .brand { justify-content: flex-start; padding: 2px 8px 16px; }
  html.nav-rail .brand .eva-mark { display: block; }
  html.nav-rail .nav-collapse { display: none; }
  .nav-scrim {
    position: fixed; inset: 0; z-index: 40; border: 0; padding: 0;
    background: var(--overlay); opacity: 0; pointer-events: none; display: block;
    transition: opacity .18s ease-out;
  }
  html.mobile-nav-open .nav-scrim { opacity: 1; pointer-events: auto; }
  .mobile-shell-brand { display: flex; }
  .mobile-menu-btn { display: grid; }
  .topbar { min-height: 60px; gap: 10px; }
  .tb-search { flex: 0 0 44px; min-width: 44px; max-width: none; }
  .tb-search input { width: 44px; height: 44px; padding: 0; color: transparent; caret-color: transparent; cursor: pointer; }
  .tb-search input::placeholder { color: transparent; }
  .tb-search .tb-ico { left: 13px; top: 13px; pointer-events: none; }
  .tb-search .tb-kbd { display: none; }
  .dash-head { min-height: 76px; }
  .dash-grid { grid-template-columns: repeat(8, minmax(0, 1fr)); }
  .dash-grid > *,
  .dash-grid > :nth-child(2) { grid-column: span 8; }
  .dash-grid > :nth-child(3),
  .dash-grid > :nth-child(4) { grid-column: span 4; }
  .pipe-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 767px) {
  main.content { padding: 0 16px calc(88px + env(safe-area-inset-bottom)); }
  .topbar { min-height: 56px; margin-bottom: 8px; }
  .mobile-shell-brand > .eva-mark,
  .mobile-shell-brand > b { display: none; }
  .tb-search { flex: 0 0 44px; min-width: 44px; }
  .tb-search input { width: 44px; height: 44px; padding: 0; color: transparent; caret-color: transparent; cursor: pointer; }
  .tb-search input::placeholder { color: transparent; }
  .tb-search .tb-ico { left: 13px; top: 13px; pointer-events: none; }
  .tb-search .tb-kbd { display: none; }
  .tb-btns { gap: 8px; }
  .quick-create { width: 44px; height: 44px; min-height: 44px; padding: 0; justify-content: center; }
  .quick-create span:not(:first-child) { display: none; }
  .iconbtn, .userbtn { min-width: 44px; min-height: 44px; }
  .userbtn { width: 44px; padding: 4px; }
  .userbtn .user-copy { display: none; }
  .dash-head { min-height: 0; align-items: flex-start; flex-direction: column; padding: 10px 0 4px; }
  .dash-head > .row { width: 100%; }
  .dash-head > .row .btn { flex: 1; min-height: 44px; }
  .dash-grid { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .dash-grid > *,
  .dash-grid > :nth-child(2),
  .dash-grid > :nth-child(3),
  .dash-grid > :nth-child(4) { grid-column: 1; }
  .dash-grid > :nth-child(1) { order: 1; }
  .dash-grid > :nth-child(2) { order: 2; }
  .dash-grid > :nth-child(3) { order: 3; }
  .dash-grid > :nth-child(4) { order: 11; }
  .dash-grid > :nth-child(5) { order: 4; }
  .dash-grid > :nth-child(6) { order: 5; }
  .dash-grid > :nth-child(7) { order: 6; }
  .dash-grid > :nth-child(8) { order: 7; }
  .dash-grid > :nth-child(9) { order: 8; }
  .dash-grid > :nth-child(10) { order: 9; }
  .dash-grid > :nth-child(11) { order: 10; }
  .dash-grid > :nth-child(12) { order: 12; }
  .panel { padding: 15px; }
  .hero-voice { min-height: 0; }
  .hero-voice { margin-bottom: calc(74px + env(safe-area-inset-bottom)); }
  .hv-orb { width: calc(var(--eva-core-size-mobile) - var(--space-4)); height: calc(var(--eva-core-size-mobile) - var(--space-4)); margin: var(--space-2) auto 0; }
  .hv-chips { flex-wrap: wrap; width: 100%; overflow: visible; justify-content: center; padding-bottom: 0; margin: var(--space-2) 0 0; }
  .hv-chip { white-space: nowrap; }
  .hv-inrow { display: grid; grid-template-columns: minmax(0, 1fr) 52px 44px; }
  .stat-tiles,
  .chart-tiles,
  .pipe-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tq { min-width: 0; }
  .tq th:nth-child(2),
  .tq td:nth-child(2),
  .tq th:nth-child(5),
  .tq td:nth-child(5) { display: none; }
  .tq th, .tq td { padding-inline: 5px; }
  .dash-foot { align-items: flex-start; flex-direction: column; }
  .mobile-bottom-nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
    min-height: calc(64px + env(safe-area-inset-bottom));
    padding: 6px 8px env(safe-area-inset-bottom); display: grid; grid-template-columns: repeat(5, 1fr);
    background: color-mix(in srgb, var(--bg-sidebar) 94%, transparent);
    border-top: 1px solid var(--border-subtle);
    backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur);
  }
  .mobile-bottom-nav button {
    position: relative; min-width: 44px; min-height: 52px; border: 0; border-radius: var(--r-control);
    background: transparent; color: var(--text-muted); display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 3px; font-size: 10px; font-weight: 600;
  }
  .mobile-bottom-nav button.active { color: var(--text-primary); background: var(--surface-2); }
  .mobile-bottom-nav button.active::before {
    content: ""; position: absolute; top: 2px; width: 24px; height: 2px;
    border-radius: var(--r-pill); background: var(--accent-primary);
  }
  .mobile-bottom-nav .ui-icon { width: 19px; height: 19px; }
  body .eva-fab {
    right: 16px;
    bottom: calc(76px + env(safe-area-inset-bottom));
  }
}

@media (max-width: 420px) {
  .stat-tiles { gap: 8px; }
  .stat-tile { padding: 10px; }
  .chart-tiles { grid-template-columns: 1fr; }
  .wrow { gap: 8px; padding-inline: 2px; }
  .wrow .pbar { display: none; }
}

/* ---------- EVACut AI-first modal ---------- */
.evacut-modal { max-width: 620px; padding: 0; overflow: hidden; }
.evacut-modal-wash {
  padding: 26px 26px 18px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent-primary) 16%, transparent), transparent 100%);
  border-bottom: 1px solid var(--border-subtle);
}
.evacut-modal-body { padding: 20px 26px 26px; max-height: 70vh; overflow-y: auto; }
.evacut-hero { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; }
.evacut-hero .hv-orb {
  --eva-core-size: 76px;
  width: var(--eva-core-size);
  height: var(--eva-core-size);
  margin: 0 0 6px;
  cursor: default;
  animation: none;
  transform: none;
}
.evacut-hero .hv-orb:hover { transform: none; }
.evacut-hero .hv-orb::before { display: none; }
.evacut-hero-title { font-size: 17px; font-weight: 800; letter-spacing: -.2px; }
.evacut-hero-actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; justify-content: center; }

.evacut-step { margin-top: 20px; }
.evacut-step-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.evacut-step-num {
  width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center;
  font-size: 11px; font-weight: 700; background: var(--surface-3); color: var(--text-muted); flex: none;
}
.evacut-step-num.on { background: var(--accent-primary); color: var(--text-on-accent); }
.evacut-step-title { font-size: 13px; font-weight: 700; }

.evacut-upload-zone {
  border: 1.5px dashed var(--border-strong); border-radius: var(--r-card); padding: 18px;
  text-align: center; color: var(--text-secondary); font-size: 12.5px; cursor: pointer;
  background: var(--surface-2); transition: border-color .12s, background .12s;
}
.evacut-upload-zone:hover, .evacut-upload-zone.drag { border-color: var(--accent-primary); background: var(--surface-3); }
.evacut-media-count { font-size: 12.5px; color: var(--text-secondary); margin-top: 8px; }

.evacut-style-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.evacut-style-card {
  text-align: left; padding: 12px 12px 10px; border-radius: var(--r-card);
  background: var(--surface-2); border: 1.5px solid var(--border-subtle); cursor: pointer;
  display: flex; flex-direction: column; gap: 3px; transition: border-color .12s, background .12s, transform .12s;
}
.evacut-style-card:hover { border-color: color-mix(in srgb, var(--accent-primary) 50%, var(--border-subtle)); transform: translateY(-1px); }
.evacut-style-card.active { border-color: var(--accent-primary); background: color-mix(in srgb, var(--accent-primary) 12%, var(--surface-2)); }
.evacut-style-card .ui-icon { color: var(--icon-violet); width: 18px; height: 18px; }
.evacut-style-name { font-size: 12.5px; font-weight: 700; }
.evacut-style-dur { font-size: 11px; font-weight: 600; color: var(--accent-primary); }
.evacut-style-desc { font-size: 11px; color: var(--text-muted); line-height: 1.4; }
.evacut-style-note { font-size: 10.5px; color: var(--warning, #d68a2a); line-height: 1.4; margin-top: 2px; }

.evacut-generate-cta { width: 100%; margin-top: 14px; }
.evacut-secondary-link { background: none; border: none; color: var(--text-secondary); font-size: 12px; cursor: pointer; padding: 0; text-decoration: underline; }

/* ============================================================
   8. Mission Control redesign — "Executive Glass" / "Executive Daylight"
   docs/design/MISSION_CONTROL_CLAUDE_HANDOFF.md §8 (layout), §9 (EVA card +
   popout), §10 (responsive), §11 (accessibility).

   Deliberately OUTSIDE both EVA_VISUAL_LOCK regions: this section adds new
   layout/component rules and consumes tokens only. The locked EVA core (orb
   geometry, liquid animation, mesh, reduced-motion contract) is untouched and
   re-used as-is by the new EVA card.
   ============================================================ */

/* ---- top command bar: search · client switcher · quick create · account ---- */
.topbar {
  position: sticky; top: 0; z-index: 46;
  margin-inline: -20px; padding-inline: 20px;
  background: color-mix(in srgb, var(--bg-canvas) 84%, transparent);
  backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur);
}
html.reduce-transparency .topbar { background: var(--bg-canvas); backdrop-filter: none; -webkit-backdrop-filter: none; }

/* ---- page header: eyebrow · title · one status sentence ---- */
.mc-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: var(--space-5); padding: var(--space-6) 0 var(--space-5);
}
.mc-head .h1 { font-size: 30px; line-height: 38px; letter-spacing: -.6px; }
.mc-eyebrow {
  display: flex; align-items: center; gap: var(--space-2);
  font-size: 11.5px; font-weight: 600; letter-spacing: .8px; text-transform: uppercase;
  color: var(--text-muted); margin-bottom: var(--space-2);
}
.mc-eyebrow .mc-eyebrow-dot {
  width: 6px; height: 6px; border-radius: 50%; flex: none;
  background: var(--eva-accent); box-shadow: 0 0 10px var(--eva-accent);
}
.mc-status { font-size: 14px; line-height: 21px; color: var(--text-secondary); margin: var(--space-2) 0 0; max-width: 62ch; }

/* ---- KPI row ---- */
.mc-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-4); margin-bottom: var(--space-6); }
.mc-kpi {
  --panel-accent: var(--kpi-tone);
  --kpi-tone: var(--accent-primary);
  position: relative; isolation: isolate; overflow: hidden;
  display: flex; flex-direction: column; align-items: flex-start; gap: 0;
  padding: var(--space-4) var(--space-5) var(--space-5);
  text-align: left; font: inherit; color: var(--text-primary); cursor: pointer;
  border-color: color-mix(in srgb, var(--kpi-tone) 22%, var(--panel-border));
  transition: transform .12s ease-out, border-color .12s;
}
.panel.mc-kpi::before {
  content: ""; position: absolute; z-index: 0; inset: 0; pointer-events: none;
  background: radial-gradient(120% 100% at 100% 0%, color-mix(in srgb, var(--kpi-tone) 13%, transparent), transparent 62%);
}
.mc-kpi::after {
  content: ""; position: absolute; z-index: 0; left: 0; top: 0; bottom: 0; width: 3px;
  background: linear-gradient(to bottom, var(--kpi-tone), transparent 82%);
}
.mc-kpi:hover { transform: translateY(-1px); border-color: color-mix(in srgb, var(--kpi-tone) 46%, var(--panel-border)); }
.mc-kpi-top { display: flex; align-items: center; gap: var(--space-2); width: 100%; }
.mc-kpi-ico {
  width: 28px; height: 28px; flex: none; display: grid; place-items: center; border-radius: 9px;
  color: var(--kpi-tone);
  background: color-mix(in srgb, var(--kpi-tone) 14%, var(--surface-2));
  border: 1px solid color-mix(in srgb, var(--kpi-tone) 34%, var(--border-subtle));
}
.mc-kpi-ico .ui-icon { width: 15px; height: 15px; }
.mc-kpi-k { font-size: 12px; font-weight: 600; letter-spacing: .3px; color: var(--text-secondary); }
.mc-kpi-v { font-size: 34px; line-height: 42px; font-weight: 700; letter-spacing: -1px; font-variant-numeric: tabular-nums; margin-top: var(--space-3); }
.mc-kpi-v .mc-kpi-unit { font-size: 15px; font-weight: 600; letter-spacing: 0; color: var(--text-secondary); margin-left: 5px; }
.mc-kpi-meta { font-size: 11.5px; line-height: 1.45; color: var(--text-muted); margin-top: 2px; }
.mc-kpi[data-tone="rose"] { --kpi-tone: var(--icon-rose); }
.mc-kpi[data-tone="blue"] { --kpi-tone: var(--icon-blue); }
.mc-kpi[data-tone="violet"] { --kpi-tone: var(--icon-violet); }
.mc-kpi[data-tone="teal"] { --kpi-tone: var(--eva-accent); }
.mc-kpi[data-tone="amber"] { --kpi-tone: var(--icon-amber); }
.mc-kpi-ok { color: var(--success); }
.mc-kpi-warn { color: var(--warning); }

/* ---- dashboard rows ---- */
.mc-row { display: grid; gap: var(--space-4); margin-bottom: var(--space-4); align-items: stretch; }
.mc-row > * { min-width: 0; }
.mc-row-primary { grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr) minmax(0, 1fr); }
.mc-row-secondary { grid-template-columns: minmax(0, 1.22fr) minmax(0, 1fr) minmax(0, 1.3fr); }
.mc-row-tertiary { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.mc-span-2 { grid-column: span 2; }
.mc-row > .panel:nth-child(3n + 1) { --panel-accent: var(--icon-violet); }
.mc-row > .panel:nth-child(3n + 2) { --panel-accent: var(--icon-blue); }
.mc-row > .panel:nth-child(3n + 3) { --panel-accent: var(--icon-teal); }
.mc-row-tertiary > .panel:nth-child(3n + 2) { --panel-accent: var(--icon-amber); }
.mc-row-tertiary > .panel:nth-child(3n + 3) { --panel-accent: var(--icon-rose); }
/* work queues stay calmer than EVA surfaces (handoff §7) */
.mc-row-secondary > .panel, .mc-row-tertiary > .panel { box-shadow: var(--panel-shadow); }
.mc-section-label {
  font-size: 11px; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase;
  color: var(--text-muted); margin: var(--space-6) 0 var(--space-3);
}
.mc-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  flex: 1; min-height: 96px; padding: var(--space-5) var(--space-4); text-align: center;
  font-size: 12.5px; color: var(--text-muted);
  border: 1px dashed var(--border-subtle); border-radius: var(--r-card);
}
.mc-empty b { color: var(--text-secondary); font-size: 13px; font-weight: 600; }

/* ---- decision inbox ---- */
.mc-decision {
  display: flex; align-items: center; gap: var(--space-3);
  padding: 10px; border-radius: var(--r-card); cursor: pointer;
  border: 1px solid color-mix(in srgb, var(--icon-rose) 26%, var(--border-subtle));
  background: color-mix(in srgb, var(--icon-rose) 7%, transparent);
}
.mc-decision + .mc-decision { margin-top: var(--space-2); }
.mc-decision:hover { border-color: color-mix(in srgb, var(--icon-rose) 52%, var(--border-subtle)); }
.mc-decision .wico { --icon-tone: var(--icon-rose); }

/* ============================================================
   9. EVA — organic orb card (handoff frame 06) + orb popout (frame 07)
   ============================================================ */
.panel.eva-card {
  align-items: center; justify-content: space-between; text-align: center;
  gap: 0; padding: var(--space-5) var(--space-5) var(--space-4);
  /* The card's whole height comes from here, never from the conversation
     (see .eva-card-thread's flex-basis: 0). This floor keeps the orb and a
     few messages visible even when the panels beside it are short; the grid
     row stretches it taller when they are not. */
  min-height: var(--eva-card-min-height);
  --panel-accent: var(--eva-accent);
  border-color: color-mix(in srgb, var(--eva-accent) 30%, var(--panel-border));
  box-shadow: var(--panel-shadow), 0 0 70px -38px var(--eva-accent);
  overflow: hidden;
}
/* the orb's "space": a deep field with a faint star wash + the orb's own bloom */
.panel.eva-card::before {
  content: ""; position: absolute; z-index: 0; inset: 0; pointer-events: none;
  background:
    radial-gradient(circle at 18% 22%, color-mix(in srgb, var(--text-primary) 22%, transparent) 0 1px, transparent 1.4px),
    radial-gradient(circle at 76% 16%, color-mix(in srgb, var(--text-primary) 16%, transparent) 0 1px, transparent 1.4px),
    radial-gradient(circle at 62% 74%, color-mix(in srgb, var(--text-primary) 14%, transparent) 0 1px, transparent 1.4px),
    radial-gradient(circle at 30% 66%, color-mix(in srgb, var(--text-primary) 12%, transparent) 0 1px, transparent 1.4px),
    radial-gradient(62% 48% at 50% 40%, color-mix(in srgb, var(--hero-orb-glow) 52%, transparent) 0%, transparent 74%),
    radial-gradient(128% 92% at 50% 4%, color-mix(in srgb, var(--bg-canvas) 72%, transparent) 0%, transparent 72%);
}
/* The orb is the card's backdrop now, not a row in its stack: absolutely
   positioned, centred, dimmed, and behind the conversation. pointer-events
   are re-enabled on the button itself so clicking the orb still opens the
   expanded popout — the wrapper must not swallow clicks meant for the
   panel behind it. */
.eva-orb-bg {
  position: absolute; inset: 0; z-index: 0;
  display: grid; place-items: center;
  pointer-events: none;
  opacity: .58;
}
.eva-orb-bg .hv-orb { margin: 0; pointer-events: auto; transform: scale(1.18); }
.eva-orb-bg .hv-orb:hover { transform: scale(1.22); }

/* The conversation, over the orb. Bubbles get their own translucent backing
   so text stays legible against the brightest part of the gradient — the orb
   is decoration and must never cost readability. */
.eva-card-thread {
  position: relative; z-index: 1;
  /* The card is a FIXED frame and the conversation scrolls inside it. Two
     things are load-bearing here and both are easy to get wrong:

     `flex-basis: 0` (the third value) means this element contributes NOTHING
     to the card's intrinsic height, so a long conversation can never push the
     card taller — it just fills whatever room the row gives it. An earlier
     version used `flex: 1` with a min-height, which did the opposite: every
     new message grew the card and dragged the whole dashboard row with it.

     `min-height: 0` is what actually lets overflow-y work. Flex items default
     to `min-height: auto`, which refuses to shrink below their content, so
     without this the element silently expands to fit every message and the
     scrollbar never appears no matter what overflow says. */
  flex: 1 1 0;
  min-height: 0;
  width: 100%;
  overflow-y: auto; overscroll-behavior: contain;
  /* column-reverse pins the pane to the newest message and keeps it pinned as
     messages arrive — no scroll scripting, and nothing that can misfire while
     the card is still detached. evaThreadHtml() emits newest-first to suit it
     (see the note there). */
  display: flex; flex-direction: column-reverse; gap: var(--space-3);
  padding: var(--space-3) var(--space-1) var(--space-2);
  text-align: left;
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--text-muted) 45%, transparent) transparent;
  /* Fade the top edge so a long conversation dissolves into the orb rather
     than being sliced off by the card's rounded corner. */
  mask-image: linear-gradient(to bottom, transparent 0, black var(--space-4), black 100%);
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, black var(--space-4), black 100%);
}
.eva-card-thread::-webkit-scrollbar { width: 6px; }
.eva-card-thread::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--text-muted) 40%, transparent); border-radius: 3px;
}
.eva-card-thread .eva-msg { backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.eva-card-thread .eva-msg-user {
  background: color-mix(in srgb, var(--surface-2) 82%, transparent);
}
.eva-card-thread .eva-msg-eva {
  background: color-mix(in srgb, var(--eva-accent) 13%,
              color-mix(in srgb, var(--surface-1-solid) 82%, transparent));
}
.eva-card .hv-state { position: relative; z-index: 1; margin: 0 0 var(--space-2); }
.eva-state.is-blocked,
.eva-state.is-degraded {
  width: 100%; min-height: 0; padding: 8px 10px; border-radius: var(--r-control);
  font-size: 12px; line-height: 1.4; text-align: left; color: var(--text-primary);
}
.eva-state.is-blocked {
  border: 1px solid color-mix(in srgb, var(--icon-rose) 42%, var(--border-subtle));
  background: color-mix(in srgb, var(--icon-rose) 13%, var(--surface-1-solid));
}
.eva-state.is-degraded {
  border: 1px solid color-mix(in srgb, var(--icon-amber) 42%, var(--border-subtle));
  background: color-mix(in srgb, var(--icon-amber) 12%, var(--surface-1-solid));
}

/* ---- chatbar (card + popout share it) ---- */
.eva-chatbar {
  position: relative; z-index: 1;
  display: flex; align-items: center; gap: var(--space-2);
  width: 100%; padding: 5px 5px 5px 14px; border-radius: var(--r-pill);
  background: color-mix(in srgb, var(--bg-deep) 78%, transparent);
  border: 1px solid var(--border-subtle);
  transition: border-color .12s, box-shadow .12s;
}
.eva-chatbar:focus-within {
  border-color: var(--eva-accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--eva-accent) 16%, transparent);
}
.eva-chat-input {
  flex: 1; min-width: 0; border: 0; background: transparent; outline: none;
  color: var(--text-primary); font-size: 13.5px; padding: 10px 0;
}
.eva-chat-input::placeholder { color: var(--text-muted); }
.eva-chat-btn {
  width: 36px; height: 36px; flex: none; display: grid; place-items: center;
  border-radius: 50%; cursor: pointer;
  border: 1px solid var(--border-subtle); background: var(--surface-2); color: var(--text-secondary);
  transition: background .12s, color .12s, border-color .12s;
}
.eva-chat-btn .ui-icon { width: 16px; height: 16px; }
.eva-chat-btn:hover { color: var(--text-primary); border-color: var(--border-strong); }
.eva-chat-btn.is-muted { opacity: .55; }
.eva-chat-btn.listening {
  color: var(--text-on-accent);
  background: var(--eva-accent);
  border-color: var(--eva-accent);
}
.eva-chat-btn.eva-send { border: 0; color: var(--text-on-accent); background: var(--accent-grad); }
.eva-chat-btn.eva-send:hover { filter: brightness(1.08); }
.eva-chat-btn:disabled { opacity: .45; cursor: not-allowed; }
.eva-chat-btn:focus-visible,
.eva-chat-input:focus-visible,
.eva-pop-close:focus-visible,
.mc-kpi:focus-visible,
.mc-decision:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }

/* ---- expanded EVA state: orb popout ---- */
/* ---- floating EVA launcher (every non-dashboard view; see ensureEvaFab in app.js) ----
   Sits under the popout backdrop (z 70) and hides while the popout is open —
   the :has() rule keeps open/close state out of JS entirely. The inner .hv-orb
   is display-only (same treatment as .eva-pop-mark): the FAB button is the
   click target, so the orb's own cursor/shadow affordances are stripped. */
.eva-fab {
  position: fixed; right: 22px; bottom: 22px; z-index: 60;
  width: 62px; height: 62px; padding: 0; border-radius: 50%;
  display: grid; place-items: center; cursor: pointer;
  background: color-mix(in srgb, var(--bg-panel) 82%, var(--eva-accent) 18%);
  border: 1px solid color-mix(in srgb, var(--eva-accent) 36%, var(--panel-border));
  box-shadow: var(--panel-shadow), 0 0 46px -18px var(--eva-accent);
}
.eva-fab:hover { border-color: color-mix(in srgb, var(--eva-accent) 60%, var(--panel-border)); }
.eva-fab:focus-visible { outline: 2px solid var(--eva-accent); outline-offset: 2px; }
.eva-fab .hv-orb { width: 46px; height: 46px; margin: 0; cursor: pointer; box-shadow: none; }
.eva-fab .hv-orb::before { display: none; }
.eva-fab .hv-liquid-orb { width: 42px; }
body:has(.eva-pop-back) .eva-fab { display: none; }

.eva-pop-back {
  position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: var(--space-6);
  background: var(--overlay);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
}
html.reduce-transparency .eva-pop-back { backdrop-filter: none; -webkit-backdrop-filter: none; }
.eva-pop {
  --panel-accent: var(--eva-accent);
  position: relative; isolation: isolate; overflow: hidden;
  width: min(560px, 100%); max-height: min(80vh, 760px);
  display: flex; flex-direction: column; padding: 0;
  border-color: color-mix(in srgb, var(--eva-accent) 32%, var(--panel-border));
  box-shadow: var(--panel-shadow), 0 0 90px -40px var(--eva-accent);
}
.eva-pop-head {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-4) var(--space-4) var(--space-3);
  border-bottom: 1px solid var(--border-subtle);
  background: linear-gradient(180deg, color-mix(in srgb, var(--eva-accent) 10%, transparent), transparent);
}
.eva-pop-mark { flex: none; display: grid; place-items: center; }
.eva-pop-mark .hv-orb { width: 44px; height: 44px; margin: 0; cursor: default; box-shadow: none; }
.eva-pop-mark .hv-orb::before { display: none; }
.eva-pop-mark .hv-liquid-orb { width: 40px; }
.eva-pop-titles { flex: 1; min-width: 0; text-align: left; }
.eva-pop-title { font-size: 16px; font-weight: 700; letter-spacing: -.2px; }
.eva-pop-context {
  display: inline-flex; align-items: center; gap: 5px; margin-top: 2px;
  font-size: 11px; font-weight: 600; letter-spacing: .4px;
  color: var(--eva-accent);
}
.eva-pop-context::before {
  content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor;
}
.eva-pop-close {
  width: 34px; height: 34px; flex: none; display: grid; place-items: center;
  border-radius: var(--r-control); cursor: pointer; font-size: 15px; line-height: 1;
  border: 1px solid var(--border-subtle); background: var(--surface-2); color: var(--text-secondary);
}
.eva-pop-close:hover { background: var(--surface-3); color: var(--text-primary); }
.eva-pop-thread {
  flex: 1; min-height: 180px; overflow-y: auto;
  /* column-reverse for the same reason as .eva-card-thread: both render the
     same newest-first markup from evaThreadHtml() and both must open on the
     newest message. */
  padding: var(--space-4); display: flex; flex-direction: column-reverse; gap: var(--space-3);
}
.eva-msg { max-width: 88%; padding: 10px 13px; border-radius: 14px; font-size: 13.5px; line-height: 1.55; }
.eva-msg-user {
  align-self: flex-end; border-bottom-right-radius: 5px;
  background: var(--surface-2); border: 1px solid var(--border-subtle); color: var(--text-primary);
}
.eva-msg-eva {
  align-self: flex-start; border-bottom-left-radius: 5px; color: var(--text-primary);
  background: color-mix(in srgb, var(--eva-accent) 11%, var(--surface-1-solid));
  border: 1px solid color-mix(in srgb, var(--eva-accent) 30%, var(--border-subtle));
}
.eva-msg-pending { color: var(--text-muted); }
.eva-msg-who { display: block; font-size: 10px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase; color: var(--text-muted); margin-bottom: 3px; }
.eva-pop-hint { padding: 0 var(--space-4); font-size: 11.5px; color: var(--text-muted); min-height: var(--eva-status-height); }
.eva-pop-hint.is-blocked,
.eva-pop-hint.is-degraded { margin: 0 var(--space-4); width: auto; }
.eva-pop-foot { padding: var(--space-3) var(--space-4) var(--space-4); }

/* ---- accessibility: reduced motion / reduced transparency ---- */
@media (prefers-reduced-motion: reduce) {
  .mc-kpi:hover { transform: none; }
}

/* ---- responsive (handoff §10) ---- */
@media (max-width: 1439px) {
  .mc-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .mc-row-primary { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); }
  .mc-row-primary > :nth-child(3) { grid-column: span 2; }
  .mc-row-secondary { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .mc-row-secondary > :nth-child(3) { grid-column: span 2; }
  .mc-row-tertiary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mc-row-tertiary > .mc-span-2 { grid-column: span 2; }
}
@media (max-width: 1023px) {
  .topbar { margin-inline: -16px; padding-inline: 16px; }
  .mc-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mc-head { padding: var(--space-5) 0 var(--space-4); }
  .mc-head .h1 { font-size: 26px; line-height: 33px; }
}
@media (max-width: 767px) {
  .mc-head { flex-direction: column; align-items: flex-start; gap: var(--space-3); }
  .mc-head .mc-head-actions { width: 100%; }
  .mc-head .mc-head-actions .btn { width: 100%; min-height: 44px; }
  .mc-kpis { gap: 10px; }
  .mc-kpi { padding: 14px 14px 16px; }
  .mc-kpi-v { font-size: 27px; line-height: 34px; margin-top: 10px; }
  .mc-row,
  .mc-row-primary,
  .mc-row-secondary,
  .mc-row-tertiary { grid-template-columns: minmax(0, 1fr); }
  .mc-row > *,
  .mc-row > .mc-span-2,
  .mc-row-primary > :nth-child(3),
  .mc-row-secondary > :nth-child(3) { grid-column: 1; }
  /* EVA card stays near the top of the mobile stack (handoff §10) */
  .mc-row-primary { display: flex; flex-direction: column; }
  .eva-card .hv-orb { width: var(--eva-core-size-mobile); height: var(--eva-core-size-mobile); }
  .eva-orb-space { min-height: calc(var(--eva-core-size-mobile) + var(--space-5)); }
  .eva-chat-btn { width: 40px; height: 40px; }
  .eva-chat-input { padding: 12px 0; }
  /* popout becomes a near-full-screen sheet; input clears the browser chrome */
  .eva-pop-back { padding: 0; place-items: end stretch; }
  .eva-pop {
    width: 100%; max-height: 92vh; height: 92vh;
    border-radius: var(--r-card) var(--r-card) 0 0;
  }
  .eva-pop-foot { padding-bottom: calc(var(--space-4) + env(safe-area-inset-bottom)); }
}

/* ---- late overrides that must beat earlier, more specific selectors ---- */
.mc-kpi .mc-kpi-word { font-size: 23px; line-height: 42px; font-weight: 700; letter-spacing: -.4px; }
.mc-decision.wrow .wico { --icon-tone: var(--icon-rose); }
.mc-decisions .panel-scroll { max-height: 300px; }
.mc-row > .panel > .panel-scroll { flex: 1; }
/* Task queue inside the secondary row is narrower than the full-width v1 table —
   fix the column rhythm so no header/cell clips (handoff §13 "no text
   overlaps/clips"). */
.mc-row .tq { table-layout: fixed; }
.mc-row .tq th:nth-child(1), .mc-row .tq td:nth-child(1) { width: 38%; }
.mc-row .tq th:nth-child(2), .mc-row .tq td:nth-child(2) { width: 18%; }
.mc-row .tq th:nth-child(3), .mc-row .tq td:nth-child(3) { width: 16%; }
.mc-row .tq th:nth-child(4), .mc-row .tq td:nth-child(4) { width: 18%; }
.mc-row .tq th:nth-child(5), .mc-row .tq td:nth-child(5) { width: 10%; text-align: right; }
.mc-row .tq td.muted { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mc-row .tq .pbar { flex: 1; width: auto; min-width: 24px; }
.panel.dash-foot { flex-direction: row; flex-wrap: wrap; }
/* the chatbar wrapper's focus-within ring IS the focus indicator — the input's
   own outline on top of it reads as a double border */
.eva-chatbar .eva-chat-input:focus-visible { outline: none; }
html.reduce-transparency .eva-chatbar { background: var(--bg-deep); }

/* Mobile top command bar: the client switcher was the one control that never
   got a compact form, so the bar overflowed and the page scrolled sideways at
   <=390px (handoff §10 "avoid horizontal scroll"). Collapse it to an icon
   button like Quick Create; the dropdown still lists every client. */
@media (max-width: 767px) {
  .topbar #client-sel-btn {
    max-width: 44px !important; width: 44px; min-height: 44px;
    padding: 0; justify-content: center; gap: 0;
  }
  .topbar #client-sel-btn > span { display: none; }
}

/* ---------- floating cards (generic pop-out window container, max 3 open) ----------
   Ported from v1 "floating run cards". This is a content-agnostic shell — callers
   supply the body HTML via openFloatingCard(id, renderFn) in app.js; nothing here
   knows what's inside a card. */
.fcard-layer { position: fixed; inset: 0; pointer-events: none; z-index: 55; }
.fcard {
  position: absolute; top: 86px; left: calc(50% - 360px); width: min(760px, 90vw); height: min(80vh, 860px);
  background: var(--panel-background), var(--surface-1); border: 1px solid var(--border-strong);
  border-radius: var(--r-card); box-shadow: var(--panel-shadow, var(--shadow-card));
  backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur);
  display: flex; flex-direction: column; pointer-events: auto; overflow: hidden;
}
.fcard .fchead {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px;
  border-bottom: 1px solid var(--border-subtle); background: var(--surface-2); cursor: grab; user-select: none; flex: none;
}
.fcard .fchead .fchead-title {
  font-weight: 700; font-size: 13px; color: var(--text-primary); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.fcard.dragging .fchead { cursor: grabbing; }
.fcard .fchead .x {
  margin-left: auto; cursor: pointer; font-size: 18px; line-height: 1; color: var(--text-muted);
  background: none; border: none; padding: 2px 4px;
}
.fcard .fchead .x:hover { color: var(--text-primary); }
.fcard .fcbody { flex: 1; overflow-y: auto; padding: 16px 18px; min-height: 0; }
