    :root {
      --bg: #f5efe2;
      --paper: #fffaf0;
      --ink: #15232d;
      --muted: #5a6b76;
      --accent: #0f8b8d;
      --accent-2: #e36414;
      --good: #1e8e3e;
      --warn: #b26f00;
      --bad: #be123c;
      --line: #d8c9a9;
      --shadow: 0 10px 30px rgba(21, 35, 45, 0.12);
      --card-radius: 16px;
      --eps: 5;

      /* ── Phase 18 token layer (plan 18-03) ─────────────────────────────────────────
         Role-named tokens built ON TOP of the twelve-variable seed above, which keeps its
         exact names and values. Every light value below is the literal it replaces, copied
         verbatim: this layer is re-plumbing, not restyling. Two roles that happen to share a
         hex today get two names on purpose, so plan 18-04 can diverge them in dark without
         touching light. */

      /* Page and card washes */
      --bg-wash-1: #f8f4ea;
      --bg-wash-2: #f2e7d3;
      --bg-glow-1: rgba(15, 139, 141, 0.18);
      --bg-glow-2: rgba(227, 100, 20, 0.18);
      --card-wash-1: #fff9ef;
      --card-wash-2: #fff2de;
      --shadow-soft: 0 4px 14px rgba(21, 35, 45, 0.06);

      /* Surfaces */
      --surface-raised: #fffdf8;
      --surface-soft: #fefbf7;
      --surface-warm: #f7eedc;
      --surface-sunken: #f0e8d8;
      --surface-head: #fdf5e5;
      --surface-hover: #fff6e8;
      --surface-tab-hover: #fdf6ea;
      --surface-calc: #fff7e9;
      --surface-code: #f7f3eb;
      --surface-teal: #f0f5f5;
      --surface-info: #e8f4f8;
      --surface-drag: #ecfffe;
      --surface-input: #fff;
      --surface-clear-hover: #ffe0b2;
      --on-accent: #fff;
      --ink-dim: #555;
      --title-strong: #000;

      /* Borders */
      --line-warm: #ead7b6;
      --line-soft: #ead9bb;
      --line-strong: #cdb995;
      --line-table: #eedfbe;
      --line-faint: #eee;

      /* Status families — badge, KPI tile and gate pill share one set each */
      --ok-bg: #e3f9eb;
      --ok-fg: #14652a;
      --ok-line: #82d9a0;
      --notok-bg: #fff8e1;
      --notok-fg: #7a5500;
      --notok-line: #ffd54f;
      --caution-bg: #fffbeb;
      --caution-fg: #92400e;
      --caution-line: #fde68a;
      --bad-bg: #fff0f3;
      --bad-fg: #a30f34;
      --bad-line: #ffc6d0;
      --old-bg: #eef1f5;
      --old-fg: #4a5568;
      --old-line: #c3ccd8;

      /* Accent shades and semantic washes */
      --accent-deep: #0d6e72;
      --accent-edge: #0b6e70;
      --accent-hint: #0d5e60;
      --accent-wash: rgba(15, 139, 141, 0.07);
      --warn-wash: rgba(178, 111, 0, 0.10);
      --accent-2-bg: #fff6ea;
      --accent-2-line: #d9b070;
      --accent-2-fg: #7f4c00;
      --good-edge: #1a6b2e;
      --good-tint: rgba(26,122,64,0.10);
      --good-wash: rgba(30, 142, 62, 0.08);
      --good-wash-line: rgba(30, 142, 62, 0.25);
      --bad-wash: rgba(190, 18, 60, 0.08);
      --bad-wash-line: rgba(190, 18, 60, 0.25);
      --best-run-wash: rgba(30,142,62,0.08);

      /* Chart colours — consumed by the SVG the JS modules generate. The 18-01 probe
         (18-SVG-VAR-PROBE.md) measured SVG_VAR_PRESENTATION_ATTR: RESOLVES in Edge 153, so
         these are referenced as fill="var(--x)" / stroke="var(--x)" presentation attributes. */
      --chart-bg: #fffdf8;
      --chart-bg-alt: #fafaf8;
      --chart-grid: #e2e8f0;
      --chart-grid-warm: #d7e0ea;
      --chart-axis: #64748b;
      --chart-axis-warm: #5a6b76;
      --chart-axis-strong: #7b8794;
      --chart-tick: #475569;
      --chart-tick-warm: #5a6b76;
      --chart-label: #334155;
      --chart-label-dim: #888888;
      --chart-label-strong: #111111;
      --chart-label-soft: #444444;
      --chart-hairline: #aaaaaa;
      --chart-text-halo: rgba(250,248,242,0.92);
      --chart-hatch: #cbd5e1;
      --chart-north: #1e3a5f;
      --chart-crosshair: #111827;
      --chart-marker-blue: #2563eb;
      --chart-marker-blue-fill: #dbeafe;
      --chart-wind: #6b7280;
      --chart-note: #6b7280;
      --chart-label-brown: #7c2d12;
      --chart-trace-warm: #ea580c;
      --chart-trace-warm-soft: #fb923c;
      --accent-tint: rgba(15,139,141,0.10);
      --marker-good-edge: #14532d;
      --marker-bad-edge: #7f1d1d;
      --marker-warn-fill: #f97316;
      --marker-good-fill: #ecfdf5;
      --marker-ok-edge: #15803d;
      --table-subhead: #f9f5f0;
      --table-filter-row: #fffdf8;
      --chip-good-bg: #f0fdf4;
      --chip-good-line: #bbf7d0;
      --chip-bad-bg: #fef2f2;
      --chip-bad-line: #fecaca;
      --series-cs: #1a56db;
      --series-dt: #b45309;
      --series-as: #047857;

      /* Trace state — the accelerating / neutral / decelerating split the Speed and
         Precision overlays already distinguish. */
      --trace-accel: #22c55e;
      --trace-neutral: #fbbf24;
      --trace-decel: #ef4444;

      /* Competition rank ramp — RESERVED. Nothing consumes these in the light theme yet;
         plan 18-04 gives them their dark gold/silver/bronze values and plan 18-05 spends
         them on the dogfight medals. */
      --rank-1: #b8860b;
      --rank-2: #8c8f94;
      --rank-3: #a1662f;
      --rank-better: #1e8e3e;
      --rank-worse: #be123c;

      /* Dogfight orbit canvas (Phase 19). Light values are byte-identical to the canvas
         fallback literals passed to themeColor; --ink, --muted and --surface-raised are
         reused for the canvas ink, grid and background. */
      --df-state-none: #d1d5db;
      --df-control-zone: #3b82f6;
      --df-offensive: #22c55e;
      --df-defensive: #ef4444;
      --df-pursuit: #d946ef;
      --df-neutral: #9ca3af;
      --df-unscored: #6b7280;
      --df-pilot-a: #3b82f6;
      --df-pilot-b: #ef4444;
      --df-halo: #fff;
      --df-shadow: #c4c9cf;
      --df-tracer: #facc15;
      --df-flash: #fffff0;
      --df-gun-solution: #f59e0b;

      /* ── Type scale (plan 18-03) ────────────────────────────────────────────────────
         Eight steps, derived from the eight most-used font sizes in the stylesheet and in
         the generated markup, NOT from an invented geometric ramp: the acceptance rule is
         that adopting a step must not move a computed pixel value. The ramp sits low
         because this is a dense telemetry table. Sizes that do not land on a step are left
         as literals and listed in 18-03-SUMMARY.md rather than silently resized. */
      --fs-1: 0.7rem;
      --fs-2: 0.72rem;
      --fs-3: 0.74rem;
      --fs-4: 0.75rem;
      --fs-5: 0.78rem;
      --fs-6: 0.8rem;
      --fs-7: 0.82rem;
      --fs-8: 0.85rem;

      /* ── Spacing scale (plan 18-03) ─────────────────────────────────────────────────
         A 4/8px rhythm. Adopted only where every component of a box already sits on the
         rhythm, so no computed box changes; 2/3/5/6/10/14px boxes keep their literals. */
      --space-1: 4px;
      --space-2: 8px;
      --space-3: 12px;
      --space-4: 16px;
      --space-5: 20px;
      --space-6: 24px;
    }

    /* == Phase 18 DARK CHAMPIONSHIP THEME (plan 18-04) ==============================
       ADDITIVE AND OPT-IN (18-CONTEXT.md D9). The :root block above is the light theme,
       it is the default, and NOTHING below changes any of its values. Dark is reached
       two ways:

         1. the OS preference, via the @media block -- but only when the user has made
            no explicit choice, hence :root:not([data-theme="light"]);
         2. an explicit stored choice, via :root[data-theme="dark"].

       Both selectors have the same specificity (0,2,0), so SOURCE ORDER decides between
       them: the explicit block is written AFTER the media block so an explicit dark
       choice also wins under an OS light preference. Do not reorder them.

       Every foreground/surface pair that carries body text or a data label is asserted
       at WCAG AA (4.5:1) by automated-tests/_test_theme_tokens.js, which computes the
       ratio from the browser’s own resolved colours. ============================= */
    @media (prefers-color-scheme: dark) {
      :root:not([data-theme="light"]) {

        /* Seed -- the twelve originals, re-valued. Near-black instrument ground; the paper
           surface is separated from it by LIGHTNESS, not by a louder border. */
        --bg: #0a0e13;
        --paper: #161d26;
        --ink: #e6edf5;
        --muted: #9fb2c2;
        --accent: #2dd4bf;
        --accent-2: #fb923c;
        --good: #34d399;
        --warn: #fbbf24;
        --bad: #fb7185;
        --line: #263141;
        --shadow: 0 10px 30px rgba(0, 0, 0, 0.55);

        /* Page and card washes -- DESATURATED on purpose. In light these gradients carry the
           page’s only real saturation; in dark the saturation budget belongs to the data, so
           the ground is near-neutral and the glows are barely there. */
        --bg-wash-1: #0c1119;
        --bg-wash-2: #0e141c;
        --bg-glow-1: rgba(45, 212, 191, 0.05);
        --bg-glow-2: rgba(251, 146, 60, 0.04);
        --card-wash-1: #161d26;
        --card-wash-2: #131a23;
        --shadow-soft: 0 4px 14px rgba(0, 0, 0, 0.45);

        /* Surfaces -- an elevation ramp by lightness alone. */
        --surface-raised: #1b232e;
        --surface-soft: #18202a;
        --surface-warm: #1e2733;
        --surface-sunken: #111821;
        --surface-head: #1a222c;
        --surface-hover: #223040;
        --surface-tab-hover: #1f2836;
        --surface-calc: #1c2532;
        --surface-code: #131a22;
        --surface-teal: #12242a;
        --surface-info: #10222b;
        --surface-drag: #0f2b2e;
        --surface-input: #131a22;
        --surface-clear-hover: #3a2a12;
        --on-accent: #04161a;
        --ink-dim: #c3d0dc;
        --title-strong: #f5f9fc;

        /* Borders -- quieter than in light, because elevation is carried by surface lightness. */
        --line-warm: #2a3547;
        --line-soft: #26303f;
        --line-strong: #3a4759;
        --line-table: #222c3a;
        --line-faint: #1c242f;

        /* Status families -- saturated foregrounds on deep tinted grounds. Every fg/bg pair
           here is asserted at WCAG AA (4.5:1) by _test_theme_tokens.js, never eyeballed. */
        --ok-bg: #0d2a1b;
        --ok-fg: #5ce39b;
        --ok-line: #1f6b43;
        --notok-bg: #2e2408;
        --notok-fg: #fbd34d;
        --notok-line: #7a5f10;
        --caution-bg: #2c2209;
        --caution-fg: #fcd34d;
        --caution-line: #7c611a;
        --bad-bg: #331018;
        --bad-fg: #ff8a9c;
        --bad-line: #7d2436;
        --old-bg: #1a212b;
        --old-fg: #a8b6c4;
        --old-line: #3a4757;

        /* Accent shades and semantic washes. */
        --accent-deep: #14b8a6;
        --accent-edge: #2dd4bf;
        --accent-hint: #5eead4;
        --accent-wash: rgba(45, 212, 191, 0.10);
        --warn-wash: rgba(251, 191, 36, 0.12);
        --accent-2-bg: #2b1c0b;
        --accent-2-line: #8a5a1e;
        --accent-2-fg: #fcb26a;
        --good-edge: #10b981;
        --good-tint: rgba(52, 211, 153, 0.14);
        --good-wash: rgba(52, 211, 153, 0.10);
        --good-wash-line: rgba(52, 211, 153, 0.35);
        --bad-wash: rgba(251, 113, 133, 0.10);
        --bad-wash-line: rgba(251, 113, 133, 0.35);
        --best-run-wash: rgba(52, 211, 153, 0.12);
        --accent-tint: rgba(45, 212, 191, 0.14);

        /* Chart -- the saturation budget. Grids and axes recede; labels and traces come forward. */
        --chart-bg: #131a23;
        --chart-bg-alt: #101720;
        --chart-grid: #2a3543;
        --chart-grid-warm: #2d3846;
        --chart-axis: #8fa3b5;
        --chart-axis-warm: #90a4b4;
        --chart-axis-strong: #a9bacb;
        --chart-tick: #c3d2e0;
        --chart-tick-warm: #bfcedd;
        --chart-label: #d5e1ec;
        --chart-label-dim: #9aa8b6;
        --chart-label-strong: #f2f7fb;
        --chart-label-soft: #b9c6d3;
        --chart-hairline: #55626f;
        --chart-text-halo: rgba(19,26,35,0.92);
        --chart-hatch: #33404f;
        --chart-north: #7aa7e0;
        --chart-crosshair: #dbe6f0;
        --chart-marker-blue: #60a5fa;
        --chart-marker-blue-fill: #12243d;
        --chart-wind: #93a3b3;
        --chart-note: #93a3b3;
        --chart-label-brown: #f0a878;
        --chart-trace-warm: #fb923c;
        --chart-trace-warm-soft: #fdba74;
        --marker-good-edge: #34d399;
        --marker-bad-edge: #fb7185;
        --marker-warn-fill: #fb923c;
        --marker-good-fill: #0e2a20;
        --marker-ok-edge: #34d399;
        --table-subhead: #171f29;
        --table-filter-row: #131a23;
        --chip-good-bg: #0e2a1c;
        --chip-good-line: #1f6b43;
        --chip-bad-bg: #2e1219;
        --chip-bad-line: #7d2436;
        --series-cs: #60a5fa;
        --series-dt: #fbbf24;
        --series-as: #34d399;

        /* Trace state. */
        --trace-accel: #34d399;
        --trace-neutral: #fbbf24;
        --trace-decel: #fb7185;

        /* Competition rank ramp -- gold, silver, bronze, then better/worse than reference.
           This is the championship semantic the brief asked for; plan 18-05 spends it on the
           dogfight medals. */
        --rank-1: #ffd24a;
        --rank-2: #cfd8e3;
        --rank-3: #e08b4c;
        --rank-better: #34d399;
        --rank-worse: #fb7185;

        /* Dogfight orbit canvas (Phase 19). Offensive/defensive follow the dark trace-accel/-decel,
           the pilots follow the same hues, the halo becomes the dark canvas surface (a
           background-coloured ring, as white is in light). Tracer, flash and gun-solution keep
           their light values: amber and yellow read on both grounds and the literal
           gun-solution legend box must keep matching its wedge. */
        --df-state-none: #374151;
        --df-control-zone: #60a5fa;
        --df-offensive: #34d399;
        --df-defensive: #fb7185;
        --df-pursuit: #e879f9;
        --df-neutral: #94a3b8;
        --df-unscored: #64748b;
        --df-pilot-a: #60a5fa;
        --df-pilot-b: #fb7185;
        --df-halo: #1b232e;
        --df-shadow: #4b5563;
        --df-tracer: #facc15;
        --df-flash: #fffff0;
        --df-gun-solution: #f59e0b;

        /* Type and spacing scales are THEME-INVARIANT -- a theme re-values colour, never rhythm.
           They are restated verbatim so each dark block is a complete cover of every token that
           governs a snapshotted node, and so a step cannot later be added to light alone. */
        --fs-1: 0.7rem;
        --fs-2: 0.72rem;
        --fs-3: 0.74rem;
        --fs-4: 0.75rem;
        --fs-5: 0.78rem;
        --fs-6: 0.8rem;
        --fs-7: 0.82rem;
        --fs-8: 0.85rem;
        --space-1: 4px;
        --space-2: 8px;
        --space-3: 12px;
        --space-4: 16px;
        --space-5: 20px;
        --space-6: 24px;
        --card-radius: 16px;
      }
    }

    /* The explicit choice. MUST stay after the media block above (see the note there). */
    :root[data-theme="dark"] {

      /* Seed -- the twelve originals, re-valued. Near-black instrument ground; the paper
         surface is separated from it by LIGHTNESS, not by a louder border. */
      --bg: #0a0e13;
      --paper: #161d26;
      --ink: #e6edf5;
      --muted: #9fb2c2;
      --accent: #2dd4bf;
      --accent-2: #fb923c;
      --good: #34d399;
      --warn: #fbbf24;
      --bad: #fb7185;
      --line: #263141;
      --shadow: 0 10px 30px rgba(0, 0, 0, 0.55);

      /* Page and card washes -- DESATURATED on purpose. In light these gradients carry the
         page’s only real saturation; in dark the saturation budget belongs to the data, so
         the ground is near-neutral and the glows are barely there. */
      --bg-wash-1: #0c1119;
      --bg-wash-2: #0e141c;
      --bg-glow-1: rgba(45, 212, 191, 0.05);
      --bg-glow-2: rgba(251, 146, 60, 0.04);
      --card-wash-1: #161d26;
      --card-wash-2: #131a23;
      --shadow-soft: 0 4px 14px rgba(0, 0, 0, 0.45);

      /* Surfaces -- an elevation ramp by lightness alone. */
      --surface-raised: #1b232e;
      --surface-soft: #18202a;
      --surface-warm: #1e2733;
      --surface-sunken: #111821;
      --surface-head: #1a222c;
      --surface-hover: #223040;
      --surface-tab-hover: #1f2836;
      --surface-calc: #1c2532;
      --surface-code: #131a22;
      --surface-teal: #12242a;
      --surface-info: #10222b;
      --surface-drag: #0f2b2e;
      --surface-input: #131a22;
      --surface-clear-hover: #3a2a12;
      --on-accent: #04161a;
      --ink-dim: #c3d0dc;
      --title-strong: #f5f9fc;

      /* Borders -- quieter than in light, because elevation is carried by surface lightness. */
      --line-warm: #2a3547;
      --line-soft: #26303f;
      --line-strong: #3a4759;
      --line-table: #222c3a;
      --line-faint: #1c242f;

      /* Status families -- saturated foregrounds on deep tinted grounds. Every fg/bg pair
         here is asserted at WCAG AA (4.5:1) by _test_theme_tokens.js, never eyeballed. */
      --ok-bg: #0d2a1b;
      --ok-fg: #5ce39b;
      --ok-line: #1f6b43;
      --notok-bg: #2e2408;
      --notok-fg: #fbd34d;
      --notok-line: #7a5f10;
      --caution-bg: #2c2209;
      --caution-fg: #fcd34d;
      --caution-line: #7c611a;
      --bad-bg: #331018;
      --bad-fg: #ff8a9c;
      --bad-line: #7d2436;
      --old-bg: #1a212b;
      --old-fg: #a8b6c4;
      --old-line: #3a4757;

      /* Accent shades and semantic washes. */
      --accent-deep: #14b8a6;
      --accent-edge: #2dd4bf;
      --accent-hint: #5eead4;
      --accent-wash: rgba(45, 212, 191, 0.10);
      --warn-wash: rgba(251, 191, 36, 0.12);
      --accent-2-bg: #2b1c0b;
      --accent-2-line: #8a5a1e;
      --accent-2-fg: #fcb26a;
      --good-edge: #10b981;
      --good-tint: rgba(52, 211, 153, 0.14);
      --good-wash: rgba(52, 211, 153, 0.10);
      --good-wash-line: rgba(52, 211, 153, 0.35);
      --bad-wash: rgba(251, 113, 133, 0.10);
      --bad-wash-line: rgba(251, 113, 133, 0.35);
      --best-run-wash: rgba(52, 211, 153, 0.12);
      --accent-tint: rgba(45, 212, 191, 0.14);

      /* Chart -- the saturation budget. Grids and axes recede; labels and traces come forward. */
      --chart-bg: #131a23;
      --chart-bg-alt: #101720;
      --chart-grid: #2a3543;
      --chart-grid-warm: #2d3846;
      --chart-axis: #8fa3b5;
      --chart-axis-warm: #90a4b4;
      --chart-axis-strong: #a9bacb;
      --chart-tick: #c3d2e0;
      --chart-tick-warm: #bfcedd;
      --chart-label: #d5e1ec;
      --chart-label-dim: #9aa8b6;
      --chart-label-strong: #f2f7fb;
      --chart-label-soft: #b9c6d3;
      --chart-hairline: #55626f;
      --chart-text-halo: rgba(19,26,35,0.92);
      --chart-hatch: #33404f;
      --chart-north: #7aa7e0;
      --chart-crosshair: #dbe6f0;
      --chart-marker-blue: #60a5fa;
      --chart-marker-blue-fill: #12243d;
      --chart-wind: #93a3b3;
      --chart-note: #93a3b3;
      --chart-label-brown: #f0a878;
      --chart-trace-warm: #fb923c;
      --chart-trace-warm-soft: #fdba74;
      --marker-good-edge: #34d399;
      --marker-bad-edge: #fb7185;
      --marker-warn-fill: #fb923c;
      --marker-good-fill: #0e2a20;
      --marker-ok-edge: #34d399;
      --table-subhead: #171f29;
      --table-filter-row: #131a23;
      --chip-good-bg: #0e2a1c;
      --chip-good-line: #1f6b43;
      --chip-bad-bg: #2e1219;
      --chip-bad-line: #7d2436;
      --series-cs: #60a5fa;
      --series-dt: #fbbf24;
      --series-as: #34d399;

      /* Trace state. */
      --trace-accel: #34d399;
      --trace-neutral: #fbbf24;
      --trace-decel: #fb7185;

      /* Competition rank ramp -- gold, silver, bronze, then better/worse than reference.
         This is the championship semantic the brief asked for; plan 18-05 spends it on the
         dogfight medals. */
      --rank-1: #ffd24a;
      --rank-2: #cfd8e3;
      --rank-3: #e08b4c;
      --rank-better: #34d399;
      --rank-worse: #fb7185;

      /* Dogfight orbit canvas (Phase 19). Offensive/defensive follow the dark trace-accel/-decel,
         the pilots follow the same hues, the halo becomes the dark canvas surface (a
         background-coloured ring, as white is in light). Tracer, flash and gun-solution keep
         their light values: amber and yellow read on both grounds and the literal
         gun-solution legend box must keep matching its wedge. */
      --df-state-none: #374151;
      --df-control-zone: #60a5fa;
      --df-offensive: #34d399;
      --df-defensive: #fb7185;
      --df-pursuit: #e879f9;
      --df-neutral: #94a3b8;
      --df-unscored: #64748b;
      --df-pilot-a: #60a5fa;
      --df-pilot-b: #fb7185;
      --df-halo: #1b232e;
      --df-shadow: #4b5563;
      --df-tracer: #facc15;
      --df-flash: #fffff0;
      --df-gun-solution: #f59e0b;

      /* Type and spacing scales are THEME-INVARIANT -- a theme re-values colour, never rhythm.
         They are restated verbatim so each dark block is a complete cover of every token that
         governs a snapshotted node, and so a step cannot later be added to light alone. */
      --fs-1: 0.7rem;
      --fs-2: 0.72rem;
      --fs-3: 0.74rem;
      --fs-4: 0.75rem;
      --fs-5: 0.78rem;
      --fs-6: 0.8rem;
      --fs-7: 0.82rem;
      --fs-8: 0.85rem;
      --space-1: 4px;
      --space-2: 8px;
      --space-3: 12px;
      --space-4: 16px;
      --space-5: 20px;
      --space-6: 24px;
      --card-radius: 16px;
    }

    /* The generated filter fields are emitted as <input> with NO type attribute, so the
       input[type="text"] rule further down has never matched them and they have always used
       the user-agent default field: white ground, black text. That is invisible against the
       light paper and unreadable against the dark one. These two rules give them the themed
       field, and they CANNOT affect light by construction -- neither selector matches unless
       a dark theme is active. Adding type="text" to the markup instead would change the
       generated HTML that several tests assert verbatim, for no light-theme gain. */
    @media (prefers-color-scheme: dark) {
      :root:not([data-theme="light"]) input:not([type]) {
        background: var(--surface-input);
        color: var(--ink);
        border-color: var(--line-strong);
      }
    }

    :root[data-theme="dark"] input:not([type]) {
      background: var(--surface-input);
      color: var(--ink);
      border-color: var(--line-strong);
    }

    * { box-sizing: border-box; }

    body {
      margin: 0;
      font-family: "Space Grotesk", sans-serif;
      color: var(--ink);
      background:
        radial-gradient(80vw 50vh at 5% 0%, var(--bg-glow-1), transparent 60%),
        radial-gradient(60vw 45vh at 95% 5%, var(--bg-glow-2), transparent 60%),
        linear-gradient(180deg, var(--bg-wash-1) 0%, var(--bg-wash-2) 100%);
      min-height: 100vh;
      animation: reveal 460ms ease-out;
    }

    @keyframes reveal {
      from { opacity: 0; transform: translateY(8px); }
      to   { opacity: 1; transform: translateY(0); }
    }

    .app { max-width: 1420px; margin: 0 auto; padding: var(--space-5); }

    .hero {
      background: linear-gradient(130deg, var(--card-wash-1) 0%, var(--card-wash-2) 100%);
      border: 1px solid var(--line-warm);
      border-radius: 14px;
      padding: 8px 14px;
      box-shadow: var(--shadow);
    }

    h1 { margin: 0; font-size: 1.45rem; letter-spacing: 0.02em; white-space: nowrap; font-weight: 800; }

    .sub { display: none; }

    .controls { display: flex; flex-direction: column; gap: 5px; }
    .controls-row { display: flex; align-items: center; gap: 6px; }
    .controls-row button { width: auto; min-height: 30px; padding: 3px 10px; font-size: var(--fs-8); }
    .controls-row select { width: auto; min-height: 30px; padding: 3px 7px; font-size: var(--fs-8); }
    .controls-row input[type="text"] { min-height: 30px; padding: 3px 8px; font-size: var(--fs-8); }

    .dropzone,
    .table-wrap {
      background: var(--paper);
      border: 1px solid var(--line);
      border-radius: var(--card-radius);
      box-shadow: var(--shadow-soft);
    }

    .dropzone {
      padding: var(--space-3);
      display: flex;
      align-items: center;
      justify-content: center;
      text-align: center;
      border-style: dashed;
      min-height: 54px;
      transition: all 180ms ease;
      cursor: pointer;
    }

    .dropzone.drag { border-color: var(--accent); background: var(--surface-drag); transform: translateY(-1px); }


    label {
      font-size: var(--fs-5);
      color: var(--muted);
      text-transform: uppercase;
      letter-spacing: 0.08em;
      font-weight: 700;
    }

    input[type="text"],
    input[type="number"],
    select,
    button {
      width: 100%;
      font-family: "Space Grotesk", sans-serif;
      border: 1px solid var(--line-strong);
      border-radius: 10px;
      background: var(--surface-input);
      color: var(--ink);
      padding: 9px 10px;
      min-height: 40px;
    }

    .btn { font-weight: 700; cursor: pointer; transition: transform 100ms ease, background 160ms ease; }
    .btn:active { transform: translateY(1px); }
    .btn-main { background: var(--accent); color: var(--on-accent); border-color: var(--accent-edge); }
    .btn-alt { background: var(--accent-2-bg); border-color: var(--accent-2-line); color: var(--accent-2-fg); }
    .btn-danger { background: var(--bad-bg); border-color: var(--bad-line); color: var(--bad-fg); }

    /* ── Tabs ── */
    .tabs-wrapper {
      display: flex;
      align-items: flex-end;
      justify-content: space-between;
      margin: var(--space-4) 0 0;
      border-bottom: 2px solid var(--line);
      padding-bottom: 0;
    }

    .tabs { display: flex; gap: var(--space-1); }

    .tab {
      padding: var(--space-2) var(--space-5);
      border: 1px solid var(--line);
      border-bottom: none;
      border-radius: 10px 10px 0 0;
      background: var(--surface-sunken);
      color: var(--muted);
      cursor: pointer;
      font-family: "Space Grotesk", sans-serif;
      font-weight: 600;
      font-size: 0.88rem;
      min-height: unset;
      width: auto;
      transition: background 150ms ease, color 150ms ease;
    }

    .tab:hover { background: var(--surface-tab-hover); color: var(--ink); }

    .tab.active {
      background: var(--paper);
      color: var(--ink);
      border-color: var(--line);
      position: relative;
      bottom: -2px;
      z-index: 1;
    }

    .tab-placeholder { opacity: 0.55; }

    
    .tabs-actions {
      display: flex;
      gap: 6px;
      margin-left: auto;
      align-items: flex-end;
      justify-content: flex-end;
    }

    .tabs-actions .btn {
      width: auto;
      min-height: unset;
      white-space: nowrap;
      flex: 0 0 auto;
      padding: 4px 10px;
      font-size: var(--fs-4);
      border-radius: 6px;
      margin-bottom: 4px;
    }

    #btnResetFilters { min-width: 160px; }

    /* ── Layout ── */
    .layout { display: grid; gap: var(--space-3); margin-top: 0; }

    .table-wrap { overflow: auto; animation: pop 240ms ease; }

    @keyframes pop {
      from { opacity: 0; transform: translateY(4px); }
      to   { opacity: 1; transform: translateY(0); }
    }

    table { width: 100%; border-collapse: collapse; }

    thead th {
      text-align: left;
      font-size: var(--fs-2);
      letter-spacing: 0.07em;
      color: var(--muted);
      text-transform: uppercase;
      position: sticky;
      top: 0;
      background: var(--surface-head);
      z-index: 1;
      border-bottom: 1px solid var(--line);
      padding: 6px 8px;
      white-space: nowrap;
    }

    tbody td { padding: var(--space-1) var(--space-2); border-bottom: 1px solid var(--line-table); font-size: 0.84rem; vertical-align: middle; line-height: 1.25; }
    /* v3.0 polish10 (T item 4): no hover colour change on a row whose drawer is open, or on
       the drawer row itself. */
    tbody tr:hover:not(.row-expanded) { background: var(--surface-hover); }
    tbody tr.detail-row:hover { background: transparent; }

    .mono { font-family: "IBM Plex Mono", monospace; font-size: 0.84rem; }

    .badge {
      display: inline-block;
      padding: 2px 8px;
      border-radius: 999px;
      border: 1px solid transparent;
      font-size: var(--fs-2);
      font-weight: 700;
      letter-spacing: 0.06em;
      text-transform: uppercase;
      white-space: nowrap;
    }

    .badge-ok        { background: var(--ok-bg); color: var(--ok-fg); border-color: var(--ok-line); }
    .badge-notok     { background: var(--notok-bg); color: var(--notok-fg); border-color: var(--notok-line); }
    .badge-invalid   { background: var(--bad-bg); color: var(--bad-fg); border-color: var(--bad-line); }
    .badge-old       { background: var(--old-bg); color: var(--old-fg); border-color: var(--old-line); }

    /* Dogfight pilot-set rank decoration (plan 18-05). Additive to the winner accent emphasis,
       never a replacement. Colour comes only from the plan-18-03 rank ramp tokens, which plan
       18-04 gave dark values -- no literals here, in either theme. */
    .rank-badge {
      display: inline-block;
      margin-left: 6px;
      font-size: var(--fs-1);
      font-weight: 700;
      letter-spacing: 0.04em;
      color: var(--muted);
    }
    .rank-badge.rank-none { font-weight: 400; }
    .rank-medal {
      padding: 0 5px;
      border-radius: 999px;
      border: 1px solid currentColor;
    }
    .rank-medal-1 { color: var(--rank-1); }
    .rank-medal-2 { color: var(--rank-2); }
    .rank-medal-3 { color: var(--rank-3); }

    .status { font-size: var(--fs-5); color: var(--muted); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    /* v3.0 polish11 (T item 7): floating toast overlaying the top of the app -- position:fixed
       takes it out of flow entirely, so it costs no layout space regardless of message length.
       Round 10's in-tab-bar placement (.tabs-status) is gone; this replaces it. */
    .status-toast {
      position: fixed; top: 12px; left: 50%; transform: translateX(-50%);
      z-index: 500; display: flex; align-items: center; gap: 8px;
      max-width: min(600px, calc(100vw - 32px));
      padding: 8px 12px; background: var(--paper); border: 1px solid var(--line); border-radius: 10px;
      box-shadow: var(--shadow); font-size: var(--fs-5);
    }
    /* .status's shared flex:1/min-width:0 (meant for the old full-width row layouts) collapses
       to zero width here: position:fixed with no explicit width makes .status-toast shrink-to-
       fit, and a flex:1 child inside a shrink-to-fit container resolves to 0, not its content
       size -- this is why round 10's move showed only the close button. Size to content instead. */
    .status-toast .status { flex: 0 1 auto; min-width: auto; max-width: 500px; }
    /* The global `button { width: 100%; }` reset (elsewhere overridden by .controls-row
       button's width:auto, a context this toast isn't inside) otherwise makes #statusClose
       balloon to consume the flex row's space, squeezing .status to nothing -- the actual
       cause of "only the ✕ is visible". */
    .status-toast button { width: auto; min-height: auto; padding: 0 2px; }

    .metric {
      display: inline-block;
      margin-right: 8px; margin-bottom: 4px;
      padding: 2px 6px;
      border-radius: 8px;
      background: var(--surface-warm);
      border: 1px solid var(--line-soft);
      font-size: 0.76rem;
    }

    .breakdown-table { width: 100%; border-collapse: collapse; font-size: var(--fs-8); margin-top: 8px; }
    .breakdown-table td { padding: 6px 8px; border: 1px solid var(--line); background: var(--surface-soft); }
    .breakdown-table td:first-child { font-weight: 600; color: var(--accent-deep); background: var(--surface-teal); width: 140px; }
    .breakdown-table td:nth-child(2) { color: var(--muted); font-size: var(--fs-6); width: 200px; }
    .breakdown-table td:nth-child(3) { text-align: right; font-family: "IBM Plex Mono", monospace; font-weight: 500; }

    tr.best-run { background: linear-gradient(to right, var(--best-run-wash), transparent) !important; }
    tr.best-run td { border-color: var(--good); border-top: 2px solid var(--good); }

    details { margin-top: 6px; }
    summary { cursor: pointer; color: var(--accent-deep); font-size: var(--fs-7); font-weight: 700; list-style: none; }

    th[data-sort] { cursor: pointer; user-select: none; position: relative; padding-left: 16px !important; }
    th[data-sort]::before { content: "⇅"; position: absolute; left: 2px; opacity: 0.3; font-size: 0.7em; }
    th[data-sort].sort-asc::before { content: "▲"; opacity: 0.8; }
    th[data-sort].sort-desc::before { content: "▼"; opacity: 0.8; }

    .score-toggle { font-weight: 700; color: var(--accent); text-decoration: none; cursor: pointer; }
    .score-toggle:hover { text-decoration: underline; }
    .detail-row td.calc-body { border-bottom: 2px solid var(--accent); background: var(--surface-calc); }

    .detail-drawer { margin-top: 6px; }
    .detail-drawer summary { font-size: var(--fs-2); letter-spacing: 0.03em; text-transform: uppercase; }

    .calc-body {
      margin-top: 4px;
      padding: 6px;
      min-width: 420px;
      max-width: 760px;
      overflow-x: auto;
      border: 1px solid var(--line-soft);
      border-radius: 8px;
      background: var(--surface-calc);
      font-size: var(--fs-4);
      line-height: 1.3;
      color: var(--muted);
    }

    .heatmap-wrap { margin-top: 6px; padding: 6px; border: 1px solid var(--line-soft); border-radius: 8px; background: var(--surface-raised); }
    .heatmap-wrap svg { display: block; width: 100%; height: auto; }

    /* ── Hide / Delete column ── */
    .btn-hide, .btn-delete {
      min-height: 20px;
      width: 22px;
      padding: 0;
      border-radius: 4px;
      font-size: var(--fs-1);
      line-height: 1;
    }

    .col-hide { width: 30px; text-align: center; }
    .col-del  { width: 30px; text-align: center; }

    .recording-label { display: inline-block; margin-top: 1px; font-size: var(--fs-1); color: var(--muted); white-space: nowrap; }

    #btnWatch.active { background: var(--good); color: var(--on-accent); border-color: var(--good-edge); }

    #watchStatus { color: var(--muted); font-size: var(--fs-2); }

    .foot { margin-top: 12px; color: var(--muted); font-size: var(--fs-6); line-height: 1.35; }
    /* v3.0 polish9 (T item 11): observations collapsed behind a link, off by default. */
    .obs-toggle { color: var(--accent); text-decoration: none; cursor: pointer; }
    .obs-toggle:hover { text-decoration: underline; }
    .obs-body { margin-top: 8px; }
    .obs-body p { margin: 0 0 8px; }
    .obs-body p:last-child { margin-bottom: 0; }

    /* ── Filter row – compact height ── */
    /* Lifted out of the per-tab inline style= attributes (plan 18-03): the table sub-head
       and filter rows are identical in Speed, Accuracy, Precision and Dogfight. Both rows
       live in <thead>, so no tbody rule competes and the computed values are unchanged. */
    tr.table-subhead { background: var(--table-subhead); font-size: var(--fs-4); color: var(--muted); font-weight: 500; }
    tr.filter-row { background: var(--table-filter-row); }
    tr.filter-row td { padding: 4px 6px; }

    tr.filter-row input,
    tr.filter-row select {
      min-height: unset;
      height: 30px;
      padding: 2px 6px;
      font-size: var(--fs-7);
      border-radius: 7px;
    }

    .filter-cell { display: flex; align-items: center; gap: 2px; }
    .filter-cell input,
    .filter-cell select { flex: 1; min-width: 0; }

    .btn-clear-filter {
      min-height: unset;
      width: 18px;
      height: 18px;
      padding: 0;
      border-radius: 4px;
      font-size: var(--fs-1);
      line-height: 1;
      flex-shrink: 0;
      background: var(--surface-sunken);
      border-color: var(--line-strong);
      color: var(--muted);
      cursor: pointer;
    }

    .btn-clear-filter:hover { background: var(--surface-clear-hover); color: var(--ink); }

    /* ── Placeholder tab content ── */
    .placeholder-tab {
      padding: 60px 20px;
      text-align: center;
      color: var(--muted);
      font-size: 1.1rem;
      border: 1px solid var(--line);
      border-radius: 0 var(--card-radius) var(--card-radius) var(--card-radius);
      background: var(--paper);
      margin-top: -1px;
    }

    /* ── Detail Drawer Redesign ── */
    .precision-drawer { padding: calc(var(--space-3) / 2); background: var(--surface-raised); border: 1px solid var(--line); border-radius: 10px; margin: var(--space-1) 0; }
    /* v3.0 polish9 (P item 2): the shared .run-summary-row is align-items:flex-start (V/D's
       rule, other tabs' summary cards are shorter than their charts by design), so it never
       stretched the Run Summary card to match the chart row's height here -- scoped to
       Precision only, since this is Precision's own row-height convention, not the shared
       standard's. */
    .precision-drawer .run-summary-row { align-items: stretch; }
    .precision-drawer .run-summary-card { height: 360px; overflow: auto; }
    /* v3.0 polish5 (P items 5-6): one row -- the bare TA31 circuit (no card), then the
       three impact cards, all the same height (align-items:stretch, the row's own fixed
       height). Circuit gets the larger flex share so it reads at ~600px against each
       card's ~250px, matching the brief's row proportions. */
    .precision-chart-row { display: flex; align-items: stretch; gap: 10px; height: 360px; margin-bottom: 10px; }
    /* v3.0 polish11 (P item 12): flex column, same shape as the impact cards, so the new
       HTML .precision-panel-title sits fixed-height at the top and the svg fills exactly
       what's left -- title text no longer has to be positioned by a fixed SVG-unit offset
       that drifted away from the visual top whenever H (data-dependent) shrank. */
    /* v3.0 polish14 (P item 2): border/background moved from the svg to this wrapper, so
       the HTML title sits INSIDE the border, like the impact panels' titles (padding added
       to match .precision-panel-card's 8px 10px). */
    .precision-circuit-panel { flex: 2.4 1 0; min-width: 0; display: flex; flex-direction: column; padding: 8px 10px; background: var(--chart-bg-alt); border: 1px solid var(--line); border-radius: 8px; box-sizing: border-box; }
    .precision-circuit-panel svg { flex: 1 1 auto; width: 100%; height: 100%; min-height: 0; display: block; }
    .precision-chart-row .precision-panel-card { flex: 1 1 0; display: flex; flex-direction: column; overflow: auto; }
    /* v3.0 polish8 (P item 1/3): height:100% (not auto) so the svg's own box actually
       fills whatever vertical space flex:1 leaves it, instead of an intrinsic-aspect
       height that left the card visibly shorter than the circuit beside it -- height:auto
       on a replaced element sizes from the viewBox aspect ratio, it does not stretch to
       fill a flex column's remaining space. */
    .precision-chart-row .precision-panel-card svg { flex: 1 1 auto; width: 100%; height: 100%; min-height: 0; display: block; }
    /* v3.0 polish7 (P item 5): pins the stats block to the card's bottom edge no matter
       how tall the chart or the miss-distance list renders, so Bomb/Rocket/Shell's stat
       blocks share one bottom edge across the row. */
    .precision-chart-row .precision-panel-card .precision-panel-stats { margin-top: auto; flex: 0 0 auto; }
    .precision-panel-card { padding: 8px 10px; background: var(--surface-raised); border: 1px solid var(--line-soft); border-radius: 8px; min-width: 0; }
    .precision-panel-title { font-size: var(--fs-3); font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: 0.05em; margin: 0 0 6px; }
    .precision-engaged { margin-left: 8px; font-size: var(--fs-1); font-weight: 600; color: var(--muted); text-transform: none; letter-spacing: 0; }
    /* Row 1 (circuit/AGL) and row 2 (Bomb/Rocket/Shell) get different fixed chart
       heights -- shrinking both to match Run Summary's (text-only, no chart) natural
       height let the row-1 charts go narrow (letterboxed sideways: box became wider
       than their content once shortened). Row 2's stats text already fills more of a
       shorter box, so it keeps the smaller value; row 1 gets a taller one so its charts
       render at full card width -- Run Summary is left with modest blank space below
       its (inherently shorter) text content instead. */
    /* v3.0 polish (L5, SVG dark-mode colours): the Speed/Precision label halo is set as an
       inline stroke= presentation attribute (kept literal for the sibling markup tests). A
       CSS rule against the same elements overrides it regardless of specificity -- SVG
       presentation attributes always lose to author stylesheet rules -- so the halo follows
       the theme instead of staying a fixed near-white that was illegible on dark chart bg. */
    svg text[paint-order="stroke"] { stroke: var(--chart-text-halo); }
    .precision-panel-card svg { width: 100%; height: 230px; display: block; }
    .precision-panel-card--chart-tall svg { height: 320px; }
    .precision-pds-score { font-size: 1.7rem; font-weight: 700; color: var(--accent); line-height: 1; }
    .precision-pds-score-label { font-size: 0.66rem; font-weight: 700; color: var(--muted); margin-left: 6px; letter-spacing: 0.05em; text-transform: uppercase; }
    .precision-panel-card .precision-summary-table { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line-soft); font-size: 0.68rem; }
    .precision-panel-card .precision-summary-table td:first-child { width: auto; white-space: nowrap; }
    .precision-panel-card .precision-summary-table td:last-child { white-space: nowrap; padding-left: 10px; }
    .precision-pds-formula { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line-soft); }
    .precision-pds-formula .score-equation-line { font-size: 0.66rem; color: var(--muted); white-space: normal; overflow-x: visible; text-align: left; padding-bottom: 4px; }
    /* v3.0 polish4: the Run Summary standard (all four tabs) -- one card, max 20% of the
       drawer width, never causing a horizontal scrollbar. Shared class set proposed by Lane D
       (sfl-apex-f4) and used identically by Speed/Accuracy (Lane V) and Precision/Dogfight
       (Lane D) so all four tabs render from one implementation. */
    .run-summary-row { display: flex; gap: 12px; align-items: flex-start; }
    .run-summary-chart-col { flex: 1 1 auto; min-width: 0; }
    /* v3.0 polish9 item 12 (Dogfight): the 3D canvas gets the same card treatment as
       Speed's trace map and Accuracy's circuit SVG. */
    .dogfight-canvas-frame { padding: 8px; background: var(--chart-bg-alt); border: 1px solid var(--line); border-radius: 8px; box-sizing: border-box; }
    /* v3.0 polish12 item 3: the scrub slider had no styling of its own, so it rendered in
       the browser's default (light-grey) track/thumb -- readable in light theme, washed
       out against dark. --line-strong / --accent-deep already darken correctly under
       :root[data-theme="dark"] (and OS dark via the media query), so no separate dark
       override is needed here. */
    input[data-scrub-slider] { -webkit-appearance: none; appearance: none; height: 4px; background: var(--line-strong); border-radius: 2px; outline: none; }
    input[data-scrub-slider]::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 13px; height: 13px; border-radius: 50%; background: var(--accent-deep); cursor: pointer; }
    input[data-scrub-slider]::-moz-range-thumb { width: 13px; height: 13px; border: none; border-radius: 50%; background: var(--accent-deep); cursor: pointer; }
    input[data-scrub-slider]::-moz-range-track { height: 4px; background: var(--line-strong); border-radius: 2px; }
    /* v3.0 polish12 item 4: one line, minimal widths, on a class rather than scattered
       inline styles -- see the comment at controlsHtml (82-dogfight-drawer.js) for why. */
    .dogfight-transport { display: flex; flex-wrap: nowrap; align-items: center; gap: 5px; margin-top: 6px; min-width: 0; }
    .dogfight-transport select { flex: 0 0 auto; width: auto; min-height: 22px; padding: 2px 5px; font-size: var(--fs-1); }
    .dogfight-transport button.btn { flex: 0 0 auto; width: auto; min-height: 22px; padding: 2px 8px; font-size: var(--fs-1); }
    .dogfight-transport input[data-scrub-slider] { flex: 1 1 0; min-width: 0; }
    .dogfight-transport span { flex: 0 0 auto; min-width: 6ch; text-align: right; font-size: var(--fs-1); }
    /* v3.0 polish14 item 7: close out the chart column the same way .run-summary-pilot
       closes out the card (border-top: 1px solid var(--line-soft)), mirrored as a bottom
       border with padding above it, below the coloured score bars. */
    [data-dogfight-timeline] { padding-bottom: 10px; border-bottom: 1px solid var(--line-soft); }
    .run-summary-card { flex: 0 0 20%; min-width: 0; padding: 6px 10px; background: var(--surface-raised); border: 1px solid var(--line-soft); border-radius: 8px; overflow-wrap: break-word; }
    /* v3.0 polish5: no "Run Summary" title -- the card starts at the player name. Kept as a
       dead rule (not deleted) in case a caller still emits it; nothing should render it now. */
    .run-summary-title { display: none; }
    .run-summary-player { font-size: var(--fs-4); font-weight: 700; color: var(--ink); margin-bottom: 3px; overflow-wrap: break-word; }
    .run-summary-score { font-size: 1.7rem; font-weight: 700; color: var(--accent); line-height: 1; }
    .run-summary-score-label { font-size: 0.66rem; font-weight: 700; color: var(--muted); margin-left: 6px; letter-spacing: 0.05em; text-transform: uppercase; }
    /* v3.0 polish11 (P item 10): no border-top -- spacing (margin/padding) stays.
       v3.0 polish12 (P item 1): 8px -> 6px top margin/padding, so Precision's longest
       realistic case (Run Time..TMD, all seven stat rows, plus Bomb/Rockets/Rounds,
       PTST, PDS -- verified against the real Guericke recording) fits the card's normal
       height with no vertical scrollbar. */
    .run-summary-section { margin-top: 6px; padding-top: 6px; }
    /* v3.0 polish10 (T item 6) / polish12 (P item 1): smaller still, tighter line-height
       and padding, so a Calculation line never forces the card to scroll. */
    /* v3.0 polish14 (V item 4): slightly larger than before, verified against Precision's
       longest realistic case (7 stat rows + 5 Calculation lines) with no vertical scrollbar. */
    .run-summary-section .score-equation-line { font-size: 0.57rem; line-height: 1.15; color: var(--muted); white-space: normal; overflow-x: visible; text-align: left; padding-bottom: 1px; }
    .run-summary-obs { font-size: 0.64rem; color: var(--muted); font-style: italic; }
    /* v3.0 polish5 (V item 2): one separator line above Calculation, not two -- the section
       immediately after the score (almost always the stats table) sits flush, with no rule
       of its own; only a section that follows ANOTHER section draws the line. */
    .run-summary-card .run-summary-section:first-child { margin-top: 6px; padding-top: 0; border-top: none; }
    /* Stats table inside the card: never wraps a line; only the right-hand number is bold. */
    .run-summary-section .driver-table { table-layout: auto; }
    /* v3.0 polish12 (P item 1): 3px -> 2px vertical row padding, part of the same fit. */
    .run-summary-section .driver-table td { white-space: nowrap; font-size: 0.68rem; padding: 2px 4px; }
    .run-summary-section .driver-table td:first-child { font-weight: 400; color: var(--muted); }
    .run-summary-section .driver-table td:last-child { font-weight: 700; color: var(--ink); }
    @media (max-width: 900px) {
      .run-summary-row { flex-direction: column; }
      .run-summary-card { flex-basis: auto; }
    }
    /* v3.0 polish4 (D6/D7): Dogfight's two pilots share one run-summary-card, each in its
       own player/score/section block, divided the same way precision-panel-card rows are. */
    .run-summary-pilot + .run-summary-pilot { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line-soft); }
    .drawer-section { margin-bottom: 14px; padding: var(--space-3); background: var(--paper); border: 1px solid var(--line); border-radius: 10px; }
    .drawer-section-title { font-size: var(--fs-5); text-transform: uppercase; letter-spacing: 0.08em; color: var(--accent); font-weight: 700; margin: 0 0 var(--space-2) 0; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
    .formula-display { font-family: "IBM Plex Mono", monospace; font-size: var(--fs-7); padding: var(--space-2); background: var(--surface-code); border-radius: 6px; margin-bottom: 8px; line-height: 1.6; }
    .contribution-table { width: 100%; border-collapse: collapse; font-size: var(--fs-7); margin-top: 8px; }
    .contribution-table th { text-align: left; font-size: var(--fs-2); letter-spacing: 0.06em; color: var(--muted); text-transform: uppercase; padding: var(--space-1) var(--space-2); border-bottom: 1px solid var(--line); }
    .contribution-table td { padding: 5px 8px; border-bottom: 1px solid var(--line-faint); vertical-align: middle; }
    .contribution-table tr.top-contributor { background: var(--bad-bg); font-weight: 600; }
    .contribution-bar-wrap { width: 100%; height: 6px; background: var(--line-faint); border-radius: 3px; overflow: hidden; }
    .contribution-bar { height: 100%; border-radius: 3px; background: var(--accent-2); }
    .contribution-bar.top { background: var(--bad); }
    .driver-tables { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
    .driver-group { padding: 10px; background: var(--surface-soft); border: 1px solid var(--line); border-radius: 8px; }
    .driver-group-title { font-size: 0.76rem; font-weight: 700; color: var(--accent); margin: 0 0 6px; text-transform: uppercase; letter-spacing: 0.05em; }
    .driver-table { width: 100%; border-collapse: collapse; font-size: var(--fs-5); }
    .driver-table td { padding: 4px 6px; border-bottom: 1px solid var(--line-soft); }
    .driver-table td:first-child { font-weight: 600; color: var(--ink-dim); width: 45%; }
    .driver-table td:last-child { text-align: right; font-family: "IBM Plex Mono", monospace; }
    .driver-table td.formula-cell { color: var(--muted); font-size: var(--fs-3); font-weight: 400 !important; }
    .coaching-hint { margin-top: 6px; padding: 6px 8px; background: var(--surface-info); border-left: 3px solid var(--accent); border-radius: 0 6px 6px 0; font-size: 0.76rem; color: var(--accent-hint); }
    .notice-close { border: none; background: transparent; color: inherit; cursor: pointer; font-size: var(--fs-8); line-height: 1; padding: 0 2px; opacity: 0.55; flex-shrink: 0; }
    .notice-close:hover { opacity: 1; }
    .heatmap-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
    .heatmap-cell { text-align: left; }
    .heatmap-cell-title { font-size: 0.76rem; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: 0.05em; margin: 0 0 var(--space-1); text-align: left; }
    /* v3.0 polish8 (P item 2): smallest readable font (below the --fs-1 token floor,
       same precedent as .heatmap-miss-list's existing hardcoded size) so the chart above
       keeps as much of the card's height as possible; only used by the Precision impact
       cards (71-drawer-precision.js). */
    .heatmap-impact-stats { margin-top: 3px; font-size: 0.62rem; line-height: 1.3; color: var(--muted); font-family: "IBM Plex Mono", monospace; }
    .heatmap-penalty-value { color: var(--ink); font-weight: 400; }
    .heatmap-penalty-value-top { color: var(--bad); font-weight: 700; }
    .heatmap-miss-list { margin-top: 2px; font-size: 0.62rem; line-height: 1.3; font-family: "IBM Plex Mono", monospace; color: var(--muted); display: flex; flex-wrap: wrap; gap: 1px 5px; }
    .heatmap-miss-hit  { color: var(--good); }
    .heatmap-miss-miss { color: var(--muted); }
    .log-source-badge { font-size: 0.65rem; font-weight: 600; color: var(--good, #1a7a40); background: var(--good-tint); border-radius: 3px; padding: 1px 4px; letter-spacing: 0.03em; vertical-align: middle; margin-left: 4px; }
    .priority-item { display: grid; grid-template-columns: 24px 1fr; gap: var(--space-2); padding: var(--space-2) 0; border-bottom: 1px solid var(--line-faint); font-size: var(--fs-7); }
    .priority-item:last-child { border-bottom: none; }
    .priority-rank { font-weight: 700; color: var(--bad); font-size: 0.9rem; text-align: center; }
    .priority-label { font-weight: 600; }
    .priority-evidence { color: var(--muted); font-size: var(--fs-5); }
    .priority-action { color: var(--accent-hint); font-size: var(--fs-5); font-style: italic; }
    .targets-table { width: 100%; border-collapse: collapse; font-size: var(--fs-7); }
    .targets-table th { text-align: left; font-size: var(--fs-2); letter-spacing: 0.06em; color: var(--muted); text-transform: uppercase; padding: var(--space-1) var(--space-2); border-bottom: 1px solid var(--line); }
    .targets-table td { padding: 5px 8px; border-bottom: 1px solid var(--line-faint); }
    .direction-hint { font-size: var(--fs-2); color: var(--good); }

    .score-explainer-total {
      display: flex;
      align-items: baseline;
      justify-content: space-between;
      gap: var(--space-2);
      padding: 0 0 var(--space-2);
      margin-bottom: 8px;
      background: transparent;
      border: none;
      border-bottom: 1px solid var(--line);
      border-radius: 0;
    }
    .score-explainer-total-label {
      font-size: 0.64rem;
      color: var(--muted);
      text-transform: uppercase;
      letter-spacing: 0.08em;
      font-weight: 700;
    }
    .score-explainer-total-value {
      font-size: 0.94rem;
      font-weight: 700;
      color: var(--ink);
      font-family: "IBM Plex Mono", monospace;
    }
    .score-explainer-list { display: grid; gap: var(--space-2); }
    .score-explainer-item {
      padding: 0;
      background: transparent;
      border: none;
      border-left: none;
      border-radius: 0;
    }
    .score-explainer-row {
      display: flex;
      align-items: baseline;
      justify-content: space-between;
      gap: var(--space-2);
      margin-bottom: 0;
    }
    .score-explainer-title { font-size: 0.69rem; font-weight: 700; color: var(--ink); }
    .score-explainer-points {
      font-size: var(--fs-3);
      font-weight: 700;
      color: var(--ink);
      font-family: "IBM Plex Mono", monospace;
      white-space: nowrap;
    }
    .score-explainer-meta {
      display: block;
      margin-bottom: 0;
      color: var(--muted);
      font-size: 0.63rem;
      line-height: 1.15;
      font-family: "IBM Plex Mono", monospace;
    }
    .score-explainer-copy { color: var(--muted); font-size: 0.66rem; line-height: 1.2; }
    .score-breakdown-panel { padding: 9px 10px; }

    /* ── Speed drawer specific ── */
    /* v3.0 polish2 (V item 4): cell-to-card padding is half the drawer-2col-body card gap
       (var(--space-3) = 12px), shared across all four mission tabs. */
    .speed-drawer, .accuracy-drawer { padding: calc(var(--space-3) / 2); background: transparent; border: none; border-radius: 0; margin: 0; }

    .score-formula-inline {
      font-size: var(--fs-6);
      color: var(--muted);
      white-space: nowrap;
      overflow-x: auto;
      text-align: right;
      max-width: 100%;
    }

    .score-equation-line {
      font-size: 0.55rem;
      color: var(--muted);
      font-family: "IBM Plex Mono", monospace;
      white-space: nowrap;
      overflow-x: auto;
      text-align: center;
      padding-bottom: 2px;
    }

    .score-top-worsener { color: var(--bad); font-weight: 700; }
    .score-improve { color: var(--bad); font-weight: 700; margin-left: 10px; }

    .tacview-cell,
    .tacview-cell a {
      white-space: nowrap;
    }

    .tacview-cell { text-align: right; }

    /* v3.0 polish5 (V item 1): player name + identity badge never wrap onto a second line. */
    .player-cell { white-space: nowrap; }

    .gate-progress-table { width: 100%; border-collapse: collapse; font-size: var(--fs-6); }
    .gate-progress-table th { text-align: left; font-size: var(--fs-2); letter-spacing: 0.06em; color: var(--muted); text-transform: uppercase; padding: var(--space-1) var(--space-2); border-bottom: 1px solid var(--line); }
    .gate-progress-table td { padding: var(--space-1) var(--space-2); border-bottom: 1px solid var(--line-faint); vertical-align: middle; }
    .gate-progress-table tr.gate-missed { background: var(--bad-bg); }
    .gate-progress-table tr.gate-passed { }
    .gate-badge-pass { display: inline-block; padding: 1px 6px; border-radius: 999px; font-size: var(--fs-1); font-weight: 700; background: var(--ok-bg); color: var(--ok-fg); border: 1px solid var(--ok-line); }
    .gate-badge-miss { display: inline-block; padding: 1px 6px; border-radius: 999px; font-size: var(--fs-1); font-weight: 700; background: var(--bad-bg); color: var(--bad-fg); border: 1px solid var(--bad-line); }

    /* ── Responsive ── */
    @media (max-width: 1080px) {
      .controls-row { flex-wrap: wrap; }
    }

    @media (max-width: 900px) {
      .driver-tables { grid-template-columns: 1fr; }
      .heatmap-grid { grid-template-columns: 1fr; }
      .precision-chart-row { flex-direction: column; height: auto; }
      .precision-circuit-panel svg { height: 360px; }
    }

    .drawer-kpi-strip { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
    .kpi-item { display: flex; flex-direction: column; padding: 6px 10px; background: var(--paper); border: 1px solid var(--line); border-radius: 8px; min-width: 90px; flex: 1; }
    .kpi-item.kpi-good { border-color: var(--ok-line); background: var(--ok-bg); }
    .kpi-item.kpi-warn { border-color: var(--caution-line); background: var(--caution-bg); }
    .kpi-item.kpi-bad  { border-color: var(--bad-line); background: var(--bad-bg); }
    .kpi-label { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 600; }
    .kpi-value { font-size: 0.98rem; font-weight: 700; font-family: "IBM Plex Mono", monospace; margin-top: 1px; color: var(--ink); }
    .kpi-item.kpi-good .kpi-value { color: var(--ok-fg); }
    .kpi-item.kpi-warn .kpi-value { color: var(--caution-fg); }
    .kpi-item.kpi-bad  .kpi-value { color: var(--bad-fg); }
    /* v3.0 polish4: Speed/Accuracy now use the shared .run-summary-row/-chart-col/-card
       (see above) instead of their own drawer-2col-body/-left-col/-right-col. */
    .gate-table-toggle { font-size: var(--fs-6); color: var(--accent); text-decoration: none; cursor: pointer; }
    .gate-table-toggle:hover { text-decoration: underline; }

    /* -- Cloud tab (Phase 11) -- */
    /* v3.0 polish16 (round 16 items 1-2): session block left, Refresh/Sign out right --
       was flex-start with everything in one left-hand cluster. */
    .cloud-header {
      display: flex; align-items: baseline; justify-content: right;
      gap: 14px; flex-wrap: wrap; margin: 12px 0 6px;
    }

    .cloud-session-block { display: flex; align-items: center; gap: var(--space-2); font-size: var(--fs-5); color: var(--muted); min-width: 0; }
    .cloud-session-email { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }

    /* v3.0 polish14 (A item 10): nowrap + shrink-safe buttons so Refresh/Sign out never drop
       to their own line under "Signed in as …". */
    .cloud-who { font-size: var(--fs-5); color: var(--muted); display: flex; align-items: center; justify-content: flex-end; gap: var(--space-2); flex-wrap: nowrap; max-width: 100%; }
    .cloud-who-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
    .cloud-who .btn { flex-shrink: 0; }

    /* v3.0 polish (L3 item 6): standard heading size/weight, was var(--fs-6)/500 (too small). */
    /* v3.0 polish6 (M item 4): a consistent rule + spacing under every section heading,
       so the Admin tab's sections read alike without wrapping each one in its own panel. */
    .cloud-section {
      margin: 26px 0 10px; padding-bottom: 6px; font-size: 0.95rem; font-weight: 700;
      color: var(--ink); letter-spacing: 0.01em; border-bottom: 1px solid var(--line);
    }
    .cloud-empty {
      padding: 18px; text-align: center; font-size: var(--fs-7);
      color: var(--muted); border: 1px dashed var(--line); border-radius: 10px;
    }

    .cloud-error, .cloud-notice {
      margin: var(--space-2) 0; padding: 8px 11px; font-size: var(--fs-5);
      border: 1px solid; border-radius: 10px;
    }

    .cloud-error  { color: var(--bad);  background: var(--bad-wash);  border-color: var(--bad-wash-line); }
    .cloud-notice { color: var(--good); background: var(--good-wash);  border-color: var(--good-wash-line); }

    /* -- Guide tab (self-onboarding) -- */
    .guide-tab { padding: 8px 4px 24px; }
    .guide-h2 { font-size: 1.05rem; font-weight: 700; color: var(--ink); margin: 0 0 8px; }
    .guide-intro { margin: 18px 0; max-width: 900px; }
    .guide-intro p { color: var(--ink); font-size: var(--fs-5); line-height: 1.55; margin: 0 0 10px; }
    .guide-intro a, .guide-steps a { color: var(--accent); }
    .guide-actions {
      display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
      gap: 12px; margin: 4px 0 22px; max-width: 1180px;
    }
    .guide-action {
      display: flex; flex-direction: column; gap: 4px; padding: 14px 16px;
      border: 1px solid var(--accent); border-radius: 10px;
      background: var(--accent-wash);
      text-decoration: none; transition: background 0.15s ease, box-shadow 0.15s ease;
    }
    .guide-action:hover { background: var(--surface-raised); box-shadow: var(--shadow-soft); }
    .guide-action:hover .guide-action-label { text-decoration: underline; }
    .guide-action-label { font-size: var(--fs-5); font-weight: 700; color: var(--accent); }
    .guide-action-url {
      font-size: var(--fs-7); font-weight: 500; color: var(--muted);
      word-break: break-all;
    }
    .guide-steps { margin: 8px 0 0; padding-left: 20px; color: var(--ink); font-size: var(--fs-5); line-height: 1.6; }
    .guide-steps li { margin-bottom: 6px; }
    .guide-footnote p { color: var(--muted); font-size: var(--fs-6); }
    .guide-grid {
      display: grid; grid-template-columns: repeat(4, 1fr);
      gap: 16px; margin: 20px 0;
    }
    @media (max-width: 1100px) {
      .guide-grid { grid-template-columns: repeat(2, 1fr); }
    }
    @media (max-width: 620px) {
      .guide-grid { grid-template-columns: 1fr; }
    }
    .guide-card {
      display: flex; flex-direction: column;
      border: 1px solid var(--line); border-radius: 12px; overflow: hidden;
      background: var(--panel, transparent);
    }
    .guide-card-body { padding: 16px; display: flex; flex-direction: column; flex: 1; }
    .guide-card-kicker {
      font-size: var(--fs-7); font-weight: 700; letter-spacing: 0.06em;
      text-transform: uppercase; color: var(--accent);
    }
    .guide-card-title {
      font-size: 1.35rem; font-weight: 800; color: var(--accent); margin: 2px 0 12px;
      padding-bottom: 8px; border-bottom: 2px solid var(--accent);
    }
    .guide-card-facts { margin: 0; }
    .guide-card-facts dt {
      font-size: var(--fs-7); font-weight: 700; text-transform: uppercase;
      letter-spacing: 0.03em; color: var(--muted); margin-top: 10px;
    }
    .guide-card-facts dt:first-child { margin-top: 0; }
    .guide-card-facts dd { margin: 3px 0 0; color: var(--ink); font-size: var(--fs-6); line-height: 1.5; }
    .guide-card-link {
      display: block; margin-top: auto; padding-top: 12px;
      font-size: var(--fs-6); font-weight: 500; color: var(--accent); text-decoration: none;
      word-break: break-all;
    }
    .guide-card-link:hover { text-decoration: underline; }

    .cloud-file { max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .cloud-uploaded { color: var(--good); font-size: var(--fs-5); font-weight: 500; }
    .cloud-muted { color: var(--muted); }
    .cloud-uis { color: var(--muted); font-size: 0.76rem; margin-left: 6px; }

    /* -- Cloud tab: teams and leaderboard (Phase 12) -- */
    .cloud-team-forms { display: flex; gap: 18px; flex-wrap: wrap; margin: var(--space-1) 0 var(--space-2); }

    .cloud-team-form {
      display: flex; align-items: flex-end; gap: var(--space-2);
      padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px;
      background: var(--paper);
    }

    .cloud-team-form label { font-size: var(--fs-3); color: var(--muted); }
    .cloud-team-form input { display: block; margin-top: 4px; width: 180px; }
    /* v3.0 polish3 (A item 3): the base `button { width: 100% }` rule stretched Create/
       Join/Add to fill the flex item; sized to content instead. */
    .cloud-team-form button { width: auto; }

    .cloud-team-bar {
      display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
      margin: 4px 0 10px; font-size: var(--fs-8);
    }

    .cloud-invite { font-size: var(--fs-5); color: var(--muted); }

    .cloud-invite code {
      font-family: "IBM Plex Mono", monospace; font-size: var(--fs-8);
      letter-spacing: 0.08em; color: var(--ink);
      padding: 2px 7px; border: 1px solid var(--line); border-radius: 6px;
      background: var(--paper);
    }

    .cloud-board-picker { display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0 10px; }
    .cloud-rank { font-weight: 700; color: var(--accent); text-align: center; }

    /* v3.0 polish (L3 item 5): one card per mission instead of a button-switched table. */
    .cloud-board-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: var(--space-4); margin: var(--space-2) 0 10px; }
    .cloud-board-card { border: 1px solid var(--line); border-radius: 10px; padding: var(--space-3); background: var(--paper); min-width: 0; }
    /* v3.0 polish11 (A item 6): dogfight has 6 columns vs. the others' 5 -- give it the
       full row so it never forces a horizontal scrollbar at 1280px. */
    .cloud-board-card-wide { grid-column: 1 / -1; }
    .cloud-board-card-title { margin: 0 0 8px; font-size: var(--fs-6); font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: 0.05em; }
    .cloud-dl { text-decoration: none; }

    /* v3.0 polish (L3 item 3): row-select checkboxes and the bulk action bar. */
    /* v3.0 polish16 (round 16 item 4): every action bar right-aligned, one standard. */
    .cloud-bulk-bar { display: flex; justify-content: flex-end; gap: var(--space-2); flex-wrap: wrap; margin: 4px 0 8px; }
    .cloud-bulk-bar .btn { width: auto; }
    td input[type="checkbox"].cloud-select-upload,
    td input[type="checkbox"].cloud-select-delete,
    th input[type="checkbox"].cloud-select-all-upload,
    th input[type="checkbox"].cloud-select-all-delete { width: auto; margin: 0; }

    /* v3.0 polish (L3 item 1): single-line rows across the Admin tab's tables. */
    .cloud-tab td, .cloud-tab th { white-space: nowrap; }
    .cloud-tab .cloud-file { white-space: nowrap; }

    /* v3.0 polish (L3 item 7, P9): the callsign-alias editor hosted in Admin. */
    .cloud-identity { margin-bottom: 10px; }
    .cloud-alias-hint { font-size: var(--fs-5); color: var(--muted); margin: 0 0 8px; }
    /* v3.0 polish6 (M item 1): two compact columns -- add-form left (fixed, content-sized),
       alias list right (flexes) -- was a full-width list with the form spanning below it. */
    .cloud-alias-cols { display: flex; gap: var(--space-4); align-items: flex-start; }
    .cloud-alias-add { flex: 0 0 auto; display: flex; flex-direction: row; align-items: center; gap: 6px; white-space: nowrap; }
    .cloud-alias-add label { font-size: var(--fs-3); color: var(--muted); display: flex; align-items: center; gap: 6px; }
    .cloud-alias-add input { width: 140px; }
    .cloud-alias-add button { width: auto; }
    /* v3.0 polish16 (round 16 item 3): one line of "|"-separated chips, was a
       one-alias-per-row grid. */
    .cloud-alias-list { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
    .cloud-alias-chip { display: inline-flex; align-items: center; gap: 6px; }
    .cloud-alias-sep { color: var(--line); }
    .cloud-alias-bound-tag { font-size: var(--fs-1); color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
    @media (max-width: 640px) { .cloud-alias-cols { flex-direction: column; } .cloud-alias-add { flex-basis: auto; width: 100%; } }

    /* v3.0 polish2/4 (A item 1 / item 2): the reparented #identityBlock (Callsign/Event/
       Group + Rename Tacview Files) on one line; overflows to a scrollbar rather than
       wrap. polish4 fix: mountIdentityBlock() appends #identityBlock itself INTO
       .cloud-rename-row, so #identityBlock -- not the wrapper -- is the flex container
       whose direct children (pilotNameInput/tournamentSelect/phaseSelect/btnRename)
       need the row layout; flexing only the wrapper left #identityBlock as a single
       block-flow item with its four controls still stacked inside it. */
    .cloud-rename-row { overflow-x: auto; padding-bottom: 2px; }
    .cloud-rename-row #identityBlock {
      display: flex; align-items: center; gap: 8px; flex-wrap: nowrap;
    }
    .cloud-rename-row #identityBlock input,
    .cloud-rename-row #identityBlock select,
    .cloud-rename-row #identityBlock button {
      width: auto; flex: 0 0 auto;
    }

    /* v3.0 polish3 (A item 4): Share/etc. row actions sized like the mission tabs'
       H/X buttons (.btn-hide/.btn-delete, app.css ~line 883); .cloud-actions-cell keeps
       the actions column from wrapping even where a row's other cells may not. */
    .btn-row-action { min-height: 20px; width: 22px; padding: 0; border-radius: 4px; font-size: var(--fs-1); line-height: 1; margin-right: 4px; }
    .cloud-actions-cell { white-space: nowrap; }

    /* -- Cloud tab: admin dashboard (Phase 13) -- */
    .cloud-admin { margin-top: 26px; padding-top: 14px; border-top: 2px solid var(--line); }

    .cloud-admin code {
      font-family: "IBM Plex Mono", monospace; font-size: var(--fs-6);
      letter-spacing: 0.06em;
    }

    .cloud-admin .btn { margin-right: 4px; }

    .cloud-admin-note {
      margin: 14px 0 0; padding: 8px 11px;
      font-size: var(--fs-3); color: var(--muted);
      background: var(--accent-wash);
      border: 1px solid var(--line); border-radius: 10px;
    }

    /* v3.0 polish6 (M item 6): co-owner chips + the promote-a-member picker, both compact
       row content rather than full-width controls. */
    .cloud-owners-cell { white-space: normal; }
    .cloud-owner-chip {
      display: inline-flex; align-items: center; gap: 4px;
      padding: 2px 6px; margin: 2px 4px 2px 0;
      border: 1px solid var(--line); border-radius: 999px; font-size: var(--fs-2);
    }
    .cloud-owner-chip .btn-row-action { min-height: 16px; width: 16px; margin: 0; }
    .cloud-owner-add { display: inline-flex; align-items: center; gap: 4px; margin-top: 2px; }
    .cloud-owner-add select { width: auto; max-width: 140px; min-height: 22px; padding: 1px 4px; font-size: var(--fs-2); }
    .cloud-owner-add .btn-row-action { margin: 0; }

    /* -- Phase 22: cloud runs in tabs (hosted app only; var() tokens only) --
       v3.0 polish2 (A item 4): inline-flex, not flex -- a block-level .run-tags forced
       a line break after the Tacview cell's date link regardless of .tacview-cell's own
       white-space: nowrap (that only governs text, not block child layout). nowrap keeps
       every tag on the same line as the date instead of wrapping under it. */
    .run-tags {
      display: inline-flex; align-items: center; flex-wrap: nowrap; gap: var(--space-1);
      margin-left: var(--space-1); vertical-align: middle; white-space: nowrap; font-family: "Space Grotesk", sans-serif;
    }
    .run-tag-local, .run-tag-observed { background: transparent; color: var(--old-fg); border-color: var(--old-line); }
    .cloud-sync { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-2); font-size: var(--fs-8); }
    .cloud-sync[hidden] { display: none; }
    .cloud-sync-label { color: var(--muted); font-weight: 400; }
    .cloud-sync-count { color: var(--ink); font-weight: 700; font-size: var(--fs-8); }
    .cloud-sync-bar {
      appearance: none; -webkit-appearance: none;
      width: 160px; height: 8px; border-radius: 4px; border: 0;
      background: var(--surface-sunken);
    }
    .cloud-sync-bar::-webkit-progress-bar { background: var(--surface-sunken); border-radius: 4px; }
    .cloud-sync-bar::-webkit-progress-value { background: var(--accent-deep); border-radius: 4px; }
    .cloud-sync-action {
      min-height: 32px; background: transparent; border: 0; padding: 0 var(--space-1);
      color: var(--ink); font: inherit; text-decoration: underline; cursor: pointer;
    }
    .cloud-sync .cloud-error { margin: 0; }
    .cloud-sync-failures {
      flex-basis: 100%; list-style: none;
      background: var(--surface-raised); border: 1px solid var(--bad-line); border-radius: 10px;
      padding: var(--space-2) var(--space-4); margin: var(--space-2) 0 0;
      max-height: 192px; overflow: auto;
    }
    .cloud-sync-failures li { padding: var(--space-1) 0; display: flex; gap: var(--space-2); min-width: 0; }
    .cloud-sync-failures .cloud-file { min-width: 0; flex: 0 1 auto; }
    .cloud-sync-reason { color: var(--bad-fg); white-space: nowrap; }
    .cloud-sync button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
    .run-tag-stage { background: transparent; color: var(--muted); border-color: var(--line); }
    /* The one caution badge (UI-SPEC C3); Phases 24/25 reuse it. */
    .badge-caution { background: var(--caution-bg); color: var(--caution-fg); border-color: var(--caution-line); }
    /* -- Phase 22 (22-02): "Which pilot are you?" picker, UI-SPEC C4 (var() tokens only) -- */
    .pilot-picker {
      display: grid; gap: var(--space-4);
      background: var(--surface-raised); border: 1px solid var(--line); border-radius: 10px;
      padding: var(--space-4); margin: var(--space-2) 0;
      font-size: var(--fs-8); white-space: normal; text-align: left;
    }
    .pilot-picker h4 { margin: 0; font-size: 0.98rem; font-weight: 700; line-height: 1.2; color: var(--ink); }
    .pilot-picker-intro { margin: var(--space-1) 0 0; color: var(--muted); font-weight: 400; }
    .pilot-picker-list { display: grid; gap: var(--space-2); }
    .pilot-picker-option {
      display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--space-2); align-items: center;
      min-height: 40px; padding: var(--space-2) var(--space-4);
      border: 1px solid var(--line-soft); border-radius: 8px; cursor: pointer;
    }
    .pilot-picker-option:hover { background: var(--surface-hover); }
    .pilot-picker-option.is-selected, .pilot-picker-option:has(input:checked) { border-color: var(--accent-deep); background: var(--surface-hover); }
    .pilot-picker-text { display: flex; align-items: baseline; gap: var(--space-2); min-width: 0; }
    .pilot-picker-callsign { color: var(--ink); font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
    .pilot-picker-meta, .pilot-picker-placeholder { color: var(--muted); font-weight: 400; white-space: nowrap; }
    .pilot-picker-note { border-top: 1px solid var(--line-soft); padding-top: var(--space-4); color: var(--muted); }
    .pilot-picker-note[hidden] { display: none; }
    .pilot-picker-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
    .pilot-picker .btn-main { background: var(--accent-deep); border-color: var(--accent-edge); color: var(--on-accent); width: auto; }
    .pilot-picker-action {
      width: auto; min-height: 32px; background: transparent; border: 0; padding: 0 var(--space-1);
      color: var(--ink); font: inherit; text-decoration: underline; cursor: pointer;
    }
    .pilot-picker-action[hidden] { display: none; }
    .pilot-picker-error { color: var(--bad-fg); }
    .pilot-picker-error:empty { display: none; }
    .pilot-picker input:focus-visible, .pilot-picker button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

    /* ── Phase 24: Run Card (24-01) ── var() tokens only; spacing 4/8/16/24 */
    .run-card { background: var(--surface-raised); border: 1px solid var(--line); border-radius: 10px; padding: var(--space-4); margin: var(--space-2); display: grid; gap: var(--space-4); text-align: left; }
    .run-card-facts { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-4); }
    .run-card-fact { display: inline-flex; gap: var(--space-1); align-items: baseline; min-width: 0; }
    .run-card-label { font-size: var(--fs-2); font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
    .run-card-value { font-size: var(--fs-8); color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 320px; }
    .run-card-ellipsis { display: inline-block; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
    .run-card-scores { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-2); border-top: 1px solid var(--line-soft); padding-top: var(--space-4); }
    .run-card-scores .kpi-item { min-width: 0; }
    @media (max-width: 719px) { .run-card-scores { grid-template-columns: 1fr; } }
    .run-card-sub { font-size: var(--fs-8); color: var(--muted); margin-top: var(--space-1); }
    .run-card-badge-outline { background: transparent; color: var(--old-fg); border-color: var(--old-line); }
    .official-tile { display: flex; flex-direction: column; gap: var(--space-1); }
    .official-tile.official-sfl { border-left: 3px solid var(--accent-deep); }
    .official-tile.official-self { border: 1px dashed var(--old-line); background: var(--paper); }
    .official-badge-sfl { background: var(--accent-deep); color: var(--on-accent); border-color: var(--accent-edge); }
    .official-badge-self { background: transparent; color: var(--old-fg); border: 1px dashed var(--old-line); }
    .official-value { font-weight: 700; color: var(--ink); }
    .official-value-self { font-weight: 400; color: var(--ink-dim); }
    .official-delta, .official-empty { color: var(--muted); font-size: var(--fs-8); }
    /* ── Phase 24: Official score entry (24-02) ── var() tokens only; spacing 4/8/16/24 */
    .official-tile-actions { display: flex; justify-content: flex-end; gap: var(--space-2); margin-top: var(--space-1); }
    .official-action { width: auto; min-height: 32px; padding: 0 var(--space-2); background: transparent; border: 0; color: var(--ink); font-size: var(--fs-8); cursor: pointer; }
    .official-editor { display: grid; gap: var(--space-2); }
    .official-editor-row { display: flex; align-items: center; gap: var(--space-2); }
    .official-input { width: auto; flex: 1; min-width: 0; font-size: var(--fs-8); color: var(--ink); background: var(--surface-input); }
    .run-card .btn-main { width: auto; background: var(--accent-deep); border-color: var(--accent-edge); color: var(--on-accent); }
    .official-error { color: var(--bad-fg); font-size: var(--fs-8); }
    .official-error:empty { display: none; }
    .official-saved { margin: 0; }
    .official-action:hover { background: var(--surface-hover); text-decoration: underline; }
    .official-action:focus-visible, .official-input:focus-visible, .run-card .btn-main:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
    .run-card .btn-main:disabled, .official-input:disabled { opacity: 0.5; cursor: not-allowed; }
    .official-save.official-confirm { box-shadow: 0 0 0 2px var(--caution-fg); }
    /* ── Phase 24: Bulk entry (24-03) ── var() tokens only; spacing 4/8/16/24, 32px section gap */
    .bulk-entry { background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: var(--space-4); display: grid; gap: var(--space-6); margin-top: var(--space-2); }
    .bulk-entry .btn-main { width: auto; background: var(--accent-deep); border-color: var(--accent-edge); color: var(--on-accent); }
    .bulk-paste { font-family: "IBM Plex Mono", monospace; font-size: var(--fs-8); min-height: 192px; width: 100%; resize: vertical; padding: var(--space-2); border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface-input); color: var(--ink); }
    .bulk-preview-wrap { max-height: 480px; overflow: auto; border: 1px solid var(--line); border-radius: 10px; }
    .bulk-section { margin-top: 32px; }
    .bulk-defaults { display: flex; flex-wrap: wrap; gap: var(--space-4); }
    .bulk-defaults label { display: grid; gap: var(--space-1); font-size: var(--fs-8); color: var(--muted); }
    .bulk-defaults select { width: auto; }
    .bulk-actions, .bulk-chips { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
    .bulk-hint { color: var(--muted); font-size: var(--fs-8); }
    .bulk-chip { width: auto; min-height: 32px; cursor: pointer; }
    .bulk-chip[aria-pressed="false"] { background: transparent; }
    .bulk-chip:hover { border-color: var(--surface-hover); }
    .bulk-preview, .bulk-queue { width: 100%; border-collapse: collapse; }
    .bulk-preview th, .bulk-preview td, .bulk-queue th, .bulk-queue td { padding: var(--space-2) var(--space-4); font-size: var(--fs-8); text-align: left; white-space: nowrap; }
    .bulk-preview thead th { position: sticky; top: 0; background: var(--surface-head); color: var(--ink); font-size: var(--fs-2); font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }
    .bulk-preview tbody tr:hover { background: var(--surface-hover); }
    .bulk-file { display: inline-block; max-width: 40ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
    .bulk-park { display: flex; align-items: center; gap: var(--space-2); font-size: var(--fs-8); color: var(--ink); text-transform: none; letter-spacing: normal; font-weight: 400; }
    .bulk-park input { width: auto; min-height: 0; }
    .bulk-queue .btn-main { width: auto; background: var(--accent-deep); border-color: var(--accent-edge); color: var(--on-accent); }
    .bulk-attach-row td { background: var(--surface-raised); }
    .bulk-attach-select { width: auto; max-width: 100%; }
    .bulk-attach-error, .bulk-error { margin: 0; }
    .bulk-queue-empty p { margin: var(--space-1) 0 0; }
    .bulk-chip:focus-visible, .bulk-paste:focus-visible, .bulk-attach-select:focus-visible, .bulk-entry .btn-main:focus-visible, .bulk-queue .btn-main:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
    .bulk-entry .btn-main:disabled, .bulk-queue .btn-main:disabled { opacity: 0.5; cursor: not-allowed; }

    /* ── Phase 25: stage shell (25-01) ── */
    /* v3.0 polish: hidden to save vertical space — restore when the stage/event bar returns (P5).
       Original rule: display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-2) var(--space-4); margin-top: var(--space-4); */
    .shell-nav { display: none; }
    .shell-event { display: inline-flex; align-items: center; gap: var(--space-2); }
    #eventSelect { width: auto; min-width: 136px; min-height: 32px; padding: var(--space-1) var(--space-2); font-size: 0.88rem; font-weight: 700; border-radius: 10px; }
    .stage-bar { display: inline-flex; align-items: center; gap: var(--space-1); padding: var(--space-1); background: var(--surface-sunken); border: 1px solid var(--line); border-radius: 10px; max-width: 100%; overflow-x: auto; }
    .stage-seg { width: auto; min-height: 32px; padding: var(--space-1) var(--space-4); border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-family: "Space Grotesk", sans-serif; font-size: 0.88rem; font-weight: 700; line-height: 1.2; white-space: nowrap; flex-shrink: 0; cursor: pointer; transition: background 150ms ease, color 150ms ease; }
    .stage-seg:hover:not(:disabled):not([aria-selected="true"]) { background: var(--surface-tab-hover); color: var(--ink); }
    .stage-seg[aria-selected="true"] { background: var(--accent-deep); color: var(--on-accent); }
    .stage-seg:disabled { cursor: default; }
    .stage-meta { font-size: var(--fs-4); font-weight: 400; }
    .stage-meta-count { font-family: "IBM Plex Mono", monospace; }
    .stage-seg[aria-selected="true"] .stage-sep, .stage-seg[aria-selected="true"] .stage-meta { opacity: 0.85; }
    .stage-divider { width: 1px; height: 16px; background: var(--line-strong); margin: 0 var(--space-1); flex-shrink: 0; }
    .shell-spacer { flex: 1 1 auto; }
    #eventSelect:focus-visible, .stage-seg:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
    .shell-caption { font-size: var(--fs-4); font-weight: 400; color: var(--muted); }
    .shell-error { display: inline-flex; align-items: center; gap: var(--space-2); background: var(--bad-bg); color: var(--bad-fg); border: 1px solid var(--bad-line); border-radius: 10px; padding: var(--space-1) var(--space-2); font-size: var(--fs-4); font-weight: 700; }
    .shell-error[hidden] { display: none; }
    .shell-error .btn { width: auto; min-height: unset; padding: var(--space-1) var(--space-2); font-size: var(--fs-4); }
    .shell-error .btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
    .shell-utility { display: inline-flex; align-items: center; gap: var(--space-2); }
    .shell-utility[hidden] { display: none; }
    .shell-utility .tab, .shell-utility .tab.active { border-bottom: 1px solid var(--line); border-radius: 10px; bottom: 0; }
    @media (max-width: 1099px) {
      .shell-nav .stage-bar { order: 3; flex: 1 0 100%; }
      .shell-nav .shell-caption, .shell-nav .shell-error { order: 4; }
    }

    /* ── Phase 25: stage shell (25-02) ── */
    .stage-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--good); margin-right: var(--space-1); vertical-align: middle; }
    .tab-count { font-family: "IBM Plex Mono", monospace; font-size: var(--fs-4); font-weight: 400; color: var(--muted); margin-left: var(--space-1); }
    .tab[data-shell-extra] { border-style: dashed; }
    .tab[data-shell-extra]:not(.active) { color: var(--muted); }
    .stage-empty { background: var(--paper); border: 1px solid var(--line); border-radius: var(--card-radius); box-shadow: var(--shadow-soft); padding: var(--space-6) var(--space-4); text-align: center; max-width: 560px; margin: var(--space-4) auto; }
    .stage-empty-title { font-size: 1rem; font-weight: 700; color: var(--ink); line-height: 1.2; margin: 0 0 var(--space-2); }
    .stage-empty-body { font-size: 0.88rem; font-weight: 400; color: var(--muted); line-height: 1.5; margin: 0; }
    .stage-empty-action { width: auto; margin-top: var(--space-4); }
    .stage-empty-action:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
