﻿/* ==========================================================================
   SHAZAM Workbench - VS Code / Positron-grade Professional UI
   Fluent 2 light theme alignment
   ========================================================================== */

/* ── Host reset ───────────────────────────────────────────────────────────
   Was duplicated verbatim in BOTH hosts - Shazam.Web/wwwroot/app.css and an
   inline <style> in Shazam.Desktop.Maui/wwwroot/index.html, the latter
   carrying a "keep in sync with" comment. Two copies of the same rules, kept
   aligned by hand, on a pair of hosts we do not exercise equally.

   It belongs here: both hosts already load this stylesheet, and being at the
   TOP of it satisfies the ordering the MAUI copy documented - the reset has to
   apply before the workbench grid so .shazam-workbench's 100vh composes against
   a viewport-sized html/body rather than one inflated by UA default margins,
   which produced outer scrollbars on the desktop window. */
html, body {
    margin: 0;
    padding: 0;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    font-family: 'Segoe UI Variable Text', 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: #f3f3f3;
    color: #1e1e1e;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-size: 13px;
}

*, *::before, *::after {
    box-sizing: border-box;
}

button {
    font-family: inherit;
}

/* The MAUI host also sized its Blazor root; harmless on web, where #app is the
   same element, so it is shared rather than left behind in one host. */
#app {
    height: 100%;
    width: 100%;
    overflow: hidden;
}


:root {
    --bg-page:          #f3f3f3;
    --bg-surface:       #ffffff;
    --bg-sidebar:       #f8f8f8;
    --bg-input:         #ffffff;
    --bg-hover:         rgba(0,0,0,.04);
    --bg-active:        rgba(0,0,0,.06);

    --border-default:   #e5e5e5;
    --border-subtle:    #f0f0f0;

    --text-primary:     #1e1e1e;
    --text-secondary:   #616161;
    --text-tertiary:    #9e9e9e;
    --text-inverse:     #ffffff;

    --accent:           #005fb8;
    --accent-hover:     #004c99;
    --accent-subtle:    #e8f0fe;

    --statusbar-bg:     #005fb8;
    --statusbar-fg:     #ffffff;

    /* Run-state colours for the status bar's session chip. Idle is a quiet green
       dot on the bar; busy replaces the whole chip with a solid amber pill, so
       the two states differ in colour, area, and motion rather than in a single
       7px dot. Every theme whose status bar is not a mid-blue must restate these
       - see [data-theme="high-contrast-dark"], where the bar is already yellow. */
    --statusbar-idle:        #73c991;
    --statusbar-running-bg:  #b45309;
    --statusbar-running-fg:  #ffffff;
    --statusbar-stopping-bg: #9a3412;

    --menubar-bg:       #f3f3f3;

    --font-ui:          'Segoe UI Variable Text', 'Segoe UI', system-ui, -apple-system, sans-serif;
    --font-ui-small:    'Segoe UI Variable Small', 'Segoe UI Variable Text', 'Segoe UI', system-ui, sans-serif;
    --font-mono:        'Cascadia Mono', Consolas, 'Courier New', monospace;

    --error-fg:         #d32f2f;
    --warning-fg:       #b25e14;
    --success-fg:       #2e7d32;

    /* Badge background for the "Ken (executing plan)" header pill
       rendered when the user has approved a Plan-mode plan and the agent
       loop is running it. Same accent hue as .ai-mode.active with one
       step of additional saturation so the executing-plan state reads as
       visually adjacent to Ken's active state without being mistaken for a
       clickable mode pill. */
    --ai-badge-executing-plan-bg: #0078d4;

    /* Legacy aliases used by graph properties panel, matrix toolbar, and other
       later-added components. These map to the canonical theme tokens so legacy
       code paths get themed correctly without modifying every selector. */
    --bg-header:        var(--bg-sidebar);
    /* --bg-default was used by 9 rules across the workbench and several component stylesheets but
       was never DEFINED by any theme, so every one of them fell through to a hardcoded `#fff`.
       NOTE: this :root copy only supplies the light default - the themed values come from the
       [data-theme] re-declaration below the theme blocks. See the long comment there. */
    --bg-default:       var(--bg-surface);
    --border-color:     var(--border-default);
    --border-strong:    var(--border-default);
    --panel-bg:         var(--bg-sidebar);
    --muted-fg:         var(--text-secondary);
    --surface-1:        var(--bg-surface);
    --surface-2:        var(--bg-sidebar);
    --surface-3:        var(--bg-hover);
    --surface-input:    var(--bg-input);
    --surface-hover:    var(--bg-hover);
    --accent-soft:      var(--accent-subtle);
    --accent-strong:    var(--accent);
    --danger-fg:        var(--error-fg);

    /* -- Alias layer --------------------------------------------------------
       Component stylesheets were written against these names, which nothing ever
       defined. Every such rule reads `var(--surface-card, #fff)`, so the undefined
       variable silently fell back to its LIGHT default and the component rendered
       white on a dark workbench. The fallback is what hid it: nothing errors, the
       styling is just wrong, and only in one theme. The Add-data-connection dialog
       was the visible case - white panel but dark inputs, because --bg-input
       happened to exist and --surface-card did not.

       Declared in BOTH the :root and [data-theme] blocks, for the reason given in
       the [data-theme] header below: an alias declared only on :root resolves
       against :root's light values and inherits that resolved colour, so it never
       follows the theme. Keep the two copies in sync.
       ---------------------------------------------------------------------- */
    --surface-card:     var(--bg-surface);
    --surface-default:  var(--bg-surface);
    --surface-inset:    var(--bg-page);
    --bg-surface-alt:   var(--bg-sidebar);
    --bg-subtle:        var(--bg-page);
    --text:             var(--text-primary);
    --text-muted:       var(--text-tertiary);
    --text-error:       var(--error-fg);
    --text-success:     var(--success-fg);
    --text-warning:     var(--warning-fg);
    --border:           var(--border-default);
    --border-soft:      var(--border-subtle);
    --primary:          var(--accent);
    --accent-faint:     var(--accent-subtle);
    --danger:           var(--error-fg);
    --font-body:        var(--font-ui);
    --code-font:        var(--font-mono);

    /* Tinted backgrounds mixed against the surface rather than hard-coded, so they
       stay legible in both themes instead of washing out on dark. */
    --danger-subtle:    color-mix(in srgb, var(--error-fg) 12%, var(--bg-surface));
    --error-bg:         color-mix(in srgb, var(--error-fg) 12%, var(--bg-surface));
    --success-bg:       color-mix(in srgb, var(--success-fg) 12%, var(--bg-surface));
    --warning-bg:       color-mix(in srgb, var(--warning-fg) 12%, var(--bg-surface));
    --bg-diff-add:      color-mix(in srgb, var(--success-fg) 14%, var(--bg-surface));
    --bg-diff-del:      color-mix(in srgb, var(--error-fg) 14%, var(--bg-surface));

    /* Add-data-connection dialog's own namespace (Components/DataConnection). */
    --ac-muted:                 var(--text-tertiary);
    --ac-mono:                  var(--font-mono);
    --ac-error:                 var(--error-fg);
    --ac-focus-ring:            var(--accent);
    --ac-card-bg:               var(--bg-surface);
    --ac-card-border:           var(--border-default);
    --ac-card-name:             var(--text-primary);
    --ac-card-desc:             var(--text-secondary);
    --ac-card-icon:             var(--text-secondary);
    --ac-card-hover-bg:         var(--bg-hover);
    --ac-card-hover-border:     var(--border-strong);
    --ac-card-selected-bg:      var(--accent-subtle);
    --ac-card-selected-border:  var(--accent);
    --ac-popover-bg:            var(--bg-surface);
    --ac-popover-border:        var(--border-default);
    --ac-popover-title:         var(--text-primary);
    --ac-preview-bg:            var(--bg-page);
}

/* ==========================================================================
   Theme overrides - scoped via data-theme attribute on .shazam-workbench
   ========================================================================== */

/* -- Dark ----------------------------------------------------------------- */
[data-theme="dark"] {
    color-scheme: dark;
    --bg-page:          #1e1e1e;
    --bg-surface:       #252526;
    --bg-sidebar:       #252526;
    --bg-input:         #3c3c3c;
    --bg-hover:         rgba(255,255,255,.06);
    --bg-active:        rgba(255,255,255,.08);
    --border-default:   #3c3c3c;
    --border-subtle:    #2d2d2d;
    --text-primary:     #cccccc;
    --text-secondary:   #9d9d9d;
    /* #6d6d6d measured 3.22:1 on --bg-page and 2.96:1 on --bg-surface - below the WCAG AA 4.5:1
       floor for body text, which is what made secondary/hint text read as washed-out grey in dark
       mode. #8c8c8c is the lightest value that clears AA on the darker of the two surfaces
       (4.55:1 on --bg-surface, 4.96:1 on --bg-page) while staying visibly subordinate to
       --text-secondary. Used in ~75 rules, so this lifts every hint/placeholder/caption at once. */
    --text-tertiary:    #8c8c8c;
    --text-inverse:     #1e1e1e;
    --accent:           #3794ff;
    --accent-hover:     #51a5ff;
    --accent-subtle:    rgba(55,148,255,.15);
    --statusbar-bg:     #008ceb;
    --statusbar-fg:     #ffffff;
    --menubar-bg:       #1e1e1e;
    --error-fg:         #f48771;
    --warning-fg:       #e5c07b;
    --success-fg:       #89d185;
}

/* -- High Contrast Light -------------------------------------------------- */
[data-theme="high-contrast-light"] {
    --bg-page:          #ffffff;
    --bg-surface:       #ffffff;
    --bg-sidebar:       #f5f5f5;
    --bg-input:         #ffffff;
    --bg-hover:         rgba(0,0,0,.08);
    --bg-active:        rgba(0,0,0,.12);
    --border-default:   #000000;
    --border-subtle:    #737373;
    --text-primary:     #000000;
    --text-secondary:   #292929;
    --text-tertiary:    #595959;
    --text-inverse:     #ffffff;
    --accent:           #0050a0;
    --accent-hover:     #003c78;
    --accent-subtle:    #d0e4ff;
    --statusbar-bg:     #0050a0;
    --statusbar-fg:     #ffffff;
    --menubar-bg:       #ffffff;
    --error-fg:         #b50000;
    --warning-fg:       #a85400;
    --success-fg:       #1a7a1a;
}

/* -- High Contrast Dark --------------------------------------------------- */
[data-theme="high-contrast-dark"] {
    color-scheme: dark;
    --bg-page:          #000000;
    --bg-surface:       #000000;
    --bg-sidebar:       #0a0a0a;
    --bg-input:         #1a1a1a;
    --bg-hover:         rgba(255,255,255,.10);
    --bg-active:        rgba(255,255,255,.14);
    --border-default:   #6fc3df;
    --border-subtle:    #3b3b3b;
    --text-primary:     #ffffff;
    --text-secondary:   #d4d4d4;
    --text-tertiary:    #a0a0a0;
    --text-inverse:     #000000;
    --accent:           #ffff00;
    --accent-hover:     #ffff66;
    --accent-subtle:    rgba(255,255,0,.12);
    --statusbar-bg:     #ffff00;
    --statusbar-fg:     #000000;
    /* The bar is already yellow here, so the default amber busy pill would
       vanish into it. Invert instead: a black pill with yellow content is the
       highest-contrast pairing available against this bar, and the dark green
       idle dot stays legible on yellow where the default light green does not. */
    --statusbar-idle:        #005c00;
    --statusbar-running-bg:  #000000;
    --statusbar-running-fg:  #ffff00;
    --statusbar-stopping-bg: #3d0000;
    --menubar-bg:       #000000;
    --error-fg:         #ff5555;
    --warning-fg:       #ffff00;
    --success-fg:       #55ff55;
}

/* -- Nord ----------------------------------------------------------------- */
[data-theme="nord"] {
    color-scheme: dark;
    --bg-page:          #2e3440;
    --bg-surface:       #3b4252;
    --bg-sidebar:       #3b4252;
    --bg-input:         #434c5e;
    --bg-hover:         rgba(216,222,233,.06);
    --bg-active:        rgba(216,222,233,.10);
    --border-default:   #4c566a;
    --border-subtle:    #3b4252;
    --text-primary:     #d8dee9;
    --text-secondary:   #a3be8c;
    --text-tertiary:    #7b88a1;
    --text-inverse:     #2e3440;
    --accent:           #88c0d0;
    --accent-hover:     #8fbcbb;
    --accent-subtle:    rgba(136,192,208,.15);
    --statusbar-bg:     #86a1c1;
    --statusbar-fg:     #eceff4;
    --menubar-bg:       #2e3440;
    --error-fg:         #d9a2a8;
    --warning-fg:       #ebcb8b;
    --success-fg:       #a3be8c;
}

/* -- Solarized Dark ------------------------------------------------------- */
[data-theme="solarized-dark"] {
    color-scheme: dark;
    --bg-page:          #002b36;
    --bg-surface:       #073642;
    --bg-sidebar:       #073642;
    --bg-input:         #0a4050;
    --bg-hover:         rgba(147,161,161,.08);
    --bg-active:        rgba(147,161,161,.12);
    --border-default:   #2a5662;
    --border-subtle:    #073642;
    --text-primary:     #8e9e9f;
    --text-secondary:   #93a1a1;
    --text-tertiary:    #657b83;
    --text-inverse:     #002b36;
    --accent:           #4ca2df;
    --accent-hover:     #2aa198;
    --accent-subtle:    rgba(38,139,210,.15);
    --statusbar-bg:     #3295da;
    --statusbar-fg:     #fdf6e3;
    --menubar-bg:       #002b36;
    --error-fg:         #e87b79;
    --warning-fg:       #c49500;
    --success-fg:       #92a800;
}

/* -- Solarized Light ------------------------------------------------------ */
[data-theme="solarized-light"] {
    --bg-page:          #fdf6e3;
    --bg-surface:       #eee8d5;
    --bg-sidebar:       #eee8d5;
    --bg-input:         #fdf6e3;
    --bg-hover:         rgba(101,123,131,.06);
    --bg-active:        rgba(101,123,131,.10);
    --border-default:   #d3cbb7;
    --border-subtle:    #e4dcc8;
    --text-primary:     #55686e;
    --text-secondary:   #54696f;
    --text-tertiary:    #93a1a1;
    --text-inverse:     #fdf6e3;
    --accent:           #1d6ca2;
    --accent-hover:     #2aa198;
    --accent-subtle:    rgba(38,139,210,.12);
    --statusbar-bg:     #2074af;
    --statusbar-fg:     #fdf6e3;
    --menubar-bg:       #fdf6e3;
    --error-fg:         #c62421;
    --warning-fg:       #826200;
    --success-fg:       #5d6b00;
}

/* -- Abyss ---------------------------------------------------------------- */
[data-theme="abyss"] {
    color-scheme: dark;
    --bg-page:          #000c18;
    --bg-surface:       #06162a;
    --bg-sidebar:       #06162a;
    --bg-input:         #0d2240;
    --bg-hover:         rgba(102,136,204,.08);
    --bg-active:        rgba(102,136,204,.12);
    --border-default:   #1b3a5e;
    --border-subtle:    #0f2840;
    --text-primary:     #6688cc;
    --text-secondary:   #8899aa;
    --text-tertiary:    #4e6080;
    --text-inverse:     #000c18;
    --accent:           #6796e6;
    --accent-hover:     #82aaff;
    --accent-subtle:    rgba(103,150,230,.12);
    --statusbar-bg:     #597fb0;
    --statusbar-fg:     #c0d0e8;
    --menubar-bg:       #000c18;
    --error-fg:         #ff6b6b;
    --warning-fg:       #e5c07b;
    --success-fg:       #89d185;
}

/* -- Legacy aliases, RE-DECLARED IN THE THEMED SCOPE ----------------------
   These same aliases are declared in :root above. That alone does NOT work, and
   the reason is a genuine CSS subtlety worth stating plainly:

     a custom property whose value contains var() is substituted at the element
     where it is DECLARED, and the resolved value is what inherits.

   :root is <html>. The themes above are selected by [data-theme], which the app
   sets on <body> (theme-interop.js). So `--bg-header: var(--bg-sidebar)` declared
   on :root resolved against the LIGHT :root value of --bg-sidebar and inherited
   that resolved colour everywhere - body's dark override of --bg-sidebar came too
   late to affect it. Every consumer of these 13 aliases therefore rendered with
   light-theme colours in all four dark themes, which is why the report dialog card
   stayed white while its header (which uses --bg-sidebar DIRECTLY) went dark.

   Re-declaring them here, on [data-theme], makes them resolve on the element that
   actually carries the theme. The selector is the attribute rather than `body` on
   purpose: it matches whichever element the host themes, so Web/Windows/Mac stay
   identical. Keep this list in sync with the :root block.
   -------------------------------------------------------------------------- */
[data-theme] {
    --bg-header:        var(--bg-sidebar);
    --bg-default:       var(--bg-surface);
    --border-color:     var(--border-default);
    --border-strong:    var(--border-default);
    --panel-bg:         var(--bg-sidebar);
    --muted-fg:         var(--text-secondary);
    --surface-1:        var(--bg-surface);
    --surface-2:        var(--bg-sidebar);
    --surface-3:        var(--bg-hover);
    --surface-input:    var(--bg-input);
    --surface-hover:    var(--bg-hover);
    --accent-soft:      var(--accent-subtle);
    --accent-strong:    var(--accent);
    --danger-fg:        var(--error-fg);

    /* -- Alias layer --------------------------------------------------------
       Component stylesheets were written against these names, which nothing ever
       defined. Every such rule reads `var(--surface-card, #fff)`, so the undefined
       variable silently fell back to its LIGHT default and the component rendered
       white on a dark workbench. The fallback is what hid it: nothing errors, the
       styling is just wrong, and only in one theme. The Add-data-connection dialog
       was the visible case - white panel but dark inputs, because --bg-input
       happened to exist and --surface-card did not.

       Declared in BOTH the :root and [data-theme] blocks, for the reason given in
       the [data-theme] header below: an alias declared only on :root resolves
       against :root's light values and inherits that resolved colour, so it never
       follows the theme. Keep the two copies in sync.
       ---------------------------------------------------------------------- */
    --surface-card:     var(--bg-surface);
    --surface-default:  var(--bg-surface);
    --surface-inset:    var(--bg-page);
    --bg-surface-alt:   var(--bg-sidebar);
    --bg-subtle:        var(--bg-page);
    --text:             var(--text-primary);
    --text-muted:       var(--text-tertiary);
    --text-error:       var(--error-fg);
    --text-success:     var(--success-fg);
    --text-warning:     var(--warning-fg);
    --border:           var(--border-default);
    --border-soft:      var(--border-subtle);
    --primary:          var(--accent);
    --accent-faint:     var(--accent-subtle);
    --danger:           var(--error-fg);
    --font-body:        var(--font-ui);
    --code-font:        var(--font-mono);

    /* Tinted backgrounds mixed against the surface rather than hard-coded, so they
       stay legible in both themes instead of washing out on dark. */
    --danger-subtle:    color-mix(in srgb, var(--error-fg) 12%, var(--bg-surface));
    --error-bg:         color-mix(in srgb, var(--error-fg) 12%, var(--bg-surface));
    --success-bg:       color-mix(in srgb, var(--success-fg) 12%, var(--bg-surface));
    --warning-bg:       color-mix(in srgb, var(--warning-fg) 12%, var(--bg-surface));
    --bg-diff-add:      color-mix(in srgb, var(--success-fg) 14%, var(--bg-surface));
    --bg-diff-del:      color-mix(in srgb, var(--error-fg) 14%, var(--bg-surface));

    /* Add-data-connection dialog's own namespace (Components/DataConnection). */
    --ac-muted:                 var(--text-tertiary);
    --ac-mono:                  var(--font-mono);
    --ac-error:                 var(--error-fg);
    --ac-focus-ring:            var(--accent);
    --ac-card-bg:               var(--bg-surface);
    --ac-card-border:           var(--border-default);
    --ac-card-name:             var(--text-primary);
    --ac-card-desc:             var(--text-secondary);
    --ac-card-icon:             var(--text-secondary);
    --ac-card-hover-bg:         var(--bg-hover);
    --ac-card-hover-border:     var(--border-strong);
    --ac-card-selected-bg:      var(--accent-subtle);
    --ac-card-selected-border:  var(--accent);
    --ac-popover-bg:            var(--bg-surface);
    --ac-popover-border:        var(--border-default);
    --ac-popover-title:         var(--text-primary);
    --ac-preview-bg:            var(--bg-page);
}

/* -- Syncfusion component overrides for themed backgrounds ---------------- */
/* fluent2-dark.css sets its own backgrounds (#1e1e1e / #252526) which only
   match the "dark" theme. For Nord, Abyss, Solarized, etc. we must override
   Syncfusion internals to use our CSS tokens so they blend with the chrome. */
[data-theme="nord"] .e-grid,
[data-theme="nord"] .e-grid .e-gridcontent,
[data-theme="nord"] .e-grid .e-gridcontent .e-content,
[data-theme="nord"] .e-grid .e-gridheader,
[data-theme="nord"] .e-grid .e-headercontent,
[data-theme="nord"] .e-grid .e-frozenheader,
[data-theme="nord"] .e-grid .e-frozencontent,
[data-theme="nord"] .e-grid .e-rowcell,
[data-theme="nord"] .e-dialog .e-dlg-content,
[data-theme="nord"] .e-dialog,
[data-theme="nord"] .e-tab .e-content,
[data-theme="nord"] .e-tab .e-content > .e-item,
[data-theme="nord"] .e-spreadsheet,
[data-theme="solarized-dark"] .e-grid,
[data-theme="solarized-dark"] .e-grid .e-gridcontent,
[data-theme="solarized-dark"] .e-grid .e-gridcontent .e-content,
[data-theme="solarized-dark"] .e-grid .e-gridheader,
[data-theme="solarized-dark"] .e-grid .e-headercontent,
[data-theme="solarized-dark"] .e-grid .e-frozenheader,
[data-theme="solarized-dark"] .e-grid .e-frozencontent,
[data-theme="solarized-dark"] .e-grid .e-rowcell,
[data-theme="solarized-dark"] .e-dialog .e-dlg-content,
[data-theme="solarized-dark"] .e-dialog,
[data-theme="solarized-dark"] .e-tab .e-content,
[data-theme="solarized-dark"] .e-tab .e-content > .e-item,
[data-theme="solarized-dark"] .e-spreadsheet,
[data-theme="abyss"] .e-grid,
[data-theme="abyss"] .e-grid .e-gridcontent,
[data-theme="abyss"] .e-grid .e-gridcontent .e-content,
[data-theme="abyss"] .e-grid .e-gridheader,
[data-theme="abyss"] .e-grid .e-headercontent,
[data-theme="abyss"] .e-grid .e-frozenheader,
[data-theme="abyss"] .e-grid .e-frozencontent,
[data-theme="abyss"] .e-grid .e-rowcell,
[data-theme="abyss"] .e-dialog .e-dlg-content,
[data-theme="abyss"] .e-dialog,
[data-theme="abyss"] .e-tab .e-content,
[data-theme="abyss"] .e-tab .e-content > .e-item,
[data-theme="abyss"] .e-spreadsheet,
[data-theme="high-contrast-dark"] .e-grid,
[data-theme="high-contrast-dark"] .e-grid .e-gridcontent,
[data-theme="high-contrast-dark"] .e-grid .e-gridcontent .e-content,
[data-theme="high-contrast-dark"] .e-grid .e-gridheader,
[data-theme="high-contrast-dark"] .e-grid .e-headercontent,
[data-theme="high-contrast-dark"] .e-grid .e-frozenheader,
[data-theme="high-contrast-dark"] .e-grid .e-frozencontent,
[data-theme="high-contrast-dark"] .e-grid .e-rowcell,
[data-theme="high-contrast-dark"] .e-dialog .e-dlg-content,
[data-theme="high-contrast-dark"] .e-dialog,
[data-theme="high-contrast-dark"] .e-tab .e-content,
[data-theme="high-contrast-dark"] .e-tab .e-content > .e-item,
[data-theme="high-contrast-dark"] .e-spreadsheet {
    background: var(--bg-surface) !important;
    background-color: var(--bg-surface) !important;
    color: var(--text-primary) !important;
}

[data-theme="nord"] .e-grid .e-headercell,
[data-theme="solarized-dark"] .e-grid .e-headercell,
[data-theme="abyss"] .e-grid .e-headercell,
[data-theme="high-contrast-dark"] .e-grid .e-headercell {
    background: var(--bg-sidebar) !important;
    background-color: var(--bg-sidebar) !important;
}

[data-theme="nord"] .e-grid .e-row:hover .e-rowcell,
[data-theme="solarized-dark"] .e-grid .e-row:hover .e-rowcell,
[data-theme="abyss"] .e-grid .e-row:hover .e-rowcell,
[data-theme="high-contrast-dark"] .e-grid .e-row:hover .e-rowcell {
    background: var(--bg-hover) !important;
    background-color: var(--bg-hover) !important;
}

[data-theme="nord"] .e-grid .e-altrow .e-rowcell,
[data-theme="solarized-dark"] .e-grid .e-altrow .e-rowcell,
[data-theme="abyss"] .e-grid .e-altrow .e-rowcell,
[data-theme="high-contrast-dark"] .e-grid .e-altrow .e-rowcell {
    background: var(--bg-page) !important;
    background-color: var(--bg-page) !important;
}

[data-theme="nord"] .e-pager,
[data-theme="solarized-dark"] .e-pager,
[data-theme="abyss"] .e-pager,
[data-theme="high-contrast-dark"] .e-pager {
    background: var(--bg-sidebar) !important;
    background-color: var(--bg-sidebar) !important;
    color: var(--text-secondary) !important;
}

[data-theme="nord"] .e-input,
[data-theme="nord"] .e-input-group,
[data-theme="nord"] .e-input-group .e-input,
[data-theme="solarized-dark"] .e-input,
[data-theme="solarized-dark"] .e-input-group,
[data-theme="solarized-dark"] .e-input-group .e-input,
[data-theme="abyss"] .e-input,
[data-theme="abyss"] .e-input-group,
[data-theme="abyss"] .e-input-group .e-input,
[data-theme="high-contrast-dark"] .e-input,
[data-theme="high-contrast-dark"] .e-input-group,
[data-theme="high-contrast-dark"] .e-input-group .e-input {
    background: var(--bg-input) !important;
    color: var(--text-primary) !important;
}

/* Dialog internals: header, content, footer, overlay, buttons */
[data-theme="nord"] .e-dialog .e-dlg-header-content,
[data-theme="solarized-dark"] .e-dialog .e-dlg-header-content,
[data-theme="abyss"] .e-dialog .e-dlg-header-content,
[data-theme="high-contrast-dark"] .e-dialog .e-dlg-header-content {
    background: var(--bg-sidebar) !important;
    background-color: var(--bg-sidebar) !important;
    border-bottom-color: var(--border-default) !important;
}

[data-theme="nord"] .e-dialog .e-dlg-header,
[data-theme="solarized-dark"] .e-dialog .e-dlg-header,
[data-theme="abyss"] .e-dialog .e-dlg-header,
[data-theme="high-contrast-dark"] .e-dialog .e-dlg-header {
    color: var(--text-primary) !important;
}

[data-theme="nord"] .e-dialog .e-dlg-content,
[data-theme="solarized-dark"] .e-dialog .e-dlg-content,
[data-theme="abyss"] .e-dialog .e-dlg-content,
[data-theme="high-contrast-dark"] .e-dialog .e-dlg-content {
    background: var(--bg-surface) !important;
    background-color: var(--bg-surface) !important;
    color: var(--text-primary) !important;
}

[data-theme="nord"] .e-dialog .e-footer-content,
[data-theme="solarized-dark"] .e-dialog .e-footer-content,
[data-theme="abyss"] .e-dialog .e-footer-content,
[data-theme="high-contrast-dark"] .e-dialog .e-footer-content {
    background: var(--bg-sidebar) !important;
    background-color: var(--bg-sidebar) !important;
    border-top-color: var(--border-default) !important;
}

[data-theme="nord"] .e-dialog .e-btn.e-flat,
[data-theme="solarized-dark"] .e-dialog .e-btn.e-flat,
[data-theme="abyss"] .e-dialog .e-btn.e-flat,
[data-theme="high-contrast-dark"] .e-dialog .e-btn.e-flat {
    color: var(--text-secondary) !important;
    background: transparent !important;
}

[data-theme="nord"] .e-dialog .e-btn.e-flat:hover,
[data-theme="solarized-dark"] .e-dialog .e-btn.e-flat:hover,
[data-theme="abyss"] .e-dialog .e-btn.e-flat:hover,
[data-theme="high-contrast-dark"] .e-dialog .e-btn.e-flat:hover {
    background: var(--bg-hover) !important;
    color: var(--text-primary) !important;
}

[data-theme="nord"] .e-dialog .e-dlg-closeicon-btn,
[data-theme="solarized-dark"] .e-dialog .e-dlg-closeicon-btn,
[data-theme="abyss"] .e-dialog .e-dlg-closeicon-btn,
[data-theme="high-contrast-dark"] .e-dialog .e-dlg-closeicon-btn {
    color: var(--text-secondary) !important;
}

/* Syncfusion Spreadsheet - internals don't pick up our theme tokens automatically.
   Force cells, headers, formula bar, ribbon, and selection colors to match the theme. */
[data-theme="nord"] .e-spreadsheet,
[data-theme="solarized-dark"] .e-spreadsheet,
[data-theme="abyss"] .e-spreadsheet,
[data-theme="high-contrast-dark"] .e-spreadsheet,
[data-theme="dark"] .e-spreadsheet,
[data-theme="nord"] .e-spreadsheet .e-sheet,
[data-theme="solarized-dark"] .e-spreadsheet .e-sheet,
[data-theme="abyss"] .e-spreadsheet .e-sheet,
[data-theme="high-contrast-dark"] .e-spreadsheet .e-sheet,
[data-theme="dark"] .e-spreadsheet .e-sheet,
[data-theme="nord"] .e-spreadsheet .e-sheet-content,
[data-theme="solarized-dark"] .e-spreadsheet .e-sheet-content,
[data-theme="abyss"] .e-spreadsheet .e-sheet-content,
[data-theme="high-contrast-dark"] .e-spreadsheet .e-sheet-content,
[data-theme="dark"] .e-spreadsheet .e-sheet-content,
[data-theme="nord"] .e-spreadsheet .e-main-panel,
[data-theme="solarized-dark"] .e-spreadsheet .e-main-panel,
[data-theme="abyss"] .e-spreadsheet .e-main-panel,
[data-theme="high-contrast-dark"] .e-spreadsheet .e-main-panel,
[data-theme="dark"] .e-spreadsheet .e-main-panel,
[data-theme="nord"] .e-spreadsheet .e-sheet-panel,
[data-theme="solarized-dark"] .e-spreadsheet .e-sheet-panel,
[data-theme="abyss"] .e-spreadsheet .e-sheet-panel,
[data-theme="high-contrast-dark"] .e-spreadsheet .e-sheet-panel,
[data-theme="dark"] .e-spreadsheet .e-sheet-panel {
    background: var(--bg-surface) !important;
    background-color: var(--bg-surface) !important;
    color: var(--text-primary) !important;
}

[data-theme="nord"] .e-spreadsheet .e-cell,
[data-theme="solarized-dark"] .e-spreadsheet .e-cell,
[data-theme="abyss"] .e-spreadsheet .e-cell,
[data-theme="high-contrast-dark"] .e-spreadsheet .e-cell,
[data-theme="dark"] .e-spreadsheet .e-cell {
    background: var(--bg-surface) !important;
    background-color: var(--bg-surface) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-subtle) !important;
}

[data-theme="nord"] .e-spreadsheet .e-row-header,
[data-theme="nord"] .e-spreadsheet .e-column-header,
[data-theme="nord"] .e-spreadsheet .e-header-cell,
[data-theme="nord"] .e-spreadsheet .e-header-row,
[data-theme="nord"] .e-spreadsheet .e-select-all-cell,
[data-theme="solarized-dark"] .e-spreadsheet .e-row-header,
[data-theme="solarized-dark"] .e-spreadsheet .e-column-header,
[data-theme="solarized-dark"] .e-spreadsheet .e-header-cell,
[data-theme="solarized-dark"] .e-spreadsheet .e-header-row,
[data-theme="solarized-dark"] .e-spreadsheet .e-select-all-cell,
[data-theme="abyss"] .e-spreadsheet .e-row-header,
[data-theme="abyss"] .e-spreadsheet .e-column-header,
[data-theme="abyss"] .e-spreadsheet .e-header-cell,
[data-theme="abyss"] .e-spreadsheet .e-header-row,
[data-theme="abyss"] .e-spreadsheet .e-select-all-cell,
[data-theme="high-contrast-dark"] .e-spreadsheet .e-row-header,
[data-theme="high-contrast-dark"] .e-spreadsheet .e-column-header,
[data-theme="high-contrast-dark"] .e-spreadsheet .e-header-cell,
[data-theme="high-contrast-dark"] .e-spreadsheet .e-header-row,
[data-theme="high-contrast-dark"] .e-spreadsheet .e-select-all-cell,
[data-theme="dark"] .e-spreadsheet .e-row-header,
[data-theme="dark"] .e-spreadsheet .e-column-header,
[data-theme="dark"] .e-spreadsheet .e-header-cell,
[data-theme="dark"] .e-spreadsheet .e-header-row,
[data-theme="dark"] .e-spreadsheet .e-select-all-cell {
    background: var(--bg-sidebar) !important;
    background-color: var(--bg-sidebar) !important;
    color: var(--text-secondary) !important;
    border-color: var(--border-default) !important;
}

[data-theme="nord"] .e-spreadsheet .e-formula-bar-panel,
[data-theme="nord"] .e-spreadsheet .e-formula-bar,
[data-theme="nord"] .e-spreadsheet .e-name-box,
[data-theme="solarized-dark"] .e-spreadsheet .e-formula-bar-panel,
[data-theme="solarized-dark"] .e-spreadsheet .e-formula-bar,
[data-theme="solarized-dark"] .e-spreadsheet .e-name-box,
[data-theme="abyss"] .e-spreadsheet .e-formula-bar-panel,
[data-theme="abyss"] .e-spreadsheet .e-formula-bar,
[data-theme="abyss"] .e-spreadsheet .e-name-box,
[data-theme="high-contrast-dark"] .e-spreadsheet .e-formula-bar-panel,
[data-theme="high-contrast-dark"] .e-spreadsheet .e-formula-bar,
[data-theme="high-contrast-dark"] .e-spreadsheet .e-name-box,
[data-theme="dark"] .e-spreadsheet .e-formula-bar-panel,
[data-theme="dark"] .e-spreadsheet .e-formula-bar,
[data-theme="dark"] .e-spreadsheet .e-name-box {
    background: var(--bg-sidebar) !important;
    background-color: var(--bg-sidebar) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-default) !important;
}

[data-theme="nord"] .e-spreadsheet .e-ribbon,
[data-theme="nord"] .e-spreadsheet .e-ribbon-toolbar,
[data-theme="nord"] .e-spreadsheet .e-ribbon-content,
[data-theme="nord"] .e-spreadsheet .e-tab-header,
[data-theme="solarized-dark"] .e-spreadsheet .e-ribbon,
[data-theme="solarized-dark"] .e-spreadsheet .e-ribbon-toolbar,
[data-theme="solarized-dark"] .e-spreadsheet .e-ribbon-content,
[data-theme="solarized-dark"] .e-spreadsheet .e-tab-header,
[data-theme="abyss"] .e-spreadsheet .e-ribbon,
[data-theme="abyss"] .e-spreadsheet .e-ribbon-toolbar,
[data-theme="abyss"] .e-spreadsheet .e-ribbon-content,
[data-theme="abyss"] .e-spreadsheet .e-tab-header,
[data-theme="high-contrast-dark"] .e-spreadsheet .e-ribbon,
[data-theme="high-contrast-dark"] .e-spreadsheet .e-ribbon-toolbar,
[data-theme="high-contrast-dark"] .e-spreadsheet .e-ribbon-content,
[data-theme="high-contrast-dark"] .e-spreadsheet .e-tab-header,
[data-theme="dark"] .e-spreadsheet .e-ribbon,
[data-theme="dark"] .e-spreadsheet .e-ribbon-toolbar,
[data-theme="dark"] .e-spreadsheet .e-ribbon-content,
[data-theme="dark"] .e-spreadsheet .e-tab-header {
    background: var(--bg-sidebar) !important;
    background-color: var(--bg-sidebar) !important;
    color: var(--text-primary) !important;
}

[data-theme="nord"] .e-spreadsheet .e-sheet-tab,
[data-theme="nord"] .e-spreadsheet .e-sheet-tabs-items,
[data-theme="nord"] .e-spreadsheet .e-add-sheet-tab,
[data-theme="solarized-dark"] .e-spreadsheet .e-sheet-tab,
[data-theme="solarized-dark"] .e-spreadsheet .e-sheet-tabs-items,
[data-theme="solarized-dark"] .e-spreadsheet .e-add-sheet-tab,
[data-theme="abyss"] .e-spreadsheet .e-sheet-tab,
[data-theme="abyss"] .e-spreadsheet .e-sheet-tabs-items,
[data-theme="abyss"] .e-spreadsheet .e-add-sheet-tab,
[data-theme="high-contrast-dark"] .e-spreadsheet .e-sheet-tab,
[data-theme="high-contrast-dark"] .e-spreadsheet .e-sheet-tabs-items,
[data-theme="high-contrast-dark"] .e-spreadsheet .e-add-sheet-tab,
[data-theme="dark"] .e-spreadsheet .e-sheet-tab,
[data-theme="dark"] .e-spreadsheet .e-sheet-tabs-items,
[data-theme="dark"] .e-spreadsheet .e-add-sheet-tab {
    background: var(--bg-sidebar) !important;
    background-color: var(--bg-sidebar) !important;
    color: var(--text-secondary) !important;
}

[data-theme="nord"] .e-spreadsheet .e-cell.e-active-cell,
[data-theme="solarized-dark"] .e-spreadsheet .e-cell.e-active-cell,
[data-theme="abyss"] .e-spreadsheet .e-cell.e-active-cell,
[data-theme="high-contrast-dark"] .e-spreadsheet .e-cell.e-active-cell,
[data-theme="dark"] .e-spreadsheet .e-cell.e-active-cell {
    background: var(--accent-subtle) !important;
    background-color: var(--accent-subtle) !important;
}

/* Document editor ribbon - dropdowns, inputs, and selected buttons need themed backgrounds.
   The document content area (white paper) is intentionally left as-is for authoring. */
[data-theme="nord"] .e-ribbon-container,
[data-theme="nord"] .e-ribbon,
[data-theme="nord"] .e-ribbon-tab,
[data-theme="nord"] .e-ribbon-group-container,
[data-theme="solarized-dark"] .e-ribbon-container,
[data-theme="solarized-dark"] .e-ribbon,
[data-theme="solarized-dark"] .e-ribbon-tab,
[data-theme="solarized-dark"] .e-ribbon-group-container,
[data-theme="abyss"] .e-ribbon-container,
[data-theme="abyss"] .e-ribbon,
[data-theme="abyss"] .e-ribbon-tab,
[data-theme="abyss"] .e-ribbon-group-container,
[data-theme="high-contrast-dark"] .e-ribbon-container,
[data-theme="high-contrast-dark"] .e-ribbon,
[data-theme="high-contrast-dark"] .e-ribbon-tab,
[data-theme="high-contrast-dark"] .e-ribbon-group-container,
[data-theme="dark"] .e-ribbon-container,
[data-theme="dark"] .e-ribbon,
[data-theme="dark"] .e-ribbon-tab,
[data-theme="dark"] .e-ribbon-group-container {
    background: var(--bg-sidebar) !important;
    background-color: var(--bg-sidebar) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-default) !important;
}

/* Ribbon dropdown buttons (font name, size, etc.) */
[data-theme="nord"] .e-ribbon .e-dropdown-btn,
[data-theme="nord"] .e-ribbon .e-input-group,
[data-theme="nord"] .e-ribbon .e-input-group input.e-input,
[data-theme="nord"] .e-ribbon .e-ddl,
[data-theme="nord"] .e-ribbon .e-ddl input,
[data-theme="solarized-dark"] .e-ribbon .e-dropdown-btn,
[data-theme="solarized-dark"] .e-ribbon .e-input-group,
[data-theme="solarized-dark"] .e-ribbon .e-input-group input.e-input,
[data-theme="solarized-dark"] .e-ribbon .e-ddl,
[data-theme="solarized-dark"] .e-ribbon .e-ddl input,
[data-theme="abyss"] .e-ribbon .e-dropdown-btn,
[data-theme="abyss"] .e-ribbon .e-input-group,
[data-theme="abyss"] .e-ribbon .e-input-group input.e-input,
[data-theme="abyss"] .e-ribbon .e-ddl,
[data-theme="abyss"] .e-ribbon .e-ddl input,
[data-theme="high-contrast-dark"] .e-ribbon .e-dropdown-btn,
[data-theme="high-contrast-dark"] .e-ribbon .e-input-group,
[data-theme="high-contrast-dark"] .e-ribbon .e-input-group input.e-input,
[data-theme="high-contrast-dark"] .e-ribbon .e-ddl,
[data-theme="high-contrast-dark"] .e-ribbon .e-ddl input,
[data-theme="dark"] .e-ribbon .e-dropdown-btn,
[data-theme="dark"] .e-ribbon .e-input-group,
[data-theme="dark"] .e-ribbon .e-input-group input.e-input,
[data-theme="dark"] .e-ribbon .e-ddl,
[data-theme="dark"] .e-ribbon .e-ddl input {
    background: var(--bg-input) !important;
    background-color: var(--bg-input) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-default) !important;
}

/* Active/selected ribbon buttons (the "Normal" style block, B/I/U toggles) */
[data-theme="nord"] .e-ribbon .e-btn.e-active,
[data-theme="nord"] .e-ribbon .e-ribbon-gallery-item.e-active,
[data-theme="nord"] .e-ribbon .e-ribbon-gallery-item.e-selected,
[data-theme="solarized-dark"] .e-ribbon .e-btn.e-active,
[data-theme="solarized-dark"] .e-ribbon .e-ribbon-gallery-item.e-active,
[data-theme="solarized-dark"] .e-ribbon .e-ribbon-gallery-item.e-selected,
[data-theme="abyss"] .e-ribbon .e-btn.e-active,
[data-theme="abyss"] .e-ribbon .e-ribbon-gallery-item.e-active,
[data-theme="abyss"] .e-ribbon .e-ribbon-gallery-item.e-selected,
[data-theme="high-contrast-dark"] .e-ribbon .e-btn.e-active,
[data-theme="high-contrast-dark"] .e-ribbon .e-ribbon-gallery-item.e-active,
[data-theme="high-contrast-dark"] .e-ribbon .e-ribbon-gallery-item.e-selected,
[data-theme="dark"] .e-ribbon .e-btn.e-active,
[data-theme="dark"] .e-ribbon .e-ribbon-gallery-item.e-active,
[data-theme="dark"] .e-ribbon .e-ribbon-gallery-item.e-selected {
    background: var(--accent-subtle) !important;
    background-color: var(--accent-subtle) !important;
    color: var(--text-primary) !important;
    border-color: var(--accent) !important;
}

/* Ribbon gallery items (style blocks like Normal, Heading 1, Heading 2) */
[data-theme="nord"] .e-ribbon-gallery-item,
[data-theme="solarized-dark"] .e-ribbon-gallery-item,
[data-theme="abyss"] .e-ribbon-gallery-item,
[data-theme="high-contrast-dark"] .e-ribbon-gallery-item,
[data-theme="dark"] .e-ribbon-gallery-item {
    background: var(--bg-surface) !important;
    background-color: var(--bg-surface) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-default) !important;
}

/* Floating dropdown popups (font lists, color pickers) - they render outside the ribbon */
[data-theme="nord"] .e-popup.e-popup-open,
[data-theme="nord"] .e-dropdown-popup,
[data-theme="nord"] .e-dropdown-popup ul,
[data-theme="nord"] .e-ddl.e-popup,
[data-theme="solarized-dark"] .e-popup.e-popup-open,
[data-theme="solarized-dark"] .e-dropdown-popup,
[data-theme="solarized-dark"] .e-dropdown-popup ul,
[data-theme="solarized-dark"] .e-ddl.e-popup,
[data-theme="abyss"] .e-popup.e-popup-open,
[data-theme="abyss"] .e-dropdown-popup,
[data-theme="abyss"] .e-dropdown-popup ul,
[data-theme="abyss"] .e-ddl.e-popup,
[data-theme="high-contrast-dark"] .e-popup.e-popup-open,
[data-theme="high-contrast-dark"] .e-dropdown-popup,
[data-theme="high-contrast-dark"] .e-dropdown-popup ul,
[data-theme="high-contrast-dark"] .e-ddl.e-popup,
[data-theme="dark"] .e-popup.e-popup-open,
[data-theme="dark"] .e-dropdown-popup,
[data-theme="dark"] .e-dropdown-popup ul,
[data-theme="dark"] .e-ddl.e-popup {
    background: var(--bg-surface) !important;
    background-color: var(--bg-surface) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-default) !important;
}

/* Syncfusion popup list items used by font/size dropdowns, color pickers, etc.
   Uses .e-list-item (DropDownList/ComboBox) and .e-item (DropDownButton menus). */
[data-theme="nord"] .e-popup .e-list-item,
[data-theme="nord"] .e-popup .e-item,
[data-theme="nord"] .e-dropdownbase .e-list-item,
[data-theme="nord"] .e-dropdownbase ul li,
[data-theme="solarized-dark"] .e-popup .e-list-item,
[data-theme="solarized-dark"] .e-popup .e-item,
[data-theme="solarized-dark"] .e-dropdownbase .e-list-item,
[data-theme="solarized-dark"] .e-dropdownbase ul li,
[data-theme="abyss"] .e-popup .e-list-item,
[data-theme="abyss"] .e-popup .e-item,
[data-theme="abyss"] .e-dropdownbase .e-list-item,
[data-theme="abyss"] .e-dropdownbase ul li,
[data-theme="high-contrast-dark"] .e-popup .e-list-item,
[data-theme="high-contrast-dark"] .e-popup .e-item,
[data-theme="high-contrast-dark"] .e-dropdownbase .e-list-item,
[data-theme="high-contrast-dark"] .e-dropdownbase ul li,
[data-theme="dark"] .e-popup .e-list-item,
[data-theme="dark"] .e-popup .e-item,
[data-theme="dark"] .e-dropdownbase .e-list-item,
[data-theme="dark"] .e-dropdownbase ul li {
    color: var(--text-primary) !important;
    background: transparent !important;
    background-color: transparent !important;
}

[data-theme="nord"] .e-popup .e-list-item:hover,
[data-theme="nord"] .e-popup .e-item:hover,
[data-theme="nord"] .e-dropdownbase .e-list-item:hover,
[data-theme="solarized-dark"] .e-popup .e-list-item:hover,
[data-theme="solarized-dark"] .e-popup .e-item:hover,
[data-theme="solarized-dark"] .e-dropdownbase .e-list-item:hover,
[data-theme="abyss"] .e-popup .e-list-item:hover,
[data-theme="abyss"] .e-popup .e-item:hover,
[data-theme="abyss"] .e-dropdownbase .e-list-item:hover,
[data-theme="high-contrast-dark"] .e-popup .e-list-item:hover,
[data-theme="high-contrast-dark"] .e-popup .e-item:hover,
[data-theme="high-contrast-dark"] .e-dropdownbase .e-list-item:hover,
[data-theme="dark"] .e-popup .e-list-item:hover,
[data-theme="dark"] .e-popup .e-item:hover,
[data-theme="dark"] .e-dropdownbase .e-list-item:hover {
    background: var(--bg-hover) !important;
    background-color: var(--bg-hover) !important;
    color: var(--text-primary) !important;
}

/* Selected/active list items (e.g. current font in font dropdown) */
[data-theme="nord"] .e-popup .e-list-item.e-active,
[data-theme="nord"] .e-popup .e-list-item.e-item-focus,
[data-theme="nord"] .e-popup .e-item.e-selected,
[data-theme="nord"] .e-popup .e-item.e-focused,
[data-theme="solarized-dark"] .e-popup .e-list-item.e-active,
[data-theme="solarized-dark"] .e-popup .e-list-item.e-item-focus,
[data-theme="solarized-dark"] .e-popup .e-item.e-selected,
[data-theme="solarized-dark"] .e-popup .e-item.e-focused,
[data-theme="abyss"] .e-popup .e-list-item.e-active,
[data-theme="abyss"] .e-popup .e-list-item.e-item-focus,
[data-theme="abyss"] .e-popup .e-item.e-selected,
[data-theme="abyss"] .e-popup .e-item.e-focused,
[data-theme="high-contrast-dark"] .e-popup .e-list-item.e-active,
[data-theme="high-contrast-dark"] .e-popup .e-list-item.e-item-focus,
[data-theme="high-contrast-dark"] .e-popup .e-item.e-selected,
[data-theme="high-contrast-dark"] .e-popup .e-item.e-focused,
[data-theme="dark"] .e-popup .e-list-item.e-active,
[data-theme="dark"] .e-popup .e-list-item.e-item-focus,
[data-theme="dark"] .e-popup .e-item.e-selected,
[data-theme="dark"] .e-popup .e-item.e-focused {
    background: var(--accent-subtle) !important;
    background-color: var(--accent-subtle) !important;
    color: var(--text-primary) !important;
}

/* Document editor styles gallery - the "Normal", "Heading 1", "Heading 2" tile blocks.
   Syncfusion uses several class patterns for these: .e-de-styles-list-item,
   .e-ribbon-gallery-item, .e-de-styles-gallery, plus generic .e-btn variants. */
[data-theme="nord"] .e-de-styles-list-item,
[data-theme="nord"] .e-ribbon-gallery-item,
[data-theme="nord"] .e-de-styles-gallery .e-list-item,
[data-theme="solarized-dark"] .e-de-styles-list-item,
[data-theme="solarized-dark"] .e-ribbon-gallery-item,
[data-theme="solarized-dark"] .e-de-styles-gallery .e-list-item,
[data-theme="abyss"] .e-de-styles-list-item,
[data-theme="abyss"] .e-ribbon-gallery-item,
[data-theme="abyss"] .e-de-styles-gallery .e-list-item,
[data-theme="high-contrast-dark"] .e-de-styles-list-item,
[data-theme="high-contrast-dark"] .e-ribbon-gallery-item,
[data-theme="high-contrast-dark"] .e-de-styles-gallery .e-list-item,
[data-theme="dark"] .e-de-styles-list-item,
[data-theme="dark"] .e-ribbon-gallery-item,
[data-theme="dark"] .e-de-styles-gallery .e-list-item {
    background: var(--bg-input) !important;
    background-color: var(--bg-input) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-default) !important;
}

[data-theme="nord"] .e-de-styles-list-item.e-active,
[data-theme="nord"] .e-de-styles-list-item.e-selected,
[data-theme="nord"] .e-ribbon-gallery-item.e-active,
[data-theme="nord"] .e-ribbon-gallery-item.e-selected,
[data-theme="solarized-dark"] .e-de-styles-list-item.e-active,
[data-theme="solarized-dark"] .e-de-styles-list-item.e-selected,
[data-theme="solarized-dark"] .e-ribbon-gallery-item.e-active,
[data-theme="solarized-dark"] .e-ribbon-gallery-item.e-selected,
[data-theme="abyss"] .e-de-styles-list-item.e-active,
[data-theme="abyss"] .e-de-styles-list-item.e-selected,
[data-theme="abyss"] .e-ribbon-gallery-item.e-active,
[data-theme="abyss"] .e-ribbon-gallery-item.e-selected,
[data-theme="high-contrast-dark"] .e-de-styles-list-item.e-active,
[data-theme="high-contrast-dark"] .e-de-styles-list-item.e-selected,
[data-theme="high-contrast-dark"] .e-ribbon-gallery-item.e-active,
[data-theme="high-contrast-dark"] .e-ribbon-gallery-item.e-selected,
[data-theme="dark"] .e-de-styles-list-item.e-active,
[data-theme="dark"] .e-de-styles-list-item.e-selected,
[data-theme="dark"] .e-ribbon-gallery-item.e-active,
[data-theme="dark"] .e-ribbon-gallery-item.e-selected {
    background: var(--accent-subtle) !important;
    background-color: var(--accent-subtle) !important;
    color: var(--text-primary) !important;
    border-color: var(--accent) !important;
    box-shadow: 0 0 0 1px var(--accent) !important;
}

/* Aggressive blanket override for the document ribbon area - Syncfusion's SfRibbon
   uses many internal class names and our specific selectors miss some. We catch any
   input-like control (combobox, dropdown, textbox) and any button regardless of class. */
[data-theme="nord"] .document-ribbon-area input,
[data-theme="nord"] .document-ribbon-area .e-input,
[data-theme="nord"] .document-ribbon-area .e-control-wrapper,
[data-theme="nord"] .document-ribbon-area .e-input-group,
[data-theme="nord"] .document-ribbon-area .e-combobox,
[data-theme="nord"] .document-ribbon-area .e-dropdownlist,
[data-theme="nord"] .document-ribbon-area .e-numerictextbox,
[data-theme="solarized-dark"] .document-ribbon-area input,
[data-theme="solarized-dark"] .document-ribbon-area .e-input,
[data-theme="solarized-dark"] .document-ribbon-area .e-control-wrapper,
[data-theme="solarized-dark"] .document-ribbon-area .e-input-group,
[data-theme="solarized-dark"] .document-ribbon-area .e-combobox,
[data-theme="solarized-dark"] .document-ribbon-area .e-dropdownlist,
[data-theme="solarized-dark"] .document-ribbon-area .e-numerictextbox,
[data-theme="abyss"] .document-ribbon-area input,
[data-theme="abyss"] .document-ribbon-area .e-input,
[data-theme="abyss"] .document-ribbon-area .e-control-wrapper,
[data-theme="abyss"] .document-ribbon-area .e-input-group,
[data-theme="abyss"] .document-ribbon-area .e-combobox,
[data-theme="abyss"] .document-ribbon-area .e-dropdownlist,
[data-theme="abyss"] .document-ribbon-area .e-numerictextbox,
[data-theme="high-contrast-dark"] .document-ribbon-area input,
[data-theme="high-contrast-dark"] .document-ribbon-area .e-input,
[data-theme="high-contrast-dark"] .document-ribbon-area .e-control-wrapper,
[data-theme="high-contrast-dark"] .document-ribbon-area .e-input-group,
[data-theme="high-contrast-dark"] .document-ribbon-area .e-combobox,
[data-theme="high-contrast-dark"] .document-ribbon-area .e-dropdownlist,
[data-theme="high-contrast-dark"] .document-ribbon-area .e-numerictextbox,
[data-theme="dark"] .document-ribbon-area input,
[data-theme="dark"] .document-ribbon-area .e-input,
[data-theme="dark"] .document-ribbon-area .e-control-wrapper,
[data-theme="dark"] .document-ribbon-area .e-input-group,
[data-theme="dark"] .document-ribbon-area .e-combobox,
[data-theme="dark"] .document-ribbon-area .e-dropdownlist,
[data-theme="dark"] .document-ribbon-area .e-numerictextbox {
    background: var(--bg-input) !important;
    background-color: var(--bg-input) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-default) !important;
}

/* Style gallery tiles - try every conceivable Syncfusion class for the "Normal/Heading"
   button blocks. Targets the tile itself, its label, and the tile-button wrapper. */
[data-theme="nord"] .document-ribbon-area .e-ribbon-tile-item,
[data-theme="nord"] .document-ribbon-area .e-ribbon-tile-button,
[data-theme="nord"] .document-ribbon-area .e-ribbon-collection-item,
[data-theme="nord"] .document-ribbon-area .e-de-styles-item,
[data-theme="nord"] .document-ribbon-area .e-de-style-name,
[data-theme="nord"] .document-ribbon-area .e-ribbon-gallery,
[data-theme="nord"] .document-ribbon-area .e-ribbon-gallery .e-btn,
[data-theme="solarized-dark"] .document-ribbon-area .e-ribbon-tile-item,
[data-theme="solarized-dark"] .document-ribbon-area .e-ribbon-tile-button,
[data-theme="solarized-dark"] .document-ribbon-area .e-ribbon-collection-item,
[data-theme="solarized-dark"] .document-ribbon-area .e-de-styles-item,
[data-theme="solarized-dark"] .document-ribbon-area .e-de-style-name,
[data-theme="solarized-dark"] .document-ribbon-area .e-ribbon-gallery,
[data-theme="solarized-dark"] .document-ribbon-area .e-ribbon-gallery .e-btn,
[data-theme="abyss"] .document-ribbon-area .e-ribbon-tile-item,
[data-theme="abyss"] .document-ribbon-area .e-ribbon-tile-button,
[data-theme="abyss"] .document-ribbon-area .e-ribbon-collection-item,
[data-theme="abyss"] .document-ribbon-area .e-de-styles-item,
[data-theme="abyss"] .document-ribbon-area .e-de-style-name,
[data-theme="abyss"] .document-ribbon-area .e-ribbon-gallery,
[data-theme="abyss"] .document-ribbon-area .e-ribbon-gallery .e-btn,
[data-theme="high-contrast-dark"] .document-ribbon-area .e-ribbon-tile-item,
[data-theme="high-contrast-dark"] .document-ribbon-area .e-ribbon-tile-button,
[data-theme="high-contrast-dark"] .document-ribbon-area .e-ribbon-collection-item,
[data-theme="high-contrast-dark"] .document-ribbon-area .e-de-styles-item,
[data-theme="high-contrast-dark"] .document-ribbon-area .e-de-style-name,
[data-theme="high-contrast-dark"] .document-ribbon-area .e-ribbon-gallery,
[data-theme="high-contrast-dark"] .document-ribbon-area .e-ribbon-gallery .e-btn,
[data-theme="dark"] .document-ribbon-area .e-ribbon-tile-item,
[data-theme="dark"] .document-ribbon-area .e-ribbon-tile-button,
[data-theme="dark"] .document-ribbon-area .e-ribbon-collection-item,
[data-theme="dark"] .document-ribbon-area .e-de-styles-item,
[data-theme="dark"] .document-ribbon-area .e-de-style-name,
[data-theme="dark"] .document-ribbon-area .e-ribbon-gallery,
[data-theme="dark"] .document-ribbon-area .e-ribbon-gallery .e-btn {
    background: var(--bg-input) !important;
    background-color: var(--bg-input) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-default) !important;
}

[data-theme="nord"] .document-ribbon-area .e-ribbon-tile-item.e-active,
[data-theme="nord"] .document-ribbon-area .e-ribbon-tile-item.e-selected,
[data-theme="nord"] .document-ribbon-area .e-ribbon-tile-button.e-active,
[data-theme="nord"] .document-ribbon-area .e-ribbon-collection-item.e-active,
[data-theme="nord"] .document-ribbon-area .e-de-styles-item.e-active,
[data-theme="solarized-dark"] .document-ribbon-area .e-ribbon-tile-item.e-active,
[data-theme="solarized-dark"] .document-ribbon-area .e-ribbon-tile-item.e-selected,
[data-theme="solarized-dark"] .document-ribbon-area .e-ribbon-tile-button.e-active,
[data-theme="solarized-dark"] .document-ribbon-area .e-ribbon-collection-item.e-active,
[data-theme="solarized-dark"] .document-ribbon-area .e-de-styles-item.e-active,
[data-theme="abyss"] .document-ribbon-area .e-ribbon-tile-item.e-active,
[data-theme="abyss"] .document-ribbon-area .e-ribbon-tile-item.e-selected,
[data-theme="abyss"] .document-ribbon-area .e-ribbon-tile-button.e-active,
[data-theme="abyss"] .document-ribbon-area .e-ribbon-collection-item.e-active,
[data-theme="abyss"] .document-ribbon-area .e-de-styles-item.e-active,
[data-theme="high-contrast-dark"] .document-ribbon-area .e-ribbon-tile-item.e-active,
[data-theme="high-contrast-dark"] .document-ribbon-area .e-ribbon-tile-item.e-selected,
[data-theme="high-contrast-dark"] .document-ribbon-area .e-ribbon-tile-button.e-active,
[data-theme="high-contrast-dark"] .document-ribbon-area .e-ribbon-collection-item.e-active,
[data-theme="high-contrast-dark"] .document-ribbon-area .e-de-styles-item.e-active,
[data-theme="dark"] .document-ribbon-area .e-ribbon-tile-item.e-active,
[data-theme="dark"] .document-ribbon-area .e-ribbon-tile-item.e-selected,
[data-theme="dark"] .document-ribbon-area .e-ribbon-tile-button.e-active,
[data-theme="dark"] .document-ribbon-area .e-ribbon-collection-item.e-active,
[data-theme="dark"] .document-ribbon-area .e-de-styles-item.e-active {
    background: var(--accent-subtle) !important;
    background-color: var(--accent-subtle) !important;
    color: var(--text-primary) !important;
    border-color: var(--accent) !important;
    box-shadow: 0 0 0 1px var(--accent) !important;
}

/* Document editor: keep the page (paper) area light for authoring,
   but theme the surrounding chrome (toolbar, status bar, properties pane). */
[data-theme="nord"] .e-de-toolbar,
[data-theme="nord"] .e-de-status-bar,
[data-theme="nord"] .e-de-prop-pane,
[data-theme="solarized-dark"] .e-de-toolbar,
[data-theme="solarized-dark"] .e-de-status-bar,
[data-theme="solarized-dark"] .e-de-prop-pane,
[data-theme="abyss"] .e-de-toolbar,
[data-theme="abyss"] .e-de-status-bar,
[data-theme="abyss"] .e-de-prop-pane,
[data-theme="high-contrast-dark"] .e-de-toolbar,
[data-theme="high-contrast-dark"] .e-de-status-bar,
[data-theme="high-contrast-dark"] .e-de-prop-pane,
[data-theme="dark"] .e-de-toolbar,
[data-theme="dark"] .e-de-status-bar,
[data-theme="dark"] .e-de-prop-pane {
    background: var(--bg-sidebar) !important;
    background-color: var(--bg-sidebar) !important;
    color: var(--text-primary) !important;
}

/* Tab headers inside dialogs */
[data-theme="nord"] .e-tab .e-tab-header,
[data-theme="solarized-dark"] .e-tab .e-tab-header,
[data-theme="abyss"] .e-tab .e-tab-header,
[data-theme="high-contrast-dark"] .e-tab .e-tab-header {
    background: var(--bg-sidebar) !important;
    background-color: var(--bg-sidebar) !important;
}

[data-theme="nord"] .e-tab .e-tab-header .e-toolbar-item .e-tab-text,
[data-theme="solarized-dark"] .e-tab .e-tab-header .e-toolbar-item .e-tab-text,
[data-theme="abyss"] .e-tab .e-tab-header .e-toolbar-item .e-tab-text,
[data-theme="high-contrast-dark"] .e-tab .e-tab-header .e-toolbar-item .e-tab-text {
    color: var(--text-secondary) !important;
}

[data-theme="nord"] .e-tab .e-tab-header .e-toolbar-item.e-active,
[data-theme="solarized-dark"] .e-tab .e-tab-header .e-toolbar-item.e-active,
[data-theme="abyss"] .e-tab .e-tab-header .e-toolbar-item.e-active,
[data-theme="high-contrast-dark"] .e-tab .e-tab-header .e-toolbar-item.e-active {
    background: var(--bg-surface) !important;
    background-color: var(--bg-surface) !important;
}

[data-theme="nord"] .e-tab .e-tab-header .e-toolbar-item.e-active .e-tab-text,
[data-theme="solarized-dark"] .e-tab .e-tab-header .e-toolbar-item.e-active .e-tab-text,
[data-theme="abyss"] .e-tab .e-tab-header .e-toolbar-item.e-active .e-tab-text,
[data-theme="high-contrast-dark"] .e-tab .e-tab-header .e-toolbar-item.e-active .e-tab-text {
    color: var(--text-primary) !important;
}

/* -- Global workbench layout ---------------------------------------------- */
.shazam-workbench {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    background: var(--bg-page);
    color: var(--text-primary);
    font-family: var(--font-ui);
}

/* -- Toolbar -------------------------------------------------------------- */
.shazam-toolbar {
    height: 36px;
    background: var(--menubar-bg);
    display: flex;
    align-items: center;
    padding: 0;
    flex-shrink: 0;
    font-size: 12px;
    border-bottom: 1px solid var(--border-default);
    user-select: none;
    -webkit-app-region: drag;
}

.toolbar-start {
    display: flex;
    align-items: center;
    gap: 0;
    flex-shrink: 0;
    -webkit-app-region: no-drag;
}

.toolbar-brand {
    width: 48px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    cursor: pointer;
    flex-shrink: 0;
    padding: 0;
}

.toolbar-brand:hover {
    background: var(--bg-hover);
}

.brand-mark {
    width: 22px;
    height: 22px;
    background: var(--accent);
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 13px;
    color: var(--text-inverse);
    letter-spacing: -0.5px;
}

.brand-logo {
    width: 22px;
    height: 22px;
    border-radius: 4px;
    object-fit: contain;
}

.toolbar-group {
    display: flex;
    align-items: center;
    gap: 0;
}

.toolbar-sep {
    width: 1px;
    height: 16px;
    background: var(--border-default);
    margin: 0 4px;
    flex-shrink: 0;
}

.toolbar-btn {
    height: 26px;
    padding: 0 8px;
    border: none;
    background: transparent;
    font-size: 12px;
    font-family: var(--font-ui);
    color: var(--text-primary);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
    border-radius: 3px;
    margin: 0 1px;
    transition: background .1s, color .1s;
}

.toolbar-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.toolbar-btn:active {
    background: var(--bg-active);
}

.toolbar-btn svg {
    flex-shrink: 0;
}

.dropdown-caret {
    margin-left: -2px;
    opacity: .6;
}

.toolbar-run {
    color: var(--success-fg);
    font-weight: 600;
}

.toolbar-run:hover {
    background: rgba(46,125,50,.08);
    color: var(--success-fg);
}

.toolbar-run svg {
    color: var(--success-fg);
}

.toolbar-stop,
.toolbar-icon-btn.toolbar-stop {
    color: var(--error-fg);
}

.toolbar-stop:hover,
.toolbar-icon-btn.toolbar-stop:hover {
    background: rgba(211,47,47,.08);
    color: var(--error-fg);
}

.toolbar-stop svg {
    color: var(--error-fg);
}

/* -- Toolbar dropdown ----------------------------------------------------- */
.toolbar-dropdown {
    position: relative;
    display: inline-flex;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 2px;
    min-width: 180px;
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: 6px;
    box-shadow: 0 4px 16px rgba(0,0,0,.12);
    padding: 4px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

.dropdown-sep {
    height: 1px;
    margin: 4px 6px;
    background: var(--border-default);
    flex-shrink: 0;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 5px 10px;
    border: none;
    background: transparent;
    font-size: 12px;
    font-family: var(--font-ui);
    color: var(--text-primary);
    cursor: pointer;
    border-radius: 3px;
    text-align: left;
    white-space: nowrap;
}

.dropdown-item:hover {
    background: var(--accent-subtle);
    color: var(--accent);
}

.dropdown-item svg {
    color: var(--text-secondary);
    flex-shrink: 0;
}

.dropdown-item:hover svg {
    color: var(--accent);
}

.toolbar-title {
    flex: 1;
    text-align: center;
    font-size: 12px;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 0 16px;
    -webkit-app-region: drag;
}

.toolbar-title-cluster {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 0;
}

.toolbar-workspace-name {
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: min(420px, 50vw);
}

.toolbar-workspace-rename,
.toolbar-workspace-manage {
    flex-shrink: 0;
    width: 26px;
    height: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 3px;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    -webkit-app-region: no-drag;
}

.toolbar-workspace-rename:hover,
.toolbar-workspace-manage:hover {
    background: var(--bg-hover);
    color: var(--accent);
}

.toolbar-end {
    display: flex;
    align-items: center;
    gap: 0;
    flex-shrink: 0;
    padding-right: 4px;
    -webkit-app-region: no-drag;
}

.toolbar-icon-btn {
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 3px;
    padding: 0;
}

.toolbar-icon-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.toolbar-icon-btn.toggled {
    color: var(--accent);
}

.toolbar-icon-btn.toggled:hover {
    color: var(--accent);
}

/* "Ready" tri-state: the focused pane reports CanX=true for this command,
   so the button is both enabled AND contextually applicable. Distinct from
   .toggled (panel visibility) and the disabled attribute. */
.toolbar-icon-btn.ready {
    color: var(--accent);
}
.toolbar-icon-btn.ready:hover {
    color: var(--accent);
    background: var(--accent-subtle, var(--bg-hover));
}
.toolbar-icon-btn:disabled {
    color: var(--text-disabled, var(--text-secondary));
    cursor: default;
    opacity: .55;
}
.toolbar-icon-btn:disabled:hover {
    background: transparent;
    color: var(--text-disabled, var(--text-secondary));
}

/* Same tri-state for per-panel toolbar buttons (FileManager Delete/Rename
   etc.). Existing .tb-btn:hover styling is preserved. */
.tb-btn:not(:disabled).ready {
    color: var(--accent);
}

/* -- Workspace ------------------------------------------------------------ */
.shazam-workspace {
    flex: 1;
    overflow: hidden;
    min-height: 0;
    min-width: 0;
    padding: 4px;
    background: var(--bg-page);
    /* Containing block for the absolutely-positioned loading overlay (.shz-workspace-loading),
       so it centres reliably regardless of the height-% resolution chain (web has no full-window
       index.html splash to mask a collapsed height:100%). Harmless when the splitter is mounted. */
    position: relative;
}

/* -- Status bar ----------------------------------------------------------- */
.shazam-statusbar {
    height: 22px;
    background: var(--statusbar-bg);
    color: var(--statusbar-fg);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    flex-shrink: 0;
    user-select: none;
    padding: 0;
}

.statusbar-left,
.statusbar-right {
    display: flex;
    align-items: center;
    height: 100%;
    flex-shrink: 0;
}

.statusbar-center {
    display: flex;
    align-items: center;
    height: 100%;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    justify-content: center;
    gap: 0;
    white-space: nowrap;
    text-overflow: ellipsis;
    font-size: 12px;
    padding: 0 8px;
}

.statusbar-center > span {
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Ephemeral API / session messages (rate limit, connection) - status bar, not modal */
.sb-ephemeral {
    max-width: min(560px, 70vw);
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 2px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    line-height: 1.35;
    white-space: nowrap;
}

.sb-ephemeral.sb-rate-limit {
    background: rgba(255, 214, 102, 0.95);
    color: #1a1a1a;
}

.sb-ephemeral.sb-error {
    background: rgba(255, 180, 180, 0.95);
    color: #1a1a1a;
}

.statusbar-pipe {
    flex-shrink: 0;
    padding: 0 6px;
}

.sb-item {
    height: 22px;
    padding: 0 8px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    border: none;
    background: transparent;
    color: inherit;
    font-size: 12px;
    font-family: var(--font-ui-small);
    cursor: pointer;
    white-space: nowrap;
    line-height: 22px;
}

.sb-item:hover {
    background: rgba(255,255,255,.12);
}

/* Plan badge (Free/Pro/Enterprise) in the status-bar centre - replaces the retired
   per-seat "For Use Only By" watermark. The tier is the emphasised token; the optional
   Enterprise attribution line trails it, muted. */
.sb-plan-tier {
    font-weight: 600;
}

.sb-plan-org {
    opacity: .7;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: min(360px, 40vw);
}

.sb-remote {
    background: rgba(255,255,255,.15);
    padding: 0 6px;
}

.sb-remote:hover {
    background: rgba(255,255,255,.25);
}

.session-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    display: inline-block;
}

.session-dot.idle {
    background: var(--statusbar-idle);
}

.session-dot.paused {
    background: #e67e22;
}

.session-dot.error {
    background: #f48771;
}

/* Busy chip. While the engine is working the whole status item flips to a solid
   colour that no other state uses, so "something is happening" is legible from
   across the room rather than being a 7px dot change. No border: the fill alone
   is what separates it from the bar. */
.sb-item.sb-session-indicator.running,
.sb-item.sb-session-indicator.stopping {
    background: var(--statusbar-running-bg);
    color: var(--statusbar-running-fg);
    font-weight: 600;
}

.sb-item.sb-session-indicator.running:hover,
.sb-item.sb-session-indicator.stopping:hover {
    background: var(--statusbar-running-bg);
}

/* Cancellation in progress reads as the same busy family, one shade hotter. */
.sb-item.sb-session-indicator.stopping {
    background: var(--statusbar-stopping-bg);
}

/* Spinner arcs inherit the chip's foreground, so contrast is guaranteed by the
   chip's own colour pair in every theme. Two lit quadrants (not one) make the
   rotation unmistakable at 12px. */
.sb-spinner {
    width: 12px;
    height: 12px;
    box-sizing: border-box;
    border: 2px solid color-mix(in srgb, currentColor 28%, transparent);
    border-top-color: currentColor;
    border-right-color: currentColor;
    border-radius: 50%;
    display: inline-block;
    animation: spin .7s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.sb-diagnostics {
    gap: 8px;
}

.diag-errors,
.diag-warnings {
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.diag-errors svg { color: rgba(255,255,255,.9); }
.diag-warnings svg { color: rgba(255,255,255,.7); }

/* -- Pane primitives ------------------------------------------------------ */
.pane {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: var(--bg-surface);
    overflow: hidden;
    border-radius: 6px;
    border: 1.5px solid var(--border-default);
    transition: border-color 0.15s;
}

.pane:focus-within {
    border-color: var(--accent);
}

.pane:focus {
    outline: none;
}

.pane-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 35px;
    min-height: 35px;
    padding: 0 10px;
    background: var(--bg-sidebar);
    border-bottom: 1px solid var(--border-default);
    font-family: var(--font-ui-small);
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: .6px;
    flex-shrink: 0;
    user-select: none;
    border-radius: 6px 6px 0 0;
}

.pane-header-actions {
    display: flex;
    align-items: center;
    gap: 2px;
}

/* Positioning context for the anchored actions menu, so the dropdown hangs off
   the hamburger rather than off the viewport. */
.fm-actions {
    position: relative;
}

.fm-actions-btn[aria-expanded="true"] {
    background: var(--bg-active);
    color: var(--text-primary);
}

.pane-content {
    flex: 1;
    overflow: auto;
    min-height: 0;
}

/* -- File tree ------------------------------------------------------------ */
.file-search {
    padding: 6px 8px;
    border-bottom: 1px solid var(--border-default);
    background: var(--bg-sidebar);
}

.file-tree-content {
    background: var(--bg-sidebar);
}

.project-label {
    padding: 8px 12px 4px;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: .8px;
}

.file-tree-list {
    padding-bottom: 16px;
}

.tree-node {
    display: flex;
    align-items: center;
    height: 24px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-primary);
    padding-right: 8px;
    user-select: none;
    border-left: 2px solid transparent;
    transition: background .08s;
}

.tree-node:hover {
    background: var(--bg-hover);
}

.tree-node.selected {
    background: var(--accent-subtle);
    border-left-color: var(--accent);
    color: var(--accent);
    font-weight: 500;
}

.tree-node.recently-added:not(.selected) {
    animation: workspace-tree-entry-added 2.8s ease-out both;
}

.tree-node.recently-added .tree-text {
    animation: workspace-tree-entry-name-added 2.8s ease-out both;
}

@keyframes workspace-tree-entry-added {
    0%, 100% { background: transparent; }
    12%, 48% { background: color-mix(in srgb, var(--accent) 18%, transparent); }
    30%, 68% { background: color-mix(in srgb, var(--accent) 7%, transparent); }
}

@keyframes workspace-tree-entry-name-added {
    0%, 100% { color: inherit; font-weight: 400; }
    12%, 48% { color: var(--accent); font-weight: 700; }
    30%, 68% { color: var(--text-primary); font-weight: 500; }
}

@media (prefers-reduced-motion: reduce) {
    .tree-node.recently-added:not(.selected) {
        animation: none;
        background: color-mix(in srgb, var(--accent) 15%, transparent);
    }

    .tree-node.recently-added .tree-text {
        animation: none;
        color: var(--accent);
        font-weight: 700;
    }
}

/* ── Workspace tree drag (pointer-based, tree-drag.js) ────────────────────
   The old `.tree-node.drag-over` (native-DnD hover) is gone with native DnD;
   these are the states the pointer engine toggles. */

/* A valid drop target under the cursor: the folder the item would land in. */
.tree-node.tree-drop-target {
    background: var(--accent-subtle);
    outline: 1px solid var(--accent);
    outline-offset: -1px;
    border-radius: 3px;
}

/* An illegal target (a folder into itself/descendant, or already-there): shown
   so the user learns WHY nothing will happen, rather than a dead drop. */
.tree-node.tree-drop-invalid {
    background: color-mix(in srgb, var(--error-fg) 10%, transparent);
    outline: 1px dashed var(--error-fg);
    outline-offset: -1px;
    border-radius: 3px;
    cursor: no-drop;
}

/* While any tree drag is in flight, suppress text selection and the default
   caret so the gesture reads as a drag, not a botched click. */
body.tree-dragging {
    cursor: grabbing;
    user-select: none;
}

/* The floating label that follows the cursor. Positioned by the engine in fixed
   coords; pointer-events:none so it never becomes its own hit-test target. */
.tree-drag-ghost {
    position: fixed;
    z-index: 100050;
    display: none;
    align-items: center;
    gap: 5px;
    max-width: 280px;
    padding: 3px 8px;
    border-radius: 5px;
    background: var(--bg-surface);
    border: 1px solid var(--accent);
    box-shadow: 0 4px 14px rgba(0,0,0,.18);
    font-family: var(--font-ui-small);
    font-size: 12px;
    color: var(--text-primary);
    pointer-events: none;
    white-space: nowrap;
}

.tree-drag-ghost-label {
    overflow: hidden;
    text-overflow: ellipsis;
}

/* The + that marks a copy (Ctrl/Cmd held). A filled green badge, matching the
   "additive" reading of copy versus the neutral move. */
.tree-drag-ghost-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background: var(--success-fg);
    color: #fff;
    font-weight: 700;
    font-size: 12px;
    line-height: 1;
}

.tree-drag-ghost--copy {
    border-color: var(--success-fg);
}

/* ── Drop name-clash confirm ─────────────────────────────────────────────── */
.fm-drop-confirm-overlay {
    position: fixed;
    inset: 0;
    z-index: 100060;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,.28);
}

.fm-drop-confirm {
    /* Positioned so it paints above the .overlay-dismiss surface behind it. */
    position: relative;
    width: min(340px, 90vw);
    padding: 16px;
    border-radius: 8px;
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    box-shadow: 0 8px 28px rgba(0,0,0,.22);
    font-family: var(--font-ui);
}

.fm-drop-confirm-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.fm-drop-confirm-detail {
    margin-top: 6px;
    font-size: 12px;
    line-height: 1.45;
    color: var(--text-secondary);
}

.fm-drop-confirm-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 16px;
}

.fm-drop-confirm-btn {
    padding: 5px 12px;
    border-radius: 6px;
    border: 1px solid var(--border-default);
    background: var(--bg-surface);
    color: var(--text-primary);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

.fm-drop-confirm-btn:hover {
    background: var(--bg-hover);
}

/* Replace is the consequential, destructive choice - tinted, but not the loud
   default, since Keep both is the safer path. */
.fm-drop-confirm-replace {
    border-color: color-mix(in srgb, var(--warning-fg) 50%, transparent);
    color: var(--warning-fg);
}

.fm-drop-confirm-cancel {
    color: var(--text-secondary);
}

/* External OS file drag anywhere over the app. The dashed blue frame is
   anchored to the workspace pane (the import destination) even when the cursor
   is elsewhere in the window, and the folder under the cursor is highlighted
   when the drag is over the tree, so the user sees where the files will land.
   Toggled by shazamDragDrop.initExternalFileDrop (JS owns these classes because
   the dropped bytes are only reachable from the native DOM drop event, not
   Blazor's DragEventArgs). */
.file-tree-content.external-drop-active {
    outline: 2px dashed var(--accent);
    outline-offset: -2px;
    background: var(--accent-subtle);
}

.tree-node.external-drop-target {
    background: var(--accent-subtle);
    outline: 1px dashed var(--accent);
    outline-offset: -1px;
}

/* Post-drop confirmation: the blue frame pulses twice then settles so the user
   sees where the dropped files went (cf. the macOS drag-to-trash cue). Uses an
   inset box-shadow so it frames the pane without shifting layout. Under
   prefers-reduced-motion the global neutraliser collapses this to a no-op. */
@keyframes shz-workspace-drop-pulse {
    0%   { box-shadow: inset 0 0 0 2px transparent; }
    50%  { box-shadow: inset 0 0 0 2px var(--accent); }
    100% { box-shadow: inset 0 0 0 2px transparent; }
}

.file-tree-content.shz-drop-pulse {
    animation: shz-workspace-drop-pulse 0.5s ease-in-out 2;
}

/* Central-panel drag-to-move (editor / output / data / graphs). The pane title
   is the drag handle; grab it to move the panel between rows or swap it
   horizontally with another central pane. Replaces the old up/down arrow. The
   gesture is pointer-based (panel-drag.js) because native HTML5 drag-and-drop
   does not work in this WebView / Blazor-Server setup. */
/* Cursor: `move`. See the shared cursor block near the Syncfusion overrides -
   grab / grabbing and url() glyphs cannot render on the desktop host, and both
   hosts are meant to look identical. */
.pane-drag-handle {
    cursor: move;
    user-select: none;
    /* Own the pointer gesture outright so touch/pen drags don't scroll/pan. */
    touch-action: none;
}

.pane-drag-handle:active {
    cursor: move;
}

/* While a panel drag is in flight (body class toggled by panel-drag.js), keep
   the grabbing cursor everywhere and suppress stray text selection. :active is
   unreliable once panel-drag.js takes pointer capture, so drive it off the body
   class instead - same technique as body.notebook-cell-reorder-active. */
body.shazam-panel-dragging,
body.shazam-panel-dragging * {
    cursor: move !important;
    user-select: none;
}

/* cursor inherits, so the grab hand on the header would bleed onto the header's
   action buttons (minimise / maximise / clear / etc.). Pin them back to the
   normal arrow. Higher specificity than the MAUI bare-keyword grab override, so
   it wins on both hosts. */
.pane-header.pane-drag-handle .pane-header-actions,
.pane-header.pane-drag-handle .pane-header-actions * {
    cursor: default !important;
}

/* Drop feedback is an INSERT POINT, not a target pane: the two panes either side
   of where the dragged panel will land part a little, and an accent bar marks the
   gap. Classes toggled directly by panel-drag.js. The transition is scoped to an
   active drag so panes never animate during normal splitter resizing. */
body.shazam-panel-dragging .pane {
    transition: transform 0.12s ease;
}

.pane.pane-part-left {
    transform: translateX(-7px);
}

.pane.pane-part-right {
    transform: translateX(7px);
}

/* The bar sits in the parted gap, spanning the row's height. */
.shazam-panel-insert-bar {
    position: fixed;
    z-index: 100001;
    pointer-events: none;
    width: 3px;
    border-radius: 2px;
    background: var(--accent);
    box-shadow: 0 0 6px var(--accent);
}

/* The panel being dragged dims so the eye follows the drop frame. */
.pane.pane-drag-source {
    opacity: 0.5;
}

/* Faint panel-shaped frame that follows the cursor during a panel drag (sized
   and created by panel-drag.js). Shows the shape of the panel being moved - the
   primary "drag is happening" cue, and identical on Web and MAUI unlike cursor
   changes, which WebView2 renders unreliably. pointer-events:none so it never
   blocks the pane hit-test underneath. Deliberately faint: it floats over live
   content and must not obscure the drop frame it is being dragged towards. */
.shazam-panel-drag-ghost {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 100000;
    pointer-events: none;
    box-sizing: border-box;
    padding: 8px 10px;
    border: 2px solid var(--accent);
    border-radius: 8px;
    background: var(--accent-subtle);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
    opacity: 0.5;
    font-family: var(--font-ui-small, system-ui, sans-serif);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .6px;
    text-transform: uppercase;
    color: var(--accent);
    white-space: nowrap;
    overflow: hidden;
}

.tree-arrow {
    width: 16px;
    text-align: center;
    font-size: 10px;
    color: var(--text-tertiary);
    flex-shrink: 0;
}

.tree-arrow-spacer {
    width: 16px;
    flex-shrink: 0;
}

.tree-icon-svg {
    width: 16px;
    height: 16px;
    margin-right: 6px;
    flex-shrink: 0;
}

.tree-icon {
    width: 16px;
    height: 16px;
    margin-right: 6px;
    flex-shrink: 0;
    border-radius: 3px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 8px;
    font-weight: 700;
    color: var(--text-inverse);
}

.tree-icon.icon-folder    { background: #dcb67a; }
.tree-icon.icon-script    { background: #5b8abf; }
.tree-icon.icon-procedure { background: #7b6bbf; }
.tree-icon.icon-data      { background: #5bae6b; }
.tree-icon.icon-output    { background: #9e9e9e; }
.tree-icon.icon-graph     { background: #d07070; }
.tree-icon.icon-project   { background: #005fb8; }
.tree-icon.icon-document  { background: #4a7fc4; }
.tree-icon.icon-notebook  { background: #6b4f9a; }
.tree-icon.icon-markdown  { background: #c47a3d; }

.tree-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.tree-tooltip.e-tooltip-wrap {
    font-size: 12px !important;
    max-width: 300px !important;
}

/* (legacy .tree-context-* / .graph-context-menu / .graph-context-item /
   .graph-context-sep CSS removed after migration to the shared
   .pane-context-* component above. .graph-context-overlay is preserved
   below because GraphPane still uses it for the legend color-picker
   overlay.) */

/* -- Workspace path input ------------------------------------------------- */
.workspace-path-input {
    display: flex;
    gap: 4px;
    padding: 6px 8px;
    border-bottom: 1px solid var(--border-default);
    background: var(--bg-sidebar);
    align-items: center;
}

.workspace-open-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: var(--accent);
    color: var(--text-inverse);
    border-radius: 4px;
    cursor: pointer;
    flex-shrink: 0;
    padding: 0;
}

.workspace-open-btn:hover {
    background: var(--accent-hover);
}

.workspace-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px 16px;
    text-align: center;
    gap: 12px;
    color: var(--text-secondary);
    font-size: 13px;
}

.workspace-open-action {
    padding: 6px 16px;
    background: var(--accent);
    color: var(--text-inverse);
    border: none;
    border-radius: 4px;
    font-family: var(--font-ui);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
}

.workspace-open-action:hover {
    background: var(--accent-hover);
}

.workspace-hint {
    font-size: 11px;
    color: var(--text-tertiary);
    max-width: 200px;
    line-height: 1.4;
}

/* -- Syncfusion File Manager overrides ------------------------------------ */
.file-manager-pane {
    height: 100%;
    overflow: hidden;
    border-radius: 6px;
    border: 1.5px solid var(--border-default);
    transition: border-color 0.15s;
}

.file-manager-pane:focus-within {
    border-color: var(--accent);
}

.file-manager-pane:focus {
    outline: none;
}

.shazam-file-manager.e-filemanager {
    border: none !important;
    height: 100% !important;
    min-width: 0 !important;
}

.shazam-file-manager .e-toolbar {
    border-bottom: 1px solid var(--border-default) !important;
    background: var(--bg-sidebar) !important;
    min-height: 34px !important;
    height: 36px !important;
    padding: 0 4px !important;
}

.shazam-file-manager .e-toolbar .e-toolbar-items {
    height: 36px !important;
}

.shazam-file-manager .e-toolbar .e-toolbar-item .e-tbar-btn {
    padding: 3px 6px !important;
    height: 28px !important;
    min-height: 28px !important;
    min-width: 28px !important;
    border-radius: 4px !important;
    color: var(--text-secondary) !important;
    transition: background .12s, color .12s !important;
}

.shazam-file-manager .e-toolbar .e-toolbar-item .e-tbar-btn:hover {
    background: var(--bg-hover) !important;
    color: var(--text-primary) !important;
}

.shazam-file-manager .e-toolbar .e-toolbar-item .e-tbar-btn .e-icons {
    font-size: 15px !important;
    color: inherit !important;
}

.shazam-file-manager .e-toolbar .e-tbar-btn-text {
    display: none !important;
}

.shazam-file-manager .e-toolbar .e-toolbar-item.e-separator {
    margin: 0 2px !important;
    min-height: 18px !important;
}

.shazam-file-manager .e-grid {
    border: none !important;
}

.shazam-file-manager .e-address {
    height: 26px !important;
    font-size: 12px !important;
    font-family: var(--font-ui) !important;
    border-bottom: 1px solid var(--border-default) !important;
    background: var(--bg-surface) !important;
    padding: 0 6px !important;
}

.shazam-file-manager .e-address .e-address-list-item,
.shazam-file-manager .e-address .e-list-text {
    font-size: 12px !important;
    color: var(--text-secondary) !important;
}

.shazam-file-manager .e-address .e-list-text:hover {
    color: var(--accent) !important;
}

.shazam-file-manager .e-splitter {
    border: none !important;
}

.shazam-file-manager .e-layout-content {
    min-width: 0 !important;
}

.shazam-file-manager .e-grid .e-rowcell {
    font-size: 12px !important;
    font-family: var(--font-ui) !important;
    padding: 4px 6px !important;
}

.shazam-file-manager .e-grid .e-gridheader {
    display: none !important;
}

.shazam-file-manager .e-grid .e-checkbox-wrapper {
    display: none !important;
}

.shazam-file-manager .e-grid .e-fe-icon {
    font-size: 14px !important;
}

.shazam-file-manager .e-grid .e-rowcell.e-focus,
.shazam-file-manager .e-grid .e-rowcell.e-focused,
.shazam-file-manager .e-grid .e-rowcell {
    border: none !important;
    box-shadow: none !important;
    outline: none !important;
}

.shazam-file-manager .e-grid .e-row .e-rowcell.e-fe-grid-name.e-templatecell {
    border: none !important;
    outline: none !important;
}

.shazam-file-manager .e-grid .e-rowcell.e-editedbatchcell,
.shazam-file-manager .e-grid .e-editedbatchcell {
    border: none !important;
    box-shadow: none !important;
}

.shazam-file-manager .e-grid .e-rowcell input.e-input {
    border: none !important;
    box-shadow: none !important;
    outline: none !important;
    background: var(--accent-subtle) !important;
    border-radius: 3px !important;
    padding: 2px 4px !important;
}

.shazam-file-manager .e-grid .e-row .e-rowcell.e-selectionbackground {
    background: var(--accent-subtle) !important;
    color: var(--text-primary) !important;
    border-color: transparent !important;
}

.shazam-file-manager .e-grid .e-row.e-active .e-rowcell {
    background: var(--accent-subtle) !important;
    color: var(--text-primary) !important;
}

.shazam-file-manager .e-grid .e-row:hover .e-rowcell {
    background: var(--bg-hover) !important;
}

.shazam-file-manager .e-grid .e-row.e-active:hover .e-rowcell {
    background: var(--accent-subtle) !important;
}

/* Center Syncfusion dialogs on screen */
.e-dialog.e-popup {
    position: fixed !important;
    left: 50% !important;
    top: 50% !important;
    transform: translate(-50%, -50%) !important;
}

.e-dlg-overlay {
    position: fixed !important;
    inset: 0 !important;
}

/* ── Vendor-internal dialog theming ──────────────────────────────────────
   Dialogs raised by the Syncfusion editors themselves - the Document Editor's
   clipboard "Information" dialog in the screenshot, plus the Spreadsheet's and
   Diagram's own alerts - use markup we do not own, so they cannot adopt the
   WorkbenchDialogHost chrome. They CAN be themed: this pulls the default EJ2
   flat/web look toward the workbench desktop dialog (surface header bar,
   defined footer, raised primary button) so the family reads consistently even
   though we cannot restructure it.

   Scoped to `:not(.workbench-dialog)` so our own dialog's dedicated rules below
   stay authoritative and are not double-styled. */
.e-dialog:not(.workbench-dialog) {
    border-radius: 8px !important;
    border: 1px solid var(--border-default) !important;
    box-shadow: 0 8px 32px rgba(0,0,0,.18) !important;
    font-family: var(--font-ui) !important;
    overflow: hidden !important;
}

.e-dialog:not(.workbench-dialog) .e-dlg-header-content {
    background: var(--bg-sidebar) !important;
    border-bottom: 1px solid var(--border-default) !important;
    padding: 12px 16px !important;
}

.e-dialog:not(.workbench-dialog) .e-dlg-header {
    font-size: 13px !important;
    font-weight: 600 !important;
    color: var(--text-primary) !important;
}

.e-dialog:not(.workbench-dialog) .e-dlg-content {
    background: var(--bg-surface) !important;
    color: var(--text-primary) !important;
    font-size: 13px !important;
    line-height: 1.5 !important;
}

.e-dialog:not(.workbench-dialog) .e-footer-content {
    background: var(--bg-surface) !important;
    border-top: 1px solid var(--border-subtle) !important;
    padding: 10px 16px !important;
}

/* Raised, accented primary; bordered flat secondary - the desktop button pair,
   not the low-contrast web-flat default. */
.e-dialog:not(.workbench-dialog) .e-footer-content .e-btn.e-primary {
    background: var(--accent) !important;
    border-color: var(--accent) !important;
    color: var(--text-inverse) !important;
    border-radius: 4px !important;
    min-width: 72px !important;
}

.e-dialog:not(.workbench-dialog) .e-footer-content .e-btn.e-primary:hover {
    background: var(--accent-hover) !important;
    border-color: var(--accent-hover) !important;
}

.e-dialog:not(.workbench-dialog) .e-footer-content .e-btn:not(.e-primary) {
    border: 1px solid var(--border-default) !important;
    border-radius: 4px !important;
    color: var(--text-secondary) !important;
    min-width: 72px !important;
}

/* -- Workbench dialog (prompt/confirm) ----------------------------------- */
.workbench-dialog.e-dialog {
    border-radius: 8px !important;
    border: 1px solid var(--border-default) !important;
    box-shadow: 0 8px 32px rgba(0,0,0,.18) !important;
    font-family: var(--font-ui) !important;
    overflow: hidden !important;
}

.workbench-dialog .e-dlg-header-content {
    background: var(--bg-sidebar) !important;
    border-bottom: 1px solid var(--border-default) !important;
    padding: 12px 16px !important;
}

.workbench-dialog .e-dlg-header {
    font-size: 13px !important;
    font-weight: 600 !important;
    color: var(--text-primary) !important;
    font-family: var(--font-ui) !important;
    width: 100% !important;
}

/* Header: kind icon + title on one baseline. The icon colour comes from the
   per-kind rules below, so severity is legible before the text is read. */
.wbd-header {
    display: flex;
    align-items: center;
    gap: 9px;
}

.wbd-header-icon {
    display: inline-flex;
    flex: none;
    color: var(--accent);
}

.wbd-header-title {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wbd-kind-warning .wbd-header-icon { color: var(--warning-fg); }
.wbd-kind-error   .wbd-header-icon { color: var(--error-fg); }
.wbd-kind-success .wbd-header-icon { color: var(--success-fg); }
.wbd-kind-info    .wbd-header-icon,
.wbd-kind-question .wbd-header-icon { color: var(--accent); }

.workbench-dialog .e-dlg-content {
    padding: 16px !important;
    background: var(--bg-surface) !important;
}

.workbench-dialog .e-footer-content {
    background: var(--bg-surface) !important;
    border-top: 1px solid var(--border-subtle) !important;
    padding: 10px 16px !important;
    display: flex !important;
    justify-content: flex-end !important;
    gap: 8px !important;
}

.wbd-message {
    font-size: 13px;
    color: var(--text-primary);
    line-height: 1.5;
    margin: 0;
    /* Honour deliberate line breaks a caller puts in the message, rather than
       reflowing everything - long shortcut hints and lists stay readable. */
    white-space: pre-line;
}

.wbd-message--prompt {
    margin-bottom: 10px;
}

.wbd-input {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid var(--border-default);
    border-radius: 4px;
    font-family: var(--font-ui);
    font-size: 13px;
    color: var(--text-primary);
    background: var(--bg-input);
    outline: none;
    transition: border-color .15s, box-shadow .15s;
    box-sizing: border-box;
}

.wbd-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent);
}

.wbd-input::placeholder {
    color: var(--text-tertiary);
}

.wbd-input-error {
    border-color: var(--error-fg) !important;
    box-shadow: 0 0 0 1px var(--error-fg) !important;
}

.wbd-error {
    color: var(--error-fg);
    font-size: 12px;
    margin-top: 6px;
}

.workbench-dialog .e-btn.wbd-ok {
    background: var(--accent) !important;
    color: var(--text-inverse) !important;
    border: none !important;
    border-radius: 4px !important;
    font-family: var(--font-ui) !important;
    font-size: 12px !important;
    font-weight: 500 !important;
    padding: 5px 16px !important;
    min-width: 72px !important;
}

.workbench-dialog .e-btn.wbd-ok:hover {
    background: var(--accent-hover) !important;
}

/* Destructive primary - for an irreversible action (Delete, Reset). Red rather
   than accent so the consequential button reads as consequential. */
.workbench-dialog .e-btn.wbd-ok--danger {
    background: var(--error-fg) !important;
}

.workbench-dialog .e-btn.wbd-ok--danger:hover {
    background: color-mix(in srgb, var(--error-fg) 85%, #000) !important;
}

.workbench-dialog .e-btn.wbd-cancel {
    background: transparent !important;
    color: var(--text-secondary) !important;
    border: 1px solid var(--border-default) !important;
    border-radius: 4px !important;
    font-family: var(--font-ui) !important;
    font-size: 12px !important;
    font-weight: 500 !important;
    padding: 5px 16px !important;
    min-width: 72px !important;
}

.workbench-dialog .e-btn.wbd-cancel:hover {
    background: var(--bg-hover) !important;
    color: var(--text-primary) !important;
}

/* -- Upgrade PROC dialog -------------------------------------------------- */
.upgrade-proc-dialog .e-dlg-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow: hidden !important;
    height: 100%;
}

.upgrade-proc-banner {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 10px 12px;
    border-radius: 4px;
    font-size: 12px;
    line-height: 1.5;
    border: 1px solid transparent;
}

.upgrade-proc-banner-warning {
    background: color-mix(in srgb, var(--warning-fg, #c87f15) 12%, var(--bg-surface));
    border-color: color-mix(in srgb, var(--warning-fg, #c87f15) 30%, var(--border-default));
}

.upgrade-proc-banner-error {
    background: color-mix(in srgb, var(--error-fg, #c0392b) 12%, var(--bg-surface));
    border-color: color-mix(in srgb, var(--error-fg, #c0392b) 30%, var(--border-default));
}

.upgrade-proc-hint {
    margin: 4px 0 0;
    color: var(--text-secondary);
}

.upgrade-proc-diff {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    flex: 1 1 auto;
    min-height: 0;
}

/* -- Modernize preview dialog --------------------------------------------
   A per-line before/after diff. Stacked rows rather than side-by-side panes:
   the two versions of a line differ by a token or two, and stacking puts those
   tokens directly above one another instead of an eye-scan apart. The hunk list
   is the only thing that scrolls, so the summary and the footnote stay put
   however many changes there are. */
.modernize-preview-dialog .e-dlg-content {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 0;
}

.mz-summary {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.mz-summary-count {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.mz-summary-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

/* Category tally. Reading these tells you the shape of the change - "nine
   result temporaries and three operators" - without reading the diff. */
.mz-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 2px 4px 2px 8px;
    border: 1px solid var(--border-default);
    border-radius: 10px;
    background: var(--bg-sidebar);
    font-size: 11px;
    color: var(--text-secondary);
    white-space: nowrap;
}

.mz-chip-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 16px;
    padding: 0 5px;
    border-radius: 8px;
    background: var(--accent);
    color: #fff;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.mz-diff {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    border: 1px solid var(--border-default);
    border-radius: 4px;
    background: var(--bg-input);
}

.mz-hunk {
    border-bottom: 1px solid var(--border-subtle);
    padding: 6px 0;
}

.mz-hunk:last-child {
    border-bottom: none;
}

.mz-hunk-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 8px;
    padding: 0 12px 4px 12px;
}

.mz-hunk-line {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}

.mz-hunk-reason {
    font-size: 11px;
    color: var(--text-tertiary);
}

.mz-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 1px 12px;
}

.mz-row-before {
    background: color-mix(in srgb, var(--error-fg) 9%, transparent);
}

.mz-row-after {
    background: color-mix(in srgb, var(--success-fg) 12%, transparent);
}

/* The +/- gutter is the state cue for anyone who cannot separate the two row
   tints - it is a glyph, not a colour (SC 1.4.1). */
.mz-gutter {
    flex: 0 0 auto;
    width: 10px;
    font-family: var(--font-mono);
    font-size: 12px;
    line-height: 1.5;
    font-weight: 700;
    text-align: center;
    user-select: none;
}

.mz-row-before .mz-gutter {
    color: var(--error-fg);
}

.mz-row-after .mz-gutter {
    color: var(--success-fg);
}

.mz-code {
    flex: 1 1 auto;
    min-width: 0;
    font-family: var(--font-mono);
    font-size: 12px;
    line-height: 1.5;
    color: var(--text-primary);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

/* Changed token. Underline as well as tint so the emphasis survives without
   colour, and reset <mark>'s default yellow-on-black UA styling. */
.mz-token {
    background: color-mix(in srgb, var(--accent) 22%, transparent);
    color: inherit;
    border-radius: 2px;
    padding: 0 1px;
    text-decoration: underline;
    text-decoration-style: dotted;
    text-underline-offset: 2px;
}

.mz-truncated {
    padding: 8px 12px;
    font-size: 11px;
    color: var(--text-secondary);
    background: var(--bg-sidebar);
    border-top: 1px solid var(--border-default);
}

.mz-footnote {
    flex: 0 0 auto;
    margin: 0;
    font-size: 11px;
    line-height: 1.5;
    color: var(--text-secondary);
}

.upgrade-proc-pane {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-default);
    border-radius: 4px;
    overflow: hidden;
    min-height: 0;
}

.upgrade-proc-pane-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-tertiary);
    padding: 6px 10px;
    background: var(--bg-sidebar);
    border-bottom: 1px solid var(--border-subtle);
}

.upgrade-proc-pane-body {
    margin: 0;
    padding: 10px 12px;
    overflow: auto;
    font-family: 'Cascadia Mono', Consolas, 'Courier New', monospace;
    font-size: 12px;
    line-height: 1.45;
    color: var(--text-primary);
    background: var(--bg-input);
    white-space: pre;
    flex: 1 1 auto;
    min-height: 0;
}

.upgrade-proc-edit-pane {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    gap: 6px;
}

.upgrade-proc-edit-area {
    flex: 1 1 auto;
    min-height: 200px;
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-default);
    border-radius: 4px;
    font-family: 'Cascadia Mono', Consolas, 'Courier New', monospace;
    font-size: 12px;
    line-height: 1.45;
    color: var(--text-primary);
    background: var(--bg-input);
    resize: vertical;
    white-space: pre;
}

.upgrade-proc-warnings {
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
    background: var(--bg-surface);
    max-height: 140px;
    overflow: auto;
}

.upgrade-proc-warning-list {
    list-style: none;
    margin: 0;
    padding: 6px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 12px;
}

.upgrade-proc-warning-list li {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: baseline;
}

.upgrade-proc-warning-code {
    font-family: 'Cascadia Mono', Consolas, monospace;
    font-size: 11px;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: 3px;
    padding: 1px 6px;
    color: var(--text-secondary);
}

.upgrade-proc-warning-line {
    font-size: 11px;
    color: var(--text-tertiary);
}

.upgrade-proc-warning-message {
    flex: 1 1 240px;
    color: var(--text-primary);
}

/* -- Editor --------------------------------------------------------------- */
/* Editor header matches the standard .pane-header (icon + "Editor" title), with the open files as
   compact pill tabs after the title - same chrome as Output/Data/Graphs, not a VS Code tab strip. */
.editor-header {
    gap: 8px;
    justify-content: flex-start;
    /* No bottom border on the editor header: the Chrome-style active tab needs
       to connect straight into the content below it. The .editor-tabs strip uses
       overflow-x:auto (which forces overflow-y to clip), so a tab can't extend
       down to paint over a header border-bottom - removing the border is the
       only way to stop the grey line slicing across the active tab's base. The
       header / content boundary is still delineated by the background colour
       change (sidebar header vs surface content). */
    border-bottom: none;
}

.editor-pane-title {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex: 0 0 auto;
    /* Match the Data / Graphs pane headers (the default .pane-header text style):
       uppercase + lighter (secondary) text, same size/weight/tracking. */
    text-transform: uppercase;
    letter-spacing: .6px;
    font-weight: 600;
    font-size: 11px;
    color: var(--text-secondary);
}
.editor-pane-title svg { opacity: .6; }

.editor-header .pane-header-actions {
    margin-left: auto;
}

/* Chrome-style tabs: rounded tops, growing up from the bottom of the header; the active tab is
   elevated to the content colour and visually connects to the editor below; inactive tabs are flat. */
.editor-tabs {
    display: flex;
    gap: 2px;
    flex: 0 1 auto;
    min-width: 0;
    align-self: stretch;
    align-items: flex-end;          /* tabs sit on the bottom edge, Chrome-style */
    padding-top: 5px;               /* breathing room above the rounded tab tops */
    padding-left: 10px;             /* start the tabs a little further right of the "Editor" title */
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
}

.editor-tabs::-webkit-scrollbar {
    display: none;
}

.editor-tab-add-host {
    position: relative;
    display: inline-flex;
    align-self: stretch;
    align-items: flex-end;
    flex: 0 0 auto;
    padding-top: 5px;
    margin-left: 2px;
    z-index: 6;
}

.editor-tab-add {
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 999px;
    background: transparent;
    color: var(--text-primary);
    cursor: pointer;
    margin-bottom: 4px;
    transition: background .12s, color .12s;
}

.editor-tab-add svg {
    display: block;
}

.editor-tab-add:hover,
.editor-tab-add:focus-visible,
.editor-tab-add[aria-expanded="true"] {
    background: #a8c7fa;
    color: #202124;
}

.editor-tab-add:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.editor-tab-add-menu {
    top: calc(100% + 2px);
    left: 50%;
    min-width: 132px;
    transform: translateX(-50%);
}

.editor-tab {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 30px;
    max-width: 200px;
    padding: 0 8px 0 12px;
    font-size: 12px;
    font-weight: 400;
    color: var(--text-secondary);
    cursor: pointer;
    background: transparent;
    border: none;
    border-radius: 10px 10px 0 0;    /* Chrome rounded top corners */
    text-transform: none;
    letter-spacing: 0;
    transition: background .12s, color .12s;
    white-space: nowrap;
    flex-shrink: 0;
}

.editor-tab:hover {
    color: var(--text-primary);
}

/* Background-tab hover (Chrome-style): a rounded "pill" highlight around the
   name + close icon rather than a flat full-tab shade. Excludes the active tab
   and the split-peer tab (those already have their own elevated background).
   The pill sits behind the label/close, which are lifted above it below. */
.editor-tab:not(.active):not(.split-peer):hover::before {
    content: "";
    position: absolute;
    inset: 4px 2px;
    background: var(--bg-hover);
    border-radius: 999px;
    pointer-events: none;
    z-index: 0;
}

/* Active tab: elevated to the content colour and connected to it below -
   margin-bottom bridges the header's bottom line so nothing cuts across the
   tab, and the ::before/::after "feet" flare the bottom corners smoothly into
   the bar (the classic Chrome tab shape). */
.editor-tab.active {
    color: var(--text-primary);
    background: var(--bg-surface);
    font-weight: 500;
    margin-bottom: -1px;
}

.editor-tab.active::before,
.editor-tab.active::after {
    content: "";
    position: absolute;
    bottom: 0;
    width: 10px;
    height: 10px;
    background: var(--bg-surface);
    pointer-events: none;
}

/* Each foot is the tab colour with a quarter-circle masked out, so the corner
   curves OUTWARD (concave) into the bar instead of ending square. */
.editor-tab.active::before {
    left: -10px;
    -webkit-mask-image: radial-gradient(circle at top left, #0000 0 10px, #000 10px);
            mask-image: radial-gradient(circle at top left, #0000 0 10px, #000 10px);
}

.editor-tab.active::after {
    right: -10px;
    -webkit-mask-image: radial-gradient(circle at top right, #0000 0 10px, #000 10px);
            mask-image: radial-gradient(circle at top right, #0000 0 10px, #000 10px);
}

/* The non-focused split pane's open tab: muted elevation (no feet - only the
   focused pane's active tab gets the full connected treatment), so both panes'
   current files stay visible in the one strip. */
.editor-tab.split-peer {
    color: var(--text-secondary);
    background: var(--bg-hover);
}

/* z-index lifts the label/close above the hover pill (::before, z-index:0). */
.tab-label {
    pointer-events: none;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;       /* truncate long file names, Chrome-style */
    position: relative;
    z-index: 1;
}

.tab-close {
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    color: var(--text-tertiary);
    opacity: 0;
    transition: opacity .1s, background .1s, color .1s;
    position: relative;
    z-index: 1;
    flex-shrink: 0;
}

.tab-close svg {
    display: block;
}

.editor-tab:hover .tab-close,
.editor-tab.active .tab-close {
    opacity: 1;
}

.tab-close:hover {
    background: var(--bg-active);
    color: var(--text-primary);
}

/* Command hover tooltip (Monaco): the command-name title is emitted as a
   markdown H3, which Monaco renders at ~1.17em (16px) with 8px margins - too
   large/heavy for a tooltip next to the 14px body. Bring it down to a compact
   title just above body size with tight spacing. */
.monaco-hover h1,
.monaco-hover h2,
.monaco-hover h3,
.monaco-hover h4 {
    font-size: 1.05em !important;
    font-weight: 700 !important;
    margin: 0 0 6px !important;
    line-height: 1.3 !important;
}

/* -- Split / side-by-side editor (one panel, content area splits) --------- */
/* The single editor panel keeps one header + tab strip; only its CONTENT area
   splits. The container holds the primary pane (which carries the persisted
   basis = the divider position) and, when split, a divider + the secondary pane
   (which fills the rest). Horizontal = side by side, vertical = stacked. When
   not split the single pane fills the content area exactly as before. */
.editor-content-split {
    display: flex;
    flex-direction: row;
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
}

.editor-content-split.split.vertical {
    flex-direction: column;
}

/* When split, float each pane as a card with the SAME gap on its left, right
   and bottom as the 5px divider gap between the panes. The top stays flush so
   the cards stay attached to the breadcrumb toolbar. Padding on the flex
   container (rather than margins on the panes) keeps the divider centred and
   works for both orientations; it also lifts the cards off the outer editor-
   panel border so the left/right edges are no longer a doubled line. */
.editor-content-split.split {
    box-sizing: border-box;
    padding: 0 5px 5px;
}

/* Each pane is the positioned ancestor the absolutely-filled .monaco-wrapper
   sizes against, so it needs position:relative and a definite flex size. */
.editor-monaco-pane {
    position: relative;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
}

/* Chrome-style split panes: each pane is a rounded card and the Monaco content
   (gutter, active-line highlight, scrollbars) is clipped to the rounded corners
   by the pane's overflow:hidden - no more square corners inside the border. */
.editor-content-split.split .editor-monaco-pane {
    border-radius: 6px;
}

/* A full border drawn as an overlay (::after, above the absolutely-filled
   Monaco, pointer-events:none) so each pane reads as a distinct rounded card.
   Neutral by default; the focused/selected pane lights up in accent - the same
   blue selection cue the single editor gets, on the actual focused pane. */
.editor-content-split.split .editor-monaco-pane::after {
    content: "";
    position: absolute;
    inset: 0;
    border: 1.5px solid var(--border-default);
    border-radius: 6px;
    pointer-events: none;
    z-index: 5;
}

.editor-content-split.split .editor-monaco-pane.focused::after {
    /* Match the 1.5px accent border a selected pane (graph/data/output) gets via
       .pane:focus-within, so the focused split pane reads identically. */
    border-color: var(--accent);
}

/* When split, the per-pane focus border above is the selection cue, so keep the
   OUTER panel border neutral rather than also lighting up on :focus-within. */
.pane:has(.editor-content-split.split):focus-within {
    border-color: var(--border-default);
}

/* In split mode each pane is its own rounded card with its own top border, so
   the breadcrumb bar's bottom border would (a) draw a line straight across the
   transparent gap between the panes and (b) double up with each pane's top
   border. Drop it - the cards' own borders define the top edge. */
.pane:has(.editor-content-split.split) .editor-breadcrumbs {
    border-bottom: none;
}

/* Divider: a thin draggable bar between the two panes. flex:0 0 5px +
   align-self:stretch gives a 5px bar perpendicular to the main axis in both
   orientations; only the cursor differs. Kept transparent to match the
   workbench's inter-panel Syncfusion split bars (also transparent) - the panes'
   own rounded-card borders provide the visual separation, so the gap reads as
   continuous with the gaps between the surrounding panels. The resize cursor is
   the affordance; there is no colour change on hover/drag, same as the panels. */
.editor-split-divider {
    flex: 0 0 5px;
    align-self: stretch;
    background: transparent;
    position: relative;
    z-index: 3;
}

.editor-content-split.horizontal > .editor-split-divider { cursor: ew-resize; }
.editor-content-split.vertical > .editor-split-divider { cursor: ns-resize; }

/* While dragging, suppress text selection and let the document-level pointer
   listeners own the gesture so Monaco doesn't capture the move. The cursor is
   set inline by the JS drag helper (orientation-dependent). */
body.shazam-split-dragging {
    user-select: none;
}

body.shazam-split-dragging * {
    pointer-events: none !important;
}

/* Active while a Syncfusion split bar is dragged (set by splitter-cursor.js).
   Suppresses the accent-coloured selection flash across panes during resize.
   Unlike .shazam-split-dragging it does NOT disable pointer-events, so
   Syncfusion's own resize handler keeps receiving the drag. */
body.shazam-splitter-resizing,
body.shazam-splitter-resizing * {
    -webkit-user-select: none !important;
    user-select: none !important;
}

/* Belt-and-braces: even if WKWebView still forms a selection mid-resize (user-select
   and selectstart cancellation are not a universal drag fix in WebKit), paint it
   transparent so the macOS accent-coloured highlight never shows. Scoped to the
   resize gesture, so normal selection elsewhere is unaffected. */
body.shazam-splitter-resizing ::selection { background: transparent !important; }
body.shazam-splitter-resizing ::-moz-selection { background: transparent !important; }

/* In-header split controls (rendered inside .pane-header-actions). */
.editor-split-orient {
    display: inline-flex;
    align-items: center;
    gap: 1px;
    margin: 0 2px;
    padding: 1px;
    border-radius: 5px;
    background: var(--bg-hover);
}

.split-orient-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 20px;
    padding: 0;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: background .12s, color .12s;
}

.split-orient-btn:hover {
    color: var(--text-primary);
    background: var(--bg-active);
}

.split-orient-btn.active {
    background: var(--bg-surface);
    color: var(--accent);
}

/* -- Editor breadcrumbs --------------------------------------------------- */
.editor-breadcrumbs {
    /* SC 1.4.4 / 1.4.12: min-height (not a fixed height) lets the bar grow when
       text is enlarged or re-spaced, so the breadcrumb path is never clipped. */
    min-height: 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 6px 0 12px;
    font-size: 12px;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-default);
    flex-shrink: 0;
    gap: 0;
    position: relative;
    overflow: hidden;
}

.breadcrumbs-path {
    display: flex;
    align-items: center;
    gap: 0;
    overflow: hidden;
    flex: 1;
    min-width: 0;
}

.editor-run-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
    margin-left: 8px;
}

/*
 * Legacy → modern syntax Upgrade / Modernize buttons. Text-labelled siblings
 * of .pane-maximize-btn: auto-width to fit the word, otherwise hover /
 * disabled / focus parity with the icon buttons they sit beside.
 *
 * They lead .editor-run-actions, so they land immediately to the LEFT of the
 * Run button and are laid out by that cluster's flex flow. They were formerly
 * absolutely centred in the breadcrumbs bar, which put them on a collision
 * course with the breadcrumb path: as soon as the workspace path was deep
 * enough to reach the middle of the bar, the two drew on top of each other.
 *
 * Styling: outlined button (visible background + border) rather than a
 * bare text link, so it reads unambiguously as a clickable affordance.
 */
.editor-upgrade-btn {
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 10px;
    background: #e7f1fb;
    color: #1565c0;
    border: 1px solid #90caf9;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    transition: background .1s, border-color .1s, color .1s, opacity .1s;
}

.editor-upgrade-btn:hover {
    background: #cce4ff;
    border-color: #1565c0;
}

.editor-upgrade-btn:disabled {
    opacity: .5;
    cursor: default;
    background: var(--bg-surface);
    color: var(--text-secondary);
    border-color: var(--border-default);
}

.editor-upgrade-btn:disabled:hover {
    background: var(--bg-surface);
    border-color: var(--border-default);
}

.breadcrumb-item {
    color: var(--text-secondary);
    padding: 2px 4px;
    border-radius: 3px;
    cursor: pointer;
    white-space: nowrap;
}

.breadcrumb-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.breadcrumb-item.current {
    color: var(--text-primary);
}

.breadcrumb-sep {
    color: var(--text-tertiary);
    font-size: 14px;
    padding: 0 2px;
    pointer-events: none;
}

.editor-content {
    padding: 0;
    overflow: hidden;
    position: relative;
}

.monaco-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

/* Command-editor layout only. Cells need auto height (managed by
   shazamNotebookCellMonacoAttach / Relayout) so they grow to fit the
   line count; forcing height: 100% there collapses the editor to 0
   inside an auto-height parent. Keyed off .editor-content (the command
   editor's pane wrapper) so the rule never applies to .notebook-cell-monaco. */
.editor-content .shazam-monaco {
    height: 100% !important;
    width: 100% !important;
}

.shazam-monaco .view-overlays .current-line {
    border: none !important;
}

.run-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-size: 12px;
    font-weight: 400;
    cursor: pointer;
    border-radius: 3px;
    font-family: var(--font-ui);
    text-transform: none;
    letter-spacing: 0;
    transition: background .12s, color .12s, opacity .12s;
}

.run-btn:hover {
    background: var(--bg-hover);
}

.run-btn:disabled {
    opacity: .35;
    cursor: default;
}

.run-btn:disabled:hover {
    background: transparent;
}

.run-btn.primary svg {
    color: #1a7f2b;
}

.run-btn.run-stop svg {
    color: #c62828;
}

/* -- Debug / breakpoint visuals ----------------------------------------- */
/* Class names are coordinated with shazam-debug.js Monaco decoration options:
     .breakpoint-glyph     -> glyphMarginClassName for breakpoint dots
     .debug-current-line   -> className (whole-line) for the paused line
     .debug-arrow-glyph    -> glyphMarginClassName for the instruction pointer
   Light/dark theming uses the [data-theme="..."] pattern from the top of this
   file. Defaults below are tuned for light themes; dark themes override the
   --shz-debug-* custom properties further down. */

.shazam-monaco {
    --shz-debug-line-bg:        rgba(255, 238, 98, 0.35);
    --shz-debug-line-edge:      #f5c518;
    --shz-debug-glyph-hint-bg:  rgba(0, 0, 0, 0.18);
}

[data-theme="dark"] .shazam-monaco,
[data-theme="high-contrast-dark"] .shazam-monaco,
[data-theme="nord"] .shazam-monaco,
[data-theme="solarized-dark"] .shazam-monaco,
[data-theme="abyss"] .shazam-monaco {
    --shz-debug-line-bg:        rgba(255, 200, 0, 0.15);
    --shz-debug-line-edge:      #ffcc00;
    --shz-debug-glyph-hint-bg:  rgba(255, 255, 255, 0.22);
}

/* Solid red dot, centered in the glyph margin column. */
.shazam-monaco .breakpoint-glyph {
    position: relative;
}

.shazam-monaco .breakpoint-glyph::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 12px;
    height: 12px;
    margin: -6px 0 0 -6px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #ff5a4d 0%, #e51400 60%, #a80f00 100%);
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.18);
    pointer-events: none;
    z-index: 1;
}

/* Whole-line background highlight for the paused execution line. The inset
   left edge mimics VS / VS Code's gold marker so it stays distinguishable
   from the normal cursor-line highlight which is suppressed above. */
.shazam-monaco .debug-current-line {
    background: var(--shz-debug-line-bg) !important;
    box-shadow: inset 2px 0 0 0 var(--shz-debug-line-edge);
}

/* Gold right-pointing instruction-pointer arrow built with the CSS triangle
   trick. z-index 2 ensures it overlays a co-located .breakpoint-glyph. */
.shazam-monaco .debug-arrow-glyph {
    position: relative;
}

.shazam-monaco .debug-arrow-glyph::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    margin-top: -6px;
    margin-left: -3px;
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
    border-left: 10px solid #f5c518;
    filter: drop-shadow(0 0 1px rgba(0, 0, 0, 0.45));
    pointer-events: none;
    z-index: 2;
}

/* Faint grey circle hint shown when hovering a line in Monaco's glyph
   margin gutter, matching VS Code's discoverable breakpoint affordance.
   Each line in the glyph margin is a position-absolute div under
   .margin-view-overlays (Monaco's own layout - DO NOT override with
   `position: relative`; doing so collapses the absolutely-positioned
   rows into normal flow and the line-number column drifts out of sync
   with the editor content). The hover-hint pseudo-element below is
   itself absolutely positioned and resolves against Monaco's existing
   `position: absolute` rows as its containing block, so no override is
   needed.

   The .shz-debug-enabled marker class is set on the editor's wrapper
   div by CommandEditor / NotebookCellCodeEditor only when debugging is
   on and the file's syntax mode supports it; without it, the hint
   would also appear next to line numbers even when there's no glyph
   margin to actually click in (because Monaco's .margin-view-overlays
   contains the line-number rows too). Keeping the hint gated keeps
   the gutter visually quiet when debugging is disabled. */
.shz-debug-enabled .shazam-monaco .margin-view-overlays > div:hover::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 6px;
    width: 12px;
    height: 12px;
    margin-top: -6px;
    border-radius: 50%;
    background: var(--shz-debug-glyph-hint-bg);
    opacity: 0.55;
    pointer-events: none;
    z-index: 0;
}

/* Don't show the hover hint on lines that already carry a real breakpoint
   or the instruction-pointer arrow. */
.shz-debug-enabled .shazam-monaco .margin-view-overlays > div:hover:has(.breakpoint-glyph)::before,
.shz-debug-enabled .shazam-monaco .margin-view-overlays > div:hover:has(.debug-arrow-glyph)::before {
    display: none;
}

/* Compact "Paused at line N" pill shown in the editor / notebook toolbar
   while a debug session is suspended. Sits to the left of Run/Stop. */
.debug-paused-indicator {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    margin-right: 6px;
    border-radius: 10px;
    background: rgba(245, 197, 24, 0.18);
    color: #8a6d00;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
    user-select: none;
}

.debug-paused-indicator svg {
    flex-shrink: 0;
}

[data-theme="dark"] .debug-paused-indicator,
[data-theme="high-contrast-dark"] .debug-paused-indicator,
[data-theme="nord"] .debug-paused-indicator,
[data-theme="solarized-dark"] .debug-paused-indicator,
[data-theme="abyss"] .debug-paused-indicator {
    background: rgba(245, 197, 24, 0.22);
    color: #ffd966;
}

/* One-shot line highlight shown when a breakpoint click on a non-statement
   line (blank, comment, brace-only) gets snapped forward to the next
   executable line - visually communicates "your dot landed here, not where
   you clicked" so the snap doesn't feel like a glitch. */
.shazam-monaco .breakpoint-snap-flash {
    animation: shz-bp-snap-flash 700ms ease-out;
}

@keyframes shz-bp-snap-flash {
    0%, 25% { background-color: rgba(229, 20, 0, 0.28); }
    100%    { background-color: transparent; }
}

/* -- Data grid ------------------------------------------------------------ */
.data-info {
    font-size: 11px;
    color: var(--text-tertiary);
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
}

/* -- Graph pane ----------------------------------------------------------- */
.graph-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 12px;
    background: var(--bg-sidebar);
}

.graph-canvas {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 0;
}

.graph-canvas svg {
    max-width: 100%;
    max-height: 100%;
}

.graph-counter {
    font-size: 11px;
    color: var(--text-tertiary);
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
    padding: 0 6px;
}

.graph-nav-btn {
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 2px 6px;
    font-size: 14px;
    border-radius: 3px;
    font-family: var(--font-ui);
    transition: background .12s;
}

.graph-nav-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* -- Plotly chart containers ---------------------------------------------- */
.plotly-graph-content {
    padding: 0;
    background: var(--bg-surface);
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
}

.plotly-main-chart {
    flex: 1;
    min-height: 0;
    position: relative;
}

.plotly-chart-container {
    width: 100%;
    height: 100%;
    min-height: 200px;
}

.plotly-chart-container .js-plotly-plot {
    width: 100% !important;
    height: 100% !important;
}

.scottplot-chart-container svg {
    max-width: 100%;
    height: auto;
    display: block;
}

.thumb-label {
    font-family: var(--font-ui-small);
    font-size: 10px;
    font-weight: 700;
    color: var(--text-secondary);
}

.graph-thumb.selected .thumb-label {
    color: var(--accent);
}

.graph-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 4px 0 2px;
    font-size: 11px;
    color: var(--text-secondary);
    gap: 1px;
    flex-shrink: 0;
}

.graph-title {
    font-weight: 600;
    color: var(--text-primary);
}

/* -- Graph thumbnail strip ------------------------------------------------ */
.graph-thumbnails {
    display: flex;
    gap: 6px;
    padding: 6px 8px;
    overflow-x: auto;
    overflow-y: hidden;
    background: var(--bg-sidebar);
    border-top: 1px solid var(--border-default);
    flex-shrink: 0;
    align-items: center;
}

.graph-thumb {
    width: 80px;
    height: 58px;
    flex-shrink: 0;
    border: 2px solid var(--border-default);
    border-radius: 4px;
    background-color: var(--bg-surface);
    background-repeat: no-repeat;
    background-size: cover;
    background-position: center;
    cursor: pointer;
    padding: 0;
    transition: border-color .12s, box-shadow .12s;
    overflow: hidden;
    position: relative;
}

.graph-thumb:hover {
    border-color: var(--text-tertiary);
}

.graph-thumb.selected {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent);
}

.graph-thumb-title {
    display: none;
}

.thumb-canvas {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.thumb-canvas svg {
    width: 100%;
    height: 100%;
}

/* -- Data editor and thumbnail differentiation ----------------------------- */

/* When the pane-content hosts the spreadsheet editor, use flexbox so the
   container always fills the available space and resizes with the splitter. */
.pane-content:has(.data-editor-container) {
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.data-editor-container {
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* Force the SfSpreadsheet and its internal panels to fill the container,
   overriding any inline pixel dimensions set by Syncfusion JS. The outer
   `.e-spreadsheet` is made a flex column so its children - ribbon /
   formula bar / main grid / sheet-tab strip - get their natural vertical
   share. The main grid takes `flex: 1` so it stretches; the sheet-tab
   strip at the bottom keeps its natural height instead of being clipped
   off the pane (the earlier `height: 100% !important` rules on the main
   panel ate that space). */
.data-editor-container > .data-editor-activity > .e-control.e-spreadsheet {
    width: 100% !important;
    height: 100% !important;
    display: flex !important;
    flex-direction: column !important;
}

.data-editor-container .e-spreadsheet .e-main-panel {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    height: auto !important;
}

.data-editor-container .e-spreadsheet .e-sheet-panel {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    height: auto !important;
}

.data-editor-container .e-spreadsheet .e-spreadsheet-content {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    height: auto !important;
}

/* Defence-in-depth: the sheet-tab strip Syncfusion injects at the bottom
   must keep its natural height (it has none of `flex-grow`) and must not
   be hidden by a stale `display: none`. Some Syncfusion themes set it
   to `flex: 0 0 auto` already; this rule pins it for our overrides. */
.data-editor-container .e-spreadsheet .e-sheet-tab,
.data-editor-container .e-spreadsheet .e-sheet-tab-panel {
    flex: 0 0 auto !important;
    display: flex !important;
}

.shazam-spreadsheet {
    border: none !important;
}

/* Hide the ribbon tab headers (File, HOME, INSERT, FORMULAS, REVIEW, VIEW)
   but keep the Home tab toolbar content visible as a persistent button bar. */
.shazam-spreadsheet .e-tab-header,
.shazam-spreadsheet .e-ribbon .e-tab-header {
    display: none !important;
}

/* Hide the File menu button */
.shazam-spreadsheet .e-ribbon .e-file-menu,
.shazam-spreadsheet .e-ribbon .e-ribbon-file-menu {
    display: none !important;
}

/* The spreadsheet ribbon folds groups into "..." drop-downs whenever its content row is narrower
   than the groups it holds. Sized to its content, the row is never narrower, so every button stays
   in place and the strip scrolls sideways in a narrow pane. The row's own minimum overrides the
   theme's calc(100% - 60px), which holds back room for the overflow button. */
.shazam-spreadsheet .e-spreadsheet-ribbon {
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
}

/* Collapsed, the strip can be shorter than the expand chevron it holds, so nothing may clip it. */
.shazam-spreadsheet .e-spreadsheet-ribbon:not(.e-expanded) {
    overflow: visible;
}

.shazam-spreadsheet .e-spreadsheet-ribbon > .e-ribbon {
    width: max-content !important;
    min-width: 100%;
}

/* The right padding keeps the last group clear of the collapse chevron below. */
.shazam-spreadsheet .e-spreadsheet-ribbon > .e-ribbon .e-ribbon-tab > .e-content {
    min-width: max-content;
    padding-right: 23px;
}

/* The collapse chevron stays at the strip's visible right edge while the groups scroll under it,
   opaque so they do not show through. */
.shazam-spreadsheet .e-spreadsheet-ribbon.e-expanded .e-ribbon-help-template {
    position: sticky;
    left: auto;
    right: 0;
    width: fit-content;
    height: 44px;
    margin-left: auto;
    margin-bottom: -44px;
    background: var(--bg-surface, #ffffff);
    border-left: 1px solid var(--border-subtle, #ebebeb);
}

/* The chevron points the way it will move the toolbar, as the formula bar's does. The theme's own
   flip keys off an e-collapsed class this spreadsheet never sets; it marks the state with e-expanded. */
.shazam-spreadsheet .e-spreadsheet-ribbon.e-expanded .e-drop-icon {
    transform: rotate(180deg);
}

/* Undo and Redo show their icons only; the tooltip and the accessible name still carry the label. */
.shazam-spreadsheet .e-spreadsheet-ribbon #undoButton,
.shazam-spreadsheet .e-spreadsheet-ribbon #redoButton {
    font-size: 0;
}

.shazam-spreadsheet .e-spreadsheet-ribbon #undoButton .e-btn-icon,
.shazam-spreadsheet .e-spreadsheet-ribbon #redoButton .e-btn-icon {
    margin: 0;
}

/* SHAZAM-compat: suppress cell number formats that have no SHAZAM analogue
   and would silently corrupt or mislead when the workbook is read back through
   `cell.Number` / `LoadMatrixFromFile`.

     - Currency / Accounting: numeric but currency symbol is meaningless.
     - Percentage: typing "50%" stores 0.5, so SHAZAM reads 0.5 instead of 50.
     - Fraction: no SHAZAM concept.
     - ShortDate / LongDate / Time: cell stores Excel date serial (e.g.
         2020-01-15 -> 43845), which SHAZAM reads literally and silently wrong.

   These dropdowns are portalled to <body>, so we cannot scope via the
   `.shazam-spreadsheet` ancestor. We rely on the stable `e-numformat-{type}`
   icon classes Syncfusion attaches to each item in the Number Format
   DropDownButton. Save-time scrub in DataEditorPane.AutoSaveAsync provides
   defence-in-depth if the DOM shape changes. */
.e-dropdown-popup li:has(.e-numformat-currency),
.e-dropdown-popup li:has(.e-numformat-accounting),
.e-dropdown-popup li:has(.e-numformat-percentage),
.e-dropdown-popup li:has(.e-numformat-fraction),
.e-dropdown-popup li:has(.e-numformat-shortdate),
.e-dropdown-popup li:has(.e-numformat-longdate),
.e-dropdown-popup li:has(.e-numformat-time),
.e-dropdown-popup li:has(.e-numformat-customformat),
.e-dropdown-popup li:has(.e-numformat-moreformats) {
    display: none !important;
}

/* Belt-and-braces: also match by the auto-generated item id suffix
   ({spreadsheetId}_Currency, etc.) in case the icon span is absent. */
.e-dropdown-popup li[id$="_Currency"],
.e-dropdown-popup li[id$="_Accounting"],
.e-dropdown-popup li[id$="_Percentage"],
.e-dropdown-popup li[id$="_Fraction"],
.e-dropdown-popup li[id$="_ShortDate"],
.e-dropdown-popup li[id$="_LongDate"],
.e-dropdown-popup li[id$="_Time"],
.e-dropdown-popup li[id$="_CustomFormat"],
.e-dropdown-popup li[id$="_MoreFormats"] {
    display: none !important;
}

/* -- Matrix toolbar (above SfSpreadsheet in matrix mode) ---------------- */
.matrix-toolbar {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    background: var(--bg-sidebar);
    border-bottom: 1px solid var(--border-default);
    font-family: var(--font-ui-small);
    font-size: 12px;
    user-select: none;
    overflow: visible;
    position: relative;
    z-index: 5;
}
.matrix-toolbar-group {
    position: relative;
    display: inline-block;
}
.matrix-toolbar-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 3px;
    color: var(--text-primary);
    cursor: pointer;
    white-space: nowrap;
    font: inherit;
}
.matrix-toolbar-btn:hover {
    background: var(--bg-hover);
    border-color: var(--border-default);
}
.matrix-toolbar-btn.active {
    background: var(--bg-active);
    border-color: var(--border-default);
    color: var(--text-primary);
}
.matrix-toolbar-btn .caret {
    opacity: 0.6;
}
.matrix-toolbar-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 24px;
    padding: 0;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 3px;
    color: var(--text-primary);
    cursor: pointer;
}
.matrix-toolbar-icon:hover {
    background: var(--bg-hover);
    border-color: var(--border-default);
}
.matrix-toolbar-icon-danger:hover {
    background: rgba(198, 40, 40, 0.10);
    border-color: rgba(198, 40, 40, 0.45);
}
.matrix-toolbar-icon-success:hover {
    background: rgba(46, 125, 50, 0.10);
    border-color: rgba(46, 125, 50, 0.45);
}
.matrix-toolbar-sep-vertical {
    display: inline-block;
    width: 1px;
    height: 18px;
    background: var(--border-default);
    margin: 0 4px;
}
.matrix-toolbar-status {
    margin-left: auto;
    color: var(--text-secondary);
    font-size: 11px;
    padding-right: 4px;
}
.matrix-toolbar-menu {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 2px;
    min-width: 220px;
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    padding: 4px 0;
    z-index: 1000;
}
.matrix-toolbar-item {
    display: block;
    width: 100%;
    text-align: left;
    padding: 4px 12px;
    border: none;
    background: transparent;
    color: var(--text-primary);
    cursor: pointer;
    font: inherit;
    white-space: nowrap;
}
.matrix-toolbar-item:hover {
    background: var(--accent-subtle);
    color: var(--text-primary);
}
.matrix-toolbar-sep {
    height: 1px;
    background: var(--border-default);
    margin: 4px 0;
}
.matrix-toolbar-section-label {
    padding: 4px 12px 2px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
}

/* -- Matrix toolbar flyout submenus ------------------------------------ */
/* A .matrix-toolbar-flyout wraps a parent item plus its submenu. The submenu is
   hidden by default and appears on hover, anchored to the right edge of the
   parent. Used inside .matrix-toolbar-menu to keep long menus compact. */
.matrix-toolbar-flyout {
    position: relative;
}
.matrix-toolbar-flyout-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    text-align: left;
    padding: 4px 8px 4px 12px;
    border: none;
    background: transparent;
    color: var(--text-primary);
    cursor: pointer;
    font: inherit;
    white-space: nowrap;
}
.matrix-toolbar-flyout:hover > .matrix-toolbar-flyout-toggle,
.matrix-toolbar-flyout-toggle:hover {
    background: var(--accent-soft, rgba(21, 101, 192, 0.10));
}
.matrix-toolbar-flyout-toggle .caret-right {
    margin-left: 6px;
    opacity: 0.6;
}
.matrix-toolbar-flyout > .matrix-toolbar-submenu {
    display: none;
    position: absolute;
    top: -4px;
    left: 100%;
    min-width: 220px;
    background: var(--surface-1, #fff);
    border: 1px solid var(--border-strong, #c0c0c0);
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    padding: 4px 0;
    z-index: 1001;
}
.matrix-toolbar-flyout:hover > .matrix-toolbar-submenu {
    display: block;
}

/* -- Matrix editor (HTML table-based, always-editable) ----------------- */
/* The matrix editor is a plain HTML table where every cell is an <input>. The
   matrix-toolbar sits above and the table fills the rest of the pane. The bracket
   pseudo-elements on .shazam-matrix-bracket draw the math-style [ ... ] frame. */
.matrix-editor-scroll {
    width: 100%;
    height: 100%;
    overflow: auto;
    background: var(--surface-1, #fff);
    /* SC 2.4.11 Focus Not Obscured: keep a tabbed-to cell clear of the sticky
       column header (24px) and sticky row header (24px) when scrolled into view. */
    scroll-padding-top: 26px;
    scroll-padding-left: 26px;
}
.matrix-editor-table {
    border-collapse: separate;
    border-spacing: 0;
    font-family: var(--font-mono, "Cascadia Mono", monospace);
    font-size: 12px;
    color: var(--text-primary, inherit);
}
.matrix-editor-table th,
.matrix-editor-table td {
    margin: 0;
    padding: 0;
    border-right: 1px solid var(--border-strong, #e0e0e0);
    border-bottom: 1px solid var(--border-strong, #e0e0e0);
    background: var(--surface-1, #fff);
}
.matrix-editor-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    height: 24px;
    min-width: 72px;
    text-align: center;
    font-weight: 600;
    background: var(--surface-2, #f5f5f5);
    color: var(--text-secondary, inherit);
    font-variant-numeric: tabular-nums;
    border-top: 1px solid var(--border-strong, #e0e0e0);
}
.matrix-editor-table th.matrix-editor-rowhead {
    position: sticky;
    left: 0;
    z-index: 1;
    width: 24px;
    min-width: 24px;
    max-width: 24px;
    height: 24px;
    text-align: center;
    font-weight: 600;
    background: var(--surface-2, #f5f5f5);
    color: var(--text-secondary, inherit);
    font-variant-numeric: tabular-nums;
}
.matrix-editor-table th.matrix-editor-corner {
    position: sticky;
    top: 0;
    left: 0;
    z-index: 3;
    width: 24px;
    min-width: 24px;
    max-width: 24px;
    background: var(--surface-2, #f5f5f5);
    border-left: 1px solid var(--border-strong, #e0e0e0);
}
.matrix-editor-table thead th:first-child + th { border-left: 1px solid var(--border-strong, #e0e0e0); }
.matrix-editor-cell {
    height: 24px;
    min-width: 72px;
    padding: 0;
}
.matrix-editor-input {
    box-sizing: border-box;
    width: 100%;
    height: 100%;
    min-width: 72px;
    padding: 0 6px;
    border: none;
    outline: none;
    background: transparent;
    color: inherit;
    font: inherit;
    font-variant-numeric: tabular-nums;
    text-align: right;
}
.matrix-editor-input:focus {
    background: var(--accent-soft, rgba(21, 101, 192, 0.10));
    box-shadow: inset 0 0 0 2px var(--accent, #1565c0);
}


.data-thumb-viewer,
.data-thumb-editor,
.data-thumb-matrix,
.data-thumb-large {
    position: relative;
}

.data-thumb-viewer { border-top: 3px solid var(--text-tertiary); }
.data-thumb-editor { border-top: 3px solid var(--accent); }
.data-thumb-matrix { border-top: 3px solid var(--accent); }
.data-thumb-large { border-top: 3px solid var(--warning-fg); }

/* -- New matrix dialog -------------------------------------------------- */
.new-matrix-dialog .nmd-field { margin-bottom: 12px; display: flex; flex-direction: column; }
.new-matrix-dialog .nmd-field-row { display: flex; gap: 12px; }
.new-matrix-dialog .nmd-field-half { flex: 1; }
.new-matrix-dialog .nmd-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.new-matrix-dialog .nmd-input {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid var(--border-strong, #c0c0c0);
    border-radius: 4px;
    font-size: 13px;
    background: var(--surface-input, #fff);
    color: var(--text-primary, inherit);
    box-sizing: border-box;
}
.new-matrix-dialog .nmd-input:focus {
    outline: none;
    border-color: var(--accent, #1565c0);
    box-shadow: 0 0 0 2px var(--accent-soft, rgba(21, 101, 192, 0.18));
}
.new-matrix-dialog .nmd-input-error {
    border-color: var(--danger-fg, #c62828);
}
.new-matrix-dialog .nmd-error {
    color: var(--danger-fg, #c62828);
    font-size: 12px;
    margin-top: 4px;
}
.new-matrix-dialog .nmd-radio-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.new-matrix-dialog .nmd-radio {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-primary, inherit);
    cursor: pointer;
}

.data-thumb-viewer .thumb-icon,
.data-thumb-editor .thumb-icon,
.data-thumb-matrix .thumb-icon,
.data-thumb-large .thumb-icon {
    position: absolute;
    inset: 3px;
    width: calc(100% - 6px);
    height: calc(100% - 6px);
    opacity: 0.7;
}

.data-thumb-viewer .thumb-label,
.data-thumb-editor .thumb-label,
.data-thumb-matrix .thumb-label,
.data-thumb-large .thumb-label {
    position: relative;
    z-index: 1;
}

.thumb-sublabel {
    position: relative;
    z-index: 1;
    font-family: var(--font-ui-small);
    font-size: 8px;
    color: var(--text-tertiary);
    line-height: 1;
}

.dirty-dot {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--warning-fg);
}

.large-file-banner {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: rgba(230, 126, 34, 0.08);
    border-bottom: 1px solid rgba(230, 126, 34, 0.2);
    font-family: var(--font-ui-small);
    font-size: 11px;
    color: var(--warning-fg);
    flex-shrink: 0;
}

.large-file-open-anyway {
    margin-left: auto;
    background: none;
    border: 1px solid var(--warning-fg);
    color: var(--warning-fg);
    border-radius: 3px;
    padding: 1px 8px;
    font-size: 10px;
    cursor: pointer;
    font-family: var(--font-ui-small);
    transition: background 0.15s, color 0.15s;
}

.large-file-open-anyway:hover {
    background: var(--warning-fg);
    color: white;
}

/* -- Output pane ---------------------------------------------------------- */
.output-pane-title {
    /* Match the Data / Graphs pane headers: uppercase + lighter (secondary) text. */
    text-transform: uppercase;
    letter-spacing: .6px;
    font-weight: 600;
    font-size: 11px;
    color: var(--text-secondary);
}

.output-autosave-badge {
    font-family: var(--font-ui-small);
    font-size: 9px;
    padding: 1px 6px;
    border-radius: 3px;
    background: var(--bg-hover);
    color: var(--text-tertiary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .3px;
}

.output-content {
    font-family: var(--font-mono);
    font-size: 12.5px;
    padding: 8px 14px;
    line-height: 1.55;
    background: var(--bg-surface);
    /* Wide, pre-formatted tables overflow horizontally; the pane already
       scrolls on both axes (.pane-content: overflow auto). Contain the scroll
       so a vertical trackpad gesture doesn't rubber-band sideways (the macOS
       "wobble") or chain to the parent - both axes stay independently auto. */
    overscroll-behavior: contain;
    /* A block child of a horizontal scroller is as wide as the VISIBLE area, so
       every background, border and outline it paints stops at the fold while the
       nowrap tables carry on past it. One grid column sizes the track to the
       widest row instead and stretches every block to it: the max-content
       minimum is the widest row, and the 1fr maximum grows a narrow track back
       out to the full pane. (minmax(100%, max-content) does NOT work - a track
       whose base size already fills the container has no free space left to
       grow into its max-content limit.) align-content: start keeps rows at their
       natural height, which grid would otherwise spread down the pane.
       container-type lets wrapping prose cap itself at the visible width with
       100cqi so it never widens the track; the reserved scrollbar gutter is what
       makes 100cqi exactly that width whether or not the pane scrolls. */
    display: grid;
    grid-template-columns: minmax(max-content, 1fr);
    align-content: start;
    container-type: inline-size;
    scrollbar-gutter: stable;
    /* The widest a wrapping block may be without widening the track: the visible
       content width, less whatever chrome the block it sits in adds around it. */
    --output-fold: 100cqi;
}

/* Prose wraps rather than overflowing, so its unwrapped max-content length must
   not size the track. Capping at the fold keeps it wrapping where it does now.
   Pre-formatted lines are capped for the same reason; tables and metric blocks
   are deliberately left free to widen the track, because they are the content
   the shading has to reach. */
.output-text-line,
.output-warning-text,
.output-error-text,
.output-note-text,
.output-connection-status {
    max-width: var(--output-fold, 100cqi);
}

.output-element {
    margin-bottom: 1px;
}

.output-header-text {
    font-weight: 700;
    color: var(--accent);
    padding: 8px 0 3px;
    border-bottom: 1px solid var(--border-subtle);
    margin-bottom: 4px;
    font-size: 12.5px;
}

.output-table {
    margin: 0;
    white-space: pre;
    font-size: 12px;
    line-height: 1.55;
    color: var(--text-primary);
    font-family: inherit;
}

.output-warning-text {
    color: var(--warning-fg);
    font-weight: 500;
}

.output-stat-text {
    color: var(--text-primary);
}

.output-command {
    color: var(--text-tertiary);
}

.empty-tab-message {
    padding: 24px 14px;
    color: var(--text-tertiary);
    font-size: 13px;
    font-family: var(--font-ui);
}

.history-items {
    font-family: var(--font-mono);
    font-size: 12px;
}

.history-item {
    display: flex;
    gap: 12px;
    padding: 4px 14px;
    border-bottom: 1px solid var(--border-subtle);
}

.history-item:hover {
    background: var(--bg-hover);
}

.history-time {
    color: var(--text-tertiary);
    min-width: 60px;
}

.history-cmd {
    color: var(--text-primary);
}

/* -- Bottom panel tabs ---------------------------------------------------- */
.bottom-panel-tabs {
    display: flex;
    gap: 0;
    height: 35px;
    align-items: stretch;
}

/* -- Variables table ------------------------------------------------------ */
.variables-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    /* Fixed layout so a long variable name ellipsises inside its own column instead of widening
       the table and pushing Type / Size / Value out of the pane. The --var-*-col properties are
       what the header dividers write while they are dragged. */
    table-layout: fixed;
    /* Value takes whatever is left, but never less than its floor: at the default 300px panel the
       three fixed columns used to consume the whole width, leaving Value 15px - so its content was
       unreadable and its header painted past the table's right edge as a white strip. Below the
       floor the pane scrolls sideways instead of squeezing the column. */
    min-width: calc(var(--var-name-col, 130px) + var(--var-type-col, 62px)
                  + var(--var-size-col, 44px) + var(--var-value-floor, 160px));
}

.variables-table col.var-col-name  { width: var(--var-name-col, 130px); }
.variables-table col.var-col-type  { width: var(--var-type-col, 62px); }
.variables-table col.var-col-size  { width: var(--var-size-col, 44px); }
/* SC 2.4.11 Focus Not Obscured: the sticky column header sits at the top of the
   scroll area, so offset a focused row control (expand toggle, link) below it. */
.variables-table [tabindex="0"],
.variables-table a,
.variables-table button {
    scroll-margin-top: 34px;
}

.variables-table th {
    position: relative;
    background: var(--bg-sidebar);
    padding: 6px 8px;
    /* A header label never paints outside its own cell: with nothing behind it, an overflowing
       label showed as a white strip over the scrolled-away part of the table. */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-default);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .4px;
    position: sticky;
    top: 0;
    z-index: 1;
}

.variables-table td {
    padding: 4px 8px;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-primary);
}

.variables-table tr:hover td {
    background: var(--bg-hover);
}

.var-name {
    font-family: var(--font-mono);
    font-weight: 600;
    color: var(--accent) !important;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* The divider between two header cells. It sits inside its own cell rather than overhanging, so
   the header's overflow clip cannot eat the grab area, and its line is drawn at rest: a divider
   nobody can see is a resize affordance nobody finds. */
.var-col-resizer {
    position: absolute;
    top: 0;
    right: 0;
    width: 7px;
    height: 100%;
    cursor: col-resize;
    touch-action: none;
    user-select: none;
    z-index: 2;
}

.var-col-resizer::after {
    content: "";
    position: absolute;
    right: 0;
    top: 4px;
    bottom: 4px;
    width: 1px;
    background: var(--border-default);
}

.var-col-resizer:hover::after,
.var-col-resizer:focus-visible::after {
    background: var(--accent);
    width: 2px;
}

.var-type {
    color: var(--text-tertiary) !important;
    font-size: 11px;
}

.var-value {
    font-family: var(--font-mono);
    font-size: 11px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.var-size {
    text-align: right;
    color: var(--text-tertiary) !important;
    font-size: 11px;
}

.var-name-temp {
    color: var(--text-tertiary) !important;
    font-weight: 500;
}

.var-section-header {
    cursor: pointer;
    user-select: none;
}

.var-section-header td {
    padding: 5px 8px !important;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--bg-sidebar);
    border-bottom: 1px solid var(--border-default);
    letter-spacing: .3px;
}

.var-section-header:hover td {
    background: var(--bg-hover) !important;
}

.var-section-toggle {
    display: inline-block;
    width: 12px;
    font-size: 10px;
    color: var(--text-tertiary);
}

.var-section-count {
    float: right;
    font-weight: 400;
    color: var(--text-tertiary);
    font-size: 11px;
}

/* Inline expand chevron next to a result-object's name. Tighter and
   muted compared with the section-level toggle; clicking it is what
   reveals the indented child rows for the result object's properties. */
.var-expand-toggle {
    display: inline-block;
    width: 12px;
    margin-right: 2px;
    font-size: 9px;
    color: var(--text-tertiary);
    cursor: pointer;
    user-select: none;
}

.var-expand-toggle:hover {
    color: var(--text-primary);
}

/* Indented child row shown when a result-object is expanded - one row
   per scalar / vector / matrix property of the result. The leading
   gutter on the name column gives a clear visual hierarchy without
   needing a tree control. */
.var-result-property td {
    background: var(--bg-subtle, rgba(0, 0, 0, 0.02));
    font-size: 11px;
}

.var-name-property {
    padding-left: 28px !important;
    color: var(--text-secondary);
    font-style: italic;
}

[data-theme="dark"] .var-result-property td,
[data-theme="high-contrast-dark"] .var-result-property td,
[data-theme="nord"] .var-result-property td,
[data-theme="solarized-dark"] .var-result-property td,
[data-theme="abyss"] .var-result-property td {
    background: rgba(255, 255, 255, 0.04);
}

/* -- AI panel ------------------------------------------------------------- */
.ai-panel {
    background: var(--bg-page);
    overflow: hidden;
    /* AI panel is hosted inside the right-dock chrome, which already provides
       a containing border. The inherited `.pane` border (and its focus-within
       accent) added a redundant inner ring around the session area. */
    border: none;
}

.ai-panel:focus {
    outline: none;
}

.ai-panel:focus-within {
    /* Override `.pane:focus-within { border-color: var(--accent) }`. */
    border-color: transparent;
}

.ai-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 35px;
    min-height: 35px;
    padding: 0 4px 0 0;
    background: var(--bg-sidebar);
    border-bottom: 1px solid var(--border-default);
    flex-shrink: 0;
}

/* Wrapper around the tab strip that holds the left/right chevron
   arrows alongside the scroller. Flex so the scroller takes whatever
   width is left after the arrows. */
.ai-session-tabs-wrap {
    position: relative;
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: stretch;
    height: 35px;
}

.ai-session-selector {
    display: flex;
    align-items: stretch;
    height: 35px;
    overflow-x: auto;
    overflow-y: hidden;
    gap: 0;
    flex: 1;
    min-width: 0;
    /* Hide the OS-native horizontal scrollbar. The earlier design
       used overflow-x:auto which on Windows / WebView produced a
       30 px thumb that overlapped the bottom of the last visible
       tab - looked like a broken UI. Arrow buttons (.ai-session-tab-
       arrow) replace it. Firefox + WebKit + Edge all support these
       hide-scrollbar incantations. */
    scrollbar-width: none;
}
.ai-session-selector::-webkit-scrollbar {
    display: none;
}

/* Chevron arrows that flank the tab strip. Visibility is controlled
   from Blazor via inline `visibility:hidden` (not display:none) so
   the layout doesn't reflow as the strip scrolls between
   "everything-fits" and "scrolled-to-end" states. */
.ai-session-tab-arrow {
    width: 22px;
    height: 35px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-sidebar);
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
}
.ai-session-tab-arrow:hover {
    color: var(--text-primary);
    background: color-mix(in srgb, var(--text-primary, #000) 6%, transparent);
}
.ai-session-tab-arrow:focus-visible {
    outline: 2px solid var(--accent, #1565c0);
    outline-offset: -2px;
}

.ai-session-tab-wrap {
    display: inline-flex;
    align-items: stretch;
    height: 35px;
    flex-shrink: 0;
    border-bottom: 2px solid transparent;
}

.ai-session-tab-wrap.active {
    border-bottom-color: var(--accent);
}

.ai-session-tab {
    padding: 0 7px 0 12px;
    height: 33px;
    border: none;
    background: transparent;
    font-family: var(--font-ui-small);
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    white-space: nowrap;
    transition: color .1s;
    text-transform: uppercase;
    letter-spacing: .4px;
    /* display is restated because ellipsis needs a block container, and a
       bare <button> is not one in every engine. */
    display: inline-block;
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ai-session-tab:hover,
.ai-session-tab-wrap:hover .ai-session-tab {
    color: var(--text-primary);
}

.ai-session-tab-wrap.active .ai-session-tab {
    color: var(--text-primary);
}

.ai-session-tab-rename {
    width: 24px;
    height: 33px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 8px 0 2px;
    border: none;
    background: transparent;
    color: var(--text-tertiary);
    cursor: pointer;
    border-radius: 0;
}

.ai-session-tab-rename:hover,
.ai-session-tab-rename:focus-visible {
    color: var(--text-primary);
    background: color-mix(in srgb, var(--text-primary, #000) 6%, transparent);
}

.ai-session-tab-rename:focus-visible {
    outline: 2px solid var(--accent, #1565c0);
    outline-offset: -2px;
}

.ai-session-tab--editing {
    min-width: 120px;
    max-width: 240px;
    /* The typed name is the user's own text, so it is shown as typed rather than
       in the strip's uppercase tracking. Everything else matches the tab it replaces. */
    text-transform: none;
    letter-spacing: 0;
    font-size: 12px;
    color: var(--text-primary);
    background: color-mix(in srgb, var(--text-primary, #000) 6%, transparent);
    border: none;
    border-radius: 3px 3px 0 0;
    outline: none;
    align-self: center;
    height: 25px;
    padding: 0 8px;
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent, #1565c0) 45%, transparent);
}

.ai-session-tab--editing:focus {
    box-shadow: inset 0 0 0 2px var(--accent, #1565c0);
}

.ai-toolbar-actions {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
}

.ai-toolbar-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 4px;
    padding: 0;
}

.ai-toolbar-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.ai-toolbar-btn.ai-delete:hover {
    color: var(--error-fg);
}

/*
 * Inline delete-confirm strip rendered in place of the trash button after the
 * first click. Sits inside .ai-toolbar-actions next to the + so it never grows
 * the 35px toolbar height; uses a tinted error background to read as
 * destructive without being a full modal.
 */
.ai-delete-confirm {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 28px;
    padding: 0 8px;
    background: color-mix(in srgb, var(--error-fg) 12%, transparent);
    border-radius: 4px;
}

.ai-delete-confirm-prompt {
    font-family: var(--font-ui-small);
    font-size: 11px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
}

.ai-delete-confirm-btn {
    height: 22px;
    padding: 0 8px;
    border: 1px solid var(--border-default);
    border-radius: 3px;
    font-family: var(--font-ui-small);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    background: var(--bg-surface);
    color: var(--text-primary);
}

.ai-delete-confirm-btn.ai-delete-confirm-yes {
    background: var(--error-fg);
    border-color: var(--error-fg);
    color: #fff;
}

.ai-delete-confirm-btn.ai-delete-confirm-yes:hover {
    filter: brightness(1.08);
}

.ai-delete-confirm-btn.ai-delete-confirm-no:hover {
    background: var(--bg-hover);
}

/*
 * First-use warm-up banner. Rendered at the top of the chat messages area
 * while the LocalSidecarPrewarmer is doing a cold prefill of one or more
 * mode caches (the "Preparing your AI for first use" experience). On a
 * fully-cached restart the prewarmer restores all slots in milliseconds
 * and this banner never appears. The visual language deliberately avoids
 * red/error connotations - it's a one-time setup step, not a fault.
 */
/*
 * Sub-agent fan-out cards: one per child run, rendered under the parent
 * message's step trace. Collapsed = status glyph + label + step count;
 * expanded = that child's own tool trace. Runtime-only.
 */
.ai-sub-agent-cards {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 6px 0;
}

.ai-sub-agent-card {
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
    background: var(--bg-sidebar);
    font-size: 12px;
    color: var(--text-secondary);
}

.ai-sub-agent-card__header {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 4px 8px;
    background: transparent;
    border: none;
    cursor: pointer;
    font: inherit;
    color: var(--text-primary);
    text-align: left;
}

.ai-sub-agent-card__glyph {
    flex: 0 0 auto;
    width: 14px;
    text-align: center;
    color: var(--text-tertiary);
}

.ai-sub-agent-card--completed .ai-sub-agent-card__glyph {
    color: var(--text-success, #2e7d32);
}

.ai-sub-agent-card--running .ai-sub-agent-card__glyph {
    color: var(--accent);
}

.ai-sub-agent-card--failed .ai-sub-agent-card__glyph {
    color: var(--text-error, #c62828);
}

.ai-sub-agent-card__label {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ai-sub-agent-card__meta {
    flex: 0 0 auto;
    color: var(--text-tertiary);
    font-size: 11px;
}

.ai-sub-agent-card__disclosure {
    flex: 0 0 auto;
    color: var(--text-tertiary);
    font-size: 10px;
}

.ai-sub-agent-card__summary {
    padding: 0 8px 5px 30px;
    color: var(--text-tertiary);
    font-size: 11px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ai-sub-agent-card__steps {
    list-style: none;
    margin: 0;
    padding: 2px 8px 6px 30px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.ai-sub-agent-card__step {
    display: flex;
    gap: 6px;
    align-items: baseline;
    line-height: 1.4;
}

.ai-sub-agent-card__step-detail {
    color: var(--text-tertiary);
    font-size: 11px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/*
 * Live task checklist the assistant maintains during multi-step work.
 * Pinned above the transcript; collapsible; persists with the session.
 */
.ai-task-list {
    margin: 8px 12px 0 12px;
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
    background: var(--bg-sidebar);
    font-size: 12px;
    color: var(--text-secondary);
}

.ai-task-list__header {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 5px 10px;
    background: transparent;
    border: none;
    cursor: pointer;
    font: inherit;
    color: var(--text-primary);
    text-align: left;
}

.ai-task-list__title {
    font-weight: 600;
}

.ai-task-list__count {
    flex: 1 1 auto;
    color: var(--text-tertiary);
}

.ai-task-list__disclosure {
    color: var(--text-tertiary);
    font-size: 10px;
}

.ai-task-list__items {
    list-style: none;
    margin: 0;
    padding: 2px 10px 8px 10px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.ai-task-list__item {
    display: flex;
    align-items: baseline;
    gap: 8px;
    line-height: 1.4;
}

.ai-task-list__glyph {
    flex: 0 0 auto;
    width: 12px;
    text-align: center;
    color: var(--text-tertiary);
}

.ai-task-list__item--done .ai-task-list__glyph {
    color: var(--text-success, #2e7d32);
}

.ai-task-list__item--active .ai-task-list__glyph {
    color: var(--accent);
}

.ai-task-list__item--done .ai-task-list__text {
    color: var(--text-tertiary);
    text-decoration: line-through;
}

.ai-task-list__item--active .ai-task-list__text {
    color: var(--text-primary);
    font-weight: 600;
}

.ai-task-list__item--skipped .ai-task-list__text {
    color: var(--text-tertiary);
    font-style: italic;
}

/*
 * One-time Ken Workbench autonomy suggestion strip at the top of the chat
 * area. Rendered at most once ever; either button stamps the persisted
 * marker.
 */
.ai-autonomy-notice {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 8px 12px;
    padding: 8px 12px;
    background: color-mix(in srgb, var(--primary, #1565c0) 6%, transparent);
    border: 1px solid color-mix(in srgb, var(--primary, #1565c0) 24%, transparent);
    border-left: 3px solid var(--primary, #1565c0);
    border-radius: 4px;
    font-size: 12px;
    color: var(--text-secondary);
}

.ai-autonomy-notice__label {
    flex: 1 1 auto;
    min-width: 0;
}

.ai-autonomy-notice__switch,
.ai-autonomy-notice__dismiss {
    flex: 0 0 auto;
    padding: 3px 10px;
    border-radius: 4px;
    border: 1px solid var(--border-default);
    background: var(--bg-sidebar);
    color: var(--text-primary);
    cursor: pointer;
    font: inherit;
}

.ai-autonomy-notice__switch {
    border-color: var(--primary, #1565c0);
    color: var(--primary, #1565c0);
}

.ai-autonomy-notice__switch:hover,
.ai-autonomy-notice__dismiss:hover {
    background: var(--bg-hover);
}

/*
 * Demo task menu. On the anonymous demo host the free-text composer is locked
 * and the curated demo-* agents are surfaced as click-to-run tutorial cards at
 * the top of the chat area. Each card is a real button so it is keyboard- and
 * screen-reader-operable.
 */
.ai-demo-tasks {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 8px 12px;
    padding: 12px 14px;
    background: color-mix(in srgb, var(--primary, #1565c0) 6%, transparent);
    border: 1px solid color-mix(in srgb, var(--primary, #1565c0) 24%, transparent);
    border-left: 3px solid var(--primary, #1565c0);
    border-radius: 4px;
}

.ai-demo-tasks-header {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-family: var(--font-ui-small);
    color: var(--text-primary);
}

.ai-demo-tasks-header strong {
    font-size: 13px;
}

.ai-demo-tasks-sub {
    font-size: 12px;
    color: var(--text-secondary, #555);
}

.ai-demo-tasks-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 8px;
}

.ai-demo-task-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    padding: 10px 12px;
    text-align: left;
    background: var(--surface, #fff);
    border: 1px solid color-mix(in srgb, var(--primary, #1565c0) 30%, transparent);
    border-radius: 6px;
    cursor: pointer;
    color: var(--text-primary);
    transition: background 0.12s ease, border-color 0.12s ease;
}

.ai-demo-task-card:hover:not(:disabled) {
    background: color-mix(in srgb, var(--primary, #1565c0) 10%, transparent);
    border-color: var(--primary, #1565c0);
}

.ai-demo-task-card:disabled {
    opacity: 0.6;
    cursor: default;
}

.ai-demo-task-card-label {
    font-size: 13px;
    font-weight: 600;
}

.ai-demo-task-card-desc {
    font-size: 11px;
    line-height: 1.35;
    color: var(--text-secondary, #555);
}

.ai-demo-task-card-run {
    margin-top: 2px;
    font-size: 11px;
    font-weight: 600;
    color: var(--primary, #1565c0);
}

.ai-warmup-banner {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 8px 12px;
    padding: 12px 14px;
    background: color-mix(in srgb, #b87333 8%, transparent);
    border: 1px solid color-mix(in srgb, #b87333 30%, transparent);
    border-left: 3px solid #b87333;
    border-radius: 4px;
}

/* Error variant: structural prewarm failure (system prompt won't fit
   in the configured context window). Distinct red palette so the user
   reads it as "actually broken - needs a fix" rather than the orange
   "still working" connotation of the regular warm-up banner. */
.ai-warmup-banner.ai-warmup-banner-error {
    background: color-mix(in srgb, #c00 8%, transparent);
    border: 1px solid color-mix(in srgb, #c00 35%, transparent);
    border-left: 3px solid #c00;
    color: var(--text-primary, #111);
}

.ai-warmup-banner-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-ui-small);
    font-size: 13px;
    color: var(--text-primary);
}

.ai-warmup-banner-icon {
    color: #b87333;
    /* Slow rotation gives the user evidence the warmup is alive without
       being a literal spinner that flashes "loading" anxiety; same vibe
       as the streaming-progress-strip's pulsing dots, just adapted for
       the larger banner footprint. */
    animation: aiWarmupBannerSpin 4s linear infinite;
    display: inline-flex;
}

@keyframes aiWarmupBannerSpin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

.ai-warmup-banner-body {
    font-family: var(--font-ui-small);
    font-size: 11px;
    line-height: 1.5;
    color: var(--text-secondary, #555);
}

.ai-warmup-banner-progress {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-family: var(--font-ui-small);
    font-size: 11px;
    color: var(--text-primary);
    margin-top: 2px;
}

.ai-warmup-banner-progress-elapsed {
    font-variant-numeric: tabular-nums;
    color: var(--text-secondary, #555);
}

.ai-warmup-banner-bar {
    position: relative;
    height: 4px;
    background: color-mix(in srgb, #b87333 15%, transparent);
    border-radius: 2px;
    overflow: hidden;
}

/* Indeterminate barber-pole stripes that animate across the full
   track width whenever the bar is visible. Sits BEHIND the
   determinate fill, so a user sees:
     [ solid orange = modes finished ][ shimmering stripes = current mode is in flight ]
   The stripe motion gives unambiguous "we're alive" feedback even
   when the discrete mode-fill stays at the same 25/50/75% step for
   many minutes (a long cold-prefill on a low-VRAM iGPU). The
   chat-panel warmup banner and the install dialog's prewarm strip
   both use this class, so both pick up the animation automatically. */
.ai-warmup-banner-bar::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image: repeating-linear-gradient(
        45deg,
        color-mix(in srgb, #b87333 30%, transparent) 0px,
        color-mix(in srgb, #b87333 30%, transparent) 8px,
        transparent 8px,
        transparent 16px
    );
    animation: ai-prewarm-stripe 900ms linear infinite;
    pointer-events: none;
}

@keyframes ai-prewarm-stripe {
    from { background-position: 0 0; }
    /* 16-px stripe period × √2 for the 45° slant ≈ 22.63 px to loop seamlessly. */
    to   { background-position: 22.627px 0; }
}

.ai-warmup-banner-bar-fill {
    position: relative;
    height: 100%;
    background: #b87333;
    transition: width 250ms ease;
}

/*
 * Crash diagnostics banner. Rendered at the top of the chat messages area
 * whenever the local sidecar is in the Crashed state and the supervisor
 * captured exit info from the most recent process death. Replaces the
 * silent "click to retry" experience.
 */
.ai-crash-banner {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 8px 12px;
    padding: 10px 12px;
    background: color-mix(in srgb, var(--error-fg, #c00) 8%, transparent);
    border: 1px solid color-mix(in srgb, var(--error-fg, #c00) 30%, transparent);
    border-left: 3px solid var(--error-fg, #c00);
    border-radius: 4px;
}

.ai-crash-banner-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-ui-small);
    font-size: 12px;
}

.ai-crash-banner-icon {
    color: var(--error-fg, #c00);
    font-size: 14px;
    line-height: 1;
}

.ai-crash-banner-title {
    flex: 1;
    color: var(--text-primary);
    font-weight: 600;
}

.ai-crash-banner-exitcode {
    font-weight: 400;
    color: var(--text-secondary);
    margin-left: 4px;
}

.ai-crash-banner-toggle {
    border: 1px solid var(--border-default);
    background: var(--bg-surface);
    color: var(--text-primary);
    font-family: var(--font-ui-small);
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 3px;
    cursor: pointer;
}

.ai-crash-banner-toggle:hover {
    background: var(--bg-hover);
}

.ai-crash-banner-alternative {
    margin: 6px 0 0 22px;
    font-size: 12px;
    line-height: 1.5;
    color: var(--text-secondary);
}

.ai-crash-banner-preview {
    margin: 2px 0 0 22px;
    font-family: var(--font-mono, ui-monospace, "Cascadia Mono", monospace);
    font-size: 11px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.ai-crash-banner-stderr {
    margin: 6px 0 0 22px;
    padding: 8px 10px;
    background: var(--bg-subtle, rgba(0, 0, 0, 0.04));
    border-left: 2px solid var(--border-default);
    border-radius: 3px;
    font-family: var(--font-mono, ui-monospace, "Cascadia Mono", monospace);
    font-size: 11px;
    line-height: 1.55;
    color: var(--text-primary);
    white-space: pre-wrap;
    word-wrap: break-word;
    max-height: 240px;
    overflow-y: auto;
}

.ai-crash-banner-actions {
    display: flex;
    gap: 6px;
    margin-top: 4px;
    margin-left: 22px;
}

.ai-crash-banner-btn {
    height: 24px;
    padding: 0 12px;
    border: 1px solid var(--border-default);
    border-radius: 3px;
    font-family: var(--font-ui-small);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    background: var(--bg-surface);
    color: var(--text-primary);
}

.ai-crash-banner-btn.ai-crash-banner-retry {
    background: var(--error-fg, #c00);
    border-color: var(--error-fg, #c00);
    color: #fff;
}

.ai-crash-banner-btn.ai-crash-banner-retry:hover:not([disabled]) {
    filter: brightness(1.08);
}

.ai-crash-banner-btn[disabled] {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Error row header: the ERROR label and the Retry action share one row, the
   label left and the button right. Same visual language as the crash banner's
   Retry, sized for the per-message context. */
.ai-error-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 4px;
}

.ai-error-header .message-role {
    margin-bottom: 0;
}

.ai-error-report-btn {
    height: 22px;
    margin-right: 6px;
    padding: 0 10px;
    border: 1px solid var(--error-fg, #c00);
    border-radius: 3px;
    background: transparent;
    color: var(--error-fg, #c00);
    font-family: var(--font-ui-small);
    font-size: 11px;
    cursor: pointer;
}

.ai-error-report-btn:hover {
    background: color-mix(in srgb, var(--error-fg, #c00) 8%, transparent);
}

.ai-error-retry-btn {
    height: 22px;
    padding: 0 10px;
    border: 1px solid var(--error-fg, #c00);
    border-radius: 3px;
    background: var(--error-fg, #c00);
    color: #fff;
    font-family: var(--font-ui-small);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
}

.ai-error-retry-btn:hover:not([disabled]) {
    filter: brightness(1.08);
}

.ai-error-retry-btn[disabled] {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Header chrome alongside the toolbar above it, not a white band floating over
   the transcript card's surround. */
.ai-session-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 10px;
    background: var(--bg-page);
    flex-shrink: 0;
}

.ai-session-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    /* Always sit at the right edge of the header regardless of whether the
       sidecar-status badge or other sibling chips are present. Without this,
       the mode pills snap leftward whenever a sibling disappears (e.g. the
       "starting…" pill clears once the local engine is Ready). */
    margin-left: auto;
}





.ai-billing-readout {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
    font-family: var(--font-ui-small);
    font-size: 11px;
    color: var(--text-muted, #666);
}

.ai-billing-sep {
    color: var(--border, #ccc);
}

.ai-confidence-note {
    margin-top: 8px;
    padding: 6px 10px;
    border-left: 3px solid var(--warning-fg, #b45309);
    border-radius: 4px;
    background: var(--bg-surface, #f6f6f6);
    font-family: var(--font-ui-small);
    font-size: 12px;
    color: var(--text-secondary, #444);
}

.ai-confidence-note--low {
    border-left-color: var(--error-fg, #b91c1c);
}

.ai-frontier-rerun {
    margin-top: 6px;
    padding: 3px 10px;
    border: 1px solid var(--accent, #2563eb);
    border-radius: 4px;
    background: transparent;
    color: var(--accent, #2563eb);
    font-family: var(--font-ui-small);
    font-size: 12px;
    cursor: pointer;
}

.ai-frontier-rerun:hover {
    background: var(--accent-subtle, #e0ecff);
}




/* Header pill rendered while an approved plan is being executed.
   Distinct from .ai-mode pills (which are clickable buttons); this is a
   static badge that replaces the mode-pill row for the duration of the
   execution. */
.ai-mode-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 8px;
    font-family: var(--font-ui-small);
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .4px;
    color: var(--text-inverse);
    background: var(--ai-badge-executing-plan-bg);
}

.ai-mode-badge--executing-plan {
    background: var(--ai-badge-executing-plan-bg);
}






/* Chip suffix on each custom-agent pill so users can distinguish
   user-authored modes from the built-in four at a glance. */
.ai-mode--custom {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.ai-mode--custom .ai-mode-badge {
    padding: 1px 6px;
    border-radius: 6px;
    font-size: 9px;
    color: var(--text-primary);
    background: var(--accent-soft, var(--bg-active));
}

/* The transcript is a card on the same terms as the composer beneath it: same
   inset, same border, same corner. The composer takes no top margin because the
   resizer strip between them supplies that gap, so this takes no bottom one. */
.ai-messages {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 8px 8px 0;
    border: 1px solid var(--border-default);
    border-radius: 10px;
    background: var(--bg-surface);
}

.chat-compaction-marker {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 6px 0;
    font-size: 11px;
    color: var(--text-muted, #6b7280);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.chat-compaction-marker::before,
.chat-compaction-marker::after {
    content: "";
    flex: 1;
    border-top: 1px dashed var(--border-color, #d1d5db);
}

.chat-message {
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 13px;
    line-height: 1.6;
    position: relative;
}

/* Cursor-style per-message hover toolbar. Always rendered (so layout is
   stable) but starts hidden via opacity:0 and fades in when the parent
   .chat-message is hovered or any child receives keyboard focus. */
.ai-msg-actions {
    position: absolute;
    top: 4px;
    right: 6px;
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.12s ease-in-out;
    pointer-events: none;
}

.chat-message:hover .ai-msg-actions,
.chat-message:focus-within .ai-msg-actions {
    opacity: 1;
    pointer-events: auto;
}

/* Sized to the workbench's other icon buttons (.pane-maximize-btn and friends): a
   24px square target carrying a 14px glyph. The previous 2px/6px padding around a
   text glyph gave roughly a 16px tall hit area - under the 24px minimum these
   controls are held to, and small enough that the two sat almost touching. */
.ai-msg-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    padding: 0;
    background: var(--bg-default, #fff);
    border: 1px solid var(--border-default, #d0d7de);
    border-radius: 4px;
    line-height: 1;
    cursor: pointer;
    color: var(--text-secondary, #57606a);
}

.ai-msg-action-btn:hover {
    color: var(--text-default, #1f2328);
}

.ai-msg-action-btn:hover {
    background: var(--accent-subtle, #ddf4ff);
}

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

/* Layout: user messages on the left, assistant on the right.
   Inverted from the conventional iMessage-style arrangement at the
   user's request - keeps the human-typed turn closest to the
   composer/edge they're already focused on, with the model's reply
   visually distinct on the opposite side. */
.chat-message.user {
    background: var(--accent-subtle);
    align-self: flex-start;
    max-width: 92%;
}

/* Assistant turns take the full width of the transcript; only the user's own
   messages hug their content. The turn is a reading surface - prose, code,
   tables, tool rows - not a speech bubble, and sizing it to its content caused
   two visible faults.

   It used to be `align-self: flex-end`, which sizes to content AND anchors
   right. Streaming text therefore grew the bubble leftwards, so a reply
   appeared to slide across the panel until it hit the width cap and began
   wrapping. And a code block inside declares `width: 100%` - a percentage of a
   parent that is itself sizing to content, which the layout resolves as no
   contribution - so the bubble took its width from whatever else was in it,
   leaving Monaco to shred a script into a two-token column that dragging the
   splitter could not widen, because the width never depended on the panel. */
.chat-message.assistant {
    background: var(--bg-sidebar);
    align-self: stretch;
    max-width: 100%;
}

.message-role {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--text-tertiary);
    margin-bottom: 4px;
}

.message-content {
    /* Markdown-rendered HTML, so the newlines Markdig puts between block tags are
       text nodes here. Under pre-wrap each one rendered as a blank line on top of
       the margins below, which is where the over-large gaps came from. */
    white-space: normal;
    color: var(--text-primary);
    /* An unbroken token - a URL, a JSON error body - has no wrap
       opportunity, and without this it forces the chat pane to scroll
       sideways. Breaking mid-token is the lesser evil in a narrow dock. */
    overflow-wrap: anywhere;
}

/* Margins for the block elements Markdig emits. Chat bodies carry no plain
   text of their own - every text segment goes through MarkdownRenderer. */
.message-content > p {
    margin: 0 0 0.6em 0;
}
.message-content > p:last-child {
    margin-bottom: 0;
}
.message-content > ol,
.message-content > ul {
    margin: 0.4em 0;
    padding-left: 1.6em;
}
.message-content > ol li,
.message-content > ul li {
    margin: 0.2em 0;
}
/* Sized here because the browser default is not scoped to a 13px chat column: an
   unsized h1 renders at 2em - 26px - and a report with three headings turns the
   transcript into a poster. Every other block in this body is scoped; the sizes
   were the one property left to the user agent, which only showed once the
   assistant began writing structured reports with headings. */
.message-content > h1,
.message-content > h2,
.message-content > h3,
.message-content > h4 {
    margin: 0.8em 0 0.3em 0;
    line-height: 1.3;
    font-weight: 600;
}
.message-content > h1 { font-size: 1.25em; }
.message-content > h2 { font-size: 1.12em; }
.message-content > h3 { font-size: 1.02em; }
.message-content > h4 { font-size: 1em; }
.message-content > h1:first-child,
.message-content > h2:first-child,
.message-content > h3:first-child,
.message-content > h4:first-child {
    margin-top: 0;
}
.message-content > blockquote {
    margin: 0.4em 0;
    padding-left: 0.8em;
    border-left: 3px solid var(--border-default, #ddd);
    color: var(--text-secondary, #666);
}
.message-content > table {
    margin: 0.5em 0;
    border-collapse: collapse;
    white-space: normal;
}
.message-content > table th,
.message-content > table td {
    padding: 4px 8px;
    border: 1px solid var(--border-default, #ddd);
}
.message-content code {
    /* Inline-code styling (NOT fenced blocks - those are handled by
       AiChatCodeBlock and never enter this path). Just a subtle
       background tint and a monospace family so `ols` reads as code
       in running prose. */
    font-family: var(--font-mono, ui-monospace, "Consolas", monospace);
    font-size: 0.9em;
    padding: 1px 4px;
    border-radius: 3px;
    background: color-mix(in srgb, var(--text-primary, #000) 7%, transparent);
}

/* AI chat fenced code blocks - read-only Monaco snippets with a floating
   Copy button so users can lift the snippet straight into a notebook
   cell or the script editor. Hosted by AiChatCodeBlock.razor. */
.ai-code-block {
    position: relative;
    margin: 8px 0;
    padding: 4px 12px;
    box-sizing: border-box;
    border-radius: 6px;
    border: 1px solid var(--border-default);
    background: var(--bg-base, #ffffff);
    /* Horizontal scroll on overflow rather than `overflow: hidden` so a
       long line stays readable inside a narrow assistant bubble (the
       fallback pre below sets white-space:pre and pushes intrinsic
       width to the longest line; this keeps that visible). */
    overflow-x: auto;
    overflow-y: hidden;
    /* Take the full width the parent bubble offers so the bubble doesn't
       shrink-to-fit a wrapped pre. Without this, a code block whose
       longest line happens to be one identifier would shrink the
       bubble to that identifier's width, then aggressive `overflow-wrap:
       anywhere` on the fallback would shred it character by character. */
    width: 100%;
}

.ai-code-block-actions {
    position: absolute;
    top: 6px;
    right: 8px;
    z-index: 5;
    opacity: 0;
    transition: opacity 120ms ease;
    pointer-events: none;
}

.ai-code-block:hover .ai-code-block-actions,
.ai-code-block:focus-within .ai-code-block-actions {
    opacity: 1;
    pointer-events: auto;
}

.ai-code-block-copy {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    font-size: 11px;
    font-family: var(--font-ui-small, var(--font-ui));
    color: var(--text-secondary);
    background: var(--bg-base, #ffffff);
    border: 1px solid var(--border-default);
    border-radius: 4px;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.ai-code-block-copy:hover {
    color: var(--text-primary);
    background: var(--bg-active, var(--bg-sidebar));
}

.ai-code-block-copy-label {
    line-height: 1;
}

.ai-code-monaco {
    width: 100%;
    /* Height set imperatively by shazamAiCodeBlock.attach */
}

.ai-code-block-fallback {
    margin: 0;
    padding: 4px 0;
    font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
    font-size: 12px;
    /* `pre` (no wrap) + horizontal scroll on the parent .ai-code-block
       lets long code lines stay on one line. The previous combination
       (`pre-wrap` + `overflow-wrap: anywhere`) shred lines at every
       character boundary inside a narrow assistant bubble - a sample
       script with `nor(1)`, `m = ols(y ~ x, ...)`, etc. rendered as a
       ~14-character-wide column with one or two tokens per line. */
    white-space: pre;
    color: var(--text-primary);
    background: transparent;
}

.ai-citation-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}

/* ── Composer ────────────────────────────────────────────────────────────
   One bordered container holding the text area and the control row beneath
   it. Replaces the old .ai-input strip plus the four bands that used to sit
   above it (mode rail, mode-info bubble, context chips, two attach rows) -
   those are now the + and mode menus on the control row. */
.ai-composer {
    display: flex;
    flex-direction: column;
    /* No top margin: the resizer strip immediately above provides that gap,
       and stacking the two put the grip hard against the transcript with a
       double-width space below it. */
    margin: 0 8px 8px 8px;
    border: 1px solid var(--border-default);
    border-radius: 10px;
    background: var(--bg-input);
    transition: border-color .15s, box-shadow .15s;
}

/* Focus ring on the container, not the textarea: the textarea is borderless
   inside it, so focusing the text must light the whole control. */
.ai-composer:focus-within {
    border-color: var(--text-tertiary);
    box-shadow: 0 0 0 3px var(--bg-active);
}

.ai-composer-controls {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 8px 8px 8px;
    min-width: 0;
}

/* The row never wraps and never pushes Send out of the pane: the icon buttons keep their size, and
   the two text controls (mode chip, model picker) give up width and ellipsise instead. */
.ai-composer-controls > .ai-composer-menu-anchor,
.ai-composer-controls > .ai-send-btn,
.ai-composer-controls > .ai-stop-btn {
    flex: 0 0 auto;
}

.ai-composer-controls > .ai-composer-menu-anchor--chip {
    flex: 0 1 auto;
    min-width: 0;
}

/* Pushes the model picker and send button to the trailing edge. */
.ai-composer-spacer {
    flex: 1 1 0;
    min-width: 0;
}

/* Context-window readout for a local-model turn ("12K / 32K"). Quiet by
   default - it is a gauge, not a warning - and tints only once the
   conversation is close enough to the ceiling that the user may want to
   start a fresh chat. */
.ai-composer-context {
    flex: 0 0 auto;
    padding: 0 6px;
    font-family: var(--font-ui-small);
    font-size: 11px;
    line-height: 28px;
    color: var(--text-tertiary);
    white-space: nowrap;
    cursor: default;
}

.ai-composer-context--tight {
    color: var(--text-warning, #b58900);
}

/* Single-line tool-call rows rendered beneath an assistant message outside
   Agent mode. These shipped without any CSS at all, so they inherited
   nothing and sat unstyled against the chat bubble; the rules below mirror
   the Agent-mode step rows so the two surfaces read alike. */
.ai-toolcall-rows {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin: 4px 0;
}

.ai-toolcall-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px;
    background: var(--bg-sidebar);
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
    font-family: var(--font-ui);
    font-size: 12px;
    line-height: 1.4;
    color: var(--text-secondary);
}

.ai-toolcall-row__icon {
    flex: 0 0 auto;
    width: 14px;
    text-align: center;
    color: var(--text-tertiary);
}

.ai-toolcall-row__label {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ai-toolcall-row--pending .ai-toolcall-row__icon {
    color: var(--accent);
}

.ai-toolcall-row--succeeded .ai-toolcall-row__icon {
    color: var(--text-success, #2e7d32);
}

.ai-toolcall-row--completed-with-errors .ai-toolcall-row__icon {
    color: var(--text-warning, #b58900);
}

.ai-toolcall-row--failed .ai-toolcall-row__icon {
    color: var(--text-error, #c62828);
}

/* Fold that hides a failed turn's step trace behind its summary. Styled as
   quiet text rather than a button so it does not compete with Retry, which
   is the action the user most likely wants on an errored turn. */
.ai-agent-trace-summary {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    margin: 4px 0;
    padding: 4px 8px;
    background: transparent;
    border: none;
    border-radius: 4px;
    text-align: left;
    font-family: var(--font-ui);
    font-size: 12px;
    line-height: 1.4;
    color: var(--text-secondary);
    cursor: pointer;
}

.ai-agent-trace-summary:hover {
    background: var(--bg-hover);
}

.ai-agent-trace-summary__chevron {
    flex: 0 0 auto;
    width: 14px;
    height: 14px;
    color: var(--text-tertiary);
}

/* Agent-mode step-row stack. Also previously unstyled - the rows carried
   their own scoped CSS but the container did not, so the gap between rows
   came from the row margins alone. */
.ai-agent-step-rows {
    display: flex;
    flex-direction: column;
    margin: 4px 0;
}

/* The agent safety limit is exceptional rather than normal progress. Keep the
   explanation and its actions in one aligned row, using the established blue
   primary action and neutral secondary action from the workbench. */
.ai-agent-continue-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin: 6px 0;
    padding: 8px 10px;
    background: var(--bg-sidebar);
    border: 1px solid var(--border-subtle);
    border-left: 3px solid var(--warning-fg, #b25e14);
    border-radius: 5px;
    font-family: var(--font-ui);
    font-size: 12px;
    line-height: 1.4;
    color: var(--text-secondary);
}

.ai-agent-continue-row__label {
    flex: 1 1 220px;
    min-width: 0;
}

.ai-agent-continue-row__actions {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 6px;
    margin-left: auto;
}

.ai-agent-continue-btn,
.ai-agent-continue-dismiss {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    padding: 0 10px;
    border-radius: 4px;
    font: inherit;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
}

.ai-agent-continue-btn {
    border: 1px solid var(--accent);
    background: var(--accent);
    color: var(--text-inverse);
}

.ai-agent-continue-btn:hover:not(:disabled) {
    filter: brightness(.93);
}

.ai-agent-continue-dismiss {
    border: 1px solid var(--border-subtle);
    background: var(--bg-surface);
    color: var(--text-secondary);
}

.ai-agent-continue-dismiss:hover:not(:disabled) {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.ai-agent-continue-btn:focus-visible,
.ai-agent-continue-dismiss:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.ai-agent-continue-btn:disabled,
.ai-agent-continue-dismiss:disabled {
    opacity: .55;
    cursor: default;
}

@media (max-width: 420px) {
    .ai-agent-continue-row {
        align-items: flex-start;
        flex-direction: column;
    }

    .ai-agent-continue-row__actions {
        align-self: flex-end;
    }
}

/* The composer's popovers are positioned against the COMPOSER, not against the
   button that opens them: the panel is often only ~320px wide, and a menu
   anchored to a button part-way along the control row would run past the pane's
   right edge and be cut off by its overflow:hidden. Spanning the composer's
   width instead means the menu always fits, whatever the dock width. */
.ai-composer {
    position: relative;
}

.ai-composer-menu-anchor {
    display: inline-flex;
}

/* Opens UPWARD - the composer sits at the foot of the panel, and the panel at
   the foot of the window, so a downward menu has nowhere to go. Two classes
   here out-rank the single-class base anchored rule regardless of order. */
.ai-composer .pane-context-menu--anchored {
    top: auto;
    bottom: calc(100% + 6px);
    left: 0;
    right: 0;
    /* Beat the described-menu min-width so a narrow dock still fits. */
    min-width: 0;
}

.ai-composer-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: background .12s, color .12s;
}

.ai-composer-btn:hover:not(:disabled),
.ai-composer-btn[aria-expanded="true"] {
    background: var(--bg-active);
    color: var(--text-primary);
}

.ai-composer-btn:disabled {
    opacity: .5;
    cursor: default;
}

/* Mode chip: the current autonomy level, and the control that changes it.
   Text-first rather than an icon - which mode you are in is the single most
   consequential thing about a turn, so it is spelled out. */
.ai-composer-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    height: 28px;
    padding: 0 6px;
    border: none;
    border-radius: 8px;
    background: transparent;
    font-family: var(--font-ui-small);
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    white-space: nowrap;
    min-width: 0;
    max-width: 100%;
    transition: background .12s, color .12s;
}

.ai-composer-chip > svg {
    flex: 0 0 auto;
}

.ai-composer-chip:hover,
.ai-composer-chip[aria-expanded="true"] {
    background: var(--bg-active);
    color: var(--text-primary);
}

.ai-composer-chip-label {
    font-weight: 600;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Model picker: a bare select that reads as inline text, matching the chip
   beside it rather than a boxed form control. */
.ai-composer-model {
    flex: 0 1 auto;
    /* As wide as the chosen model, not the longest one in the list, so the mode chip keeps the room. */
    field-sizing: content;
    min-width: 56px;
    max-width: 40%;
    text-overflow: ellipsis;
    height: 28px;
    padding: 0 4px;
    border: none;
    border-radius: 8px;
    background: transparent;
    font-family: var(--font-ui-small);
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
}

.ai-composer-model:hover {
    background: var(--bg-active);
    color: var(--text-primary);
}

.ai-pending-queue {
    flex: 0 1 auto;
    min-height: 0;
    max-height: 40%;
    overflow-y: auto;
    padding: 8px;
    background: var(--bg-sidebar);
    border-top: 1px solid var(--border-default);
    font-family: var(--font-ui-small);
}

.ai-pending-queue-label,
.ai-pending-queue-heading,
.ai-pending-queue-actions,
.ai-pending-queue-edit-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ai-pending-queue-label {
    flex-wrap: wrap;
    justify-content: space-between;
    margin-bottom: 6px;
    color: var(--text-secondary);
    font-size: 11px;
}

.ai-pending-queue-label strong {
    color: var(--text-primary);
    font-weight: 600;
}

.ai-pending-queue-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.ai-pending-queue-item {
    min-width: 0;
    padding: 8px 10px;
    background: color-mix(in srgb, var(--accent) 5%, var(--bg-surface));
    border: 1px solid var(--border-default);
    border-inline-start: 3px solid var(--accent);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 12px;
}

.ai-pending-queue-item.editing {
    border-color: var(--accent);
}

.ai-pending-queue-heading {
    justify-content: space-between;
    flex-wrap: wrap;
    margin-bottom: 4px;
}

.ai-pending-queue-position {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
}

.ai-pending-queue-preview {
    overflow-wrap: anywhere;
    line-height: 1.5;
}

.ai-pending-queue-preview > :first-child { margin-top: 0; }
.ai-pending-queue-preview > :last-child { margin-bottom: 0; }
.ai-pending-queue-preview pre { white-space: pre-wrap; }

.ai-pending-queue-edit-label {
    display: block;
    margin-bottom: 4px;
    font-size: 11px;
}

.ai-pending-queue-editor {
    display: block;
    box-sizing: border-box;
    width: 100%;
    min-height: 76px;
    resize: none;
    padding: 8px;
    border: 1px solid var(--border-default);
    border-radius: 6px;
    background: var(--bg-surface);
    color: var(--text-primary);
    font: inherit;
    line-height: 1.5;
}

.ai-pending-queue-edit-actions {
    justify-content: flex-end;
    flex-wrap: wrap;
    margin-top: 6px;
}

.ai-pending-queue-edit-hint {
    flex: 1;
    min-width: 120px;
    color: var(--text-secondary);
    font-size: 11px;
}

.ai-pending-queue-action {
    min-height: 24px;
    padding: 3px 6px;
    border: 1px solid transparent;
    border-radius: 4px;
    background: transparent;
    color: var(--text-secondary);
    font: inherit;
    font-size: 11px;
    cursor: pointer;
}

.ai-pending-queue-action:hover:not(:disabled) {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.ai-pending-queue-action:disabled { opacity: 0.5; cursor: default; }
.ai-pending-queue-save { border-color: var(--border-default); color: var(--text-primary); }
.ai-pending-queue-action:focus-visible,
.ai-pending-queue-editor:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ai-paper-url-input {
    display: flex;
    gap: 6px;
    padding: 6px 8px;
    background: var(--bg-sidebar);
    border-top: 1px solid var(--border-subtle);
}

.ai-paper-url-input-box {
    flex: 1;
    padding: 4px 8px;
    font-size: 12px;
    border: 1px solid var(--border-default);
    border-radius: 4px;
    background: var(--bg-surface);
    color: var(--text-primary);
}

.ai-paper-url-add {
    padding: 4px 12px;
    border-radius: 4px;
    border: 1px solid color-mix(in srgb, var(--accent, #0078d4) 40%, var(--border-default));
    background: color-mix(in srgb, var(--accent, #0078d4) 12%, var(--bg-surface));
    color: var(--text-primary);
    font-size: 12px;
    cursor: pointer;
}

.ai-paper-url-add:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.ai-paper-url-add:not(:disabled):hover {
    background: color-mix(in srgb, var(--accent, #0078d4) 22%, var(--bg-surface));
}

/* Attached paper chips. Replace the source row while at least one chip
   is present so the surface always says exactly one of "you can attach"
   or "this is attached". */
.ai-paper-attachment-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 6px 8px;
    border-top: 1px solid var(--border-subtle);
    background: var(--bg-sidebar);
}

.ai-paper-attachment-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 4px 3px 8px;
    border-radius: 12px;
    background: color-mix(in srgb, var(--accent, #0078d4) 14%, var(--bg-surface));
    border: 1px solid color-mix(in srgb, var(--accent, #0078d4) 30%, var(--border-default));
    font-size: 12px;
    color: var(--text-primary);
    max-width: 320px;
}

.ai-paper-attachment-chip-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ai-paper-attachment-chip-remove {
    border: none;
    background: transparent;
    cursor: pointer;
    color: var(--text-tertiary);
    font-size: 14px;
    line-height: 1;
    padding: 0 6px;
    border-radius: 50%;
}

.ai-paper-attachment-chip-remove:hover {
    background: color-mix(in srgb, var(--danger, #d13438) 20%, transparent);
    color: var(--danger, #d13438);
}

.ai-artifact-reference-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 6px 8px;
    border-top: 1px solid var(--border-subtle);
    background: var(--bg-sidebar);
}

.ai-artifact-reference-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 320px;
    padding: 3px 8px;
    border-radius: 12px;
    border: 1px solid color-mix(in srgb, var(--accent, #0078d4) 28%, var(--border-default));
    background: color-mix(in srgb, var(--accent, #0078d4) 10%, var(--bg-surface));
    color: var(--text-primary);
    cursor: pointer;
    font-size: 12px;
}

.ai-artifact-reference-chip:hover {
    background: color-mix(in srgb, var(--accent, #0078d4) 18%, var(--bg-surface));
}

.ai-artifact-reference-kind {
    color: var(--text-tertiary);
    font-size: 11px;
}

.ai-artifact-reference-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Top-mounted drag handle that grows the composer textarea upward.
   The native textarea resize affordance only grows downward from the
   bottom-right corner, so we render our own affordance just above the
   composer. The actual height adjustment is driven by ai-composer-resizer.js. */
/* Sits in the gap between the transcript and the composer, inset to the same
   8px as the composer so the grip lines up with the box it resizes rather than
   spanning wider than every other pane's content. Transparent, because a filled
   band here read as a third panel wedged between the two real ones. The height
   is the whole gap: the composer's top margin is dropped to compensate, so the
   grip has room to breathe without the space between the panes growing. */
.ai-input-resizer {
    height: 12px;
    margin: 0 8px;
    flex-shrink: 0;
    cursor: ns-resize;
    background: transparent;
    position: relative;
    user-select: none;
}

.ai-input-resizer::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 32px;
    height: 2px;
    border-radius: 1px;
    background: var(--border-default);
    transition: background-color .15s, width .15s;
}

.ai-input-resizer:hover::after {
    background: var(--accent);
    width: 48px;
}

/* Borderless inside .ai-composer, which owns the border and focus ring. */
.ai-input-box {
    /* NOT `flex: 1`. That resolves to flex-basis:0%, which makes the flex
       algorithm - not the height property - the authority on this element's
       height, so the drag handle above could set style.height all it liked
       and nothing moved. The composer is content-sized either way, so
       basis:auto renders identically until the user drags. */
    flex: 0 0 auto;
    border: none;
    border-radius: 10px 10px 0 0;
    padding: 9px 10px 4px 10px;
    font-family: var(--font-ui);
    font-size: 13px;
    resize: none;
    outline: none;
    background: transparent;
    color: var(--text-primary);
}

/* Composer focus uses a soft grey ring rather than the accent-blue
   double-border the rest of the app uses. The user's complaint was that
   the blue ring drew the eye away from the AI conversation - the
   composer is the SECOND-most-important UI element on this pane (after
   the chat history), and a louder focus indicator on it pulled focus
   constantly. A subtle grey ring still provides keyboard-focus
   affordance for accessibility without competing with the conversation
   for attention. */
/* The container owns the focus ring (.ai-composer:focus-within); a ring here
   too would draw a second box inside the first. */
.ai-input-box:focus {
    box-shadow: none;
}

/* A plan revision starts with an empty draft. Its prompt is a hint, not text
   the user is expected to delete before writing their requested changes. */
.ai-input-box--plan-revision::placeholder {
    color: var(--text-tertiary);
}

.ai-input-box--plan-revision:focus::placeholder {
    color: transparent;
}

.ai-send-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent);
    color: var(--text-inverse);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    flex-shrink: 0;
    transition: background .12s;
    padding: 0;
}

.ai-send-btn:hover:not(:disabled) {
    background: var(--accent-hover);
}

.ai-send-btn:disabled {
    opacity: .45;
    cursor: default;
}

.ai-send-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255,255,255,.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: ai-spin .6s linear infinite;
}

@keyframes ai-spin {
    to { transform: rotate(360deg); }
}

/* Stop button - red to signal destructive cancellation, matched in size
   to .ai-send-btn so the composer's two action buttons line up. Renders
   beside the send/queue button while a stream is in flight. */
.ai-stop-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-default, #fff);
    color: #dc2626;
    border: 1px solid #dc2626;
    border-radius: 8px;
    cursor: pointer;
    flex-shrink: 0;
    transition: background .12s, color .12s;
    padding: 0;
}

.ai-stop-btn:hover:not(:disabled) {
    background: #dc2626;
    color: #fff;
}

.ai-stop-btn:disabled {
    opacity: .45;
    cursor: default;
}

/* Guidance: the user has a step left, which is not the same as something having gone wrong.
   Informational blue rather than the error red, and no retry control. */
.chat-message.guidance {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    align-self: stretch;
}

.chat-message.guidance .message-role {
    color: #1d4ed8;
}

.chat-message.guidance .message-content {
    color: #1e3a8a;
}

.chat-message.error {
    background: #fef2f2;
    border: 1px solid #fca5a5;
    align-self: stretch;
}

.chat-message.error .message-role {
    color: #dc2626;
}

.chat-message.error .message-content {
    color: #991b1b;
}

.ai-thinking {
    font-size: 12px;
    color: var(--text-tertiary);
    font-style: italic;
    animation: ai-pulse 1.2s ease-in-out infinite;
}

.ai-plan-notice {
    display: inline-flex;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    padding: 6px 10px;
    margin: 4px 0;
    border-radius: 4px;
    background: var(--surface-2, #f4f6f8);
    border: 1px solid var(--border, #d8dde1);
    font-size: 12px;
}

.ai-plan-notice[data-status="cancelled"] {
    opacity: 0.6;
}

.ai-plan-notice-label {
    color: var(--text-secondary, #666);
}

.ai-plan-notice-name {
    background: transparent;
    padding: 0;
    font-family: var(--font-ui);
    font-size: 14px;
    flex-basis: 100%;
    overflow-wrap: anywhere;
}

.ai-plan-notice-steps {
    flex-basis: 100%;
    min-width: 0;
    margin: 8px 0;
    padding-left: 22px;
    font-size: 13px;
    line-height: 1.5;
    overflow-wrap: anywhere;
}
.ai-plan-notice-steps li + li { margin-top: 10px; }
.ai-plan-step-notes { margin-top: 4px; color: var(--text-secondary); }
.ai-plan-approval-explanation, .ai-plan-notice-error {
    flex-basis: 100%;
    margin: 6px 0;
    line-height: 1.5;
    overflow-wrap: anywhere;
}
.ai-plan-notice-error { color: var(--text-error, #b42318); }
/* Ken's word on a plan: a speech bubble whose tail rises from its top-left corner toward
   Ken's name, so the advice reads as spoken by Ken rather than as part of the plan card. */
.ai-plan-advice {
    position: relative;
    margin: 12px 0 10px;
    padding: 8px 12px;
    border: 1px solid var(--border-default);
    border-radius: 10px;
    background: var(--bg-surface);
    color: var(--text-primary);
}

.ai-plan-advice::before,
.ai-plan-advice::after {
    content: "";
    position: absolute;
    left: 16px;
    width: 0;
    height: 0;
    border-style: solid;
}

.ai-plan-advice::before {
    top: -10px;
    border-width: 0 9px 10px 9px;
    border-color: transparent transparent var(--border-default) transparent;
}

.ai-plan-advice::after {
    top: -8px;
    left: 17px;
    border-width: 0 8px 9px 8px;
    border-color: transparent transparent var(--bg-surface) transparent;
}

.ai-loop-question-answer {
    margin: 6px 0 0;
    color: var(--text-secondary);
}

.ai-plan-notice-btn {
    border: 1px solid var(--border, #c8c8c8);
    background: var(--surface-0, #fff);
    padding: 2px 8px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
    color: inherit;
}

.ai-plan-notice-btn:hover:not(:disabled) {
    background: var(--surface-1, #f0f0f0);
}

.ai-plan-notice-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.ai-plan-notice-open {
    color: #1872c2;
}

.ai-plan-notice-approve {
    background: #1872c2;
    border-color: #1872c2;
    color: #fff;
}

.ai-plan-notice-approve:hover:not(:disabled) {
    background: #145ea0;
    border-color: #145ea0;
}

.ai-plan-notice-status {
    margin-left: 6px;
    padding: 1px 6px;
    border-radius: 8px;
    background: var(--surface-1, #eee);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.ai-plan-notice-ask-hint {
    color: var(--text-secondary, #666);
    font-size: 11px;
    font-style: italic;
}

@keyframes ai-pulse {
    0%, 100% { opacity: .4; }
    50% { opacity: 1; }
}

/* ── "The assistant cannot answer" notice ────────────────────────────────
   One treatment for every reason: no provider configured, or the local engine
   not installed / stopped / crashed. Replaces a yellow banner (no-provider) and
   a muted grey pill (local status) that said the same thing two different ways.

   Themed rather than hard-coded: the old banner's #fffbeb / #92400e were
   invisible in the dark themes, and this surface appears exactly when something
   has gone wrong - the worst time to be unreadable. */
.ai-unavailable {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    margin: 8px;
    border: 1px solid;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.5;
}

.ai-unavailable--warn {
    background: color-mix(in srgb, var(--warning-fg) 10%, var(--bg-surface));
    border-color: color-mix(in srgb, var(--warning-fg) 40%, transparent);
    color: var(--text-primary);
}

.ai-unavailable--error {
    background: color-mix(in srgb, var(--error-fg) 10%, var(--bg-surface));
    border-color: color-mix(in srgb, var(--error-fg) 40%, transparent);
    color: var(--text-primary);
}

.ai-unavailable--info {
    background: color-mix(in srgb, var(--accent) 8%, var(--bg-surface));
    border-color: color-mix(in srgb, var(--accent) 30%, transparent);
    color: var(--text-primary);
}

.ai-unavailable-icon {
    flex: none;
    display: flex;
    margin-top: 1px;
}

.ai-unavailable--warn .ai-unavailable-icon { color: var(--warning-fg); }
.ai-unavailable--error .ai-unavailable-icon { color: var(--error-fg); }
.ai-unavailable--info .ai-unavailable-icon { color: var(--accent); }

/* The spinner turns only for the transient starting state. Exempt from the
   reduced-motion neutraliser for the same reason the run indicator is: a busy
   signal that has stopped moving reads as a hung app. */
.ai-unavailable--info .ai-unavailable-icon svg {
    animation: spin 1s linear infinite;
}

@media (prefers-reduced-motion: reduce) {
    .ai-unavailable--info .ai-unavailable-icon svg {
        animation-duration: 1.2s !important;
        animation-iteration-count: infinite !important;
    }
}

.ai-unavailable-body {
    flex: 1 1 auto;
    min-width: 0;
}

.ai-unavailable-title {
    font-weight: 600;
}

.ai-unavailable-detail {
    margin-top: 2px;
    color: var(--text-secondary);
}

/* Never wraps: two routes to the same fix read as one choice only while they
   sit on one row, and the dock is narrow enough that content-width buttons
   stack. Equal halves that shrink instead - the label wraps inside its own
   button long before the pair breaks apart. */
.ai-unavailable-actions {
    display: flex;
    flex-wrap: nowrap;
    align-items: stretch;
    gap: 8px;
    margin-top: 10px;
}

/* A real button, not a "go to Settings" instruction the user has to follow by
   hand - the notice knows where the fix is, so it should just take them. */
.ai-unavailable-action {
    flex: 1 1 0;
    min-width: 0;
    padding: 6px 4px;
    border: 1px solid var(--accent);
    border-radius: 6px;
    background: var(--accent);
    color: var(--text-inverse);
    font-family: var(--font-ui-small);
    font-size: 11px;
    font-weight: 600;
    line-height: 1.25;
    text-align: center;
    cursor: pointer;
    transition: background .12s, border-color .12s;
}

/* A single-route state has nothing to share the row with, so it keeps the
   content width it always had rather than stretching across the card. */
.ai-unavailable-action:only-child {
    flex: 0 0 auto;
    padding: 5px 12px;
    font-size: 12px;
}

.ai-unavailable-action:hover:not(:disabled) {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
}

.ai-unavailable-action:disabled {
    opacity: .6;
    cursor: default;
}

/* The other route, in the colours the AI settings panel already gives the two
   cards - blue for the local engine, green for Frontier AI. Filled, not
   outlined: an outline reads as "not really an option", and paying is a real
   answer for a user whose machine cannot host a model. The two stay
   distinguishable by colour and order rather than by one being faded out.
   Literal green rather than --success-fg because the themed token goes pale in
   the dark themes, which white label text cannot sit on. */
.ai-unavailable-action--secondary {
    border-color: #2e7d32;
    background: #2e7d32;
    color: #fff;
}

.ai-unavailable-action--secondary:hover:not(:disabled) {
    background: #1b5e20;
    border-color: #1b5e20;
    color: #fff;
}

/* -- Right dock tabs ------------------------------------------------------ */
.right-dock {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.right-dock .e-tab {
    height: 100%;
}

.right-dock .e-tab .e-content {
    height: calc(100% - 36px);
    overflow: hidden;
}

.right-dock .e-tab .e-content > .e-item {
    height: 100%;
    overflow: auto;
}

/* -- Pane maximize -------------------------------------------------------- */
.pane-with-maximize {
    position: relative;
    height: 100%;
}

.pane-with-maximize > .pane {
    height: 100%;
}

.pane-maximize-btn {
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: var(--bg-surface);
    color: var(--text-tertiary);
    cursor: pointer;
    border-radius: 3px;
    padding: 0;
    transition: background .1s, color .1s, opacity .1s;
    z-index: 5;
}

.pane-maximize-btn:disabled {
    opacity: .3;
    cursor: default;
}

.pane-maximize-btn:disabled:hover {
    background: var(--bg-surface);
    color: var(--text-tertiary);
}

.pane-maximize-btn:hover {
    background: var(--bg-active);
    color: var(--text-primary);
}

.pane:focus-within .pane-maximize-btn:not(:disabled),
.pane:focus-within .pane-header-actions .graph-nav-btn,
.pane:focus-within .pane-header-actions .tb-btn,
.pane:focus-within .pane-header-actions .notebook-icon-btn,
.bottom-panel:focus-within .pane-header-actions .pane-maximize-btn:not(:disabled),
.bottom-panel:focus-within .pane-header-actions .graph-nav-btn,
.bottom-panel:focus-within .pane-header-actions .tb-btn,
.bottom-panel:focus-within .help-nav-buttons .help-icon-btn,
.bottom-panel:focus-within .help-nav-buttons .help-home-btn {
    color: var(--accent);
}

.pane:focus-within .pane-maximize-btn:not(:disabled):hover,
.pane:focus-within .pane-header-actions .graph-nav-btn:hover,
.pane:focus-within .pane-header-actions .tb-btn:hover,
.pane:focus-within .pane-header-actions .notebook-icon-btn:hover,
.bottom-panel:focus-within .pane-header-actions .pane-maximize-btn:not(:disabled):hover,
.bottom-panel:focus-within .pane-header-actions .graph-nav-btn:hover,
.bottom-panel:focus-within .pane-header-actions .tb-btn:hover,
.bottom-panel:focus-within .help-nav-buttons .help-icon-btn:hover,
.bottom-panel:focus-within .help-nav-buttons .help-home-btn:hover {
    color: var(--accent);
}

.pane-maximize-btn.doc-history-arrow-btn {
    color: var(--primary, #0078d4);
}

.pane-maximize-btn.doc-history-arrow-btn:hover {
    color: var(--primary, #0078d4);
}

.pane-maximize-btn.corner {
    position: absolute;
    bottom: 6px;
    right: 6px;
    opacity: .65;
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    box-shadow: 0 1px 3px rgba(0,0,0,.08);
}

.pane-maximize-btn.corner:hover {
    opacity: 1;
    background: var(--bg-active);
}

.maximized-pane {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: var(--bg-surface);
    border-radius: 6px;
    overflow: hidden;
}

.maximized-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 35px;
    min-height: 35px;
    padding: 0 10px;
    background: var(--bg-sidebar);
    border-bottom: 1px solid var(--border-default);
    font-family: var(--font-ui-small);
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: .6px;
    flex-shrink: 0;
    border-radius: 6px 6px 0 0;
}

.maximized-content {
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

.maximized-content > .pane {
    height: 100%;
}

/* -- Syncfusion overrides ------------------------------------------------- */
.e-splitter .e-split-bar.e-split-bar-horizontal {
    background: transparent !important;
    width: 5px !important;
    border: none !important;
}

.e-splitter .e-split-bar.e-split-bar-vertical {
    background: transparent !important;
    height: 5px !important;
    border: none !important;
}

.e-splitter .e-split-bar:hover {
    background: transparent !important;
}

.e-splitter .e-split-bar .e-navigate-arrow,
.e-splitter .e-split-bar .e-resize-handler {
    display: none !important;
}

.e-splitter .e-split-bar .e-icon-hidden {
    display: none !important;
}

.e-splitter .e-pane {
    position: relative !important;
    float: none !important;
}

.e-splitter .e-split-bar {
    pointer-events: auto;
}

/*
 * Resize and drag cursors. One rule set, both hosts, identical result.
 *
 * Force the resize cursor on every split bar regardless of theme state:
 * Syncfusion's fluent2 only sets a cursor on `.e-resizable-split-bar`, and that
 * class is added by the splitter JS after it has measured min/max sizes, so the
 * first pointer enter races the classification and the cursor stays a plain
 * arrow until the next mouse-leave / re-enter. Pinning it on the unconditional
 * `.e-split-bar` guarantees the affordance from the first frame.
 *
 * VALUES ARE CONSTRAINED BY THE DESKTOP HOST. WinUI 3 runs WebView2 in
 * composition mode, mapping the cursor the WebView asks for onto
 * InputSystemCursorShape - an enum with no member for `col-resize`,
 * `row-resize`, `grab`, `grabbing`, or custom `url()` bitmaps. Anything
 * unmapped silently renders as the plain arrow (microsoft/microsoft-ui-xaml
 * #9188). The mapped shapes are:
 *
 *     ew-resize -> SizeWestEast      ns-resize -> SizeNorthSouth
 *     move      -> SizeAll           nwse/nesw -> SizeNWSE / SizeNESW
 *
 * So the workbench uses only those, on BOTH hosts. Browsers render them just as
 * well, and a single shared value is worth more than a per-host flourish: the
 * two hosts are meant to be indistinguishable, and a Web-only SVG cursor made
 * the same splitter look different depending on where it was opened.
 *
 * Selector coverage is belt-and-braces on purpose, since which element gets
 * hit-tested inside a 5px bar is not something to rely on:
 *   - the bar itself, by its own orientation modifier class;
 *   - the bar, by its OWN splitter's orientation class (child combinator, not
 *     descendant), in case the modifier has not been applied to the bar yet.
 *     The `>` is load-bearing: the workbench nests splitters, so a descendant
 *     selector let the outer vertical splitter claim every bar inside it -
 *     including the horizontal one between the editor and output panes, which
 *     then showed an up/down cursor;
 *   - Syncfusion's `::after` hit-zone overlay, which extends the target to ~16px;
 *   - every descendant, since some themes set `cursor: default` on children.
 */
.e-splitter .e-split-bar.e-split-bar-horizontal,
.e-splitter .e-split-bar.e-split-bar-horizontal::after,
.e-splitter .e-split-bar.e-split-bar-horizontal *,
.e-splitter.e-splitter-horizontal > .e-split-bar,
.e-splitter.e-splitter-horizontal > .e-split-bar::after,
.e-splitter.e-splitter-horizontal > .e-split-bar *,
.e-splitter .e-resize-handler.e-split-bar-horizontal {
    cursor: ew-resize !important;
}

.e-splitter .e-split-bar.e-split-bar-vertical,
.e-splitter .e-split-bar.e-split-bar-vertical::after,
.e-splitter .e-split-bar.e-split-bar-vertical *,
.e-splitter.e-splitter-vertical > .e-split-bar,
.e-splitter.e-splitter-vertical > .e-split-bar::after,
.e-splitter.e-splitter-vertical > .e-split-bar *,
.e-splitter .e-resize-handler.e-split-bar-vertical {
    cursor: ns-resize !important;
}

/*
 * macOS (Mac Catalyst) resize cursors - the exact mirror of the WinUI3 constraint above.
 *
 * Catalyst is iOS-family: the pointer shape comes from UIKit's UIPointerInteraction, and WebKit
 * maps only a subset of CSS cursor keywords onto it. `ew-resize` / `ns-resize` are NOT in that
 * subset, so the pointer stayed a plain arrow over every split bar while `text` (the I-beam) mapped
 * fine - i.e. CSS cursors DO reach the native pointer here, just not those two keywords.
 *
 * This was measured, not guessed: a hover probe reported topIsTheBar=true and topCursor=ew-resize
 * on 71 samples, so the DOM, the stylesheet and splitter-cursor.js were all already correct and
 * nothing was overlaying the bar - the value simply had no native equivalent.
 *
 * col-resize / row-resize are the column/row split-view shapes UIKit does expose. They are scoped
 * to .platform-mac rather than applied globally BECAUSE they are the pair WinUI3 cannot map
 * (microsoft/microsoft-ui-xaml #9188, see above) - using them everywhere would break Windows to fix
 * macOS. This is one of the few genuinely per-host divergences: neither host can render the other's
 * keyword, so a single shared value does not exist. It still lives in the shared stylesheet, keyed
 * off the platform class the host page already sets, so there is no Mac-specific host code.
 */
html.platform-mac .e-splitter .e-split-bar.e-split-bar-horizontal,
html.platform-mac .e-splitter .e-split-bar.e-split-bar-horizontal::after,
html.platform-mac .e-splitter .e-split-bar.e-split-bar-horizontal *,
html.platform-mac .e-splitter.e-splitter-horizontal > .e-split-bar,
html.platform-mac .e-splitter.e-splitter-horizontal > .e-split-bar::after,
html.platform-mac .e-splitter.e-splitter-horizontal > .e-split-bar *,
html.platform-mac .e-splitter .e-resize-handler.e-split-bar-horizontal {
    cursor: col-resize !important;
}

html.platform-mac .e-splitter .e-split-bar.e-split-bar-vertical,
html.platform-mac .e-splitter .e-split-bar.e-split-bar-vertical::after,
html.platform-mac .e-splitter .e-split-bar.e-split-bar-vertical *,
html.platform-mac .e-splitter.e-splitter-vertical > .e-split-bar,
html.platform-mac .e-splitter.e-splitter-vertical > .e-split-bar::after,
html.platform-mac .e-splitter.e-splitter-vertical > .e-split-bar *,
html.platform-mac .e-splitter .e-resize-handler.e-split-bar-vertical {
    cursor: row-resize !important;
}

/*
 * Splitter grip - DISABLED, PENDING A DECISION. Do not delete yet.
 *
 * A small centred pill on each split bar, brightening to the accent colour on
 * hover. It was added as a substitute affordance back when the resize cursor
 * could not be made to work on the desktop host. The cursor now works on both
 * hosts, so the grip is being trialled OFF to see whether it is still earning
 * its place: the bar is 5px of transparent chrome, and the argument for a
 * visible mark was that the cursor change alone is easy to miss on a wide
 * screen. That argument may still hold - hence disabled rather than removed.
 *
 * To re-enable, uncomment the rules below. To retire it, delete this whole
 * block; nothing else references the pill.
 *
 * Implementation notes, for whoever restores it: drawn with ::before so
 * Syncfusion's ::after (the ~16px hit-zone overlay) is untouched and the drag
 * target stays wide, and pointer-events: none keeps the pill out of the
 * gesture. Geometry mirrors .ai-input-resizer::after. `position: relative` on
 * the bar is only needed by the pill - it is inside the commented block.
 */
/*
.e-splitter .e-split-bar {
    position: relative;
}

.e-splitter .e-split-bar.e-split-bar-vertical::before,
.e-splitter .e-split-bar.e-split-bar-horizontal::before {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    border-radius: 1px;
    background: var(--border-default);
    pointer-events: none;
}

.e-splitter .e-split-bar.e-split-bar-vertical::before {
    width: 32px;
    height: 2px;
    transition: background-color .15s, width .15s;
}

.e-splitter .e-split-bar.e-split-bar-vertical:hover::before {
    background: var(--accent);
    width: 48px;
}

.e-splitter .e-split-bar.e-split-bar-horizontal::before {
    width: 2px;
    height: 32px;
    transition: background-color .15s, height .15s;
}

.e-splitter .e-split-bar.e-split-bar-horizontal:hover::before {
    background: var(--accent);
    height: 48px;
}
*/

/* Drag handles inherit onto their children, which would otherwise pick up a
   descendant rule's cursor mid-drag. `move` (SizeAll) is the mapped shape that
   reads as "pick this up and reposition it"; the elements themselves declare it
   at their own rule, this only extends it across their subtrees. */
.pane-header.pane-drag-handle *,
.editor-pane-title.pane-drag-handle * {
    cursor: move !important;
}


.e-splitter .e-split-bar .e-icon-in-split-bar {
    display: none !important;
    pointer-events: none !important;
}

.e-splitter.middle-collapsed > .e-split-bar {
    display: none !important;
    height: 0 !important;
    width: 0 !important;
}

.e-splitter.middle-collapsed > .e-pane:last-of-type {
    flex-basis: 0 !important;
    min-height: 0 !important;
    min-width: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
}

/* The mirror image, for the TOP row of the same splitter: every panel in it
   minimized leaves a row with nothing to show, and its remembered height would
   otherwise sit above Data and Graphs as an empty band they cannot expand into. */
.e-splitter.top-collapsed > .e-split-bar {
    display: none !important;
    height: 0 !important;
    width: 0 !important;
}

.e-splitter.top-collapsed > .e-pane:first-of-type {
    flex-basis: 0 !important;
    min-height: 0 !important;
    min-width: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
}

/* Same treatment for the OUTER center-vertical splitter when the bottom panel
   is hidden: zero the bottom pane and hide its split bar so the top area fills
   the full height cleanly (panes keep their rounded bottom corners, no residual
   collapse-indicator gap). Mirrors .middle-collapsed above. */
.center-vertical-splitter.bottom-collapsed > .e-split-bar {
    display: none !important;
    height: 0 !important;
}

.center-vertical-splitter.bottom-collapsed > .e-pane:last-of-type {
    flex-basis: 0 !important;
    min-height: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
}

.e-splitter .e-pane[style*="flex-basis: 0"] {
    overflow: hidden !important;
}

/* Pin the bottom pane (problems / console / terminal / connections) to its
   pixel height so it does not grow proportionally when the browser window
   is resized. Without this, Syncfusion treats the configured "170px"
   start size as a ratio and rebalances the panes on every container
   resize, eating into the editor area as the window grows. The user can
   still resize the bottom panel via the splitter handle because Syncfusion
   sets flex-basis directly on drag. */
.center-vertical-splitter > .e-pane:last-of-type {
    flex-grow: 0 !important;
    flex-shrink: 0 !important;
}

.center-vertical-splitter > .e-pane:first-of-type {
    flex-grow: 1 !important;
    flex-shrink: 1 !important;
}

/* The INNER vertical splitter (editor/output row + data/graph row) must always
   fill its container, exactly like the outer center-vertical splitter above.
   Syncfusion keeps the last pane flexible by default, but once BOTH rows have
   been resized to fixed pixel sizes (e.g. the user dragged the inner divider,
   or minimised/restored a row) it marks them static (flex-grow:0). With no
   flexible pane the splitter stops filling, so a large gap opens below the
   data/graph row whenever the container grows - most visibly when the bottom
   panel is hidden. Force the data/graph row to absorb the slack; when that row
   is collapsed the editor row fills instead.

   NB: target the second pane with the sibling combinator (a pane preceded by a
   pane) rather than ":last-of-type" - Syncfusion appends the split bar AFTER the
   panes, so the bar (not the data/graph pane) is the last child of its type. */
.inner-vertical-splitter:not(.middle-collapsed) > .e-pane ~ .e-pane {
    flex-grow: 1 !important;
    flex-shrink: 1 !important;
    /* ...and take the space LEFT OVER by the row above rather than however much
       its own content wants. See .central-row-splitter below for why: with the
       theme's flex-basis:auto this pane's height tracked its content, so loading
       a 75-row grid into Data pushed the editor row from half the area down to a
       third of it. Not !important - Syncfusion writes an inline flex-basis for a
       persisted size and while dragging, and those must still win. */
    flex-basis: 0;
}

/* Floor each inner row at the bottom-panel Min (48px) so neither row can be
   squashed below its 35px header (keeping the minimise/maximise buttons
   reachable). Both rows must also be shrinkable so that when the container is
   squeezed (e.g. dragging the bottom panel up) they shrink down to their 48px
   floors TOGETHER. Without flex-shrink on the editor row it stays static at its
   full size, overflows the shrunken container, and pushes the data/graph row
   off-screen - which looks exactly like the data/graph row being squashed away.
   min-height is the hard floor the flex algorithm respects (the Syncfusion Min
   only constrains the drag, not flex-driven shrink). The middle-collapsed rule
   that zeroes the data/graph row when it is minimised still wins because this
   rule is scoped with :not(.middle-collapsed). */
.inner-vertical-splitter:not(.middle-collapsed) > .e-pane {
    min-height: 48px !important;
    flex-shrink: 1 !important;
}

.inner-vertical-splitter.middle-collapsed > .e-pane:first-of-type {
    flex-grow: 1 !important;
    flex-shrink: 1 !important;
}

/* Panel WIDTH belongs to the user, not to what the panels happen to contain.
   Syncfusion's theme gives a pane with no configured size `flex: 1 1 auto`, so
   its flex base size is its content's max-content width. In the central rows
   that meant the panes were sized by their contents: "reset panel layout" (which
   deliberately clears the stored widths) produced four panels of visibly unequal
   width, and running a script re-laid the row out with no user input at all - a
   15-column grid arriving in Data grew that pane and squeezed Graphs down to its
   minimum, and the same thing crushed the editor when output filled it.
   flex-basis:0 makes flex-grow alone decide, so unsized panes share the row
   evenly and stay put no matter what lands in them.
   Deliberately NOT !important: Syncfusion writes an inline flex-basis for a pane
   with a persisted size and while a divider is being dragged, so user-chosen
   widths keep overriding this. */
.e-splitter.central-row-splitter.e-splitter-horizontal > .e-pane {
    flex-basis: 0;
}

/* A central row must always fill its width, exactly like .inner-vertical-splitter
   fills its height. Dragging a row divider pins BOTH neighbours to pixel widths
   (e-static-pane, flex-grow:0), and Syncfusion frees the last pane again only on a
   WINDOW resize. Any other change to the row's width - dragging the explorer or
   right-dock divider, toggling a side panel - left every pane pinned, so the row
   stopped short of the central area and a dead band opened beside the last panel
   until the splitter was rebuilt. While every pane in the row is pinned, the last
   one takes up the slack, which is what a window resize would have made it do.
   Scoped to the all-pinned state: beside an unpinned pane the slack is already
   absorbed, and a second flexible pane would share it and undo the dragged width.
   The split bars follow the panes in the DOM, so "last pane" is a pane with no
   pane after it rather than :last-of-type. */
.e-splitter.central-row-splitter.e-splitter-horizontal:not(:has(> .e-pane:not(.e-static-pane))) > .e-pane:not(:has(~ .e-pane)) {
    flex-grow: 1 !important;
    flex-shrink: 1 !important;
}

.e-splitter {
    border: none !important;
}

.e-splitter .e-pane {
    overflow: hidden !important;
}

.e-splitter .e-pane > :first-child {
    height: 100%;
}

.e-grid .e-headercell,
.e-grid .e-headercell .e-headercelldiv,
.e-grid .e-headercell .e-headertext {
    font-weight: 700 !important;
    font-size: 11px !important;
    text-transform: none !important;
    letter-spacing: 0 !important;
    background: var(--bg-sidebar) !important;
    color: var(--text-secondary) !important;
}

.e-grid .e-headercell {
    padding: 4px 6px !important;
    height: 26px !important;
    line-height: 1.2 !important;
}

.e-grid th.grid-row-number,
.e-grid td.grid-row-number {
    width: 50px !important;
    min-width: 50px !important;
    max-width: 50px !important;
}

/* The row-number column is chrome, not data: it must read as a row header - the
   same background and text colour as the column headers - on every row, whatever
   state the row is in. Syncfusion stripes, hovers and selects rows through
   .e-rowcell selectors that carry more class weight than a bare column class, so
   every state is pinned here at a weight none of them reach. background and
   background-color are both declared because a later background-color beats a
   background shorthand no matter how the shorthand was written, and the frozen
   first column is stuck with position:sticky - a transparent cell would let the
   scrolled columns show through it. The literal fallbacks keep the column
   readable if a theme token is not resolved when the grid first paints. */
.e-grid .e-gridheader th.e-headercell.grid-row-number,
.e-grid .e-gridcontent tr.e-row td.e-rowcell.grid-row-number,
.e-grid .e-gridcontent tr.e-row.e-altrow td.e-rowcell.grid-row-number,
.e-grid .e-gridcontent tr.e-row:hover td.e-rowcell.grid-row-number,
.e-grid .e-gridcontent tr.e-row.e-active td.e-rowcell.grid-row-number,
.e-grid .e-gridcontent tr.e-row td.e-rowcell.grid-row-number.e-leftfreeze {
    background: var(--bg-sidebar, #f8f8f8) !important;
    background-color: var(--bg-sidebar, #f8f8f8) !important;
    color: var(--text-secondary, #616161) !important;
    font-size: 11px !important;
    font-weight: 700 !important;
}

/* The column a Variables-pane double-click asked for. Syncfusion has no column selection
   of its own for this grid, so the marking is a class the column carries; the same weight
   trick as the row-number column above keeps it visible through striping and hover. */
.e-grid .e-gridheader th.e-headercell.grid-col-highlight {
    background: var(--accent-soft, #e8f0fe) !important;
    background-color: var(--accent-soft, #e8f0fe) !important;
    color: var(--accent-strong, #005fb8) !important;
    box-shadow: inset 0 -2px 0 var(--accent, #005fb8) !important;
}

.e-grid .e-gridcontent tr.e-row td.e-rowcell.grid-col-highlight,
.e-grid .e-gridcontent tr.e-row.e-altrow td.e-rowcell.grid-col-highlight,
.e-grid .e-gridcontent tr.e-row:hover td.e-rowcell.grid-col-highlight {
    background: var(--accent-faint, #e8f0fe) !important;
    background-color: var(--accent-faint, #e8f0fe) !important;
}

.e-grid .e-rowcell {
    font-size: 11.5px !important;
    font-family: var(--font-mono) !important;
    padding: 2px 6px !important;
    line-height: 1.3 !important;
}

.e-tab .e-tab-header {
    border-bottom: 1px solid var(--border-default) !important;
}

.e-tab .e-tab-header .e-toolbar-item .e-tab-text {
    font-size: 11px !important;
    font-weight: 600 !important;
    text-transform: uppercase !important;
    letter-spacing: .4px !important;
    color: var(--text-secondary) !important;
}

.e-tab .e-tab-header .e-toolbar-item.e-active .e-tab-text {
    color: var(--text-primary) !important;
}

/* -- Toolbar buttons used in pane headers --------------------------------- */
.pane-header .tb-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 6px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    border-radius: 4px;
    font-family: var(--font-ui);
    transition: background .12s, color .12s;
}

.pane-header .tb-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* -- Structured output renderers ------------------------------------------ */
.output-text-line {
    font-family: var(--font-mono);
    white-space: pre-wrap;
    line-height: 1.55;
    color: var(--text-primary);
}

.output-blank-line {
    height: 1.2em;
}

.output-error-text {
    color: var(--error-fg);
    font-weight: 500;
}

.output-note-text {
    color: var(--accent);
}

.output-badge {
    display: inline-block;
    font-family: var(--font-ui-small);
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .4px;
    padding: 1px 5px;
    border-radius: 3px;
    margin-right: 6px;
    vertical-align: 1px;
}

.output-badge.warning { background: #fff3cd; color: #856404; }
.output-badge.error { background: #f8d7da; color: #721c24; }
.output-badge.note { background: var(--accent-subtle); color: var(--accent); }
.output-badge.unsupported { background: #e2e3e5; color: #383d41; }
.output-badge.graph { background: #d4edda; color: #155724; }

[data-theme="dark"] .output-badge.warning,
[data-theme="nord"] .output-badge.warning,
[data-theme="solarized-dark"] .output-badge.warning,
[data-theme="abyss"] .output-badge.warning,
[data-theme="high-contrast-dark"] .output-badge.warning { background: rgba(229,192,123,.18); color: #e5c07b; }

[data-theme="dark"] .output-badge.error,
[data-theme="nord"] .output-badge.error,
[data-theme="solarized-dark"] .output-badge.error,
[data-theme="abyss"] .output-badge.error,
[data-theme="high-contrast-dark"] .output-badge.error { background: rgba(244,135,113,.18); color: #f48771; }

[data-theme="dark"] .output-badge.note,
[data-theme="nord"] .output-badge.note,
[data-theme="solarized-dark"] .output-badge.note,
[data-theme="abyss"] .output-badge.note,
[data-theme="high-contrast-dark"] .output-badge.note { background: var(--accent-subtle); color: var(--accent); }

[data-theme="dark"] .output-badge.unsupported,
[data-theme="nord"] .output-badge.unsupported,
[data-theme="solarized-dark"] .output-badge.unsupported,
[data-theme="abyss"] .output-badge.unsupported,
[data-theme="high-contrast-dark"] .output-badge.unsupported { background: rgba(255,255,255,.08); color: var(--text-secondary); }

[data-theme="dark"] .output-badge.graph,
[data-theme="nord"] .output-badge.graph,
[data-theme="solarized-dark"] .output-badge.graph,
[data-theme="abyss"] .output-badge.graph,
[data-theme="high-contrast-dark"] .output-badge.graph { background: rgba(137,209,133,.15); color: #89d185; }

.output-separator {
    border: none;
    border-top: 1px solid var(--border-default);
    margin: 6px 0;
}

.output-table-wrapper {
    margin: 6px 0;
}

.output-table-title {
    font-family: var(--font-mono);
    font-weight: 700;
    color: var(--accent);
    padding: 4px 0 2px;
    font-size: 12.5px;
}

.output-structured-table {
    width: auto;
    border-collapse: collapse;
    font-family: var(--font-mono);
    font-size: var(--output-base-font, 12px);
    line-height: 1.5;
    margin: 2px 0 8px;
}

.output-structured-table th {
    padding: 4px 8px;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-default);
    font-size: calc(var(--output-base-font, 12px) - 1px);
    white-space: nowrap;
}

.output-structured-table td {
    padding: 3px 8px;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-primary);
    white-space: nowrap;
}

.output-structured-table tr:hover td {
    background: var(--bg-hover);
}

.align-left { text-align: left; }
.align-right { text-align: right; }
.align-center { text-align: center; }

.output-table-footer {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-secondary);
    padding: 2px 0;
}

.output-stat-line {
    display: flex;
    gap: 12px;
    font-family: var(--font-mono);
    font-size: 12px;
    line-height: 1.55;
    padding: 1px 0;
}

/*
   A run of statistic and property rows shares ONE label column, sized to the
   widest label in that run. Before this, statistics used `min-width: 200px`
   for their labels and properties used no column at all, so the two never
   lined up with each other, and a label wider than 200px pushed its own value
   further right than its neighbours'. `max-content` sizes the column to the
   longest label present, so short-label and long-label blocks are each
   internally aligned without a magic width.
*/
.output-metric-block {
    display: grid;
    grid-template-columns: max-content max-content;
    column-gap: 16px;
    align-items: baseline;
}

.output-metric-block .output-stat-line,
.output-metric-block .output-property-line {
    display: contents;
}

/* Inside the shared grid the label is the first cell, so its own width rule
   must stand down or it would re-impose the ragged column. */
.output-metric-block .stat-label,
.output-metric-block .prop-label {
    min-width: 0;
    margin-right: 0;
}

/* Numbers read down the column, so they align on their right edge; a text
   value (a sampler name, a link function) reads from the left. */
.output-metric-block .stat-value {
    justify-self: end;
}

.output-metric-block .prop-value {
    justify-self: start;
}

/* A statistic group keeps its own title line, so it spans both tracks and
   nests its own rows rather than joining the outer grid. */
.output-metric-block .output-stat-group {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: max-content max-content;
    column-gap: 16px;
    align-items: baseline;
}

.output-metric-block .output-stat-group-title {
    grid-column: 1 / -1;
}

.stat-label {
    color: var(--text-secondary);
    min-width: 200px;
}

.stat-value {
    color: var(--text-primary);
    font-weight: 500;
}

.output-stat-group {
    margin: 4px 0;
}

.output-stat-group-title {
    font-family: var(--font-mono);
    font-weight: 700;
    color: var(--accent);
    padding: 4px 0 2px;
    font-size: 12.5px;
}

.output-property-line {
    display: flex;
    gap: 12px;
    font-family: var(--font-mono);
    font-size: 12px;
    line-height: 1.55;
    padding: 1px 0;
}

.prop-label {
    color: var(--text-secondary);
    /* Matches .stat-label so a property and a statistic rendered outside a
       grouped block still share a column. */
    min-width: 200px;
}

.prop-value {
    color: var(--text-primary);
}

.output-section {
    margin: 2px 0;
}

.output-section-title {
    font-family: var(--font-mono);
    font-weight: 700;
    color: var(--accent);
    font-size: 12.5px;
    cursor: pointer;
    padding: 4px 0;
    user-select: none;
}

.output-section-title:hover {
    color: var(--accent-hover);
}

.output-graph-inline {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-secondary);
}

.output-connection-status {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    font-size: 13px;
    color: var(--text-tertiary);
    gap: 8px;
}

.output-connection-status button {
    padding: 4px 12px;
    background: var(--accent);
    color: var(--text-inverse);
    border: none;
    border-radius: 4px;
    font-family: var(--font-ui);
    font-size: 12px;
    cursor: pointer;
    margin-left: 8px;
}

.output-connection-status button:hover {
    background: var(--accent-hover);
}

/* -- Output command groups ------------------------------------------------ */

.output-group-highlighted {
    border-left-color: var(--accent);
    background: color-mix(in srgb, var(--accent) 6%, transparent);
}

/* -- Minimized panels restore bar ---------------------------------------- */
.minimized-panels-bar {
    display: flex;
    align-items: center;
    gap: 4px;
    /* Uniform 4px so the left gap equals the inter-button gap (was 8px left vs
       4px between, which made the row look shifted right) and the top/bottom
       gaps match each other and the sides. */
    padding: 4px;
    background: var(--bg-sidebar);
    border-bottom: 1px solid var(--border-default);
    flex-shrink: 0;
}

.minimized-panel-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 16px;
    border: 1px solid rgba(0, 95, 184, 0.25);
    background: linear-gradient(to bottom, var(--bg-surface), var(--accent-subtle));
    color: var(--accent);
    font-family: var(--font-ui);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 5px;
    transition: background .15s, color .15s, border-color .15s, box-shadow .15s;
    white-space: nowrap;
    box-shadow: 0 1px 2px rgba(0, 95, 184, 0.08);
}

.minimized-panel-btn:hover {
    background: linear-gradient(to bottom, var(--accent-subtle), rgba(0, 95, 184, 0.15));
    color: var(--accent-hover);
    border-color: var(--accent);
    box-shadow: 0 1px 4px rgba(0, 95, 184, 0.15);
}

.minimized-panel-btn:active {
    background: var(--accent-subtle);
    box-shadow: none;
}

.minimized-panel-btn svg {
    flex-shrink: 0;
    color: var(--accent);
}

.minimized-panel-btn:hover svg {
    color: var(--accent-hover);
}

/* -- Bottom tabbed panel ------------------------------------------------- */

.bottom-panel {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: var(--bg-surface);
    border-radius: 6px;
    overflow: hidden;
    border: 1.5px solid var(--border-default);
    transition: border-color 0.15s;
}

.bottom-panel:focus-within {
    border-color: var(--accent);
}

.bottom-panel:focus {
    outline: none;
}

.bottom-tab-bar {
    display: flex;
    align-items: center;
    gap: 0;
    border-bottom: 1px solid var(--border-subtle);
    background: var(--bg-sidebar);
    padding: 0 4px;
    flex-shrink: 0;
    height: 30px;
    border-radius: 6px 6px 0 0;
}

.bottom-tab {
    position: relative;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    font-family: var(--font-ui);
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: .5px;
    padding: 4px 12px 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: color .15s, border-color .15s;
}

.bottom-tab:hover {
    color: var(--text-primary);
}

.bottom-tab.active {
    color: var(--text-primary);
    border-bottom-color: var(--accent);
    margin-bottom: -1px;
}

/* The Problems tab carries two kinds of control: the label opens the pane, and each
   count pill switches its severity in or out of the list. They are siblings rather than
   nested, so both are reachable by keyboard. The label is an ordinary tab and draws the
   active marker itself; the group only lays the pills out beside it. */
.bottom-tab-group {
    display: flex;
    align-items: center;
}

/* Matches the padding a tab carries, so the next tab sits as far from the last pill as
   it would from a tab - and a Problems tab with no pills spaces like any other. */
.bottom-tab-group > .bottom-tab-badge:last-child {
    margin-right: 12px;
}

.bottom-tab-group:hover > .bottom-tab {
    color: var(--text-primary);
}

.bottom-tab-badge {
    background: none;
    border: none;
    font-family: var(--font-ui);
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    padding: 0 5px;
    border-radius: 8px;
    min-width: 16px;
    text-align: center;
    line-height: 16px;
    cursor: pointer;
    transition: background .15s, color .15s, box-shadow .15s;
}

.bottom-tab-badge.badge-error {
    background: #f14c4c;
}

.bottom-tab-badge.badge-warning {
    background: var(--warning-fg);
}

.bottom-tab-badge.badge-note {
    background: var(--accent);
}

/* A severity switched off keeps its hue and loses its fill: the pill still reads as that
   severity's count, and reads as one that is not being listed. The count takes the pane's
   own text colour rather than the severity's, because a red count on a washed red fill is
   around 3:1 - the hue survives in the wash and the ring, which carry no information the
   count does not. */
.bottom-tab-badge.is-muted {
    color: var(--text-primary);
}

.bottom-tab-badge.badge-error.is-muted {
    background: color-mix(in srgb, #f14c4c 22%, transparent);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, #f14c4c 55%, transparent);
}

.bottom-tab-badge.badge-warning.is-muted {
    background: color-mix(in srgb, var(--warning-fg) 22%, transparent);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--warning-fg) 55%, transparent);
}

.bottom-tab-badge.badge-note.is-muted {
    background: color-mix(in srgb, var(--accent) 22%, transparent);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 55%, transparent);
}

.bottom-tab-badge:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.bottom-tab-badge + .bottom-tab-badge {
    margin-left: 4px;
}

.bottom-tab-content {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* -- Problems / Console / Terminal card -------------------------------------
   The bottom panel's frame is chrome: the tab strip sits on it and the active
   pane is an inset rounded card, the arrangement the ribbon and the diagram
   shapes palette already use. The right dock carries the same classes and is
   deliberately left on the flush layout. */

.bottom-panel:not(.right-dock) {
    background: var(--bg-page);
}

.bottom-panel:not(.right-dock) .bottom-tab-bar {
    height: 32px;
    padding: 0 8px;
    border-bottom: none;
    background: transparent;
}

.bottom-panel:not(.right-dock) .bottom-tab {
    border-bottom: none;
    padding: 3px 12px 9px;
}

.bottom-panel:not(.right-dock) .bottom-tab.active {
    border-bottom-color: transparent;
    margin-bottom: 0;
}

/* The ribbon's own active marker, matched: 3px tall, inset 8px from each side
   of the tab, and lifted clear of the card edge below it. */
.bottom-panel:not(.right-dock) .bottom-tab.active::after {
    content: "";
    position: absolute;
    left: 8px;
    right: 8px;
    bottom: 3px;
    height: 3px;
    background: var(--accent);
}

.bottom-panel:not(.right-dock) .bottom-tab-content {
    margin: 0 8px 8px;
    border: 1px solid var(--border-default);
    border-radius: 8px;
    background: var(--bg-surface);
    box-shadow: 0 1px 3px rgba(0, 0, 0, .08);
}

/* -- Problems pane ------------------------------------------------------- */

.problems-list {
    flex: 1;
    min-height: 0;
    overflow: auto;
    font-family: var(--font-mono);
    font-size: 12px;
}

.problems-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    color: var(--text-tertiary);
    font-family: var(--font-ui);
    font-size: 13px;
}

/* Shown when the retention cap dropped rows, so the count in the tab badge and the number of
   rows in the grid cannot silently disagree. */
.problems-suppressed {
    padding: 6px 12px;
    color: var(--warning-fg);
    background: var(--bg-hover);
    border-bottom: 1px solid var(--border-subtle);
    font-family: var(--font-ui);
    font-size: 12px;
}

.problems-pane .e-treegrid {
    border: none;
    background: transparent;
    font-family: var(--font-ui);
    font-size: 12px;
}

.problems-pane .e-treegrid .e-gridheader {
    display: none;
}

.problems-pane .e-treegrid .e-gridcontent {
    background: transparent;
}

/* The column header is hidden, so the first row would otherwise start hard
   against the card's inner edge and have its hover and selection fill sliced by
   the corner radius. The gap goes inside the scroller, where it does not
   contend with the inline height Syncfusion measures onto the grid. */
.problems-pane .e-treegrid .e-gridcontent .e-content {
    padding-top: 6px;
    padding-bottom: 6px;
}

/* A diagnostic is the payload of this pane, so it must never be abbreviated.
   Syncfusion's stock rowcell is `white-space: nowrap; text-overflow: ellipsis`,
   which silently truncates a multi-line engine error to a single "...". Let the
   cell wrap and let the row grow to whatever the message needs. */
.problems-pane .e-treegrid .e-rowcell {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    height: auto;
    line-height: 1.45;
    padding-top: 5px;
    padding-bottom: 5px;
    vertical-align: top;
}

/* The row height is content-driven once cells wrap; Syncfusion otherwise pins
   every row to a single line via inline height on the tr. */
.problems-pane .e-treegrid .e-row,
.problems-pane .e-treegrid .e-row .e-rowcell {
    height: auto !important;
}

.problems-pane .e-treegrid .e-row:hover .e-rowcell {
    background: var(--bg-hover);
}

.problems-pane .e-treegrid .e-rowcell.e-focus,
.problems-pane .e-treegrid .e-rowcell.e-focused,
.problems-pane .e-treegrid .e-rowcell:focus {
    border: none !important;
    box-shadow: none !important;
    outline: none !important;
}

.problems-pane .e-treegrid .e-row.e-active .e-rowcell {
    background: var(--accent-subtle) !important;
    border-color: transparent !important;
}

.problem-command-name {
    font-weight: 600;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 12px;
}

.problem-command-summary {
    color: var(--text-secondary);
    margin-left: 6px;
    font-size: 11px;
}

.problem-help-link {
    margin-left: 8px;
    font-size: 11px;
    color: var(--accent);
    text-decoration: underline;
    white-space: nowrap;
}

.problem-help-link:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}

.problem-detail-text {
    color: var(--text-primary);
    word-break: break-word;
}

.problem-repeat-count {
    display: inline-block;
    margin-left: 6px;
    padding: 0 6px;
    border-radius: 8px;
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 600;
    line-height: 16px;
    color: var(--text-secondary);
    background: var(--accent-subtle);
    white-space: nowrap;
}

.problem-line-number {
    color: var(--text-tertiary);
    font-family: var(--font-mono);
    font-size: 11px;
}

.problem-source-tag {
    display: inline-block;
    margin-right: 4px;
    padding: 0 4px;
    border-radius: 3px;
    font-size: 8px;
    font-weight: 700;
    vertical-align: 1px;
    letter-spacing: 0.02em;
}

.problem-source-tag.problem-source-api {
    background: rgba(0, 120, 212, 0.2);
    color: var(--accent-strong, #005fb8);
}

.problem-source-cell {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-tertiary);
}

.problem-source-cell.is-api {
    color: var(--accent-strong, #005fb8);
}

.problem-api-hint {
    margin-left: 4px;
    font-size: 10px;
    font-weight: 500;
    color: var(--text-tertiary);
    font-style: italic;
}

/* -- Console action buttons (Fix / Explain) ----------------------------- */
/* Paired action buttons rendered next to error/warning rows in the         */
/* Problems pane and inline next to error/warning text in the output        */
/* renderer. Shared classes so both surfaces stay visually coherent.        */

/* Top-aligned, not centred: the message wraps to as many lines as it needs and
   the actions stay level with its first line rather than drifting to the middle
   of a tall row. */
.problem-row-content {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 8px;
    width: 100%;
}

.problem-row-message {
    flex: 1 1 auto;
    min-width: 0;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.problem-actions {
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    gap: 4px;
    margin-left: auto;
    flex: 0 0 auto;
}

.problem-action {
    appearance: none;
    border: 1px solid var(--border-default);
    background: var(--bg-surface);
    color: var(--text-primary);
    border-radius: 3px;
    font-family: var(--font-ui-small);
    font-size: 11px;
    font-weight: 500;
    line-height: 1;
    padding: 2px 8px;
    cursor: pointer;
    transition: background-color 80ms linear, border-color 80ms linear, color 80ms linear;
}

.problem-action:hover:not([disabled]) {
    background: var(--bg-hover);
}

.problem-action:active:not([disabled]) {
    background: var(--bg-active);
}

.problem-action:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}

.problem-action[disabled] {
    opacity: 0.55;
    cursor: progress;
}

.problem-action.is-fix {
    border-color: var(--accent);
    color: var(--accent);
}

.problem-action.is-fix:hover:not([disabled]) {
    background: var(--accent-subtle);
}

.problem-action.is-explain {
    color: var(--text-secondary);
}

/* Report action on exception rows (host/API/system faults) - accent-bordered
   like Fix so the one available action reads as the primary one. */
.problem-action.is-report {
    border-color: var(--accent);
    color: var(--accent);
}

.problem-action.is-report:hover:not([disabled]) {
    background: var(--accent-subtle);
}

.output-warning-text,
.output-error-text {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.output-diagnostic-message {
    flex: 1 1 auto;
    min-width: 0;
    word-break: break-word;
}

/* -- Console separator --------------------------------------------------- */

.console-separator {
    border-top: 1px solid var(--border-default);
    margin: 4px 0;
}

/* -- Terminal ------------------------------------------------------------- */

/* The terminal fills a rounded card, so an unpadded first cell is sliced by the
   corner curve. The padding also moves xterm's viewport scrollbar in off the
   card edge. FitAddon reads the host's content box, so the column and row count
   still follows the padding. */
.terminal-host {
    padding: 8px;
}

/* xterm keeps its viewport permanently scrollable, so with nothing to scroll it
   still paints a bar. Unstyled that is a light native scrollbar sitting on the
   terminal's dark ground. */
.terminal-host .xterm-viewport {
    scrollbar-width: thin;
    scrollbar-color: #4a4a4a transparent;
}

.terminal-host .xterm-viewport::-webkit-scrollbar {
    width: 10px;
}

.terminal-host .xterm-viewport::-webkit-scrollbar-track {
    background: transparent;
}

.terminal-host .xterm-viewport::-webkit-scrollbar-thumb {
    background: #4a4a4a;
    background-clip: content-box;
    border: 2px solid transparent;
    border-radius: 5px;
}

.terminal-host .xterm-viewport::-webkit-scrollbar-thumb:hover {
    background: #5a5a5a;
    background-clip: content-box;
}

/* -- Terminal placeholder ------------------------------------------------ */

.terminal-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex: 1;
    color: var(--text-tertiary);
    font-family: var(--font-ui);
    font-size: 13px;
}

/* -- Output style presets ------------------------------------------------- */

.output-content {
    --output-base-font: 12px;
}

.output-text-line,
.output-stat-line,
.output-property-line {
    font-size: var(--output-base-font);
}

.output-structured-table {
    font-size: var(--output-base-font);
}

.output-structured-table th {
    font-size: calc(var(--output-base-font) - 1px);
}

.output-header-text {
    font-size: calc(var(--output-base-font) + 1px);
}

.output-table-title,
.output-stat-group-title,
.output-section-title {
    font-size: calc(var(--output-base-font) + 0.5px);
}

/* -- Modern preset -------------------------------------------------------- */
.output-style-modern .output-table-wrapper {
    background: var(--bg-sidebar);
    border-radius: 10px;
    padding: 14px 16px 10px;
    margin: 6px 0;
}

.output-style-modern .output-table-title {
    font-family: var(--font-ui);
    font-weight: 600;
    color: var(--text-primary);
    font-size: 13px;
    padding: 0 0 8px;
}

.output-style-modern .output-structured-table {
    width: auto;
    border-collapse: separate;
    border-spacing: 0;
    font-family: var(--font-mono);
    background: var(--bg-surface);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 0 0 1px var(--border-subtle);
    margin: 0;
}

.output-style-modern .output-structured-table th {
    background: none;
    border-bottom: 1px solid var(--border-default);
    color: var(--text-tertiary);
    font-family: var(--font-ui);
    font-size: 10.5px;
    font-weight: 500;
    text-transform: none;
    letter-spacing: 0;
    padding: 8px 12px;
}

.output-style-modern .output-structured-table td {
    padding: 6px 12px;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-primary);
}

.output-style-modern .output-structured-table tbody tr:last-child td {
    border-bottom: none;
}

.output-style-modern .output-structured-table tr:hover td {
    background: rgba(0,0,0,.02);
}

.output-style-modern .output-table-footer {
    font-family: var(--font-ui);
    font-size: 11px;
    color: var(--text-tertiary);
    padding: 6px 0 0;
}

.output-style-modern .output-header-text {
    font-family: var(--font-ui);
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
    padding: 4px 0;
}

.output-style-modern .output-stat-group {
    background: var(--bg-sidebar);
    border-radius: 10px;
    padding: 12px 16px;
    margin: 4px 0;
}

.output-style-modern .output-stat-group-title {
    font-family: var(--font-ui);
    font-weight: 600;
    color: var(--text-primary);
    font-size: 13px;
    padding-bottom: 4px;
}

.output-style-modern .output-stat-line {
    font-family: var(--font-mono);
}

.output-style-modern .stat-label {
    color: var(--text-tertiary);
}

.output-style-modern .output-property-line {
    font-family: var(--font-mono);
}

.output-style-modern .prop-label {
    color: var(--text-tertiary);
}

.output-style-modern .output-section-title {
    font-family: var(--font-ui);
    font-weight: 600;
    color: var(--text-primary);
    font-size: 13px;
}

.output-style-modern .output-badge {
    border-radius: 10px;
    font-size: 9px;
    padding: 2px 7px;
}

/* -- Journal preset ------------------------------------------------------- */
.output-style-journal .output-structured-table {
    border-top: 2px solid #2c2c2c;
    border-bottom: 2px solid #2c2c2c;
    width: auto;
}

.output-style-journal .output-structured-table th {
    background: none;
    border-bottom: 1px solid #2c2c2c;
    border-top: none;
    text-transform: none;
    letter-spacing: 0;
    font-weight: 600;
    color: #1a1a1a;
    font-size: var(--output-base-font);
    padding: 5px 12px;
}

.output-style-journal .output-structured-table td {
    border-bottom: none;
    padding: 4px 12px;
    color: #1a1a1a;
}

.output-style-journal .output-structured-table tr:hover td {
    background: none;
}

.output-style-journal .output-table-title {
    color: #1a1a1a;
    font-style: italic;
}

.output-style-journal .output-header-text {
    color: #1a1a1a;
    font-weight: 600;
}

.output-style-journal .output-stat-group-title,
.output-style-journal .output-section-title {
    color: #1a1a1a;
}

.output-style-journal .stat-label {
    color: #444;
}

/* -- Presentation preset -------------------------------------------------- */
.output-style-presentation .output-content {
    --output-base-font: 14px;
}

.output-style-presentation .output-structured-table {
    font-size: 14px;
    border: 2px solid var(--text-primary);
}

.output-style-presentation .output-structured-table th {
    font-size: 13px;
    font-weight: 700;
    background: none;
    color: var(--text-primary);
    border-bottom: 3px solid var(--text-primary);
    text-transform: none;
    letter-spacing: 0;
    padding: 8px 12px;
}

.output-style-presentation .output-structured-table td {
    padding: 6px 12px;
    border-bottom: 2px solid var(--border-default);
    color: #000;
    font-size: 14px;
}

.output-style-presentation .output-structured-table tr:hover td {
    background: rgba(0,0,0,.04);
}

.output-style-presentation .output-text-line {
    font-size: 14px;
    line-height: 1.7;
}

.output-style-presentation .output-header-text {
    font-size: 18px;
    color: #000;
}

.output-style-presentation .output-stat-line {
    font-size: 14px;
}

.output-style-presentation .output-property-line {
    font-size: 14px;
}

.output-style-presentation .output-table-title,
.output-style-presentation .output-stat-group-title,
.output-style-presentation .output-section-title {
    font-size: 15px;
    color: #000;
}

.output-style-presentation .output-badge {
    font-size: 11px;
    padding: 2px 8px;
}

/* -- Vibrant preset ------------------------------------------------------- */
.output-style-vibrant .output-table-wrapper {
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border-default);
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
}

.output-style-vibrant .output-structured-table {
    margin: 0;
}

.output-style-vibrant .output-structured-table th {
    background: var(--accent);
    color: #fff;
    text-transform: none;
    letter-spacing: 0;
    border-bottom: none;
    padding: 7px 10px;
    font-size: var(--output-base-font);
}

.output-style-vibrant .output-structured-table td {
    padding: 5px 10px;
}

.output-style-vibrant .output-structured-table tbody tr:nth-child(even) td {
    background: color-mix(in srgb, var(--accent) 5%, transparent);
}

.output-style-vibrant .output-structured-table tr:hover td {
    background: color-mix(in srgb, var(--accent) 12%, transparent);
}

.output-style-vibrant .output-header-text {
    color: var(--accent);
}

.output-style-vibrant .output-table-title {
    color: var(--accent);
    font-weight: 700;
}

.output-style-vibrant .output-stat-group-title,
.output-style-vibrant .output-section-title {
    color: var(--accent);
}

.output-style-vibrant .output-table-footer {
    padding: 4px 10px;
    background: var(--bg-sidebar);
    border-radius: 0 0 8px 8px;
}

/* -- Corporate preset ----------------------------------------------------- */
.output-style-corporate .output-structured-table {
    border: 1px solid #b0b0b0;
    border-radius: 0;
}

.output-style-corporate .output-structured-table th {
    background: #3b3b3b;
    color: #fff;
    border-bottom: none;
    border-right: 1px solid #555;
    text-transform: none;
    letter-spacing: 0;
    font-size: calc(var(--output-base-font) - 0.5px);
    font-weight: 600;
    padding: 6px 10px;
}

.output-style-corporate .output-structured-table th:last-child {
    border-right: none;
}

.output-style-corporate .output-structured-table td {
    border-bottom: 1px solid #ccc;
    border-right: 1px solid #e0e0e0;
    padding: 4px 10px;
}

.output-style-corporate .output-structured-table td:last-child {
    border-right: none;
}

.output-style-corporate .output-structured-table tbody tr:nth-child(even) td {
    background: #f6f6f6;
}

.output-style-corporate .output-structured-table tr:hover td {
    background: #eef2f7;
}

.output-style-corporate .output-table-wrapper {
    border-radius: 0;
}

.output-style-corporate .output-header-text {
    color: #222;
    font-weight: 700;
}

.output-style-corporate .output-table-title,
.output-style-corporate .output-stat-group-title,
.output-style-corporate .output-section-title {
    color: #222;
    font-weight: 700;
}

.output-style-corporate .stat-label {
    color: #555;
}

.output-style-corporate .output-badge {
    border-radius: 2px;
    font-weight: 600;
}

/* -- Print preset --------------------------------------------------------- */
.output-style-print .output-structured-table {
    border: 1px solid #000;
}

.output-style-print .output-structured-table th {
    background: none;
    color: #000;
    border: 1px solid #000;
    text-transform: none;
    letter-spacing: 0;
    font-weight: 700;
}

.output-style-print .output-structured-table td {
    border: 1px solid #000;
    color: #000;
}

.output-style-print .output-structured-table tr:hover td {
    background: none;
}

.output-style-print .output-header-text {
    color: #000;
    font-weight: 700;
}

.output-style-print .output-table-title,
.output-style-print .output-stat-group-title,
.output-style-print .output-section-title {
    color: #000;
}

.output-style-print .output-badge {
    background: none;
    color: #000;
    border: 1px solid #000;
}

.output-style-print .stat-label {
    color: #333;
}

@media print {
    .output-style-print .output-structured-table tr:hover td {
        background: none !important;
    }
}

/* -- Significance stars --------------------------------------------------- */
.significance-stars {
    color: var(--accent);
    font-weight: 700;
    letter-spacing: -0.5px;
    user-select: none;
}

.significance-legend {
    font-style: italic;
    color: var(--text-tertiary);
    margin-top: 2px;
}

/* -- Zebra striping (enabled per-setting) --------------------------------- */
.output-zebra .output-structured-table tbody tr:nth-child(even) td {
    background: rgba(0,0,0,.02);
}

/* ==========================================================================
   Dark-mode compatibility for output style presets
   Presets that hardcode light-only colors need overrides so content
   remains readable on dark backgrounds.
   ========================================================================== */

/* Generic dark-base: adjust hover tints and zebra from black-alpha to white-alpha */
[data-theme="dark"] .output-style-modern .output-structured-table tr:hover td,
[data-theme="nord"] .output-style-modern .output-structured-table tr:hover td,
[data-theme="solarized-dark"] .output-style-modern .output-structured-table tr:hover td,
[data-theme="abyss"] .output-style-modern .output-structured-table tr:hover td,
[data-theme="high-contrast-dark"] .output-style-modern .output-structured-table tr:hover td {
    background: rgba(255,255,255,.04);
}

[data-theme="dark"] .output-zebra .output-structured-table tbody tr:nth-child(even) td,
[data-theme="nord"] .output-zebra .output-structured-table tbody tr:nth-child(even) td,
[data-theme="solarized-dark"] .output-zebra .output-structured-table tbody tr:nth-child(even) td,
[data-theme="abyss"] .output-zebra .output-structured-table tbody tr:nth-child(even) td,
[data-theme="high-contrast-dark"] .output-zebra .output-structured-table tbody tr:nth-child(even) td {
    background: rgba(255,255,255,.03);
}

/* Journal - replace hardcoded dark foreground/borders with theme-aware values */
[data-theme="dark"] .output-style-journal .output-structured-table,
[data-theme="nord"] .output-style-journal .output-structured-table,
[data-theme="solarized-dark"] .output-style-journal .output-structured-table,
[data-theme="abyss"] .output-style-journal .output-structured-table,
[data-theme="high-contrast-dark"] .output-style-journal .output-structured-table {
    border-top-color: var(--text-secondary);
    border-bottom-color: var(--text-secondary);
}

[data-theme="dark"] .output-style-journal .output-structured-table th,
[data-theme="nord"] .output-style-journal .output-structured-table th,
[data-theme="solarized-dark"] .output-style-journal .output-structured-table th,
[data-theme="abyss"] .output-style-journal .output-structured-table th,
[data-theme="high-contrast-dark"] .output-style-journal .output-structured-table th {
    border-bottom-color: var(--text-secondary);
    color: var(--text-primary);
}

[data-theme="dark"] .output-style-journal .output-structured-table td,
[data-theme="nord"] .output-style-journal .output-structured-table td,
[data-theme="solarized-dark"] .output-style-journal .output-structured-table td,
[data-theme="abyss"] .output-style-journal .output-structured-table td,
[data-theme="high-contrast-dark"] .output-style-journal .output-structured-table td {
    color: var(--text-primary);
}

[data-theme="dark"] .output-style-journal .output-table-title,
[data-theme="dark"] .output-style-journal .output-header-text,
[data-theme="dark"] .output-style-journal .output-stat-group-title,
[data-theme="dark"] .output-style-journal .output-section-title,
[data-theme="nord"] .output-style-journal .output-table-title,
[data-theme="nord"] .output-style-journal .output-header-text,
[data-theme="nord"] .output-style-journal .output-stat-group-title,
[data-theme="nord"] .output-style-journal .output-section-title,
[data-theme="solarized-dark"] .output-style-journal .output-table-title,
[data-theme="solarized-dark"] .output-style-journal .output-header-text,
[data-theme="solarized-dark"] .output-style-journal .output-stat-group-title,
[data-theme="solarized-dark"] .output-style-journal .output-section-title,
[data-theme="abyss"] .output-style-journal .output-table-title,
[data-theme="abyss"] .output-style-journal .output-header-text,
[data-theme="abyss"] .output-style-journal .output-stat-group-title,
[data-theme="abyss"] .output-style-journal .output-section-title,
[data-theme="high-contrast-dark"] .output-style-journal .output-table-title,
[data-theme="high-contrast-dark"] .output-style-journal .output-header-text,
[data-theme="high-contrast-dark"] .output-style-journal .output-stat-group-title,
[data-theme="high-contrast-dark"] .output-style-journal .output-section-title {
    color: var(--text-primary);
}

[data-theme="dark"] .output-style-journal .stat-label,
[data-theme="nord"] .output-style-journal .stat-label,
[data-theme="solarized-dark"] .output-style-journal .stat-label,
[data-theme="abyss"] .output-style-journal .stat-label,
[data-theme="high-contrast-dark"] .output-style-journal .stat-label {
    color: var(--text-secondary);
}

/* Presentation - replace hardcoded #000 foreground */
[data-theme="dark"] .output-style-presentation .output-structured-table td,
[data-theme="dark"] .output-style-presentation .output-header-text,
[data-theme="dark"] .output-style-presentation .output-table-title,
[data-theme="dark"] .output-style-presentation .output-stat-group-title,
[data-theme="dark"] .output-style-presentation .output-section-title,
[data-theme="nord"] .output-style-presentation .output-structured-table td,
[data-theme="nord"] .output-style-presentation .output-header-text,
[data-theme="nord"] .output-style-presentation .output-table-title,
[data-theme="nord"] .output-style-presentation .output-stat-group-title,
[data-theme="nord"] .output-style-presentation .output-section-title,
[data-theme="solarized-dark"] .output-style-presentation .output-structured-table td,
[data-theme="solarized-dark"] .output-style-presentation .output-header-text,
[data-theme="solarized-dark"] .output-style-presentation .output-table-title,
[data-theme="solarized-dark"] .output-style-presentation .output-stat-group-title,
[data-theme="solarized-dark"] .output-style-presentation .output-section-title,
[data-theme="abyss"] .output-style-presentation .output-structured-table td,
[data-theme="abyss"] .output-style-presentation .output-header-text,
[data-theme="abyss"] .output-style-presentation .output-table-title,
[data-theme="abyss"] .output-style-presentation .output-stat-group-title,
[data-theme="abyss"] .output-style-presentation .output-section-title,
[data-theme="high-contrast-dark"] .output-style-presentation .output-structured-table td,
[data-theme="high-contrast-dark"] .output-style-presentation .output-header-text,
[data-theme="high-contrast-dark"] .output-style-presentation .output-table-title,
[data-theme="high-contrast-dark"] .output-style-presentation .output-stat-group-title,
[data-theme="high-contrast-dark"] .output-style-presentation .output-section-title {
    color: var(--text-primary);
}

[data-theme="dark"] .output-style-presentation .output-structured-table tr:hover td,
[data-theme="nord"] .output-style-presentation .output-structured-table tr:hover td,
[data-theme="solarized-dark"] .output-style-presentation .output-structured-table tr:hover td,
[data-theme="abyss"] .output-style-presentation .output-structured-table tr:hover td,
[data-theme="high-contrast-dark"] .output-style-presentation .output-structured-table tr:hover td {
    background: rgba(255,255,255,.04);
}

/* Corporate - replace hardcoded light foreground/background colors */
[data-theme="dark"] .output-style-corporate .output-structured-table,
[data-theme="nord"] .output-style-corporate .output-structured-table,
[data-theme="solarized-dark"] .output-style-corporate .output-structured-table,
[data-theme="abyss"] .output-style-corporate .output-structured-table,
[data-theme="high-contrast-dark"] .output-style-corporate .output-structured-table {
    border-color: var(--border-default);
}

[data-theme="dark"] .output-style-corporate .output-structured-table th,
[data-theme="nord"] .output-style-corporate .output-structured-table th,
[data-theme="solarized-dark"] .output-style-corporate .output-structured-table th,
[data-theme="abyss"] .output-style-corporate .output-structured-table th,
[data-theme="high-contrast-dark"] .output-style-corporate .output-structured-table th {
    background: var(--bg-active);
    color: var(--text-primary);
    border-right-color: var(--border-default);
}

[data-theme="dark"] .output-style-corporate .output-structured-table td,
[data-theme="nord"] .output-style-corporate .output-structured-table td,
[data-theme="solarized-dark"] .output-style-corporate .output-structured-table td,
[data-theme="abyss"] .output-style-corporate .output-structured-table td,
[data-theme="high-contrast-dark"] .output-style-corporate .output-structured-table td {
    border-bottom-color: var(--border-subtle);
    border-right-color: var(--border-subtle);
}

[data-theme="dark"] .output-style-corporate .output-structured-table tbody tr:nth-child(even) td,
[data-theme="nord"] .output-style-corporate .output-structured-table tbody tr:nth-child(even) td,
[data-theme="solarized-dark"] .output-style-corporate .output-structured-table tbody tr:nth-child(even) td,
[data-theme="abyss"] .output-style-corporate .output-structured-table tbody tr:nth-child(even) td,
[data-theme="high-contrast-dark"] .output-style-corporate .output-structured-table tbody tr:nth-child(even) td {
    background: rgba(255,255,255,.03);
}

[data-theme="dark"] .output-style-corporate .output-structured-table tr:hover td,
[data-theme="nord"] .output-style-corporate .output-structured-table tr:hover td,
[data-theme="solarized-dark"] .output-style-corporate .output-structured-table tr:hover td,
[data-theme="abyss"] .output-style-corporate .output-structured-table tr:hover td,
[data-theme="high-contrast-dark"] .output-style-corporate .output-structured-table tr:hover td {
    background: rgba(255,255,255,.06);
}

[data-theme="dark"] .output-style-corporate .output-header-text,
[data-theme="dark"] .output-style-corporate .output-table-title,
[data-theme="dark"] .output-style-corporate .output-stat-group-title,
[data-theme="dark"] .output-style-corporate .output-section-title,
[data-theme="nord"] .output-style-corporate .output-header-text,
[data-theme="nord"] .output-style-corporate .output-table-title,
[data-theme="nord"] .output-style-corporate .output-stat-group-title,
[data-theme="nord"] .output-style-corporate .output-section-title,
[data-theme="solarized-dark"] .output-style-corporate .output-header-text,
[data-theme="solarized-dark"] .output-style-corporate .output-table-title,
[data-theme="solarized-dark"] .output-style-corporate .output-stat-group-title,
[data-theme="solarized-dark"] .output-style-corporate .output-section-title,
[data-theme="abyss"] .output-style-corporate .output-header-text,
[data-theme="abyss"] .output-style-corporate .output-table-title,
[data-theme="abyss"] .output-style-corporate .output-stat-group-title,
[data-theme="abyss"] .output-style-corporate .output-section-title,
[data-theme="high-contrast-dark"] .output-style-corporate .output-header-text,
[data-theme="high-contrast-dark"] .output-style-corporate .output-table-title,
[data-theme="high-contrast-dark"] .output-style-corporate .output-stat-group-title,
[data-theme="high-contrast-dark"] .output-style-corporate .output-section-title {
    color: var(--text-primary);
}

[data-theme="dark"] .output-style-corporate .stat-label,
[data-theme="nord"] .output-style-corporate .stat-label,
[data-theme="solarized-dark"] .output-style-corporate .stat-label,
[data-theme="abyss"] .output-style-corporate .stat-label,
[data-theme="high-contrast-dark"] .output-style-corporate .stat-label {
    color: var(--text-secondary);
}

/* Print - replace hardcoded #000 with theme tokens */
[data-theme="dark"] .output-style-print .output-structured-table,
[data-theme="nord"] .output-style-print .output-structured-table,
[data-theme="solarized-dark"] .output-style-print .output-structured-table,
[data-theme="abyss"] .output-style-print .output-structured-table,
[data-theme="high-contrast-dark"] .output-style-print .output-structured-table {
    border-color: var(--text-secondary);
}

[data-theme="dark"] .output-style-print .output-structured-table th,
[data-theme="dark"] .output-style-print .output-structured-table td,
[data-theme="nord"] .output-style-print .output-structured-table th,
[data-theme="nord"] .output-style-print .output-structured-table td,
[data-theme="solarized-dark"] .output-style-print .output-structured-table th,
[data-theme="solarized-dark"] .output-style-print .output-structured-table td,
[data-theme="abyss"] .output-style-print .output-structured-table th,
[data-theme="abyss"] .output-style-print .output-structured-table td,
[data-theme="high-contrast-dark"] .output-style-print .output-structured-table th,
[data-theme="high-contrast-dark"] .output-style-print .output-structured-table td {
    color: var(--text-primary);
    border-color: var(--text-secondary);
}

[data-theme="dark"] .output-style-print .output-header-text,
[data-theme="dark"] .output-style-print .output-table-title,
[data-theme="dark"] .output-style-print .output-stat-group-title,
[data-theme="dark"] .output-style-print .output-section-title,
[data-theme="nord"] .output-style-print .output-header-text,
[data-theme="nord"] .output-style-print .output-table-title,
[data-theme="nord"] .output-style-print .output-stat-group-title,
[data-theme="nord"] .output-style-print .output-section-title,
[data-theme="solarized-dark"] .output-style-print .output-header-text,
[data-theme="solarized-dark"] .output-style-print .output-table-title,
[data-theme="solarized-dark"] .output-style-print .output-stat-group-title,
[data-theme="solarized-dark"] .output-style-print .output-section-title,
[data-theme="abyss"] .output-style-print .output-header-text,
[data-theme="abyss"] .output-style-print .output-table-title,
[data-theme="abyss"] .output-style-print .output-stat-group-title,
[data-theme="abyss"] .output-style-print .output-section-title,
[data-theme="high-contrast-dark"] .output-style-print .output-header-text,
[data-theme="high-contrast-dark"] .output-style-print .output-table-title,
[data-theme="high-contrast-dark"] .output-style-print .output-stat-group-title,
[data-theme="high-contrast-dark"] .output-style-print .output-section-title {
    color: var(--text-primary);
}

[data-theme="dark"] .output-style-print .output-badge,
[data-theme="nord"] .output-style-print .output-badge,
[data-theme="solarized-dark"] .output-style-print .output-badge,
[data-theme="abyss"] .output-style-print .output-badge,
[data-theme="high-contrast-dark"] .output-style-print .output-badge {
    color: var(--text-primary);
    border-color: var(--text-secondary);
}

[data-theme="dark"] .output-style-print .stat-label,
[data-theme="nord"] .output-style-print .stat-label,
[data-theme="solarized-dark"] .output-style-print .stat-label,
[data-theme="abyss"] .output-style-print .stat-label,
[data-theme="high-contrast-dark"] .output-style-print .stat-label {
    color: var(--text-secondary);
}

/* -- Output element selection --------------------------------------------- */
.output-element-wrapper {
    position: relative;
    border: 1px solid transparent;
    border-radius: 4px;
    margin: 0 -4px;
    padding: 0 4px;
    transition: border-color .12s, background-color .12s;
    cursor: pointer;
}

.output-element-wrapper:hover {
    border-color: var(--border-default);
    background: rgba(0,0,0,.015);
}

.output-element-wrapper.output-element-selected {
    border-color: var(--accent);
    background: color-mix(in srgb, var(--accent) 5%, transparent);
}

.output-copy-btn {
    position: absolute;
    top: 4px;
    /* The group can be wider than the pane; anchor to the fold so the button does
       not sit off-screen at the far end of the widest row. Both terms are in the
       group's padding box, which is why this reads --output-fold and not 100cqi. */
    right: max(4px, calc(100% - var(--output-fold, 100cqi) - 4px));
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    background: var(--bg-surface);
    border: 1px solid var(--accent);
    border-radius: 4px;
    color: var(--accent);
    font-family: var(--font-ui-small);
    font-size: 10px;
    font-weight: 600;
    cursor: pointer;
    z-index: 10;
    box-shadow: 0 1px 4px rgba(0,0,0,.1);
    transition: background .1s, color .1s;
    opacity: 0;
    pointer-events: none;
}

.output-element-selected .output-copy-btn {
    opacity: 1;
    pointer-events: auto;
}

.output-copy-btn:hover {
    background: var(--accent);
    color: #fff;
}

.output-copy-btn svg {
    flex-shrink: 0;
}

/* -- Command group source indicator --------------------------------------- */
.output-group-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 2px 4px 1px;
    font-family: var(--font-ui-small);
    font-size: 10px;
    color: var(--text-tertiary);
    cursor: pointer;
    user-select: none;
    border-radius: 3px;
    transition: color .1s, background .1s;
}

.output-group-header:hover {
    color: var(--accent);
    background: var(--bg-hover);
}

.output-group-header svg {
    opacity: .5;
}

.output-group-header:hover svg {
    opacity: 1;
}

.output-command-group {
    /* Chrome that survives the -4px bleed each side: the transparent left border. */
    --output-fold: calc(100cqi - 2px);
    border-left: 2px solid transparent;
    transition: border-color 0.15s, background-color 0.15s;
    padding-left: 4px;
    position: relative;
    cursor: pointer;
    border-radius: 4px;
    margin: 0 -4px;
    padding: 2px 4px;
}

.output-command-group:hover {
    background: rgba(0,0,0,.015);
}

.output-group-selected {
    background: rgba(0,0,0,.02);
    border-left-color: transparent;
    outline: 1.5px dotted var(--text-tertiary);
    outline-offset: -1px;
}

.output-group-selected .output-copy-btn {
    opacity: 1;
    pointer-events: auto;
}

/* -- Settings dialog ------------------------------------------------------ */
.settings-dialog {
    border-radius: 10px !important;
    overflow: hidden;
}

.settings-dialog .e-dlg-header-content {
    padding: 12px 20px !important;
    background: var(--bg-sidebar) !important;
    border-bottom: 1px solid var(--border-default) !important;
}

.settings-dialog .e-dlg-header {
    font-family: var(--font-ui) !important;
    font-size: 14px !important;
    font-weight: 600 !important;
}

.settings-dialog .e-dlg-content {
    padding: 0 !important;
    overflow: hidden !important;
}

.settings-dialog .e-footer-content {
    padding: 10px 20px !important;
    border-top: 1px solid var(--border-default) !important;
    background: var(--bg-sidebar) !important;
}

.settings-dialog .e-tab {
    height: 100%;
}

.settings-dialog .e-tab .e-tab-header {
    background: var(--bg-sidebar) !important;
    border-right: 1px solid var(--border-default) !important;
    border-bottom: none !important;
    /* Fit the longest label ("Artificial Intelligence") with a generous floor so
       a wider UI font or OS text-scaling can't clip it; max-content lets the rail
       grow past the floor when a font is wider still, capped so it can't run away. */
    min-width: 220px;
    width: max-content !important;
    max-width: 320px;
    padding-top: 8px;
}

.settings-dialog .e-tab .e-tab-header .e-toolbar-item .e-tab-text {
    text-transform: none !important;
    letter-spacing: 0 !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    white-space: nowrap !important;
    overflow: visible !important;
}

.settings-dialog .e-tab .e-tab-header .e-toolbar-item.e-active {
    background: var(--bg-surface) !important;
}

.settings-dialog .e-tab .e-content {
    padding: 0 !important;
    overflow-y: auto;
    height: 100%;
}

.settings-dialog .e-tab .e-content > .e-item {
    height: 100%;
    overflow-y: auto;
    padding: 0;
}

.settings-switch {
    appearance: none;
    -webkit-appearance: none;
    box-sizing: border-box;
    flex: 0 0 auto;
    inline-size: 40px;
    block-size: 22px;
    margin-block: 1px 0;
    margin-inline: 0;
    border: 1px solid var(--border-strong, #8c959f);
    border-radius: 999px;
    background: var(--bg-hover, #eaeef2);
    cursor: pointer;
    position: relative;
    transition: background-color 120ms ease, border-color 120ms ease;
}

.settings-switch::after {
    content: "";
    position: absolute;
    inset-block-start: 2px;
    inset-inline-start: 2px;
    inline-size: 16px;
    block-size: 16px;
    border-radius: 50%;
    background: var(--bg-surface, #fff);
    box-shadow: 0 1px 2px rgb(0 0 0 / 25%);
    transition: transform 120ms ease;
}

.settings-switch:checked {
    border-color: var(--primary, #1565c0);
    background: var(--primary, #1565c0);
}

.settings-switch:checked::after {
    transform: translateX(18px);
}

[dir="rtl"] .settings-switch:checked::after {
    transform: translateX(-18px);
}

.settings-switch:focus-visible {
    outline: 2px solid var(--focus-ring, #005fcc);
    outline-offset: 2px;
}

.settings-switch:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.settings-segmented-control {
    display: inline-flex;
    overflow: hidden;
    border: 1px solid var(--border-default, #d0d7de);
    border-radius: 6px;
    background: var(--bg-surface, #fff);
}

.settings-segmented-control label {
    cursor: pointer;
    position: relative;
}

.settings-segmented-control input {
    position: absolute;
    opacity: 0;
}

.settings-segmented-control span {
    display: block;
    min-inline-size: 32px;
    padding: 4px 8px;
    border-inline-end: 1px solid var(--border-default, #d0d7de);
    text-align: center;
}

.settings-segmented-control label:last-child span {
    border-inline-end: 0;
}

.settings-segmented-control input:checked + span {
    background: var(--primary, #1565c0);
    color: var(--on-primary, #fff);
    font-weight: 600;
}

.settings-segmented-control input:focus-visible + span {
    outline: 2px solid var(--focus-ring, #005fcc);
    outline-offset: -2px;
}

@media (prefers-reduced-motion: reduce) {
    .settings-switch,
    .settings-switch::after {
        transition: none;
    }
}

@media (forced-colors: active) {
    .settings-switch {
        forced-color-adjust: none;
        border-color: CanvasText;
        background: Canvas;
    }

    .settings-switch::after {
        background: CanvasText;
    }

    .settings-switch:checked {
        background: Highlight;
        border-color: Highlight;
    }

    .settings-segmented-control input:checked + span {
        background: Highlight;
        color: HighlightText;
    }
}

/* -- Shared dialog chrome (overlay + plain-div dialogs) -------------------
   Used by GlobalResetDialog and ReportIssueDialog which render a backdrop
   plus a card via raw <div> rather than Syncfusion's <SfDialog>. Lives in
   the global stylesheet so the classes match across components (Blazor's
   scoped CSS would otherwise rewrite selectors per .razor file). */
.settings-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.settings-overlay > .settings-dialog {
    background: var(--bg-default, #fff);
    border-radius: 8px;
    box-shadow: 0 10px 32px rgba(0, 0, 0, 0.25);
    max-width: 540px;
    width: calc(100vw - 48px);
    max-height: calc(100vh - 48px);
    display: flex;
    flex-direction: column;
    color: var(--text-primary, #1a1a1a);
    overflow: hidden;
}

.settings-dialog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    background: var(--bg-sidebar, #f5f5f5);
    border-bottom: 1px solid var(--border-default, #d0d7de);
}

.settings-dialog-title {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    font-family: var(--font-ui);
}

.settings-dialog-close {
    background: none;
    border: none;
    font-size: 20px;
    line-height: 1;
    color: var(--text-secondary, #666);
    cursor: pointer;
    padding: 0 4px;
    border-radius: 3px;
}

.settings-dialog-close:hover {
    background: var(--bg-hover, #eee);
    color: var(--text-primary, #1a1a1a);
}

.settings-dialog-body {
    padding: 16px 20px;
    overflow-y: auto;
    font-size: 13px;
    line-height: 1.5;
}

.settings-dialog-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 10px 20px;
    background: var(--bg-sidebar, #f5f5f5);
    border-top: 1px solid var(--border-default, #d0d7de);
}

/* -- Shared dialog buttons -----------------------------------------------
   Normal-sized action buttons used in dialog footers and inline settings
   actions (e.g. "Reset SHAZAM to defaults", "Check for updates"). Replaces
   the earlier scoped-only .settings-btn-danger so the same class works in
   any component. */
.settings-btn {
    box-sizing: border-box;
    /* Fixed height + line-height keeps primary/secondary/danger variants
       perfectly aligned even when the variant bumps font-weight to 600. */
    height: 32px;
    line-height: 18px;
    padding: 6px 14px;
    border-radius: 3px;
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    border: 1px solid var(--border-default, #d0d7de);
    background: var(--bg-default, #fff);
    color: var(--text-primary, #1a1a1a);
    transition: background .12s, border-color .12s, opacity .12s;
    min-width: 90px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
}

.settings-btn:hover:not(:disabled) {
    background: var(--bg-hover, #f0f0f0);
}

.settings-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Variants share the base .settings-btn box (height, padding, font-weight,
   line-height) and only differ in colour. The danger variant uses an orange
   border + orange text on a neutral background so it sits as a visual sibling
   of the default button rather than a solid-fill alert; hover fills it. */
.settings-btn-primary {
    background: #005fb8;
    color: #fff;
    border-color: #005fb8;
}

.settings-btn-primary:hover:not(:disabled) {
    background: #106ebe;
    border-color: #106ebe;
}

.settings-btn-secondary {
    background: var(--bg-default, #fff);
    color: var(--text-primary, #1a1a1a);
    border-color: var(--border-default, #d0d7de);
}

.settings-btn-secondary:hover:not(:disabled) {
    background: var(--bg-hover, #f0f0f0);
}

.settings-btn-danger {
    background: var(--bg-default, #fff);
    color: #9a3412;
    border-color: #c2410c;
}

.settings-btn-danger:hover:not(:disabled) {
    background: #c2410c;
    color: #fff;
    border-color: #9a3412;
}

/* Inline status line under the Maintenance buttons in the Settings dialog
   (rendered by SettingsDialog.razor after a "Check for updates" click). */
.settings-update-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    margin-top: 4px;
    background: var(--bg-sidebar, #f5f5f5);
    border: 1px solid var(--border-default, #d0d7de);
    border-radius: 3px;
    font-size: 12px;
    color: var(--text-secondary, #666);
}

.settings-update-status.settings-update-available {
    background: #e6f0fb;
    border-color: #005fb8;
    color: #003e7a;
}

/* Shared spinner used by GlobalResetDialog and ReportIssueDialog progress
   panes. */
.reset-spinner {
    width: 32px;
    height: 32px;
    margin: 0 auto 16px auto;
    border: 3px solid var(--border-default, #d0d7de);
    border-top-color: #005fb8;
    border-radius: 50%;
    animation: reset-spinner-rotate 1s linear infinite;
}

@keyframes reset-spinner-rotate {
    to { transform: rotate(360deg); }
}

/* -- Output style panel --------------------------------------------------- */
.output-style-panel {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 16px 20px;
    overflow-y: auto;
    height: 100%;
}

.style-section-label {
    font-family: var(--font-ui-small);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .6px;
    color: var(--text-secondary);
    margin: 0;
}

.style-preset-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}

.style-preset-card {
    border: 2px solid var(--border-default);
    border-radius: 6px;
    padding: 8px 10px;
    cursor: pointer;
    transition: border-color .15s, background .15s, box-shadow .15s;
    background: var(--bg-surface);
}

.style-preset-card:hover {
    border-color: var(--accent);
    background: var(--accent-subtle);
}

.style-preset-card.selected {
    border-color: var(--accent);
    background: var(--accent-subtle);
    box-shadow: 0 0 0 1px var(--accent);
}

.style-preset-card-name {
    font-family: var(--font-ui);
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.35;
    margin-block-end: 4px;
}

.style-preset-card-desc {
    font-family: var(--font-ui);
    font-size: 12px;
    font-weight: 400;
    color: var(--text-secondary);
    line-height: 1.4;
}

.graph-theme-card {
    padding: 7px 9px 8px;
}

.graph-theme-preview {
    block-size: 48px;
    box-sizing: border-box;
    inline-size: min(100%, 160px);
    margin-block-end: 7px;
    margin-inline: auto;
    overflow: hidden;
    border: 1px solid color-mix(in srgb, var(--graph-theme-preview-ink) 22%, transparent);
    border-radius: 4px;
    background: var(--graph-theme-preview-background);
}

.graph-theme-preview svg {
    display: block;
    block-size: 100%;
    inline-size: 100%;
}

.graph-theme-preview__grid,
.graph-theme-preview__axis,
.graph-theme-preview__series,
.graph-theme-preview__series-secondary {
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.graph-theme-preview__grid {
    stroke: var(--graph-theme-preview-ink);
    stroke-opacity: .18;
    stroke-width: .75;
}

.graph-theme-preview__grid.is-dotted {
    stroke-dasharray: 1 3;
}

.graph-theme-preview__grid.is-dashed {
    stroke-dasharray: 4 3;
}

.graph-theme-preview__grid.is-hidden {
    display: none;
}

.graph-theme-preview__axis {
    stroke: var(--graph-theme-preview-ink);
    stroke-opacity: .6;
    stroke-width: 1;
}

.graph-theme-preview__series {
    stroke: var(--graph-theme-preview-series);
    stroke-width: 2.25;
}

.graph-theme-preview__series-secondary {
    stroke: var(--graph-theme-preview-series-secondary);
    stroke-width: 1.5;
}

.graph-theme-preview--thin-line .graph-theme-preview__series {
    stroke-width: 1.5;
}

.graph-theme-preview--wide-line .graph-theme-preview__series {
    stroke-width: 3;
}

.graph-theme-preview__marker {
    fill: var(--graph-theme-preview-background);
    stroke: var(--graph-theme-preview-series);
    stroke-width: 1.5;
}

.graph-theme-preview--small-markers .graph-theme-preview__marker {
    r: 1.5;
}

.graph-theme-preview--large-markers .graph-theme-preview__marker {
    r: 3;
}

.graph-theme-preview__label {
    fill: var(--graph-theme-preview-ink);
    font-size: 8px;
}

.graph-theme-preview--sans-serif .graph-theme-preview__label {
    font-family: Arial, Helvetica, sans-serif;
}

.graph-theme-preview--serif .graph-theme-preview__label {
    font-family: "Times New Roman", Times, serif;
}

.graph-theme-preview--monospace .graph-theme-preview__label {
    font-family: "Courier New", Courier, monospace;
}

@media (forced-colors: active) {
    .graph-theme-preview {
        border-color: CanvasText;
        background: Canvas;
    }

    .graph-theme-preview__grid,
    .graph-theme-preview__axis,
    .graph-theme-preview__series-secondary {
        stroke: CanvasText;
    }

    .graph-theme-preview__series,
    .graph-theme-preview__marker {
        stroke: Highlight;
    }

    .graph-theme-preview__marker {
        fill: Canvas;
    }

    .graph-theme-preview__label {
        fill: CanvasText;
    }
}

.graph-engine-card {
    appearance: none;
    inline-size: 100%;
    color: inherit;
    font: inherit;
    text-align: start;
}

.graph-engine-card:focus-visible {
    outline: 2px solid var(--focus-ring);
    outline-offset: 2px;
}

.graph-engine-card-header {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 2px;
}

.graph-engine-card .style-preset-card-name {
    flex: 1;
    margin-bottom: 0;
}

.graph-engine-icon {
    position: relative;
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    inline-size: 24px;
    block-size: 24px;
    border-radius: 5px;
}

.graph-engine-icon svg {
    display: block;
    inline-size: 20px;
    block-size: 20px;
}

.graph-engine-icon--plotly {
    color: #7a76ff;
    background: color-mix(in srgb, #7a76ff 15%, var(--bg-surface));
}

.graph-engine-icon--scottplot {
    color: #6f247f;
    background: transparent;
}

.graph-engine-icon--gnuplot {
    color: #76426f;
    background: color-mix(in srgb, #a06195 15%, var(--bg-surface));
}

.graph-engine-icon-wordmark {
    position: absolute;
    inset-block-end: 1px;
    inset-inline-end: 1px;
    padding-inline: 1px;
    border-radius: 2px;
    background: var(--bg-surface);
    color: currentColor;
    font-family: var(--font-mono);
    font-size: 6px;
    font-weight: 700;
    letter-spacing: -.4px;
    line-height: 1.1;
}

.graph-engine-card-unavailable {
    color: var(--error-fg);
    font-family: var(--font-ui);
    font-size: 9px;
    font-weight: 600;
    letter-spacing: .3px;
    text-transform: uppercase;
}

@media (forced-colors: active) {
    .graph-engine-icon {
        color: CanvasText;
        border: 1px solid CanvasText;
        background: Canvas;
    }
}

.style-preview-container {
    border: 1px solid var(--border-default);
    border-radius: 6px;
    padding: 10px 14px;
    background: var(--bg-surface);
    overflow: hidden;
    flex: 1 1 auto;
}

.style-preview-container .output-structured-table {
    font-size: 11px;
}

.style-preview-container .output-structured-table th {
    font-size: 10px;
    padding: 3px 6px;
}

.style-preview-container .output-structured-table td {
    padding: 2px 6px;
}

.style-preview-container .output-table-title {
    font-size: 11px;
    padding: 2px 0;
}

.style-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 20px;
    flex-shrink: 0;
}

.style-control-group {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.style-control-label {
    font-family: var(--font-ui);
    font-size: 10.5px;
    font-weight: 500;
    color: var(--text-secondary);
}

.style-control-row {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 28px;
}

.settings-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 300px;
    color: var(--text-tertiary);
    font-family: var(--font-ui);
    font-size: 14px;
    gap: 8px;
}

/* -- Manage workspaces dialog --------------------------------------------- */
.manage-workspaces-dialog .e-dlg-content {
    padding: 12px 18px 8px !important;
}

.manage-ws-intro {
    margin: 0 0 12px;
    font-family: var(--font-ui);
    font-size: 12px;
    line-height: 1.45;
    color: var(--text-secondary);
}

.manage-ws-error {
    margin: 0 0 8px;
    font-family: var(--font-ui);
    font-size: 12px;
    color: var(--error, #c62828);
}

.manage-ws-loading,
.manage-ws-empty {
    margin: 8px 0;
    font-family: var(--font-ui);
    font-size: 12px;
    color: var(--text-tertiary);
}

.manage-ws-list {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: min(520px, 65vh);
    overflow-y: auto;
    border: 1px solid var(--border-default);
    border-radius: 6px;
    background: var(--bg-surface);
}

.manage-ws-item {
    border-bottom: 1px solid var(--border-subtle, var(--border-default));
}

.manage-ws-item:last-child {
    border-bottom: none;
}

.manage-ws-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px 8px 6px;
    font-family: var(--font-ui);
    font-size: 12px;
}

.manage-ws-expand {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
}

.manage-ws-expand:hover {
    background: var(--bg-hover);
    color: var(--accent);
}

.manage-ws-browse {
    padding: 0 10px 10px 38px;
    background: var(--bg-subtle, rgba(0, 0, 0, 0.02));
}

.manage-ws-breadcrumb {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px 0;
    margin-bottom: 8px;
    font-family: var(--font-ui);
    font-size: 11px;
}

.manage-ws-crumb {
    border: none;
    background: none;
    padding: 2px 4px;
    margin: 0;
    color: var(--accent);
    cursor: pointer;
    font-family: inherit;
    font-size: inherit;
    font-weight: 600;
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.manage-ws-crumb:hover {
    text-decoration: underline;
}

.manage-ws-crumb-sep {
    color: var(--text-tertiary);
    user-select: none;
    padding: 0 1px;
}

.manage-ws-browse-status,
.manage-ws-browse-error {
    margin: 4px 0 0;
    font-family: var(--font-ui);
    font-size: 11px;
    color: var(--text-secondary);
}

.manage-ws-browse-error {
    color: var(--error, #c62828);
}

.manage-ws-browse-scroll {
    max-height: 240px;
    overflow: auto;
    border: 1px solid var(--border-subtle, var(--border-default));
    border-radius: 4px;
    background: var(--bg-surface);
}

.manage-ws-virtual-host {
    display: block;
}

.manage-ws-browse-row {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    min-height: 30px;
    padding: 4px 10px;
    box-sizing: border-box;
    border: none;
    border-bottom: 1px solid var(--border-subtle, var(--border-default));
    background: transparent;
    font-family: var(--font-ui);
    font-size: 11px;
    text-align: left;
    color: var(--text-primary);
    cursor: default;
}

.manage-ws-browse-row.is-dir {
    cursor: pointer;
}

.manage-ws-browse-row.is-dir:hover {
    background: var(--bg-hover);
}

.manage-ws-browse-row.is-file {
    cursor: default;
    color: var(--text-secondary);
}

.manage-ws-browse-up {
    cursor: pointer;
    font-weight: 600;
    color: var(--accent);
}

.manage-ws-browse-up:hover {
    background: var(--bg-hover);
}

.manage-ws-browse-glyph {
    flex-shrink: 0;
    display: flex;
    color: var(--text-tertiary);
}

.manage-ws-browse-name {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.manage-ws-browse-size {
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
    color: var(--text-tertiary);
    font-size: 10px;
}

.manage-ws-browse-empty {
    margin: 0;
    padding: 12px 10px;
    font-family: var(--font-ui);
    font-size: 11px;
    color: var(--text-tertiary);
    font-style: italic;
}

.manage-ws-name {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 500;
    color: var(--text-primary);
}

.manage-ws-current {
    flex-shrink: 0;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--accent);
}

.manage-ws-open-btn {
    flex-shrink: 0;
    font-family: var(--font-ui);
    font-size: 11px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 4px;
    border: 1px solid var(--border-default);
    background: var(--bg-elevated, var(--bg-surface));
    color: var(--text-primary);
    cursor: pointer;
}

.manage-ws-open-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.manage-ws-actions {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.manage-ws-download-btn {
    flex-shrink: 0;
    font-family: var(--font-ui);
    font-size: 11px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 4px;
    border: 1px solid var(--border-default);
    background: var(--bg-elevated, var(--bg-surface));
    color: var(--text-primary);
    cursor: pointer;
}

.manage-ws-download-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.manage-ws-delete-btn {
    flex-shrink: 0;
    font-family: var(--font-ui);
    font-size: 11px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 4px;
    border: 1px solid var(--border-default);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
}

.manage-ws-delete-btn:hover {
    border-color: var(--error, #c62828);
    color: var(--error, #c62828);
    background: color-mix(in srgb, var(--error, #c62828) 8%, transparent);
}

/* -- Document editor pane -------------------------------------------------- */

/* Mirror the data-editor-container pattern: flexbox fill + forced dimensions. */
.pane-content:has(.document-editor-container) {
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding: 0;
    background: var(--bg-page);
}

/* The editor, its scrollbars and its status bar are one inset card below the
   ribbon. The ribbon area's own 8px bottom padding supplies the gap between
   them, so this takes no top margin. overflow already clips to the corner. */
.document-editor-container {
    flex: 1;
    min-height: 0;
    margin: 0 8px 8px;
    border: 1px solid var(--border-default);
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .08);
    overflow: hidden;
}

/* Force the SfDocumentEditorContainer and its internal panels to fill the
   container, overriding any inline pixel dimensions set by Syncfusion JS. */
.document-editor-container > .e-documenteditorcontainer {
    width: 100% !important;
    height: 100% !important;
}

.document-editor-container .e-documenteditorcontainer .e-documenteditor {
    width: 100% !important;
    height: 100% !important;
}

.document-editor-container .e-documenteditorcontainer .e-de-ctn {
    width: 100% !important;
    height: 100% !important;
}

/* Hide Syncfusion's built-in floating paste-options dropdown (redundant with our ribbon). */
.document-editor-container .e-de-tooltip:has(.e-de-paste) {
    display: none !important;
}

/* -- Ribbon card (document and diagram) ------------------------------------
   Both ribbons render as an inset rounded card: the pane chrome shows through
   on all four sides, and the tab strip and the command area share one rounded
   surface rather than meeting the pane edges square. */

.document-ribbon-area,
.diagram-ribbon-area {
    flex-shrink: 0;
    overflow: visible;
    z-index: 10;
    position: relative;
    background: var(--bg-page, #f3f3f3);
    padding: 6px 8px 8px;
}

.document-ribbon-area .e-ribbon,
.diagram-ribbon-area .e-ribbon {
    border: 1px solid var(--border-color, #e0e0e0);
    border-radius: 8px;
    background: var(--bg-surface, #ffffff);
    box-shadow: 0 1px 3px rgba(0, 0, 0, .08);
}

.document-ribbon-area .e-ribbon .e-ribbon-tab,
.diagram-ribbon-area .e-ribbon .e-ribbon-tab {
    background: transparent;
    border-radius: 8px;
}

.document-ribbon-area .e-ribbon .e-ribbon-tab .e-tab-header,
.diagram-ribbon-area .e-ribbon .e-ribbon-tab .e-tab-header,
.document-ribbon-area .e-ribbon .e-ribbon-tab .e-tab-header .e-toolbar-items,
.diagram-ribbon-area .e-ribbon .e-ribbon-tab .e-tab-header .e-toolbar-items {
    background: transparent;
    border-radius: 8px 8px 0 0;
    box-sizing: border-box;
}

.document-ribbon-area .e-ribbon .e-ribbon-tab .e-content,
.diagram-ribbon-area .e-ribbon .e-ribbon-tab .e-content {
    background: transparent;
    border-radius: 0 0 8px 8px;
}

/* The active-tab underline is absolutely positioned at the bottom of the tab
   strip, so it meets the command area with no gap. Lift it clear of the join. */
.document-ribbon-area .e-ribbon .e-ribbon-tab .e-tab-header .e-toolbar-item.e-active::before,
.diagram-ribbon-area .e-ribbon .e-ribbon-tab .e-tab-header .e-toolbar-item.e-active::before {
    bottom: 6px;
}

/* Command-area scroll arrows. Groups here never collapse into overflow dropdowns, so a
   ribbon narrower than its groups scrolls instead, and these are the control that does it.
   Syncfusion leaves them as a bare full-height column with a hairline edge; give them the
   card's own surface, a rounded outer corner that follows the ribbon, and a button's
   hover / press response so they read as something to click. */
.document-ribbon-area .e-ribbon .e-hscroll .e-scroll-nav,
.diagram-ribbon-area .e-ribbon .e-hscroll .e-scroll-nav {
    width: 26px;
    justify-content: center;
    background: var(--bg-surface, #ffffff);
    color: var(--text-secondary, #555);
    transition: background 120ms ease, color 120ms ease;
}

.document-ribbon-area .e-ribbon .e-hscroll .e-scroll-nav.e-scroll-left-nav,
.diagram-ribbon-area .e-ribbon .e-hscroll .e-scroll-nav.e-scroll-left-nav {
    border-right: 1px solid var(--border-subtle, #ebebeb);
    border-radius: 0 0 0 8px;
    box-shadow: 6px 0 8px -6px rgba(0, 0, 0, .12);
}

.document-ribbon-area .e-ribbon .e-hscroll .e-scroll-nav.e-scroll-right-nav,
.diagram-ribbon-area .e-ribbon .e-hscroll .e-scroll-nav.e-scroll-right-nav {
    border-left: 1px solid var(--border-subtle, #ebebeb);
    border-radius: 0 0 8px 0;
    box-shadow: -6px 0 8px -6px rgba(0, 0, 0, .12);
}

/* Opaque, not a translucent overlay: the arrows sit above the scrolling content and have
   to mask what passes under them. */
.document-ribbon-area .e-ribbon .e-hscroll .e-scroll-nav:hover,
.diagram-ribbon-area .e-ribbon .e-hscroll .e-scroll-nav:hover {
    background: color-mix(in srgb, var(--text-primary) 6%, var(--bg-surface));
    color: var(--text-primary, #222);
}

.document-ribbon-area .e-ribbon .e-hscroll .e-scroll-nav:active,
.diagram-ribbon-area .e-ribbon .e-hscroll .e-scroll-nav:active {
    background: color-mix(in srgb, var(--text-primary) 10%, var(--bg-surface));
}

.document-ribbon-area .e-ribbon .e-hscroll .e-scroll-nav .e-nav-arrow,
.diagram-ribbon-area .e-ribbon .e-hscroll .e-scroll-nav .e-nav-arrow {
    font-size: 12px;
    color: inherit;
}

/* Scrolled to the end: Syncfusion keeps the arrow in place and marks it overlaid. */
.document-ribbon-area .e-ribbon .e-hscroll .e-scroll-nav.e-overlay,
.diagram-ribbon-area .e-ribbon .e-hscroll .e-scroll-nav.e-overlay {
    opacity: .38;
    pointer-events: none;
}

/* -- Document ribbon -------------------------------------------------------- */

.document-ribbon-area .e-ribbon .e-ribbon-collapse-btn {
    display: none !important;
}

.document-ribbon-area .e-ribbon .e-tab-header {
    padding-right: 34px;
}

.doc-ribbon-minimize-btn {
    position: absolute;
    top: 10px;
    right: 14px;
    width: 22px;
    height: 22px;
    border: 1px solid transparent;
    border-radius: 3px;
    background: transparent;
    color: var(--text-secondary, #444);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 12;
}

.doc-ribbon-minimize-btn:hover {
    background: var(--surface-hover, #f3f3f3);
    border-color: var(--border-color, #d0d0d0);
}

.doc-ribbon-minimize-btn .e-icons {
    font-size: 12px;
    line-height: 1;
}

.document-ribbon-area .e-ribbon .e-tab .e-content {
    padding: 2px 4px;
}

.document-ribbon-area .e-ribbon .e-ribbon-group {
    padding: 2px 6px;
}

.document-ribbon-area .e-ribbon .e-ribbon-group-header {
    font-size: 10px;
    padding: 0 2px 1px;
}

.document-ribbon-area .e-ribbon .e-btn {
    padding: 2px 6px;
    font-size: 12px;
}

.document-ribbon-area .e-ribbon .e-btn .e-btn-icon {
    font-size: 14px;
}

.doc-shazam-import-group .e-ribbon-item .e-btn {
    display: inline-flex;
    flex-direction: row-reverse;
    justify-content: flex-end;
    gap: 6px;
}

.doc-shazam-import-group .e-ribbon-item .e-btn .e-btn-icon {
    margin: 0;
}

.doc-review-comments-group .doc-review-large-toggle-btn.e-btn,
.doc-review-large-toggle-btn.e-btn,
.doc-review-large-action-btn.e-btn {
    min-height: 78px;
    min-width: 86px;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    text-align: center;
}

.doc-review-large-toggle-btn.e-btn .e-btn-icon,
.doc-review-large-action-btn.e-btn .e-btn-icon {
    margin: 0;
    font-size: 18px;
}

.doc-review-large-toggle-btn.doc-review-toggle-active.e-btn {
    border-color: var(--primary, #0f6cbd);
    background: color-mix(in srgb, var(--primary, #0f6cbd) 12%, transparent);
}

/* -- Document ribbon: Word-style Font panel -------------------------------- */

.doc-font-panel {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    padding: 4px 4px 2px;
}

.doc-font-row {
    display: flex;
    align-items: center;
    gap: 3px;
}

.doc-clipboard-panel {
    display: flex;
    align-items: stretch;
    gap: 8px;
    padding: 2px 4px 0;
}

.doc-clipboard-paste {
    display: flex;
    align-items: stretch;
}

.doc-clipboard-paste :is(.e-split-btn-wrapper, .e-btn, .e-dropdown-btn) {
    height: 58px;
}

.doc-clipboard-paste .e-split-btn-wrapper {
    display: flex;
    align-items: stretch;
}

.doc-clipboard-paste .e-btn {
    min-width: 52px;
}

.doc-clipboard-tools {
    display: grid;
    grid-template-columns: repeat(2, auto);
    grid-template-rows: repeat(2, auto);
    column-gap: 8px;
    row-gap: 2px;
    align-content: start;
}

.doc-clipboard-tool-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 24px;
    padding: 2px 4px;
    border: 1px solid transparent;
    border-radius: 2px;
    background: transparent;
    color: var(--text-primary, #333);
    cursor: pointer;
    font-size: 12px;
    white-space: nowrap;
}

.doc-clipboard-tool-btn:hover {
    background: var(--surface-hover, #e8e8e8);
    border-color: var(--border-color, #c8c8c8);
}

.doc-clipboard-tool-btn .e-icons {
    font-size: 14px;
}

.doc-clipboard-tool-wide {
    grid-column: 1 / span 2;
}

.doc-ribbon-inline-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 24px;
    padding: 2px 4px;
    border: 1px solid transparent;
    border-radius: 2px;
    background: transparent;
    color: var(--text-primary, #333);
    cursor: pointer;
    font-size: 12px;
    white-space: nowrap;
}

.doc-ribbon-inline-btn:hover {
    background: var(--surface-hover, #e8e8e8);
    border-color: var(--border-color, #c8c8c8);
}

.doc-ribbon-inline-icon {
    font-size: 14px;
}

.doc-layout-large-wrap {
    display: inline-flex;
    align-items: stretch;
    height: 58px;
    position: relative;
}

.doc-layout-large-btn {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 58px;
    height: 58px;
    padding: 4px 6px;
    border: 1px solid transparent;
    border-radius: 2px 0 0 2px;
    background: transparent;
    color: var(--text-primary, #333);
    cursor: pointer;
    gap: 4px;
}

.doc-layout-large-btn:hover {
    background: var(--surface-hover, #e8e8e8);
    border-color: var(--border-color, #c8c8c8);
}

.doc-layout-large-icon {
    font-size: 18px;
}

.doc-layout-large-arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 58px;
    border: 1px solid transparent;
    border-left: none;
    border-radius: 0 2px 2px 0;
    background: transparent;
    color: var(--text-secondary, #666);
    cursor: pointer;
    padding: 0;
}

.doc-layout-large-arrow:hover {
    background: var(--surface-hover, #e8e8e8);
    border-color: var(--border-color, #c8c8c8);
}

.doc-layout-palette {
    position: fixed;
    z-index: 10000;
    background: var(--surface-default, #fff);
    border: 1px solid var(--border-color, #c8c8c8);
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 4px 0;
    min-width: 150px;
}

.doc-layout-option {
    display: block;
    width: 100%;
    padding: 5px 12px;
    border: none;
    background: transparent;
    color: var(--text-primary, #333);
    font-size: 13px;
    text-align: left;
    cursor: pointer;
}

.doc-layout-option:hover {
    background: var(--surface-hover, #e8e8e8);
}

.doc-layout-paragraph-panel {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 4px 4px 2px;
}

.doc-layout-paragraph-column {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.doc-layout-paragraph-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary, #666);
}

.doc-layout-paragraph-row {
    display: flex;
    align-items: center;
    gap: 3px;
}

.doc-layout-mini-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 26px;
    border: 1px solid transparent;
    border-radius: 2px;
    background: transparent;
    color: var(--text-primary, #333);
    cursor: pointer;
    padding: 0;
}

.doc-layout-mini-btn:hover {
    background: var(--surface-hover, #e8e8e8);
    border-color: var(--border-color, #c8c8c8);
}

.doc-symbol-wrap {
    display: inline-flex;
    align-items: stretch;
    position: relative;
}

.doc-symbol-wrap-large {
    height: 58px;
}

.doc-symbol-main-btn {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 58px;
    height: 58px;
    padding: 4px 6px;
    border: 1px solid transparent;
    border-radius: 2px;
    background: transparent;
    color: var(--text-primary, #333);
    cursor: pointer;
    gap: 3px;
}

.doc-symbol-main-btn:hover {
    background: var(--surface-hover, #e8e8e8);
    border-color: var(--border-color, #c8c8c8);
}

.doc-symbol-main-icon {
    font-size: 18px;
}

.doc-symbol-main-label {
    font-size: 11px;
    line-height: 1;
    white-space: nowrap;
}

.doc-symbol-palette {
    position: fixed;
    z-index: 10000;
    background: var(--surface-default, #fff);
    border: 1px solid var(--border-color, #c8c8c8);
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 8px;
    width: 292px;
}

.doc-symbol-group + .doc-symbol-group {
    margin-top: 10px;
}

.doc-symbol-grid {
    display: grid;
    grid-template-columns: repeat(8, 28px);
    gap: 6px;
}

.doc-symbol-option {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: 1px solid var(--border-color, #c8c8c8);
    border-radius: 2px;
    background: transparent;
    color: var(--text-primary, #333);
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    padding: 0;
}

.doc-symbol-option:hover {
    background: var(--surface-hover, #e8e8e8);
    border-color: var(--border-color, #b5b5b5);
}

.doc-symbol-option.active {
    outline: 1px solid var(--primary, #0078d4);
    outline-offset: 1px;
}

.doc-paragraph-panel {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    padding: 4px 4px 2px;
}

.doc-paragraph-row {
    display: flex;
    align-items: center;
    gap: 3px;
}

.doc-table-picker {
    position: fixed;
    z-index: 20000;
    border: 1px solid var(--border-color, #c8c8c8);
    border-radius: 4px;
    background: var(--surface, #fff);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
    padding: 8px;
    width: 266px;
}

.doc-table-picker-size {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary, #555);
    margin: 2px 0 8px;
}

.doc-table-picker-grid {
    display: grid;
    grid-template-columns: repeat(10, 22px);
    grid-template-rows: repeat(8, 22px);
    gap: 3px;
}

.doc-table-picker-cell {
    border: 1px solid var(--border-color, #9a9a9a);
    background: #fff;
    border-radius: 1px;
    padding: 0;
    width: 22px;
    height: 22px;
    cursor: pointer;
}

.doc-table-picker-cell.active {
    background: #e6f2ff;
    border-color: var(--primary, #0078d4);
}

.doc-table-picker-cell:hover {
    border-color: var(--primary, #0078d4);
}

.doc-styles-group .e-ribbon-group-content,
.doc-styles-group .e-ribbon-collection,
.doc-styles-group .e-ribbon-items-container,
.doc-styles-group .e-ribbon-item {
    height: 100%;
}

.doc-styles-quick-wrap {
    display: flex;
    align-items: stretch;
    height: 100%;
    min-height: 44px;
}

.doc-styles-quick-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(82px, 1fr));
    grid-template-rows: repeat(2, minmax(18px, 1fr));
    gap: 2px;
    min-width: 344px;
    padding: 2px 4px;
    height: 100%;
}

.doc-style-quick-btn {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    min-width: 0;
    border: 1px solid transparent;
    border-radius: 2px;
    background: transparent;
    color: var(--text-primary, #333);
    text-align: left;
    padding: 1px 6px 3px;
    cursor: pointer;
    overflow: hidden;
}

.doc-style-quick-btn:hover {
    background: var(--surface-hover, #e8e8e8);
    border-color: var(--border-color, #c8c8c8);
}

.doc-style-quick-btn.active {
    background: var(--surface-hover, #e8e8e8);
    border-color: var(--border-color, #c8c8c8);
    outline: 1px solid var(--primary, #0078d4);
    outline-offset: 1px;
}

.doc-styles-chevron-btn {
    width: 18px;
    min-width: 18px;
    border: 1px solid transparent;
    border-radius: 2px;
    background: transparent;
    color: var(--text-secondary, #666);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 2px 2px 2px 0;
    padding: 0;
}

.doc-styles-chevron-btn:hover {
    background: var(--surface-hover, #e8e8e8);
    border-color: var(--border-color, #c8c8c8);
}

.doc-styles-popup {
    position: fixed;
    z-index: 20000;
    width: 360px;
    max-height: 320px;
    border: 1px solid var(--border-color, #c8c8c8);
    border-radius: 4px;
    background: var(--surface, #fff);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
    padding: 8px;
    overflow: auto;
}

.doc-styles-popup-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
}

.doc-style-popup-option {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    min-width: 0;
    min-height: 38px;
    border: 1px solid transparent;
    border-radius: 2px;
    background: transparent;
    color: var(--text-primary, #333);
    text-align: left;
    padding: 4px 6px 6px;
    cursor: pointer;
    overflow: hidden;
}

.doc-style-popup-option:hover {
    background: var(--surface-hover, #e8e8e8);
    border-color: var(--border-color, #c8c8c8);
}

.doc-style-popup-option.active {
    background: var(--surface-hover, #e8e8e8);
    border-color: var(--border-color, #c8c8c8);
    outline: 1px solid var(--primary, #0078d4);
    outline-offset: 1px;
}

.doc-style-preview {
    display: block;
    width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.35;
    padding-bottom: 2px;
}

.doc-style-quick-btn .doc-style-preview {
    font-size: 13px;
}

.doc-style-popup-option .doc-style-preview {
    font-size: 14px;
}

.doc-style-popup-option .doc-style-heading1 {
    font-size: 17px;
}

.doc-style-popup-option .doc-style-heading2 {
    font-size: 15px;
}

.doc-style-popup-option .doc-style-heading3 {
    font-size: 14px;
}

.doc-style-popup-option .doc-style-heading4 {
    font-size: 13px;
}

.doc-style-popup-option .doc-style-heading5,
.doc-style-popup-option .doc-style-heading6 {
    font-size: 12px;
}

.doc-style-popup-option .doc-style-heading7,
.doc-style-popup-option .doc-style-heading8,
.doc-style-popup-option .doc-style-heading9 {
    font-size: 11px;
}

.doc-style-quick-btn .doc-style-heading1 {
    font-size: 15px;
}

.doc-style-quick-btn .doc-style-heading2 {
    font-size: 14px;
}

.doc-style-quick-btn .doc-style-heading3 {
    font-size: 13px;
}

.doc-style-quick-btn .doc-style-heading4 {
    font-size: 12px;
}

.doc-style-quick-btn .doc-style-heading5,
.doc-style-quick-btn .doc-style-heading6,
.doc-style-quick-btn .doc-style-heading7,
.doc-style-quick-btn .doc-style-heading8,
.doc-style-quick-btn .doc-style-heading9 {
    font-size: 11px;
}

.doc-style-gallery-tile {
    display: flex;
    height: 100%;
}

.doc-style-normal {
    font-size: 13px;
    font-weight: 400;
}

.doc-style-no-spacing {
    font-size: 13px;
    font-weight: 400;
}

.doc-style-heading1 {
    font-size: 18px;
    font-weight: 300;
    color: #496b7d;
}

.doc-style-heading2 {
    font-size: 16px;
    font-weight: 300;
    color: #496b7d;
}

.doc-style-heading3 {
    font-size: 14px;
    font-weight: 600;
    color: #496b7d;
}

.doc-style-heading4 {
    font-size: 13px;
    font-weight: 600;
    color: #496b7d;
}

.doc-style-heading5 {
    font-size: 12px;
    font-weight: 600;
    color: #496b7d;
}

.doc-style-heading6 {
    font-size: 12px;
    font-weight: 500;
    color: #496b7d;
}

.doc-style-heading7,
.doc-style-heading8,
.doc-style-heading9 {
    font-size: 11px;
    font-weight: 500;
    color: #496b7d;
}

/* Keep style-specific typography classes reusable across inline and popup gallery items. */

.doc-bullet-wrap,
.doc-numbering-wrap {
    display: inline-flex;
    align-items: stretch;
    height: 26px;
    position: relative;
}

.doc-bullet-wrap .doc-font-btn,
.doc-numbering-wrap .doc-font-btn {
    border-radius: 2px 0 0 2px;
}

.doc-list-arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 26px;
    border: 1px solid transparent;
    border-left: none;
    border-radius: 0 2px 2px 0;
    background: transparent;
    color: var(--text-secondary, #666);
    cursor: pointer;
    padding: 0;
}

.doc-list-arrow:hover {
    background: var(--surface-hover, #e8e8e8);
    border-color: var(--border-color, #c8c8c8);
}

.doc-bullet-palette,
.doc-numbering-palette {
    position: fixed;
    z-index: 10000;
    background: var(--surface-default, #fff);
    border: 1px solid var(--border-color, #c8c8c8);
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 8px;
}

.doc-crossref-popup {
    position: fixed;
    z-index: 10000;
    background: var(--surface-default, #fff);
    border: 1px solid var(--border-color, #c8c8c8);
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 10px;
    width: 320px;
}

.doc-crossref-mode-row {
    display: flex;
    gap: 12px;
    margin-bottom: 8px;
}

.doc-crossref-mode {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-primary, #333);
}

.doc-crossref-target-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary, #666);
    margin-bottom: 6px;
}

.doc-crossref-target-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-height: 180px;
    overflow: auto;
    border: 1px solid var(--border-color, #d8d8d8);
    border-radius: 3px;
    padding: 4px;
    margin-bottom: 10px;
}

.doc-crossref-target {
    border: 1px solid transparent;
    background: transparent;
    border-radius: 2px;
    font-size: 12px;
    color: var(--text-primary, #333);
    padding: 4px 6px;
    text-align: left;
    cursor: pointer;
}

.doc-crossref-target:hover {
    background: var(--surface-hover, #e8e8e8);
    border-color: var(--border-color, #c8c8c8);
}

.doc-crossref-target.active {
    background: var(--primary-light, #e0f0ff);
    border-color: var(--primary, #0078d4);
}

.doc-crossref-empty {
    font-size: 12px;
    color: var(--text-secondary, #666);
    padding: 4px;
}

.doc-crossref-actions {
    display: flex;
    justify-content: flex-end;
    gap: 6px;
}

.doc-crossref-btn {
    border: 1px solid var(--border-color, #c8c8c8);
    border-radius: 3px;
    background: var(--surface-default, #fff);
    color: var(--text-primary, #333);
    font-size: 12px;
    padding: 4px 10px;
    cursor: pointer;
}

.doc-crossref-btn:hover {
    background: var(--surface-hover, #e8e8e8);
}

.doc-crossref-btn:disabled {
    opacity: 0.55;
    cursor: default;
}

.doc-crossref-btn-primary {
    background: var(--primary, #0078d4);
    color: #fff;
    border-color: var(--primary, #0078d4);
}

.doc-crossref-btn-primary:hover {
    background: #106ebe;
}

.doc-numbering-palette {
    width: 378px;
}

.doc-list-palette-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary, #333);
    margin-bottom: 8px;
}

.doc-bullet-grid {
    display: grid;
    grid-template-columns: repeat(4, 60px);
    gap: 8px;
}

.doc-bullet-option {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 56px;
    border: 1px solid var(--border-color, #c8c8c8);
    border-radius: 2px;
    background: transparent;
    color: var(--text-primary, #333);
    cursor: pointer;
    padding: 0;
}

.doc-bullet-option:hover,
.doc-numbering-option:hover {
    background: var(--surface-hover, #e8e8e8);
    border-color: var(--border-color, #b5b5b5);
}

.doc-bullet-option.active,
.doc-numbering-option.active {
    outline: 1px solid var(--primary, #0078d4);
    outline-offset: 1px;
}

.doc-bullet-preview {
    font-size: 24px;
    line-height: 1;
}

.doc-bullet-none {
    font-size: 14px;
    color: var(--text-primary, #333);
}

.doc-numbering-grid {
    display: grid;
    grid-template-columns: repeat(3, 112px);
    gap: 10px;
}

.doc-numbering-option {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 82px;
    border: 1px solid var(--border-color, #c8c8c8);
    border-radius: 2px;
    background: transparent;
    color: var(--text-primary, #333);
    cursor: pointer;
    padding: 8px;
}

.doc-numbering-option-none {
    align-items: center;
}

.doc-numbering-sample {
    display: flex;
    flex-direction: column;
    gap: 7px;
    width: 100%;
}

.doc-numbering-line-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
}

.doc-numbering-line-row span:first-child {
    min-width: 18px;
    text-align: left;
}

.doc-numbering-line {
    flex: 1;
    height: 1px;
    background: currentColor;
    opacity: 0.45;
}

.doc-shading-wrap,
.doc-borders-wrap {
    display: inline-flex;
    align-items: stretch;
    height: 26px;
    position: relative;
}

.doc-shading-wrap .doc-font-btn,
.doc-borders-wrap .doc-font-btn {
    border-radius: 2px 0 0 2px;
}

.doc-shading-btn {
    flex-direction: column;
    gap: 0;
    padding: 0 3px !important;
}

.doc-shading-bar {
    width: 16px;
    height: 3px;
    border-radius: 1px;
    flex-shrink: 0;
}

.doc-shading-arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 26px;
    border: 1px solid transparent;
    border-left: none;
    border-radius: 0 2px 2px 0;
    background: transparent;
    color: var(--text-secondary, #666);
    cursor: pointer;
    position: relative;
}

.doc-shading-arrow:hover {
    background: var(--surface-hover, #e8e8e8);
    border-color: var(--border-color, #c8c8c8);
}

.doc-borders-palette {
    position: fixed;
    z-index: 10000;
    background: var(--surface-default, #fff);
    border: 1px solid var(--border-color, #c8c8c8);
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 8px 0;
    min-width: 220px;
}

.doc-border-option {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 6px 12px;
    border: none;
    background: transparent;
    color: var(--text-primary, #333);
    font-size: 13px;
    text-align: left;
    cursor: pointer;
}

.doc-border-option:hover {
    background: var(--surface-hover, #e8e8e8);
}

.doc-border-option.active {
    background: var(--primary-light, #e0f0ff);
}

.doc-border-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.doc-font-family {
    width: 130px;
    height: 26px;
    font-size: 13px;
    border: 1px solid var(--border-color, #c8c8c8);
    border-radius: 2px;
    background: var(--surface-default, #fff);
    color: var(--text-primary, #333);
    padding: 0 4px;
    cursor: pointer;
}

.doc-font-family option {
    font-size: 14px;
    padding: 3px 6px;
}

.doc-font-size {
    width: 50px;
    height: 26px;
    font-size: 12px;
    border: 1px solid var(--border-color, #c8c8c8);
    border-radius: 2px;
    background: var(--surface-default, #fff);
    color: var(--text-primary, #333);
    padding: 0 2px;
    cursor: pointer;
}

.doc-font-family:hover,
.doc-font-size:hover {
    border-color: var(--primary, #0078d4);
}

.doc-font-family:focus,
.doc-font-size:focus {
    outline: none;
    border-color: var(--primary, #0078d4);
    box-shadow: 0 0 0 1px var(--primary, #0078d4);
}

.doc-font-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 26px;
    border: 1px solid transparent;
    border-radius: 2px;
    background: transparent;
    color: var(--text-primary, #333);
    cursor: pointer;
    padding: 0;
    font-size: 14px;
}

.doc-font-btn:hover {
    background: var(--surface-hover, #e8e8e8);
    border-color: var(--border-color, #c8c8c8);
}

.doc-font-btn:active {
    background: var(--surface-active, #d0d0d0);
}

.doc-font-btn .e-icons {
    font-size: 15px;
}

.doc-font-btn-active {
    background: var(--surface-hover, #e8e8e8);
    border-color: var(--border-color, #c8c8c8);
}

.doc-pilcrow-icon {
    font-size: 17px;
    line-height: 1;
}

.doc-font-sep {
    display: block;
    align-self: center;
    width: 1px;
    height: 18px;
    background: var(--border-color, #d0d0d0);
    margin: 0 2px;
    flex-shrink: 0;
}

.doc-font-btn-disabled {
    opacity: 0.35;
    cursor: default;
}

.doc-font-btn-disabled:hover {
    background: transparent;
    border-color: transparent;
}

.doc-fontcolor-wrap {
    display: inline-flex;
    align-items: stretch;
    height: 26px;
    position: relative;
}

.doc-fontcolor-btn {
    flex-direction: column;
    gap: 0;
    border-radius: 2px 0 0 2px !important;
    padding: 0 3px !important;
}

.doc-font-color-icon {
    font-size: 14px;
    font-weight: 400;
    line-height: 1;
    color: var(--text-primary, #333);
}

.doc-font-color-bar {
    width: 16px;
    height: 3px;
    border-radius: 1px;
    flex-shrink: 0;
}

.doc-fontcolor-arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 26px;
    border: 1px solid transparent;
    border-left: none;
    border-radius: 0 2px 2px 0;
    background: transparent;
    color: var(--text-secondary, #666);
    cursor: pointer;
    position: relative;
}

.doc-fontcolor-arrow:hover {
    background: var(--surface-hover, #e8e8e8);
    border-color: var(--border-color, #c8c8c8);
}

.doc-color-palette {
    position: fixed;
    z-index: 20000;
    width: 268px;
    max-height: 380px;
    background: var(--surface-default, #fff);
    border: 1px solid var(--border-color, #c8c8c8);
    border-radius: 4px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
    overflow: auto;
}

.doc-color-auto {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border: none;
    border-bottom: 1px solid var(--border-color, #e0e0e0);
    background: transparent;
    color: var(--text-primary, #333);
    font-size: 13px;
    text-align: left;
    cursor: pointer;
}

.doc-color-auto:hover {
    background: var(--surface-hover, #e8e8e8);
}

.doc-color-auto-sample {
    width: 18px;
    height: 18px;
    border: 1px solid var(--border-color, #aaa);
    border-radius: 2px;
    flex-shrink: 0;
}

.doc-color-auto-none {
    background:
        linear-gradient(135deg, #c8c8c8 0 42%, transparent 42% 58%, #c8c8c8 58% 100%),
        #fff;
}

.doc-color-section-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary, #555);
    padding: 8px 10px 4px;
}

.doc-color-theme-grid {
    display: grid;
    grid-template-columns: repeat(10, 22px);
    gap: 4px;
    padding: 0 10px 8px;
}

.doc-color-standard-grid {
    display: grid;
    grid-template-columns: repeat(10, 22px);
    gap: 4px;
    padding: 0 10px 10px;
}

.doc-color-swatch {
    width: 22px;
    height: 22px;
    border: 1px solid var(--border-color, #a8a8a8);
    border-radius: 2px;
    cursor: pointer;
    padding: 0;
}

.doc-color-swatch:hover {
    border-color: var(--primary, #0078d4);
}

.doc-color-swatch.active {
    border-color: var(--primary, #0078d4);
    outline: 1px solid var(--primary, #0078d4);
    outline-offset: 1px;
}

.doc-changecase-wrap {
    display: inline-flex;
    align-items: stretch;
    height: 26px;
    position: relative;
}

.doc-changecase-btn {
    gap: 0 !important;
    width: auto !important;
    padding: 0 4px !important;
}

.doc-changecase-icon {
    font-size: 13px;
    line-height: 1;
}

.doc-changecase-palette {
    position: fixed;
    z-index: 10000;
    background: var(--surface-default, #fff);
    border: 1px solid var(--border-color, #c8c8c8);
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 4px 0;
    min-width: 170px;
    white-space: nowrap;
}

.doc-changecase-option {
    display: block;
    width: 100%;
    padding: 5px 14px;
    border: none;
    background: transparent;
    color: var(--text-primary, #333);
    font-size: 13px;
    text-align: left;
    cursor: pointer;
}

.doc-changecase-option:hover {
    background: var(--surface-hover, #e8e8e8);
}

.doc-spacing-wrap {
    display: inline-flex;
    align-items: stretch;
    height: 26px;
}

.doc-spacing-arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 26px;
    border: 1px solid transparent;
    border-left: none;
    border-radius: 0 2px 2px 0;
    background: transparent;
    color: var(--text-secondary, #666);
    cursor: pointer;
    padding: 0;
}

.doc-spacing-arrow:hover {
    background: var(--surface-hover, #e8e8e8);
    border-color: var(--border-color, #c8c8c8);
}

.doc-spacing-wrap .doc-font-btn {
    border-radius: 2px 0 0 2px;
}

.doc-spacing-palette {
    position: fixed;
    z-index: 10000;
    background: var(--surface-default, #fff);
    border: 1px solid var(--border-color, #c8c8c8);
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 4px 0;
    min-width: 86px;
}

.doc-spacing-option {
    display: block;
    width: 100%;
    padding: 5px 12px;
    border: none;
    background: transparent;
    color: var(--text-primary, #333);
    font-size: 13px;
    text-align: left;
    cursor: pointer;
}

.doc-spacing-option:hover {
    background: var(--surface-hover, #e8e8e8);
}

.doc-underline-wrap {
    display: inline-flex;
    align-items: stretch;
    height: 26px;
}

.doc-underline-wrap .doc-font-btn {
    border-radius: 2px 0 0 2px;
}

.doc-underline-arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 26px;
    border: 1px solid transparent;
    border-left: none;
    border-radius: 0 2px 2px 0;
    background: transparent;
    color: var(--text-secondary, #666);
    cursor: pointer;
    padding: 0;
}

.doc-underline-arrow:hover {
    background: var(--surface-hover, #e8e8e8);
    border-color: var(--border-color, #c8c8c8);
}

.doc-underline-palette {
    position: fixed;
    z-index: 10000;
    background: var(--surface-default, #fff);
    border: 1px solid var(--border-color, #c8c8c8);
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 4px 0;
    width: 152px;
}

.doc-underline-option {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 22px;
    border: none;
    background: transparent;
    color: var(--text-primary, #333);
    cursor: pointer;
    padding: 2px 12px;
}

.doc-underline-option:hover {
    background: var(--surface-hover, #e8e8e8);
}

.doc-underline-option.active {
    background: var(--primary-light, #e0f0ff);
}

.doc-underline-option svg {
    display: block;
}

.doc-underline-sep {
    height: 1px;
    background: var(--border-color, #e0e0e0);
    margin: 4px 0;
}

.doc-underline-text-option {
    display: block;
    width: 100%;
    padding: 4px 14px;
    border: none;
    background: transparent;
    color: var(--text-primary, #333);
    font-size: 13px;
    text-align: left;
    cursor: pointer;
}

.doc-underline-text-option:hover {
    background: var(--surface-hover, #e8e8e8);
}

.doc-underline-text-option.active {
    background: var(--primary-light, #e0f0ff);
}

.doc-highlight-wrap {
    display: inline-flex;
    align-items: stretch;
    height: 26px;
    position: relative;
}

.doc-highlight-btn {
    position: relative;
    flex-direction: column;
    gap: 0;
    padding: 0 2px !important;
}

.doc-highlight-bar {
    width: 16px;
    height: 3px;
    border-radius: 1px;
    flex-shrink: 0;
}

.doc-highlight-arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 26px;
    border: 1px solid transparent;
    border-left: none;
    border-radius: 0 2px 2px 0;
    background: transparent;
    color: var(--text-secondary, #666);
    cursor: pointer;
    padding: 0;
}

.doc-highlight-arrow:hover {
    background: var(--surface-hover, #e8e8e8);
    border-color: var(--border-color, #c8c8c8);
}

.doc-highlight-palette {
    position: fixed;
    z-index: 10000;
    background: var(--surface-default, #fff);
    border: 1px solid var(--border-color, #c8c8c8);
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    width: 160px;
    padding: 8px;
    min-width: 156px;
}

.doc-highlight-grid {
    display: grid;
    grid-template-columns: repeat(5, 24px);
    gap: 3px;
    margin-bottom: 6px;
}

.doc-highlight-swatch {
    width: 24px;
    height: 24px;
    border: 1px solid var(--border-color, #c8c8c8);
    border-radius: 2px;
    cursor: pointer;
    padding: 0;
}

.doc-highlight-swatch:hover {
    border-color: var(--primary, #0078d4);
}

.doc-highlight-swatch.active {
    border-color: var(--primary, #0078d4);
    outline: 1px solid var(--primary, #0078d4);
    outline-offset: 1px;
}

.doc-highlight-action {
    display: block;
    width: 100%;
    padding: 4px 6px;
    border: none;
    border-top: 1px solid var(--border-color, #e0e0e0);
    background: transparent;
    color: var(--text-primary, #333);
    font-size: 12px;
    text-align: left;
    cursor: pointer;
}

.doc-highlight-action:hover {
    background: var(--surface-hover, #e8e8e8);
}

.doc-highlight-action:first-of-type {
    margin-top: 4px;
}

/* -- Equation toolbar icon ------------------------------------------------- */

.e-de-equation-icon::before {
    content: '';
    display: inline-block;
    width: 1em;
    height: 1em;
    background: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M18 4H6l6 8-6 8h12'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M18 4H6l6 8-6 8h12'/%3E%3C/svg%3E") center / contain no-repeat;
}

.e-de-footnote-icon::before {
    content: '';
    display: inline-block;
    width: 1em;
    height: 1em;
    background: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z'/%3E%3Cpolyline points='14 2 14 8 20 8'/%3E%3Cpath d='M10 12h4'/%3E%3Cpath d='M12 10v8'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z'/%3E%3Cpolyline points='14 2 14 8 20 8'/%3E%3Cpath d='M10 12h4'/%3E%3Cpath d='M12 10v8'/%3E%3C/svg%3E") center / contain no-repeat;
}

.e-de-endnote-icon::before {
    content: '';
    display: inline-block;
    width: 1em;
    height: 1em;
    background: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z'/%3E%3Cpolyline points='14 2 14 8 20 8'/%3E%3Cpath d='M9 17h6'/%3E%3Cpath d='M12 10v5'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z'/%3E%3Cpolyline points='14 2 14 8 20 8'/%3E%3Cpath d='M9 17h6'/%3E%3Cpath d='M12 10v5'/%3E%3C/svg%3E") center / contain no-repeat;
}

.doc-layout-orientation-icon::before {
    content: '';
    display: inline-block;
    width: 1em;
    height: 1em;
    background: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Crect x='3' y='3' width='11' height='8' fill='%23000'/%3E%3Crect x='10' y='12' width='11' height='8' fill='%23000'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Crect x='3' y='3' width='11' height='8' fill='%23000'/%3E%3Crect x='10' y='12' width='11' height='8' fill='%23000'/%3E%3C/svg%3E") center / contain no-repeat;
}

.doc-layout-size-icon::before {
    content: '';
    display: inline-block;
    width: 1em;
    height: 1em;
    background: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 3h10l4 4v14H6z' fill='%23000'/%3E%3Cpath d='M16 3v5h5' fill='%23fff'/%3E%3Crect x='8' y='6' width='8' height='2' fill='%23fff'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 3h10l4 4v14H6z' fill='%23000'/%3E%3Cpath d='M16 3v5h5' fill='%23fff'/%3E%3Crect x='8' y='6' width='8' height='2' fill='%23fff'/%3E%3C/svg%3E") center / contain no-repeat;
}

.doc-layout-columns-icon::before {
    content: '';
    display: inline-block;
    width: 1em;
    height: 1em;
    background: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Crect x='4' y='4' width='16' height='16' fill='%23000'/%3E%3Crect x='7' y='6' width='3' height='12' fill='%23fff'/%3E%3Crect x='11' y='6' width='3' height='12' fill='%23fff'/%3E%3Crect x='15' y='6' width='3' height='12' fill='%23fff'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Crect x='4' y='4' width='16' height='16' fill='%23000'/%3E%3Crect x='7' y='6' width='3' height='12' fill='%23fff'/%3E%3Crect x='11' y='6' width='3' height='12' fill='%23fff'/%3E%3Crect x='15' y='6' width='3' height='12' fill='%23fff'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* -- Equation dialog -------------------------------------------------------- */

.equation-dialog .eq-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    padding: 0 0 8px;
    border-bottom: 1px solid var(--border-default, #e0e0e0);
    margin-bottom: 8px;
}

.equation-dialog .eq-tb-btn {
    font-family: "Cambria Math", "Segoe UI", system-ui, sans-serif;
    font-size: 14px;
    line-height: 1;
    min-width: 28px;
    height: 28px;
    padding: 2px 5px;
    border: 1px solid transparent;
    border-radius: 3px;
    background: transparent;
    color: var(--text-primary, #333);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.equation-dialog .eq-tb-btn:hover {
    background: var(--surface-hover, #f0f0f0);
    border-color: var(--border-default, #d1d5db);
}

.equation-dialog .eq-tb-sep {
    width: 1px;
    height: 20px;
    background: var(--border-default, #e0e0e0);
    margin: 4px 3px;
    align-self: center;
}

.equation-dialog .eq-input {
    display: block;
    width: 100%;
    box-sizing: border-box;
    font-family: "Cascadia Code", "Consolas", "Courier New", monospace;
    font-size: 14px;
    line-height: 1.5;
    padding: 8px 10px;
    border: 1px solid var(--border-default, #d1d5db);
    border-radius: 4px;
    background: var(--surface-primary, #fff);
    color: var(--text-primary, #333);
    resize: vertical;
}

.equation-dialog .eq-input:focus {
    outline: none;
    border-color: var(--accent, #0078d4);
}

.equation-dialog .eq-mode-toggle {
    padding: 6px 0;
}

.equation-dialog .eq-mode-label {
    font-size: 12px;
    color: var(--text-secondary, #666);
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.equation-dialog .eq-preview-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary, #888);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.equation-dialog .eq-preview {
    min-height: 60px;
    padding: 16px;
    border: 1px solid var(--border-default, #e0e0e0);
    border-radius: 4px;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: auto;
}

/* ── Graph Properties Panel ──────────────────────────────────────── */

.graph-properties-panel {
    width: 280px;
    min-width: 240px;
    max-width: 560px;
    border-left: 1px solid var(--border-default, #e0e0e0);
    background: var(--bg-surface, #ffffff);
    display: flex;
    position: relative;
    flex-direction: column;
    overflow: hidden;
}

.graph-properties-resize-handle {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    cursor: ew-resize;
    z-index: 10;
}
.graph-properties-resize-handle:hover {
    background: var(--accent, #005fb8);
    opacity: 0.3;
}

.graph-properties-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-default);
    background: var(--bg-sidebar);
    flex-shrink: 0;
}

.graph-properties-close {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-secondary, #666);
    padding: 2px 4px;
    border-radius: 3px;
}
.graph-properties-close:hover {
    background: var(--bg-hover, #eee);
}

.graph-properties-body {
    flex: 1;
    overflow-y: auto;
    padding: 4px 0;
}

.graph-props-section {
    border-bottom: 1px solid var(--border-subtle, #f0f0f0);
}
.graph-props-section > summary {
    padding: 8px 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary, #666);
    cursor: pointer;
    user-select: none;
    list-style: none;
}
.graph-props-section > summary::-webkit-details-marker { display: none; }
.graph-props-section > summary::before {
    content: "▸ ";
    font-size: 10px;
}
.graph-props-section[open] > summary::before {
    content: "▾ ";
}

.graph-props-subsection {
    margin: 2px 0;
    border: 1px solid var(--border-subtle, #f0f0f0);
    border-radius: 4px;
}
.graph-props-subsection > summary {
    padding: 5px 8px;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    user-select: none;
    list-style: none;
}
.graph-props-subsection > summary::-webkit-details-marker { display: none; }
.graph-props-subsection > summary::before { content: "▸ "; font-size: 9px; }
.graph-props-subsection[open] > summary::before { content: "▾ "; }
.graph-props-subsection > .graph-props-fields { padding: 4px 8px 8px; }

.graph-props-fields {
    padding: 4px 12px 10px;
}

.graph-props-label {
    display: block;
    font-size: 11px;
    color: var(--text-tertiary, #888);
    margin: 6px 0 3px;
}

.graph-props-input {
    width: 100%;
    padding: 4px 8px;
    font-size: 12px;
    border: 1px solid var(--border-default, #ddd);
    border-radius: 4px;
    background: var(--bg-surface, #fff);
    color: var(--text-primary, #333);
    outline: none;
    box-sizing: border-box;
}
.graph-props-input:focus {
    border-color: var(--accent, #005fb8);
    box-shadow: 0 0 0 1px var(--accent, #005fb8);
}

.graph-props-font-row {
    display: flex;
    gap: 4px;
}

.graph-props-add-btn {
    display: block;
    width: 100%;
    padding: 4px 8px;
    font-size: 11px;
    color: var(--accent, #005fb8);
    background: none;
    border: 1px dashed var(--border-default, #ddd);
    border-radius: 4px;
    cursor: pointer;
    text-align: center;
}
.graph-props-add-btn:hover {
    background: var(--bg-hover, #f0f4ff);
}

.graph-props-remove-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 12px;
    color: var(--text-tertiary, #999);
    padding: 2px 4px;
    border-radius: 3px;
}
.graph-props-remove-btn:hover {
    color: #c0392b;
    background: #ffeaea;
}

.graph-props-theme-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
}

.graph-props-theme-card {
    padding: 6px 8px;
    font-size: 11px;
    border: 1px solid var(--border-default, #ddd);
    border-radius: 4px;
    background: var(--bg-surface, #fff);
    cursor: pointer;
    text-align: center;
}
.graph-props-theme-card:hover {
    border-color: var(--accent, #005fb8);
}
.graph-props-theme-card.selected {
    border-color: var(--accent, #005fb8);
    background: var(--bg-accent-subtle, #e8f0fe);
    font-weight: 600;
}

.pane-maximize-btn.active {
    background: var(--bg-accent-subtle, #e8f0fe);
    color: var(--accent, #005fb8);
}

.settings-input {
    min-block-size: 32px;
    padding: 6px 10px;
    font-family: var(--font-ui);
    font-size: 13px;
    line-height: 18px;
    border: 1px solid var(--border-default, #ddd);
    border-radius: 4px;
    background: var(--bg-surface, #fff);
    color: var(--text-primary, #333);
    outline: none;
    box-sizing: border-box;
    width: 100%;
}
.settings-input:focus {
    border-color: var(--accent, #005fb8);
}

/* Settings typography is deliberately owned here, not by the switch. A setting has
   one hierarchy throughout the dialog: a quiet section label, readable supporting
   copy, then a medium-weight choice title and its regular-weight explanation. The
   dialog still contains legacy inline declarations, so these scoped rules explicitly
   take precedence while the surface is progressively moved to component classes. */
.settings-dialog .style-section-label {
    font-family: var(--font-ui);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .4px;
    color: var(--text-secondary, #5f6368);
}

.settings-dialog [style*="font-size:12px"][style*="line-height:1.5"] {
    font-family: var(--font-ui);
    font-size: 13px !important;
    font-weight: 400;
    line-height: 1.5 !important;
    color: var(--text-secondary, #5f6368) !important;
}

.settings-dialog label[style*="font-size:13px"] {
    font-family: var(--font-ui);
    font-size: 13px !important;
    font-weight: 400;
    line-height: 1.35;
    color: var(--text-primary, #24292f);
}

.settings-dialog label[style*="font-size:13px"] > span > strong {
    display: block;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.35;
    color: var(--text-primary, #24292f);
}

.settings-dialog label[style*="font-size:13px"] > span > span[style*="font-size:11px"] {
    display: block;
    margin-block-start: 3px !important;
    font-size: 12px !important;
    font-weight: 400;
    line-height: 1.45;
    color: var(--text-secondary, #5f6368) !important;
}

.settings-dialog label[style*="font-size:11px"][style*="display:block"] {
    font-family: var(--font-ui);
    font-size: 12px !important;
    font-weight: 600;
    line-height: 1.35;
    color: var(--text-secondary, #5f6368) !important;
}

/* A <select> wearing .settings-input needs room on the right that an <input> does not: the native
   disclosure arrow is painted INSIDE the control, over the padding box, so the symmetric 8px above
   leaves the label running underneath it. Chromium reserves a little slack of its own and mostly gets
   away with it, WebKit does not - which is why "Annotation mode" reads as truncated on macOS and looks
   fine on Windows. Keeping the native arrow (rather than appearance:none plus a drawn chevron) means
   each platform still renders the control its users expect. */
select.settings-input {
    padding-inline-end: 30px;
}

/* Inline informational hint above a Settings field; rendered when the
   active workbench notebook carries an annotation override. */
.settings-inline-hint {
    margin-bottom: 8px;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 12px;
    line-height: 1.4;
    background: color-mix(in srgb, var(--accent, #0078d4) 8%, var(--bg-surface, #fff));
    border: 1px solid color-mix(in srgb, var(--accent, #0078d4) 28%, var(--border-default, #ddd));
    color: var(--text-secondary, #555);
}

/* ── Pane Context Menu (shared across all panels) ─────────────────── */

.pane-context-overlay {
    position: fixed;
    inset: 0;
    z-index: 999;
}

/*
 * Monaco's overflowing-widget containers. `fixedOverflowWidgets: true` gives
 * these `position: fixed`, which lifts the suggest list, its documentation pane,
 * hovers, and signature help out of the editor's clipping box - but the
 * containers themselves stay INSIDE the editor's DOM (Monaco only detaches them
 * when the host passes an `overflowWidgetsDomNode`, which we do not). Being
 * fixed answers the clipping; it does not answer stacking, so without this the
 * popups still paint under the pane header and panel chrome.
 *
 * Lift them above the panes and the anchored menus, but keep them below the
 * modal layer (100000) so an open dialog still covers them.
 *
 * NB the class is `overflowingContentWidgets`, not the
 * `monaco-editor-overflow-widgets-root` used by builds that detach to <body>.
 * Verified against the Monaco shipped in BlazorMonaco 3.4.0 - check both names
 * if that package is ever upgraded.
 */
.monaco-editor .overflowingContentWidgets,
.monaco-editor .overflowingOverlayWidgets,
.monaco-editor-overflow-widgets-root {
    z-index: 10500 !important;
}

.pane-context-menu {
    position: fixed;
    z-index: 1000;
    min-width: 200px;
    background: var(--bg-surface, #fff);
    border: 1px solid var(--border-default, #e0e0e0);
    border-radius: 6px;
    box-shadow: 0 4px 16px rgba(0,0,0,.12);
    padding: 4px;
    outline: none;
}

/* Button-anchored variant: hangs below the trigger's right edge instead of at
   cursor coordinates. The trigger's container supplies the positioning context.
   right:0 rather than left:0 so the menu grows inward from the pane edge and
   cannot spill off the right of a narrow pane.

   Placed AFTER the base rule and kept to ONE class on purpose. It only has to
   out-rank .pane-context-menu, which source order now does - so a contextual
   override (.ai-composer .pane-context-menu--anchored, two classes) wins
   naturally. When this rule was doubled up and sat earlier in the file, every
   such override tied on specificity and lost silently to source order; that is
   how the chat composer's menu ended up opening downward off the screen. Do not
   move it back above .pane-context-menu, and do not add the second class. */
.pane-context-menu--anchored {
    position: absolute;
    left: auto;
    top: calc(100% + 4px);
    right: 0;
    /* The host pane clips its overflow, so a menu taller than the space below
       the header would be cut off rather than overflowing the pane. Scroll it
       instead - no item can become unreachable. */
    max-height: 60vh;
    overflow-y: auto;
}

.pane-context-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 5px 10px 5px 12px;
    border: none;
    background: transparent;
    font-size: 12px;
    font-family: var(--font-ui);
    color: var(--text-primary, #333);
    cursor: pointer;
    border-radius: 3px;
    text-align: left;
    white-space: nowrap;
}
.pane-context-item:hover:not(:disabled) {
    background: var(--accent-subtle, #e8f0fe);
    color: var(--accent, #005fb8);
}
.pane-context-item:disabled {
    color: var(--text-disabled, var(--text-secondary));
    cursor: default;
    opacity: .55;
}
.pane-context-item.pane-context-danger:hover:not(:disabled) {
    background: rgba(211,47,47,.08);
    color: var(--error-fg, #b71c1c);
}

.pane-context-icon {
    display: inline-flex;
    width: 14px;
    height: 14px;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    flex: none;
}

/* Label + optional description share one column so the two lines stack beside
   the icon rather than under it. Always present, even for single-line menus, so
   the row structure is the same whichever layout is in play. */
.pane-context-text {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.pane-context-label {
    flex: 0 0 auto;
}

.pane-context-shortcut {
    margin-left: 24px;
    color: var(--text-secondary, #888);
    font-size: 11px;
    font-family: var(--font-ui);
    flex: none;
}

.pane-context-sep {
    height: 1px;
    background: var(--border-default, #e0e0e0);
    margin: 4px 0;
}

/* ── Described menus (mode / context pickers) ─────────────────────────
   Opt-in two-line layout, applied only when an item carries a Description.
   Menus of one-off commands keep the compact single-line rows above. */

.pane-context-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    padding: 8px 12px 6px 12px;
    font-size: 12px;
    color: var(--text-secondary);
}

.pane-context-header-text {
    font-weight: 600;
}

/* Rendered as a <button> so the click can be routed in .NET rather than
   through an href, but it is a link to the reader and must look like one -
   the default button chrome (border, background, padding, centred bold
   label) turned a quiet "Learn more" into a control competing with the
   menu items below it. */
.pane-context-header-link {
    flex: none;
    font-size: 11px;
    color: var(--accent);
    text-decoration: none;
    appearance: none;
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    font-family: inherit;
    line-height: inherit;
    cursor: pointer;
}

.pane-context-header-link:hover {
    text-decoration: underline;
}

/* Wider than a command menu: two lines of prose need the room, and a
   description that wraps to four lines defeats the point of having it. */
.pane-context-menu--described {
    min-width: 300px;
    max-width: 380px;
}

.pane-context-menu--described .pane-context-item {
    align-items: flex-start;
    padding: 8px 10px 8px 12px;
    white-space: normal;
}

/* Nudge the icon and the tick onto the title's optical line - both are
   flex-start aligned against a two-line block, so they otherwise sit a
   little high against the cap height of the label. */
.pane-context-menu--described .pane-context-icon,
.pane-context-menu--described .pane-context-check {
    margin-top: 1px;
}

.pane-context-menu--described .pane-context-label {
    font-weight: 600;
}

.pane-context-description {
    margin-top: 2px;
    font-size: 11px;
    line-height: 1.4;
    color: var(--text-secondary);
}

/* The description must stay readable against the hover/checked tints, which
   both recolour the row - without this it inherits the accent and the two
   lines stop reading as title + supporting text. */
.pane-context-item:hover:not(:disabled) .pane-context-description,
.pane-context-item--checked .pane-context-description {
    color: var(--text-secondary);
}

.pane-context-item--checked .pane-context-label {
    color: var(--accent);
}

.pane-context-check {
    flex: none;
    display: inline-flex;
    align-items: center;
    color: var(--accent);
}

/* Classification chip (e.g. "Custom" on a user-authored agent). Distinct from
   .pane-context-shortcut, which is muted keyboard text. */
.pane-context-badge {
    flex: none;
    align-self: center;
    padding: 1px 6px;
    border: 1px solid var(--border-default);
    border-radius: 8px;
    font-size: 10px;
    line-height: 1.5;
    color: var(--text-secondary);
    white-space: nowrap;
}

/* Wrapper that exists to scope the right-click event, not to lay anything out -
   it must not disturb the spreadsheet's own sizing. */
.data-spreadsheet-host {
    display: contents;
}

/* ── Vendor context menus, aligned to the workbench menu scale ──────────────
   Right-click menus in the workbench come from three places: our own
   PaneContextMenu (12px / --font-ui), Monaco's, and Syncfusion's. Left alone
   the three render at 12 / 11 / 14px in two different families, so the same
   gesture produced visibly different menus depending on which pane the pointer
   was over. Both vendors' menus are plain DOM in this document - no shadow
   root - so a stylesheet rule reaches them, and 12px / --font-ui is the one
   scale (it is what our own menus and the notebook overflow panel already
   use). Sizes here are deliberately NOT !important: the specificity of each
   selector already beats the vendor's own, and a future vendor rule that
   legitimately needs to win should be able to.

   Only typography and row rhythm are normalised. Colours stay with the vendor
   theme so a Monaco or Syncfusion menu still reads as part of its own control.
   ────────────────────────────────────────────────────────────────────────── */

/* Monaco: the label carries the size (.monaco-action-bar .action-label is
   11px), the container carries the family. Both are set so a menu row matches
   ours whichever the cascade resolves first. */
.monaco-menu .monaco-action-bar.vertical .action-item .action-label,
.monaco-menu .monaco-action-bar.vertical .action-menu-item .action-label {
    font-size: 12px;
    font-family: var(--font-ui);
}

/* No row-height rule for Monaco on purpose. Monaco sets neither height nor padding on
   its vertical menu rows - they are content-sized - so raising the label to 12px grows
   them into step with ours on its own. Pinning a height here would be inventing a
   constraint the control never had, and its separators, submenu rows and checkbox rows
   share this structure. */

/* Keybinding hints sit alongside the label; ours are 11px (.pane-context-shortcut). */
.monaco-menu .monaco-action-bar.vertical .action-item .keybinding,
.monaco-menu .monaco-action-bar.vertical .action-menu-item .keybinding {
    font-size: 11px;
    font-family: var(--font-ui);
}

/* Syncfusion (spreadsheet, document editor, diagram). The theme sets 14px on
   the <ul>; every row inherits it, so the <ul> is the single point to change. */
.e-contextmenu-wrapper ul,
.e-contextmenu-container ul,
.e-contextmenu-wrapper ul.e-ul,
.e-contextmenu-container ul.e-ul {
    font-size: 12px;
    font-family: var(--font-ui);
}

.e-contextmenu-wrapper ul .e-menu-item,
.e-contextmenu-container ul .e-menu-item {
    height: 26px;
    line-height: 26px;
}

/* The theme sizes icons and submenu carets off the same 14px scale; bring them
   down in step or the rows keep the taller rhythm the font change just removed. */
.e-contextmenu-wrapper ul .e-menu-item .e-menu-icon,
.e-contextmenu-container ul .e-menu-item .e-menu-icon,
.e-contextmenu-wrapper ul .e-menu-item .e-caret,
.e-contextmenu-container ul .e-menu-item .e-caret {
    font-size: 12px;
}

/* ── Graph Context Menu ──────────────────────────────────────────── */

/* .graph-context-menu / .graph-context-item / .graph-context-sep removed -
   GraphContextMenu now delegates to the shared .pane-context-* component
   defined further up the file. .graph-context-overlay survives because
   GraphPane reuses it for the legend color-picker overlay. */

.graph-context-overlay {
    position: fixed;
    inset: 0;
    z-index: 999;
}

/* ── Graph Export Dialog ─────────────────────────────────────────── */

.export-preset-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
    margin-bottom: 16px;
}

.export-preset-card {
    padding: 10px;
    border: 1px solid var(--border-default, #ddd);
    border-radius: 6px;
    background: var(--bg-surface, #fff);
    cursor: pointer;
    text-align: center;
    transition: border-color .15s;
}
.export-preset-card:hover {
    border-color: var(--accent, #005fb8);
}
.export-preset-card.selected {
    border-color: var(--accent, #005fb8);
    background: var(--bg-accent-subtle, #e8f0fe);
}
.export-preset-card-name {
    font-weight: 600;
    font-size: 12px;
    margin-bottom: 2px;
}
.export-preset-card-desc {
    font-size: 10px;
    color: var(--text-tertiary, #888);
}

/* ── Inline Edit Overlay ─────────────────────────────────────────── */

.graph-inline-edit-overlay {
    position: absolute;
    z-index: 50;
    background: var(--bg-surface, #fff);
    border: 2px solid var(--accent, #005fb8);
    border-radius: 4px;
    padding: 4px 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,.15);
}

.graph-inline-edit-input {
    border: none;
    outline: none;
    font-size: 14px;
    font-family: var(--font-ui);
    width: 250px;
    background: transparent;
    color: var(--text-primary, #333);
}

/* -- Diagram editor pane -------------------------------------------------- */

.pane-content.diagram-editor-content {
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding: 0;
}

.pane-content.diagram-editor-content .e-diagram,
.pane-content.diagram-editor-content .e-symbolpalette {
    pointer-events: auto;
}

.pane-content.diagram-editor-content .e-diagram canvas {
    pointer-events: auto;
}

.diagram-ribbon-area .e-ribbon .e-ribbon-collapse-btn {
    display: inline-flex;
}

.diagram-ribbon-area .e-ribbon .e-tab .e-content {
    padding: 2px 4px;
}

.diagram-ribbon-area .e-ribbon .e-ribbon-group {
    padding: 2px 6px;
}

.diagram-ribbon-area .e-ribbon .e-ribbon-group-header {
    font-size: 10px;
    padding: 0 2px 1px;
}

.diagram-ribbon-colorpicker {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 72px;
    min-height: 72px;
    padding: 6px;
}

.diagram-ribbon-color-label {
    margin-top: 4px;
    font-size: 12px;
    text-align: center;
}

.diagram-ribbon-area .e-ribbon .e-btn {
    padding: 2px 6px;
    font-size: 12px;
}

.diagram-ribbon-area .e-ribbon .e-btn .e-btn-icon {
    font-size: 14px;
}

.diagram-editor-container {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: row;
    position: relative;
    background: var(--bg-page, #f3f3f3);
}

/* The shapes palette is an inset rounded card on the same grid as the ribbon
   above it: the ribbon's own 8px bottom padding supplies the gap between them,
   so this adds none of its own on top. */
.diagram-palette-area {
    width: 260px;
    min-width: 220px;
    max-width: 400px;
    margin: 0 8px 8px;
    border: 1px solid var(--border-color, #e0e0e0);
    border-radius: 8px;
    background: var(--bg-surface, #ffffff);
    box-shadow: 0 1px 3px rgba(0, 0, 0, .08);
    overflow: auto;
    flex-shrink: 0;
}

/* The palette is a shapes source, not a document: a drag that starts on a
   category header or a shape label must begin the shape drag, and the browser
   must not turn it into a text selection that then stays highlighted after the
   pointer is released. The filter field below opts back in. */
.diagram-palette-area,
.diagram-palette-area * {
    -webkit-user-select: none;
    user-select: none;
}

.diagram-palette-area .e-symbolpalette .e-acrdn-header {
    padding-right: 32px;
}

.diagram-palette-area .e-tooltip-wrap {
    display: none !important;
}

.diagram-palette-area .e-symbol-description {
    margin-top: 8px;
    line-height: 1.2;
}

/* -- Palette filter field --------------------------------------------------
   The filter sits inside the palette card and acts on the list directly below
   it, so it is filled rather than bordered: a border here would read as a
   second card edge a few pixels inside the first. --bg-hover is a translucent
   tint in every theme, so the field stays one step recessed from whatever
   surface the card is painted in. */

.diagram-palette-area .e-symbolpalette .e-input-group {
    box-sizing: border-box;
    width: calc(100% - 16px);
    margin: 8px;
    padding: 0 8px;
    border: none !important;
    border-radius: 6px;
    background: var(--bg-hover) !important;
    box-shadow: none !important;
    transition: background .12s, box-shadow .12s;
}

/* Syncfusion draws the focus underline as a pseudo-element on the group, which
   under a filled field is a stray line across the bottom of the pill. */
.diagram-palette-area .e-symbolpalette .e-input-group::before,
.diagram-palette-area .e-symbolpalette .e-input-group::after {
    display: none !important;
}

.diagram-palette-area .e-symbolpalette .e-input-group input.e-input {
    -webkit-user-select: text;
    user-select: text;
    padding: 6px 0;
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    color: var(--text-primary);
    font-size: 13px;
}

.diagram-palette-area .e-symbolpalette .e-input-group input.e-input::placeholder {
    color: var(--text-tertiary);
}

.diagram-palette-area .e-symbolpalette .e-input-group .e-input-group-icon {
    border: none !important;
    background: transparent !important;
    color: var(--text-tertiary);
    min-height: 0;
    padding: 0 0 0 6px;
    margin: 0;
}

.diagram-palette-area .e-symbolpalette .e-input-group.e-input-focus,
.diagram-palette-area .e-symbolpalette .e-input-group:focus-within {
    background: var(--bg-input) !important;
    box-shadow: 0 0 0 1px var(--accent) !important;
}

.diagram-palette-area .e-symbolpalette path {
    fill-rule: nonzero !important;
}


/* The canvas is the second card on the row: the shapes palette's own right
   margin supplies the gutter between them, so this adds none on that side. */
.diagram-canvas-area {
    flex: 1;
    min-width: 0;
    min-height: 0;
    margin: 0 8px 8px 0;
    border: 1px solid var(--border-default);
    border-radius: 8px;
    background: var(--bg-surface);
    box-shadow: 0 1px 3px rgba(0, 0, 0, .08);
    overflow: hidden;
    position: relative;
}

.diagram-canvas-area .e-diagram path {
    fill-rule: nonzero !important;
}

.diagram-overview-panel {
    position: absolute;
    bottom: 8px;
    right: 8px;
    border: 1px solid var(--border-color, #e0e0e0);
    border-radius: 4px;
    background: var(--bg-primary, #ffffff);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    z-index: 5;
    overflow: hidden;
}

.icon-diagram {
    color: #6366f1;
}

/* ── Notebook pane ───────────────────────────────────────────── */
.notebook-pane-header {
    height: auto;
    min-height: 35px;
    /* Single row, always: the title ellipsizes (flex 1 1, min-width 0) so the
       toolbar never wraps onto a second row - a wrapped header is what made
       the actions menu appear to "jump up a row" when it opened. */
    flex-wrap: nowrap;
    column-gap: 8px;
    padding-top: 6px;
    padding-bottom: 6px;
    align-items: center;
}

.notebook-pane-header .notebook-pane-title {
    flex: 1 1 140px;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.notebook-pane-header .notebook-toolbar {
    /* Natural width, never wraps; the title column absorbs all shrinkage. */
    flex: 0 0 auto;
    justify-content: flex-end;
    flex-wrap: nowrap;
    gap: 4px;
}

.notebook-icon-btn {
    width: 26px;
    height: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: var(--bg-surface);
    color: var(--text-tertiary);
    cursor: pointer;
    border-radius: 3px;
    padding: 0;
    flex-shrink: 0;
    box-sizing: border-box;
}

.notebook-icon-btn:hover {
    background: var(--bg-active);
    color: var(--text-primary);
}

.notebook-icon-btn.active {
    color: var(--accent);
    background: var(--bg-active);
}

/* Double-play + label (VS Code-style Run All) */
.notebook-run-all-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 26px;
    padding: 0 10px 0 8px;
    border: 1px solid var(--border-default);
    border-radius: 6px;
    background: var(--bg-surface);
    color: var(--text-primary);
    font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
    font-size: 12.5px;
    font-weight: 600;
    letter-spacing: 0.01em;
    cursor: pointer;
    flex-shrink: 0;
    box-sizing: border-box;
    box-shadow: 0 1px 0 color-mix(in srgb, var(--text-primary) 6%, transparent);
}

.notebook-run-all-btn .notebook-run-all-label {
    line-height: 1;
    user-select: none;
}

.notebook-run-all-btn:hover:not(:disabled) {
    background: var(--bg-active);
    border-color: color-mix(in srgb, var(--accent) 35%, var(--border-default));
    color: var(--text-primary);
}

.notebook-run-all-btn:active:not(:disabled) {
    transform: translateY(0.5px);
    box-shadow: none;
}

.notebook-run-all-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.notebook-pane-content {
    overflow: auto;
    flex: 1;
    min-height: 0;
}

.notebook-cells {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 8px;
}

.notebook-cell-row {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    gap: 0;
    border-radius: 8px;
    border: none;
    background: transparent;
}

/* Lifted preview: transform is applied in notebook-drag.js; keep hit-testing on rows beneath. */
.notebook-cell-row-dragging {
    position: relative;
    z-index: 50;
    opacity: 0.98;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14);
    will-change: transform;
}

/* Insertion position during drag (driven by notebook-drag.js); gap-centered between rows. */
.notebook-drop-insert-line {
    display: none;
    height: 4px;
    background: var(--accent, #0078d4);
    border-radius: 2px;
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent, #0078d4) 35%, transparent),
        0 2px 8px color-mix(in srgb, var(--accent, #0078d4) 45%, transparent);
    pointer-events: none;
}

/* Legacy: row-level drop target no longer applied by JS (replaced by gap line). Kept for older caches. */
.notebook-cell-row-drop-target {
    position: relative;
    z-index: 2;
    border-radius: 8px;
    background: color-mix(in srgb, var(--accent, #0078d4) 12%, transparent);
    box-shadow:
        inset 0 0 0 2px color-mix(in srgb, var(--accent, #0078d4) 55%, transparent),
        0 0 0 1px color-mix(in srgb, var(--accent, #0078d4) 25%, transparent);
}

.notebook-cell-row-drop-target::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: 5px;
    background: var(--accent, #0078d4);
    border-radius: 8px 8px 0 0;
    pointer-events: none;
    z-index: 3;
    box-shadow: 0 2px 8px color-mix(in srgb, var(--accent, #0078d4) 40%, transparent);
}

/* Selection is shown on the gutter strip only - avoids a second blue frame on top of the pane. */
.notebook-cell-row-selected .notebook-cell-inner {
    border-radius: 0 8px 8px 0;
    background: color-mix(in srgb, var(--accent, #0078d4) 5%, var(--bg-sidebar, var(--bg-surface)));
}

.notebook-cell-gutter {
    flex: 0 0 28px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 4px;
    padding-top: 6px;
    min-height: 36px;
    background: var(--bg-surface);
    border-radius: 8px 0 0 8px;
    border: 1px solid var(--border-subtle);
    border-right: none;
}

/* Reorder: `move` - the desktop host cannot render grab / grabbing or url() glyphs, and both hosts must match. */
.notebook-cell-drag-zone {
    cursor: move;
    user-select: none;
    -webkit-user-select: none;
}

.notebook-cell-drag-zone:active {
    cursor: move;
}

/* Press-and-hold: :active is unreliable with pointer capture / before drag threshold; notebook-drag.js sets these. */
body.notebook-cell-drag-pressing {
    cursor: move !important;
}

.notebook-pane .notebook-cell-drag-zone.notebook-drag-zone-pressed {
    cursor: move !important;
    filter: brightness(0.93);
}

body.notebook-cell-reorder-active {
    cursor: move !important;
}

/* Markdown gutter: invisible when idle (matches the borderless markdown cell).
   Reveals on row hover so the drag handle remains discoverable; selection rules
   below have higher specificity and override both states. */
.notebook-cell-gutter-md {
    background: transparent;
    border-color: transparent;
}

.notebook-md-row:hover .notebook-cell-gutter-md {
    background: color-mix(in srgb, var(--text-tertiary) 6%, var(--bg-surface));
    border-color: var(--border-subtle);
}

.notebook-cell-gutter-selected {
    box-shadow: inset 3px 0 0 0 var(--accent, #0078d4);
    background: color-mix(in srgb, var(--accent, #0078d4) 8%, var(--bg-surface));
}

/* Markdown gutters: higher specificity than .notebook-cell-gutter-md alone (order/load can otherwise hide selection). */
.notebook-cell-gutter-md.notebook-cell-gutter-selected {
    box-shadow: inset 3px 0 0 0 var(--accent, #0078d4);
    background: color-mix(in srgb, var(--accent, #0078d4) 8%, var(--bg-surface));
}

/* Same chrome when the row is selected (row + gutter classes should align; this matches code-cell gutter treatment). */
.notebook-md-row.notebook-cell-row-selected .notebook-cell-gutter {
    box-shadow: inset 3px 0 0 0 var(--accent, #0078d4);
    background: color-mix(in srgb, var(--accent, #0078d4) 8%, var(--bg-surface));
}

.notebook-cell-inner {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.notebook-cell-row .notebook-cell {
    border-radius: 0 8px 8px 0;
    border-left: none;
}

/* Jump to script line - text link, not a second “badge” button */
.notebook-cell-output .notebook-output-source-line {
    margin-left: 6px;
    padding: 0;
    border: none;
    background: none;
    font: inherit;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-tertiary);
    text-decoration: underline;
    text-decoration-color: color-mix(in srgb, var(--text-tertiary) 45%, transparent);
    text-underline-offset: 2px;
    cursor: pointer;
    border-radius: 2px;
}

.notebook-cell-output .notebook-output-source-line:hover {
    color: var(--accent);
    text-decoration-color: color-mix(in srgb, var(--accent) 55%, transparent);
}

/* Cell ⋯ menu - same pattern as .tree-context-overlay / .tree-context-menu */
.notebook-overflow-anchor {
    position: relative;
    display: inline-block;
}

.notebook-overflow-backdrop {
    position: fixed;
    inset: 0;
    z-index: 999;
}

.notebook-overflow-panel {
    min-width: 200px;
    max-height: min(70vh, 520px);
    overflow-y: auto;
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: 6px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    padding: 4px;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.notebook-overflow-panel-floating {
    position: fixed;
    z-index: 1000;
    transform: translateX(-100%);
}

/* Toolbar-anchored variant: drops below its anchor, right-aligned so it
   never overflows the pane's right edge. Used by the notebook header's
   "…" actions menu. */
.notebook-overflow-panel-anchored {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    z-index: 1000;
}

.notebook-overflow-item {
    text-align: left;
    border: none;
    background: transparent;
    padding: 6px 10px;
    cursor: pointer;
    font-size: 12px;
    font-family: var(--font-ui);
    color: var(--text-primary);
    border-radius: 4px;
    width: 100%;
}

.notebook-overflow-item:hover:not(:disabled) {
    background: var(--accent-subtle);
    color: var(--accent);
}

.notebook-overflow-item:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.notebook-overflow-divider {
    border: none;
    border-top: 1px solid var(--border-subtle);
    margin: 4px 0;
}

.notebook-cell {
    border: 1px solid var(--border-default);
    border-radius: 6px;
    background: var(--bg-sidebar);
}

.notebook-cell-chrome {
    /* Positioning context for the AI next-step popover (.notebook-cell-ai-next-step-chip),
       which hangs full-width below the chrome. The markdown-cell chrome overrides
       this with position:absolute further down. */
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border-bottom: 1px solid var(--border-subtle);
    font-size: 12px;
}


.notebook-cell-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px;
    margin-left: auto;
}

/* The labelled AI disclosure and progress indicator share the toolbar row.
   The disclosure expands in normal flow so all actions remain reachable by
   notebook scrolling. Error messages anchor to the wider cell chrome. */
.notebook-cell-ai-actions {
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    gap: 2px;
}

/* Floating error popover hanging below the cell chrome, right-aligned, with
   its arrow pointing back at the AI actions disclosure. Anchored to
   .notebook-cell-chrome (position: relative) rather than the AI-actions
   group so it resolves to its natural single-line width and is capped by the
   cell width, never by the anchor's width. It replaces an earlier in-flow
   chip that was rendered as a flex item of `.notebook-cell-toolbar` and
   shoved the delete / overflow buttons aside. Dismissible (×), offers Retry
   when the failure was transient. */
.notebook-cell-ai-error-chip {
    position: absolute;
    top: calc(100% + 6px);
    right: 8px;
    z-index: 50;
    display: flex;
    align-items: center;
    gap: 8px;
    width: max-content;
    max-width: min(420px, calc(100% - 16px));
    min-width: min(220px, calc(100% - 16px));
    padding: 6px 8px 6px 10px;
    font-size: 12px;
    line-height: 1.35;
    color: #7a1d1d;
    background: #fff5f5;
    border: 1px solid #f5b8b8;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    white-space: normal;
    /* Lives inside the drag-zone chrome: not a reorder handle. */
    cursor: default;
    user-select: text;
    -webkit-user-select: text;
}

/* Arrow sits under the last AI action button: the delete + overflow buttons
   and their separator occupy the ~60px to its right in the cell toolbar. */
.notebook-cell-ai-error-chip::before {
    content: "";
    position: absolute;
    top: -5px;
    right: 72px;
    width: 8px;
    height: 8px;
    background: #fff5f5;
    border-left: 1px solid #f5b8b8;
    border-top: 1px solid #f5b8b8;
    transform: rotate(45deg);
}

.notebook-cell-ai-error-text {
    flex: 1 1 auto;
    min-width: 0;
}

.notebook-cell-ai-error-retry,
.notebook-cell-ai-error-dismiss {
    flex: 0 0 auto;
    padding: 2px 8px;
    font-size: 11px;
    font-family: inherit;
    color: #7a1d1d;
    background: #ffffff;
    border: 1px solid #f5b8b8;
    border-radius: 4px;
    cursor: pointer;
    line-height: 1.2;
}

.notebook-cell-ai-error-retry:hover,
.notebook-cell-ai-error-dismiss:hover {
    background: #fde2e2;
}

.notebook-cell-ai-error-dismiss {
    width: 20px;
    height: 20px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    line-height: 1;
}

/* Next-step suggestion popover. Rendered by NotebookCellAiActionToolbar as a
   sibling of the AI-actions group inside .notebook-cell-toolbar; without this
   block it shipped unstyled and landed as an in-flow flex item of the toolbar:
   the prose wrapped onto its own row, the delete / overflow buttons dropped to a
   third row, and the two 22px .pane-maximize-btn buttons stacked their labels
   vertically on top of each other. Anchored to .notebook-cell-chrome so it spans
   the cell width and floats over the editor rather than reflowing the chrome. */
.notebook-cell-ai-next-step-chip {
    position: absolute;
    top: calc(100% + 6px);
    left: 8px;
    right: 8px;
    z-index: 50;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px 12px 10px;
    font-size: 12px;
    font-family: var(--font-ui);
    line-height: 1.45;
    color: var(--text-primary);
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-left: 3px solid var(--accent);
    border-radius: 6px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.14);
    cursor: default;
    user-select: text;
    -webkit-user-select: text;
    white-space: normal;
    text-align: left;
}

.notebook-cell-ai-next-step-header {
    display: flex;
    align-items: center;
    gap: 8px;
}

.notebook-cell-ai-next-step-title {
    flex: 1 1 auto;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
}

.notebook-cell-ai-next-step-dismiss {
    flex: 0 0 auto;
    width: 20px;
    height: 20px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    line-height: 1;
    color: var(--text-tertiary);
    background: transparent;
    border: none;
    border-radius: 3px;
    cursor: pointer;
}

.notebook-cell-ai-next-step-dismiss:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.notebook-cell-ai-next-step-prose p { margin: 0 0 0.5em; }
.notebook-cell-ai-next-step-prose p:last-child { margin-bottom: 0; }
.notebook-cell-ai-next-step-prose code {
    font-family: var(--font-mono);
    font-size: 11px;
    padding: 1px 4px;
    background: var(--bg-hover);
    border-radius: 3px;
}

.notebook-cell-ai-next-step-chip .notebook-suggestion-code {
    margin: 0;
    padding: 6px 10px;
    font-family: var(--font-mono);
    font-size: 12px;
    line-height: 1.4;
    color: var(--text-primary);
    background: var(--bg-sidebar);
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    max-height: 160px;
    overflow: auto;
}

.notebook-cell-ai-next-step-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 6px;
}

.notebook-cell-ai-next-step-actions > button {
    height: 26px;
    padding: 0 12px;
    font-size: 12px;
    font-family: var(--font-ui);
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    cursor: pointer;
    white-space: nowrap;
}

.notebook-cell-ai-next-step-actions > button:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}

.notebook-cell-ai-next-step-insert {
    color: var(--text-inverse);
    background: var(--accent);
    border: 1px solid var(--accent);
}

.notebook-cell-ai-next-step-insert:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
}

.notebook-cell-ai-action-spinner {
    display: inline-block;
    width: 12px;
    height: 12px;
    margin-left: 4px;
    border: 2px solid var(--border-default, #d0d7de);
    border-top-color: var(--accent, #005fb8);
    border-radius: 50%;
    animation: notebook-cell-ai-action-spin 0.8s linear infinite;
}

@keyframes notebook-cell-ai-action-spin {
    to { transform: rotate(360deg); }
}

.notebook-cell-badge {
    font-weight: 600;
    color: var(--text-secondary);
}

.notebook-stale-badge {
    font-size: 11px;
    font-weight: 700;
    color: var(--warning-fg);
    background: color-mix(in srgb, var(--warning-fg) 12%, var(--bg-surface));
    padding: 1px 6px;
    border-radius: 4px;
}

.notebook-code-block {
    margin: 0;
    padding: 8px;
    font-family: var(--font-mono);
    font-size: 12px;
    white-space: pre-wrap;
    max-height: 240px;
    overflow: auto;
    background: var(--bg-surface);
    color: var(--text-primary);
}

/* Height is driven by notebook-cell-monaco.js (min/max lines); keep a tight fallback before JS runs so 1-line cells don't flash as 5-line boxes. */
.notebook-cell-monaco {
    min-height: 2.5rem;
    border: 1px solid var(--border-default);
    border-radius: 4px;
    /* allow Monaco suggest widget & parameter hints to draw outside the cell (see FixedOverflowWidgets in NotebookCellCodeEditor) */
    overflow: visible;
    background: var(--bg-surface);
}

.notebook-cell-monaco .monaco-editor {
    min-height: 0;
}

/* Shown only when Monaco never loaded: the cell body stays readable instead of
   the cell rendering as an empty box (NotebookCellCodeEditor, MonacoReadiness). */
.notebook-cell-monaco-unavailable {
    padding: 6px 8px;
}

.notebook-cell-monaco-unavailable-note {
    margin: 0 0 4px;
    color: var(--text-muted);
    font-size: 0.8125rem;
}

.notebook-cell-monaco-unavailable-text {
    margin: 0;
    white-space: pre-wrap;
    overflow-x: auto;
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    color: var(--text-primary);
}

.notebook-cell-monaco .monaco-editor .suggest-widget {
    z-index: 20;
}

/* Completes the cell frame: .notebook-cell wraps editor only; output is a sibling, so it must
   carry the outer right and bottom borders (gutter already draws its own bottom edge). */
.notebook-cell-output {
    padding: 6px 8px 10px;
    border-top: 1px dashed var(--border-subtle);
    border-right: 1px solid var(--border-default);
    border-bottom: 1px solid var(--border-default);
    border-bottom-right-radius: 8px;
}

/* Inherit cell chrome; avoid double surface behind preset-styled tables/stats.
   Nothing else scrolls a notebook cell sideways, so wide output scrolls here
   rather than pushing past the cell's own right border. */
.notebook-cell-output .output-content {
    padding: 4px 2px 6px;
    background: transparent;
    overflow-x: auto;
    /* Output owns horizontal scrolling, but the notebook owns vertical
       scrolling. The standalone output pane's containment would trap wheel
       gestures here even when this content has no vertical scroll range. */
    overscroll-behavior-y: auto;
    /* Height is content-driven, so no vertical scrollbar ever appears and the
       pane's reserved gutter would only blank out 15px of every cell. */
    scrollbar-gutter: auto;
}

/* Markdown source: align with .notebook-md-preview's left padding; height still from notebook-cell-monaco.js. */
.notebook-md-monaco.notebook-cell-monaco {
    margin: 4px 12px 8px;
}

/* Markdown cells render as flowing document prose, not as cards. We override the
   base .notebook-cell card frame (border / radius / fill) and use position:relative
   as the anchor for the floating chrome pill below; overflow:visible so the pill's
   shadow is not clipped. */
.notebook-cell.notebook-md {
    background: transparent;
    border: none;
    border-radius: 0;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 0;
    overflow: visible;
}

/* Markdown chrome (toggle + convert) floats top-right of the cell as a quiet pill,
   hidden by default. Revealed on hover, keyboard focus, row selection, or while
   the cell is in source-edit mode. The gutter remains the primary drag handle
   (NotebookPane.razor adds its own data-nb-drag), so hiding the chrome does not
   regress drag-to-reorder. */
.notebook-cell.notebook-md > .notebook-cell-chrome {
    position: absolute;
    top: 4px;
    right: 4px;
    z-index: 2;
    padding: 2px 4px;
    margin: 0;
    border: 1px solid var(--border-subtle);
    border-radius: 5px;
    background: var(--bg-surface);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    opacity: 0;
    pointer-events: none;
    transition: opacity 120ms ease;
}

.notebook-md-row:hover .notebook-cell.notebook-md > .notebook-cell-chrome,
.notebook-cell.notebook-md:focus-within > .notebook-cell-chrome,
.notebook-md-row.notebook-cell-row-selected .notebook-cell.notebook-md > .notebook-cell-chrome,
.notebook-cell.notebook-md.notebook-md-editing > .notebook-cell-chrome {
    opacity: 1;
    pointer-events: auto;
}

/* Rendered / Markdown view switch - quiet inline pair, no segmented-control border. */
.notebook-md-view-switch {
    display: inline-flex;
    align-items: center;
    margin-left: 0;
    border: none;
    background: transparent;
}

.notebook-md-tab {
    border: none;
    background: transparent;
    padding: 1px 6px;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-tertiary);
    cursor: pointer;
    line-height: 1.4;
    border-radius: 3px;
}

.notebook-md-tab + .notebook-md-tab {
    margin-left: 2px;
}

.notebook-md-tab:hover:not(.active) {
    color: var(--text-primary);
}

.notebook-md-tab.active {
    color: var(--text-primary);
    background: color-mix(in srgb, var(--accent, #0078d4) 14%, transparent);
}

/* Document-style rendered preview: no inner card. Right padding reserves room for
   the floating chrome pill on the first line. Drop the previous min/max-height -
   markdown flows naturally as prose between code cells. */
.notebook-md-preview {
    box-sizing: border-box;
    align-self: stretch;
    flex: 1 1 auto;
    margin: 0;
    padding: 6px 84px 8px 12px;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-size: 13px;
    line-height: 1.5;
    overflow: visible;
}

.notebook-md-preview:focus {
    outline: none;
}

.notebook-md-preview:focus-visible {
    outline: none;
}

.notebook-md-preview-empty {
    color: var(--text-tertiary);
    font-style: italic;
    font-size: 12px;
}

.notebook-md-preview h1,
.notebook-md-preview h2,
.notebook-md-preview h3,
.notebook-md-preview h4 {
    margin: 0.6em 0 0.35em;
    font-weight: 650;
    line-height: 1.25;
}

.notebook-md-preview h1 { font-size: 1.35rem; }
.notebook-md-preview h2 { font-size: 1.2rem; }
.notebook-md-preview h3 { font-size: 1.08rem; }

.notebook-md-preview p {
    margin: 0.4em 0;
}

.notebook-md-preview ul,
.notebook-md-preview ol {
    margin: 0.4em 0;
    padding-left: 1.35em;
}

.notebook-md-preview pre,
.notebook-md-preview code {
    font-family: var(--font-mono, ui-monospace, monospace);
    font-size: 12px;
}

.notebook-md-preview pre {
    margin: 0.5em 0;
    padding: 8px 10px;
    overflow: auto;
    border-radius: 4px;
    background: color-mix(in srgb, var(--text-primary) 5%, var(--bg-surface));
    border: 1px solid var(--border-subtle);
}

.notebook-md-preview :not(pre) > code {
    padding: 1px 4px;
    border-radius: 3px;
    background: color-mix(in srgb, var(--text-primary) 7%, var(--bg-surface));
}

.notebook-md-preview blockquote {
    margin: 0.5em 0;
    padding-left: 10px;
    border-left: 3px solid var(--border-default);
    color: var(--text-secondary);
}

.notebook-md-preview table {
    border-collapse: collapse;
    margin: 0.5em 0;
    font-size: 12px;
}

.notebook-md-preview th,
.notebook-md-preview td {
    border: 1px solid var(--border-default);
    padding: 4px 8px;
}

.notebook-md-preview a {
    color: var(--accent, #0078d4);
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* Selected state: no card to tint, so signal selection with a subtle inset accent
   bar on the left of the prose. The gutter still draws its own accent strip. */
.notebook-md-row.notebook-cell-row-selected .notebook-md-preview {
    box-shadow: inset 2px 0 0 0 color-mix(in srgb, var(--accent, #0078d4) 40%, transparent);
}

.notebook-md-editor {
    box-sizing: border-box;
    align-self: stretch;
    width: auto;
    flex: 1 1 auto;
    min-height: 80px;
    margin: 6px 8px 8px;
    font-family: system-ui, sans-serif;
    font-size: 13px;
    line-height: 1.45;
    padding: 8px;
    resize: vertical;
    border: 1px solid var(--border-default);
    border-radius: 4px;
    background: var(--bg-surface);
    color: var(--text-primary);
    outline: none;
}

.notebook-md-editor:focus {
    outline: none;
    border-color: color-mix(in srgb, var(--accent, #0078d4) 45%, var(--border-default));
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent, #0078d4) 22%, transparent);
}

.notebook-md-editor:focus-visible {
    outline: none;
}

/* Legacy textarea editor (kept for any unmigrated callers; current markup uses Monaco).
   Gutter accent + Monaco's own focus ring convey selection - no extra background tint. */
.notebook-md-row.notebook-cell-row-selected .notebook-md-editor {
    background: transparent;
}

/* Inline charts (notebook, rich output): do not cap height - Plotly layout includes title/legend/margins and would be clipped. */
.graph-chart-inline {
    min-height: 200px;
    width: 100%;
    overflow: visible;
}

.graph-chart-inline .plotly-chart-container {
    height: auto;
    min-height: 200px;
}

/* Command palette (Ctrl+Shift+P): help <command> */
.command-palette-backdrop {
    position: fixed;
    inset: 0;
    z-index: 10050;
    background: rgba(0, 0, 0, 0.35);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 12vh;
}

.command-palette {
    /* Positioned so it paints above the .overlay-dismiss surface behind it. */
    position: relative;
    width: min(520px, 92vw);
    background: var(--bg-surface, #fff);
    color: var(--text-primary);
    border: 1px solid var(--border-subtle, #ccc);
    border-radius: 8px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.22);
    padding: 12px 14px;
}

.command-palette-input {
    width: 100%;
    box-sizing: border-box;
    font-family: var(--font-ui, system-ui, sans-serif);
    font-size: 14px;
    padding: 8px 10px;
    border-radius: 4px;
    border: 1px solid var(--border-subtle, #ccc);
    background: var(--bg-input, #fff);
    color: var(--text-primary);
    outline: none;
}

.command-palette-input:focus {
    border-color: color-mix(in srgb, var(--accent, #0078d4) 55%, var(--border-subtle));
}

.command-palette-hint {
    margin: 10px 0 0;
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.4;
}

.command-palette-hint code {
    font-size: 11px;
    padding: 1px 4px;
    border-radius: 3px;
    background: var(--bg-sidebar, #f3f3f3);
}

/* -- AI output annotations -------------------------------------------------- */
.output-ai-annotation {
    margin: 8px 0 4px 12px;
    max-width: calc(var(--output-fold, 100cqi) - 12px);
    padding: 10px 12px;
    border-radius: 6px;
    border: 1px solid color-mix(in srgb, var(--accent, #0078d4) 35%, var(--border-default));
    background: color-mix(in srgb, var(--accent, #0078d4) 6%, var(--bg-surface));
}

.output-ai-annotation-nb {
    margin-left: 0;
    max-width: var(--output-fold, 100cqi);
}

.output-ai-annotation-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.output-ai-badge {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    padding: 2px 6px;
    border-radius: 3px;
    background: color-mix(in srgb, var(--accent, #0078d4) 22%, transparent);
    color: var(--text-primary);
}

.output-ai-mode {
    font-size: 11px;
    color: var(--text-secondary);
}

.output-ai-annotation-actions {
    margin-left: auto;
    display: flex;
    gap: 4px;
}

.output-ai-icon-btn {
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 12px;
    line-height: 1;
    padding: 2px 6px;
    border-radius: 3px;
    color: var(--text-secondary);
}

.output-ai-icon-btn:hover {
    background: var(--bg-hover);
}

.output-ai-icon-btn.active {
    color: var(--accent, #0078d4);
    font-weight: 600;
}

.output-ai-annotation-body.markdown-body {
    font-size: 12px;
    line-height: 1.55;
}

.output-ai-feedback {
    margin-top: 8px;
    padding-top: 6px;
    border-top: 1px solid var(--border-subtle);
}

.notebook-tutorial-annotation-banner {
    margin: 8px 12px;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    background: color-mix(in srgb, var(--accent, #0078d4) 10%, var(--bg-surface));
    border: 1px solid color-mix(in srgb, var(--accent, #0078d4) 28%, var(--border-default));
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

/* Locked-by-author annotation-mode badge. Neutral inline pill,
   accent-coloured border, no animation. Stronger signal than the tutorial
   banner; suppresses the tutorial banner when both would show. */
.notebook-annotation-lock-badge {
    margin: 8px 12px;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: color-mix(in srgb, var(--accent, #0078d4) 12%, var(--bg-surface));
    border: 1px solid color-mix(in srgb, var(--accent, #0078d4) 38%, var(--border-default));
    color: var(--text-primary, inherit);
}

.notebook-banner-link {
    border: none;
    background: none;
    color: var(--accent, #0078d4);
    cursor: pointer;
    text-decoration: underline;
    font-size: 12px;
    padding: 0;
}

.notebook-banner-dismiss {
    margin-left: auto;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    color: var(--text-tertiary);
}

/* Save-failed banner: sits above the notebook cells when a forced save
   throws (file lock, permission denied, disk full). Carries the underlying
   exception message so the user can act on it, and a × to dismiss. The
   notebook content stays editable behind the banner - losing visibility
   on the working set just because the file write failed would be worse
   than the failure itself. */




/* ==========================================================================
   Notebook AI confirm-before-insert dialog (Explain / Document preview).
   Shipped without CSS originally - rendered as raw stacked text. This block
   gives it a real modal shell so the title, preview body, help text, and
   action buttons read as a dialog rather than a pile of unstyled markup.
   ========================================================================== */

.notebook-confirm-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .35);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1500;
    padding: 24px;
}

.notebook-confirm-panel {
    background: var(--bg-surface);
    color: var(--text-primary);
    border: 1px solid var(--border-default);
    border-radius: 6px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, .18);
    width: min(720px, 100%);
    max-height: calc(100vh - 48px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    font-family: var(--font-ui);
}

.notebook-confirm-header {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 14px 18px 10px;
    border-bottom: 1px solid var(--border-subtle);
    background: var(--bg-sidebar);
}

.notebook-confirm-title {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
    color: var(--text-primary);
}

.notebook-confirm-sublabel {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.3;
}

.notebook-confirm-body {
    flex: 1 1 auto;
    overflow: auto;
    padding: 14px 18px;
    background: var(--bg-surface);
}

.notebook-confirm-preview {
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-primary);
}

.notebook-confirm-preview p { margin: 0 0 0.6em; }
.notebook-confirm-preview p:last-child { margin-bottom: 0; }
.notebook-confirm-preview h1,
.notebook-confirm-preview h2,
.notebook-confirm-preview h3,
.notebook-confirm-preview h4 {
    margin: 0.6em 0 0.3em;
    font-weight: 600;
    line-height: 1.25;
}
.notebook-confirm-preview h1 { font-size: 18px; }
.notebook-confirm-preview h2 { font-size: 16px; }
.notebook-confirm-preview h3 { font-size: 14px; }
.notebook-confirm-preview h4 { font-size: 13px; }
.notebook-confirm-preview ul,
.notebook-confirm-preview ol {
    margin: 0 0 0.6em;
    padding-left: 1.4em;
}
.notebook-confirm-preview code {
    font-family: var(--font-mono);
    font-size: 12px;
    padding: 1px 5px;
    background: var(--bg-hover);
    border-radius: 3px;
}
.notebook-confirm-preview pre {
    font-family: var(--font-mono);
    font-size: 12px;
    background: var(--bg-sidebar);
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
    padding: 8px 10px;
    overflow: auto;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}
.notebook-confirm-preview pre code {
    padding: 0;
    background: transparent;
    border-radius: 0;
}
.notebook-confirm-preview a {
    color: var(--accent);
    text-decoration: none;
}
.notebook-confirm-preview a:hover { text-decoration: underline; }

.notebook-confirm-footer {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 18px 12px;
    border-top: 1px solid var(--border-subtle);
    background: var(--bg-sidebar);
}

.notebook-confirm-help {
    flex: 1 1 auto;
    font-size: 11px;
    color: var(--text-tertiary);
    line-height: 1.4;
}

.notebook-confirm-buttons {
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
}

.notebook-confirm-buttons > button {
    height: 26px;
    width: auto;
    min-width: 64px;
    padding: 0 12px;
    white-space: nowrap;
    font-size: 12px;
    font-family: var(--font-ui);
    border-radius: 4px;
    cursor: pointer;
    border: 1px solid var(--border-default);
    background: var(--bg-surface);
    color: var(--text-primary);
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.notebook-confirm-buttons > button:hover {
    background: var(--bg-hover);
}

.notebook-confirm-buttons > button:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}

.notebook-confirm-buttons > .notebook-confirm-insert {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--text-inverse);
}

.notebook-confirm-buttons > .notebook-confirm-insert:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
}

/* ==========================================================================
   First-use workbench walkthrough (.shz-tour*)
   Apple-style guided tour: dimmed scrim with an animated spotlight cutout and
   a floating balloon. All colors come from the theme tokens so every preset
   renders correctly; only the scrim opacity is tuned per theme.
   ========================================================================== */

.shazam-workbench {
    --shz-dur: 320ms;
    --shz-ease: cubic-bezier(.22, .61, .36, 1);          /* iOS decelerate, no overshoot */
    --shz-balloon-dur: 240ms;
    --shz-balloon-ease: cubic-bezier(.4, 0, .2, 1);
    --shz-tour-scrim-fill: rgba(15, 18, 22, .55);
}

.shazam-workbench[data-theme="light"],
.shazam-workbench[data-theme="solarized-light"] { --shz-tour-scrim-fill: rgba(20, 22, 26, .42); }
.shazam-workbench[data-theme="high-contrast-dark"]  { --shz-tour-scrim-fill: rgba(0, 0, 0, .82); }
.shazam-workbench[data-theme="high-contrast-light"] { --shz-tour-scrim-fill: rgba(0, 0, 0, .55); }

.shz-tour {
    position: fixed;
    inset: 0;
    z-index: 4000;
    font-family: var(--font-ui);
    color: var(--text-primary);
}

/* ── Scrim + spotlight cutout ─────────────────────────────────────────── */
.shz-tour__scrim {
    position: fixed;
    inset: 0;
    pointer-events: auto;
    animation: shz-scrim-in 260ms ease both;
}
.shz-tour__scrim rect { pointer-events: all; }          /* block the app, even through the hole */

.shz-tour__hole {
    x: calc(var(--shz-tx, 0px) - 6px);
    y: calc(var(--shz-ty, 0px) - 6px);
    width: calc(var(--shz-tw, 0px) + 12px);
    height: calc(var(--shz-th, 0px) + 12px);
    rx: 10px;
    transition: x var(--shz-dur) var(--shz-ease), y var(--shz-dur) var(--shz-ease),
                width var(--shz-dur) var(--shz-ease), height var(--shz-dur) var(--shz-ease);
}
.shz-tour--no-cutout .shz-tour__hole { width: 0; height: 0; }

/* ── Animated accent halo around the target ───────────────────────────── */
.shz-tour__halo {
    position: fixed;
    left: calc(var(--shz-tx, 0px) - 6px);
    top: calc(var(--shz-ty, 0px) - 6px);
    width: calc(var(--shz-tw, 0px) + 12px);
    height: calc(var(--shz-th, 0px) + 12px);
    border-radius: 12px;
    pointer-events: none;
    box-shadow:
        0 0 0 1px color-mix(in srgb, var(--accent) 70%, transparent),
        0 0 0 4px color-mix(in srgb, var(--accent) 20%, transparent),
        0 0 22px 2px color-mix(in srgb, var(--accent) 26%, transparent);
    transition: left var(--shz-dur) var(--shz-ease), top var(--shz-dur) var(--shz-ease),
                width var(--shz-dur) var(--shz-ease), height var(--shz-dur) var(--shz-ease);
    animation: shz-halo-breathe 2600ms ease-in-out infinite;
}

/* ── Balloon ──────────────────────────────────────────────────────────── */
/* Width and max-height are PAIRED with BalloonW / BalloonH in WalkthroughOverlay.razor.cs, and
   WalkthroughPlacementTests reads these two numbers back out of this file to prove they still
   match. The placement math reserves exactly that much room beside and below the target, so the
   cap here is what makes the reservation truthful: a step with more copy than fits scrolls inside
   the balloon instead of growing past what was reserved and hanging off the bottom of the screen.
   Wider than the old 360px on purpose - the same words in fewer lines is the cheapest height. */
.shz-tour__balloon {
    position: fixed;
    width: min(440px, calc(100vw - 24px));
    max-height: min(520px, calc(100vh - 24px));
    display: flex;
    flex-direction: column;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: 14px;
    box-shadow: 0 1px 1px rgba(0, 0, 0, .04), 0 12px 40px -8px rgba(0, 0, 0, .30);
    padding: 0 0 14px;
    outline: none;
    overflow: visible;              /* the beak straddles the edge */
    animation: shz-balloon-in var(--shz-balloon-dur) var(--shz-balloon-ease) both;
}
/* Art, head, footer and the checkbox hold their size; only the copy gives way. */
.shz-tour__balloon > * { flex: 0 0 auto; }
.shz-tour__scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
}
.shz-tour__balloon--center {
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: clamp(360px, 30rem, 460px);
    text-align: center;
}
/* The first-run chooser: six cards read three across, the whole dialog stays inside the
   viewport, and the body scrolls rather than the art being cut off on a short screen. */
.shz-tour__balloon--chooser {
    width: min(900px, calc(100vw - 32px));
    max-height: calc(100vh - 32px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding-bottom: 0;
}
/* No art band here: across the full width it reads as an empty stripe, and the question is
   what the reader is being asked to answer. The head leads instead. */
.shz-tour__balloon--chooser .shz-tour__media { display: none; }
.shz-tour__balloon--chooser .shz-tour__head { padding: 24px 28px 0; }
.shz-tour__balloon--chooser .shz-tour__title { font-size: 22px; }
.shz-tour__chooser {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    overflow: hidden;
    padding: 12px 28px 24px;
}

/* Beak (rotated square straddling the relevant edge, pointing at the target). */
.shz-tour__beak {
    position: absolute;
    width: 14px;
    height: 14px;
    background: var(--bg-surface);
    border: 0 solid var(--border-subtle);
    transform: rotate(45deg);
}
/* The beak offset is computed against the RESERVED balloon size; a step whose copy is short
   renders smaller than that, so clamp against the balloon's own box or the beak floats off its
   edge, pointing from nowhere. */
.shz-tour__balloon--left  .shz-tour__beak { left: -7px;  top: clamp(9px, calc(var(--shz-beak, 28px) - 7px), calc(100% - 23px)); border-left-width: 1px; border-bottom-width: 1px; }
.shz-tour__balloon--right .shz-tour__beak { right: -7px; top: clamp(9px, calc(var(--shz-beak, 28px) - 7px), calc(100% - 23px)); border-top-width: 1px; border-right-width: 1px; }
.shz-tour__balloon--up    .shz-tour__beak { top: -7px;   left: clamp(9px, calc(var(--shz-beak, 28px) - 7px), calc(100% - 23px)); border-top-width: 1px; border-left-width: 1px; }
.shz-tour__balloon--down  .shz-tour__beak { bottom: -7px; left: clamp(9px, calc(var(--shz-beak, 28px) - 7px), calc(100% - 23px)); border-bottom-width: 1px; border-right-width: 1px; }

/* Media (theme-aware inline SVG art) */
/* 96px, not the 132px this used to be: measured against the longest step (the AI modes, five
   features) at 1366x768, that is the band height at which the whole step still reads without
   scrolling. The art is decoration; the copy is the point. */
.shz-tour__media {
    height: 96px;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-hover);
    border-radius: 13px 13px 0 0;
    color: var(--text-secondary);
    overflow: hidden;
}
.shz-tour__media--hero { height: 168px; }
/* On a short screen the art is the first thing to go: it is decoration, and 132px of it is the
   difference between the copy reading in full and the copy scrolling. */
@media (max-height: 700px) {
    .shz-tour__media { display: none; }
}
.shz-tour__media .shz-art { width: 64%; height: auto; max-height: 84%; }
.shz-tour__media .shz-art-accent { stroke: var(--accent); color: var(--accent); }
.shz-tour__media .shz-art-accent[fill="currentColor"] { fill: var(--accent); }

.shz-tour__head {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 16px 16px 0;
}
.shz-tour__balloon--center .shz-tour__head { justify-content: center; }
.shz-tour__title {
    flex: 1;
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.25;
    letter-spacing: -.01em;
    color: var(--text-primary);
}
.shz-tour__balloon--center .shz-tour__title { font-size: 20px; }
.shz-tour__close {
    flex: 0 0 auto;
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--text-tertiary);
    cursor: pointer;
}
.shz-tour__close:hover { background: var(--bg-hover); color: var(--text-primary); }
.shz-tour__balloon--center .shz-tour__close { position: absolute; top: 10px; right: 10px; }

.shz-tour__body {
    margin: 8px 16px 0;
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-secondary);
}
.shz-tour__balloon--center .shz-tour__body { font-size: 14px; margin-top: 6px; }

.shz-tour__features {
    margin: 12px 16px 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 7px;
}
.shz-tour__features li {
    position: relative;
    padding-left: 20px;
    font-size: 12.5px;
    line-height: 1.45;
    color: var(--text-secondary);
}
.shz-tour__features li::before {
    content: "";
    position: absolute;
    left: 3px;
    top: 6px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
}
.shz-tour__balloon--center .shz-tour__features {
    text-align: left;
    max-width: 340px;
    margin-left: auto;
    margin-right: auto;
}

.shz-tour__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    row-gap: 10px;
    flex-wrap: wrap;               /* let progress + actions stack on a narrow card */
    margin: 16px 16px 0;
}
.shz-tour__progress { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.shz-tour__count { font-family: var(--font-ui-small); font-size: 11px; font-weight: 500; color: var(--text-tertiary); }
.shz-tour__dots { display: flex; flex-wrap: wrap; gap: 5px; }
.shz-tour__actions { flex: 0 0 auto; margin-left: auto; }
.shz-tour__dot { width: 5px; height: 5px; border-radius: 50%; background: var(--text-tertiary); opacity: .45; transition: opacity .2s, background .2s; }
.shz-tour__dot.active { background: var(--accent); opacity: 1; }

.shz-tour__actions, .shz-tour__hero-actions { display: flex; align-items: center; gap: 8px; }
.shz-tour__hero-actions { justify-content: center; margin: 18px 16px 0; }

.shz-tour__btn {
    font-family: var(--font-ui);
    font-size: 13px;
    min-height: 30px;
    padding: 6px 16px;
    border-radius: 7px;
    border: 1px solid transparent;
    cursor: pointer;
    white-space: nowrap;            /* never wrap labels like "Start exploring" */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1.15;
}
.shz-tour__btn--primary { background: var(--accent); color: var(--text-inverse); font-weight: 600; }
.shz-tour__btn--primary:hover { background: var(--accent-hover); }
.shz-tour__btn--ghost { background: transparent; color: var(--text-secondary); font-weight: 500; }
.shz-tour__btn--ghost:hover { background: var(--bg-hover); }
.shz-tour__btn:disabled { opacity: .4; cursor: default; }

.shz-tour__dontshow {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 12px 16px 0;
    padding-top: 12px;
    border-top: 1px solid var(--border-subtle);
    font-family: var(--font-ui-small);
    font-size: 12px;
    color: var(--text-tertiary);
    cursor: pointer;
}
.shz-tour__dontshow input { accent-color: var(--accent); }

/* ── Motion ───────────────────────────────────────────────────────────── */
@keyframes shz-scrim-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes shz-balloon-in {
    from { opacity: 0; transform: translateY(6px) scale(.985); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
.shz-tour__balloon--center { animation-name: shz-hero-in; }
@keyframes shz-hero-in {
    from { opacity: 0; transform: translate(-50%, -50%) scale(.96); }
    to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}
@keyframes shz-halo-breathe {
    0%, 100% { box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 70%, transparent), 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent), 0 0 18px 1px color-mix(in srgb, var(--accent) 22%, transparent); }
    50%      { box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 70%, transparent), 0 0 0 5px color-mix(in srgb, var(--accent) 26%, transparent), 0 0 26px 3px color-mix(in srgb, var(--accent) 32%, transparent); }
}

/* Finish check draw-on */
.shz-art-draw { stroke-dasharray: 40; stroke-dashoffset: 40; animation: shz-draw 600ms var(--shz-ease) 120ms forwards; }
@keyframes shz-draw { to { stroke-dashoffset: 0; } }

/* Respect reduced motion: snap the spotlight, keep only a quick cross-fade. */
@media (prefers-reduced-motion: reduce) {
    .shz-tour__hole, .shz-tour__halo { transition: none; }
    .shz-tour__halo { animation: none; }
    .shz-tour__balloon { animation-duration: 120ms; }
    .shz-tour__balloon, .shz-tour__balloon--center { animation-name: shz-scrim-in; }
    .shz-art-draw { animation: none; stroke-dashoffset: 0; }
}

/* Settings dialog: lightweight tab control - a button rail plus CSS-shown panels
   that replaces Syncfusion's SfTab. The SfTab tab-select fires a JS interop that
   could hang indefinitely inside the MAUI BlazorWebView (dropped IPC response),
   freezing the whole app; switching panels via a CSS class uses zero JS interop. */
.settings-tabs-shell { display: flex; align-items: stretch; flex: 1 1 auto; min-height: 0; min-width: 0; }
.settings-tabs-rail {
    display: flex; flex-direction: column; gap: 2px;
    flex: 0 0 252px; box-sizing: border-box;
    padding: 8px; overflow-y: auto;
    border-right: 1px solid var(--border-subtle, #e6e6e6);
}
.settings-tab-btn {
    display: flex; align-items: center; gap: 8px;
    width: 100%; padding: 9px 12px;
    border: 0; border-left: 3px solid transparent; border-radius: 6px;
    background: transparent; cursor: pointer;
    font: inherit; font-size: 14px; text-align: left;
    color: var(--text-secondary, #555);
}
.settings-tab-btn:hover { background: var(--bg-hover, rgba(0,0,0,0.045)); color: var(--text-primary, #111); }
.settings-tab-btn.active {
    background: color-mix(in srgb, var(--primary, #1565c0) 8%, transparent);
    color: var(--text-primary, #111); font-weight: 600;
}
/* The wider rail keeps its longest label on one line despite host font differences. */
.settings-tab-label {
    flex: 1 1 auto; min-width: 0;
    white-space: nowrap; line-height: 1.3;
}
.settings-tabs-content { flex: 1 1 auto; min-width: 0; }
.settings-page { width: 100%; }

/* Settings dialog as a pure-CSS modal (replaces Syncfusion SfDialog - zero JS interop on open/close/content-change). */
.shz-settings-overlay {
    position: fixed; inset: 0; z-index: 1000;
    background: rgba(0, 0, 0, 0.45);
    display: flex; align-items: center; justify-content: center;
}
.shz-settings-modal {
    display: flex; flex-direction: column;
    width: 1144px; max-width: calc(100vw - 32px);
    height: 836px; max-height: calc(100vh - 32px);
    background: var(--bg-surface, #fff); color: var(--text-primary, #111);
    border-radius: 10px; box-shadow: 0 12px 48px rgba(0, 0, 0, 0.35);
    overflow: hidden;
}
.shz-settings-modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 13px 18px; border-bottom: 1px solid var(--border-subtle, #e6e6e6);
}
.shz-settings-modal-title { font-size: 16px; font-weight: 600; }
.shz-settings-modal-close {
    border: 0; background: transparent; cursor: pointer;
    font-size: 22px; line-height: 1; padding: 2px 9px; border-radius: 6px;
    color: var(--text-secondary, #555);
}
.shz-settings-modal-close:hover { background: var(--bg-hover, rgba(0, 0, 0, 0.06)); color: var(--text-primary, #111); }
.shz-settings-modal-body { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.shz-settings-modal-footer {
    display: flex; justify-content: flex-end; gap: 10px;
    padding: 12px 18px; border-top: 1px solid var(--border-subtle, #e6e6e6);
}
.shz-modal-btn {
    padding: 7px 18px; border-radius: 6px; cursor: pointer; font-size: 14px;
    border: 1px solid var(--border, #ccc); background: var(--bg-surface, #fff);
    color: var(--text-primary, #111);
}
.shz-modal-btn:hover { background: var(--bg-hover, rgba(0, 0, 0, 0.04)); }
.shz-modal-btn-primary { background: var(--primary, #1565c0); border-color: var(--primary, #1565c0); color: #fff; }
.shz-modal-btn-primary:hover { background: var(--primary-hover, #0d47a1); }

/* Settings dialog tab icons: match the workbench panel glyphs, mask-rendered so they inherit the tab's active/inactive color. Glyphs are copied from the corresponding pane headers (Output console, Notebook, Graphs, Editor) and the New menu. */
.shz-tab-ico {
    flex: none;
    display: inline-block !important;
    width: 16px !important;
    height: 16px !important;
    background-color: currentColor !important;
    -webkit-mask: var(--shz-ico) no-repeat center / contain;
    mask: var(--shz-ico) no-repeat center / contain;
    vertical-align: middle;
    margin-right: 4px;
}
.shz-tab-ico-general { --shz-ico: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='12' cy='12' r='3'/><path d='M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 1 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 1 1-2.83-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 1 1 2.83-2.83l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 1 1 2.83 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z'/></svg>"); }
.shz-tab-ico-work { --shz-ico: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='12' cy='12' r='10'/><circle cx='12' cy='12' r='6'/><circle cx='12' cy='12' r='2'/></svg>"); }
.shz-tab-ico-editor { --shz-ico: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z'/><polyline points='14 2 14 8 20 8'/><line x1='8' y1='13' x2='16' y2='13'/><line x1='8' y1='17' x2='13' y2='17'/></svg>"); }
.shz-tab-ico-output { --shz-ico: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='4 17 10 11 4 5'/><line x1='12' y1='19' x2='20' y2='19'/></svg>"); }
.shz-tab-ico-graphs { --shz-ico: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><line x1='18' y1='20' x2='18' y2='10'/><line x1='12' y1='20' x2='12' y2='4'/><line x1='6' y1='20' x2='6' y2='14'/></svg>"); }
.shz-tab-ico-notebook { --shz-ico: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><rect x='4' y='3' width='16' height='18' rx='2'/><line x1='8' y1='3' x2='8' y2='21'/><line x1='11' y1='8' x2='17' y2='8'/><line x1='11' y1='12' x2='17' y2='12'/><line x1='11' y1='16' x2='15' y2='16'/></svg>"); }
.shz-tab-ico-ai { --shz-ico: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z'/><path d='M20 3v4'/><path d='M22 5h-4'/><path d='M4 17v2'/><path d='M5 18H3'/></svg>"); }
.shz-tab-ico-plan { --shz-ico: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><rect x='2' y='5' width='20' height='14' rx='2' ry='2'/><line x1='2' y1='10' x2='22' y2='10'/></svg>"); }
.shz-tab-ico-history { --shz-ico: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='12' cy='12' r='9'/><polyline points='12 7 12 12 15 14'/></svg>"); }
.shz-tab-ico-credentials { --shz-ico: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><rect x='3' y='11' width='18' height='11' rx='2' ry='2'/><path d='M7 11V7a5 5 0 0 1 10 0v4'/></svg>"); }

/* ══════════════════════════════════════════════════════════════════════════
   macOS native appearance
   The workbench is tuned for Windows (Segoe UI Variable + Cascadia Mono at 12px).
   On macOS those fonts are absent, so text falls back to a heavier subpixel
   render that reads as "not a native app". Under .platform-mac (set from the
   host page when the WebView is on macOS) prefer the system San Francisco fonts
   and the antialiased smoothing native Mac apps use, and lift the base text a
   touch so density matches the macOS standard (13px vs Windows' 12px).
   ══════════════════════════════════════════════════════════════════════════ */
html.platform-mac,
html.platform-mac body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

html.platform-mac {
    --font-ui: -apple-system, system-ui, 'Segoe UI', sans-serif;
    --font-ui-small: -apple-system, system-ui, 'Segoe UI', sans-serif;
    --font-mono: ui-monospace, 'SF Mono', Menlo, Monaco, 'Cascadia Mono', monospace;
    /* NOTE: do NOT use `zoom` to scale density here. `zoom` desynchronises the
       Syncfusion SfSplitter's JS pixel measurements from the rendered layout,
       which pushes the right (Ken/Help) panel off-screen on resize. Native SF +
       the antialiased smoothing above already carry most of the native feel; if
       the base text needs to be larger, bump specific font-size rules instead. */
}

/* ==========================================================================
   Accessibility
   Global focus visibility, reduced-motion honouring, and the accessible-chart
   container styling. Uses theme CSS variables so all 8 themes (including High
   Contrast Light/Dark) inherit correct colours.
   ========================================================================== */

/* Baseline visible focus ring for keyboard users (WCAG 2.4.7 / 2.4.11).
   Low specificity so component-specific focus rules still win. */
:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
}

/* Honour the OS "reduce motion" preference across the whole workbench
   (WCAG 2.3.3 / 2.2.2). Individual components may still opt into essential
   motion, but decorative transitions and animations are neutralised. */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
        scroll-behavior: auto !important;
    }

    /* Exception for essential motion (WCAG 2.2.2 explicitly exempts activity
       indicators). The neutraliser above froze the run spinner mid-arc, which is
       exactly the "is it working or is it hung?" ambiguity the spinner exists to
       resolve - and Windows reports reduce whenever the OS animation-effects
       toggle is off, so a great many users saw a permanently stationary spinner.
       The class beats the universal selector on specificity, so this wins
       regardless of source order. The elapsed clock beside it carries the same
       signal without motion for anyone who still prefers stillness. */
    .sb-spinner {
        animation-duration: .9s !important;
        animation-iteration-count: infinite !important;
    }
}

.accessible-chart {
    margin: 0;
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

.accessible-chart-visual {
    flex: 1 1 auto;
    min-height: 0;
}

.accessible-chart-actions {
    display: flex;
    justify-content: flex-end;
    padding: 2px 6px;
    flex: 0 0 auto;
}

.accessible-chart-table-toggle {
    font: inherit;
    font-size: 11px;
    color: var(--accent);
    background: transparent;
    border: 1px solid var(--border-default);
    border-radius: 4px;
    padding: 2px 8px;
    cursor: pointer;
}

.accessible-chart-table-toggle:hover {
    background: var(--bg-hover);
}

.accessible-chart-data-table {
    max-height: 320px;
    overflow: auto;
    padding: 4px 8px;
    flex: 0 0 auto;
}

.accessible-chart-data-table table {
    border-collapse: collapse;
    font-size: 11px;
    margin-bottom: 8px;
}

.accessible-chart-data-table caption {
    text-align: left;
    font-weight: 600;
    padding: 2px 0;
    color: var(--text-secondary);
}

.accessible-chart-data-table th,
.accessible-chart-data-table td {
    border: 1px solid var(--border-default);
    padding: 2px 8px;
    text-align: right;
}

.accessible-chart-data-table th[scope="col"] {
    background: var(--bg-sidebar);
    position: sticky;
    top: 0;
}

.accessible-chart-data-note {
    font-size: 10px;
    color: var(--text-tertiary);
    margin: 0 0 8px;
}

/* Shared modal wrapper (ModalFocusScope). Consumers supply their own inner
   dialog styling via ChildContent; these are neutral defaults. The sentinels
   must remain focusable, so they are made invisible with opacity/size, never
   display:none (which would drop them from the tab order). */
.modal-focus-scope-overlay {
    position: fixed;
    inset: 0;
    /* Above the workbench's own overlay layer (.settings-overlay and friends sit at 10000): a modal
       opened FROM one of those, as the data-credentials dialog is, must paint over it rather than
       behind its scrim. */
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.35);
}

.modal-focus-scope {
    max-width: 90vw;
    max-height: 90vh;
    overflow: auto;
    outline: none;
}

.modal-focus-sentinel {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

/* Workbench skip link (WCAG 2.4.1): hidden until keyboard-focused, then shown
   over the toolbar so keyboard users can bypass the chrome. */
.workbench-skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    z-index: 2000;
    padding: 6px 14px;
    background: var(--accent);
    color: var(--text-inverse);
    border-radius: 0 0 6px 0;
    font-size: 12px;
    text-decoration: none;
}

.workbench-skip-link:focus {
    left: 0;
}

/* Transparent dismiss backdrop behind open dropdown menus: outside-click
   closes without stealing the menu's keyboard focus (the focusout-close it
   replaces fired on every roving-focus move between menu items). */
/* Click-outside-to-dismiss surfaces are <button> elements so they are real
   controls rather than clickable <div>s, and carry tabindex="-1" so they stay
   out of the tab order - a full-screen tab stop in front of the menu it
   dismisses would be worse than none. These rules strip the button chrome the
   browser would otherwise paint over the whole viewport. */
.menu-dismiss-backdrop,
.notebook-overflow-backdrop,
.graph-context-overlay,
.pane-context-overlay,
.overlay-dismiss {
    appearance: none;
    -webkit-appearance: none;
    border: 0;
    margin: 0;
    padding: 0;
    background: transparent;
    cursor: default;
}

/* Fills the dimming layer it sits inside, beneath the dialog that follows it. */
.overlay-dismiss {
    position: absolute;
    inset: 0;
}

.menu-dismiss-backdrop {
    position: fixed;
    inset: 0;
    z-index: 899;
    background: transparent;
}

.toolbar-dropdown .dropdown-menu,
.editor-tab-add-host .dropdown-menu {
    z-index: 900;
}

/* Target size (WCAG 2.5.8, Level AA): every interactive control is at least
   24x24 CSS px. min-* floors the compact toolbar buttons (some fixed at 22px,
   the dropdown carets at 14px wide) up to 24 without changing their centered
   content or theme overrides. */
.editor-tab-add,
.tab-close,
.split-orient-btn,
.graph-nav-btn,
.pane-maximize-btn,
.doc-underline-arrow,
.doc-fontcolor-arrow {
    min-width: 24px;
    min-height: 24px;
}

/* ── Loading splash: centred app mark shown while the shell boots ─────────────
   Replaces the old "Loading SHAZAM workbench…" / "Loading workspace…" text.
   .shz-workspace-loading : in-pane, used by the shared _layoutReady branch (both hosts).
   Pure CSS + static PNGs (_content/Shazam.UI.Blazor/images/shazam-splash*.png), so it
   paints immediately and adds no startup delay. */
@keyframes shz-splash-pulse {
    0%, 100% { opacity: .5;  transform: scale(.95); }
    50%      { opacity: 1;   transform: scale(1); }
}
.shz-splash-mark {
    width: 128px;
    height: 128px;
    animation: shz-splash-pulse 1.6s ease-in-out infinite;
}
.shz-splash-mark-dark { display: none; }
[data-theme="dark"] .shz-splash-mark-light { display: none; }
[data-theme="dark"] .shz-splash-mark-dark { display: block; }
.shz-workspace-loading {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
    align-items: center;
    justify-content: center;
}
.shz-workspace-loading .shz-splash-mark {
    width: 128px;
    height: 128px;
}

.shz-workspace-loading .shz-loading-title {
    font-family: var(--font-ui);
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
}
.shz-workspace-loading .shz-loading-step {
    font-size: 11px;
    color: #aaa;
    opacity: .55;
}
@media (prefers-reduced-motion: reduce) {
    .shz-splash-mark { animation: none; opacity: .85; }
}

/* File manager Workspace/Learning tabs (Phase 1 learning-workspace isolation). */
/* Workspace | Learning segmented control. Styled like an iOS/macOS segmented
   toggle: a subtle track holds two segments, and the ACTIVE segment is a raised
   surface-coloured pill with strong text, so the current tab is unmistakable. */
.file-manager-pane .fm-tabs {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 2px;
    border-radius: 7px;
    background: var(--surface-hover, rgba(0, 0, 0, 0.06));
}
.file-manager-pane .fm-tab {
    appearance: none;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-secondary);
    padding: 3px 12px;
    font: inherit;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.4;
    cursor: pointer;
    border-radius: 5px;
    transition: background 0.12s ease, color 0.12s ease, box-shadow 0.12s ease;
}
.file-manager-pane .fm-tab:hover:not(.active) {
    color: var(--text-primary);
}
.file-manager-pane .fm-tab.active {
    background: var(--bg-surface);
    color: var(--text-primary);
    font-weight: 600;
    border-color: var(--border-subtle);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

/* Minimized-panel "has content" indicator. A minimized Data/Graphs button whose
   pane currently holds items takes a solid-accent fill with an item count instead
   of auto-opening the pane. The idle button is already a subtle-accent outline, so
   this inverts to a solid accent fill (+ the count) and gives a one-time entrance
   pulse each time it re-appears. It persists across view/minimize cycles and falls
   back to the idle outline only when the pane is emptied. */
.minimized-panel-btn.has-content,
.minimized-panel-btn.has-content:hover {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
    box-shadow: none;
    animation: panel-content-pulse 0.9s ease-out 2;
}
.minimized-panel-btn.has-content svg,
.minimized-panel-btn.has-content:hover svg { color: #fff; }
.panel-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 16px;
    height: 16px;
    margin-left: 2px;
    padding: 0 4px;
    border-radius: 8px;
    background: #fff;
    color: var(--accent);
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
}
@keyframes panel-content-pulse {
    0%   { box-shadow: 0 0 0 0 var(--accent-subtle); }
    70%  { box-shadow: 0 0 0 6px transparent; }
    100% { box-shadow: 0 0 0 0 transparent; }
}

/* ---------------------------------------------------------------------------
   Pane error card (PaneErrorBoundary).

   Shown in place of a single pane that failed to render, instead of the
   full-screen error page that used to replace the whole workbench. Sized to sit
   inside whatever pane it replaces, and deliberately quiet: the surrounding app
   still works, so this should read as one panel being unavailable rather than
   as a crash.
   --------------------------------------------------------------------------- */
.pane-error {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 0.5rem;
    height: 100%;
    padding: 1.25rem;
    overflow: auto;
    color: var(--text-muted, #666);
    font-size: 0.875rem;
}

.pane-error-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary, #222);
}

.pane-error-body {
    margin: 0;
    max-width: 34rem;
}

.pane-error-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.25rem;
}

.pane-error-retry {
    padding: 0.35rem 0.9rem;
    border: 1px solid var(--shz-border, #d0d0d0);
    border-radius: 4px;
    background: var(--surface-raised, #fff);
    color: var(--text-primary, #222);
    font-size: 0.8125rem;
    cursor: pointer;
}

.pane-error-retry:hover {
    background: var(--surface-hover, #f2f2f2);
}

.pane-error-note {
    margin: 0;
    font-size: 0.8125rem;
    opacity: 0.85;
}

.pane-fault-marker {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1rem;
    height: 1rem;
    margin-left: 0.35rem;
    border-radius: 50%;
    background: var(--error-fg, #b91c1c);
    color: #fff;
    font-size: 0.6875rem;
    font-weight: 700;
    line-height: 1;
    vertical-align: middle;
}

.pane-error-retry:disabled {
    cursor: default;
    opacity: 0.6;
}

.fault-report {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
    max-width: 42rem;
    margin-top: 0.5rem;
}

.fault-report-text {
    margin: 0;
    color: var(--text-primary, #222);
    font-size: 0.8125rem;
}

.fault-report-failure {
    color: var(--error-fg, #b91c1c);
}

.fault-report-preview {
    margin: 0;
    max-height: 14rem;
    overflow: auto;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--shz-border, #d0d0d0);
    border-radius: 4px;
    background: var(--surface-raised, #fff);
    color: var(--text-primary, #222);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.75rem;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

/* ---------------------------------------------------------------------------
   Hosted-deployment limits, shown above the Terms on the demo host only.

   Deliberately styled as part of the agreement rather than as a warning banner:
   these limits are what the visitor is accepting, and a first-time user should
   meet one gate rather than a queue of notices.
   --------------------------------------------------------------------------- */
.terms-of-use-demo-limits {
    margin: 0 0 1rem;
    padding: 0.875rem 1rem;
    border: 1px solid var(--shz-border, #d0d0d0);
    border-radius: 6px;
    background: var(--surface-subtle, #f7f7f7);
    font-size: 0.875rem;
}

.terms-of-use-demo-limits h3 {
    margin: 0 0 0.5rem;
    font-size: 0.9375rem;
    font-weight: 600;
}

.terms-of-use-demo-limits ul {
    margin: 0;
    padding-left: 1.15rem;
}

.terms-of-use-demo-limits li { margin-bottom: 0.3rem; }

.terms-of-use-demo-limits-note {
    margin: 0.6rem 0 0;
    opacity: 0.9;
}

/* ---------------------------------------------------------------------------
   Safe Start banner. Full-width and at the top of the shell, unlike the update
   card in the corner: recovery mode changes what the user is looking at, so it
   must be read before they wonder where their tabs went.
   --------------------------------------------------------------------------- */
.safe-start-banner {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 0.7rem 1rem;
    border-bottom: 1px solid var(--shz-border, #d0d0d0);
    background: var(--surface-notice, #fff8e1);
    color: var(--text-primary, #222);
    font-size: 0.875rem;
}

.safe-start-banner-text { flex: 1 1 24rem; }

.safe-start-banner-actions {
    display: flex;
    gap: 0.5rem;
    flex: 0 0 auto;
}

@media (prefers-color-scheme: dark) {
    .safe-start-banner { background: #3a3222; color: #eee; border-bottom-color: rgba(255,255,255,0.18); }
}


/* Transient marker painted on the line a Problems row points at, so the eye
   lands on it after the editor scrolls. Fades rather than snapping off: an
   instant disappearance reads as a glitch. Cleared by the interop helper
   after two seconds; Monaco keeps its own persistent squiggle. */
.monaco-editor .shz-problem-line-mark {
    background: var(--accent-subtle, rgba(37, 99, 235, .14));
    box-shadow: inset 2px 0 0 0 var(--accent, #2563eb);
    animation: shz-problem-line-fade 2s ease-out forwards;
}

@keyframes shz-problem-line-fade {
    0%   { opacity: 1; }
    70%  { opacity: 1; }
    100% { opacity: 0; }
}

/* Problems rows that name a line are click-through to the editor. The cue is
   the pointer and a hover tint, not a link colour: the row is still a row,
   and colouring it blue would compete with the Fix / Explain actions on it. */
.problems-line-link {
    cursor: pointer;
    text-decoration: underline;
    text-decoration-style: dotted;
    text-underline-offset: 2px;
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    color: inherit;
}

.problems-line-link:hover {
    color: var(--accent, #2563eb);
    text-decoration-style: solid;
}

.problems-line-link:focus-visible {
    outline: 2px solid var(--accent, #2563eb);
    outline-offset: 1px;
}

/* EU AI Act Article 50 disclosure. Quiet, but always present under the composer rather than once at the
   top of a transcript that scrolls away - the obligation is that the person knows while they are asking,
   not that we said it somewhere earlier. */
.ai-disclosure {
    /* No top margin: the composer's own 8px bottom margin is already the gap, and adding to it put
       the line adrift halfway between the composer and the pane edge. Side margins match the
       composer's so the two are on the same vertical line. */
    margin: 0 8px 8px;
    font-size: 0.75rem;
    line-height: 1.2;
    color: var(--shz-text-muted, #94a3b8);
    text-align: center;
}

/* Run-status line: what the agent is doing, while it does it. Quiet by design - it sits under
   a streaming message for the whole run, so it must not compete with the answer. */
.ai-run-status {
    display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
    margin-top: 6px; font-size: 11.5px; color: var(--text-secondary, #666);
}
.ai-run-status-line { display: inline-flex; align-items: center; gap: 6px; }
.ai-run-status-sep { opacity: .5; }
