/* motool — light engineering console. Three collapsible columns. No modals. */
/*
 * CSS PRIMITIVES — use these before writing new classes or inline styles
 *
 * Layout:   .fg  .fg-2  .fg-3          (grid: 1/2/3 equal columns)
 *           .span-2                    (grid-column: span 2, inside .fg)
 *           .inline-flex               (inline-flex row, gap 6px, items centered)
 *           .form-flow                 (ordinary stacked form rhythm, 18px)
 * Spacing:  .admin-gap-top-md          (margin-top: 18px)
 *           .admin-gap-bottom-md       (margin-bottom: 18px)
 *           .admin-panel form > .fg + .fg  (auto 18px row gap — prefer over per-row classes)
 *           .modal-content form > .f + .f  (same 18px rhythm inside modal_shell forms)
 * Forms:    .f                         (field wrapper — input/select/textarea styling)
 * Buttons:  .btn  .btn.btn-primary  .btn.btn-danger
 * State:    .is-hidden                 (display:none !important)
 * Text:     .note                      (muted helper text, font-small)
 *           .modal-confirm-text        (modal confirmation paragraph)
 * Tables:   .perf-table  .admin-table  .tbl-excel
 * Filter:   data-col-filter on <table> + tables.th_filter() macro + mat-col-filter.js
 *           .mat-th-filter             (header filter row — input stretches to column width)
 *           .mat-th-filter--center     (center label+icon when closed; input still stretches)
 *           .mat-th-filter-btn         (search icon button — colour/weight/cursor handled)
 *           .mat-th-input-wrap         (flex:1 search shell inside filter row)
 */

:root {
  color-scheme: light;
  --bg:       #f7f8fa;
  --sur:      #ffffff;
  --bdr:      #d8dde5;
  --bdr2:     #e7ebf0;
  --tx:       #1c1917;
  --tx2:      #57534e;
  --tx3:      #a8a29e;
  /* One accent for the whole platform — same teal the console prompt uses.
     Console chrome and ordinary UI must not run two competing hues. */
  --acc:      #0f766e;
  --acc2:     #ecfdf5;
  --acc-strong: #115e59; /* accent hover/pressed — never hardcode a darker hex */
  /* A border tinted by the accent instead of neutral -- the resting outline
     of an accent chip and the hover outline of a field. Both themes derive it
     from --acc and --bdr, so it needs no dark entry. */
  --acc-bdr: color-mix(in srgb, var(--acc) 35%, var(--bdr));
  /* The three neighbours of --acc-bdr. Pick the nearest step; never type
     a percentage. soft = a resting/hover outline, strong = a live pill or
     hovered chip, solid = the one selected chip. */
  --acc-bdr-soft:   color-mix(in srgb, var(--acc) 25%, var(--bdr));
  --acc-bdr-strong: color-mix(in srgb, var(--acc) 45%, var(--bdr));
  --acc-bdr-solid:  color-mix(in srgb, var(--acc) 55%, var(--bdr));
  /* Picker swatches. A swatch shows a theme you are NOT wearing, so it cannot
     read that theme's own tokens — these are constants and live only here.
     In :root, so they add no raw-colour debt and need no dark entry. */
  --theme-sample-light-sur:    #ffffff;
  --theme-sample-light-acc:    #0f766e;
  --theme-sample-vintage-sur:  #f8f3e8;
  --theme-sample-vintage-acc:  #0e6b63;
  --theme-sample-retro70-sur:  #f2d8b3;
  --theme-sample-retro70-acc:  #d76735;
  --theme-sample-eighties-sur: #fbfaff;
  --theme-sample-eighties-acc: #a3186f;
  /* The ground and the bar, not the paper and the accent: white-over-teal was
     Classic's swatch with a different teal, and the two were indistinguishable
     in a 14px square. */
  --theme-sample-buehler-sur:  #dbeae3;
  --theme-sample-buehler-acc:  #006953;
  --theme-sample-dark-sur:     #272b31;
  --theme-sample-dark-acc:     #2dd4bf;
  /* ---------------------------------------------------------------------
     Brand glyph — THE single source of the product mark. Every static logo
     and every loading spinner is a box masked by one of these three shapes,
     tinted with currentColor. To change the logo, change these URIs and
     nothing else: no template, no JS, no per-page SVG.
       --brand-glyph-ring the segmented ring that turns
       --brand-glyph-hub  the shaft, which never turns
     A loader is ring + hub. The full mark adds the tile and lives in
     macros/brand.html, which must keep the same ring numbers as the token.
     --------------------------------------------------------------------- */
  --brand-glyph-ring: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48'><circle cx='24' cy='24' r='13' fill='none' stroke='%23000' stroke-width='6.5' stroke-linecap='round' stroke-dasharray='18.4 8.83'/></svg>");
  --brand-glyph-hub: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48'><circle cx='24' cy='24' r='5' fill='%23000'/></svg>");
  /* Loader tuning — one turn per --brand-spin-duration, for every spinner. */
  --brand-spin-duration: 1.4s;
  --brand-tumble-duration: 2.2s;
  --app-mark-lean-duration: 900ms;
  /* Startup: the product mark spins up and settles as the page arrives. App
     marks do not -- they are still until pointed at. */
  --brand-boot-duration: 1.7s;
  --app-mark-flow-duration: 0.9s;
  --app-mark-spin-duration: 3.2s;
  --app-mark-assemble-duration: 2.2s;
  --app-mark-stack-duration: 2.2s;
  --app-mark-chart-duration: 2.4s;
  --app-mark-orbit-duration: 4s;
  --app-mark-stream-duration: 4.8s;
  --app-mark-gear-duration: 2.6s;
  /* The impeller. The slowest mark in the set on purpose: a pump wheel that whips round
     reads as a fan, and the blades are backswept -- which way they sweep is the one
     thing this drawing says that a circle would not, and it needs time to be seen. */
  --app-mark-rotor-duration: 9s;
  --app-mark-map-duration: 3.6s;
  --brand-spin-size: 15px;
  --brand-mark-size: 22px;
  /* Command glow — the only depth cue a command control gets. No drop shadow. */
  --acc-glow: 0 0 14px color-mix(in srgb, var(--acc) 22%, transparent);
  /* Identity hues — hub modules, management-nav icons, param-diagram nodes.
     Deliberate exception to the one-accent rule: these are how you find an
     app or component in a list. Do not mute them to --term-tx2. */
  --app-hue-motool: #c2410c;
  --app-hue-dqmodel: #1d4ed8;
  --app-hue-maps: #6d28d9;
  --app-hue-market_reports: #b45309;
  --app-hue-materials: #0f766e;
  --app-hue-ipump: #15803d;
  --app-hue-field_viewer: #0e7490;
  /* The parts of a pump, each in the ink its part is drawn in on the sheets
     (pumpstudio_centrifugal/drawings.py STYLES): hub brown, blade purple, inlet teal,
     the volute wall blue. A tab and its drawing then read as the same thing. */
  --pump-part-inlet:    #00806a;
  --pump-part-impeller: #a35a00;
  --pump-part-blade:    #7a3fa0;
  --pump-part-volute:   #0060b0;
  --pump-part-diffusor: #b0335f;
  /* Not a part: the three surfaces a CFD case hands the flow over on, dashed on the
     sheets. Its own hue because it was the axis red first and read as the axis -- see
     the `iface` entry in the package's STYLES for the distance measurement that picked
     fuchsia over orange, pink and violet. */
  --pump-iface:         #c026d3;
  /* The AI chat button, and therefore the corner of the WINDOW nothing else may use:
     it is `position: fixed` at z-index 900, so it covers whatever a page draws under
     it. Anything a person has to click near that corner keeps clear of
     `--fab-inset + --fab-size` (see `.dwg-zoom`). Written once, here, because the
     clearance and the button have to move together. */
  --fab-inset: 20px;
  --fab-size: 44px;
  --app-hue-catalog: #0e7490;
  --app-hue-rfq_search: #0369a1;
  --app-hue-admin: #be185d;
  --app-hue-help: #4338ca;
  /* Identity chips (`.product-type-badge`): ink is an --app-hue-*; fill and
     rim mix that colour into the raised surface so both themes stay readable.
     Dark mixes more — a 16% wash vanishes on slate. */
  --identity-chip-fill: 16%;
  --identity-chip-bdr: 42%;
  /* OEM group badges (`.oem-group-badge--*`, identity chips): one ink per
     brand, by name -- GM is GM, not "info". `--oem-pal-N` are the eight
     fallback inks for groups without a named brand. Fill and rim come from
     the .product-type-badge recipe above; never type a per-brand hex. */
  --brand-gm: #1d4ed8;
  --brand-mercedes-benz: #374151;
  --brand-stellantis: #b91c1c;
  --brand-volkswagen: #0e7490;
  --brand-hyundai: #047857;
  --brand-honda: #c2410c;
  --brand-bmw: #1e3a8a;
  --oem-pal-0: #7c3aed;
  --oem-pal-1: #0d9488;
  --oem-pal-2: #db2777;
  --oem-pal-3: #ca8a04;
  --oem-pal-4: #2563eb;
  --oem-pal-5: #ea580c;
  --oem-pal-6: #0891b2;
  --oem-pal-7: #65a30d;
  /* Material-category badges (`.mat-cat-badge--<color>`): the category
     stores one of these names (CATEGORY_COLORS in app/stores/materials.py);
     the badge sets `color` only, fill follows currentColor. */
  --mat-cat-amber: #92400e;
  --mat-cat-indigo: #3730a3;
  --mat-cat-green: #166534;
  --mat-cat-sky: #075985;
  --mat-cat-purple: #6b21a8;
  --mat-cat-rose: #9f1239;
  --mat-cat-teal: #115e59;
  --mat-cat-slate: #334155;
  --unit-color: var(--acc);
  --red:      #b91c1c;
  --grn:      #15803d;
  --amb:      #b45309;
  --amb2:     #fef3c7;
  --amb-bdr:  #fcd34d;

  /* State callouts: a tinted surface with its own text and border. Three tokens
     per state, because a badge needs all three and picking them apart is what
     produced four near-identical reds. Distinct from --red / --grn / --amb
     above: those are the state hue on the ORDINARY page surface (an icon, a
     line of text), these are the recipe for a tinted chip, banner or callout.
     Values are the `.comp-head-badge--*` set, the only family that already had
     a complete light AND dark definition for all four states. */
  --info-bg:     #dbeafe;
  --info-bdr:    #bfdbfe;
  --info-fg:     #1d4ed8;
  /* Two jobs the state trio above cannot do on its own.
     `--mark-read` is the blue a **standalone** mark is drawn in — the history
     link, a comment bubble. On light paper that is the info ink itself; in dark
     it is not, because there `--info-fg` is tuned to be read on a deep blue
     tint and as a bare glyph on the page it measures 11.4:1 and glares.
     `--seal-fill` / `--seal-mark` are the two inks the released seal is painted
     with, and in dark they trade places like every tint here does. */
  --mark-read:   var(--info-fg);
  --seal-fill:   var(--success-fg);
  --seal-mark:   var(--tx-on-fill);
  --warn-bg:     #fef3c7;
  --warn-bdr:    #fde68a;
  --warn-fg:     #b45309;
  --danger-bg:   #fee2e2;
  --danger-bdr:  #fecaca;
  --danger-fg:   #b91c1c;
  --success-bg:  #dcfce7;
  --success-bdr: #bbf7d0;
  --success-fg:  #15803d;
  /* The same recipe with no state to report -- an unset slot, an unknown file
     type. Not --tx2/--tx3: the pair it needs is tx2's light with tx3's dark. */
  --muted-bg:    #f5f5f4;
  --muted-bdr:   #d6d3d1;
  --muted-fg:    #57534e;
  --grid-opacity: 0.08;
  --grid-line-opacity-scale: 0.38;
  --grid-dot-rgb: 82, 94, 110;
  --grid-square-rgb: 82, 94, 110;
  --grid-dot-line: rgba(var(--grid-dot-rgb), var(--grid-opacity));
  --grid-square-line: rgba(var(--grid-square-rgb), calc(var(--grid-opacity) * var(--grid-line-opacity-scale)));
  --grid-size: 24px;
  /* Corner-anchored + transparent 0 tiles cleanly (hard same-stop cuts AA-seam). */
  /* 80s cassette tile -- line art: contours only, no fills, one ink. The four
     coloured cassettes of the old tile sat on an 88x64 grid and differed only
     in colour, so one drawing repeats to the same picture and costs a quarter
     of the CSS. The tile is 104x80 for a 76x48 cassette: the paper around it
     is the spacing between neighbours, so widen the tile to open the pattern
     up (GAP_X / GAP_Y in the script). The ink is still baked in (a data URI cannot read a CSS
     variable), so strength still comes from --grid-opacity on the ::before
     overlay that paints it. Geometry is generated, not hand-typed:
     scripts/gen_cassette_tile.py prints this exact line. */
  --grid-pattern-cassettes:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 104 80' width='104' height='80'><g fill='none' stroke='%23221d38' stroke-width='1' stroke-linejoin='round' stroke-linecap='round'><rect x='14' y='16' width='76' height='48' rx='4' stroke-width='1.1'/><path d='M14 54H25' stroke-width='0.8'/><path d='M79 54H90' stroke-width='0.8'/><rect x='19' y='20' width='66' height='19' rx='1.5' stroke-width='0.9'/><path d='M19 25.5H85' stroke-width='0.8'/><path d='M23 28.5H79' stroke-width='0.7'/><path d='M23 32H71' stroke-width='0.7'/><path d='M23 35.5H57' stroke-width='0.7'/><rect x='25' y='42' width='54' height='15' rx='2' stroke-width='0.9'/><path d='M42.4 54H61.6' stroke-width='0.7'/><circle cx='36' cy='49' r='6.4' stroke-width='0.9'/><circle cx='36' cy='49' r='3.4' stroke-width='0.8'/><circle cx='36' cy='49' r='1.2' stroke-width='0.7'/><circle cx='68' cy='49' r='6.4' stroke-width='0.9'/><circle cx='68' cy='49' r='3.4' stroke-width='0.8'/><circle cx='68' cy='49' r='1.2' stroke-width='0.7'/><circle cx='17.5' cy='19.5' r='1.4' stroke-width='0.7'/><circle cx='86.5' cy='19.5' r='1.4' stroke-width='0.7'/><circle cx='17.5' cy='60.5' r='1.4' stroke-width='0.7'/><circle cx='86.5' cy='60.5' r='1.4' stroke-width='0.7'/><circle cx='52' cy='60.5' r='1.4' stroke-width='0.7'/><rect x='19' y='41.5' width='4' height='2.5' rx='0.6' stroke-width='0.7'/></g></svg>");
  /* Bühler Tanne tile — the fir from the company mark, stroked and never
     filled, so it reads as a watermark rather than a wall of logos.
     The path is the mark's real silhouette, not a lookalike: the logo PNG was
     thresholded, its boundary walked with marching squares and simplified to
     42 points, which is why the notches where each branch meets the trunk are
     there and why the tile is 72x92 (the mark's own 0.666 width:height).
     Its ink is the brand green #009475, sampled off the logo by pixel count,
     and baked into the SVG for the same reason the cassette tile's inks are:
     a data URI cannot read a CSS variable. Strength comes from --grid-opacity
     on the ::before overlay that paints it. */
  --grid-pattern-tanne:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 72 92' width='72' height='92'><path fill='none' stroke='%23009475' stroke-width='1.5' stroke-linejoin='round' d='M36.1 16L16 36L20.9 40.7L31.3 30.1L32.4 30.3L32.3 35.2L16.1 51.5L20.3 56L21 56.1L31.8 45.4L32.5 46.4L32.4 50.4L16.1 67.1L19.9 71.3L21 71.7L31.3 61.3L32 61.2L32.5 62.3L32.5 75.1L32.9 76.1L38.8 76L39.5 75.5L39.5 62.3L39.9 61.4L41 61.7L50.9 71.6L51.8 71.5L55.7 67.2L39.7 50.6L39.4 46.2L40.3 45.7L51.1 56.1L51.8 55.9L55.8 51.5L39.9 35.3L39.5 31L40.1 30.4L41 30.7L51.2 40.7L56 35.8Z'/></svg>");
  --grid-pattern-dots:
    radial-gradient(circle at 1px 1px, var(--grid-dot-line) 1px, transparent 0);
  --grid-pattern-lines:
    linear-gradient(to right, var(--grid-square-line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid-square-line) 1px, transparent 1px);
  --mono:     "Cascadia Mono","Consolas",ui-monospace,monospace;
  --sans:     "Inter","Segoe UI",system-ui,sans-serif;
  --col1:     286px;
  --col2:     240px;
  --topbar-h: 38px;
  /* The bar's own palette. The topbar used to derive its paint and its ink from
     --sur / --bg / --tx*, which meant no theme could paint it without a patch
     rule. These name the job instead, and every default below is exactly what
     the bar already computed, so a theme that mentions none of them renders
     identically. A theme that paints the bar must name the inks too: the ink on
     a painted bar reads against the BAR, not against the page.
       --topbar-bg     the bar itself (also handed to a mark as --mark-spark)
       --topbar-rule   the hairline under it
       --topbar-fg     the brand wordmark and the page name
       --topbar-fg2    a labelled control at rest
       --topbar-fg3    muted: the app label, the version chip, icon controls
       --topbar-bdr    a labelled control's resting border
       --topbar-acc    hover ink and the focus ring
       --topbar-danger Exit, on hover only
     --topbar-mark is the ninth and is deliberately NOT here -- see the rule that
     reads it. */
  --topbar-bg: color-mix(in srgb, var(--sur) 94%, var(--bg));
  --topbar-rule: color-mix(in srgb, var(--bdr) 70%, transparent);
  --topbar-fg: var(--tx);
  --topbar-fg2: var(--tx2);
  --topbar-fg3: var(--tx3);
  --topbar-bdr: var(--bdr);
  --topbar-acc: var(--acc);
  --topbar-danger: var(--red);
  --font-base: 17px;
  --font-ui-sm: 13px;
  --font-ui-xs: 11px;
  --radius-sm: 3px;
  --radius-md: 4px;
  /* Single source of truth for action / button icon size. Drives .btn svg and
     .admin-action-btn svg; CSS wins over inline width="11" lucide attributes. */
  --icon-action: 14px;
  --page-panel-pad-y: 36px;
  --page-panel-pad-x: 44px;
  --page-wrap-pad-y: 24px;
  --page-wrap-pad-x: 18px;
  --comp-panel-gap: 18px;
  /* Normal form rhythm. Dense engineering parameter grids stay independent. */
  --form-row-gap: 18px;
  --form-section-gap: 24px;
  /* Space above in-flow section headings (.comp-head--section-gap, .admin-section-head) */
  --comp-head-section-gap-top: 24px;
  --admin-block-pad: 12px;
  --admin-panel-pad-y: var(--page-panel-pad-y);
  --admin-panel-pad-x: var(--page-panel-pad-x);
  /* Single content column for admin paper: panel pad + former .comp-block
     horizontal inset. Footers/fields/tables all share this edge — do not
     re-add --admin-block-pad on .admin-form-actions / .settings-actions. */
  --admin-content-pad-x: calc(var(--admin-panel-pad-x) + var(--admin-block-pad));
  --admin-page-margin: 32px; /* paper inset when no HUD strip floats over the pane */
  /* Paper top inset when a HUD strip floats over the pane — Motool/DQModel
     diagram strip and Configurator/Admin/Materials/Settings nav share this. */
  --hud-float-pad-top: 56px;
  /* Match the secondary-nav → paper rhythm used by admin/settings pages. */
  --results-wrap-pad-y: var(--admin-page-margin);
  --results-wrap-pad-x: var(--page-wrap-pad-x);
  --results-panel-pad-y: var(--page-panel-pad-y);
  --results-panel-pad-x: var(--page-panel-pad-x);
  /* How wide a page of work is allowed to get, however wide the window is. One
     number, because a person moving between Motool, DQModel and the Pump Designer
     reads one page width -- a board that is 400 px wider on one app is noticed as
     a different app, not as more room. Read by `.rpanel-wrap.is-act` (the motor
     apps' result card) and by `.dwg-page` (the drawing board). The Materials
     scatter keeps its own, wider cap: a plot with two axes is not a page of work. */
  --paper-max-w: 1040px;
  /* Shared app paper surface: result cards, CRUD pages, auth cards, full-page tools. */
  --paper-bg:
    linear-gradient(
      to bottom,
      color-mix(in srgb, var(--acc) 3%, var(--sur)) 0,
      var(--sur) 132px
    );
  --paper-border: color-mix(in srgb, var(--bdr) 78%, transparent);
  --paper-radius: 8px;
  /* Raised surface — modals and popovers. On white, a card already separates by
     shadow alone, so light keeps the paper surface and only dark lifts a step. */
  --sur-raised: var(--sur);
  --modal-bg: var(--paper-bg);
  --modal-backdrop: rgba(0, 0, 0, 0.45);
  /* Label and icon ON a filled colour -- accent, danger, warn and success
     buttons, badges and markers. White in BOTH themes on purpose: the fill
     underneath is saturated in both, so the label must not follow the page.
     Never `--sur` here; that is the page surface and it inverts. */
  --tx-on-fill: #ffffff;
  /* Plate behind a server-drawn chart image that is white in BOTH themes: the
     Market Report charts, which are drawn for a PDF and stay light on purpose.
     The app's own plots (Motool, DQModel, MAPS) now follow the page instead --
     they are drawn per theme, see motorstudio/plot/plot_theme.py -- so
     they need no plate at all. Never point a themed plot at this. */
  --plot-plate: #ffffff;
  /* Market Report cover: colours sampled from Julia Wolf's slide. Printed
     paper, so the same in every theme -- no theme block redefines them. */
  --cover-ink:  #15343e;
  --cover-rule: #203d48;
  --cover-tag:  #7073ee;
  /* A surface that steps AWAY from the page: recessed on white, lifted on dark.
     Elevation reads as shadow in a light theme and as light in a dark one, so
     the two themes move in opposite directions from the same body surface.
     Column headers and chat bubbles are the same job; do not re-derive it. */
  --sur-step: color-mix(in srgb, var(--bg) 76%, var(--sur));
  --table-head-bg: var(--sur-step);
  /* Body-cell surface. A token, not `--sur` directly, because a table does not
     always sit on the page: inside a modal the box is already `--sur-raised`,
     so cells painted `--sur` land DARKER than the box they sit on and the
     header disappears into it. `.modal-box` re-points these two. */
  --table-cell-bg: var(--sur);
  /* Column header for a table on a raised surface. */
  --table-head-bg-raised: var(--table-head-bg);
  /* Categorical chart series ramp, shared by every Chart.js page and by the
     chart-action icons that point at them. Numbered, not named after a job:
     a series palette is chosen by position, which is the one place a
     positional token is the honest one. Light values are 600/700 weights
     picked against white. */
  --chart-series-1: #1d4ed8;
  --chart-series-2: #dc2626;
  --chart-series-3: #16a34a;
  --chart-series-4: #d97706;
  --chart-series-5: #7c3aed;
  --chart-series-6: #0891b2;
  --chart-series-7: #be185d;
  --chart-series-8: #65a30d;
  --chart-series-9: #ea580c;
  --chart-series-10: #6d28d9;
  /* Selected variant row. On white the paper surface plus its shadow is enough;
     on dark a shadow is invisible, so selection has to be carried by lightness. */
  --row-selected-bg: var(--sur);
  /* Slate lift only — cyan bloom is HUD chrome (`--term-glow`), not paper. */
  --paper-shadow:
    0 1px 0 rgba(255, 255, 255, 0.9) inset,
    0 10px 28px rgba(15, 23, 42, 0.08);
  /* Inset plates: the result plot sits on `-strong`, the summary table on
     `-soft`. On white they land a hair below the card (about a 1% recess) —
     a hint of a plate, not a frame. Dark redefines them; see the note there. */
  --paper-inset-strong: color-mix(in srgb, var(--bg) 34%, var(--sur));
  --paper-inset-soft: color-mix(in srgb, var(--bg) 22%, var(--sur));
  --sidebar-bg: color-mix(in srgb, var(--bg) 88%, var(--bdr));
  --font-ui-2xs: 8px;
  --font-ui-md: 11px;
  --font-heading: calc(var(--font-base) + 4px);
  --font-sub:     calc(var(--font-base) - 1px);
  --font-small:   calc(var(--font-base) - 4px);
  --font-tiny:    calc(var(--font-base) - 6px);
  --content-width: 980px;
  --radius-input: 3px;
  --radius-btn: 4px;
  --btn-pad-y: 4px;
  --btn-pad-x: 9px;
  --btn-font-size: calc(var(--font-base) - 4px);
  --btn-run-pad-y: 6px;
  --btn-run-font-size: calc(var(--font-base) - 3px);
  /* The confirm button's hue. Normally the accent — but a theme whose accent
     sits in the red family leaves Save/OK and Cancel/Delete reading as the
     same button, which is the one pair that must never be confusable. Such a
     theme re-points this at its own green instead of losing its accent
     everywhere else. */
  --btn-primary-hue: var(--acc);
  --field-font-size: calc(var(--font-base) - 3px);
  --field-pad-y: 3px;
  --field-pad-x: 6px;
  --label-font-size: calc(var(--font-base) - 6px);
  --table-font-size: calc(var(--font-base) - 5px);
  --table-head-font-size: calc(var(--font-base) - 7px);
  --table-cell-pad-y: 4px;
  --table-cell-pad-x: 5px;
  --table-head-pad-y: 3px;
  /* Terminal blinking cursor — shared across all console/result-area cursors */
  --terminal-cursor-w: 0.55em;
  --terminal-cursor-h: 1.05em;
  /* Ice HUD — hub terminal, empty-run, admin/settings/param-diagram nav */
  --term-bg: #e8eef5;
  --term-bar-from: #f5f8fc;
  --term-bar-to: #e8eef5;
  --term-bdr: color-mix(in srgb, #22d3ee 42%, #c5d0dc);
  --term-bdr-soft: #d4dde8;
  --term-tx: #0f172a;
  --term-tx2: #475569;
  --term-tx3: #64748b;
  --term-prompt: var(--acc);
  --term-tick: #22d3ee;
  --term-tick-len: 16px;
  --term-ver: var(--acc);
  --term-glow:
    var(--paper-shadow),
    0 0 28px color-mix(in srgb, var(--term-tick) 16%, transparent);
  --term-ticks:
    linear-gradient(var(--term-tick), var(--term-tick)) 0 0 / var(--term-tick-len) 2px no-repeat,
    linear-gradient(var(--term-tick), var(--term-tick)) 0 0 / 2px var(--term-tick-len) no-repeat,
    linear-gradient(var(--term-tick), var(--term-tick)) 100% 0 / var(--term-tick-len) 2px no-repeat,
    linear-gradient(var(--term-tick), var(--term-tick)) 100% 0 / 2px var(--term-tick-len) no-repeat,
    linear-gradient(var(--term-tick), var(--term-tick)) 0 100% / var(--term-tick-len) 2px no-repeat,
    linear-gradient(var(--term-tick), var(--term-tick)) 0 100% / 2px var(--term-tick-len) no-repeat,
    linear-gradient(var(--term-tick), var(--term-tick)) 100% 100% / var(--term-tick-len) 2px no-repeat,
    linear-gradient(var(--term-tick), var(--term-tick)) 100% 100% / 2px var(--term-tick-len) no-repeat;
  --table-head-pad-x: 5px;
  --admin-table-row-h: 30px;
  --admin-table-head-row-h: 28px;
  --admin-list-row-h: 38px;
  --admin-list-pad-y: 7px;
  --admin-list-pad-x: 12px;
  --table-row-hover-bg: #f6f9ff;
  /* Help / theory reading — independent of GUI --font-base (see html.help-reading-*) */
  --help-font-base: 17px;
  --help-font-small: calc(var(--help-font-base) - 4px);
  --help-font-heading: calc(var(--help-font-base) + 4px);
}

html.help-reading-sm {
  --help-font-base: 14px;
  --help-font-small: calc(var(--help-font-base) - 4px);
  --help-font-heading: calc(var(--help-font-base) + 4px);
}
html.help-reading-lg {
  --help-font-base: 20px;
  --help-font-small: calc(var(--help-font-base) - 4px);
  --help-font-heading: calc(var(--help-font-base) + 4px);
}

i[data-lucide] { display:inline-block; vertical-align:-0.15em; }

html[data-theme="dark"] {
  color-scheme: dark;
  /* Slate-neutral, deliberately not near-black: #171717 / #1c1c1c left the page
     and every card 1.05:1 apart, so a modal was indistinguishable from the page
     behind it. The ramp below keeps three readable steps — page, card, raised. */
  --bg:   #1e2126;
  --sur:  #272b31;
  --sur-raised: #343941;
  --bdr:  #4a505b;
  --bdr2: #32363d;
  --tx:   #e5e5e5;
  --tx2:  #d4d4d8;
  --tx3:  #a1a1aa;
  --acc:  #2dd4bf;
  --acc2: #0f766e33;
  --acc-strong: #5eead4;
  --acc-glow: 0 0 16px color-mix(in srgb, var(--acc) 30%, transparent);
  --unit-color: var(--acc);
  /* Identity hues, dark. The light values are 600/700 weights chosen against
     white; on the dark page they landed at 2.0–3.2:1 and read muddy rather than
     coloured. Same hue family, lighter weight — all now above 5.4:1. */
  --app-hue-motool: #fb923c;
  --app-hue-dqmodel: #60a5fa;
  --app-hue-maps: #a78bfa;
  --app-hue-market_reports: #fbbf24;
  --app-hue-materials: #2dd4bf;
  --app-hue-ipump: #6ee7a0;
  --app-hue-field_viewer: #22d3ee;
  --pump-part-inlet:    #34d3b4;
  --pump-part-impeller: #e0a458;
  --pump-part-blade:    #bda0e0;
  --pump-part-volute:   #6fb3f0;
  --pump-part-diffusor: #f191b3;
  --pump-iface:         #e879f9;
  --app-hue-catalog: #22d3ee;
  --app-hue-rfq_search: #38bdf8;
  --app-hue-admin: #f472b6;
  --app-hue-help: #818cf8;
  --identity-chip-fill: 26%;
  --identity-chip-bdr: 55%;
  --brand-gm: #93c5fd;
  --brand-mercedes-benz: #d1d5db;
  --brand-stellantis: #fca5a5;
  --brand-volkswagen: #67e8f9;
  --brand-hyundai: #6ee7b7;
  --brand-honda: #fdba74;
  --brand-bmw: #a5b4fc;
  --oem-pal-0: #c4b5fd;
  --oem-pal-1: #5eead4;
  --oem-pal-2: #f9a8d4;
  --oem-pal-3: #fde047;
  --oem-pal-4: #93c5fd;
  --oem-pal-5: #fdba74;
  --oem-pal-6: #67e8f9;
  --oem-pal-7: #bef264;
  --mat-cat-amber: #fcd34d;
  --mat-cat-indigo: #a5b4fc;
  --mat-cat-green: #86efac;
  --mat-cat-sky: #7dd3fc;
  --mat-cat-purple: #d8b4fe;
  --mat-cat-rose: #fda4af;
  --mat-cat-teal: #5eead4;
  --mat-cat-slate: #cbd5e1;
  --red:  #ef4444;
  --grn:  #22c55e;
  --amb:  #f59e0b;
  --amb2: #78350f4d;
  --amb-bdr: #b4530999;

  /* State callouts, dark. A tint cannot simply darken: the surface goes to the
     deep end of the hue and the text swaps to the light end, so bg and fg trade
     places rather than both sliding. */
  --info-bg:     #1e3a8a;
  --info-bdr:    #1d4ed8;
  --info-fg:     #bfdbfe;
  /* 6.4:1 on the page — clearly blue, clearly readable, not a light source.
     `--info-fg` here is 11.4:1 and is for text on the tint above it. */
  --mark-read:   #60a5fa;
  --seal-fill:   var(--success-bg);
  --seal-mark:   var(--success-fg);
  --warn-bg:     #78350f;
  --warn-bdr:    #92400e;
  --warn-fg:     #fcd34d;
  --danger-bg:   #7f1d1d;
  --danger-bdr:  #991b1b;
  --danger-fg:   #fca5a5;
  --success-bg:  #14532d;
  --success-bdr: #166534;
  --success-fg:  #86efac;
  --muted-bg:    var(--sur-raised);
  --muted-bdr:   var(--bdr);
  --muted-fg:    #a1a1aa;
  --grid-dot-rgb: 148, 163, 184;
  --grid-square-rgb: 148, 163, 184;
  /* Sits between the row and the header lift, so a hovered row never reads as
     a second header. */
  --table-row-hover-bg: #2f343c;
  /* Lighter than the rows, not darker — see the token's note on :root. */
  --sur-step: var(--sur-raised);
  --table-head-bg: var(--sur-step);
  /* A step above --sur-raised: the sidebar it sits on is already near --sur, so
     the card surface left selection at 1.06:1 against it. This reads at 1.63:1. */
  /* Inset plates, dark: the page surface, not a step toward `--bg`. The light
     formula steps toward the page colour, which on white is the ~1% recess
     above; on dark the same step lands BELOW both the card and the content, so
     a plot or a table read as a lighter block inside a black frame. Elevation
     is direction-dependent — the same thing `--sur-step` records — and there is
     no room to recess on a dark page without framing what sits on it, so the
     plate simply joins the card. The plot's own background is `--sur` too
     (`plot_theme.py`), which is what makes the image seamless here. */
  --paper-inset-strong: var(--sur);
  --paper-inset-soft: var(--sur);
  --row-selected-bg: #414852;
  /* Same step, for a table header inside a modal — --table-head-bg alone is the
     modal's own surface there, so the header would read as body. */
  --table-head-bg-raised: #414852;
  /* Same hue family, lighter weight — the identical move --app-hue-* makes and
     for the same reason: the light weights land at 1.6-2.4:1 on the dark page
     and on the raised modal surface, so a blue or violet curve was there but
     could not be seen. These all clear 4.2:1 on the modal, 5.8:1 on the page. */
  --chart-series-1: #60a5fa;
  --chart-series-2: #f87171;
  --chart-series-3: #4ade80;
  --chart-series-4: #fbbf24;
  --chart-series-5: #a78bfa;
  --chart-series-6: #22d3ee;
  --chart-series-7: #f472b6;
  --chart-series-8: #a3e635;
  --chart-series-9: #fb923c;
  --chart-series-10: #c084fc;
  --modal-bg: var(--sur-raised);
  /* Dimmer backdrop than light: on a dark page a 45% veil barely registers. */
  --modal-backdrop: rgba(0, 0, 0, 0.66);
  --term-bg: #1c2535;
  --term-bar-from: #243044;
  --term-bar-to: #1c2535;
  --term-bdr: color-mix(in srgb, #22d3ee 34%, #3d4f66);
  --term-bdr-soft: #334155;
  --term-tx: #e2e8f0;
  --term-tx2: #94a3b8;
  --term-tx3: #7b8ea3;
  --term-prompt: var(--acc);
  --term-ver: var(--acc);
  --paper-shadow:
    0 1px 0 rgba(255, 255, 255, 0.07) inset,
    0 14px 36px rgba(0, 0, 0, 0.55);
}

/* Vintage — warm paper. Tokens only; never a patch rule (see
   scripts/check_css_raw_colors.py TOKEN_BLOCK_SELECTORS). Everything not
   named here inherits Classic from :root.
   Its grid background defaults to lines rather than dots (ruled paper), set in
   settings/appearance.js `THEME_GRID_DEFAULTS` and base.html's boot script —
   a default only, so an explicit pick still wins. */
html[data-theme="vintage"] {
  color-scheme: light;
  --bg:       #e7e2d8;
  --sur:      #faf7f0;
  --bdr:      #d5cec0;
  --bdr2:     #e9e3d8;
  --tx:       #2b2420;
  --tx2:      #57534e;
  --tx3:      #6b6258;
  --acc:      #0c5c55;
  --acc-strong: #0b4f49;
  --acc2:     color-mix(in srgb, var(--acc) 8%, var(--sur));
  --red:      #b91c1c;
  --grn:      #166534;
  --amb:      #92400e;
  --amb2:     #f5e9bd;
  --amb-bdr:  #e0bd63;
  --info-bg:     #d8e3f2;
  --info-bdr:    #b9cde8;
  --info-fg:     #1d4ed8;
  --warn-bg:     #f5e9bd;
  --warn-bdr:    #e3d08a;
  --warn-fg:     #92400e;
  --danger-bg:   #f7dcd6;
  --danger-bdr:  #eebfb4;
  --danger-fg:   #b91c1c;
  --success-bg:  #dbe9d2;
  --success-bdr: #bcd4ae;
  --success-fg:  #166534;
  --muted-bg:    #eeeae1;
  --muted-bdr:   #d5cbb8;
  --muted-fg:    #57534e;
  --table-row-hover-bg: #efebe2;
  --grid-dot-rgb: 116, 108, 96;
  --grid-square-rgb: 116, 108, 96;
  --paper-shadow:
    0 1px 0 rgba(255, 253, 248, 0.9) inset,
    0 1px 2px rgba(74, 56, 32, 0.10),
    0 10px 28px rgba(74, 56, 32, 0.13);
  --term-bg:      #e5dccb;
  --term-bar-from: #efe8d8;
  --term-bar-to:  #e5dccb;
  --term-bdr:     #ad9a85;
  --term-bdr-soft: #d5cbb8;
  --term-tx:      #241f1a;
  --term-tx2:     #5c5346;
  --term-tx3:     #5f5647;
  --term-tick:    #0d7f8d;
}

/* 70s Retro — the reference cream is the ground, a lighter cream is the paper.
   The three brights (#fbd266 / #8fb0a9 / #d76735) measure 1.05 / 1.70 / 2.59
   on the ground, so they are fills and marks only; ink uses darker cousins. */
html[data-theme="retro70"] {
  color-scheme: light;
  --bg:       #f2d8b3;
  --sur:      #fbf1dd;
  --bdr:      #d8bd93;
  --bdr2:     #eddbba;
  --tx:       #2e2013;
  --tx2:      #5f4526;
  --tx3:      #755438;
  --acc:      #2f5d55;
  --acc-strong: #234641;
  --acc2:     color-mix(in srgb, var(--acc) 8%, var(--sur));
  --red:      #98241a;
  --grn:      #35603a;
  --amb:      #8f3d10;
  --amb2:     #fbd266;
  --amb-bdr:  #d99b1f;
  --info-bg:     #d8e2ec;
  --info-bdr:    #b3c7db;
  --info-fg:     #1e4e94;
  --warn-bg:     #fbd266;
  --warn-bdr:    #d99b1f;
  --warn-fg:     #8f3d10;
  --danger-bg:   #f4d6cb;
  --danger-bdr:  #e5b3a2;
  --danger-fg:   #98241a;
  --success-bg:  #d9e6d0;
  --success-bdr: #b6cda8;
  --success-fg:  #35603a;
  --muted-bg:    #efe2c9;
  --muted-bdr:   #d8c6a5;
  --muted-fg:    #5f4526;
  --table-row-hover-bg: #f4e6c9;
  --grid-dot-rgb: 138, 110, 72;
  --grid-square-rgb: 138, 110, 72;
  --paper-shadow:
    0 1px 0 rgba(255, 250, 238, 0.9) inset,
    0 10px 28px rgba(92, 60, 24, 0.12);
  --term-bg:      #e6d4b2;
  --term-bar-from: #f2e2c4;
  --term-bar-to:  #e6d4b2;
  --term-bdr:     #cb8f62;
  --term-bdr-soft: #d8c6a5;
  --term-tx:      #2e2013;
  --term-tx2:     #5f4526;
  --term-tx3:     #6d4d33;
  --term-tick:    #b8501f;
}

/* 80s — cream paper, indigo ink, a deep teal accent. The cassette page pattern
   (data-grid-mode="cassettes") belongs to this theme alone: it is drawn in
   these colours, so under any other theme it is four wrong colours on the page.
   `data-grid-mode` is never set to cassettes outside this theme — the rule
   lives in settings/appearance.js (`cassettesAllowed`) and in base.html's boot
   script, so no selector here has to repeat it.
   Tokens only; never a patch rule. */
html[data-theme="eighties"] {
  color-scheme: light;
  --bg:       #eceaf4;
  --sur:      #fbfaff;
  --bdr:      #cfcadd;
  --bdr2:     #e4e0ee;
  --tx:       #221d38;
  --tx2:      #4d4668;
  --tx3:      #635c80;
  --acc:      #a3186f;
  --acc-strong: #7d1254;
  /* The bar wears the theme's magenta rather than near-white paper, because a
     pale bar over this ground reads as Classic with a coloured page. Inks are
     lightened until they clear on it, and hover is the theme's mustard — a
     yellow-on-magenta pairing the decade is entitled to.
     On the bar: --topbar-fg 7.20, -fg2 5.70, -fg3 4.95, -danger 5.23,
     -acc 5.58, -bdr as a mark 3.67; bar against the ground 6.05. */
  --topbar-bg:     #a3186f;
  --topbar-rule:   #7d1254;
  --topbar-fg:     #ffffff;
  --topbar-fg2:    #f7deed;
  --topbar-fg3:    #f0cce1;
  --topbar-bdr:    #e3a8c9;
  --topbar-acc:    #ffe08a;
  --topbar-danger: #ffd0d8;
  --topbar-mark:   #ffffff;
  --acc2:     color-mix(in srgb, var(--acc) 8%, var(--sur));
  --red:      #c02040;
  --grn:      #1c6b52;
  --amb:      #8a5a10;
  --amb2:     #f8e7b8;
  --amb-bdr:  #dcb765;
  --info-bg:     #dde5f5;
  --info-bdr:    #bccbe8;
  --info-fg:     #1e4e94;
  --warn-bg:     #f8e7b8;
  --warn-bdr:    #dcb765;
  --warn-fg:     #8a5a10;
  --danger-bg:   #fadde2;
  --danger-bdr:  #f0b9c3;
  --danger-fg:   #c02040;
  --success-bg:  #d8e9e0;
  --success-bdr: #b0d0c2;
  --success-fg:  #1c6b52;
  --muted-bg:    #eceaf4;
  --muted-bdr:   #d3cee2;
  --muted-fg:    #4d4668;
  --table-row-hover-bg: #eae7f3;
  --grid-dot-rgb: 104, 96, 138;
  --grid-square-rgb: 104, 96, 138;
  --paper-shadow:
    0 1px 0 rgba(255, 255, 255, 0.9) inset,
    0 1px 2px rgba(34, 29, 56, 0.10),
    0 10px 28px rgba(34, 29, 56, 0.12);
  --term-bg:      #e2ddf0;
  --term-bar-from: #eeeaf8;
  --term-bar-to:  #e2ddf0;
  --term-bdr:     #8b6fb8;
  --term-bdr-soft: #d3cee2;
  --term-tx:      #1e1930;
  --term-tx2:     #4d4668;
  --term-tx3:     #5d5678;
  --term-tick:    #0e7490;
  /* Save/OK went magenta and Cancel/Delete crimson, so the one pair that must
     never be confusable read as the same button. Confirm takes the theme's own
     green instead; the accent is untouched, so links and focus stay magenta.
     As button ink over its own 12% wash: 5.20 on a card, 4.58 on the page
     (--red, unchanged, is 4.73 / 4.17). */
  --btn-primary-hue: var(--grn);
}

/* Bühler Motor — the corporate palette, taken from the company's own material
   rather than invented: #007162 is the green the buehlermotor.de stylesheet
   uses most (81 declarations), #006953 is the deep shade of the logo mark and
   #009475 the bright one sampled out of it — the bright green inks the Tanne
   watermark and the picker swatch, the deep one paints the bar. #1a171b is the
   wordmark's near-black and #ededed / #b5b5b5 are the site's own greys.
   Three surfaces, and they are three different materials on purpose, because
   the first pass at this theme was Classic with green borders:
     the BAR is solid corporate green, white ink, a white logo on it;
     the PAGE is a light green field, with white paper floating on it;
     the HUB CONSOLE is grey — the launch panel steps out of the green rather
       than joining it, and the nine identity hues need a neutral to sit on.
   Measured, not estimated: 4.5:1 for text, 3:1 for marks.
     on ground #dbeae3 / paper #ffffff —
       --tx 13.28/16.52, --tx2 6.89/8.57, --tx3 5.02/6.24, --acc 4.77/5.93,
       --red 5.56/6.92, --grn 5.26/6.54, --amb 5.09/6.33;
       the Tanne's #009475 as a mark, 3.07/3.82.
     on the bar #006953 —
       --topbar-fg and --topbar-mark 6.68, --topbar-fg2 5.45,
       --topbar-fg3 4.70, --topbar-danger 4.57, --topbar-bdr as a mark 3.21;
       the bar itself against the ground, 5.37.
     on the grey console #ededed —
       --term-tx 15.17, --term-tx2 7.94, --term-tx3 6.08, --term-tick 5.07;
       the weakest identity hue (market reports) 4.27, level with the 4.30 the
       same hue measures on Classic's own console.
     tinted chips, text on fill — danger 5.42, warn 5.39, success 5.31,
       info 6.38, muted 7.31.
   Its grid background defaults to the Tanne, which belongs to this theme
   alone — both rules live in settings/appearance.js and base.html's boot
   script. Tokens only; never a patch rule. */
html[data-theme="buehler"] {
  color-scheme: light;
  --bg:       #dbeae3;
  --sur:      #ffffff;
  --bdr:      #b3cbc3;
  --bdr2:     #cfe2da;
  --tx:       #16211f;
  --tx2:      #3d504c;
  --tx3:      #4f6561;
  --acc:      #007162;
  --acc-strong: #00554a;
  --acc2:     color-mix(in srgb, var(--acc) 8%, var(--sur));
  --red:      #ad231e;
  --grn:      #0f6b45;
  --amb:      #845610;
  --amb2:     #f7ecd2;
  --amb-bdr:  #e2c68a;
  /* The bar. A solid brand-green header with white ink and a white mark on it:
     the page tokens above are 600/700 weights picked against paper and measure
     1.0-1.3:1 here, so every ink the bar uses is named. */
  --topbar-bg:     #006953;
  --topbar-rule:   #00483c;
  --topbar-fg:     #ffffff;
  --topbar-fg2:    #d7ede7;
  --topbar-fg3:    #bce0d7;
  --topbar-bdr:    #7fc0b4;
  --topbar-acc:    #ffffff;
  --topbar-danger: #ffc9c0;
  /* One white mark for every app, the way a logo sits on a corporate header.
     The identity hues stay themselves everywhere they are actually compared —
     the hub wall, the management nav, the param diagram — and a topbar shows
     one mark with nothing beside it to tell apart. */
  --topbar-mark:   #ffffff;
  /* Info is blue here, not the brand teal it used to be. `#00594d` sat beside
     `--success-fg: #0f6b45` and the two were one dark green to the eye, so in
     this theme an "in review" chip read as a released one and a comment mark
     read as an approval. A state colour has to survive being next to the other
     three. 6.7:1 on its own tint, well past the 4.5 every pair here keeps. */
  --info-bg:     #dbe4f5;
  --info-bdr:    #b7c6e8;
  --info-fg:     #1e40af;
  --warn-bg:     #f7ecd2;
  --warn-bdr:    #e2c68a;
  --warn-fg:     #845610;
  --danger-bg:   #f8dedb;
  --danger-bdr:  #eebfb9;
  --danger-fg:   #ad231e;
  --success-bg:  #d9ece2;
  --success-bdr: #b3d4c3;
  --success-fg:  #0f6b45;
  --muted-bg:    #e6efeb;
  --muted-bdr:   #cfe2da;
  --muted-fg:    #3d504c;
  --table-row-hover-bg: #e6f1ec;
  --grid-dot-rgb: 0, 113, 98;
  --grid-square-rgb: 0, 113, 98;
  /* Paper lifts off a green field, so the shadow under it is green-black
     rather than the shared slate. */
  --paper-shadow:
    0 1px 0 rgba(255, 255, 255, 0.9) inset,
    0 10px 28px rgba(0, 60, 48, 0.14);
  /* The hub console, in the site's own greys. Deliberately NOT green: the
     launch panel carries nine identity hues, and a coloured ground under them
     is what made the first pass read as one flat wash. */
  --term-bg:      #ededed;
  --term-bar-from: #f6f6f6;
  --term-bar-to:  #ededed;
  --term-bdr:     #b5b5b5;
  --term-bdr-soft: #d6d6d6;
  --term-tx:      #1a171b;
  --term-tx2:     #474747;
  --term-tx3:     #585858;
  --term-tick:    #007162;
}

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

html,body {
  height:100%;
  font-family:var(--sans);
  font-size:var(--font-base);
  color:var(--tx);
  -webkit-font-smoothing:antialiased;
}

html[data-grid-mode="dots"], html:not([data-grid-mode]) {
  --grid-pattern: var(--grid-pattern-dots);
}

html[data-grid-mode="lines"] {
  --grid-pattern: var(--grid-pattern-lines);
}

html[data-grid-mode="none"] {
  --grid-pattern: none;
}

/* Cassettes paint on an overlay, not on html's own background, because the
   tile's ink is baked into a data URI: --grid-opacity cannot reach inside one,
   so the opacity is applied to the layer instead. Fixed + z-index:-1 keeps it behind
   body content and above html's background-color, and stops it re-tiling on
   scroll the way a nested scroll root would. */
html[data-grid-mode="cassettes"] {
  --grid-pattern: none;
}
html[data-grid-mode="cassettes"]::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image: var(--grid-pattern-cassettes);
  /* Three quarters of the tile's own 104x80: at full size the cassette reads
     as an illustration on the page rather than a pattern behind it. */
  background-size: 78px 60px;
  background-repeat: repeat;
  opacity: var(--grid-opacity);
}

/* The Tanne paints on the same overlay and for the same reason: its green is
   inside the data URI, out of --grid-opacity's reach, so the opacity is
   applied to the layer. */
html[data-grid-mode="tanne"] {
  --grid-pattern: none;
}
html[data-grid-mode="tanne"]::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image: var(--grid-pattern-tanne);
  background-size: 72px 92px;
  background-repeat: repeat;
  opacity: var(--grid-opacity);
}

/* Graph-paper canvas — paint ONCE on html (viewport-fixed). Nested scroll
   roots stay transparent so they never re-tile from a different origin
   (that was the vertical/horizontal "seam" / uneven dot spacing). */
html {
  background-color: var(--bg);
  background-image: var(--grid-pattern);
  background-size: var(--grid-size) var(--grid-size);
  background-attachment: fixed;
  background-repeat: repeat;
}
.grid-canvas,
body,
.admin-scroll,
.hub-scroll,
.app-body,
#motool-ui,
#dqmodel-ui,
#maps-ui,
#admin-ui,
#paramEditorRoot,
#spa-panel,
.rcontent {
  background-color: transparent;
  background-image: none;
}

.app-frame {
  display:flex;
  flex-direction:column;
  height:100vh;
  overflow:hidden;
}

/* Single flex grow region below topbar (avoids stray whitespace flex items between header and content). */
.app-main {
  flex:1;
  min-height:0;
  display:flex;
  flex-direction:column;
  font-size:0;
  line-height:0;
  overflow:hidden;
}
.app-main > * {
  font-size:var(--font-base);
  line-height:normal;
}

/* ── Topbar ── */
.topbar {
  display:flex;
  align-items:center;
  height:var(--topbar-h);
  flex-shrink:0;
  /* Named twice on purpose: the bar's own paint, and the same paint handed to
     whatever needs to draw in it -- an app mark's current spark reads as a gap
     in a wire only if it is the colour actually behind the mark. */
  --mark-spark:var(--topbar-bg);
  background:var(--mark-spark);
  border-bottom:1px solid var(--topbar-rule);
  box-shadow:0 1px 0 rgba(15, 23, 42, .03);
  padding:0 14px;
  gap:6px;
}
.topbar-brand--static {
  pointer-events:none;
  cursor:default;
  user-select:none;
}
.topbar-brand {
  display:inline-flex;
  align-items:center;
  font-size:var(--font-base);
  font-weight:800;
  letter-spacing:.08em;
  text-transform:uppercase;
  color:var(--topbar-fg);
  text-decoration:none;
  padding-right:0;
  margin-right:12px;
  border-right:none;
  white-space:nowrap;
}
/* Product mark and loader — both are a box masked by a --brand-glyph-* shape
   and painted with currentColor, so they follow the theme and scale by size
   token alone. Markup is `<span class="brand-mark">` / `<span class="spin">`;
   never inline an SVG copy of the logo. */
.brand-mark,
.spin,
.brand-spin {
  display:inline-block;
  flex-shrink:0;
  vertical-align:middle;
}
/* Both inherit colour: muted grey inside a panel loader, toolbar grey beside
   toolbar icons, button ink on a filled button. Never a fixed accent. */
.brand-mark {
  /* The logo keeps the accent. Only loaders inherit the colour around them. */
  color:var(--acc);
  width:var(--brand-mark-size);
  height:var(--brand-mark-size);
}
.brand-mark svg { display:block; width:100%; height:100%; }
/* Startup — plays once as the page arrives, with no script involved: the
   element exists, so the animation runs. The rotor spins up, decelerates,
   overshoots a few degrees and snaps back onto its detent, while the tile
   settles into place. `both` keeps frame zero on screen until it starts. */
.brand-mark {
  animation:brandBoot var(--brand-boot-duration) both;
}
.brand-mark .bm-ring {
  animation:brandSpinUp var(--brand-boot-duration) both;
  transform-box:fill-box;
  transform-origin:center;
}
@keyframes brandBoot {
  0%   { transform:scale(.72); opacity:0; animation-timing-function:cubic-bezier(.2, .9, .3, 1.4); }
  34%  { transform:scale(1.07); opacity:1; }
  58%  { transform:scale(.98); }
  100% { transform:none; opacity:1; }
}
@keyframes brandSpinUp {
  0%   { transform:rotate(0deg);    animation-timing-function:cubic-bezier(.45, 0, .9, .45); }
  46%  { transform:rotate(520deg);  animation-timing-function:linear; }
  74%  { transform:rotate(900deg);  animation-timing-function:cubic-bezier(.08, .8, .28, 1); }
  92%  { transform:rotate(1094deg); animation-timing-function:cubic-bezier(.35, 0, .35, 1); }
  100% { transform:rotate(1080deg); }
}
/* An app mark does not arrive: it is simply there, and it moves only while it
   is pointed at. Every mark on the hub used to draw, pop, rise or strike itself
   in as it appeared -- and a hub page is shown and hidden, so turning the page
   replayed all eight at once. A wall of icons flickering on every page turn
   reads as a fault, not as a flourish.

   What is left is what a part still needs to be moved by a hover: its own box
   as the origin, so a transform or a motion path is measured from the shape
   rather than from the whole drawing. */
.app-mark > * {
  transform-box:fill-box;
  transform-origin:center;
}

/* Per-logo motion. Every rule names a part of that app's own artwork
   (app/static/img/brand/<key>.svg), never a position in the markup, so a logo
   can be redrawn without silently swapping which piece moves. */

/* One line weight across the wall of logos. The lucide-drawn marks are a
   24-unit box stroked at 2, which lands at 5px in a hub tile; the two drawn
   machines are about 3 units of solid line in a 222-unit box, which lands at
   2px. Side by side those read as two different sets of icons.

   They are matched by bringing the glyphs down to the machines, and never the
   other way round. A machine is one contour: its housing, its brush block, its
   commutator lamellae and its leads are all the same closed outline, so a
   stroke meant to embolden the housing lands on every one of those details too
   and closes the fine white slots between them. There is no half of that path
   to stroke on its own.

   Only inside a hub tile, where the marks stand side by side and the weights
   can be compared. A topbar shows one mark and nothing to compare it with, and
   at 18px this thinning would put a glyph under a pixel wide.

   stroke-width inherits, so this one line reaches every part of every glyph;
   the parts that carry a weight of their own (bl-current, bl-spin) set it and
   are untouched.

   The same number is published as --app-mark-stroke so a part that wants to be
   drawn RELATIVE to its neighbours (Configurator's loose block) can be, without
   writing 0.8 down a second time and without an absolute weight that would come
   out five times too heavy inside a tile. Custom properties inherit; outside a
   tile the property is unset and the fallback in that calc is the glyph's own
   lucide weight. */
.hub-module .app-mark { --app-mark-stroke:0.8; stroke-width:var(--app-mark-stroke); }

/* Motool — the drawn machine, in flat side elevation. Each machine is a single
   filled contour on purpose: its white insides (barrel, board, chip, shaft, lead
   eyes) are counter-wound holes in that same path, and splitting them into named
   parts would fill every hole in solid. */
.app-mark--motool .bl-machine { fill:currentColor; }
/* Every mark is given a square box, so a drawing wider than it is tall lands
   inside that box at a fraction of the size asked for. --app-mark-box (its row
   in the key table) is how much wider the box has to be for the artwork itself
   to come out at the intended size. Written for every mark, not per app: it
   resolves to 1 -- no change at all -- for a logo that has no row. */
.topbar-brand .app-mark {
  width:calc(18px * var(--app-mark-box, 1)) !important;
  height:calc(18px * var(--app-mark-box, 1)) !important;
  /* The extra height is empty, so it is taken back out of the layout: the box
     overhangs the bar and the bar's height never moves. Zero when a logo has
     no --app-mark-box, so this one line covers both kinds. */
  margin-block:calc((1 - var(--app-mark-box, 1)) * 9px);
}
/* A mark on the bar reads against the BAR, not against the page. The product
   logo takes --acc and an app's mark takes its identity hue, and both are
   600/700 weights picked against a near-white bar: measured on a solid brand
   green they land at 1.0-1.3:1, which is no mark at all. --topbar-mark is the
   bar's own ink for whichever of the two it is carrying.
   It is deliberately NOT declared on :root. A :root value would substitute
   --hub-accent at the root element, where no app has set one, and every app
   mark in the platform would collapse to the accent. Left unset, the fallback
   chain below IS the default, so a theme that does not paint the bar keeps
   exactly the colours it has today. */
.topbar .brand-mark,
.topbar-brand .app-mark {
  color:var(--topbar-mark, var(--hub-accent, var(--acc)));
}
/* Current flowing down the leads, on hover. The spark is painted in the colour
   behind the mark, so it reads as a bright gap running along a wire that is
   already solid — a same-coloured highlight on a same-coloured wire would show
   nothing. --mark-spark is that colour: the surface by default, the terminal's
   own background inside the hub, set where the mark is placed rather than
   guessed at here.

   Each wire declares pathLength="100", so one dash pattern travels every wire
   of every logo at the same pace whatever its real length. The dash is longer
   than the gap between start and end on purpose: exactly one spark is in
   flight per wire. */
.bl-current {
  stroke:none;
  stroke-width:3.6;
  stroke-linecap:round;
  stroke-linejoin:round;
  stroke-dasharray:16 200;
}
.app-mark--motool .bl-current { stroke-width:4.2; }

/* Which way a spark runs and how far behind the last one it is are carried as
   custom properties, not as later rules that try to override this one: a hover
   selector outranks a plain one, so a rule further down the file would lose
   here and the phases would silently collapse to zero. */
.hub-module:hover .bl-current,
.topbar-brand--mark:hover .bl-current {
  stroke:var(--mark-spark, var(--sur));
  animation:var(--bl-current-way, markCurrentFlow)
            var(--app-mark-flow-duration)
            var(--bl-current-phase, 0s)
            linear infinite;
}
/* DQ Model — three phases, each a third of a turn behind the last, because that
   is what 120 degrees is. Written as a fraction of the flow duration and not as
   a number of milliseconds, so changing the speed cannot quietly put the phases
   out. */
/* Supply in, machine out: the leads are fed from their terminals, so all three
   sparks run from the ring ends toward the machine. The paths are drawn
   board-first, so that is the backwards direction. */
.app-mark--dqmodel .bl-current { --bl-current-way:markCurrentReturn; }
.app-mark--dqmodel .bl-current-2 { --bl-current-phase:calc(var(--app-mark-flow-duration) / -3); }
.app-mark--dqmodel .bl-current-3 { --bl-current-phase:calc(var(--app-mark-flow-duration) / -1.5); }

/* Motool — DC, so it is one loop and not three phases: the current arrives on
   one lead and leaves on the other at the same moment. The two sparks share a
   beat and run in opposite directions -- in along the top lead, out along the
   bottom one. Both paths are drawn motor-first, so the incoming lead is the one
   whose spark runs backwards. */
.app-mark--motool .bl-current-1 { --bl-current-way:markCurrentReturn; }

@keyframes markCurrentFlow {
  from { stroke-dashoffset:16; }
  to   { stroke-dashoffset:-100; }
}
@keyframes markCurrentReturn {
  from { stroke-dashoffset:-100; }
  to   { stroke-dashoffset:16; }
}

/* The shaft turns, on the same hover that starts the current. Both machines are
   drawn flat side-on, where a turning shaft shows nothing at all, so rotation is
   drawn the way a drawing draws it: a ring around the shaft with an arrow
   running round it.

   Depth is what makes that ring read as a ring and not as an oval painted on
   top of the shaft, and it costs nothing here, because the ring crosses the
   shaft and nothing else. The near half is drawn straight across it. The far
   half simply stops at the shaft's edges and starts again on the other side —
   the missing piece IS the shaft in front of it — and the arrow riding round
   is not painted over that same stretch. So no layer sits behind any other and
   no shape is painted in the background colour to hide anything: the artwork
   itself is the occlusion. That matters, because the shaft's inside is a hole
   in the machine, not a filled shape, and anything drawn behind it would show
   straight through.

   Shown on the hub tile only. In a topbar the whole machine is 18px, which puts
   this ring at about five pixels — a smudge, not a picture. */
.bl-spin {
  fill:none;
  stroke:currentColor;
  stroke-width:3.4;
  stroke-linecap:round;
  opacity:0;
  transition:opacity .2s ease;
}
/* The arrow is an open arc with a head, never a closed ring: a closed one reads
   as a hole or a washer, not as something turning. It is short on purpose -- a
   little over half a turn -- and it sweeps, so what goes round the shaft is the
   whole arrow and not a bead running along a standing circle.

   The sweep is a dash travelling along the ring, and a dash pattern restarts at
   every subpath, so the three drawn pieces are three elements rather than three
   subpaths of one. Each declares its own length as its share of the ring
   (`pathLength`, in percent of a full turn), so one dash pattern -- 52 on, 48
   off -- means the same arc on all three; and each starts the pattern where it
   sits on the ring, which is `--bl-spin-from` (its ellipse position plus the
   arc length). That is what keeps the pieces one arrow instead of three. */
.bl-spin-track { stroke-dasharray:52 48; }
.bl-spin-front     { --bl-spin-from:52px; }
.bl-spin-back-low  { --bl-spin-from:102px; }
.app-mark--motool  .bl-spin-back-high { --bl-spin-from:135.51px; }
.app-mark--dqmodel .bl-spin-back-high { --bl-spin-from:135.27px; }
.bl-spin-arrow { fill:currentColor; stroke:none; offset-rotate:auto; }
/* The ellipse the arrow rides is the same ellipse the ring is drawn from: the
   ring's first subpath in <key>.svg is the near half of this path, and
   test_every_app_topbar_shows_its_registry_icon checks the two still agree. */
.app-mark--motool .bl-spin-arrow {
  offset-path:path("M22 69.431A6 17 0 0 1 22 103.431A6 17 0 0 1 22 69.431");
}
.app-mark--dqmodel .bl-spin-arrow {
  offset-path:path("M249 69.55A6 17 0 0 1 249 103.55A6 17 0 0 1 249 69.55");
}
/* The head rides the leading end of the arc: same duration, same start, so the
   two are one shape at every instant. */
.hub-module:hover .bl-spin-track {
  opacity:1;
  animation:markSpinSweep var(--app-mark-spin-duration) linear infinite;
}
.hub-module:hover .bl-spin-arrow {
  opacity:1;
  animation:markSpinRide var(--app-mark-spin-duration) linear infinite,
            markSpinBehind var(--app-mark-spin-duration) linear infinite;
}
@keyframes markSpinRide { to { offset-distance:100%; } }
@keyframes markSpinSweep {
  from { stroke-dashoffset:var(--bl-spin-from); }
  to   { stroke-dashoffset:calc(var(--bl-spin-from) - 100px); }
}
/* Where the ring passes behind the shaft, measured along the ring itself and
   not in degrees -- the arrow travels at constant speed, so a share of the
   length is a share of the time and a share of the angle is not. The two
   machines put their shafts in different places and still come out within half
   a percent of each other, so one window serves both. */
@keyframes markSpinBehind {
  0%,     66.3%  { opacity:1; }
  66.4%,  83.6%  { opacity:0; }
  83.7%,  100%   { opacity:1; }
}

/* Configurator — point at it and the loose block goes back into the assembly
   and lifts out again. Taking a part out of a product and putting it back is
   the whole app, so that is the motion. The 4 units it travels are the icon's
   own grid (a 24-unit box, a block 8 across), not a number picked to look
   right. */
.hub-module:hover .app-mark--catalog .bl-block-top,
.topbar-brand--mark:hover .app-mark--catalog .bl-block-top {
  animation:markBlockShuttle var(--app-mark-assemble-duration)
            cubic-bezier(.45, .05, .35, 1) infinite;
}
@keyframes markBlockShuttle {
  0%,  14%  { transform:none; }
  44%, 60%  { transform:translate(-4px, 4px); }
  90%, 100% { transform:none; }
}

/* Configurator — the loose block is the subject, so it is drawn heavier than the
   assembly it belongs in, the way the pump's blades are drawn heavier than the
   housing round them. Relative, never absolute: inside a hub tile every glyph is
   levelled to --app-mark-stroke, and a literal 2.6 here would put a block five
   times the weight of its own assembly on that wall of logos. */
.app-mark--catalog .bl-block-top { stroke-width:calc(var(--app-mark-stroke, 2) * 1.3); }

/* Materials — point at it and the sheets stack into one pile and fan out again.
   A library is layered records; collapsing the stack is the metaphor. The 5
   units each sheet travels are the icon's own grid — one layer step in a
   24-unit box — not a number picked to look right. Sheet 2 lands first, then 3
   on top, so the motion reads as blocks piling up rather than one shape
   shrinking. */
.hub-module:hover .app-mark--materials .bl-sheet-2,
.topbar-brand--mark:hover .app-mark--materials .bl-sheet-2 {
  animation:markSheetStackMid var(--app-mark-stack-duration)
            cubic-bezier(.45, .05, .35, 1) infinite;
}
.hub-module:hover .app-mark--materials .bl-sheet-3,
.topbar-brand--mark:hover .app-mark--materials .bl-sheet-3 {
  animation:markSheetStackBot var(--app-mark-stack-duration)
            cubic-bezier(.45, .05, .35, 1) infinite;
}
@keyframes markSheetStackMid {
  0%,  20%  { transform:none; }
  35%, 55%  { transform:translateY(-5px); }
  70%, 100% { transform:none; }
}
@keyframes markSheetStackBot {
  0%,  35%  { transform:none; }
  50%, 70%  { transform:translateY(-10px); }
  85%, 100% { transform:none; }
}

/* Market Reports — point at it and the bars grow from the baseline, one after
   another. The app is charts and tables; loading a series is the metaphor.
   Each bar is a filled column, not a hairline stroke, and grows from its own
   bottom edge — transform-origin on the bar, not the whole mark. The three
   slots in the cycle are the icon's own bar positions, not a timing picked to
   look right. */
.app-mark--market_reports .bl-bar { transform-origin:center bottom; }
/* Maps — the map draws itself. Each curve strokes on from nothing, outer first,
   and the efficiency island lands last, which is the order a contour plot is
   read in: the limit of the machine, then the bands inside it, then the place
   you actually want to run. It holds there, then fades out and begins again, so
   the loop never shows a curve snapping back to empty.

   Both numbers a curve needs live here and only here. `--bl-fade` is its resting
   opacity, graded outward, and the keyframe returns to that value instead of a
   literal 1 -- otherwise tracing would flatten the grading that gives the mark
   its depth. `--bl-delay` is its place in the stagger. Neither belongs in the
   artwork: the drawing is geometry, the stylesheet is timing.

   Every curve carries pathLength="100", so one keyframe traces all five however
   long each really is. */
.app-mark--maps .bl-env,
.app-mark--maps .bl-iso    { opacity:var(--bl-fade, 1); }
.app-mark--maps .bl-env    { --bl-fade:1;   --bl-delay:0s; }
.app-mark--maps .bl-iso-60 { --bl-fade:.42; --bl-delay:.20s; }
.app-mark--maps .bl-iso-72 { --bl-fade:.58; --bl-delay:.40s; }
.app-mark--maps .bl-iso-79 { --bl-fade:.8;  --bl-delay:.60s; }
.app-mark--maps .bl-iso-83 { --bl-fade:1;   --bl-delay:.80s; }
.hub-module:hover .app-mark--maps .bl-env,
.hub-module:hover .app-mark--maps .bl-iso,
.topbar-brand--mark:hover .app-mark--maps .bl-env,
.topbar-brand--mark:hover .app-mark--maps .bl-iso {
  stroke-dasharray:100;
  animation:markMapTrace var(--app-mark-map-duration) cubic-bezier(.35, 0, .2, 1)
            var(--bl-delay, 0s) infinite both;
}
@keyframes markMapTrace {
  0%        { stroke-dashoffset:100; opacity:0; }
  8%        { opacity:var(--bl-fade, 1); }
  46%, 78%  { stroke-dashoffset:0; opacity:var(--bl-fade, 1); }
  100%      { stroke-dashoffset:0; opacity:0; }
}

/* Settings — one axis, and only the toothed ring on it.

   The ring turns about Y under perspective, so it swings edge-on and back like
   a disc on a shaft instead of a sticker spinning flat. One axis on purpose:
   an earlier version turned the teeth on Z and tumbled the mark on Y at the
   same time, and two axes at once read as a wobble, not as a machine.

   The hub is a separate part and carries no animation, so it stays put while
   the ring passes it — that stillness is what makes the ring look like it is
   mounted on something.

   Perspective is a fixed length while the mark is drawn at 18px in a topbar and
   48px on a tile, so the turn reads stronger on the tile. That is the right way
   round: the tile is where the mark is looked at. */
.hub-module:hover .app-mark--settings .bl-gear,
.topbar-brand--mark:hover .app-mark--settings .bl-gear {
  animation:markGearRun var(--app-mark-gear-duration) linear infinite;
}
/* The wheel turns; the housing it turns inside does not. That stillness is what makes the
   ring read as something the wheel is mounted in — the Settings gear's rule, where the
   teeth turn and `bl-hub` stays put. (NOT the product mark's, which is the other way
   round: there the ring is the part that moves.) `bl-rotor` is a group, so the blade
   count can change without the stylesheet knowing — never `:nth-child`. */
.hub-module:hover .app-mark--ipump .bl-rotor,
.topbar-brand--mark:hover .app-mark--ipump .bl-rotor {
  animation:markRotorSpin var(--app-mark-rotor-duration) linear infinite;
  /* `view-box` is not optional: the five blades are not symmetric about the centre, so
     the group's own box is off-centre (12.74, 11.77) and `fill-box` swings the wheel
     round a 1.9px orbit instead of spinning it. */
  transform-box:view-box;
  transform-origin:center;
}
@keyframes markRotorSpin {
  from { transform:rotate(0deg); }
  to   { transform:rotate(360deg); }
}

@keyframes markGearRun {
  from { transform:perspective(110px) rotateY(0deg); }
  to   { transform:perspective(110px) rotateY(360deg); }
}

.hub-module:hover .app-mark--market_reports .bl-bar-1,
.topbar-brand--mark:hover .app-mark--market_reports .bl-bar-1 {
  animation:markBarGrow1 var(--app-mark-chart-duration)
            cubic-bezier(.34, 1.1, .45, 1) infinite;
}
.hub-module:hover .app-mark--market_reports .bl-bar-2,
.topbar-brand--mark:hover .app-mark--market_reports .bl-bar-2 {
  animation:markBarGrow2 var(--app-mark-chart-duration)
            cubic-bezier(.34, 1.1, .45, 1) infinite;
}
.hub-module:hover .app-mark--market_reports .bl-bar-3,
.topbar-brand--mark:hover .app-mark--market_reports .bl-bar-3 {
  animation:markBarGrow3 var(--app-mark-chart-duration)
            cubic-bezier(.34, 1.1, .45, 1) infinite;
}
@keyframes markBarGrow1 {
  0%,  8%   { transform:scaleY(0); }
  22%, 72%  { transform:scaleY(1); }
  78%, 100% { transform:scaleY(0); }
}
@keyframes markBarGrow2 {
  0%,  22%  { transform:scaleY(0); }
  36%, 72%  { transform:scaleY(1); }
  78%, 100% { transform:scaleY(0); }
}
@keyframes markBarGrow3 {
  0%,  36%  { transform:scaleY(0); }
  50%, 72%  { transform:scaleY(1); }
  78%, 100% { transform:scaleY(0); }
}

/* Admin — three people, the lead in front and larger.

   Nothing here moves one figure on its own, and that is the whole design. The
   gaps between the figures are not gaps: the artwork cuts each figure out of
   the one in front of it, and those notches are shaped for the lead at one
   exact size. Scale or shift a single figure and it slides against a notch cut
   for a different one -- the white between them thins on one side and opens on
   the other. The drawing cannot be taken apart that way.

   So the shape never changes. The three scale together, about the mark's own
   centre and not their own (transform-box:view-box), which is one similarity
   transform of the whole picture: every gap keeps its proportion exactly. The
   team breathes as one.

   The ripple survives as light instead of geometry — each figure dims and comes
   back in turn, the two behind first and the lead last. Attention moving across
   a group, with not one edge disturbed. The figures never overlap (each is cut
   out of the next), so dimming one leaves no double-dark seam. */
.app-mark--admin .bl-user {
  transform-box:view-box;
  transform-origin:center;
}
.app-mark--admin .bl-user-1 { --bl-admin-wake:markAdminWake1; }
.app-mark--admin .bl-user-2 { --bl-admin-wake:markAdminWake2; }
.app-mark--admin .bl-user-3 { --bl-admin-wake:markAdminWake3; }
.hub-module:hover .app-mark--admin .bl-user,
.topbar-brand--mark:hover .app-mark--admin .bl-user {
  animation:markAdminBreath var(--app-mark-orbit-duration) cubic-bezier(.4, 0, .4, 1) infinite,
            var(--bl-admin-wake) var(--app-mark-orbit-duration) ease-in-out infinite;
}
/* One breath for all three. 1.06 of 90 units reaches 2.7 past the artwork, and
   an <svg> clips to its own viewBox, so admin.svg carries a margin wider than
   that. Raise this without widening that box and the group crops at the edge. */
@keyframes markAdminBreath {
  0%,  100% { transform:none; }
  50%       { transform:scale(1.06); }
}
@keyframes markAdminWake1 {
  0%,  4%    { opacity:1; }
  15%        { opacity:.42; }
  28%, 100%  { opacity:1; }
}
@keyframes markAdminWake2 {
  0%,  22%   { opacity:1; }
  33%        { opacity:.42; }
  46%, 100%  { opacity:1; }
}
@keyframes markAdminWake3 {
  0%,  40%   { opacity:1; }
  51%        { opacity:.42; }
  64%, 100%  { opacity:1; }
}

/* RFQ Search — a straight ticker behind the glass. Individual glyphs, 6.5
   apart, centred on the lens (y=11). The artwork masks them with a radial fade
   to the inner rim, so a letter eases in from the right and out to the left
   instead of being chopped by a hard circle. overflow:visible is required:
   the run sits past the 24-box, and a viewBox clip would pop a glyph in at
   the square edge before it reached the glass. Period 52 matches one copy of
   the eight glyphs in rfq_search.svg — keep those two in step. */
.app-mark--rfq_search { overflow:visible; }
.app-mark--rfq_search .bl-stream {
  opacity:0;
  transition:opacity .4s ease;
  pointer-events:none;
}
.app-mark--rfq_search .bl-glyph {
  fill:currentColor;
  stroke:none;
  font-size:5.2px;
  font-family:"Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  font-style:italic;
  font-weight:700;
}
.hub-module:hover .app-mark--rfq_search .bl-stream,
.topbar-brand--mark:hover .app-mark--rfq_search .bl-stream { opacity:1; }
.hub-module:hover .app-mark--rfq_search .bl-stream-run,
.topbar-brand--mark:hover .app-mark--rfq_search .bl-stream-run {
  animation:markRfqStream var(--app-mark-stream-duration) linear infinite;
}
@keyframes markRfqStream {
  to { transform:translateX(-52px); }
}

/* Field Viewer — the flow moves, the body does not.

   The streamlines themselves stay put, and that is deliberate: sliding a line
   along its own length shows nothing, because the result is the same line. What
   reads as flow is the two arrowheads drifting downstream and fading out at each
   end of their run.

   Each arrow drifts along ITS OWN streamline's tangent -- about 10deg on the top
   line, 1deg on the bottom one -- and not straight sideways. A shared translateX
   would lift the top arrow off its curve by a fifth of a unit for every unit it
   travelled, which at the 60px hub size is a visible 2px of daylight under the
   arrowhead. The two are half a period apart so the mark never has both arrows
   sitting at the same point of the same run. */
.app-mark--field_viewer .bl-arrow-1 {
  --bl-drift-x:4.3px; --bl-drift-y:0.76px; --bl-drift-delay:0s;
}
.app-mark--field_viewer .bl-arrow-2 {
  --bl-drift-x:4.3px; --bl-drift-y:0.1px;
  --bl-drift-delay:calc(var(--app-mark-stream-duration) / -2);
}
.hub-module:hover .app-mark--field_viewer .bl-arrow-1,
.hub-module:hover .app-mark--field_viewer .bl-arrow-2,
.topbar-brand--mark:hover .app-mark--field_viewer .bl-arrow-1,
.topbar-brand--mark:hover .app-mark--field_viewer .bl-arrow-2 {
  animation:markFieldDrift var(--app-mark-stream-duration) linear infinite;
  animation-delay:var(--bl-drift-delay);
}
@keyframes markFieldDrift {
  0%       { transform:translate(calc(var(--bl-drift-x) * -0.55),
                                 calc(var(--bl-drift-y) * -0.55)); opacity:0; }
  25%, 70% { opacity:1; }
  100%     { transform:translate(calc(var(--bl-drift-x) * 0.55),
                                 calc(var(--bl-drift-y) * 0.55)); opacity:0; }
}

@media (prefers-reduced-motion:reduce) {
  .brand-mark,
  .brand-mark .bm-ring { animation:none; }
}

/* Idle flourish — the ring takes one turn inside the still tile, at random
   intervals driven by brand-idle-spin.js. The plate and shaft never move. */
.brand-mark.is-tumbling .bm-ring {
  animation:brandTumble var(--brand-tumble-duration) cubic-bezier(.62, 0, .3, 1);
  transform-box:fill-box;
  transform-origin:center;
}
@keyframes brandTumble { to { transform:rotate(360deg); } }
@media (prefers-reduced-motion:reduce) {
  .brand-mark.is-tumbling .bm-ring { animation:none; }
}
.brand-mark--sm { --brand-mark-size:16px; }
.brand-mark--lg { --brand-mark-size:32px; }
/* Loader: the ring turns, the shaft stays — two masked layers on one box. */
.spin,
.brand-spin {
  position:relative;
  width:var(--brand-spin-size);
  height:var(--brand-spin-size);
  border:0;
}
.spin::before, .spin::after,
.brand-spin::before, .brand-spin::after {
  content:"";
  position:absolute;
  inset:0;
  background:currentColor;
  -webkit-mask-position:center; mask-position:center;
  -webkit-mask-size:contain;    mask-size:contain;
  -webkit-mask-repeat:no-repeat; mask-repeat:no-repeat;
}
.spin::before,
.brand-spin::before {
  -webkit-mask-image:var(--brand-glyph-ring);
  mask-image:var(--brand-glyph-ring);
  animation:brandSpin var(--brand-spin-duration) linear infinite;
}
.spin::after,
.brand-spin::after {
  -webkit-mask-image:var(--brand-glyph-hub);
  mask-image:var(--brand-glyph-hub);
}
.brand-spin--lg { --brand-spin-size:34px; }
@keyframes brandSpin { to { transform:rotate(360deg); } }
@media (prefers-reduced-motion:reduce) {
  .spin::before, .brand-spin::before { animation-duration:4s; }
}
/* The app's own topbar mark: its hub icon in its identity hue. */
.app-mark {
  display:block;
  color:var(--hub-accent, var(--acc));
  flex-shrink:0;
}
/* Idle flourish for an app mark. A full turn suits the ring; an arbitrary glyph
   reads better with a short lean, so the two marks animate differently. */
.app-mark.is-tumbling,
.topbar-brand--mark.is-tumbling .app-mark {
  animation:appMarkLean var(--app-mark-lean-duration) cubic-bezier(.34, 1.3, .5, 1);
  transform-origin:center;
}
@keyframes appMarkLean {
  30% { transform:rotate(-14deg) scale(1.12); }
  65% { transform:rotate(10deg) scale(1.06); }
  100% { transform:none; }
}
@media (prefers-reduced-motion:reduce) {
  .app-mark.is-tumbling,
  .topbar-brand--mark.is-tumbling .app-mark { animation:none; }

  .hub-module:hover .bl-current,
  .topbar-brand--mark:hover .bl-current { animation:none; stroke:none; }

  .hub-module:hover .bl-spin-track,
  .hub-module:hover .bl-spin-arrow { animation:none; opacity:0; }

  .hub-module:hover .app-mark--catalog .bl-block-top,
  .topbar-brand--mark:hover .app-mark--catalog .bl-block-top { animation:none; transform:none; }

  .hub-module:hover .app-mark--materials .bl-sheet-2,
  .hub-module:hover .app-mark--materials .bl-sheet-3,
  .topbar-brand--mark:hover .app-mark--materials .bl-sheet-2,
  .topbar-brand--mark:hover .app-mark--materials .bl-sheet-3 { animation:none; transform:none; }

  .hub-module:hover .app-mark--market_reports .bl-bar,
  .topbar-brand--mark:hover .app-mark--market_reports .bl-bar { animation:none; transform:none; }

  .hub-module:hover .app-mark--admin .bl-user,
  .topbar-brand--mark:hover .app-mark--admin .bl-user { animation:none; transform:none; }

  .hub-module:hover .app-mark--settings .bl-gear,
  .topbar-brand--mark:hover .app-mark--settings .bl-gear { animation:none; transform:none; }

  .hub-module:hover .app-mark--ipump .bl-rotor,
  .topbar-brand--mark:hover .app-mark--ipump .bl-rotor { animation:none; transform:none; }

  .hub-module:hover .app-mark--maps .bl-env,
  .hub-module:hover .app-mark--maps .bl-iso,
  .topbar-brand--mark:hover .app-mark--maps .bl-env,
  .topbar-brand--mark:hover .app-mark--maps .bl-iso {
    animation:none; stroke-dasharray:none; opacity:var(--bl-fade, 1);
  }

  .hub-module:hover .app-mark--rfq_search .bl-stream,
  .topbar-brand--mark:hover .app-mark--rfq_search .bl-stream { opacity:0; transition:none; }
  .hub-module:hover .app-mark--rfq_search .bl-stream-run,
  .topbar-brand--mark:hover .app-mark--rfq_search .bl-stream-run { animation:none; transform:none; }

  .hub-module:hover .app-mark--field_viewer .bl-arrow-1,
  .hub-module:hover .app-mark--field_viewer .bl-arrow-2,
  .topbar-brand--mark:hover .app-mark--field_viewer .bl-arrow-1,
  .topbar-brand--mark:hover .app-mark--field_viewer .bl-arrow-2 {
    animation:none; transform:none; opacity:1;
  }

  .hub-module:not(.hub-module-disabled):hover .hub-module-logo,
  .topbar-brand--mark:hover { transform:none; }
}
.topbar-brand--mark {
  margin-right:10px;
  transition:transform .18s cubic-bezier(.2, .8, .3, 1.2);
}
.topbar-brand--mark:hover { transform:scale(1.07); }
.topbar-brand-cluster {
  display:flex;
  align-items:center;
  gap:8px;
  padding-right:0;
  margin-right:12px;
  border-right:none;
}
.topbar-brand-cluster .topbar-brand {
  padding-right:0;
  margin-right:0;
  border-right:none;
}
.topbar-label {
  font-size:var(--font-ui-sm);
  color:var(--topbar-fg3);
  text-transform:uppercase;
  letter-spacing:.05em;
  margin-right:5px;
}
html[data-theme="dark"] .topbar-label,
/* The brand version chip keeps its own muted token in dark, so it stays the
   same chip as the hub's. */
html[data-theme="dark"] .topbar-badge:not(.topbar-badge--brand),
html[data-theme="dark"] .col-head-title,
html[data-theme="dark"] .psec-title {
  color:#cbd5e1;
}
.product-menu {
  position:absolute;
  top:calc(100% + 6px);
  left:0;
  min-width:210px;
  max-width:min(320px,calc(100vw - 24px));
  display:flex;
  flex-direction:column;
  padding:4px;
  border:1px solid var(--bdr);
  background:var(--sur);
  box-shadow:0 12px 28px rgba(15,23,42,.16);
  z-index:80;
}
.product-menu[hidden] { display:none; }

/* Theme picker: the shared .product-menu, narrowed and anchored to the right
   because its trigger sits in the topbar's right corner. */
.product-menu--theme {
  min-width:150px;
  left:auto;
  right:0;
}

/* Right-click menu: the same surface, opened where the pointer is. The three menus
   above hang under a button and are positioned against it; this one has no button to
   hang under, so it is fixed in the window and `js/shared/context-menu.js` writes the
   two offsets at the moment of the click. `top`/`left` here are only the resting
   place before it is measured. */
.product-menu--at-pointer {
  position:fixed;
  top:0;
  left:0;
  min-width:180px;
  z-index:120;
}
.topbar-theme-host {
  position:relative;
  display:inline-flex;
  align-items:center;
}
.theme-swatch {
  width:14px;
  height:14px;
  flex:0 0 14px;
  border:1px solid var(--bdr);
  border-radius:var(--radius-sm);
}
.theme-swatch--light   { background:linear-gradient(135deg, var(--theme-sample-light-sur) 50%,   var(--theme-sample-light-acc) 50%); }
.theme-swatch--vintage { background:linear-gradient(135deg, var(--theme-sample-vintage-sur) 50%, var(--theme-sample-vintage-acc) 50%); }
.theme-swatch--retro70 { background:linear-gradient(135deg, var(--theme-sample-retro70-sur) 50%, var(--theme-sample-retro70-acc) 50%); }
.theme-swatch--eighties { background:linear-gradient(135deg, var(--theme-sample-eighties-sur) 50%, var(--theme-sample-eighties-acc) 50%); }
.theme-swatch--buehler { background:linear-gradient(135deg, var(--theme-sample-buehler-sur) 50%,  var(--theme-sample-buehler-acc) 50%); }
.theme-swatch--dark    { background:linear-gradient(135deg, var(--theme-sample-dark-sur) 50%,    var(--theme-sample-dark-acc) 50%); }
.theme-check {
  margin-left:auto;
  color:var(--acc);
}
.product-menu-row:not(.is-active) .theme-check { visibility:hidden; }
.product-menu-row {
  display:flex;
  align-items:center;
  gap:4px;
  width:100%;
}
.product-menu-row:hover,
.product-menu-row.is-active {
  background:var(--bg);
}
.product-menu-row.is-active .product-menu-name {
  color:var(--acc);
}
.product-menu-name,
.product-menu-add {
  display:flex;
  align-items:center;
  border:0;
  background:transparent;
  color:var(--tx);
  font:600 11px var(--sans);
  padding:6px 8px;
  cursor:pointer;
}
.product-menu-name {
  flex:1;
  min-width:0;
  text-align:left;
  gap:6px;
}
/* A row that is a CHOICE rather than an action can say what it gives you, in the
   muted tone the rest of the app uses for a hint. Pushed right so the names stay a
   readable column. First user: the Pump Designer's Export menu, where "STEP file"
   alone does not say whether you get one file or a zip. */
.product-menu-hint {
  margin-left:auto;
  padding-left:10px;
  color:var(--tx3);
  font-weight:400;
  white-space:nowrap;
}
/* A setting shared by the rows below it, as a strip of chips at the menu's top.
   First user: the Pump Designer's Export menu, STL surface detail (2026-10-30). */
.product-menu-chips {
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  gap:4px;
  padding:6px 8px;
  border-bottom:1px solid var(--bdr);
  margin-bottom:4px;
}
.product-menu-chips .product-menu-hint {
  margin-left:0;
  padding-left:0;
  margin-right:4px;
  font:400 11px var(--sans);
}
.product-menu-chip {
  border:1px solid var(--bdr);
  border-radius:var(--radius-sm);
  background:transparent;
  color:var(--tx);
  font:600 10px var(--sans);
  padding:2px 6px;
  cursor:pointer;
}
.product-menu-chip:hover { border-color:var(--acc-bdr-strong); }
.product-menu-chip[aria-pressed="true"] {
  border-color:var(--acc-bdr-solid);
  color:var(--acc);
  background:var(--bg);
}
.product-menu-name .cat-drop-row-label {
  min-width:0;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.product-menu-add {
  flex:0 0 auto;
  justify-content:center;
  width:26px;
  padding-inline:0;
  color:var(--tx3);
}
.product-menu-name:hover,
.product-menu-add:hover {
  color:var(--acc);
}
html[data-theme="dark"] .field-select,
html[data-theme="dark"] .f select,
html[data-theme="dark"] .comp-var-dropdown {
  color:#f1f5f9;
  border-color:var(--bdr);
}
html[data-theme="dark"] .product-menu {
  background:var(--sur);
  border-color:var(--bdr);
}
.topbar-spacer { flex:1; }
/* Demo pages use their own left/right split in topbar_actions */
.topbar-sep { width:12px; height:18px; background:transparent; margin:0; }
.topbar-action {
  display:inline-flex;
  align-items:center;
  gap:4px;
  padding:3px 9px;
  border:1px solid var(--bdr);
  border-radius:var(--radius-btn);
  background:transparent;
  color:var(--tx2);
  font:600 11px var(--sans);
  cursor:pointer;
  letter-spacing:.02em;
  white-space:nowrap;
  text-decoration:none;
}
/* Mouse / SPA focus restore: no ring. Keyboard: keep a visible focus mark. */
.topbar-action:focus { outline:none; }
.topbar-action:focus-visible {
  outline:2px solid var(--acc);
  outline-offset:2px;
}
/* Labelled buttons read as one family in dark, so their ink is flat rather
   than each variant's hue. An **icon-only** row action is excluded: it has no
   label, so its hue is the only thing saying which action it is. Without the
   exclusion this rule beat `color:var(--btn-hue)` at rest and lost to
   `.btn:hover` — which is precisely "the icons are grey until you hover". */
html[data-theme="dark"] .topbar-action:not(.topbar-action--ghost),
html[data-theme="dark"] .btn:not(.admin-action-btn) {
  color:#e4e4e7;
}
.topbar-action:hover { color:var(--acc); border-color:var(--acc); }
.topbar-action--icon {
  width:24px;
  height:24px;
  justify-content:center;
  padding:0;
  border-color:transparent;
  border-radius:var(--radius-btn);
  color:var(--tx3);
  background:transparent;
}
.topbar-action--icon svg {
  transition:transform .12s ease, color .12s ease;
}

/* Account cluster — ghost at rest; only Exit turns red on hover. */
.topbar-action--ghost {
  background:transparent;
  border-color:transparent;
  color:var(--tx3);
}
.topbar-action--ghost svg {
  transition:transform .12s ease, color .12s ease;
}
/* Labelled cluster control (Back): fixed glyph slot so hover scale hits the arrow only. */
.topbar-action-glyph {
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:11px;
  height:11px;
  flex-shrink:0;
}
.topbar-action.topbar-action--ghost:hover,
.topbar-action.topbar-action--ghost.topbar-action--icon:hover {
  color:var(--tx3);
  background:transparent;
  border-color:transparent;
}
.topbar-action.topbar-action--ghost.topbar-action--icon:hover:not(:disabled) svg,
.topbar-action.topbar-action--ghost:hover:not(:disabled) .topbar-action-glyph svg {
  transform:scale(1.18);
}
.topbar-action.topbar-action--ghost.topbar-action--ghost-exit:hover {
  color:var(--red);
}

.topbar-action--icon:hover {
  color:var(--acc);
  background:transparent;
  border-color:transparent;
}
/* The same controls, standing on the bar rather than on paper.
   `.topbar-action` is not only the bar's: the workspace sidebars and the
   product-add modal wear it too, and those stand on paper and must keep the
   page inks. So the bar's inks are scoped to the bar -- with `:where()`, which
   adds no specificity, so each rule below sits exactly where its unscoped twin
   sits in the cascade and only wins by coming later. Every property the twin
   set is restated, or a lower-specificity rule here would outrank a later one
   there (the icon variant's transparent border is the one that bites).
   In every theme that names no --topbar-* token these resolve to --tx2 / --tx3
   / --bdr / --acc / --red, so nothing moves. */
:where(.topbar) .topbar-action {
  border-color:var(--topbar-bdr);
  color:var(--topbar-fg2);
}
:where(.topbar) .topbar-action:focus-visible {
  outline-color:var(--topbar-acc);
}
:where(.topbar) .topbar-action--icon,
:where(.topbar) .topbar-action--ghost {
  border-color:transparent;
  color:var(--topbar-fg3);
}
:where(.topbar) .topbar-action:hover {
  color:var(--topbar-acc);
  border-color:var(--topbar-acc);
}
:where(.topbar) .topbar-action--icon:hover {
  color:var(--topbar-acc);
  background:transparent;
  border-color:transparent;
}
:where(.topbar) .topbar-action.topbar-action--ghost:hover,
:where(.topbar) .topbar-action.topbar-action--ghost.topbar-action--icon:hover {
  color:var(--topbar-fg3);
  background:transparent;
  border-color:transparent;
}
:where(.topbar) .topbar-action.topbar-action--ghost.topbar-action--ghost-exit:hover {
  color:var(--topbar-danger);
}
.topbar-action--icon:hover:not(:disabled) svg {
  transform:scale(1.18);
}
.topbar-action--icon.topbar-action--success,
.topbar-action--icon.topbar-action--primary,
.topbar-action--icon.topbar-action--warn,
.topbar-action--icon.topbar-action--danger {
  color:var(--tx-on-fill);
}
.topbar-action--danger { color:var(--tx-on-fill); background:var(--red); border-color:var(--red); }
.topbar-action--danger:hover { color:var(--tx-on-fill); background:#b91c1c; border-color:#b91c1c; }
.topbar-action--no-underline { text-decoration:none; }
.topbar-action--semibold { font-weight:600; }
.topbar-action--warn { color:var(--tx-on-fill); background:#eab308; border-color:#eab308; }
.topbar-action--warn:hover { color:var(--tx-on-fill); background:#ca8a04; border-color:#ca8a04; }
.topbar-action--primary { color:var(--tx-on-fill); background:var(--acc); border-color:var(--acc); }
.topbar-action--primary:hover { color:var(--tx-on-fill); background:var(--acc-strong); border-color:var(--acc-strong); }
.topbar-action--success { color:var(--tx-on-fill); background:#15803d; border-color:#15803d; }
.topbar-action--success:hover:not(:disabled) { color:var(--tx-on-fill); background:#166534; border-color:#166534; }
.topbar-action--success:disabled { opacity:.45; cursor:not-allowed; color:var(--tx-on-fill); }
.topbar-action-icon { vertical-align:-1px; margin-right:4px; }
.topbar-action-icon-lower { vertical-align:-2px; margin-right:4px; }

/* reusable action/button grouping utility */
.btn-group {
  display:flex;
  align-items:center;
  justify-content:flex-start;
  gap:6px;
}
.btn-group > form {
  display:inline-flex;
  margin:0;
}

.topbar-actions-left {
  margin-right:auto;
}
.topbar-account-actions {
  margin-left:auto;
  display:flex;
  align-items:center;
  gap:6px;
}

/* DQModel: keep reference values in DOM for logic/summary, but do not show inline in labels */
#dqmodel-ui .dq-ref-hint {
  display:none;
}
.topbar-icon {
  background:none;
  border:none;
  color:var(--topbar-fg3);
  cursor:pointer;
  display:flex;
  align-items:center;
  padding:4px;
  margin-left:4px;
}
.topbar-icon:hover { color:var(--topbar-fg2); }

/* Small info icon shown next to a field label (pairs with [data-tooltip]). */
.label-info {
  cursor:help;
  vertical-align:middle;
  opacity:.55;
  color:var(--tx2);
}
.label-info:hover, .label-info:focus-visible { opacity:1; }

/* Tooltip host for Lucide info icons — data-tooltip must not live on the SVG. */
.info-tooltip-host {
  display:inline-flex;
  align-items:center;
  flex-shrink:0;
  outline:none;
  cursor:default;
}
.info-tooltip-host .label-info {
  cursor:inherit;
}
/* The same glyph as a <button>: it opens a modal_shell on click (info_tooltip's
   `open_modal`) and keeps its hover text, so a section with a drawing has one
   icon, not two. Only the button chrome is reset; size and colour are the (i)'s. */
.info-tooltip-host--opens {
  /* `background:none` alone leaves the native button chrome showing in some
     browsers (a themed pill behind the icon) — `appearance:none` is what
     actually turns a <button> back into a plain inline box. */
  appearance:none;
  -webkit-appearance:none;
  -moz-appearance:none;
  background:none;
  border:0;
  padding:0;
  margin:0;
  font:inherit;
  color:inherit;
  cursor:pointer;
}
/* This (i) is a control, not a hover-only hint, so it does not sit at the
   hint's resting .55 opacity — it reads at full strength all the time. */
.info-tooltip-host--opens .label-info { cursor:pointer; opacity:1; }
.comp-section-title,
.comp-section-title .info-tooltip-host,
.admin-panel.comp-panel > .comp-section-title {
  overflow:visible;
}

/* The one tooltip bubble — a single top-layer popover owned by js/tooltip.js.
   `[data-tooltip="..."]` marks a host; nothing here is a pseudo-element, so no
   ancestor's `overflow:hidden` can clip the bubble and no stacking context can
   bury it. That is what retired `data-tooltip-align`: a bubble that cannot be
   clipped has no reason to pick a side from the template it was written in.
   `data-tooltip-placement="bottom"` still asks for the side; the script flips
   it only when the window edge leaves no room, and slides it sideways rather
   than flipping when it would run off the left or right. */
.tt-bubble {
  position:fixed;
  inset:auto;
  margin:0;
  padding:0;
  border:0;
  width:max-content;
  max-width:min(330px, 90vw);
  background:none;
  overflow:visible;
  opacity:0;
  pointer-events:none;
  transition:opacity .12s ease, transform .12s ease;
  transform:translateY(2px);
  /* Only reached when the browser has no popover support: with it, the top
     layer puts the bubble above every stacking context on the page. */
  z-index:2000;
}
.tt-bubble::backdrop {
  background:none;
}
.tt-bubble--below {
  transform:translateY(-2px);
}
/* Positioned by the script before it is allowed to paint, so the bubble never
   flashes at the window's top-left on its way to the host. */
.tt-bubble.is-placed {
  opacity:1;
  transform:translateY(0);
}
.tt-bubble__text {
  display:block;
  padding:5px 8px;
  border:1px solid color-mix(in srgb, var(--bdr) 75%, transparent);
  border-radius:5px;
  background:color-mix(in srgb, var(--sur) 96%, var(--bg));
  color:var(--tx2);
  box-shadow:0 8px 20px rgba(15, 23, 42, .14);
  font:600 var(--font-ui-xs) var(--sans);
  line-height:1.35;
  /* pre-line: a &#10; in data-tooltip is a deliberate line break (who / when);
     ordinary tooltips have none and wrap exactly as before. */
  white-space:pre-line;
  text-align:start;
  overflow-wrap:break-word;
  word-break:normal;
}
.tt-bubble__arrow {
  position:absolute;
  top:100%;
  /* `left` is set by the script: the arrow tracks the host, so a bubble that
     slid away from a window edge still points at the control it describes. */
  margin-left:-4px;
  border:4px solid transparent;
  border-top-color:color-mix(in srgb, var(--sur) 96%, var(--bg));
}
.tt-bubble--below .tt-bubble__arrow {
  top:auto;
  bottom:100%;
  border-top-color:transparent;
  border-bottom-color:color-mix(in srgb, var(--sur) 96%, var(--bg));
}

/* Overflow-tooltip primitive: pair with overflow-tooltip.js. The host (.ov-tip)
   keeps overflow visible so [data-tooltip] is not clipped; the inner text
   truncates with an ellipsis. JS adds data-tooltip only when text is cut. */
.ov-tip {
  display:flex;
  align-items:center;
  /* Room for a trailing chip (a product's release badge). Every other .ov-tip
     has a single child, so the gap changes nothing for them. */
  gap:6px;
  min-width:0;
  max-width:100%;
  cursor:default;
}
.ov-tip-text {
  flex:1 1 auto;
  min-width:0;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}

.topbar-badge {
  font-size:var(--font-tiny);
  font-family:var(--mono);
  letter-spacing:.06em;
  text-transform:uppercase;
  color:var(--topbar-fg3);
  border:1px solid var(--bdr2);
  padding:1px 5px;
  margin-left:6px;
}
/* Version is metadata, not state — muted, unfilled, never accent. The same
   chip as the hub's .hub-module-ver, in the app shell's own muted token
   instead of the terminal's: one treatment for a version, wherever it is
   shown. Keep the two in step. */
.topbar-badge--brand {
  display:inline-flex;
  align-items:center;
  line-height:1;
  color:var(--topbar-fg3);
  background:transparent;
  border-color:color-mix(in srgb, var(--topbar-fg3) 26%, transparent);
  border-radius:var(--radius-sm);
  padding:2px 6px;
  margin-left:0;
  text-transform:none;
  letter-spacing:.02em;
  font-variant-numeric:tabular-nums;
}
.product-type-badge {
  display:inline-block;
  font-size:var(--font-tiny);
  font-family:var(--mono);
  letter-spacing:.06em;
  text-transform:uppercase;
  border-radius:9999px;
  padding:2px 7px;
  border:1px solid;
  line-height:1.4;
  /* Variants set `color` only. Fill and rim follow currentColor so the already-
     relit --app-hue-* values cover dark without a patch rule. */
  background: color-mix(in srgb, currentColor var(--identity-chip-fill), var(--sur-raised));
  border-color: color-mix(in srgb, currentColor var(--identity-chip-bdr), var(--bdr));
}
.product-type-badge--dc { color: var(--app-hue-motool); }
.product-type-badge--pmsm { color: var(--app-hue-maps); }
.product-type-badge--copper { color: var(--app-hue-market_reports); }
.product-type-badge--aluminium { color: var(--tx2); }
.product-type-badge--generic {
  color: var(--tx2);
  background: color-mix(in srgb, var(--bg) 88%, var(--sur));
  border-color: var(--bdr);
}
.product-type-badge--default { color: var(--grn); }

/* ── Toasts ── */
.toast-container {
  position: fixed;
  top: calc(var(--topbar-h) + 10px);
  right: 16px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 6px;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px 8px 12px;
  border-radius: var(--radius-md);
  border-left: 3px solid;
  font-size: var(--font-small);
  min-width: 220px;
  max-width: 360px;
  box-shadow: 0 2px 8px rgba(0,0,0,.12);
  pointer-events: all;
  animation: toast-in .18s ease both;
}
.toast-ok  { background:#f0fdf4; border-color:var(--grn); color:var(--grn); }
.toast-info { background:var(--acc2); border-color:var(--acc); color:var(--acc); }
.toast-err { background:#fef2f2; border-color:var(--red); color:var(--red); }
.toast-msg { flex: 1; }
.toast-close {
  flex-shrink: 0;
  background: none;
  border: none;
  cursor: pointer;
  font-size: var(--font-sub);
  line-height: 1;
  color: inherit;
  opacity: .5;
  padding: 0 2px;
}
.toast-close:hover { opacity: 1; }
.toast-hiding { animation: toast-out .2s ease forwards; }
@keyframes toast-in {
  from { opacity:0; transform:translateX(16px); }
  to   { opacity:1; transform:translateX(0); }
}
@keyframes toast-out {
  from { opacity:1; transform:translateX(0); }
  to   { opacity:0; transform:translateX(16px); }
}

/* ── Admin / Settings / Configurator HUD nav ── */
.admin-nav-row {
  display: flex;
  justify-content: center;
  padding: 10px 10px 0;
  z-index: 10;
  pointer-events: none;
  /* Must not be wider than the scroll container — prevents horizontal scroll
     caused by a nowrap nav in an overflow-y:auto ancestor. */
  max-width: 100%;
  overflow: hidden;
}
.admin-nav-row > * { pointer-events: auto; }
/* HUD overlay: stack the nav on the paper pane instead of a scroll-cut strip.
   Full-page hosts (#admin-ui, .settings-panel, .tabbed-page) size the cell to the viewport
   so .admin-scroll owns overflow. SPA (#spa-panel) uses an auto row so the
   fragment still grows and the panel itself scrolls; sticky keeps the pill
   pinned while paper slides underneath. */
:is(#admin-ui, .settings-panel, .tabbed-page):has(> .admin-nav-row) {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
}
#spa-panel:has(> .admin-nav-row):not([hidden]) {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}
:is(#admin-ui, .settings-panel, .tabbed-page, #spa-panel):has(> .admin-nav-row) > .admin-nav-row,
:is(#admin-ui, .settings-panel, .tabbed-page, #spa-panel):has(> .admin-nav-row) > .admin-scroll {
  grid-area: 1 / 1;
}
:is(#admin-ui, .settings-panel, .tabbed-page, #spa-panel):has(> .admin-nav-row) > .admin-nav-row {
  align-self: start;
  position: sticky;
  top: 0;
}
:is(#admin-ui, .settings-panel, .tabbed-page):has(> .admin-nav-row) > .admin-scroll {
  min-height: 0;
}
:is(#admin-ui, .settings-panel, .tabbed-page, #spa-panel):has(> .admin-nav-row) > .admin-scroll {
  padding-top: var(--hud-float-pad-top);
}
.admin-panel-nav {
  display: inline-flex;
  align-items: center;
  gap: 0;
  padding: 0 10px;
  --term-tick-len: 12px;
  position: relative;
  background: var(--term-bg);
  border: 1px solid var(--term-bdr);
  border-radius: var(--radius-md);
  box-shadow: var(--term-glow);
  white-space: nowrap;
  font-family: var(--mono);
  flex-shrink: 1;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.admin-panel-nav::-webkit-scrollbar { display: none; }
.admin-panel-nav::before {
  content: '›';
  color: var(--term-prompt);
  font-size: 0.85rem;
  margin-right: 4px;
  font-family: var(--mono);
  flex-shrink: 0;
}
.admin-panel-nav::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: var(--term-ticks);
}
.admin-nav-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  background: transparent;
  padding: 7px 14px;
  font-size: 0.8rem;
  font-family: var(--mono);
  font-weight: normal;
  --nav-icon: var(--term-tx2);
  color: var(--nav-icon);
  text-decoration: none;
  white-space: nowrap;
  transition: color .12s;
  position: relative;
  letter-spacing: 0.03em;
  cursor: pointer;
}
/* Command brackets — the platform's shared "this is a command" mark. Owned
   here; worn by console nav tabs and by every labeled button. They take
   `currentColor`, so each button's brackets carry its own --btn-hue: that
   single repeated mark in different colors is what ties the set together.
   Icon-only row actions (.admin-action-btn) opt out — brackets round nothing. */
.admin-nav-tab::before,
.btn:not(.admin-action-btn)::before { content: '<'; color: transparent; font-family: var(--mono); }
.admin-nav-tab::after,
.btn:not(.admin-action-btn)::after  { content: '/>'; color: transparent; font-family: var(--mono); }
/* Buttons hold the brackets' space always and only paint them on hover/focus,
   so the mark stays a hover reward and the label never shifts. */
.btn:not(.admin-action-btn):hover::before,
.btn:not(.admin-action-btn):hover::after,
.btn:not(.admin-action-btn):focus-visible::before,
.btn:not(.admin-action-btn):focus-visible::after { color: currentColor; }
/* Tabs lay the brackets out from the start and only change their color, so
   lighting up on hover/active never shifts the label. */
.admin-nav-tab::before,
.admin-nav-tab::after { color: transparent; }
.admin-nav-tab:hover { color: var(--nav-icon); }
.admin-nav-tab:hover::before,
.admin-nav-tab--active::before,
.admin-nav-tab.is-active::before { color: var(--nav-icon); }
.admin-nav-tab:hover::after,
.admin-nav-tab--active::after,
.admin-nav-tab.is-active::after  { color: var(--nav-icon); }
.admin-nav-tab--active,
.admin-nav-tab.is-active { color: var(--nav-icon); font-weight: 600; }
/* Identity hue on icon + label — same palette as the hub module name. */
.admin-nav-tab--motool { --nav-icon: var(--app-hue-motool); }
.admin-nav-tab--dqmodel { --nav-icon: var(--app-hue-dqmodel); }
.admin-nav-tab--maps { --nav-icon: var(--app-hue-maps); }
.admin-nav-tab--market_reports { --nav-icon: var(--app-hue-market_reports); }
.admin-nav-tab--materials { --nav-icon: var(--app-hue-materials); }
.admin-nav-tab--catalog { --nav-icon: var(--app-hue-catalog); }
.admin-nav-tab--rfq_search { --nav-icon: var(--app-hue-rfq_search); }
.admin-nav-tab--admin { --nav-icon: var(--app-hue-admin); }
.admin-nav-tab--help { --nav-icon: var(--app-hue-help); }
.admin-nav-tab-icon {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
  color: var(--nav-icon);
}
.admin-scroll {
  flex:1;
  min-height:0;
  overflow-y:auto;
  overscroll-behavior-y:contain;
  padding:var(--admin-page-margin) var(--page-wrap-pad-x);
}
.admin-scroll--admin-page {
  padding:var(--admin-page-margin) var(--page-wrap-pad-x);
}
/* Full-page admin CRUD without #admin-ui wrapper (e.g. component edit). */
.admin-page-root {
  flex:1;
  min-height:0;
  display:flex;
  flex-direction:column;
  overflow:hidden;
}
.admin-page-root > .admin-scroll {
  flex:1;
  min-height:0;
}
/* SPA fragment: #spa-panel is the only scroll container — no nested admin-scroll. */
#spa-panel {
  overscroll-behavior-y:contain;
}
.admin-page-root--spa,
#spa-panel > .admin-page-root {
  flex:0 0 auto;
  min-height:auto;
  display:block;
  overflow:visible;
}
.admin-page-root--spa > .admin-scroll,
#spa-panel > .admin-scroll,
#spa-panel > .admin-page-root > .admin-scroll {
  flex:none;
  min-height:auto;
  height:auto;
  overflow:visible;
}
.admin-panel {
  width:100%;
  max-width:980px;
  margin:0 auto;
  /* Height follows content — do not stretch to the scroll viewport. */
  background:var(--paper-bg);
  border:1px solid var(--paper-border);
  border-radius:var(--paper-radius);
  overflow-x:clip; /* clip (not hidden) so position:sticky descendants still work */
  box-shadow:var(--paper-shadow);
  padding:var(--admin-panel-pad-y) var(--admin-content-pad-x);
  display:flex;
  flex-direction:column;
  box-sizing:border-box;
}
/* Clip only — no horizontal scrollbar; table must fit via fixed % + wrapping. */
.admin-table-wrap {
  min-width:0;
  max-width:100%;
  overflow-x:hidden;
}
/* Cap tall entity lists inside a page section; keep heading / New outside the wrap.
   Sticky thead relies on existing .perf-table / .admin-table th backgrounds. */
.admin-table-wrap--scroll {
  max-height:min(420px, 50vh);
  overflow-y:auto;
  overscroll-behavior-y:contain;
}
.admin-table-wrap--scroll .admin-table thead th {
  position:sticky;
  top:0;
  z-index:1;
}
/* min-width:0 lets flex children shrink inside the max-width-capped card.
   Without it their default min-width:auto = content min-content, so a
   white-space:nowrap table spills outside the paper on the right. */
.admin-panel > * { align-self:stretch; min-width:0; }
.admin-panel > .btn { align-self:flex-start; }
.admin-panel.admin-panel--motor-wide {
  max-width: min(1480px, calc(100vw - (2 * var(--page-wrap-pad-x))));
}
.admin-table,
.admin-table.perf-table {
  width:100%;
  max-width:100%;
  table-layout:fixed;
}
.admin-table thead tr {
  height:var(--admin-table-head-row-h);
}
.admin-table tbody tr {
  height:var(--admin-table-row-h);
}
.admin-table--flush { margin-bottom:0; }
.admin-table th,
.admin-table td,
.admin-table.perf-table th,
.admin-table.perf-table td {
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
/* Admin entity tables (products, components, inverter, projects, users) list
   names/labels — left-align for scannability and to keep all admin pages uniform.
   The materials data tables (.mat-materials-table / .mat-props-table / .property-table)
   and read-only wire detail table are excluded:
   they intentionally center/right-align their value columns. */
.admin-table.perf-table:not(.mat-materials-table):not(.mat-props-table):not(.property-table):not(.wire-detail-table) thead th,
.admin-table.perf-table:not(.mat-materials-table):not(.mat-props-table):not(.property-table):not(.wire-detail-table) tbody td {
  text-align:left;
}
.admin-table.perf-table:not(.mat-materials-table):not(.mat-props-table):not(.property-table):not(.wire-detail-table) :is(th, td).admin-actions {
  text-align:right;
}
/* Shared actions column — all admin list tables (hub + materials catalog/index).
   Use a fixed px width in fixed-layout tables; min-width alone is ignored there.
   Do NOT set overflow:visible here — with border-collapse it drops the shared
   header/row rules in the Actions column (Chrome/Edge). Icon buttons fit the
   90px cell; hover-reveal uses opacity on children, not overflow. */
.admin-table.perf-table:not(.mat-props-table):not(.tbl-excel) :is(th, td).admin-actions {
  width:90px;
  min-width:90px;
  max-width:90px;
  padding-left:6px;
  padding-right:6px;
  vertical-align:middle;
  white-space:nowrap;
  text-align:right;
}
/* Wide icon toolbars (projects) need more than 90px; the exact share is set
   with the rest of that table's columns further down. */
.admin-table.projects-table :is(th, td).admin-actions {
  max-width:none;
  min-width:90px;
}
.admin-panel progress { accent-color:var(--acc); }
/* A few chips in a list cell (Admin -> Nodes "Can run"): they wrap instead of widening the table. */
.admin-chip-row { display:flex; flex-wrap:wrap; gap:4px; }
.admin-table td.admin-actions .admin-actions-row {
  display:flex;
  width:100%;
  justify-content:flex-end;
  gap:4px;
  flex-wrap:nowrap;
}
.admin-table th:nth-child(1),
.admin-table td:nth-child(1),
.admin-table.perf-table th:nth-child(1),
.admin-table.perf-table td:nth-child(1) { width:20%; }
.admin-table th:nth-child(2),
.admin-table td:nth-child(2),
.admin-table.perf-table th:nth-child(2),
.admin-table.perf-table td:nth-child(2) { width:24%; }
.admin-table th:nth-child(3),
.admin-table td:nth-child(3),
.admin-table.perf-table th:nth-child(3),
.admin-table.perf-table td:nth-child(3) { width:46%; }
.admin-table td.admin-actions {
  white-space:nowrap;
  text-overflow:clip;
}
/* Comfortable entity-list rhythm. Numeric/property/editable tables deliberately
   omit this modifier and retain the denser monospace result-table treatment. */
.admin-table.admin-table--list tbody tr { height:var(--admin-list-row-h); }
.admin-table.admin-table--list.perf-table thead th:not(.admin-actions),
.admin-table.admin-table--list.perf-table tbody td:not(.admin-actions) {
  padding:var(--admin-list-pad-y) var(--admin-list-pad-x);
}
.admin-table.admin-table--list.perf-table tbody td {
  font-family:var(--sans);
  font-size:var(--font-small);
  font-weight:500;
}
/* Content-sized admin table (opt-in). The default .admin-table is table-layout:fixed
   with hard-coded 20/24/46% widths on the first three columns (tuned for the standard
   3-column entity list) and ellipsis truncation. Any table that is NOT that shape —
   different column count, numeric counters, dates, short codes — squishes/truncates
   under those rules. Add .admin-table--auto and columns size to their text instead,
   with no truncation. Reserve the fixed default for tables with a long free-text
   column that SHOULD ellipsis (e.g. a Description). The 90px Actions column, header
   row heights, and left-alignment are unaffected. */
.admin-table.admin-table--auto,
.admin-table.admin-table--auto.perf-table { table-layout:auto; }
.admin-table.perf-table.admin-table--auto th,
.admin-table.perf-table.admin-table--auto td {
  width:auto;
  overflow:visible;
  text-overflow:clip;
}
/* The one column of a content-sized table that takes the slack (a run's job name): width:100% takes what the
   other columns leave, max-width:0 lets it be squeezed so its `.ov-tip-text` truncates with an ellipsis instead
   of widening the table past its wrap and cutting off the Actions column. As `.files-col-name` on Files. */
.admin-table.perf-table.admin-table--auto :is(th, td).admin-col-fill { width:100%; max-width:0; }
/* A content-sized table's Actions column fits its icons (width:1% + nowrap = shrink to content), at least the
   shared 90px: a row with four icons no longer spills over the column before it (Admin -> Nodes programs). */
.admin-table.perf-table.admin-table--auto:not(.mat-props-table):not(.tbl-excel) :is(th, td).admin-actions {
  width:1%;
  max-width:none;
}

/* Form choice matrix: one mutually exclusive value per named row. */
.choice-matrix {
  width:100%;
  border-collapse:collapse;
  table-layout:fixed;
  background:var(--sur);
  color:var(--tx);
  font-size:var(--font-small);
}
.choice-matrix :is(th, td) {
  padding:7px 10px;
  border-bottom:1px solid var(--bdr2);
}
.choice-matrix thead th {
  color:var(--tx2);
  font-size:var(--font-tiny);
  font-weight:700;
  letter-spacing:.04em;
  text-transform:uppercase;
  background:var(--table-head-bg);
}
.choice-matrix :is(th, td):first-child {
  width:52%;
  text-align:left;
}
.choice-matrix :is(th, td):not(:first-child) { text-align:center; }
.choice-matrix tbody th { font-weight:600; }
.choice-matrix tbody tr:last-child > * { border-bottom:none; }
.choice-matrix td { padding:0; }
.choice-matrix-option {
  display:grid;
  min-height:34px;
  place-items:center;
  cursor:pointer;
}
.choice-matrix-option input[type="radio"] {
  width:var(--font-small);
  height:var(--font-small);
  margin:0;
  accent-color:var(--acc);
  cursor:pointer;
}
.choice-matrix tbody tr:hover > * {
  background:color-mix(in srgb, var(--table-row-hover-bg) 72%, var(--sur));
}

/* Products tables: fixed layout, 5-6 cols (Name / Type / Family /
   optional Matches / Description / Actions). Name keeps a useful reading
   width; compact metadata columns get a reserved width; the final data column
   before Actions absorbs the remainder. Name and Description ellipsis.

   Fixed, not auto, and that is the whole point. Every cell here is nowrap, so
   under auto layout the table could never be narrower than its longest name
   plus its longest description — 956px against an 866px card once a product
   was called "Motor A + Cable + Brushes + Chokes". `.admin-table-wrap` is
   `overflow-x:hidden` (no scrollbar, by contract), so the 90px that did not
   fit was the Actions column: Edit, Duplicate and Delete were clipped off the
   right edge and unreachable on every product. Declared shares cannot
   overflow — the same reason `.projects-table` below is fixed.

   Content is ignored under fixed layout, so the compact columns carry a real
   reserved width; `width:1%` would collapse them (see np-evidence-table). */
.admin-table.admin-table--products.perf-table {
  table-layout:fixed;
  width:100%;
  min-width:0;
  margin:0 0 10px;
}
.admin-table--products th,
.admin-table--products td {
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
/* Use 3-class selectors to beat generic .admin-table.perf-table th:nth-child (0,3,0). */
/* Name and Description split the row. Description takes whatever is left, so on
   a wide card it ran to ~700px of mostly empty space while Name ellipsised the
   longest compound names at 23%. 34% fits every current name whole; Description
   still holds a full sentence, and both keep the .ov-tip hover text either way. */
.admin-table.admin-table--products th:nth-child(1),
.admin-table.admin-table--products td:nth-child(1) { width:34%; }
/* Type: the badge is tiny, but the column has to hold the DC/PMSM checkboxes
   that `th_filter_choice` swaps in when the filter is opened — the cell clips,
   so a narrower column would cut "PMSM" in half the moment you click it. */
.admin-table.admin-table--products th:nth-child(2),
.admin-table.admin-table--products td:nth-child(2) { width:8.5rem; white-space:nowrap; }
.admin-table.admin-table--products th:nth-child(3),
.admin-table.admin-table--products td:nth-child(3) { width:6rem; }
/* Matches, in the 6-column RFQ shape; the same column as Family when there are 5. */
.admin-table.admin-table--products th:nth-last-child(3),
.admin-table.admin-table--products td:nth-last-child(3) { width:6rem; }
/* Center the Type badge. The generic left-align rule carries four :not()
   guards, each of which counts as a class, so tbody + .perf-table alone lost
   to it and this column sat left for as long as the rule existed. Repeat the
   guards, the way .projects-table and .admin-table--comp-motors do. */
.admin-table.admin-table--products.perf-table:not(.mat-materials-table):not(.mat-props-table):not(.property-table):not(.wire-detail-table) tbody td:nth-child(2) { text-align:center; }
.admin-table.admin-table--products th:nth-last-child(2),
.admin-table.admin-table--products td:nth-last-child(2) { width:auto; }
/* Type + DC/PMSM filters stay on one row (column is shrink-to-fit). */
.admin-table--products th:nth-child(2) .inline-flex {
  flex-wrap:nowrap;
  white-space:nowrap;
}
/* Name and Description stay on ONE line and ellipsis; the full text is the
   hover tooltip either way. They used to wrap, which turned a long product
   name into a five-line cell and made the list unreadable — a table of short
   rows is what this page is for, and nothing is lost because `.ov-tip` already
   carries the untruncated value. */
.admin-table.admin-table--products td:nth-child(1) .ov-tip-text,
.admin-table.admin-table--products td:nth-last-child(2) .ov-tip-text {
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
/* Tooltip cells host an overflow-visible wrapper so the styled tooltip is not
   clipped by the cell's own overflow:hidden; truncation lives on .ov-tip-text. */
.admin-table.admin-table--products td.ov-cell { overflow:visible; }
/* Products carry a fourth row action (Edit, History, Duplicate, Delete). Four
   22px buttons with three 4px gaps need 100px of content, and the shared
   `.admin-actions` column reserves 90px with 6px of padding each side — 78px.
   `.admin-actions-row` is nowrap and right-aligned, so the 22px that did not
   fit hung off the LEFT edge into the cell's own overflow:hidden: Edit was
   invisible and unclickable on every product row. Repeat the two :not() guards
   the shared rule carries, or it wins on specificity and nothing changes. */
.admin-table.admin-table--products.perf-table:not(.mat-props-table):not(.tbl-excel) :is(th, td).admin-actions {
  width:112px;
  min-width:112px;
  max-width:112px;
}

/* Component tables: fixed layout.
   Motors: 5 cols — Label / Type / Family / Nameplate / Actions
   Others: 3 cols — Label / Summary / Actions
   The generated id is hover text on Label, not a column. Label (col 1)
   absorbs the remainder; all others fit explicit widths. */
.admin-table.admin-table--comp.perf-table {
  table-layout:fixed;
  width:100%;
  min-width:0;
}
.admin-table--comp th,
.admin-table--comp td {
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.admin-table.admin-table--comp th:nth-child(1),
.admin-table.admin-table--comp td:nth-child(1) { width:auto; overflow:hidden; text-overflow:ellipsis; }
.admin-table.admin-table--comp th:nth-child(2):not(.admin-actions),
.admin-table.admin-table--comp td:nth-child(2):not(.admin-actions) { width:13%; }
.admin-table.admin-table--comp th:nth-child(3):not(.admin-actions),
.admin-table.admin-table--comp td:nth-child(3):not(.admin-actions) { width:18%; }
/* Motors is the one 4-column comp table (Label / Type / Family / Actions).
   Label at 44% parked short motor names against a wide empty strip, so it drops
   to a reading width; Type follows immediately on the left, and Family sits
   centred in what is left. The row reads name -> badge -> family with the
   whitespace shared between the three instead of pooled after Label. */
.admin-table.admin-table--comp-motors.perf-table th:nth-child(1),
.admin-table.admin-table--comp-motors.perf-table td:nth-child(1) { width:34%; }
.admin-table.admin-table--comp-motors.perf-table th:nth-child(2):not(.admin-actions),
.admin-table.admin-table--comp-motors.perf-table td:nth-child(2):not(.admin-actions) { width:12%; text-align:left; }
.admin-table.admin-table--comp-motors.perf-table thead th:nth-child(3),
.admin-table.admin-table--comp-motors.perf-table tbody td:nth-child(3) { width:auto; }
/* Family is centred in the width it is given. The four :not() guards are not
   decoration: the shared left-align at the top of this file carries them, so a
   plain `.admin-table--comp-motors td:nth-child(3)` loses the cascade to it and
   the column silently stays left. Same shape as .projects-table above.
   Measured in Chromium: without the guards the cell computes `left`. */
.admin-table.admin-table--comp-motors.perf-table:not(.mat-materials-table):not(.mat-props-table):not(.property-table):not(.wire-detail-table) :is(thead th, tbody td):nth-child(3) {
  text-align:center;
}
/* The heading is a flex row (label + filter icon), so text-align does not move
   it — it has to be centred the same way its cells are. */
.admin-table.admin-table--comp-motors.perf-table thead th:nth-child(3) .mat-th-filter { justify-content:center; }

/* Families table: same component shape, but col2 (Type) needs more room for
   the dc_motor/pmsm_motor badge text and col3 (Members) is a short centered
   count rather than free text. */
.admin-table.admin-table--comp-families.perf-table th:nth-child(2):not(.admin-actions),
.admin-table.admin-table--comp-families.perf-table td:nth-child(2):not(.admin-actions) { width:20%; }
.admin-table.admin-table--comp-families.perf-table th:nth-child(3):not(.admin-actions),
.admin-table.admin-table--comp-families.perf-table td:nth-child(3):not(.admin-actions) { width:12%; }
/* Members is a count and belongs centred, and it needs the same four guards as
   above or the shared left-align wins. Addressed as "the column before
   Actions" because the macro renders two shapes: Label / Type / Members /
   Actions for component families, Label / Members / Actions for product
   families -- Members is nth-child(3) in one and nth-child(2) in the other. */
.admin-table.admin-table--comp-families.perf-table:not(.mat-materials-table):not(.mat-props-table):not(.property-table):not(.wire-detail-table) :is(thead th, tbody td):nth-last-child(2) { text-align:center; }

.admin-table th.admin-actions {
  white-space:nowrap;
}
.admin-abbrev-table.perf-table {
  width:100%;
  table-layout:fixed;
  margin:0 0 14px;
}
.admin-abbrev-table.perf-table thead th,
.admin-abbrev-table.perf-table tbody td {
  text-align:left;
}
.admin-abbrev-table th:nth-child(1),
.admin-abbrev-table td:nth-child(1) { width:34%; }
.admin-abbrev-table th:nth-child(2),
.admin-abbrev-table td:nth-child(2) { width:52%; }
.admin-abbrev-table th:nth-child(3),
.admin-abbrev-table td:nth-child(3) { width:14%; }
.admin-abbrev-table tbody td {
  white-space:normal;
  overflow:visible;
  text-overflow:clip;
}
.admin-abbrev-table tbody td:nth-child(2) {
  font-family:var(--sans);
  font-weight:600;
}
.admin-action-btn {
  display:inline-flex;
  align-items:center;
  gap:4px;
  width:22px;
  height:22px;
  padding:0;
  font-size:var(--font-tiny);
  line-height:1;
  border-radius:3px;
  justify-content:center;
}
.admin-action-btn-spacer {
  display:inline-block;
  width:22px;
  height:22px;
  flex-shrink:0;
}
.admin-action-btn svg {
  width:var(--icon-action);
  height:var(--icon-action);
  flex-shrink:0;
  opacity:.8;
}
.proj-runs-btn svg   { color:#f97316; opacity:1; }
.proj-share-btn svg  { color:#eab308; opacity:1; }
.proj-dup-btn svg    { color:#3b82f6; opacity:1; }
/* Play/open triangle: fill (not stroke) so the icon reads as a solid green ▶ */
.admin-play-btn svg,
.proj-open-btn svg { opacity:1; fill:#16a34a; stroke:none; }
.admin-actions-row {
  display:inline-flex;
  align-items:center;
  justify-content:flex-end;
  gap:4px;
  flex-wrap:nowrap;
}
.admin-actions form {
  display:inline-flex;
  margin:0;
}
/* Machine values (sizes, hashes, numbers) in the mono face, wherever they sit. `:is()` takes the weight of its
   heaviest selector, so a bare `.admin-mono` beats the list-table cell rule that sets the sans family. */
:is(.admin-mono, .admin-table.admin-table--list.perf-table tbody td.admin-mono) { font-family:var(--mono); }
.admin-table-link {
  color:var(--acc);
  font-weight:700;
  text-decoration:none;
  cursor:pointer;
}
.admin-table-link:hover,
.admin-table-link:focus-visible {
  text-decoration:none;
}

/* Admin table row links (not action buttons): accent ink, hand cursor, no underline.
   UA visited purple/blue is unreadable on the dark page — always --acc. */
.admin-table tbody td a:not(.btn):not(.admin-action-btn) {
  color: var(--acc);
  cursor: pointer;
  text-decoration: none;
}
.admin-table tbody td a:not(.btn):not(.admin-action-btn):hover,
.admin-table tbody td a:not(.btn):not(.admin-action-btn):focus-visible {
  text-decoration:none;
}

/*
 * Row-hover action reveal (shared across all admin tables).
 * Cell keeps its reserved width (td.admin-actions sets width/min-width), so only
 * the contents fade — no column shift. opacity (not display:none) keeps buttons
 * keyboard-focusable, so :focus-within reveals them for tab navigation.
 * Touch devices have no hover → always show.
 * Opacity applies to cell children only — not the <td> itself — so border-collapse
 * row/header rules stay visible in the Actions column.
 */
.admin-table tbody tr td.admin-actions > * {
  opacity:0;
  transition:opacity .12s ease;
}
.admin-table tbody tr:hover td.admin-actions > *,
.admin-table tbody tr:focus-within td.admin-actions > * {
  opacity:1;
}
@media (hover:none) {
  .admin-table tbody tr td.admin-actions > * { opacity:1; }
}
/* `tables.action_cell(next_step=true)`: a row that waits for the admin shows its next action (`data-next-step`)
   without hover; the row's other actions still fade in on hover. */
.admin-table tbody tr td.admin-actions.admin-actions--next > * { opacity:1; }
@media (hover:hover) {
  .admin-table tbody tr:not(:hover):not(:focus-within) td.admin-actions--next .admin-actions-row > :not([data-next-step]) {
    opacity:0;
  }
}

/*
 * Projects tables (5 cols): robust “fluid name + shrink-wrap actions” pattern.
 * — table-layout: auto so intrinsic widths work.
 * — Name col: no fixed %; max-width + ellipsis (full title on td[title]).
 * — Actions col: width:1% + white-space:nowrap is the classic shrink-to-fit trick;
 *   inner .admin-actions-row { width: max-content } sizes to the icon toolbar.
 * — Middle cols: max-width so they don’t steal space from the name.
 */
/* Six columns over one card. Auto layout sized each one to its own content and
   handed every spare pixel to Name, which left a hand's width of empty paper
   after the titles while Source and App still cut themselves off -- and, when
   the total came out wider than the card, pushed the Actions buttons past the
   wrap's clipped right edge where they could not be reached at all.
   Fixed layout with declared shares cannot overflow: the slack is spread over
   every column instead of pooling in one, and anything too long ellipses (the
   full text is already the cell's hover title). Shares are written by position,
   like every other list in this file, and add up to 100. */
.admin-table.projects-table.perf-table {
  table-layout:fixed;
  width:100%;
}
.admin-table.projects-table :is(th, td):nth-child(1) { width:34%; }  /* Name */
.admin-table.projects-table :is(th, td):nth-child(2) { width:11%; }  /* Source */
.admin-table.projects-table :is(th, td):nth-child(3) { width:8%; }   /* App */
.admin-table.projects-table :is(th, td):nth-child(4) { width:12%; }  /* App version */
.admin-table.projects-table :is(th, td):nth-child(5) { width:14%; }  /* Saved */
.admin-table.projects-table :is(th, td).admin-actions { width:21%; }

/* The App cell is a picture, with no text baseline to line up on, so it sits in
   the middle of its column -- header included. The :not() chain is the one from
   the shared left-align rule above: this has to outrank it, and copying its
   shape is honest about why. */
.admin-table.perf-table.projects-table:not(.mat-materials-table):not(.mat-props-table):not(.property-table):not(.wire-detail-table) thead th:nth-child(3),
.admin-table.perf-table.projects-table:not(.mat-materials-table):not(.mat-props-table):not(.property-table):not(.wire-detail-table) tbody td:nth-child(3) {
  text-align:center;
}


.admin-table.users-table.perf-table {
  table-layout:fixed;
  width:100%;
}
.admin-table.users-table th:nth-child(1),
.admin-table.users-table td:nth-child(1) {
  width:24%;
  white-space:nowrap;
  overflow:visible;
  text-overflow:clip;
}
.admin-table.users-table th:nth-child(2),
.admin-table.users-table td:nth-child(2) {
  width:29%;
}
.admin-table.users-table th:nth-child(3),
.admin-table.users-table td:nth-child(3) {
  width:auto;
}
.admin-table.users-table th:nth-child(4),
.admin-table.users-table td:nth-child(4) {
  width:12%;
  white-space:nowrap;
}
.admin-table.users-table.perf-table:not(.mat-props-table):not(.tbl-excel) :is(th, td).admin-actions {
  width:112px;
  min-width:112px;
  max-width:112px;
  padding-left:18px;
}

/* ── inverter / electronics tables ── */
.admin-table.inverter-table {
  table-layout:auto;
  width:100%;
}
.admin-table.inverter-table th:nth-child(1),
.admin-table.inverter-table td:nth-child(1),
.admin-table.inverter-table th:nth-child(2),
.admin-table.inverter-table td:nth-child(2),
.admin-table.inverter-table th:nth-child(3),
.admin-table.inverter-table td:nth-child(3) { width:auto; }

/* ── /projects page ── */
.projects-page .panel-heading {
  display:flex;
  align-items:baseline;
  flex-wrap:wrap;
  gap:8px 12px;
}
.projects-user-label { margin-left:8px; }
.projects-table--spaced { margin-bottom:10px; }
.admin-head-filter {
  display:flex;
  align-items:center;
  gap:8px;
  white-space:nowrap;
}
.admin-head-tools-row th {
  padding-top:4px;
  padding-bottom:4px;
  border-top:0;
}
.perf-table .admin-head-tools-row th {
  background:var(--sur);
  border-bottom:1px solid var(--bdr2);
}
.admin-head-name-tools {
  display:flex;
  align-items:center;
  gap:6px;
}
.admin-head-search-wrap {
  display:inline-flex;
  align-items:center;
  gap:5px;
  height:22px;
  padding:0 6px;
  border:1px solid var(--bdr2);
  border-radius:6px;
  background:var(--sur);
  color:var(--tx3);
}
.admin-head-search-wrap:focus-within {
  border-color:var(--bdr);
  box-shadow:none;
  color:var(--tx2);
}
.admin-head-name-search:not(.mat-th-input) {
  width:142px;
  min-width:0;
  height:18px;
  padding:0;
  border:0;
  border-radius:0;
  background:transparent;
  color:var(--tx);
  font-size:var(--font-ui-xs);
  font-family:var(--sans);
}
.admin-head-name-search:focus {
  outline:none;
}
.admin-head-name-sort {
  display:inline-flex;
  align-items:center;
  height:16px;
  width:16px;
  justify-content:center;
  padding:0;
  border:0;
  border-radius:0;
  background:transparent;
  color:var(--tx2);
  cursor:pointer;
}
.admin-head-name-sort i {
  width:12px;
  height:12px;
}
.admin-head-name-sort:hover {
  color:var(--tx);
}
.admin-head-filter-opt {
  display:inline-flex;
  align-items:center;
  gap:4px;
  font-size:var(--font-tiny);
  font-weight:500;
  color:var(--tx2);
  text-transform:none;
  letter-spacing:0;
}
.admin-head-filter-opt input[type="checkbox"] {
  margin:0;
  accent-color:var(--acc);
}
.projects-baseline-warning { color:var(--amb); margin-left:4px; }
.projects-modal-content { padding:16px; }
.projects-share-public-toggle {
  margin-bottom:14px;
  display:flex;
  align-items:center;
  gap:6px;
}
.projects-share-user-label,
.projects-share-label {
  display:block;
  margin-bottom:6px;
  font-size:var(--font-ui-xs);
  font-weight:700;
  text-transform:uppercase;
  letter-spacing:.04em;
  color:var(--tx2);
}
.projects-share-picker-wrap {
  margin-top:14px;
}
.projects-share-empty {
  display:none;
  font-size:var(--font-ui-xs);
  color:var(--tx3);
  margin-top:5px;
}
.projects-delete-copy {
  font-size:var(--font-small);
  color:var(--tx2);
  margin:0;
}
.projects-schema-modal-content {
  font-family:var(--sans);
  font-size:var(--font-small);
  color:var(--tx2);
}
.projects-schema-warning-card {
  margin:0 0 10px;
  padding:10px 11px;
  border:1px solid var(--warn-bdr);
  background:var(--warn-bg);
  border-radius:8px;
}
.projects-schema-warning-card .projects-delete-copy {
  color:var(--warn-fg);
}
.projects-schema-option {
  align-items:flex-start;
  line-height:1.35;
  margin:10px 0 0;
}
.projects-schema-option > span {
  font-family:var(--sans);
}
.projects-schema-modal-content .projects-delete-copy + .projects-delete-copy {
  margin-top:8px;
}
.projects-schema-modal-content .projects-delete-copy:last-of-type {
  margin-bottom:10px;
}
.projects-page .panel-heading-count {
  font-size:var(--font-ui-xs);
  font-weight:600;
  color:var(--tx3);
  letter-spacing:0.02em;
}
.projects-empty {
  text-align:center;
  padding:28px 16px;
  color:var(--tx2);
  font-size:var(--font-small);
  line-height:1.5;
  border:1px dashed var(--bdr2);
  border-radius:8px;
  background:var(--bg);
  margin-bottom:12px;
}
.projects-empty .projects-empty-actions {
  margin-top:14px;
  display:flex;
  justify-content:center;
  gap:8px;
  flex-wrap:wrap;
}
.admin-table.projects-table td.projects-empty-cell {
  padding:12px 8px;
  vertical-align:middle;
}
.projects-toolbar {
  display:flex;
  flex-direction:column;
  align-items:flex-start;
  gap:10px;
}
/* Same footer rhythm as every other panel: `.admin-form-actions` puts the
   panel's own vertical padding between the last content and the buttons, and
   12px here read as the Close button leaning on the table. The list's own
   10px bottom margin is dropped so the gap is exactly the shared one.
   Scoped to the table, not to a host: the same list is a card on My work. */
.admin-table.projects-table.projects-table--spaced { margin-bottom:0; }
.projects-toolbar--below {
  margin:0;
  padding-top:var(--admin-panel-pad-y);
}
/* No bottom rule on last row (perf-table adds border-bottom on every td) */
.admin-table.projects-table tbody tr:last-child td {
  border-bottom:none;
}
/* Inline project rename — same tokens as UI inputs, full cell width */
.proj-rename-input {
  box-sizing:border-box;
  width:100%;
  max-width:100%;
  min-width:0;
  margin:0;
  font:inherit;
  font-weight:600;
  padding:3px 6px;
  border:1px solid var(--acc);
  border-radius:4px;
  background:var(--sur);
  color:var(--tx);
  outline:none;
}
.proj-rename-input:focus {
  border-color:var(--acc);
  box-shadow:0 0 0 1px var(--acc2);
}
html[data-theme="dark"] .proj-rename-input {
  background:var(--sur);
  color:var(--tx);
}
.admin-actions .btn-danger:not(.admin-action-btn):hover:not(:disabled) {
  background:#fef2f2;
  border-color:var(--red);
}
.icon-btn {
  width:28px;
  height:28px;
  padding:0;
  display:inline-flex;
  align-items:center;
  justify-content:center;
}
.icon-btn svg {
  width:15px;
  height:15px;
}

/* ── SPA panel ── */
#spa-panel {
  flex:1;
  min-height:0;
  overflow:auto;
  display:flex;
  flex-direction:column;
}
#spa-panel[hidden] { display:none; }
/* Shell may tabindex=-1 + focus the panel; don't draw a box around the page. */
#spa-panel:focus { outline:none; }
#spa-back-btn[hidden] { display:none; }

.spa-loading {
  flex:1;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  font-size:13px;
  color:var(--tx3);
}
.spa-error {
  flex:1;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:12px;
  padding:24px;
  text-align:center;
}
.spa-error-msg {
  margin:0;
  font-size:13px;
  color:var(--tx2);
  max-width:28rem;
}
.spa-error-actions {
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  justify-content:center;
}


/* App roots: fill viewport below topbar (flex item of .app-frame) */
#motool-ui, #dqmodel-ui, #maps-ui, #admin-ui, #marketReportsAppUi {
  flex:1;
  min-height:0;
  display:flex;
  flex-direction:column;
}
#motool-ui[hidden], #dqmodel-ui[hidden], #maps-ui[hidden], #admin-ui[hidden], #marketReportsAppUi[hidden] { display:none; }

/* ── Body: 3 columns ── */
.app-body {
  display:flex;
  flex:1;
  overflow:hidden;
  min-height:0;
}

/* drag handle between columns */
.col-resizer {
  width:1px;
  flex-shrink:0;
  background:transparent;
  cursor:col-resize;
  position:relative;
  z-index:10;
  transition:background .2s;
}
.col-resizer:hover { background:var(--bdr2); }
.col-resizer::before {
  content:"";
  position:absolute;
  top:0;
  bottom:0;
  left:-4px;
  right:-4px;
}
.col-resizer::after {
  content:"";
  position:absolute;
  top:0;
  bottom:0;
  left:50%;
  width:1px;
  transform:translateX(-50%);
  background:var(--tx3);
  opacity:0;
}
.col-resizer:hover::after, .col-resizer.dragging::after { opacity:.34; }

/* ── Column shell ── */
.col {
  display:flex;
  flex-direction:column;
  background:var(--sur);
  border-right:1px solid var(--bdr);
  overflow:hidden;
  transition:none;
  flex-shrink:0;
  min-height:0;
  align-self:stretch;
}
.col-head {
  display:flex;
  align-items:center;
  justify-content:space-between;
  height:30px;
  padding:0 10px;
  border-bottom:1px solid var(--bdr);
  background:color-mix(in srgb, var(--acc) 8%, var(--sur));
  flex-shrink:0;
}
.col-head-title {
  font-size:var(--font-ui-xs);
  font-weight:700;
  text-transform:uppercase;
  letter-spacing:.08em;
  color:color-mix(in srgb, var(--acc) 70%, var(--tx));
}
/* Collapsed state — col fully hidden */
.col.is-collapsed {
  width:0 !important;
  min-width:0 !important;
  overflow:hidden;
}
.col.is-collapsed .col-body,
.col.is-collapsed .col-footer { display:none; }

/* Resizer toggle — always-readable rail chip (not hover-only) */
.resizer-toggle {
  position:absolute;
  top:50%;
  left:50%;
  transform:translate(-50%, -50%);
  display:flex;
  align-items:center;
  justify-content:center;
  width:16px;
  height:32px;
  background:var(--sur);
  border:1px solid var(--bdr);
  border-radius:999px;
  color:var(--tx2);
  cursor:pointer;
  padding:0;
  z-index:20;
  box-shadow:0 1px 2px rgba(28,25,23,.08);
  transition:color .12s, background .12s, box-shadow .12s, border-color .12s;
}
.resizer-toggle:hover {
  color:var(--tx);
  background:var(--sur);
  border-color:var(--tx3);
  box-shadow:0 2px 7px rgba(28,25,23,.14);
}
/* icon switching via sibling combinator — no JS needed */
.rt-icon-open  { display:none; }
.rt-icon-close { display:flex; }
.col-variants.is-collapsed ~ .col-resizer .rt-icon-close { display:none; }
.col-variants.is-collapsed ~ .col-resizer .rt-icon-open  { display:flex; }
html[data-theme="dark"] .resizer-toggle {
  background:color-mix(in srgb, var(--sur) 80%, var(--bg));
  box-shadow:0 1px 5px rgba(0,0,0,.28);
}

/* Col 1 — variants */
.col-variants {
  width:var(--col1);
  background:var(--sidebar-bg);
  border-right-color:var(--bdr);
}
.col-body { flex:1; min-height:0; overflow-y:auto; overflow-x:hidden; }
.col-variants .col-body {
  padding:6px;
  background:var(--sidebar-bg);
}
.variant-sidebar-toolbar {
  display:flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  position:sticky;
  top:0;
  z-index:2;
  padding:8px 8px 4px;
  background:var(--sidebar-bg);
  flex-shrink:0;
}
.variant-sidebar-tool {
  flex:0 0 auto;
}
.variant-sidebar-tool:disabled {
  opacity:.45;
}
.variant-sidebar-tool.topbar-action--primary,
.variant-sidebar-tool.topbar-action--success {
  color:var(--tx3);
  background:transparent;
  border-color:transparent;
}
.variant-sidebar-tool.topbar-action--primary:hover,
.variant-sidebar-tool.topbar-action--success:hover {
  color:var(--acc);
  background:transparent;
  border-color:transparent;
}
.v-empty {
  padding:28px 8px 10px;
  color:var(--tx2);
  font-size:var(--font-ui-sm);
  line-height:1.35;
  text-align:center;
}

/* Shared Add product command palette (Motool / DQModel / Maps). */
.product-add-content {
  display:flex;
  flex-direction:column;
  gap:12px;
  min-height:0;
}
.product-add-search-field {
  flex:0 0 auto;
}
.product-add-results {
  display:flex;
  flex-direction:column;
  gap:3px;
  min-height:96px;
  max-height:min(430px,55vh);
  overflow-y:auto;
  padding:1px;
}
.product-add-results[hidden],
.product-add-option[hidden],
.product-add-no-results[hidden] {
  display:none;
}
.product-add-option {
  display:flex;
  align-items:center;
  gap:12px;
  width:100%;
  min-height:44px;
  padding:8px 10px;
  border:1px solid transparent;
  border-radius:var(--radius-md);
  background:transparent;
  color:var(--tx);
  text-align:left;
}
.product-add-option.is-loading {
  opacity:1;
}
.product-add-option-main {
  display:flex;
  flex:1 1 auto;
  min-width:0;
  flex-direction:column;
  gap:2px;
}
.product-add-option-name {
  font-size:var(--font-ui-sm);
  font-weight:700;
  overflow-wrap:anywhere;
}
.product-add-option-meta {
  color:var(--tx3);
  font:400 var(--font-ui-xs) var(--mono);
  overflow-wrap:anywhere;
}
.product-add-option-action {
  flex:0 0 auto;
  color:var(--acc);
}
.product-add-option.is-added .product-add-option-action { color:var(--grn); }
.product-add-loading-icon,
.product-add-added-icon { display:none; }
.product-add-option.is-added .product-add-idle-icon { display:none; }
.product-add-option.is-added .product-add-added-icon { display:block; }
.product-add-option.is-loading .product-add-idle-icon,
.product-add-option.is-loading .product-add-added-icon { display:none; }
.product-add-option.is-loading .product-add-loading-icon { display:block; }
.product-add-no-results {
  min-height:96px;
  padding:28px 10px;
  color:var(--tx2);
  font-size:var(--font-ui-sm);
  text-align:center;
}
.product-add-status {
  min-height:16px;
  color:var(--tx3);
  font:400 var(--font-ui-xs) var(--mono);
}

/* Variant rows */
.vrow {
  display:flex;
  align-items:center;
  position:relative;
  width:100%;
  min-height:44px;
  margin-bottom:4px;
  padding:7px 7px 7px 10px;
  border:1px solid transparent;
  border-radius:var(--radius-md);
  background:transparent;
  color:var(--tx);
  font:inherit;
  cursor:pointer;
  text-align:left;
  gap:8px;
  /* The Pump Designer's sidebar rows are links (a pump is a URL), so the row has to
     say it carries no underline; a <div> row never needed to. */
  text-decoration:none;
  transition:background .12s ease, border-color .12s ease, box-shadow .12s ease, color .12s ease;
}
.vrow:hover {
  background:color-mix(in srgb, var(--sur) 92%, var(--bg));
}
.vrow.is-sel {
  background:var(--row-selected-bg);
  box-shadow:
    0 1px 2px rgba(28,25,23,.06),
    0 5px 16px rgba(15,23,42,.06);
}
.vrow.is-sel .vrow-name { color:var(--tx); }
.vrow-main {
  flex:1;
  min-width:0;
  display:flex;
  flex-direction:column;
  gap:1px;
  position:relative;
}
.vrow-product {
  display:block;
  font-size:var(--font-tiny);
  font-weight:400;
  color:var(--tx3);
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
html[data-theme="dark"] .vrow-product {
  color:color-mix(in srgb, var(--tx3) 82%, white);
}
.vrow-name {
  display:block;
  font-size:var(--font-small);
  font-weight:700;
  color:var(--tx2);
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  line-height:1.12;
}
.vrow-actions {
  flex-shrink:0;
  display:inline-flex;
  align-items:center;
  justify-content:flex-end;
  width:58px;
  gap:1px;
}
.vrow-up, .vrow-down, .vrow-copy, .vrow-save, .vrow-del { opacity:0; pointer-events:none; }
.vrow:hover .vrow-up,
.vrow:hover .vrow-down,
.vrow:hover .vrow-copy,
.vrow:hover .vrow-save,
.vrow:hover .vrow-del,
.vrow.is-sel .vrow-up,
.vrow.is-sel .vrow-down,
.vrow.is-sel .vrow-copy,
.vrow.is-sel .vrow-save,
.vrow.is-sel .vrow-del { opacity:1; pointer-events:auto; }
.vrow.is-structure-locked .vrow-up,
.vrow.is-structure-locked .vrow-down,
.vrow.is-structure-locked .vrow-copy,
.vrow.is-structure-locked .vrow-save,
.vrow.is-structure-locked .vrow-del {
  opacity:.35;
  pointer-events:none;
}
.vrow-up, .vrow-down, .vrow-copy, .vrow-save, .vrow-del {
  color:var(--tx3);
  cursor:pointer;
  width:17px;
  height:18px;
  padding:2px;
  line-height:1;
  display:inline-flex;
  justify-content:center;
  align-items:center;
  border:1px solid transparent;
  background:transparent;
  border-radius:var(--radius-sm);
  transition:color .12s ease;
}
.vrow-up svg,
.vrow-down svg,
.vrow-copy svg,
.vrow-save svg,
.vrow-del svg {
  transition:transform .12s ease, color .12s ease;
}
.vrow-compare {
  flex-shrink:0;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:14px;
  height:18px;
  cursor:pointer;
}
.vrow-compare input {
  width:12px;
  height:12px;
  margin:0;
  accent-color:var(--tx2);
  cursor:pointer;
  opacity:.55;
}
.vrow.is-sel .vrow-compare input { opacity:1; }
.vrow[style*="--vrow-hue"] .vrow-compare input {
  accent-color:hsl(var(--vrow-hue),55%,55%);
}
.vrow-up:hover, .vrow-down:hover, .vrow-copy:hover, .vrow-save:hover {
  color:var(--acc);
  background:transparent;
  border-color:transparent;
}
.vrow-up:hover svg,
.vrow-down:hover svg,
.vrow-copy:hover svg,
.vrow-save:hover svg {
  transform:scale(1.22);
}
.vrow-del { font-size:var(--font-base); }
.vrow-del:hover {
  color:var(--red);
  background:transparent;
  border-color:transparent;
}
.vrow-del:hover svg {
  transform:scale(1.22);
}
.vrow-rename-input {
  -webkit-appearance:none;
  appearance:none;
  display:block;
  box-sizing:border-box;
  width:auto;
  margin:-2px 10px -2px 0;
  background:var(--sur);
  border:1px solid var(--bdr);
  border-radius:var(--radius-sm);
  color:var(--tx);
  font:700 var(--font-small)/1.12 var(--sans);
  padding:1px 5px;
  outline:none;
}
.vrow-rename-input:focus {
  border-color:var(--acc);
}

/* Col 1 footer */
.col-footer {
  padding:6px 8px;
  display:flex;
  flex-direction:column;
  gap:3px;
  flex-shrink:0;
}
.col-footer-row {
  display:flex;
  gap:3px;
}
.col-footer-row .btn {
  min-width:0;
  flex:1;
}

/* ── Buttons ── */
.btn {
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:4px;
  padding:var(--btn-pad-y) var(--btn-pad-x);
  border-radius:var(--radius-btn);
  /* ONE button. Every variant re-points --btn-hue and nothing else: the tint,
     the border, the label, the brackets and the hover glow are all derived
     from it. That is what makes Save / Cancel / Run / Add read as one family
     in different colors instead of four unrelated controls. Percentages stay
     high enough to hold their color — a 4% wash reads as washed out, not as
     restraint. */
  --btn-hue: var(--tx2);
  border:1px solid color-mix(in srgb, var(--btn-hue) 60%, transparent);
  background:color-mix(in srgb, var(--btn-hue) 12%, transparent);
  text-decoration:none;
  color:var(--btn-hue);
  font:600 var(--btn-font-size) var(--mono);
  cursor:pointer;
  letter-spacing:.02em;
  white-space:nowrap;
  transition:color .08s, border-color .08s, background .08s;
}
.btn:focus { outline:none; }
.btn:focus-visible {
  outline:2px solid var(--acc);
  outline-offset:2px;
}
.btn:hover:not(:disabled) {
  color:var(--btn-hue);
  border-color:var(--btn-hue);
  background:color-mix(in srgb, var(--btn-hue) 20%, transparent);
  box-shadow:0 0 14px color-mix(in srgb, var(--btn-hue) 20%, transparent);
}
.btn:disabled { opacity:.4; cursor:not-allowed; }
.btn svg { width:var(--icon-action); height:var(--icon-action); flex-shrink:0; }
/* The variants — hue only. Never re-declare background/border/color here. */
.btn-primary,
.btn-run { --btn-hue: var(--btn-primary-hue); }
.btn-cancel,
.btn-danger,
.electronics-properties-catalog-btn { --btn-hue: var(--red); }
/* The green command. `#btnAddLp` was doing this as a one-off id rule; both now
   say it once, so a second green button never invents a third spelling. */
.btn-success,
#btnAddLp { --btn-hue: var(--grn); }
.btn-full { width:100%; }
.btn.admin-action-btn { border:none; box-shadow:none; background:transparent; }
.btn.admin-action-btn:hover:not(:disabled),
.btn.admin-action-btn.btn-danger:hover:not(:disabled) {
  border:none;
  background:transparent;
  box-shadow:none;
}
/* Admin -> Nodes: the page-head status, the Add PC fold link. */
.admin-table-wrap--scroll .admin-col-fill { min-width:170px; }
/* `buttons.disabled_icon_btn`: the host carries the tip a disabled button cannot show; it lays out like the button. */
.admin-action-host { display:inline-flex; }
.nodes-status { margin:0 0 6px; }
.inline-fold { margin:2px 0 14px; }
.inline-fold > summary { cursor:pointer; font-size:var(--font-small); color:var(--tx2); text-decoration:underline; list-style:none; width:fit-content; }
.inline-fold > summary::-webkit-details-marker { display:none; }
.inline-fold[open] > summary { margin-bottom:10px; }
.btn.admin-action-btn svg { transition:transform .12s ease; }
.btn.admin-action-btn:hover:not(:disabled) svg { transform:scale(1.25); }
/* Size only — the command look comes from the shared .btn-primary/.btn-run rule. */
.btn-run {
  min-width:0;
  padding:var(--btn-run-pad-y);
  font-size:var(--btn-run-font-size);
}
/* Compare sits beside Run as a plain command: an amber fill next to an
   unfilled Run would out-shout the action that actually executes. */
.btn-compare {
  min-width:0;
  padding:var(--btn-run-pad-y);
  font-size:var(--btn-run-font-size);
}

/* ── Load points section (lives in the param editor modal) ── */
#ps-load { flex:1; min-height:0; display:flex; flex-direction:column; overflow:hidden; }
#ps-load.is-open { flex:1; }
#ps-load:not(.is-open) { flex:0 0 auto; }
#ps-load .psec-body { display:none; }
#ps-load.is-open .psec-body { display:flex; flex:1; min-height:0; flex-direction:column; overflow:hidden; padding-top:2px; padding-bottom:6px; }
#lp-list { flex:0 0 auto; padding-bottom:2px; }

/* variant name editor at top of col 2 */
.param-name-row {
  display:flex;
  align-items:center;
  padding:6px 10px;
  border-bottom:1px solid var(--bdr);
  gap:6px;
  flex-shrink:0;
}
.param-name-input {
  flex:1;
  background:var(--sur);
  border:1px solid var(--bdr);
  color:var(--tx);
  font:700 11px var(--sans);
  text-transform:uppercase;
  letter-spacing:.05em;
  padding:3px 6px;
  outline:none;
}
.param-name-input:focus { border-color:var(--acc); }
.param-save-btn {
  background:none;
  border:none;
  color:var(--tx3);
  cursor:pointer;
  font-size:var(--font-small);
  font-weight:600;
  padding:2px 4px;
}
.param-save-btn:hover { color:var(--acc); }

/* param sections */
.psec {
  border-bottom:1px solid var(--bdr2);
  flex-shrink:0;
}
.psec-head {
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:5px 10px;
  cursor:pointer;
  user-select:none;
  background:none;
  border:none;
  width:100%;
  text-align:left;
  color:inherit;
  font:inherit;
}
.psec-head:hover { background:var(--bg); }
.psec-head:has(.comp-var-sel:hover),
.psec-head:has(.comp-var-sel:focus-within) { background:transparent; }
/* Title + variant select cluster; chevron is sibling so it stays on the row’s right edge */
.psec-head-left {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
  min-width:0;
  flex:1 1 auto;
}
/* Split header (e.g. load points): one row, same inset as .psec-head; chevron aligns with other sections */
.psec-head-row {
  display:flex;
  align-items:center;
  justify-content:space-between;
  width:100%;
  box-sizing:border-box;
  padding:5px 10px;
  gap:8px;
}
.psec-head-row:hover { background:var(--bg); }
.psec-head-row .psec-head.psec-head--inline:hover { background:transparent; }
.psec-head.psec-head--inline {
  width:auto;
  flex:0 0 auto;
  padding:0;
  min-width:0;
  justify-content:flex-start;
}
.psec-head.psec-head--inline.psec-head--stretch {
  flex:1 1 auto;
  min-width:0;
}
.psec-title {
  font-size:var(--font-ui-xs);
  font-weight:700;
  text-transform:uppercase;
  letter-spacing:.07em;
  color:var(--tx3);
}
.psec-arr {
  font-size:var(--font-ui-xs);
  color:var(--tx3);
  transition:transform .15s;
  flex:0 0 auto;
  padding:0 4px;
}
.psec.is-open .psec-arr { transform:rotate(180deg); }
.comp-var-sel {
  flex:0 1 auto;
  display:flex;
  align-items:center;
  margin-left:auto;
  min-width:0;
}
.psec-body {
  display:none;
  padding:6px 10px 10px;
}
.psec.is-open .psec-body { display:block; }

/* fields */
.fg {
  display:grid;
  gap:8px 12px;
}
.fg-2 { grid-template-columns:repeat(2, minmax(0, 1fr)); }
.fg-3 { grid-template-columns:repeat(3, minmax(0, 1fr)); }
.fg-1 { grid-template-columns:minmax(0, 1fr); }
.fg > * { min-width:0; }
.inline-flex { display:inline-flex; align-items:center; gap:6px; }
.span-2 { grid-column: span 2; }
.f {
  display:flex;
  flex-direction:column;
  gap:6px;
}
/* Shared flow for ordinary forms: every field row, checkbox and grouped block
   participates in one predictable vertical rhythm. */
.form-flow {
  display:flex;
  flex-direction:column;
  gap:var(--form-row-gap);
}
.form-flow .fg { row-gap:var(--form-row-gap); }
/* An amount against a limit (Me -> Account, MCP tool list size): the native
   meter, full field width, in the accent ink. */
.f meter { width:100%; height:10px; accent-color:var(--acc); }
.form-flow > .auth-actions { margin-top:0; }
/* The flow's gap is the spacing: a heading or button row that is a direct child adds none of its own. */
.form-flow > .panel-heading { margin-bottom:0; }
.form-flow > .form-actions:not(.admin-form-actions) { margin-top:0; }
.f .ms-drop {
  display:flex;
  width:100%;
  min-width:0;
}
.f .cat-drop-wrap {
  width:100%;
  min-width:0;
}
.f .ms-drop-trigger {
  justify-content:flex-start;
  text-align:left;
}
.f .ms-drop-caret { display:none; }
.f label {
  font-size:var(--label-font-size);
  font-weight:700;
  text-transform:uppercase;
  letter-spacing:.04em;
  color:var(--tx3);
}
html[data-theme="dark"] .f label {
  color:#cbd5e1;
}
.ref-hint,
.f-hint {
  font-size:var(--label-font-size);
  color:var(--tx3);
}
.ref-hint.ref-hint--err {
  color:var(--red);
}
/* A hint that something will quietly fall back to a default. Amber, not red:
   nothing is wrong, but the user has to be able to see it -- silence is what
   let every cable run on a default temperature coefficient. Uses the existing
   --amb token, which already flips for dark mode. */
.f-hint--warn {
  color:var(--amb);
}
.ref-hint.ref-hint-icon {
  display:inline-flex;
  align-items:center;
  cursor:default;
}
html[data-theme="dark"] .ref-hint {
  color:#a5b4fc;
}
html[data-theme="dark"] .ref-hint.ref-hint--err {
  color:#fca5a5;
}
.f input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
.f textarea {
  background:var(--sur);
  border:1px solid var(--bdr);
  color:var(--tx);
  font:var(--field-font-size) var(--mono);
  line-height:1.3;
  min-height:28px;
  padding:var(--field-pad-y) var(--field-pad-x);
  width:100%;
  box-sizing:border-box;
  outline:none;
}
.f--prose textarea { font-family:var(--sans); }
/* Copy icon inside a read-only field (`forms.copy_field`, `shared/clipboard.js` wireCopyButtons): top-right
   corner, the field keeps right padding so the text never runs under it; the check shows for 2 s after a copy. */
.copy-field { position:relative; display:flex; }
.f .copy-field > :is(input, textarea):not([type="checkbox"]):not([type="radio"]):not([type="range"]) {
  padding-right:calc(var(--field-pad-x) + 26px);
}
.copy-field-btn {
  position:absolute;
  top:3px;
  right:3px;
  width:22px;
  height:22px;
  padding:0;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  background:var(--sur);
  border:1px solid transparent;
  color:var(--tx2);
  cursor:pointer;
}
.copy-field-btn:hover:not(:disabled) { color:var(--acc); border-color:var(--bdr); }
.copy-field-btn:focus { outline:none; }
.copy-field-btn:focus-visible { outline:2px solid var(--acc); outline-offset:1px; }
.copy-field-btn:disabled { opacity:.4; cursor:default; }
.copy-field-btn .copy-field-done { display:none; }
.copy-field-btn.is-copied { color:var(--grn); }
.copy-field-btn.is-copied .copy-field-icon { display:none; }
.copy-field-btn.is-copied .copy-field-done { display:block; }
.field-select,
.f select,
.f .ms-drop-trigger,
.f .cat-drop-trigger,
.comp-var-dropdown {
  appearance:none;
  -webkit-appearance:none;
  -moz-appearance:none;
  background:var(--sur);
  border:1px solid var(--bdr);
  color:var(--tx);
  font:var(--field-font-size) var(--mono);
  line-height:1.3;
  min-height:28px;
  border-radius:var(--radius-input);
  padding:var(--field-pad-y) calc(var(--field-pad-x) + 16px) var(--field-pad-y) var(--field-pad-x);
  width:100%;
  max-width:100%;
  min-width:0;
  box-sizing:border-box;
  outline:none;
  cursor:pointer;
  background-image:url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23888' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat:no-repeat;
  background-position:right 6px center;
}
.f input:focus,
.f textarea:focus,
.field-select:focus,
.f select:focus,
.f .ms-drop-trigger:focus,
.f .cat-drop-trigger:focus,
.comp-var-dropdown:focus {
  border-color:var(--acc);
  box-shadow:0 0 0 1px color-mix(in srgb, var(--acc) 14%, transparent);
}
/* Autofill. Chrome paints an autofilled field on an internal layer that
   `background` cannot reach, so the login Email field stayed near-white with
   black text on the dark page while Password — which blocks autofill with
   autocomplete="new-password" + readonly-until-focus — followed the theme. A
   large inset box-shadow is the only thing that covers that layer and
   -webkit-text-fill-color the only thing that moves its text. No colour of its
   own: both read the same tokens the resting field uses, so autofill is
   invisible rather than merely re-themed. */
.f input:-webkit-autofill,
.f textarea:-webkit-autofill,
.f select:-webkit-autofill,
.field-select:-webkit-autofill {
  -webkit-box-shadow: 0 0 0 100px var(--sur) inset;
  -webkit-text-fill-color: var(--tx);
  caret-color: var(--tx);
}
/* The focus ring is a box-shadow too, so the fill above would erase it. Restate
   both in one list — outer ring first, then the inset plate. */
.f input:-webkit-autofill:focus,
.f textarea:-webkit-autofill:focus,
.f select:-webkit-autofill:focus,
.field-select:-webkit-autofill:focus {
  -webkit-box-shadow:
    0 0 0 1px color-mix(in srgb, var(--acc) 14%, transparent),
    0 0 0 100px var(--sur) inset;
}
.field-select:hover,
.f select:hover,
.f .ms-drop-trigger:hover,
.f .cat-drop-trigger:hover,
.comp-var-dropdown:hover {
  border-color:var(--acc-bdr);
}
.field-select:disabled,
.f select:disabled,
.f input:disabled,
/* A property value its source owns (`matLocked`, materials-edit.js). */
.mat-props-table input:disabled,
/* Read-only inputs read as "not yours to edit" too, but stay in the submitted
   form data — used where another control owns the value. */
.f input[readonly],
.comp-var-dropdown:disabled {
  cursor:not-allowed;
  opacity:.72;
  color:var(--tx3);
}
.comp-var-dropdown {
  width:auto;
  max-width:130px;
  font-size:var(--font-ui-sm);
  font-family:var(--sans);
  color:var(--tx2);
}
/* Leading icon inside a field (auth email/password/name inputs). Wraps the
   input so the icon can sit inside its border without eating layout space
   from the row. */
/* Wire picker + grade/band on one row, equal thirds. Grid forces true 1fr each
   regardless of option text length. Dropdown escapes overflow via position:fixed. */
.wire-grade-row {
  display:grid;
  grid-template-columns:2fr 1fr 1fr;
  gap:4px;
}
.wire-grade-row > .wire-picker-mount .cat-drop-wrap {
  width:100%;
}
.wire-grade-row > select {
  min-width:0;
  width:100%;
  padding-left:var(--field-pad-x);
  padding-right:calc(var(--field-pad-x) + 12px);
}
/* Magnet material + Br basis selects (run-time override). Material takes most of
   the line; basis is narrow and shrinkable; both wrap before overflowing. */
.magnet-ov-row {
  display:flex;
  flex-wrap:wrap;
  gap:4px;
}
.magnet-ov-row > select:first-child {
  flex:1 1 12rem;
  min-width:0;
}
.magnet-ov-row > select:not(:first-child) {
  flex:1 1 7rem;
  min-width:0;
  width:auto;
  padding-left:var(--field-pad-x);
  padding-right:calc(var(--field-pad-x) + 12px);
}
/* Derived read-only winding outputs below the motor inputs (copper area, slot
   fill). Distinct accent surface + monospace values mark these as OUTPUT, not
   input. Flex rows (not a fixed table) so the modal never scrolls sideways. */
.param-readout {
  margin-top:var(--form-section-gap);
  border:1px solid var(--amb-bdr);
  border-radius:var(--radius-md);
  background:var(--amb2);
  padding:8px 10px;
  max-width:100%;
  box-sizing:border-box;
}
.param-readout-title {
  font-size:var(--font-ui-xs);
  text-transform:uppercase;
  letter-spacing:.04em;
  color:var(--amb);
  margin-bottom:5px;
}
.param-readout-title:not(:first-child) { margin-top:8px; }
.param-readout-row {
  display:flex;
  flex-wrap:wrap;
  justify-content:space-between;
  align-items:baseline;
  gap:4px 12px;
  font-size:var(--font-ui-sm);
  color:var(--tx2);
}
.param-readout-row + .param-readout-row { margin-top:3px; }
.param-readout-label { min-width:0; }
.param-readout-val {
  font-family:var(--mono);
  color:var(--tx);
}
.param-readout-ref {
  font-family:var(--mono);
  font-size:var(--font-ui-xs);
  color:var(--tx3);
}
.param-readout-ref:empty { display:none; }
/* Same amber card, but carrying a sentence instead of value rows. */
.param-readout--note { margin:0 0 6px; }
/* When stacked by .form-flow, let the shared gap own vertical spacing. */
.form-flow > .param-readout,
.form-flow > .param-readout--note,
.fg > .param-readout { margin-top:0; margin-bottom:0; }
.param-readout-note-text {
  color:var(--tx2);
  font-size:var(--font-ui-sm);
  line-height:1.35;
}
/* Admin catalog toolbar keeps fixed-width selects (wider modal, no overflow risk). */
.catalog-picker-toolbar > select#comp_wire_grade,
.catalog-picker-toolbar > select#comp_wire_band {
  width:auto;
  min-width:8rem;
  max-width:10.5rem;
  flex-shrink:0;
  padding-left:var(--field-pad-x);
  padding-right:calc(var(--field-pad-x) + 12px);
}
.chk {
  display:flex;
  align-items:center;
  gap:6px;
  font-size:var(--font-small);
  color:var(--tx2);
  cursor:pointer;
  margin:4px 0 2px;
}
.chk input[type="checkbox"] { accent-color:var(--acc); width:12px; height:12px; }
html[data-theme="dark"] .chk {
  color:#d4d4d8;
}
html[data-theme="dark"] .subsec-label,
html[data-theme="dark"] .psec-arr {
  color:#c4c4cc;
}
.subsec-label {
  font-size:var(--label-font-size);
  text-transform:uppercase;
  letter-spacing:.05em;
  color:var(--tx3);
  margin:8px 0 4px;
  padding-bottom:2px;
  border-bottom:1px solid var(--bdr2);
}

/* ── Col 3 — results (transparent so html graph-paper shows through) ── */
.col-results {
  flex:1;
  border-right:none;
  min-width:0;
  background:transparent;
}
.rtabs {
  display:flex;
  align-items:flex-end;
  background:var(--sur);
  border-bottom:1px solid var(--bdr);
  padding:0 14px;
  height:34px;
  overflow-x:auto;
  flex-shrink:0;
  gap:0;
}
.rtab {
  display:inline-flex;
  align-items:center;
  gap:5px;
  padding:0 10px;
  height:34px;
  border:none;
  border-bottom:2px solid transparent;
  background:transparent;
  color:var(--tx3);
  font:600 10px var(--sans);
  cursor:pointer;
  white-space:nowrap;
  letter-spacing:.02em;
  margin-bottom:-1px;
}
.rtab:hover { color:var(--tx2); }
.rtab.is-act { color:var(--acc); border-bottom-color:var(--acc); }
.rtab-dot { width:5px; height:5px; border-radius:50%; background:var(--bdr); flex-shrink:0; }
.rtab.has-ok .rtab-dot { background:var(--grn); }
.rtab.has-err .rtab-dot { background:var(--red); }

/* ── Result area — grid canvas + floating paper card ── */

.rcontent {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: var(--results-wrap-pad-y) var(--results-wrap-pad-x);
  display: flex;
  flex-direction: column;
}

/* Panel wrap — centered page stack, no left markers column */
.rpanel-wrap { display: none; }
.rpanel-wrap.is-act {
  display: flex;
  flex: 1;
  max-width: var(--paper-max-w);
  margin: 0 auto;
  width: 100%;
}

/* Stack container — just the active card now. The right-edge index tabs it used
   to make room for are gone: Market Reports was the last page drawing them and
   it switched to the shared param-diagram strip, so the 64px gutter went too. */
.rpanel-stack {
  flex: 1;
  min-width: 0;
  min-height: 0;
  position: relative;
}

/* The model apps let the card own the full result area and stretch to its
   height even when the content is short. Scoped by container id: Market
   Reports shares .rpanel-stack and keeps a content-height card. */
#rcontent .rpanel-stack,
#mapsRcontent .rpanel-stack {
  display: flex;
  flex-direction: column;
}

#rcontent .rpanel-stack > .rpanel.is-act,
#mapsRcontent .rpanel-stack > .rpanel.is-act { flex: 1; }

/* Active result card */
.rpanel { display: none; }
.rpanel.is-act {
  display: flex;
  flex-direction: column;
  min-height: 0;
  position: relative;
  z-index: 12;
  background: var(--paper-bg);
  border: 1px solid var(--paper-border);
  border-radius: var(--paper-radius);
  overflow: visible;
  box-shadow: var(--paper-shadow);
  padding: var(--results-panel-pad-y) var(--results-panel-pad-x);
}

.rcontent.rcontent-empty .rpanel-stack { padding: 0; }
.rcontent.rcontent-empty .rpanel.is-act {
  flex: 1;
  width: 100%;
  max-width: none;
  margin: 0;
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
  padding: 0;
  min-height: 0;
}

/* Result panel banner — shared by Motool and DQ Model */
.r-banner {
  display:flex;
  flex-direction:column;
  gap:4px;
  width:100%;
  min-width:0;
  max-width:980px;
  padding:0 14px 18px;
  margin:0 auto 22px;
  border:none;
  background:transparent;
}
.r-banner-main {
  display:flex;
  align-items:center;
  gap:8px;
  min-width:0;
  flex-wrap:wrap;
}
.r-banner-name {
  max-width:100%;
  min-width:0;
  font-size:var(--font-heading);
  font-weight:800;
  letter-spacing:0;
  color:var(--tx);
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.r-banner-vtag {
  flex-shrink:0;
  font-size:var(--font-tiny);
  font-weight:700;
  letter-spacing:.06em;
  text-transform:uppercase;
  color:var(--r-banner-accent, var(--acc));
  background:color-mix(in srgb, var(--r-banner-accent, var(--acc)) 12%, transparent);
  border:1px solid color-mix(in srgb, var(--r-banner-accent, var(--acc)) 30%, transparent);
  border-radius:4px;
  padding:1px 6px;
  line-height:1.6;
}
.r-banner-sub {
  max-width:100%;
  min-width:0;
  font-size:var(--font-small);
  font-weight:500;
  letter-spacing:.01em;
  color:var(--tx2);
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
/* Components stay collapsed: they are provenance, not the headline. */
.r-banner-comps {
  font-size:var(--font-small);
  color:var(--tx2);
}
.r-banner-comps > summary {
  display:flex;
  align-items:center;
  gap:6px;
  width:fit-content;
  cursor:pointer;
  list-style:none;
  color:var(--tx2);
}
.r-banner-comps > summary::-webkit-details-marker { display:none; }
.r-banner-comps > summary:hover { color:var(--tx); }
.r-banner-comps > summary svg:last-child {
  color:var(--tx3);
  transition:transform .12s ease;
}
.r-banner-comps[open] > summary svg:last-child { transform:rotate(180deg); }
.r-banner-specs {
  display:grid;
  grid-template-columns:repeat(auto-fit, minmax(180px, 1fr));
  gap:8px 18px;
  margin:8px 0 0;
  padding:2px 0 0;
}
.r-banner-specs dt {
  font-size:var(--font-tiny);
  color:var(--tx3);
}
.r-banner-specs dd {
  margin:0;
  color:var(--tx);
  overflow-wrap:anywhere;
}
/* ── empty-state prompt ───────────────────────────────────────────────── */
.r-empty {
  min-height:0;
  flex:1;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:48px 18px;
  text-align:center;
}
.r-empty p:not(.r-empty-callout) {
  margin:0; padding:0; border:none; border-radius:0;
  background:transparent; box-shadow:none;
}

/* Hub landing terminal chrome.
   Ice HUD, not a CRT: cool panel, cyan ticks, ink type, teal prompt. */
.hub-terminal {
  --mark-spark: var(--term-bg);
  --hub-font: calc(var(--font-base) - 2px);
  --hub-font-bar: calc(var(--font-base) - 4px);
  position: relative;
  border: 1px solid var(--term-bdr);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--term-bg);
  box-shadow: var(--term-glow);
}

.hub-terminal::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: var(--term-ticks);
}

/* inline notice line inside an empty result area */
.r-empty-callout {
  display:flex;
  align-items:center;
  gap:0;
  padding:10px 14px;
  background:var(--term-bg);
  font-family:var(--mono);
  white-space:nowrap;
  margin:0;
  border:none;
  box-shadow:none;
  border-radius:0;
  width:100%;
}
.r-empty-callout::before {
  content:'›';
  color:var(--term-prompt);
  font-size:.85rem;
  margin-right:6px;
  flex-shrink:0;
}
.r-empty-action {
  display:inline-flex;
  align-items:center;
  padding:4px 10px;
  border-radius:999px;
  background:color-mix(in srgb, var(--acc) 18%, var(--bg));
  color:var(--tx);
  letter-spacing:.02em;
  font-size:calc(var(--font-ui-sm) + 1px);
}
.marker-line {
  display:inline-block;
  padding:4px 16px 5px;
  border-radius:4px;
  background:#ffe100;
}
.r-err { color:var(--red); font-size:var(--font-small); padding:12px 0; }
.r-warn { font-size:var(--font-small); color:var(--amb); margin-bottom:10px; padding-left:14px; }
.r-warn--modal { margin:0; padding-left:18px; color:var(--c-text,inherit); list-style:disc; }
.r-warn--modal li { margin:4px 0; line-height:1.45; }
.r-result-grid {
  display:grid;
  grid-template-columns:minmax(0, 1.45fr) minmax(240px, .8fr);
  gap:24px;
  align-items:start;
}
.r-result-plot,
.r-result-table {
  min-width:0;
}
.r-result-plot {
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  background:var(--paper-inset-strong);
  border-radius:6px;
  padding:14px;
}
.r-result-table {
  display:flex;
  flex-direction:column;
  align-self:stretch;
  min-width:0;
  /* Clip only — same contract as .admin-table-wrap / .lp-table-wrap. */
  overflow-x:hidden;
  background:var(--paper-inset-soft);
  border-radius:6px;
  padding:10px 12px;
}
.r-result-table > .perf-table,
.r-result-table > .lp-table-wrap {
  width:100%;
  max-width:100%;
  box-sizing:border-box;
}
.r-result-table > .lp-results:first-child {
  margin-top:0;
  padding-top:0;
}
.r-result-table > .perf-table {
  margin-left:0;
  margin-right:0;
}
.r-result-grid .r-plot { margin-bottom:0; }
.r-plot { margin-bottom:24px; text-align:center; position:relative; }
.r-plot img { display:inline-block; max-width:100%; height:auto; }
.r-plot-stage {
  display:grid;
  width:100%;
  aspect-ratio:18 / 11;
  min-height:0;
  overflow:hidden;
}
.r-plot-stage > * {
  grid-area:1 / 1;
  min-width:0;
  min-height:0;
}
.r-plot-stage > .r-empty { padding:18px; }
.r-plot-stage-empty {
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:10px;
  max-width:28ch;
  margin:0 auto;
  color:var(--tx3);
  font-size:var(--font-ui-sm);
  line-height:1.45;
  text-align:center;
}
.r-plot-stage-empty svg,
.r-plot-stage-empty [data-lucide] {
  color:var(--tx3);
  opacity:.72;
}
.r-plot-stage-content,
.r-plot-stage-content .r-plot {
  width:100%;
  height:100%;
}
.r-plot-stage-content .r-plot {
  display:grid;
  place-items:center;
  margin:0;
}
.r-plot-stage-content .r-plot img {
  width:100%;
  height:100%;
  object-fit:contain;
}
.r-plot-stage-content .r-plot canvas {
  width:100% !important;
  height:100% !important;
}
.market-report-oneoff-btn {
  width: 100%;
  justify-content: center;
}
.market-report-oneoff-btn.is-loading {
  opacity: 0.55;
  pointer-events: none;
}
.market-report-oneoff-btn.is-attention {
  color: var(--acc);
  background: color-mix(in srgb, var(--acc) 12%, var(--sur));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--acc) 34%, transparent), 0 0 0 6px color-mix(in srgb, var(--acc) 10%, transparent);
}
.market-reports-sidebar-body { display:flex; flex-direction:column; gap:16px; padding-bottom:8px; }
.market-reports-sidebar-footer { padding-top:10px; border-top:none; }
.market-reports-run-btn { width:100%; justify-content:center; min-height:38px; }
.market-reports-run-btn:disabled { cursor: inherit; }

#downloadPdfBtn.is-loading {
  opacity: 0.75;
  pointer-events: none;
}

.market-reports-main {
  position: relative;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}
#marketReportsResults {
  display: flex;
  flex-direction: column;
  min-height: 0;
}
/* Market reports — results column uses graph-paper canvas */
.market-reports-page-root {
  position: relative;
}
#marketReportsResults.market-reports-page-root {
  background-color: transparent;
  background-image: none;
}
.market-reports-catalog-root {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background-color: transparent;
  background-image: none;
}
.market-reports-catalog-root > .admin-scroll {
  flex: 1;
  min-height: 0;
}
/* Settings sub-pages: drop phantom scrollbars on short content. */
.market-reports-settings-root > .admin-scroll > .admin-panel {
  min-height: auto;
}
.market-reports-settings-root .market-report-advanced-tables-card,
.market-reports-settings-root .market-report-advanced-pages-card {
  max-height: none;
  overflow: visible;
}
#marketReportsRuns .maps-jobs-panel {
  border: none;
}
#marketReportsRuns .maps-jobs-head {
  border-bottom: none;
}
#marketReportsRuns .maps-run-card {
  border: none;
}
.market-report-form { display:flex; flex-direction:column; gap:14px; }
.market-report-params {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-top: 4px;
}
.market-report-params[hidden] {
  display: none !important;
}
.market-report-params-title {
  margin: 0;
  font: 700 var(--font-small) var(--sans);
  color: var(--tx);
}
.market-report-params-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.market-report-params-label {
  font: 600 var(--font-tiny) var(--sans);
  color: var(--tx2);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.market-report-params .fg { gap: 8px; }
.market-report-file-input { position:absolute; inline-size:1px; block-size:1px; opacity:0; pointer-events:none; }
.market-report-title-input { width:100%; }
.market-report-settings {
  border:1px solid var(--bdr);
  border-radius:8px;
  padding:10px 12px;
  background:color-mix(in srgb, var(--sur) 90%, var(--bg));
}
.market-report-settings summary {
  cursor:pointer;
  font-weight:600;
  font-size:var(--font-small);
  color:var(--tx2);
}
.market-report-preview-shell {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}
.market-report-preview-list {
  display:grid;
  gap:10px;
}
.market-report-view {
  display: none;
  flex-direction: column;
  min-height: 0;
  flex: 1;
}
.market-report-view.is-act { display: flex; }
.market-report-tables-page {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-bottom: 8px;
}
.market-report-tables-page-head { display: flex; align-items: center; }
.market-report-tables-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  align-items: start;
}
.market-report-tables-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.market-report-tables-section-head {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.market-report-tables-section-title {
  margin: 0;
  font-size: var(--font-small);
  font-weight: 600;
  color: var(--tx2);
}
.market-report-tables-section-sub {
  font-size: var(--font-tiny);
  color: var(--tx3);
}
.market-report-tables-empty { padding: 16px 4px; }
.market-report-tables-loading { padding: 16px 4px; }
.market-report-summary-tables-page {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding-bottom: 8px;
}
.market-report-summary-table-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}
.market-report-summary-table-wrap {
  overflow-x: auto;
  max-width: 100%;
}
.market-report-data-table--summary-sheet {
  min-width: max(100%, 520px);
  font-size: 11px;
}
.market-report-data-table--summary-sheet th,
.market-report-data-table--summary-sheet td {
  white-space: nowrap;
}
.market-report-data-table--summary-sheet th:first-child,
.market-report-data-table--summary-sheet td:first-child {
  white-space: normal;
  min-width: 9rem;
}
.market-report-page {
  margin:0;
  padding:0;
  position:relative;
  display:flex;
  flex-direction:column;
  gap:10px;
  padding-bottom:16px;
  border-bottom:1px solid var(--bdr);
}
.market-report-page:last-child { border-bottom:none; }
.market-report-page-head { display:flex; align-items:center; justify-content:space-between; gap:8px; }
.market-report-page-title { font-size:var(--font-base); font-weight:700; color:var(--tx); }
.market-report-page-commentary {
  display:flex;
  flex-direction:column;
  gap:10px;
  padding:12px;
  border-radius:8px;
  background:color-mix(in srgb, var(--acc) 4%, var(--sur));
  border:1px solid var(--bdr);
}
.market-report-page-commentary-head {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
}
.market-report-page-commentary-title { font-size:var(--font-small); font-weight:600; }
.market-report-notes-status { font-size: var(--font-tiny); color: var(--tx3); min-width: 4.5rem; text-align: right; }
.market-report-page-commentary-hint { margin:0; font-size:var(--font-tiny); }
.market-report-field-note {
  margin-top: 6px;
}
.market-report-preview-img { display:block; width:100%; max-width:100%; height:auto; border:none; border-radius:0; background:var(--plot-plate); }
.market-report-page--hybrid { gap: 12px; }
.market-report-page-subtitle { margin: 0; font-size: var(--font-tiny); color: var(--tx3); }
.market-report-page-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  align-items: stretch;
}
.market-report-page-grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.market-report-page-grid--dense { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.market-report-region-col { display: flex; flex-direction: column; gap: 8px; min-width: 0; min-height: 100%; }
.market-report-region-col--chart-only .market-report-chart-img { margin-top: 0; }
.market-report-panel-col { min-height: 100%; }
.market-report-region-label { font-size: var(--font-small); font-weight: 600; color: var(--tx2); }
.market-report-region-sublabel { line-height: 1.35; text-align: center; word-break: break-word; }
.market-report-data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--font-tiny);
  background: var(--table-cell-bg);
  border: 1px solid var(--bdr);
  color: var(--tx);
  border-radius: 6px;
  overflow: hidden;
}
.market-report-data-table th,
.market-report-data-table td {
  padding: 4px 6px;
  border: 1px solid var(--bdr2);
  text-align: right;
}
.market-report-data-table th:first-child,
.market-report-data-table td:first-child { text-align: left; }
.market-report-data-table thead th { background: var(--table-head-bg); color: var(--tx2); font-weight: 600; }
.market-report-data-table__total { font-weight: 600; }
.market-report-num { font-variant-numeric: tabular-nums; }
.market-report-chart-img {
  display: block;
  width: 100%;
  height: auto;
  background: var(--plot-plate);
  border: 1px solid var(--bdr);
  border-radius: 4px;
}
/* Ghost inline edit fields — look like text until hover/focus */
.mr-ghost-input,
.mr-ghost-textarea {
  display: block;
  width: 100%;
  box-sizing: border-box;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 3px;
  padding: 3px 5px;
  font: inherit;
  color: inherit;
  line-height: inherit;
  resize: none;
  cursor: text;
  transition: border-color 0.12s, background 0.12s;
}
.mr-ghost-input:hover,
.mr-ghost-textarea:hover {
  border-color: var(--bdr);
  background: color-mix(in srgb, var(--acc) 4%, var(--sur));
}
.mr-ghost-input:focus,
.mr-ghost-textarea:focus {
  border-color: color-mix(in srgb, var(--bdr) 60%, var(--acc) 40%);
  background: color-mix(in srgb, var(--acc) 6%, var(--sur));
  outline: none;
  cursor: auto;
}
.mr-ghost-input::placeholder,
.mr-ghost-textarea::placeholder {
  color: var(--tx3);
  font-style: italic;
}
.mr-ghost-input--title {
  font-size: 1.1rem;
  font-weight: 500;
  max-width: 28rem;
  color: var(--tx);
  margin-left: -6px;
}
.mr-ghost-textarea--region {
  font-size: var(--font-tiny);
  line-height: 1.35;
  overflow: hidden;
  min-height: 4rem;
  color: var(--tx);
}
.mr-ghost-label {
  display: block;
  font-size: var(--font-tiny);
  font-weight: 600;
  color: var(--tx3);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.mr-ghost-field-wrap {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.market-report-region-comment {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: auto;
  box-sizing: border-box;
  padding: 6px 4px 4px;
  border-top: 1px solid var(--bdr);
}
.market-report-region-comment-headline {
  font-size: var(--font-tiny);
  font-weight: 700;
  line-height: 1.35;
  color: var(--tx);
  max-height: 2.7em;
  overflow: hidden;
}
.market-report-page-notes-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 4px;
}
.market-report-preview-save-status {
  display: flex;
  justify-content: flex-end;
  padding: 0 4px 8px;
  min-height: 1.25rem;
}
.market-report-page-footer-comment {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.market-report-page-footer-comment .market-report-region-comment {
  margin-top: 0;
  border-top: none;
  padding-top: 0;
}
/* Cover = Julia Wolf's 835x591 slide. Positions are % of that slide and
   fonts are cqw (1% of cover width), so screen and PDF scale as one picture.
   Colours are sampled from the slide and stay fixed in dark mode: the cover
   is printed paper, not app chrome. */
.market-report-cover {
  position: relative;
  container-type: inline-size;
  width: 100%;
  aspect-ratio: 835 / 591;
  overflow: hidden;
  background: var(--plot-plate);
  color: var(--cover-ink);
  font-family: Arial, Helvetica, sans-serif;
}
.market-report-cover-tag { position: absolute; left: 44.6%; top: 1.1%; font-size: 0.95cqw; color: var(--cover-tag); }
.market-report-cover-rule { position: absolute; left: 4.4%; top: 21.8%; bottom: 0; width: 0.24%; background: var(--cover-rule); }
.market-report-cover-title { position: absolute; left: 6.8%; top: 23.4%; margin: 0; font-size: 4.8cqw; line-height: 5.63cqw; font-weight: 700; }
.market-report-cover-byline { position: absolute; left: 6.8%; top: 72%; font-size: 2.4cqw; line-height: 2.75cqw; }
.market-report-cover-foot { position: absolute; left: 6.8%; top: 91.8%; width: 27%; font-size: 1.05cqw; line-height: 1.28cqw; }
.market-report-cover-img { position: absolute; left: 48.74%; top: 0; width: 51.26%; height: 100%; object-fit: cover; }
@media (max-width: 1100px) {
  .market-report-page-grid { grid-template-columns: 1fr; }
}
/* PDF export (Playwright headless print) — screen is the single source of truth. */
@media print {
  /* Landscape (matches the original matplotlib figsize=16x9 pages) — Chromium
     lays out print content using the physical page width, not the screen's
     browser width, so portrait A4 (~700px after margins) falls under the
     max-width:1100px breakpoint above and silently collapses every 3-column
     region grid to 1 column. Force the grid templates back below too. */
  @page { size: A4 landscape; margin: 12mm 14mm; }
  /* Cover is full-bleed like the slide. Height is pinned to the sheet: the
     slide ratio (835/591) is 0.2mm taller than A4 at full width and spilled
     a blank second sheet. */
  @page mr-cover { size: A4 landscape; margin: 0; }
  .market-report-page--title { page: mr-cover; }
  .market-report-cover { width: 297mm; height: 210mm; aspect-ratio: auto; }
  .market-report-page-grid { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
  .market-report-page-grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .market-report-page-grid--dense { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
  .topbar,
  #marketReportsSidebar,
  #marketReportsResizer,
  #marketReportsRuns,
  .modal-back,
  .modal-dialog,
  .param-diagram-strip {
    display: none !important;
  }
  .rpanel-stack {
    padding-right: 0 !important;
  }
  .app-frame,
  .app-main,
  .app-body,
  #marketReportsResults,
  .market-reports-main,
  #marketReportsContent,
  .rpanel-wrap,
  .rpanel-stack,
  #marketReportsPaper,
  #marketReportsResult {
    display: block !important;
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
    flex: none !important;
    /* #marketReportsContent is a scrollable app panel on screen
       (overflow-y:auto + min-height:0) — printing clips content to a
       scrollable box's visible size instead of paginating past it, so
       every constraint that makes it "a box with a scrollbar" must be
       lifted for print, or anything below the fold gets cut off. */
    overflow: visible !important;
    height: auto !important;
    min-height: auto !important;
    max-height: none !important;
    /* #marketReportsPaper is also the .rpanel.is-act "paper card" — its
       border/shadow/radius are screen chrome, not part of the report. */
    border: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
  }
  .market-report-page {
    border-bottom: none;
    padding-bottom: 0;
    /* No break-inside:avoid — a page taller than one physical sheet must be
       allowed to flow onto a second sheet. "avoid" here made Chromium clip
       whatever didn't fit instead of continuing it on the next page. */
    page-break-after: always;
  }
  .market-report-page:last-child { page-break-after: auto; }
  .mr-ghost-input,
  .mr-ghost-textarea {
    border-color: transparent !important;
    background: transparent !important;
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
    field-sizing: content;
  }
}
#marketReportsPaper,
#marketReportsResult {
  display: flex;
  flex: 1;
  min-height: 0;
  flex-direction: column;
}
#marketReportsContent.rcontent-empty .rpanel-wrap,
#marketReportsContent.rcontent-empty .rpanel-stack,
#marketReportsContent.rcontent-empty #marketReportsPaper,
#marketReportsContent.rcontent-empty #marketReportsResult {
  display: flex;
  flex: 1;
  min-height: 0;
}
#marketReportsContent.rcontent-empty .rpanel-stack,
#marketReportsContent.rcontent-empty #marketReportsPaper {
  flex-direction: column;
}
#marketReportsPaper {
  width: 100%;
}
.market-report-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px;
  min-height: 0;
  text-align: center;
}
.market-report-empty-text {
  margin: 0;
  max-width: min(100%, 960px);
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--bg);
  font-size: var(--font-small);
  color: var(--tx2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.market-report-empty-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  inline-size: 54px;
  block-size: 54px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--acc) 8%, var(--sur));
  color: var(--acc);
}
.market-report-empty-title {
  margin: 0;
  font-size: var(--font-small);
  font-weight: 600;
  color: var(--tx);
}
.market-report-empty-text--wrap {
  white-space: normal;
  overflow: visible;
  text-overflow: unset;
  line-height: 1.45;
}
.market-report-empty--sidebar {
  align-items: stretch;
  flex: 0 0 auto;
  padding: 14px 12px;
  border: 1px solid var(--bdr);
  border-radius: 8px;
  background: var(--sur);
  gap: 8px;
  text-align: left;
}
.market-report-empty--sidebar .market-report-empty-icon {
  inline-size: 40px;
  block-size: 40px;
  border-radius: 10px;
  align-self: flex-start;
}
.market-report-empty--sidebar .market-report-empty-text {
  padding: 0;
  background: transparent;
  text-align: left;
}
.market-report-no-sources-cta {
  width: 100%;
  justify-content: center;
  margin-top: 4px;
}
.market-report-no-sources-hint {
  margin: 0;
  padding: 0;
}
.market-report-settings-form { display:flex; flex-direction:column; gap:var(--form-section-gap); margin-top:var(--form-row-gap); }
.market-report-settings-section {
  display:flex;
  flex-direction:column;
  gap:10px;
  padding:14px;
  border:1px solid var(--bdr);
  border-radius:8px;
  background:var(--sur);
}
.market-report-settings-section + .market-report-settings-section { margin-top:0; }
.market-report-settings-summary { margin:0; }
.market-report-settings-help { margin:-4px 0 8px; font-size:var(--font-small); }
.market-report-advanced-body { display:flex; flex-direction:column; gap:var(--form-row-gap); min-height:0; flex:1; overflow:hidden; }
#marketReportsAdvancedModal .modal-box--market-report-advanced {
  height:min(88vh, 720px);
  max-height:min(88vh, 720px);
}
#marketReportsAdvancedModal .modal-content.market-report-advanced-body {
  display:flex;
  flex-direction:column;
  min-height:0;
  overflow:hidden;
}
.market-report-advanced-panels {
  position:relative;
  flex:1 1 auto;
  min-height:0;
  height:min(52vh, 440px);
}
.market-report-advanced-nav-row { flex-shrink:0; padding:0; position:relative; }
.market-report-advanced-nav { max-width:100%; }
.market-report-advanced-panel {
  position:absolute;
  inset:0;
  display:flex;
  flex-direction:column;
  gap:14px;
  min-height:0;
  overflow:auto;
  opacity:0;
  visibility:hidden;
  pointer-events:none;
}
.market-report-advanced-panel.is-active {
  opacity:1;
  visibility:visible;
  pointer-events:auto;
}
.market-report-advanced-panel-card {
  border:1px solid var(--bdr);
  border-radius:8px;
  background:var(--sur);
  padding:12px 14px;
}
.market-report-advanced-warn {
  margin:0;
  padding:8px 10px;
  border-radius:8px;
  background:#fff7ed;
  border:1px solid #fdba74;
  color:#9a3412;
  font-size:var(--font-small);
}
.market-report-advanced-table-wrap { overflow:auto; flex:1 1 auto; min-height:0; border:1px solid var(--bdr); border-radius:8px; }
.market-report-propulsion-table-wrap {
  overflow:auto;
  flex:1 1 auto;
  min-height:0;
  border:1px solid var(--bdr);
  border-radius:8px;
}
.market-report-propulsion-bucket-wrap {
  flex:0 0 auto;
}
.market-report-compact-add {
  align-self:flex-start;
  margin-top:2px;
  padding:3px 8px;
  min-height:24px;
}
#mrPropulsionTable th:nth-child(2),
#mrPropulsionTable td:nth-child(2) {
  width: 7.5rem;
  max-width: 7.5rem;
}
.market-report-bucket-select {
  min-height:24px;
  padding-top:2px;
  padding-bottom:2px;
}
.market-report-advanced-panel--propulsion .market-report-advanced-table-wrap {
  flex:1 1 auto;
  min-height:0;
}
.market-report-advanced-propulsion-card {
  display:flex;
  flex-direction:column;
  min-height:0;
  flex:1 1 auto;
}
.market-report-advanced-table { margin:0; }
.market-report-advanced-table th,
.market-report-advanced-table td { font-size:var(--font-small); vertical-align:middle; }
.market-report-advanced-year { max-width:5.5rem; }
.market-report-advanced-checklist { display:flex; flex-direction:column; gap:2px; }
.market-report-advanced-check {
  display:flex;
  align-items:flex-start;
  gap:10px;
  font-size:var(--font-small);
  padding:8px 10px;
  border-radius:6px;
  cursor:pointer;
}
.market-report-advanced-check:hover { background:color-mix(in srgb, var(--acc) 6%, var(--sur)); }
.market-report-advanced-check input { margin-top:3px; flex-shrink:0; }
.market-report-advanced-check span { line-height:1.4; color:var(--tx); }
.market-report-advanced-table-checklist,
.market-report-advanced-tables-card {
  max-height:min(46vh, 400px);
  overflow:auto;
}
.market-report-advanced-group-title {
  margin:12px 0 6px;
  font-size:var(--font-tiny);
  text-transform:uppercase;
  letter-spacing:.04em;
  color:var(--tx3);
}
.market-report-advanced-group-title:first-child { margin-top:0; }
.market-report-advanced-pages-card { flex:1 1 auto; min-height:0; overflow:auto; }
.slot-catalog-actions {
  display:inline-flex;
  align-items:center;
  gap:4px;
  margin-left:8px;
}
.market-manufacturer-save-row { margin:16px 0 24px; }
#marketManufacturersTable.market-manufacturers-table th:nth-child(1),
#marketManufacturersTable.market-manufacturers-table td:nth-child(1) { width:55%; }
#marketManufacturersTable.market-manufacturers-table th:nth-child(2),
#marketManufacturersTable.market-manufacturers-table td:nth-child(2) { width:30%; white-space:nowrap; }

.market-data-sources-table {
  table-layout:fixed;
  width:100%;
  min-width:0;
}
.admin-table.market-data-sources-table th:nth-child(1),
.admin-table.market-data-sources-table td:nth-child(1) { width:13%; white-space:nowrap; }
.admin-table.market-data-sources-table th:nth-child(2),
.admin-table.market-data-sources-table td:nth-child(2) { width:8%; white-space:nowrap; }
.admin-table.market-data-sources-table th:nth-child(3),
.admin-table.market-data-sources-table td:nth-child(3) { width:20%; white-space:nowrap; }
.admin-table.market-data-sources-table th:nth-child(4),
.admin-table.market-data-sources-table td:nth-child(4) { width:25%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.admin-table.market-data-sources-table th:nth-child(5),
.admin-table.market-data-sources-table td:nth-child(5) { width:12%; white-space:nowrap; }
/* Type and Status hold one short badge each, so they are centred: the gap left
   of the pill then matches the gap right of it. The exclusion chain is repeated
   verbatim from the admin left-align default above — that rule is (0,6,1), so a
   plainer selector here loses silently and the column stays left. */
.admin-table.market-data-sources-table.perf-table:not(.mat-materials-table):not(.mat-props-table):not(.property-table):not(.wire-detail-table) :is(thead th, tbody td):is(:nth-child(2), :nth-child(5)) {
  text-align:center;
}
.admin-table.market-data-sources-table th:nth-child(6),
.admin-table.market-data-sources-table td:nth-child(6) { width:11%; white-space:nowrap; }
.admin-table.market-data-sources-table :is(th, td).admin-actions {
  width:11%;
  min-width:11%;
  max-width:11%;
  white-space:nowrap;
}
.admin-table.market-data-sources-table tbody tr td.admin-actions > * {
  opacity:1;
}
.admin-table.market-data-sources-table td.ov-cell {
  overflow:visible;
}

.market-data-source-upload-row {
  display:flex;
  justify-content:flex-end;
  margin-top:12px;
}

#dataSourceUploadModal .drop-zone { margin-bottom:0; }
.btn.is-loading:has(.btn-loading-icon) { pointer-events:none; opacity:.75; }
.btn-loading-icon { display:none; }
.is-loading .btn-idle-icon { display:none; }
.is-loading .btn-loading-icon { display:inline-block; }

.market-data-source-desc-cell { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.market-manufacturer-oem-badge { font-size:var(--font-tiny); }
.manufacturer-multi-picker { display:flex; flex-direction:column; gap:8px; }
.manufacturer-multi-picker-wrap { width:100%; }
.manufacturer-multi-picker-pills { min-height:2rem; }
.manufacturer-pill {
  display:inline-flex;
  align-items:center;
  gap:6px;
  max-width:100%;
}
.manufacturer-pill-name { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.manufacturer-pill .market-manufacturer-oem-badge { flex-shrink:0; }
.oem-group-badge--gm { color: var(--brand-gm); }
.oem-group-badge--mercedes_benz { color: var(--brand-mercedes-benz); }
.oem-group-badge--stellantis { color: var(--brand-stellantis); }
.oem-group-badge--volkswagen { color: var(--brand-volkswagen); }
.oem-group-badge--hyundai { color: var(--brand-hyundai); }
.oem-group-badge--honda { color: var(--brand-honda); }
.oem-group-badge--bmw { color: var(--brand-bmw); }
.oem-group-badge--unassigned {
  color:var(--tx3);
  background:color-mix(in srgb, var(--tx3) 12%, var(--sur));
  border-color:var(--bdr);
  text-transform:none;
  letter-spacing:normal;
  font-family:var(--sans);
}
html[data-theme="dark"] .oem-group-badge--unassigned {
  background:var(--sur-raised);
  border-color:var(--bdr);
}
.oem-group-badge--pal-0 { color: var(--oem-pal-0); }
.oem-group-badge--pal-1 { color: var(--oem-pal-1); }
.oem-group-badge--pal-2 { color: var(--oem-pal-2); }
.oem-group-badge--pal-3 { color: var(--oem-pal-3); }
.oem-group-badge--pal-4 { color: var(--oem-pal-4); }
.oem-group-badge--pal-5 { color: var(--oem-pal-5); }
.oem-group-badge--pal-6 { color: var(--oem-pal-6); }
.oem-group-badge--pal-7 { color: var(--oem-pal-7); }
.slot-variant-main .oem-group-badge { margin-right:6px; flex-shrink:0; }
.slot-label-inner .oem-group-badge { vertical-align:middle; }

/* Per-plot settings gear — top-right corner of each plot image. Opens the
   shared plot-settings modal scoped to this one plot (title + axis + ticks). */
.r-plot-gear {
  position:absolute; top:2px; right:2px; z-index:3;
  display:inline-flex; align-items:center; justify-content:center;
  padding:3px; background:none; border:none; border-radius:3px;
  color:var(--tx3); cursor:pointer;
  opacity:0; transition:opacity .12s, color .12s;
}
.r-plot:hover .r-plot-gear,
.r-plot-gear:focus-visible { opacity:1; }
.r-plot-gear:hover { color:var(--tx2); outline:none; }
.r-plot-gear svg { stroke-width:1.8; }

.r-sec {
  font-size:var(--font-ui-xs); font-weight:700; text-transform:uppercase;
  letter-spacing:.07em; color:color-mix(in srgb, var(--tx2) 82%, var(--tx));
  margin-bottom:8px; padding-bottom:3px;
  border-bottom:1px solid color-mix(in srgb, var(--bdr2) 70%, transparent);
  text-align:center;
}
/* Horizontal perf table: label row on top, values below */
.perf-table {
  width:auto;
  min-width:0;
  max-width:100%;
  border-collapse:collapse;
  font-size:var(--table-font-size);
  margin:0 auto 18px;
  table-layout:auto;
  background:var(--table-cell-bg);
}
.perf-table-transposed {
  width:100%;
  flex:1;
}
/* Fixed layout so % widths + ellipsis apply when UI font scales up */
.perf-table.perf-table-transposed {
  table-layout:fixed;
  width:100%;
}
.perf-table thead th {
  padding:var(--table-head-pad-y) var(--table-head-pad-x);
  border-bottom:1px solid color-mix(in srgb, var(--bdr) 82%, transparent);
  border-right:1px solid color-mix(in srgb, var(--bdr2) 70%, transparent);
  color:var(--tx2);
  font:700 var(--table-head-font-size) var(--sans);
  text-transform:uppercase;
  letter-spacing:.04em;
  text-align:center;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  background:var(--table-head-bg);
}
.perf-table thead th:last-child { border-right:none; }
.perf-table tbody td {
  padding:var(--table-cell-pad-y) var(--table-cell-pad-x);
  border-right:1px solid color-mix(in srgb, var(--bdr2) 70%, transparent);
  border-bottom:1px solid color-mix(in srgb, var(--bdr2) 70%, transparent);
  font-family:var(--mono);
  font-size:var(--table-font-size);
  font-weight:600;
  color:var(--tx);
  text-align:center;
  white-space:nowrap;
  background:var(--table-cell-bg);
}
.perf-table-transposed th {
  width:52%;
  min-width:0;
  padding:4px 6px;
  border-right:1px solid color-mix(in srgb, var(--bdr2) 64%, transparent);
  border-bottom:1px solid color-mix(in srgb, var(--bdr2) 64%, transparent);
  /* Cell surface, NOT --table-head-bg. This is a row-label column, not a
     column header, and the head surface is lopsided between themes: a faint
     recess on white (~1.03:1) but --sur-raised on dark, two steps up from the
     cell, which drew a light bar down the whole table. The label already reads
     as a label by type -- uppercase sans in --tx2 against mono --tx values --
     and the row border separates them. Same reasoning as the section-header
     rows below, which already say "no grey". */
  background:var(--table-cell-bg);
  color:var(--tx2);
  font:700 var(--table-head-font-size) var(--sans);
  text-transform:uppercase;
  letter-spacing:.04em;
  text-align:left;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.perf-table-transposed td {
  width:36%;
  min-width:0;
  overflow:hidden;
  text-overflow:ellipsis;
}
.perf-table .perf-unit {
  width:12%;
  min-width:0;
  color:var(--unit-color);
  font:600 var(--table-head-font-size) var(--sans);
  text-align:center;
  overflow:hidden;
  text-overflow:ellipsis;
}
.perf-table tbody td:last-child { border-right:none; }

.perf-table tbody tr:hover > :is(td, th),
.admin-table tbody tr:hover > :is(td, th),
.lp-table tbody tr:hover > :is(td, th),
.asm-table tbody tr:hover > :is(td, th),
.tbl-excel tbody tr:hover > :is(td, th),
.eol-eta-table tbody tr:hover > :is(td, th),
#adminProductsTable tbody tr:hover > :is(td, th) {
  background:color-mix(in srgb, var(--table-row-hover-bg) 72%, var(--sur));
}

/* Quiet table scan style: row rhythm over spreadsheet gridlines. */
.perf-table thead th,
.admin-table thead th,
.asm-table thead th,
.eol-eta-table thead th {
  border-right:none;
  border-left:none;
  border-bottom:1px solid color-mix(in srgb, var(--bdr) 78%, transparent);
}
.perf-table tbody td,
.admin-table tbody td,
.perf-table-transposed th,
.asm-table tbody td,
.eol-eta-table tbody td {
  border-right:none;
  border-left:none;
  border-bottom:1px solid color-mix(in srgb, var(--bdr2) 68%, transparent);
}
.perf-table tbody tr:last-child > :is(td, th),
.admin-table tbody tr:last-child > :is(td, th),
.asm-table tbody tr:last-child > :is(td, th),
.eol-eta-table tbody tr:last-child > :is(td, th) {
  border-bottom:none;
}

/* Shared column resizing for generated/result data tables. */
.resizable-table th,
.resizable-table td {
  position: relative;
  max-width: none;
}
.resizable-table .table-resize-handle {
  position: absolute;
  top: 0;
  right: -3px;
  z-index: 2;
  width: 7px;
  height: 100%;
  cursor: col-resize;
  touch-action: none;
  user-select: none;
}
.resizable-table .table-resize-handle::after {
  content: "";
  position: absolute;
  top: 20%;
  bottom: 20%;
  left: 3px;
  width: 1px;
  background: transparent;
}
.resizable-table .table-resize-handle:hover::after,
.resizable-table.is-resizing-columns .table-resize-handle::after {
  background: var(--acc);
}
.table-resize-active {
  cursor: col-resize;
  user-select: none;
}

@media (max-width: 920px) {
  .r-result-grid {
    grid-template-columns:1fr;
  }
}
.lp-results {
  margin-top:22px;
  padding-top:14px;
}
.lp-results-title {
  font-size:var(--font-small);
  font-weight:800;
  margin-bottom:12px;
  color:var(--tx);
}
.lp-result-block {
  margin-bottom:18px;
}
.lp-result-name {
  font-size:var(--font-small);
  font-weight:700;
  color:var(--tx2);
  margin-bottom:8px;
}
.lp-result-grid {
  display:grid;
  grid-template-columns:1fr;
  gap:10px;
  max-width:560px;
}
.lp-table-wrap {
  min-width:0;
  max-width:100%;
  /* Clip only — no horizontal scrollbar; tables fit via fixed % + ellipsis. */
  overflow-x:hidden;
  margin-bottom:14px;
}
.lp-table {
  font-size:var(--font-tiny);
  margin-left:0;
}
.lp-wide-table {
  width:100%;
  table-layout:fixed;
  font-size:var(--font-tiny);
}
.lp-wide-table th,
.lp-wide-table td {
  padding:3px 5px;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.lp-wide-table .lp-unit-row th {
  font:700 10px var(--sans);
  text-transform:none;
  letter-spacing:0;
  color:var(--unit-color);
  background:var(--sur);
  border-bottom:2px solid var(--bdr);
}
html[data-theme="dark"] .lp-wide-table .lp-unit-row th {
  background:var(--sur);
}

/* LP sub-column headers in grouped compare table */
.lp-wide-table .lp-cmp-variant-hdr {
  font-size: 10px; font-weight: 700; text-transform: none; letter-spacing: 0;
  color: var(--unit-color);
  background: var(--sur);
  text-align: center;
  border-right: 1px solid var(--bdr2);
  border-bottom: 2px solid var(--bdr);
}
html[data-theme="dark"] .lp-wide-table .lp-cmp-variant-hdr {
  background: var(--sur);
}

/* Greek/symbol spans inside uppercase th/div — must not be transformed */
.sym { text-transform: none; }
.perf-sec-eta { margin-top: 18px; }

/* Section header rows inside perf tables — subtle inline label, no grey */
.perf-section-header th.perf-sec {
  font-size: var(--font-ui-xs); font-weight: 700; text-transform: uppercase;
  letter-spacing: .07em; color: var(--tx2);
  padding: 12px 6px 3px;
  background: transparent;
  border-top: 1px solid var(--bdr2);
  border-bottom: none;
  text-align: left;
}
.perf-section-header:first-child th.perf-sec {
  border-top: none;
  padding-top: 4px;
}
/* Inline unit suffix in transposed table value cells */
.tbl-unit {
  font:600 var(--table-head-font-size) var(--sans);
  color:var(--unit-color);
  margin-left:2px;
}
.sym-keepcase {
  text-transform:none;
}
/* A result cell the run itself flagged as not knowable (today: winding-frame
   currents of a PMSM whose star/delta build is unknown). The number stays
   readable — it is correct for a star build — but must not read as settled. */
.tbl-cell-uncertain {
  color:var(--tx2);
  font-style:italic;
}
/* A load point the run marked as not reachable (today: beyond the inverter's
   voltage limit). Its numbers stay for diagnosis, greyed out across the whole
   row so it cannot be read as a valid point; the tooltip names the reason.
   Two classes, so it outranks `.perf-table tbody td` / `.lp-wide-table tbody th`. */
.perf-table :is(td, th).tbl-cell-invalid {
  color:var(--tx3);
}
/* Two-column layout for transposed table when unit is inline */
.perf-table-transposed.perf-unit-inline th { width:60%; }
.perf-table-transposed.perf-unit-inline td { width:40%; }
.lp-wide-table tbody th {
  color:var(--tx2);
  background:var(--bg);
  font:700 var(--table-head-font-size) var(--sans);
  text-transform:uppercase;
  letter-spacing:.04em;
  text-align:left;
}
html[data-theme="dark"] .lp-wide-table tbody th {
  background:var(--sur-raised);
  color:#d4d4d8;
}
.lp-table th,
.lp-table td {
  padding:3px 5px;
}
@media (max-width: 1180px) {
  .lp-result-grid {
    grid-template-columns:1fr;
  }
}

details { margin-top:14px; }
details summary { font-size:var(--font-tiny); color:var(--tx3); cursor:pointer; user-select:none; padding:3px 0; }
details summary:hover { color:var(--tx2); }
.r-cap-debug { margin-top:8px; }
.r-cap-debug > summary { font-weight:600; }
pre {
  font-family:var(--mono); font-size:var(--font-tiny); color:var(--tx2);
  background:var(--sur); border:1px solid var(--bdr2);
  padding:8px 10px; overflow:auto; max-height:260px; margin-top:4px; line-height:1.5;
}

/* ── Modals ── */
/* The modal is painted at --sur-raised, so the page ramp (bg -> sur ->
   sur-raised) is one step too low inside it: a table's cells land darker than
   the box and its header lands identical to it. Re-base the table surfaces
   once, here, instead of patching every modal that happens to hold a table. */
.modal-box {
  --table-cell-bg: var(--sur-raised);
  --table-head-bg: var(--table-head-bg-raised);
  background:var(--modal-bg);
  border:1px solid var(--paper-border);
  border-radius:var(--paper-radius);
  box-shadow:var(--paper-shadow);
  width:min(440px,94vw);
  max-height:90vh;
  display:flex; flex-direction:column;
  animation:m-in .15s ease;
}
.modal-box--w-440 { max-width:440px; }
.modal-box--w-380 { max-width:380px; }
/* Drawing modal only (panels.drawing_modal) — 30% over modal-box--w-680, a
   size of its own rather than resizing every other modal that reuses w-680
   (RFQ, pump add, the param editor). */
.modal-box--w-880 { width:min(880px, 94vw); }
/* Mesh preview only. 20% over w-880 -- owner, 2026-09-21: a mesh is looked at,
   and the toolbar, the Parts box and the picture were sharing 880px. */
.modal-box--w-1056 { width:min(1056px, 96vw); max-width:96vw; }
/* Drag the bottom-right corner to make it bigger. The browser's own `resize`, not a
   drag handler: it needs only a scrollport, and `.modal-box:has(> .modal-content--fit)`
   further down sets `overflow:visible` -- which is exactly what switches `resize` off
   (CSS UI 4: `resize` does not apply where the computed overflow is `visible`), and
   `max-height:none` with it. That rule is two classes and comes LATER, so a two-class
   selector here loses the tie and the grip does nothing at all: measured, a real mouse
   drag on the corner moved the box by zero. Hence `.modal-box.modal-box--resize:has(...)`
   -- three classes, so it wins wherever either rule sits in the file.
   The picture grows with the box (the two rules under it) and `shared/field-viewer.js`
   watches the stage with a `ResizeObserver`, so the GL view follows; a window-only
   listener never hears a dragged corner. */
.modal-box--resize,
.modal-box.modal-box--resize:has(> .modal-content--fit) {
  resize: both;
  overflow: auto;
  min-width: 420px;
  min-height: 360px;
  max-width: 96vw;
  max-height: 92vh;
}
/* Only where the content is a PICTURE. A resizable dialog holding a form or a table
   keeps its own layout and just gets taller; turning every one of them into a flex
   column would re-lay-out content this modifier was never asked to touch. */
.modal-box--resize > .modal-content--fit:has(.fv-stage) {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
/* `flex-basis`, NOT `height: auto`. `.fv-canvas` is absolutely positioned, so the
   stage holds nothing in normal flow: an `auto` basis measures 0 and the picture
   collapses onto its 320px floor -- which is how a window meant to be 20% BIGGER came
   out shorter. Given the height as the basis it opens at that size and then grows and
   shrinks with the box, which is the whole point of the corner. */
.modal-box--resize .fv-stage--boxed { flex: 1 1 min(78vh, 672px); height: auto; }
.modal-box--min-w-340 { min-width:340px; }
.modal-box--step-preview {
  width:min(980px,94vw);
  max-width:94vw;
}
.modal-box--step-preview,
.modal-box--stable-h {
  height:min(760px,88vh);
}
@keyframes m-in { from{opacity:0;transform:translateY(-6px)} to{opacity:1;transform:none} }
.modal-head {
  display:flex; align-items:center; justify-content:space-between;
  padding:9px 14px; border-bottom:1px solid var(--bdr);
  flex-shrink:0;
  cursor:grab; user-select:none;
  /* Above .modal-content so the head's own controls are not covered by body
     cards. The tooltip bubble no longer needs this: it is drawn in the top
     layer (js/tooltip.js), above every stacking context on the page. */
  position:relative;
  z-index:2;
}
.modal-head-title { display:inline-flex; align-items:center; gap:6px; overflow:visible; font-size:var(--font-small); font-weight:700; text-transform:uppercase; letter-spacing:.05em; }
.modal-title-info { letter-spacing:0; text-transform:none; }
.modal-close { background:none; border:none; color:var(--tx3); cursor:pointer; display:flex; padding:2px; user-select:none; }
body.is-modal-drag, body.is-modal-drag * { cursor:grabbing !important; }
.modal-close:hover { color:var(--tx); }
.modal-content {
  padding:16px 20px 20px;
  overflow:auto;
  min-width:0;
  flex:1;
}
/* Short dialogs: size to content, never create an inner scrollport — a useless
   scrollbar on a dialog that fits. (It used to clip the tooltip bubble too;
   a top-layer popover cannot be clipped by anything.) */
.modal-content--fit {
  flex:0 0 auto;
  overflow:visible;
}
.modal-box:has(> .modal-content--fit) {
  max-height:none;
  overflow:visible;
}
.modal-content > * {
  max-width:100%;
}
.modal-content :is(p, li, .modal-confirm-text, .projects-delete-copy, .note) {
  white-space:normal;
  overflow-wrap:break-word;
  word-break:normal;
}
.modal-content :is(table, pre, code) {
  word-break:normal;
  overflow-wrap:normal;
}
.modal-confirm-text { margin:0; font-size:var(--font-small); color:var(--tx2); }
.drop-zone {
  border:1px dashed var(--bdr); padding:24px 14px;
  text-align:center; cursor:pointer; position:relative;
  margin-bottom:10px;
}
.drop-zone:hover,.drop-zone.over { border-color:var(--acc); background:var(--acc2); }
.drop-zone input[type="file"] { position:absolute; inset:0; opacity:0; cursor:pointer; width:100%; height:100%; }
.drop-txt { font-size:var(--font-small); color:var(--tx2); }
.drop-hint { font-size:var(--font-tiny); color:var(--tx3); margin-top:3px; }
.drop-fname { font-size:var(--font-tiny); font-family:var(--mono); color:var(--acc); margin-top:5px; min-height:13px; }
.modal-foot { display:flex; gap:6px; justify-content:flex-end; align-items:center; margin-top:8px; }
/* When footer is a direct child of .modal-box (not inside .modal-content), add inset padding */
.modal-box > .modal-foot {
  margin-top: 0;
  padding: 12px 18px 18px;
}
.step-preview-modal-content {
  display:flex;
  flex-direction:column;
  gap:10px;
  min-height:0;
  padding:12px;
}
.step-preview-toolbar {
  display:flex;
  align-items:center;
  min-height:22px;
}
.step-preview-name {
  color:var(--tx2);
  font-family:var(--mono);
  font-size:var(--font-tiny);
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.step-preview-stage {
  position:relative;
  flex:1;
  min-height:420px;
  overflow:hidden;
  border:1px solid var(--bdr);
  border-radius:var(--paper-radius);
  background:var(--sur);
  cursor:grab;
  touch-action:none;
  user-select:none;
}
.step-preview-stage:active {
  cursor:grabbing;
}
.step-preview-canvas {
  display:block;
  width:100%;
  height:100%;
}


/* load point table */
.lp-table {
  width:100%;
  table-layout:fixed;
  border-collapse:collapse;
  margin-bottom:6px;
  font-size:var(--font-ui-xs);
  --lp-fix-spd-w: 26px;
  --lp-clt-w: 26px;
  --lp-del-w: 22px;
  --lp-action-w: calc(var(--lp-fix-spd-w) + var(--lp-del-w));
}
.lp-table thead th {
  text-align:left;
  font-weight:600;
  color:var(--tx3);
  padding:3px 4px 4px;
  border-bottom:1px solid var(--bdr2);
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.r-cap-lifetime-total.r-cap-lifetime-total--ok > :is(td, th) {
  color:var(--grn);
  background:color-mix(in srgb, var(--grn) 10%, var(--sur));
}
.r-cap-lifetime-total.r-cap-lifetime-total--warn > :is(td, th) {
  color:var(--amb);
  background:color-mix(in srgb, var(--amb) 10%, var(--sur));
}
.r-cap-lifetime-total.r-cap-lifetime-total--err > :is(td, th) {
  color:var(--red);
  background:color-mix(in srgb, var(--red) 10%, var(--sur));
}
.lp-table td {
  padding:2px 3px;
  vertical-align:middle;
  overflow:hidden;
}
.lp-table input[type="text"],
.lp-table input[type="number"] {
  width:100%;
  min-width:0;
  padding:2px 3px;
  font-size:var(--font-ui-xs);
  background:var(--sur);
  border:1px solid var(--bdr2);
  color:var(--tx);
  border-radius:2px;
  box-sizing:border-box;
}
/* equal data cols; narrow fix-spd + delete only. --lp-cable-cols adds the
   DQModel T_cable column while a cable is in the calculation. */
.lp-col-field {
  width: calc((100% - var(--lp-action-w)) / (5 + var(--lp-cable-cols, 0)));
}
.lp-table.has-fixed-speed .lp-col-field {
  width: calc((100% - var(--lp-action-w)) / (6 + var(--lp-cable-cols, 0)));
}
.lp-table.has-capacitor-temp { --lp-action-w: calc(var(--lp-fix-spd-w) + var(--lp-clt-w) + var(--lp-del-w)); }
.lp-table.has-capacitor-temp .lp-col-field { width: calc((100% - var(--lp-action-w)) / (7 + var(--lp-cable-cols, 0))); }
.lp-table.has-capacitor-temp.has-fixed-speed .lp-col-field { width: calc((100% - var(--lp-action-w)) / (8 + var(--lp-cable-cols, 0))); }
/* Pump rows: ID, pressure, flow, T_fluid + the three motor temperatures — seven
   equal columns and no Fix toggle, so only the delete (and CLT) column is fixed. */
.lp-table--pump { --lp-action-w: var(--lp-del-w); }
.lp-table--pump .lp-col-field { width: calc((100% - var(--lp-action-w)) / (7 + var(--lp-cable-cols, 0))); }
.lp-table--pump.has-capacitor-temp { --lp-action-w: calc(var(--lp-clt-w) + var(--lp-del-w)); }
.lp-table--pump.has-capacitor-temp .lp-col-field { width: calc((100% - var(--lp-action-w)) / (9 + var(--lp-cable-cols, 0))); }
.lp-table.has-cable-temp { --lp-cable-cols: 1; }
.lp-table:not(.has-fixed-speed) .lp-speed-col { display: none; }
.lp-table:not(.has-capacitor-temp) .lp-cap-temp-col { display: none; }
.lp-table:not(.has-capacitor-temp) .lp-cap-time-col { display: none; }
.lp-table:not(.has-cable-temp) .lp-cable-temp-col { display: none; }
.lp-col-spden { width: var(--lp-fix-spd-w); }
.lp-col-capten { width: var(--lp-clt-w); }
.lp-col-del   { width: var(--lp-del-w); }
.lp-table th.lp-speed-toggle,
.lp-table td.lp-speed-toggle,
.lp-table th.lp-cap-temp-toggle,
.lp-table td.lp-cap-temp-toggle {
  text-align: center;
  padding-left: 0;
  padding-right: 0;
}
/* disabled speed input */
.lp-table input:disabled {
  opacity:0.3;
  cursor:default;
}
.lp-table input.lp-input--invalid {
  border-color: var(--red);
  box-shadow: inset 0 0 0 1px var(--red);
  background: color-mix(in srgb, var(--red) 10%, var(--sur));
}
#param-modal-body #ps-load .lp-table input.lp-input--invalid {
  border: none;
  box-shadow: inset 0 -2px 0 var(--red);
  background: color-mix(in srgb, var(--red) 12%, transparent);
}

.lp-del {
  background:none;
  border:none;
  color:var(--red);
  cursor:pointer;
  line-height:1;
  padding:0;
  display:flex;
  align-items:center;
  opacity:0.5;
}
.lp-del:hover { opacity:1; }
/* LP action bar */
.lp-actions {
  display:flex;
  gap:4px;
  margin-top:6px;
  justify-content:flex-start;
  align-items:center;
}
.lp-actions .btn {
  line-height:1;
}
.lp-csv-btn svg,
.lp-csv-btn i[data-lucide] {
  width:var(--icon-action);
  height:var(--icon-action);
  flex-shrink:0;
  vertical-align:0;
}
.cond-fields--hidden { display:none; }
.cond-fields-body { margin-top:6px; }
.lp-apply-all-label {
  white-space:nowrap;
  flex-shrink:0;
  margin-left:auto;
  font-size:var(--font-ui-xs);
}

/* === admin_components.html === */
.empty-note { font-size:var(--font-small); color:var(--tx3); padding:8px 0; }
.comp-page-grid {
  display:flex;
  flex-direction:column;
  gap:var(--comp-panel-gap);
  width:100%;
  max-width:980px;
  margin:0 auto;
}
.comp-panel {
  width:100%;
  max-width:none;
  min-height:auto;
  margin:0;
}
.admin-panel.comp-panel {
  min-height:auto;
}
.comp-section-title { margin-bottom:8px; display:flex; align-items:center; gap:6px; }
.comp-section-title .info-tooltip-host { flex-shrink:0; }
.comp-section-actions {
  display:flex;
  justify-content:flex-start;
  gap:8px;
  margin-top:10px;
}
.comp-panel .comp-section-actions {
  margin-top:14px;
  padding-top:0;
  border-top:none;
}
.comp-panel > .comp-section-title ~ .doc-surface .doc-surface-title {
  display:none;
}
/* Edit form is NOT a flex item that can shrink (min-height:0 + flex-shrink
   clipped mid-panel and punched holes through cards). Gap between field
   panels lives on the inner wrapper; Documents stays a sibling of the form
   inside .comp-page-grid so upload/link/delete forms are not nested. */
.comp-page-edit-form {
  display:block;
  flex:0 0 auto;
  min-width:0;
}
.comp-page-edit-fields {
  display:flex;
  flex-direction:column;
  gap:var(--comp-panel-gap);
}
/* Wire catalog inline-edit table */
.admin-table.perf-table.wire-catalog-table {
  table-layout:fixed;
  width:100%;
  min-width:0;
}
.admin-table.perf-table.wire-catalog-table th,
.admin-table.perf-table.wire-catalog-table td {
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.admin-table.perf-table.wire-catalog-table th:nth-child(1),
.admin-table.perf-table.wire-catalog-table td:nth-child(1) { width:25%; }
.admin-table.perf-table.wire-catalog-table th:nth-child(2),
.admin-table.perf-table.wire-catalog-table td:nth-child(2) { width:15%; }
.admin-table.perf-table.wire-catalog-table th:nth-child(3),
.admin-table.perf-table.wire-catalog-table td:nth-child(3) { width:12%; }
.admin-table.perf-table.wire-catalog-table th:nth-child(4),
.admin-table.perf-table.wire-catalog-table td:nth-child(4) { width:10%; }
.admin-table.perf-table.wire-catalog-table th:nth-child(5),
.admin-table.perf-table.wire-catalog-table td:nth-child(5) { width:10%; }
.admin-table.perf-table.wire-catalog-table th:nth-child(6),
.admin-table.perf-table.wire-catalog-table td:nth-child(6) { width:10%; }
.admin-table.perf-table.wire-catalog-table th:nth-child(7),
.admin-table.perf-table.wire-catalog-table td:nth-child(7) { width:10%; }
.admin-table.perf-table.wire-catalog-table :is(th, td).admin-actions {
  width:8%;
  min-width:64px;
  max-width:80px;
  padding-left:4px;
  padding-right:4px;
  text-align:right;
}
.admin-table.perf-table.wire-catalog-table td.wire-td-badge {
  text-align:center;
  padding:0 6px;
}
.admin-table.perf-table.wire-catalog-table td.admin-actions .admin-actions-row {
  width:100%;
}
.admin-table.perf-table.wire-edit-table,
.wire-edit-table.admin-table,
.wire-edit-table.perf-table {
  table-layout:fixed;
  width:100%;
}
.admin-table.perf-table.wire-edit-table th:nth-child(1),
.admin-table.perf-table.wire-edit-table td:nth-child(1) { width:140px; white-space:nowrap; }
.admin-table.perf-table.wire-edit-table th:nth-child(2),
.admin-table.perf-table.wire-edit-table td:nth-child(2) {
  width:280px;
  min-width:280px;
  max-width:280px;
}
.admin-table.perf-table.wire-edit-table th:nth-child(3),
.admin-table.perf-table.wire-edit-table td:nth-child(3) {
  width:56px;
  min-width:56px;
  max-width:56px;
  white-space:nowrap;
}
.admin-table.perf-table.wire-edit-table th:nth-child(4),
.admin-table.perf-table.wire-edit-table td:nth-child(4) {
  width:auto;
  text-align:left;
}
.wire-edit-table td:nth-child(2),
.wire-edit-table td:nth-child(3) {
  font-family:var(--sans);
  color:var(--tx2);
}
.wire-edit-table td:nth-child(4) {
  padding-left:8px;
  padding-right:8px;
}
.admin-table.perf-table.wire-edit-table.wire-detail-table th:nth-child(1),
.admin-table.perf-table.wire-edit-table.wire-detail-table td:nth-child(1),
.admin-table.perf-table.wire-edit-table.wire-detail-table th:nth-child(2),
.admin-table.perf-table.wire-edit-table.wire-detail-table td:nth-child(2),
.admin-table.perf-table.wire-edit-table.wire-detail-table th:nth-child(3),
.admin-table.perf-table.wire-edit-table.wire-detail-table td:nth-child(3) {
  text-align:left;
}
.admin-table.perf-table.wire-edit-table.wire-detail-table th:nth-child(4),
.admin-table.perf-table.wire-edit-table.wire-detail-table td:nth-child(4) {
  text-align:center;
}
.wire-edit-table td:has(input[type="text"]),
.wire-edit-table td:has(input[type="number"]),
.wire-edit-table td:has(select) {
  padding:0;
  line-height:0;
}
.wire-edit-table td input[type="text"],
.wire-edit-table td input[type="number"],
.wire-edit-table td select {
  display:block;
  width:100%;
  height:var(--admin-table-row-h);
  min-height:var(--admin-table-row-h);
  padding:0 22px 0 6px;
  margin:0;
  border:none;
  border-radius:0;
  background-color:transparent;
  color:var(--tx);
  font-size:var(--table-font-size);
  font-family:inherit;
  box-sizing:border-box;
  outline:none;
  background-position:right 6px center;
}
.wire-edit-table td:has(select.field-select) {
  padding:3px 8px;
  line-height:normal;
}
.wire-edit-table td select.field-select {
  min-height:calc(var(--admin-table-row-h) - 6px);
  height:calc(var(--admin-table-row-h) - 6px);
  border:1px solid var(--bdr);
  border-radius:var(--radius-input);
  background-color:var(--sur);
  cursor:pointer;
}
/* === auth pages (login / register / forgot / reset) === */
/* Login only: extra flex layer so the card centers in the band below the topbar. */
.auth-login-frame {
  flex:1;
  min-height:0;
  width:100%;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  box-sizing:border-box;
  padding:var(--page-wrap-pad-y) var(--page-wrap-pad-x);
}
.auth-login-frame .auth-panel {
  flex:0 0 auto;
  width:100%;
  max-width:560px;
}
.auth-wrap {
  flex:1;
  min-height:0;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  width:100%;
  box-sizing:border-box;
  padding:var(--page-wrap-pad-y) var(--page-wrap-pad-x);
}
.auth-panel {
  width:100%;
  max-width:560px;
  padding:var(--page-panel-pad-y) var(--page-panel-pad-x);
  background:var(--paper-bg);
  border:1px solid var(--paper-border);
  border-radius:var(--paper-radius);
  overflow: hidden;
  box-shadow:var(--paper-shadow);
}
.auth-title {
  font-size:var(--font-sub);
  font-weight:700;
  text-transform:uppercase;
  letter-spacing:.05em;
  color:var(--tx2);
  margin-bottom:8px;
}
.auth-subtitle {
  font-size:var(--font-small);
  color:var(--tx3);
  margin-bottom:18px;
}
.auth-actions {
  display:flex;
  gap:8px;
  align-items:center;
  margin-top:var(--form-row-gap);
}
.auth-links {
  display:flex;
  gap:8px;
  margin-top:14px;
  font-size:var(--font-small);
}
.auth-links a {
  display:inline-flex;
  align-items:center;
  gap:5px;
  color:var(--tx2);
  text-decoration:none;
  transition:color .12s ease;
}
.auth-links a:hover,
.auth-links a:focus-visible {
  color:var(--acc);
  text-decoration:none;
}
.auth-note { font-size:var(--font-tiny); color:var(--tx3); margin-bottom:12px; }
.auth-honeypot {
  position:absolute;
  left:-9999px;
  opacity:0;
}

/* `hidden` means hidden, everywhere.
   The attribute is only `display:none` in the *browser's* stylesheet, so any
   `display` in this file silently outranks it. That cost us twice: a tab panel
   that was also a `.comp-page-grid` stayed open, and the hub's carousel nav
   (`display:flex`) showed its arrows to every user, including the ones with a
   single page. Fix the class of bug once rather than each new instance. */
[hidden] { display: none !important; }

/* === admin_edit.html + admin_component_edit.html === */
.comp-block { border:none; border-radius:0; padding:var(--admin-block-pad) 0; margin-bottom:10px; background:var(--sur); }
.comp-head { display:flex; align-items:center; gap:10px; margin-bottom:10px; }
.comp-head--tight-top { margin-top:2px; margin-bottom:8px; }
.comp-head--tight-bottom { margin-bottom:8px; }
.comp-head--section-gap { margin-top:var(--comp-head-section-gap-top); margin-bottom:14px; }
.comp-head--section-gap-lg { margin-top: calc(var(--comp-head-section-gap-top) + 10px); margin-bottom:14px; }
.comp-title { font-weight:700; font-size:var(--font-small); text-transform:uppercase; letter-spacing:.04em; color:var(--tx2); flex:1; }
.comp-head-badge {
  display:inline-flex;
  align-items:center;
  gap:5px;
  font-size:10px;
  font-weight:700;
  text-transform:uppercase;
  letter-spacing:.05em;
  padding:2px 7px;
  border-radius:999px;
  border:1px solid var(--muted-bdr);
  background:var(--muted-bg);
  color:var(--muted-fg);
}
.comp-head-badge svg {
  flex:0 0 auto;
}
.comp-head-badge--danger { background:var(--danger-bg); border-color:var(--danger-bdr); color:var(--danger-fg); }
.comp-head-badge--info { background:var(--info-bg); border-color:var(--info-bdr); color:var(--info-fg); }
.comp-head-badge--success { background:var(--success-bg); border-color:var(--success-bdr); color:var(--success-fg); }
/* A release state in a list: the mark alone, no pill. A bordered chip on
   every row is a lot of furniture for one fact, and it took the room the
   name needed. Same four state inks the chips use, so a mark and a chip can
   never disagree about what green means. */
.state-mark {
  /* Inline-block with a containing block of its own, so the count can be lifted
     **onto** the glyph instead of standing next to it. In flow the count was a
     second character taking its own width, which is what pushed everything
     along the row; taken out of flow it costs nothing but the 3px of overhang
     below. */
  display:inline-block;
  position:relative;
  margin-left:6px;
  margin-right:3px;
  white-space:nowrap;
}
.state-mark svg { vertical-align:-2px; }
/* An unapproved component says so on the card itself, not only in the corner:
   the panel that carries the release controls takes a coloured left edge in
   that state's own ink. Released takes none — most components are drafts most
   of the time while they are being built, and a page that is amber all day
   stops meaning anything, so the edge exists to mark the exception and
   disappears the moment the part is approved.

   Every panel on the page, not only the one holding the controls: the state
   belongs to the component, and the component is all of these cards.

   Driven by the mark already in the release corner (`:has`), so no editor
   template learns about release state to draw it, and the border can never
   disagree with the mark it is reading. Keyed on that corner's refresh target,
   which only a page showing release controls renders — a list of components
   with draft marks in it must never paint its own panels. */
.admin-page-root:has([data-refresh-target="component-release-controls"] .state-mark--warn) .comp-panel,
.comp-panel:has(> .mat-toolbar .state-mark--warn)   { border-color:var(--warn-fg); }
.admin-page-root:has([data-refresh-target="component-release-controls"] .state-mark--info) .comp-panel,
.comp-panel:has(> .mat-toolbar .state-mark--info)   { border-color:var(--info-fg); }
.admin-page-root:has([data-refresh-target="component-release-controls"] .state-mark--danger) .comp-panel,
.comp-panel:has(> .mat-toolbar .state-mark--danger) { border-color:var(--danger-fg); }

/* The 6px above is for a mark that follows a name in a list. In the release
   corner the row is a flex with its own even gap, and the margin added to one
   side of the mark only — which is what made those three controls look badly
   set. */
/* In the corner the mark is one of three controls on a flex row and carries no
   count, so it goes back to being centred in that row. Inline layout plus the
   `-2px` the list version needs for its superscript left it sitting two pixels
   below the icon and the button beside it. */
.mat-toolbar-actions--release .state-mark {
  margin-left:0;
  display:inline-flex;
  align-items:center;
}
.mat-toolbar-actions--release .state-mark svg { vertical-align:0; }
.state-mark--success { color:var(--success-fg); }
/* Released is the one solid mark: the seal filled in its own green, the tick
   knocked out of it in the ink every filled surface here uses. The other
   states stay outlines, which is the difference between "stamped" and "not
   stamped yet" said in shape and not only in colour.

   The seal keeps a **green** outline, not a white one. Painting the whole
   glyph's stroke in the page ink ate the outer contour, and a filled seal then
   measured a size smaller than the outlined one beside it — two states of one
   scale must be the same size. So the first path (the seal) is filled and
   stroked in the state's own colour, and everything after it (the tick) is the
   knocked-out mark. */
.state-mark--success svg > :first-child { fill:var(--seal-fill); stroke:var(--seal-fill); }
.state-mark--success svg > :not(:first-child) { fill:none; stroke:var(--seal-mark); }
.state-mark--warn    { color:var(--warn-fg); }
.state-mark--info    { color:var(--info-fg); }
.state-mark--danger  { color:var(--danger-fg); }
.state-mark--muted   { color:var(--tx3); }
/* Somebody wrote here. Not `--tx3`: at the muted ink it was the same weight as
   the table furniture around it, which is the opposite of what a mark saying
   "there is something to read on this row" is for. `--info-fg`, not `--acc`:
   the accent is the brand colour and a theme repaints it — Bühler does — so a
   mark that means one thing must not be painted in the one ink that changes
   meaning per theme. `--info-fg` is a blue in all six themes, checked, which
   is what makes "reading and talking are blue" true everywhere. Approved stays
   green and a draft stays amber. */
.state-mark--said    { color:var(--mark-read); }
/* The count rides on the mark like a superscript, not beside it as a second
   word: it belongs to that glyph — three comments, one draft — and setting it
   on the baseline made the pair read as two separate things. */
/* Out of flow, pinned to the glyph's top-right corner — a count badge, which
   is what "superscript" means for an icon. In flow it was a character of its
   own and took a character's width; this takes none. */
.state-mark-count,
.comp-release-story-count {
  position:absolute;
  top:-4px;
  right:-4px;
  font-size:9px;
  font-weight:700;
  font-variant-numeric:tabular-nums;
  line-height:1;
  pointer-events:none;
}

.comp-head-badge--warn { background:var(--warn-bg); border-color:var(--warn-bdr); color:var(--warn-fg); }
.comp-head-badge--muted { background:var(--muted-bg); border-color:var(--muted-bdr); color:var(--muted-fg); }
.run-status-badge { text-transform:none; letter-spacing:0; font-size:11px; font-weight:600; }
.admin-table--runs.perf-table { table-layout:fixed; width:100%; min-width:0; }
.admin-table--runs .admin-date { white-space:nowrap; font-size:var(--font-small); font-variant-numeric:tabular-nums; }
.admin-table--runs th:nth-child(2),
.admin-table--runs td:nth-child(2) { width:3.25rem; }
.admin-table--runs th:nth-child(5),
.admin-table--runs td:nth-child(5),
.admin-table--runs th:nth-child(6),
.admin-table--runs td:nth-child(6) { width:6.5rem; }
.admin-table--runs th:nth-child(4),
.admin-table--runs td:nth-child(4) { width:5.5rem; }
.admin-table--runs th:nth-child(7),
.admin-table--runs td:nth-child(7) { width:4.5rem; }
.comp-actions { display:inline-flex; align-items:center; gap:8px; margin-left:auto; }
/* Live geometry uses the same section slot as the parameter sheets. */
.gerotor-section-drawing { --dwg-paper:var(--sur); width:100%; max-width:600px; align-self:center; }
.gerotor-section-drawing .dwg-layer { flex:none; }
.gerotor-section-drawing:not(.is-zoomed) .dwg-layer { touch-action:pan-y; }
.gerotor-section-drawing .dwg-zoom { right:12px; }
.gerotor-section-drawing text.dwg-callout { stroke-width:2px; }
.gerotor-section-drawing text:not(.dwg-callout) { stroke:none; }
.gerotor-section-drawing .dwg-dim:is(.is-hover, :focus-within) polyline { stroke:var(--acc); }
.gerotor-section-drawing .dwg-dim:is(.is-hover, :focus-within) polygon { fill:var(--acc); }
.gerotor-section-drawing[data-gerotor-drawing-readonly] .dwg-callout { cursor:default; }
.gerotor-section-drawing .comp-drawing__cap { padding-inline:8px; }
/* The speeds field takes two columns of the grid: a list of numbers. */
.gerotor-view__wide { grid-column:span 2; }
.gerotor-view__plot { position:relative; flex:1; min-height:0; aspect-ratio:auto; grid-template:minmax(0, 1fr) / minmax(0, 1fr); }  /* the rest of the fixed stage */
.gerotor-view__plot .r-plot { grid-template:minmax(0, 1fr) / minmax(0, 1fr); }  /* the chart fits the stage, never taller */
/* The Performance tab's two modes (Curves | Size for duty): each mode's inputs, actions and its own plot stage in one
   column that takes the rest of the pane; the sizes table scrolls inside the stage, never past it. */
.gerotor-view__mode { display:flex; flex-direction:column; gap:8px; flex:1; min-height:0; }
.gerotor-view__mode > .gerotor-view__plot { min-height:10rem; }  /* the pane scrolls before the results vanish */
.gerotor-view__plot > .admin-table-wrap--scroll { max-height:100%; }
.gerotor-view__plot .perf-table :is(th, td) { white-space:normal; }  /* headers and a list of speeds wrap to the stage */
.console-nav-item[data-gerotor-perf-mode="curves"] { --nav-icon: var(--app-hue-dqmodel); }
.console-nav-item[data-gerotor-perf-mode="size"] { --nav-icon: var(--app-hue-catalog); }
/* A section that belongs to some answers only (`data-only-for`): `hidden` beats the panel's flex. */
.comp-panel[hidden] { display:none; }
/* Engineering preview: quiet translucent layers keep the kinematic contours legible. */
.gerotor-profile-housing { fill:color-mix(in srgb, var(--tx2) 47%, var(--sur)); stroke:color-mix(in srgb, var(--tx) 78%, var(--tx2)); stroke-width:.24; opacity:.78; }
.gerotor-profile-outer-rotor { fill:color-mix(in srgb, var(--tx2) 25%, var(--sur)); stroke:color-mix(in srgb, var(--tx) 78%, var(--tx2)); stroke-width:.22; opacity:.9; }
.gerotor-profile-housing-bore { fill:none; stroke:color-mix(in srgb, var(--tx) 70%, var(--tx2)); stroke-width:.18; stroke-dasharray:.48 .30; opacity:.8; }
.gerotor-profile-cavity { fill:color-mix(in srgb, var(--sur) 82%, transparent); stroke:color-mix(in srgb, var(--tx2) 74%, transparent); stroke-width:.18; opacity:.88; }
.gerotor-profile-inner { fill:color-mix(in srgb, var(--acc) 13%, var(--sur)); stroke:color-mix(in srgb, var(--tx) 78%, var(--tx2)); stroke-width:.22; opacity:.88; }
.gerotor-profile-bore { fill:color-mix(in srgb, var(--sur) 86%, transparent); stroke:color-mix(in srgb, var(--tx) 78%, var(--tx2)); stroke-width:.19; opacity:.9; }
.gerotor-profile-guide { fill:none; stroke:var(--tx3); stroke-width:.1; stroke-dasharray:.42 .34; opacity:.42; }
.gerotor-profile-center { fill:color-mix(in srgb, var(--tx) 82%, transparent); }
.gerotor-ports-outer-rotor { fill:color-mix(in srgb, var(--tx2) 18%, var(--sur)); stroke:color-mix(in srgb, var(--tx2) 74%, transparent); stroke-width:.18; opacity:.48; }
.gerotor-ports-housing-bore { fill:none; stroke:color-mix(in srgb, var(--tx2) 74%, transparent); stroke-width:.16; stroke-dasharray:.42 .28; opacity:.58; }
.gerotor-ports-housing { fill:color-mix(in srgb, var(--tx2) 25%, var(--sur)); stroke:color-mix(in srgb, var(--tx2) 74%, transparent); stroke-width:.2; opacity:.34; }
.gerotor-ports-cavity { fill:color-mix(in srgb, var(--sur) 72%, transparent); stroke:color-mix(in srgb, var(--tx2) 62%, transparent); stroke-width:.16; opacity:.56; }
.gerotor-ports-inner { fill:color-mix(in srgb, var(--acc) 20%, transparent); stroke:color-mix(in srgb, var(--tx2) 78%, var(--acc)); stroke-width:.2; opacity:.34; }
.gerotor-ports-bore { fill:color-mix(in srgb, var(--sur) 76%, transparent); stroke:color-mix(in srgb, var(--tx2) 72%, transparent); stroke-width:.18; opacity:.5; }
.gerotor-port-inlet { fill:color-mix(in srgb, var(--grn) 38%, transparent); stroke:color-mix(in srgb, var(--grn) 80%, var(--tx2)); stroke-width:.18; opacity:.72; }
.gerotor-port-outlet { fill:color-mix(in srgb, var(--red) 36%, transparent); stroke:color-mix(in srgb, var(--red) 78%, var(--tx2)); stroke-width:.18; opacity:.72; }
/* The pipes on the kidneys: a ring at each pipe centre, the pipe's diameter. */
.gerotor-feed-inlet { fill:none; stroke:var(--grn); stroke-width:.35; }
.gerotor-feed-outlet { fill:none; stroke:var(--red); stroke-width:.35; }
/* The Edit kidney shape dialog (`gerotor-kidney.js`). New, nothing shared draws these: the part of each kidney over
   the fluid between the turned rotors (a chamber open to suction / pressure at the slider's angle), the edge being
   edited as a line from the housing axis, and that edge's row in the edge table. */
.gerotor-open-suction { fill:color-mix(in srgb, var(--grn) 72%, transparent); stroke:none; }
.gerotor-open-pressure { fill:color-mix(in srgb, var(--red) 68%, transparent); stroke:none; }
.gerotor-edge-mark { stroke:var(--acc); stroke-width:.3; stroke-dasharray:.9 .45; }
tr[data-kidney-edge].is-selected > td { background:var(--acc2); }
.perf-table tbody tr[data-kidney-reason] > td { white-space:normal; text-align:left; font-family:var(--sans); font-weight:400; }
.gerotor-kidney-stage { width:min(100%, 52vh); margin-inline:auto; }   /* the slider under it stays in view */
.motor-section-card {
  border:1px solid color-mix(in srgb, var(--bdr) 78%, transparent);
  border-radius:10px;
  background:color-mix(in srgb, var(--sur) 92%, var(--bg));
  box-shadow:0 1px 0 rgba(255,255,255,.03) inset;
}
.motor-section-card + .motor-section-card:not(.comp-panel):not(.motor-section-card--link) {
  margin-top:16px;
}
.motor-section-card__body {
  padding:14px 16px 16px;
}
.motor-section-card__body > .admin-section-head:first-child {
  margin-top:0;
}
.motor-section-card__head {
  margin-top:0;
}
.motor-section-card--collapsible {
  overflow:hidden;
}
.motor-section-card__summary {
  list-style:none;
  display:flex;
  align-items:center;
  gap:10px;
  padding:14px 16px;
  cursor:pointer;
  user-select:none;
}
.motor-section-card__summary::-webkit-details-marker {
  display:none;
}
.motor-section-card__title {
  font-size:var(--font-small);
  font-weight:700;
  color:var(--tx);
}
.motor-section-card[open] > summary > .motor-section-card__title--closed,
.motor-section-card:not([open]) > summary > .motor-section-card__title--open {
  display:none;
}
.motor-section-card__note {
  color:var(--tx3);
  font-size:var(--font-small);
}
.motor-section-card__summary > svg {
  margin-left:auto;
  color:var(--tx3);
  transition:transform .15s ease;
}
.motor-section-card[open] > .motor-section-card__summary > svg {
  transform:rotate(180deg);
}
.motor-section-card--collapsible > .motor-section-card__body {
  border-top:1px solid color-mix(in srgb, var(--bdr) 68%, transparent);
}
.abbrev-collapse { margin-top:var(--comp-head-section-gap-top); margin-bottom:10px; }
.abbrev-collapse > summary { list-style:none; cursor:pointer; display:inline-block; }
.abbrev-collapse > summary::-webkit-details-marker { display:none; }
.abbrev-collapse > summary .comp-head-badge { cursor:pointer; user-select:none; }
.abbrev-collapse > summary .comp-head-badge svg { transition:transform 0.15s; }
.abbrev-collapse[open] > summary { margin-bottom:10px; }
.abbrev-collapse[open] > summary .comp-head-badge svg { transform:rotate(180deg); }
.variant-table { width:100%; border-collapse:collapse; font-size:var(--font-small); }
.variant-table th { text-align:left; color:var(--tx3); font-weight:700; font-size:var(--font-tiny); text-transform:uppercase;
                    letter-spacing:.04em; padding:3px 5px; border-bottom:none; }
.variant-table td { padding:3px 5px; vertical-align:middle; }
.variant-table td:last-child,
.variant-table th:last-child { width:34px; text-align:center; padding-left:4px; padding-right:4px; }
.variant-table td input { width:100%; min-width:55px; background:var(--sur); border:1px solid var(--bdr);
                           color:var(--tx); font:11px var(--mono); padding:3px 6px; outline:none; border-radius:0; }
.variant-table td input:focus { border-color:var(--acc); }
.btn-danger-sm { font-size:var(--font-tiny); width:22px; height:22px; padding:0; color:var(--red); border:1px solid var(--red);
                 background:transparent; border-radius:3px; cursor:pointer; line-height:1;
                 display:inline-flex; align-items:center; justify-content:center; vertical-align:middle; }
.variant-table td:last-child .btn-danger-sm { margin:0 auto; }
.btn-danger-sm:hover { background:var(--red); color:var(--tx-on-fill); }
.note { font-size:var(--font-tiny); color:var(--tx3); margin-top:5px; }
.compare-condition-wrap {
  margin-bottom:8px;
  overflow-x:visible;
}
.compare-condition-table {
  width:100%;
  table-layout:fixed;
}
.compare-condition-table th,
.compare-condition-table td {
  min-width:0;
  padding-left:4px;
  padding-right:4px;
  white-space:nowrap;
}
.compare-condition-note { margin-bottom:8px; }
.note--new-component-id { margin:-6px 0 14px; }
.note--new-component-id-compact { margin:8px 0 0; }
.auto-grow { resize:vertical; min-height:24px; max-height:220px; overflow-y:hidden; }
.np-grid { display:grid; grid-template-columns:repeat(4,1fr); gap:6px 10px; }
/* DC has only Ntcoil + Zs here — two columns so the row matches the full-width
   magnet/wire pickers above (a 4-col grid left half the row empty). */
.np-grid--2 { grid-template-columns:repeat(2,1fr); }
/* PMSM has six winding controls; three per row keeps the required build facts
   (Ntcoil, Zs, p) on one line and the winding description on the next. */
.np-grid--3 { grid-template-columns:repeat(3,1fr); }
.opt-label { font-size:var(--font-tiny); color:var(--tx3); margin-left:3px; text-transform:none; letter-spacing:0; font-weight:400; }
.motor-geom-calib-kov { display:flex; flex-direction:column; align-items:flex-start; gap:6px; }
.motor-geom-calib-kov--full-width { width:100%; align-items:stretch; }
.kov-calibrate-bar { display:flex; align-items:center; gap:10px; margin-top:0; margin-bottom:14px; flex-wrap:wrap; }
.kov-calibrate-bar.kov-calibrate-bar--motor-tight { margin-top:var(--comp-head-section-gap-top); }
.kov-result { display:inline-flex; align-items:center; gap:8px; flex-wrap:wrap; max-width:100%; }
.kov-val { font-size:var(--font-small); font-weight:700; color:var(--acc); font-family:monospace; }
.admin-gap-bottom-md { margin-bottom:var(--form-row-gap); }
.admin-gap-bottom-12 { margin-bottom:12px; }
.admin-gap-top-md { margin-top:var(--form-row-gap); }

/* Ordinary page forms share one row rhythm. Dense engineering parameter editors
   remain on the base .fg gap and #param-modal-body's explicit compact override. */
:is(.admin-panel, .auth-panel, .settings-tabpanel, .modal-content) .fg,
.market-report-form .fg {
  row-gap:var(--form-row-gap);
}

/* Admin / modal edit forms — uniform vertical rhythm between stacked field rows.
   Margins collapse with adjacent admin-gap-* utilities (max 18px). */
.admin-panel form > .fg + .fg,
.admin-panel form > .f + .fg,
.admin-panel form > .fg + .f:not(.mat-add-prop-wrap),
.admin-panel form > .f + .f:not(.f-check):not(.mat-add-prop-wrap),
.admin-panel .comp-block > .fg + .fg,
.admin-panel .comp-block > .fg + .f:not(.mat-add-prop-wrap),
.admin-panel .comp-block > .f + .fg,
.admin-panel form > .fg + .mat-props-section,
.admin-panel form > .f + .mat-props-section,
.modal-content form > .fg + .fg,
.modal-content form > .f + .fg,
.modal-content form > .fg + .f:not(.mat-add-prop-wrap),
.modal-content form > .f + .f:not(.f-check):not(.mat-add-prop-wrap),
.modal-content form > .f + .settings-axis-limits,
.modal-content form > .settings-axis-limits + .note {
  margin-top:var(--form-row-gap);
}
.is-hidden { display:none !important; }

/* === shared admin helpers === */
.topbar-sep-text { margin-left:6px; margin-right:0; color:var(--topbar-fg3); }
.topbar-label-page { margin-left:6px; color:var(--topbar-fg); }
.chk-label { display:flex; align-items:center; gap:8px; font-size:var(--font-small); color:var(--tx2); }
.form-actions { display:flex; align-items:center; gap:8px; margin-top:var(--form-row-gap); }
.admin-table-block {
  padding:var(--admin-block-pad) 0;
  overflow:hidden;
}
.admin-table-block--slots {
  margin-bottom:0;
  padding-bottom:4px;
}
.admin-section-head {
  margin:var(--comp-head-section-gap-top) 0 10px;
}
/* .comp-block no longer adds horizontal pad (panel owns --admin-content-pad-x). */
.comp-block .admin-section-head {
  margin-left:0;
  margin-right:0;
}
.admin-inline-note {
  margin:0 0 16px;
}

/* Section drawings (panels.drawing_modal, opened from the section's own info
   icon): the picture that explains a section lives in a modal, so it shows at
   every window width. It used to float in the left canvas gutter and needed
   ~300px of free margin to appear at all.

   The whole figure area is a fixed height — never content-sized — so it can
   never push the dialog past `.modal-box`'s 90vh cap and force a scrollbar:
   `overflow:hidden` here is a backstop, the height budget is the real fix.
   Two figures sit side by side while the box is wide enough; below that they
   wrap onto their own line. A wrapping container sizes each line from its
   content, and `align-content:stretch` only hands out free height, never takes
   it away, so a tall picture in a wrapped line keeps its own height and is cut
   by `overflow:hidden`. One figure alone (the gerotor sheet dialog) therefore
   does not wrap: a single-line container's line is the container's height, so
   the figure's `height:100%` and `object-fit:contain` resolve and the whole
   picture fits. */
.comp-drawing {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  height: min(65vh, 546px);
  overflow: hidden;
}
.comp-drawing:has(> .comp-drawing__figure:only-child) {
  flex-wrap: nowrap;
}
.comp-drawing__figure {
  flex: 1 1 338px;
  min-width: 286px;
  min-height: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
}
/* Inline drawings draw in currentColor: a `--sur-raised` plate with a token
   border keeps the ink distinct from the modal in both themes. Never
   `--plot-plate`, which stays white on purpose for PDF charts. `border-box`
   keeps the padding inside the flex-computed height instead of adding to it. */
.comp-drawing__svg {
  flex: 1;
  min-height: 0;
  box-sizing: border-box;
  color: var(--tx);
  background: var(--sur-raised);
  border: 1px solid var(--bdr);
  border-radius: var(--radius-md);
  padding: 12px;
}
.comp-drawing__img {
  flex: 1;
  min-height: 0;
}
.comp-drawing__svg svg,
.comp-drawing__img {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.comp-drawing__cap {
  flex: 0 0 auto;
  margin: 6px 0 0;
  font-size: var(--font-tiny);
  color: var(--tx3);
  line-height: 1.35;
}
.inverter-schematic {
  margin: 0 0 18px;
  padding: 12px;
  border: 1px solid var(--bdr);
  border-radius: 8px;
  background: var(--sur);
}
.inverter-schematic a {
  display: block;
  cursor: zoom-in;
}
.inverter-schematic img {
  display: block;
  width: 100%;
  max-height: 440px;
  object-fit: contain;
  object-position: left center;
}
.inverter-schematic__svg {
  display: block;
  width: 100%;
  height: auto;
  max-height: 440px;
}
.inverter-schematic__strike {
  stroke: var(--red);
  stroke-width: 420;
  stroke-linecap: round;
  pointer-events: none;
}
.inverter-schematic figcaption {
  margin-top: 8px;
  color: var(--tx3);
  font-size: var(--font-tiny);
}
/* Motor model pictures on the PMSM page: two per row, natural height, so a tall
   slot picture is never clipped (the fixed-height .comp-drawing box did that). */
.ms-model-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
}
.ms-model-fig {
  margin: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
/* One fixed height per picture: the views have different shapes, and equal boxes keep
   both columns and their captions on one line. The box is 400px from the first paint,
   so the page never changes shape when a picture arrives (`.pic-frame`). */
.ms-model-frame { height: 400px; }
.ms-model-img { cursor: zoom-in; }
/* ── The picture loader: panels.picture_wait + shared/picture-wait.js (06 §8) ──
   THE one way to wait for a picture. Its box keeps its size from the first paint; while
   the picture is drawn a shimmer with the brand spinner and one line sits in it, and the
   picture fades in over it. The box's state class shows it: .is-busy (shimmer + spinner),
   .is-failed (the message, still), .is-empty (a muted line, no ground); no state = faded out.
*/
.pic-frame { position: relative; overflow: hidden; border-radius: 6px; }
.pic-frame > img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: opacity .25s ease, visibility .25s;
}
.pic-frame:is(.is-busy, .is-failed, .is-empty) > img { opacity: 0; visibility: hidden; }
.pic-wait {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
  text-align: center;
  font-size: var(--font-small);
  color: var(--tx3);
  border-radius: inherit;
}
/* Never a click target: a fading loader must not swallow the first drag on a drawing under it. */
.pic-wait { opacity: 0; visibility: hidden; pointer-events: none; transition: opacity .25s ease, visibility .25s; }
:is(.is-busy, .is-failed, .is-empty) > .pic-wait { opacity: 1; visibility: visible; }
/* One grey loading shimmer for every placeholder box. */
.pic-wait, .ms-model-skel-row {
  background: linear-gradient(100deg,
    color-mix(in srgb, var(--bdr) 25%, transparent) 30%,
    color-mix(in srgb, var(--bdr) 55%, transparent) 50%,
    color-mix(in srgb, var(--bdr) 25%, transparent) 70%) 0 0 / 300% 100%;
}
.is-busy > .pic-wait, .ms-model-skel-row { animation: skel-shimmer 1.6s ease-in-out infinite; }
.pic-wait[data-compact] {
  inset: auto auto 12px 12px;
  padding: 4px 8px;
  background: var(--dwg-paper, var(--sur));
}
.is-busy > .pic-wait[data-compact] {
  animation: none;
}
/* A refusal is read on a solid ground: nothing of the last picture shows through the message. */
.is-failed > .pic-wait { background: color-mix(in srgb, var(--bdr) 25%, var(--dwg-paper, var(--sur))); }
.is-empty > .pic-wait { background: none; }
:is(.is-failed, .is-empty) > .pic-wait :is(.brand-spin, .spa-loading) { display: none; }
/* Weights: six grey rows at the height the table will have, so the table replaces them in place. */
.ms-model-weights-box { min-height: 232px; }
/* An input a server check named (forms.field_mismatch_note), e.g. winding vs the Motor-Studio model. */
.field-mismatch { outline: 2px solid var(--red); outline-offset: 1px; border-radius: 4px; }
/* the input's own border too; the wire picker is a div, so its inner input/button gets it */
.field-mismatch, .field-mismatch input, .field-mismatch button { border-color: var(--red) !important; }
.ms-model-skel-row {
  height: 28px;
  margin-bottom: 4px;
  border-radius: 4px;
}
@keyframes skel-shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }
@media (prefers-reduced-motion: reduce) {
  .is-busy > .pic-wait, .ms-model-skel-row { animation: none; }
  .pic-frame > img, .pic-wait { transition: none; }
}
/* Three classes: .mat-props-table.perf-table (later in this file) sets width:max-content and
   1px columns, and .mat-props-table nth-child(3) centres the last column. */
.perf-table.mat-props-table.ms-model-weights { width: 100%; max-width: 100%; }
.perf-table.mat-props-table.ms-model-weights :is(th, td):nth-child(2) { width: auto; max-width: none; }
.perf-table.mat-props-table.ms-model-weights :is(th, td):nth-child(3) { width: 8rem; text-align: right; }
/* The motor's 3D box: a fixed size before the viewer is mounted (it sizes its canvas once). */
.ms-model-scene { height: min(70vh, 640px); }
/* Belt-and-braces: even if a caption or head/foot ever ran long, this modal
   never grows an inner scrollport — it fits, or it clips, never scrolls. */
.modal-content:has(.comp-drawing) {
  overflow: hidden;
}

/* Admin products: configurator family hero strip (Motor…Brake). */
.admin-product-hero {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  width: 100%;
  margin: 0 0 18px;
}
.admin-product-hero__item {
  margin: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.admin-product-hero__img {
  display: block;
  width: 100%;
  height: clamp(72px, 12vw, 140px);
  object-fit: cover;
  object-position: center;
  border-radius: var(--radius-md);
  border: 1px solid var(--bdr);
  box-sizing: border-box;
  background: var(--sur);
}
.admin-product-hero__cap {
  margin: 0;
  font-size: var(--font-tiny);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--tx3);
  text-align: center;
  line-height: 1.2;
}
@media (max-width: 720px) {
  .admin-product-hero {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.admin-form-actions {
  margin-top:auto;
  padding-top:var(--admin-panel-pad-y);
}

.admin-subheading-compact {
  font-size: var(--font-small);
}

.admin-json-textarea {
  font-family: monospace;
  font-size: 12px;
}

.admin-slot-card {
  padding: 10px 12px;
  margin-bottom: 8px;
}

.admin-slot-card-grid {
  align-items: start;
}

/* ── Assembly slot form table ── */
.asm-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--font-small);
  table-layout: auto;
}
.asm-table .asm-slot-col   { width: 1%; white-space: nowrap; }
.asm-table .slot-label-cell { width: 1%; white-space: nowrap; overflow: visible; }
.asm-table .asm-params-col  { width: 1%; white-space: nowrap; }
.asm-table thead th {
  padding: 8px 10px;
  border-bottom: 1px solid color-mix(in srgb, var(--bdr) 78%, transparent);
  color: var(--tx2);
  font-size: var(--font-ui-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  text-align: left;
  background: color-mix(in srgb, var(--bg) 70%, var(--sur));
}
.asm-table tbody td {
  padding: 10px;
  border-bottom: 1px solid color-mix(in srgb, var(--bdr2) 68%, transparent);
  vertical-align: middle;
  background: var(--sur);
  text-align: left;
}
.asm-table .slot-label-cell {
  width: 1%;
  white-space: nowrap;
  overflow: visible;
  font-weight: 600;
  color: var(--tx2);
  font-size: var(--font-small);
}
.asm-comp-row { display: flex; align-items: center; gap: 8px; }
.asm-comp-row .f { flex: 1; min-width: 0; }
.asm-info-btn {
  flex-shrink: 0;
  background: none;
  border: none;
  box-shadow: none;
  padding: 2px;
  color: var(--acc);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 3px;
  transition: color .15s;
}
.asm-info-btn:hover:not(:disabled) { color: var(--acc); background: none; }
.asm-info-btn:disabled { opacity: 0.25; cursor: default; }
.asm-params-col { width: 20rem; white-space: nowrap; }
.asm-params-row { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.asm-param-item { display: flex; flex-direction: column; gap: 4px; }
.asm-param-label { font-size: 10px; color: var(--tx2); white-space: nowrap; padding-left: 1px; }
.asm-param-input {
  width: 4rem;
  flex-shrink: 0;
  background: var(--sur);
  border: 1px solid var(--bdr);
  color: var(--tx);
  font: var(--field-font-size) var(--mono);
  padding: var(--field-pad-y) var(--field-pad-x);
  border-radius: var(--radius-input);
  box-sizing: border-box;
  outline: none;
}
.asm-param-input:focus {
  border-color: var(--acc);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--acc) 14%, transparent);
}



/* Hub landing */
.hub-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 48px 28px 56px;
}

.hub-body {
  width: 100%;
  max-width: 960px;
}

.hub-terminal-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  background: linear-gradient(180deg, var(--term-bar-from) 0%, var(--term-bar-to) 100%);
  border-bottom: 1px solid var(--term-bdr-soft);
}

.hub-terminal-dots {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex-shrink: 0;
}

.hub-terminal-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.hub-terminal-dot--r { background: #e11d48; box-shadow: 0 0 7px #e11d48; }
.hub-terminal-dot--y { background: #d97706; box-shadow: 0 0 7px #d97706; }
.hub-terminal-dot--g { background: #0f766e; box-shadow: 0 0 7px #14b8a6; }

.hub-terminal-title {
  flex: 1;
  text-align: left;
  font-family: var(--mono);
  font-size: var(--hub-font-bar);
  font-weight: 600;
  color: var(--term-tx2);
  letter-spacing: 0.08em;
  user-select: none;
}

.hub-terminal-body {
  background: var(--term-bg);
}

.hub-console {
  font-family: var(--mono);
  font-size: var(--hub-font);
  color: var(--term-tx2);
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 6em;
  padding: 18px 20px 14px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--term-tick) 7%, transparent), transparent 52%),
    var(--term-bg);
}

/* The reserved height must equal the filled height: hub-console.js types the
   lines in one at a time, and a shorter empty line makes the terminal grow a
   pixel and a half per line while it types. Keep both numbers at 1.55. */
.hub-console-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0;
  min-height: 1.55em;
  line-height: 1.55;
}

.hub-console-tag {
  color: var(--term-prompt);
  font-weight: 700;
  flex-shrink: 0;
  user-select: none;
  margin-right: 0.35em;
}

.hub-console-prompt {
  color: var(--term-prompt);
  font-weight: 700;
  flex-shrink: 0;
  user-select: none;
  margin-right: 0.35em;
}

.hub-console-out {
  color: var(--term-tx);
  white-space: pre-wrap;
}

.hub-console-out--banner {
  color: var(--term-tx3);
  letter-spacing: 0.01em;
}

.hub-console-cursor {
  display: inline-block;
  width: var(--terminal-cursor-w);
  height: var(--terminal-cursor-h);
  margin-left: 1px;
  background: var(--term-prompt);
  box-shadow: 0 0 8px color-mix(in srgb, var(--term-tick) 70%, var(--term-prompt));
  vertical-align: -0.12em;
  animation: hub-console-cursor-blink 1.05s step-end infinite;
}

.hub-console.is-done .hub-console-line:last-child::after {
  content: "";
  display: inline-block;
  width: var(--terminal-cursor-w);
  height: var(--terminal-cursor-h);
  margin-left: 1px;
  background: var(--term-prompt);
  box-shadow: 0 0 8px color-mix(in srgb, var(--term-tick) 70%, var(--term-prompt));
  vertical-align: -0.12em;
  animation: hub-console-cursor-blink 1.05s step-end infinite;
}

@keyframes hub-console-cursor-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

html[data-theme="dark"] .hub-terminal {
  box-shadow: var(--term-glow);
}

@media (prefers-reduced-motion: reduce) {
  .hub-console-cursor,
  .hub-console.is-done .hub-console-line:last-child::after {
    animation: none;
    opacity: 1;
  }
}

.hub-modules {
  border-top: 1px solid var(--term-bdr-soft);
  padding: 10px 16px 18px;
  opacity: 0;
  transform: translateY(5px);
  pointer-events: none;
  transition: opacity 0.38s ease, transform 0.38s ease;
}

.hub-terminal.is-ready .hub-modules,
.hub-modules.is-visible {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

/* Square tiles, four across. A row per app spent its width on one sentence and
   left the logo a decoration; a tile spends it on the artwork. */
/* --hub-pager is the one place paging is switched on: hub-carousel.js reads it
   back rather than repeating the breakpoint. The tile block is capped to what
   the height left over allows -- 400px is everything above and below it (top
   bar, terminal chrome, console, pager) -- so a page lands in one view and the
   hub never scrolls. The floor keeps a tile readable on a short screen, where
   scrolling is the lesser loss. */
.hub-carousel {
  --hub-pager: 1;
  container-type: inline-size;
  width: 100%;
  max-width: calc(4 * max(132px, (100vh - 400px) / 2) + 24px);
  /* Left, not centred: a half-empty page reads as a list that starts where
     every other page starts. Centring moved the first tile whenever the app
     count changed. */
  margin-inline: 0;
}

.hub-page.is-off { display: none; }

/* A page holds its full two rows even when it is not full, so turning to a
   half-empty last page does not make the terminal jump to a smaller height.
   The number is the tile grid's own arithmetic: two square tiles plus the gap,
   measured against the carousel's width rather than the viewport's. */
.hub-page { min-height: calc((100cqw - 24px) / 2 + 8px); }

.hub-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
  /* The page reserves two rows even when one is filled; the spare row belongs
     at the bottom, so a single row stays at the top instead of being spread
     down the reserved height. */
  align-content: start;
}

.hub-carousel-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 10px;
  font-family: var(--mono);
}

.hub-carousel-arrow {
  display: inline-flex;
  align-items: center;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0 6px;
  line-height: 1;
  color: var(--term-tx3);
  transition: color 0.14s;
}

.hub-carousel-arrow:hover { color: var(--term-prompt); }

.hub-carousel-dots {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.hub-carousel-dot {
  width: 7px;
  height: 7px;
  padding: 0;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  background: color-mix(in srgb, var(--term-tx3) 40%, transparent);
  transition: background 0.14s, transform 0.14s;
}

.hub-carousel-dot.is-on {
  background: var(--term-prompt);
  transform: scale(1.25);
}

/* The tiles carry nothing at rest — no fill, no border, no shadow. All three
   were tried in 0.4.6 and taken back out: the fill read as white cards on the
   ice panel, the border boxed the tiles in, and the shadow floated them. The
   hue and the logo are the affordance. */
.hub-module {
  --hub-accent: var(--term-prompt);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  aspect-ratio: 1;
  position: relative;
  text-align: center;
  padding: 12px 10px;
  border-radius: var(--radius-sm);
  font-family: var(--mono);
  font-size: var(--hub-font);
  line-height: 1.5;
  text-decoration: none;
  color: inherit;
  border: 1px solid transparent;
  transition: background 0.14s, border-color 0.14s, box-shadow 0.14s;
}

/* Per-module identity hue. Deliberate exception to the one-accent rule: on
   the hub the module IS the content, and the colors are how you find your
   app in the list. Version chips stay muted so they don't ride this hue. */
/* One key -> hue table for both the hub card and the app's topbar mark. Add an
   app here once; do not start a second mapping next to the topbar rules. */
.hub-module--motool,    .app-mark--motool    { --hub-accent: var(--app-hue-motool); --app-mark-box: 2.35; }
.hub-module--dqmodel,   .app-mark--dqmodel   { --hub-accent: var(--app-hue-dqmodel); --app-mark-box: 2.6; }
.hub-module--maps,      .app-mark--maps      { --hub-accent: var(--app-hue-maps); }
.hub-module--market_reports, .app-mark--market_reports { --hub-accent: var(--app-hue-market_reports); }
.hub-module--materials, .app-mark--materials { --hub-accent: var(--app-hue-materials); }
.hub-module--ipump,     .app-mark--ipump     { --hub-accent: var(--app-hue-ipump); }
.hub-module--field_viewer, .app-mark--field_viewer { --hub-accent: var(--app-hue-field_viewer); }
.hub-module--catalog,   .app-mark--catalog   { --hub-accent: var(--app-hue-catalog); }
.hub-module--rfq_search, .app-mark--rfq_search { --hub-accent: var(--app-hue-rfq_search); }
.hub-module--admin,     .app-mark--admin     { --hub-accent: var(--app-hue-admin); }
.hub-module--help,      .app-mark--help      { --hub-accent: var(--app-hue-help); }
.hub-module--settings,  .app-mark--settings  { --hub-accent: var(--acc); }

.hub-module:not(.hub-module-disabled):hover {
  background: color-mix(in srgb, var(--hub-accent) 9%, transparent);
  border-color: transparent;
  box-shadow: none;
  cursor: pointer;
}

.hub-module-key {
  color: var(--hub-accent);
  font-weight: 600;
  letter-spacing: 0.01em;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  min-width: 0;
}

.hub-module-key-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hub-module-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 60px;
  max-width: 100%;
  /* The lift goes on the holder, never on the mark: a part animation with
     fill:both holds its own transform and would win over anything set here. */
  transition: transform 0.18s cubic-bezier(.2, .8, .3, 1.2);
}

.hub-module:not(.hub-module-disabled):hover .hub-module-logo {
  transform: translateY(-3px) scale(1.06);
}

/* Marks are sized by the ink, not by the box: 60px is how tall every logo comes
   out on a tile. A logo wider than it is tall carries --app-mark-box (its row in
   the key table), which widens only its box -- the drawing inside still stands
   60px, so every tile reads at the same weight whatever shape its artwork is.
   max-width is the safety net: on a narrow tile a widened box is fitted to the
   tile instead of spilling out of it, and an SVG with a viewBox letterboxes
   rather than distorting. */
.hub-module-icon {
  width: calc(60px * var(--app-mark-box, 1)) !important;
  height: calc(60px * var(--app-mark-box, 1)) !important;
  /* The empty half of a widened box is taken back out of the layout, so the
     tile is not stretched by a box that is mostly air. Zero when unset. */
  margin-block: calc((1 - var(--app-mark-box, 1)) * 30px);
  max-width: 100%;
  flex-shrink: 0;
  color: var(--hub-accent);
  opacity: 0.9;
}

.hub-module-ver {
  display: inline-flex;
  align-items: center;
  font-size: calc(var(--hub-font) - 5px);
  font-weight: 600;
  font-style: normal;
  line-height: 1;
  /* Version is metadata, not state — muted, unfilled, never accent. */
  color: var(--term-tx3);
  background: transparent;
  border: 1px solid color-mix(in srgb, var(--term-tx3) 26%, transparent);
  border-radius: var(--radius-sm);
  padding: 2px 6px;
  margin-left: 0;
  position: static;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  flex-shrink: 0;
  text-transform: none;
  letter-spacing: 0.02em;
}

.hub-module-ver--soon {
  color: var(--term-tx2);
  background: transparent;
  border-color: color-mix(in srgb, var(--term-tx2) 28%, transparent);
  font-style: italic;
  text-transform: lowercase;
}

.hub-console-ver {
  color: var(--term-tx3);
}

.hub-module-enter {
  color: var(--hub-accent);
  font-size: calc(var(--hub-font) - 3px);
  font-weight: 600;
  letter-spacing: 0.02em;
  opacity: 0;
  white-space: nowrap;
  transition: opacity 0.14s;
  /* Held in the flow at all times: appearing on hover must not move the name. */
  position: absolute;
  bottom: 10px;
}

.hub-module:not(.hub-module-disabled):hover .hub-module-enter {
  opacity: 1;
}

.hub-module-disabled {
  opacity: 0.42;
  cursor: default;
}

/* The tile being dragged (`hub-reorder.js`): what stays on the page is the gap
   it left, faded; the tile itself travels under the cursor as the browser's
   drag picture. Hover styling is off, or the gap would light up. */
.hub-module.is-dragging,
.hub-module.is-dragging:hover {
  opacity: 0.3;
  background: transparent;
}

.hub-module.is-dragging .hub-module-enter { opacity: 0; }

.hub-module-disabled .hub-module-key {
  color: var(--term-tx3);
}

.hub-module-disabled .hub-module-ver {
  color: var(--term-tx3);
  background: color-mix(in srgb, var(--term-tx3) 10%, transparent);
  border-color: color-mix(in srgb, var(--term-tx3) 24%, transparent);
}

@media (max-width: 860px) {
  .hub-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .hub-page { min-height: calc(2 * (100cqw - 16px) / 3 + 8px); }
}

@media (max-width: 560px) {
  /* Narrow: every page is laid out, one under the other, and the pager is off. */
  .hub-carousel { --hub-pager: 0; max-width: none; }

  .hub-page { min-height: 0; }

  /* The template sends pages 2+ as `is-off` so the wide layout is painted at its
     settled height. Here there is no paging, so every page is laid out -- the same
     answer `hub-carousel.js` gives when it reads --hub-pager back as 0, only without
     waiting for the script. The nav goes with it. */
  .hub-page.is-off { display: grid; }

  .hub-carousel-nav { display: none; }

  .hub-page + .hub-page { margin-top: 8px; }

  .hub-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hub-module { gap: 9px; padding: 10px 8px; }

  .hub-module-logo { height: 44px; }

  .hub-module-icon {
    width: calc(44px * var(--app-mark-box, 1)) !important;
    height: calc(44px * var(--app-mark-box, 1)) !important;
    margin-block: calc((1 - var(--app-mark-box, 1)) * 22px);
  }

  .hub-module-enter {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hub-modules {
    opacity: 1;
    transform: none;
    pointer-events: auto;
  }
}

/* Hub topbar user chip */
.hub-user-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--font-small);
}

.hub-user-name {
  color: var(--tx);
  font-weight: 500;
}
.app-stub-empty {
  display:flex;
  align-items:center;
  justify-content:center;
  height:100%;
  color:var(--tx3);
}

.hub-role-badge {
  font-size: var(--font-tiny);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--bdr2);
  color: var(--tx3);
}

.hub-role-badge.hub-role-product-admin {
  background: color-mix(in srgb, var(--acc) 12%, transparent);
  color: var(--acc);
}

.hub-role-badge.hub-role-editor {
  background: color-mix(in srgb, #16a34a 10%, transparent);
  color: #16a34a;
}

html[data-theme="dark"] .hub-role-badge.hub-role-editor { color: var(--term-prompt); }

/* Font size overrides (set by settings page via localStorage) */
html.font-sm { --font-base: 14px; }
html.font-lg { --font-base: 20px; }
/* font-md = default 17px, no override needed */

/* Settings — same shell as admin: HUD nav overlays the paper pane. */
.settings-panel,
.tabbed-page {
  flex:1;
  min-height:0;
  display:flex;
  flex-direction:column;
}
/* The projects card takes whatever height the cards above it leave, instead of
   stopping at the shared 420px cap with the screen half empty. A chain of
   flex children, not `min-height:100%` -- a percentage height cannot see the
   scroll area's own padding, which is how the card lost its bottom edge the
   first time this was tried.
   `:not([hidden])` matters: `display` on the panel would beat the hidden
   attribute and both tabs would show at once. */
.tabbed-page > .admin-scroll {
  display:flex;
  flex-direction:column;
}
/* Grow to the scroll area's height, never shrink below the cards: a panel
   squeezed to the viewport let the cards spill out of it, so the /me
   projects card was crushed to its heading and the page lost its bottom edge
   whenever the cards above it were taller than the window. */
.tabbed-page > .admin-scroll > [role="tabpanel"]:not([hidden]) {
  display:flex;
  flex-direction:column;
  flex:1 0 auto;
}
.tabbed-page > .admin-scroll > [role="tabpanel"] > .comp-page-grid {
  flex:1 0 auto;
}
/* Shared "this card takes the height the page leaves" modifier (the /me
   projects card, the component release page). The card stretches and its
   `--scroll` table drops the 420px cap to fill whatever the card's heading and
   anything under the table do not use. A flex chain, not `min-height:100%` --
   a percentage height cannot see the scroll area's own padding, which is how
   the /me card lost its bottom edge the first time this was tried. */
/* `.admin-panel.comp-panel` sets `min-height:auto` -- two classes, so the
   modifier has to match it or the card keeps a content-sized floor and grows
   the page instead of letting the table scroll. The basis is the plain
   `--scroll` cap, not the content: the card starts at that height, grows into
   free room, and on a page that already scrolls it keeps that height instead
   of a heading with no rows under it. */
.admin-panel.comp-panel--fill {
  flex:1 1 min(420px, 50vh);
  min-height:0;
}
.comp-panel--fill .admin-table-wrap--scroll {
  max-height:none;
  flex:1 1 auto;
  min-height:0;
}
/* The page hands that height down: scroll area becomes a column, the grid
   stretches. `:has` rather than a class on the scroll div, so a page opts in
   at one place -- on the grid. */
.admin-scroll:has(> .comp-page-grid--fill) {
  display:flex;
  flex-direction:column;
}
.comp-page-grid--fill {
  flex:1 1 auto;
  min-height:0;
}
/* SPA fragment: the shared rule above turns the page root into a plain block
   so `#spa-panel` is the only scroller. A fill page opts back out -- the panel
   already has a definite height, so the card can take it there too, and
   without this the table's dropped cap would grow the fragment forever. */
#spa-panel > .admin-page-root.comp-page-fill,
.admin-page-root--spa.comp-page-fill {
  flex:1 1 auto;
  min-height:0;
  display:flex;
  overflow:hidden;
}
#spa-panel > .admin-page-root.comp-page-fill > .admin-scroll,
.admin-page-root--spa.comp-page-fill > .admin-scroll {
  flex:1 1 auto;
  min-height:0;
  height:auto;
  overflow:auto;
}
.settings-panel .settings-tabs.console-nav .console-nav-item:focus,
.settings-panel .settings-tabs.console-nav .console-nav-item:focus-visible {
  outline: none;
  box-shadow: none;
}
.settings-tabpanel {
  margin: 0;
}
.settings-tabpanel:focus-visible {
  outline: none;
}
.settings-actions {
  justify-content: flex-start;
  margin-top: auto;
  padding-top: var(--admin-panel-pad-y);
}
.settings-section-label { font-size: var(--font-small); font-weight: 600; color: var(--tx); margin-top: 24px; margin-bottom: 10px; }
.settings-section-label-gap { margin-top:48px; }
.settings-grid-opacity-field {
  margin-top: 12px;
  max-width: 340px;
}
.f input[type="range"] {
  width: 100%;
  margin: 4px 0 0;
  padding: 0;
  border: none;
  background: transparent;
  min-height: auto;
  box-shadow: none;
  cursor: pointer;
  accent-color: var(--acc);
}
.settings-grid-opacity-value {
  font-weight: 700;
  color: var(--tx2);
  text-transform: none;
  letter-spacing: 0;
}
.settings-user-label { margin-left:4px; }
.settings-display-name-grid { max-width:28rem; }
.settings-note-inline { margin:0; }
.settings-lead {
  margin: 0 0 14px;
  font-size: var(--font-small);
  color: var(--tx3);
  line-height: 1.5;
  max-width: 42em;
}
.settings-tsc-head {
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 8px 12px;
}
.settings-tsc-head .comp-title {
  flex: 1 1 12rem;
  min-width: 0;
}
.settings-motool-scope {
  flex-shrink: 0;
  font-size: var(--font-tiny);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--acc);
  background: color-mix(in srgb, var(--acc) 14%, transparent);
  border: 1px solid var(--acc-bdr-soft);
  padding: 3px 9px;
  border-radius: 999px;
  line-height: 1.2;
}
html[data-theme="dark"] .settings-motool-scope {
  background: color-mix(in srgb, var(--acc) 12%, transparent);
}
.settings-tsc-section-label { margin: 0 0 6px; }
.settings-tsc-fields + .settings-tsc-section-label { margin-top: 22px; }
.settings-tsc-section-label.settings-section-label-gap { margin-top: 32px; }
.settings-tsc-note {
  margin: 0 0 12px;
  max-width: 44rem;
  font-size: var(--font-small);
  color: var(--tx3);
  line-height: 1.45;
}
.settings-tsc-fields {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr));
  gap: var(--form-row-gap) 14px;
  width: 100%;
  max-width: 100%;
  align-items: end;
}
.settings-tsc-fields .f {
  min-width: 0;
}
.axis-limits-ticks-field {
  max-width: 10rem;
}
.settings-axis-limits {
  display: grid;
  grid-template-columns: auto 1fr 1fr;
  gap: 4px 8px;
  align-items: center;
  max-width: 26rem;
}
.settings-axis-limits-hdr {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .03em;
  text-transform: uppercase;
  color: var(--tx3);
  padding-bottom: 2px;
}
.settings-axis-limits-label {
  font-size: var(--label-font-size);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--tx3);
  white-space: nowrap;
  padding-right: 4px;
}
.settings-axis-limits input[type="number"] {
  background: var(--sur);
  border: 1px solid var(--bdr);
  color: var(--tx);
  font: var(--field-font-size) var(--mono);
  line-height: 1.3;
  min-height: 28px;
  padding: var(--field-pad-y) var(--field-pad-x);
  width: 100%;
  box-sizing: border-box;
  outline: none;
}
.settings-axis-limits input[type="number"]:focus {
  border-color: var(--acc);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--acc) 18%, transparent);
}
.settings-tsc-color-row {
  margin-top: 0;
  max-width: 100%;
}
.settings-tsc-palette-field {
  max-width: 22rem;
  margin-bottom: 4px;
}
.settings-tsc-color-row .f {
  min-width: 0;
}
.settings-help-font-note {
  margin: 0 0 10px;
  max-width: 36rem;
}
.settings-tsc-colors-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(7.5rem, 1fr));
  gap: 12px 14px;
  margin-top: 14px;
}
.settings-tsc-color-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}
.settings-tsc-color-field label {
  font-size: var(--font-ui-sm);
  font-weight: 600;
  color: var(--tx2);
}
.settings-tsc-color-field input[type="color"] {
  width: 100%;
  height: 38px;
  padding: 3px;
  border: 1px solid var(--bdr);
  border-radius: var(--radius-btn);
  cursor: pointer;
  background: var(--sur);
  box-sizing: border-box;
}
.settings-tsc-color-field input[type="color"]:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}
.settings-tsc-color-field.is-disabled label {
  color: var(--tx3);
}
html[data-theme="dark"] .settings-tsc-color-field input[type="color"] {
  border-color: var(--bdr2);
}
.font-size-picker { display: flex; gap: 6px; flex-wrap: wrap; }
.font-size-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  border: 1px solid var(--bdr);
  border-radius: var(--radius-btn);
  background: var(--sur);
  color: var(--tx2);
  font-size: var(--btn-font-size);
  cursor: pointer;
  transition: border-color .12s, color .12s;
}
.font-size-btn:hover { border-color: var(--acc); color: var(--tx); }
.font-size-btn.active { border-color: var(--acc); background: var(--acc); color: var(--tx-on-fill); font-weight: 600; }
.font-size-btn.active i { color: var(--tx-on-fill); }

/* === document list / upload === */

/* A read surface's document section, folded away (`docs.doc_disclosure`). The
   summary carries the same uppercase weight as a section heading, so a folded
   section still reads as one of the page's sections rather than a control. */
.doc-disclosure { margin:20px 0 10px; }
.doc-disclosure__summary {
  list-style:none;
  display:flex;
  align-items:center;
  gap:8px;
  cursor:pointer;
  user-select:none;
  padding:2px 0;
}
.doc-disclosure__summary::-webkit-details-marker { display:none; }
.doc-disclosure__title {
  font-size:var(--font-ui-sm);
  font-weight:700;
  text-transform:uppercase;
  letter-spacing:.04em;
  color:var(--tx2);
}
.doc-disclosure__summary > svg { color:var(--tx3); transition:transform .15s ease; }
.doc-disclosure[open] > .doc-disclosure__summary > svg { transform:rotate(180deg); }
.doc-disclosure__body { padding-top:10px; }

.doc-list { list-style:none; padding:0; margin:0 0 14px; display:flex; flex-direction:column; gap:3px; }
.doc-list--spaced { margin-bottom:10px; }
.doc-row {
  display:flex;
  align-items:center;
  gap:6px;
  font-size:var(--font-small);
  padding:5px 8px;
  margin:0 -8px;
  border-radius:4px;
  transition:background .12s ease;
}
.doc-row:hover,
.doc-row:focus-within {
  background:color-mix(in srgb, var(--table-row-hover-bg) 72%, var(--sur));
}
.doc-row .delete-confirm-form,
.doc-row .doc-step-preview-btn {
  display:inline-flex;
  margin:0;
  flex-shrink:0;
  opacity:0;
  transition:opacity .12s ease;
}
.doc-row:hover .delete-confirm-form,
.doc-row:hover .doc-step-preview-btn,
.doc-row:focus-within .delete-confirm-form,
.doc-row:focus-within .doc-step-preview-btn { opacity:1; }
@media (hover:none) {
  .doc-row .delete-confirm-form,
  .doc-row .doc-step-preview-btn { opacity:1; }
}
.doc-row .btn-danger.admin-action-btn svg { color:var(--red); opacity:1; }
.doc-row .doc-step-preview-btn svg { color:var(--acc); opacity:1; }
.doc-icon { flex-shrink:0; color:var(--tx3); }
.doc-file-badge {
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width:42px;
  padding:2px 8px;
  border:1px solid transparent;
  border-radius:999px;
  background:var(--bg);
  color:var(--tx2);
  font-size:var(--font-ui-xs);
  font-weight:700;
  letter-spacing:.04em;
  text-transform:uppercase;
  line-height:1.2;
}
.doc-file-badge--pdf  { background:var(--danger-bg); border-color:var(--danger-bdr); color:var(--danger-fg); }
.doc-file-badge--dxf  { background:var(--info-bg); border-color:var(--info-bdr); color:var(--info-fg); }
.doc-file-badge--dwg  { background:#e0e7ff; border-color:#c7d2fe; color:#3730a3; }
.doc-file-badge--step { background:var(--success-bg); border-color:var(--success-bdr); color:var(--success-fg); }
.doc-file-badge--iges { background:var(--warn-bg); border-color:var(--warn-bdr); color:var(--warn-fg); }
.doc-file-badge--link { background:#ede9fe; border-color:#ddd6fe; color:#5b21b6; }
.doc-file-badge--xlsx { background:var(--success-bg); border-color:var(--success-bdr); color:var(--success-fg); }
.doc-file-badge--file { background:var(--muted-bg); border-color:var(--muted-bdr); color:var(--muted-fg); }
.doc-status-badge {
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:2px 8px;
  border:1px solid transparent;
  border-radius:999px;
  background:var(--bg);
  color:var(--tx2);
  font-size:var(--font-ui-xs);
  font-weight:600;
  line-height:1.2;
  white-space:nowrap;
}
.doc-status-badge--current { background:var(--success-bg); border-color:var(--success-bdr); color:var(--success-fg); }
.doc-status-badge--extracted { background:var(--info-bg); border-color:var(--info-bdr); color:var(--info-fg); }
.doc-status-badge--failed { background:var(--danger-bg); border-color:var(--danger-bdr); color:var(--danger-fg); }
.doc-status-badge--superseded { background:var(--warn-bg); border-color:var(--warn-bdr); color:var(--warn-fg); }
.doc-status-badge--neutral { background:var(--muted-bg); border-color:var(--muted-bdr); color:var(--muted-fg); }
.doc-link { color:var(--acc); text-decoration:none; flex:1; }
.doc-upload-form { display:flex; align-items:center; gap:6px; }
.doc-upload-input { font-size:var(--font-tiny); color:var(--tx); }
.doc-section { margin-top:10px; border-top:none; padding-top:0; }
.doc-section-head { display:flex; align-items:center; gap:8px; margin-bottom:6px; }
.doc-section-label { font-size:var(--font-tiny); font-weight:700; text-transform:uppercase; letter-spacing:.04em; color:var(--tx3); }
.doc-surface {
  display:flex;
  flex-direction:column;
  gap:12px;
}
.doc-surface-head {
  display:flex;
  align-items:baseline;
  flex-wrap:wrap;
  gap:8px 12px;
}
.doc-surface-title {
  font-size:var(--font-small);
  font-weight:700;
  text-transform:uppercase;
  letter-spacing:.04em;
  color:var(--tx2);
}
.doc-surface-subtitle {
  font-size:var(--font-tiny);
  color:var(--tx3);
}
.doc-surface-formats {
  margin:0 0 4px;
  font-size:var(--font-tiny);
  color:var(--tx3);
}
.doc-surface-body {
  display:flex;
  flex-direction:column;
  gap:12px;
}
.doc-surface--pending .doc-surface-body {
  padding:14px 16px;
  border:1px dashed var(--bdr2);
  border-radius:6px;
  background:color-mix(in srgb, var(--sur) 88%, var(--bg));
}
.doc-surface-pending-msg {
  margin:0;
  font-size:var(--font-small);
  color:var(--tx2);
  line-height:1.45;
}
.doc-existing {
  display:flex;
  flex-direction:column;
  gap:8px;
}
.doc-existing-block {
  margin-top:14px;
  padding-top:0;
  margin-bottom:0;
}
.doc-existing-head {
  display:flex;
  align-items:center;
  justify-content:space-between;
  margin-bottom:12px;
}
.doc-existing-title {
  font-size:var(--font-tiny);
  font-weight:700;
  text-transform:uppercase;
  letter-spacing:.04em;
  color:var(--tx3);
}
.doc-dropzone-form {
  display:flex;
  flex-direction:column;
  gap:10px;
  position:relative;
}
.form-reset { margin:0; }
/* Screen-reader / layout clip — not `hidden`, so label activation and drag-drop file assignment work. */
.doc-dropzone-input {
  position:absolute;
  width:1px;
  height:1px;
  padding:0;
  margin:-1px;
  overflow:hidden;
  clip:rect(0, 0, 0, 0);
  white-space:nowrap;
  border:0;
  opacity:0;
  pointer-events:none;
}
.doc-dropzone {
  display:flex;
  align-items:center;
  gap:12px;
  width:100%;
  padding:16px 18px;
  border:1px dashed var(--bdr);
  background:color-mix(in srgb, var(--sur) 72%, var(--bg));
  color:var(--tx);
  cursor:pointer;
  text-align:left;
  transition:border-color .14s ease, background .14s ease, transform .14s ease;
}
.doc-dropzone:hover,
.doc-surface.is-over .doc-dropzone {
  border-color:var(--acc);
  background:color-mix(in srgb, var(--acc) 8%, var(--sur));
}
.doc-surface.is-over .doc-dropzone {
  transform:translateY(-1px);
}
.doc-dropzone-icon {
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:34px;
  height:34px;
  border:1px solid var(--bdr);
  background:var(--sur);
  color:var(--acc);
  flex:0 0 auto;
}
.doc-dropzone-copy {
  display:flex;
  flex-direction:column;
  gap:4px;
  min-width:0;
}
.doc-dropzone-title {
  font-size:var(--font-small);
  font-weight:700;
  color:var(--tx);
}
.doc-dropzone-hint {
  font-size:var(--font-tiny);
  color:var(--tx3);
}
.doc-dropzone-foot {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  flex-wrap:wrap;
}
.doc-dropzone-file {
  min-width:0;
  font-size:var(--font-small);
  color:var(--tx2);
}
.doc-surface.has-file .doc-dropzone-file {
  color:var(--acc);
  font-weight:600;
}
.doc-surface.is-uploading .doc-dropzone,
.doc-surface.is-uploading .doc-dropzone-foot,
.doc-surface.is-uploading .doc-dropzone-submit {
  opacity:.7;
  cursor:progress;
  pointer-events:none;
}
.doc-link-adder {
  border:1px dashed var(--bdr);
  background:color-mix(in srgb, var(--sur) 72%, var(--bg));
}
.doc-dropzone-form + .doc-link-adder {
  margin-top:-6px;
}
.doc-link-adder__toggle {
  list-style:none;
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding:7px 10px;
  font-size:var(--font-small);
  font-weight:600;
  color:var(--tx2);
  cursor:pointer;
}
.doc-link-adder:hover {
  border-color:var(--acc);
  background:color-mix(in srgb, var(--acc) 8%, var(--sur));
}
.doc-link-adder__toggle::-webkit-details-marker { display:none; }
.doc-link-form {
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  gap:8px;
  padding:0 10px 10px;
}
.doc-link-form-actions {
  margin-left:auto;
  display:inline-flex;
  align-items:center;
  gap:8px;
}
.doc-link-input {
  flex:1 1 220px;
  min-width:180px;
  border:1px solid var(--bdr);
  background:var(--sur);
  color:var(--tx);
  font:var(--field-font-size) var(--mono);
  padding:5px 7px;
  outline:none;
}
.doc-link-input:focus {
  border-color:var(--acc);
}


.topbar-action-active { color:var(--acc) !important; }
@keyframes btn-nudge {
  0%,100% { box-shadow:0 0 0 0 color-mix(in srgb,var(--acc) 0%,transparent); }
  30%      { box-shadow:0 0 0 5px color-mix(in srgb,var(--acc) 40%,transparent); }
  70%      { box-shadow:0 0 0 3px color-mix(in srgb,var(--acc) 15%,transparent); }
}
.btn-nudge { animation:btn-nudge .7s ease-out infinite; }
.panel-heading {
  font-size:var(--font-small);
  font-weight:700;
  text-transform:uppercase;
  letter-spacing:.05em;
  color:var(--tx2);
  margin-bottom:12px;
}
.panel-heading--title { text-transform:none; letter-spacing:0; font-size:var(--font-base); color:var(--tx); }

/* === product slot configurator (admin_edit.html) === */
.slot-table { width:100%; table-layout:auto; }
.slot-table--full-width { width:100%; }
.slot-table tbody td { vertical-align:top; }
.slot-col-slot { width:132px; text-align:left; }
.slot-col-use { width:56px; text-align:center; }
.slot-table tbody tr.slot-row--empty td.slot-variants-cell { vertical-align:middle; }
.slot-table tbody td.slot-variants-cell { text-align:center; }
.slot-col-add { width:38px; text-align:center; }
.slot-col-extra { width:90px; text-align:center; }
.slot-table tbody td.slot-extra-cell { text-align:center; vertical-align:middle; }
.slot-extra-col-input { width:72px; text-align:center; margin:0 auto; }
.slot-label-cell { font-weight:600; color:var(--tx2); white-space:nowrap; }
.slot-table tbody td.slot-label-cell { text-align:left; vertical-align:middle; }
.slot-label-inner { display:inline-flex; align-items:center; gap:8px; flex-wrap:nowrap; }
.slot-conn-badge {
  display:inline-flex; align-items:center; gap:4px;
  margin:0; padding:2px 8px;
  font-size:11px; font-weight:600; line-height:1.5;
  border-radius:999px; cursor:pointer;
  background:transparent; color:var(--tx3);
  border:1px solid var(--bdr);
}
.slot-conn-badge:hover { border-color:var(--acc); color:var(--acc); }
.slot-conn-badge svg { color:inherit; }
.slot-conn-badge--set { background:var(--info-bg); border-color:var(--info-bdr); color:var(--info-fg); }
.slot-conn-badge--set:hover { border-color:var(--info-fg); }
/* Per-variant values (power-stage tr/tf) ride inside the part name, like the
   release mark, so they follow the text instead of sliding under the actions. */
.slot-variant-name .slot-conn-badge { margin-left:6px; }
.slot-enabled-cell {
  text-align:center;
  vertical-align:top;
}
.slot-enabled-cell .chk {
  display:inline-flex;
  justify-content:center;
  align-items:center;
  /* Match the 22px first-line height used by .slot-always-on / .slot-empty-state
     / .slot-variant-main / the add button, so the checkbox centers on the same
     line instead of floating above it. */
  min-height:22px;
  margin:0;
  cursor:pointer;
}
.slot-enabled-cell .chk input[type="checkbox"] {
  cursor:pointer;
}
.slot-always-on {
  color:var(--tx3);
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:22px;
}
.slot-variants { display:flex; flex-direction:column; gap:2px; min-height:22px; }
.slot-variant-row { display:block; min-width:0; }
.slot-variant-main {
  display:flex;
  align-items:center;
  gap:8px;
  min-height:22px;
  min-width:0;
  position:relative;
}
.slot-variant-actions {
  display:inline-flex;
  align-items:center;
  gap:2px;
  flex-shrink:0;
  /* Out of flow so the component name can centre in the full cell; the actions
     (default star + hover-revealed edit/remove) ride the right edge. */
  position:absolute;
  right:0;
  top:50%;
  transform:translateY(-50%);
}
.slot-variant-row.chip-default .chip-star { color:#f87171; }
.slot-variant-row.chip-default .chip-star svg { fill:#f87171; opacity:1; }
/* Per-variant action buttons stay hidden until the row is hovered/focused, to
   keep the assigned column calm. The default (★) star is exempt — it is a status
   indicator, not just an action, so it must always be visible. */
/* Larger action icons in the slot configurator table (match the picker modal's
   14px circle-plus/minus) — now inherited from the global --icon-action token. */
.slot-variant-actions .btn { opacity:0; pointer-events:none; transition:opacity .12s ease; }
.slot-variant-row:hover .slot-variant-actions .btn,
.slot-variant-main:focus-within .slot-variant-actions .btn { opacity:1; pointer-events:auto; }
.slot-variant-row.chip-default .chip-star { opacity:1; pointer-events:auto; }
.slot-variant-name {
  flex:1;
  min-width:0;
  font-size:var(--table-font-size);
  color:var(--tx);
  padding:0 4px;
  overflow-wrap:anywhere;
}
/* Empty slots render nothing in the assigned column; .slot-variants keeps the
   row height via its own min-height. The element is still created/removed by the
   JS, just not shown. */
.slot-empty-state { display:none; }
.slot-param-strip {
  display:flex;
  align-items:flex-end;
  gap:10px;
  flex-wrap:wrap;
  margin-top:5px;
  padding-left:4px;
}
.chip-rm:hover { color:var(--red) !important; }
.slot-picker {
  margin-top:8px;
}
.slot-add-cell {
  white-space:nowrap;
  vertical-align:top;
  text-align:center;
}
.slot-add-cell .slot-picker {
  margin-top:0;
  display:inline-flex;
  align-items:center;
}
.slot-row-add-btn {
  width:22px;
  min-width:22px;
  height:22px;
  padding:0;
  display:inline-flex;
  align-items:center;
  justify-content:center;
}
.slot-row-add-btn:disabled { opacity:.55; cursor:default; }
.slot-add-accent svg { color:var(--acc); opacity:1; }
.slot-add-accent:hover:not(:disabled) svg { color:var(--acc); }
.slot-modal-box {
  width:min(400px, 92vw);
  max-height:min(80vh, 640px);
  display:flex;
  flex-direction:column;
}
.slot-modal-content {
  padding:12px 18px 16px;
  overflow:hidden;
  display:flex;
  flex-direction:column;
}
.slot-modal-foot,
.modal-foot--start,
.modal-box > .modal-foot.modal-foot--start {
  justify-content:flex-start;
}
.slot-modal-picker {
  position:static;
  min-width:0;
  max-width:none;
  box-shadow:none;
  border:none;
  padding:0;
  display:flex;
  width:100%;
}
.slot-modal-dropdown {
  width:100%;
  min-width:0;
}
/* Hide the dropdown trigger — the list is shown inline inside the modal */
.slot-modal-dropdown .product-dropdown-btn {
  display:none;
}
.slot-modal-dropdown .product-menu {
  position:static;
  border:1px solid var(--bdr);
  border-radius:6px;
  background:var(--sur);
  box-shadow:none;
  min-width:0;
  max-width:none;
  max-height:min(340px, 52vh);
  overflow-y:auto;
  margin:0;
  padding:4px 0;
}
.slot-modal-dropdown .product-menu-row {
  gap:8px;
  padding:6px 12px;
  min-height:36px;
  justify-content:space-between;
}
/* Stronger than the base .product-menu-row:hover, which uses --bg: this menu
   sits on the raised modal surface, so the page background is not a step away
   from it. --bdr is the effective value this rule always had: it asked for a
   --sur2 that has never existed and fell through to the --bdr behind it. */
.slot-modal-dropdown .product-menu-row:hover,
.slot-modal-dropdown .product-menu-row.is-active {
  background:var(--bdr);
}
.slot-modal-dropdown .product-menu-name,
.slot-modal-dropdown .product-menu-add {
  color:var(--tx);
}
.slot-modal-dropdown .product-menu-name {
  padding:2px 4px;
  font-size:var(--font-ui-sm);
}
.slot-modal-dropdown .product-menu-add {
  width:26px;
  height:26px;
  padding-inline:0;
  border-radius:4px;
  flex-shrink:0;
}
.slot-modal-name-wrap {
  display:inline-flex;
  align-items:center;
  gap:6px;
  min-width:0;
  flex:1;
}
.slot-default-badge {
  display:inline-flex;
  align-items:center;
  padding:0;
  border:0;
  background:transparent;
  color:#f87171;
}
.slot-default-badge svg { fill:#f87171; opacity:1; }
.slot-modal-dropdown .product-menu-add--add,
.product-menu-add--add { color:var(--acc); }
.slot-modal-dropdown .product-menu-add--remove,
.product-menu-add--remove { color:var(--red); }
.slot-modal-dropdown .product-menu-add--add:hover { color:var(--acc); }
.slot-modal-dropdown .product-menu-add--remove:hover { color:var(--red); }
.slot-picker-empty {
  padding:10px 12px;
  color:var(--tx3);
  font-size:var(--font-ui-sm);
}

/* scrollbar */
::-webkit-scrollbar { width:4px; height:4px; }
::-webkit-scrollbar-track { background:transparent; }
::-webkit-scrollbar-thumb { background:var(--bdr); }


/* Help section */
.help-shell {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.help-layout {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.help-layout .help-sidebar {
  width: 292px;
  /* min-width must not lock width — drag resize sets inline width */
  min-width: 0;
  background: color-mix(in srgb, var(--sidebar-bg) 92%, var(--sur));
}
.help-sidebar .col-body {
  padding: 12px 10px 18px;
  background: transparent;
}
.help-sidebar.is-collapsed ~ .col-resizer .rt-icon-close { display:none; }
.help-sidebar.is-collapsed ~ .col-resizer .rt-icon-open  { display:flex; }
/* Help sidebar text follows the help reading scale (--help-font-*), not the
   generic UI scale, so chapter names match the article they open and grow with
   the Settings help font size. */
.help-sidebar-group {
  margin: 14px 8px 5px;
  color: var(--tx3);
  font-size: var(--help-font-small);
  font-weight: 700;
  line-height: 1.2;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.help-sidebar-group:first-child {
  margin-top: 2px;
}
.help-sidebar .help-sidebar-item {
  min-height: 36px;
  margin-bottom: 3px;
  padding: 7px 8px 7px 12px;
  border-radius: 6px;
  gap: 6px;
  text-decoration: none;
}
.help-sidebar .help-sidebar-item:hover {
  background: color-mix(in srgb, var(--sur) 72%, var(--bg));
}
.help-sidebar .help-sidebar-item.is-sel {
  background: var(--sur);
  border-color: transparent;
  box-shadow:
    0 1px 2px rgba(28,25,23,.06),
    0 5px 16px rgba(15,23,42,.06);
}
.help-sidebar .help-sidebar-item::before {
  top: 6px;
  bottom: 6px;
}
.help-sidebar .help-sidebar-item.is-sel::before {
  width: 2px;
}
.help-sidebar .help-sidebar-item .vrow-name {
  color: var(--tx2);
  font-size: var(--help-font-base);
  font-weight: 400;
  line-height: 1.25;
  white-space: normal;
}
.help-sidebar .help-sidebar-item.is-sel .vrow-name {
  color: var(--tx);
  font-weight: 500;
}
.help-sidebar .help-sidebar-item:focus-visible {
  outline: 2px solid var(--acc);
  outline-offset: 2px;
}
.help-content.help-markdown {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 28px 30px 36px;
  font-size: var(--help-font-base);
}
.help-article .doc-figure {
  max-width: 100%;
  margin: 24px 0;
}
.help-article .doc-figure img {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
}
.help-article .doc-figure figcaption {
  margin-top: 8px;
  color: var(--tx3);
  font-size: var(--font-ui-xs);
  line-height: 1.4;
}
.help-article .inverter-help-figure img {
  max-height: 440px;
  object-fit: contain;
  object-position: left center;
  border: 1px solid var(--bdr);
  border-radius: 8px;
  background: var(--sur);
}
.help-article {
  box-sizing: border-box;
  /* Keep 860px: the comment layout picks its mode from the free margin beside
     the paper (help-comments.js MARGIN_NEED), so widening the article moves the
     bubbles. Extra reading room comes from padding, not from the outer width. */
  max-width: 860px;
  margin: 0 auto;
  padding: 44px 56px 52px;
  background: var(--sur);
  border: 1px solid color-mix(in srgb, var(--bdr) 78%, transparent);
  border-radius: 8px;
  box-shadow:
    0 1px 2px rgba(15, 23, 42, .05),
    0 16px 34px rgba(15, 23, 42, .07);
}
.help-doc-head {
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid color-mix(in srgb, var(--bdr2) 78%, transparent);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
/* Admin-only per-page comments on/off toggle. */
.hc-comments-toggle {
  flex: none;
  gap: 5px;
  font-size: var(--font-ui-xs);
  padding: 3px 10px;
  white-space: nowrap;
  border-radius: 999px;
  font-weight: 600;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}
/* Colour-codes its own state: accent when comments are on, muted when off. */
.hc-comments-toggle[data-enabled="1"] {
  color: var(--acc);
  background: var(--acc2);
  border-color: color-mix(in srgb, var(--acc) 38%, transparent);
}
.hc-comments-toggle[data-enabled="1"]:hover:not(:disabled) {
  background: color-mix(in srgb, var(--acc) 12%, var(--sur));
  border-color: var(--acc);
}
.hc-comments-toggle:not([data-enabled="1"]) {
  color: var(--tx3);
}
.hc-comments-toggle:not([data-enabled="1"]):hover:not(:disabled) {
  color: var(--tx2);
  background: var(--bg);
}
.help-doc-title {
  margin: 0;
  color: var(--tx);
  font-size: calc(var(--help-font-base) + 8px);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0;
}
/* Flat band behind the section list, spanning the full sidebar width (negative
   margins cancel .col-body padding), so it reads as one level under the chapter
   row without looking like a card. */
.help-toc {
  margin: 3px -10px 10px;
  padding: 5px 10px 7px 17px;
  border-radius: 0;
  border-left: 0;
  background: color-mix(in srgb, var(--sidebar-bg) 97%, var(--tx));
}
.help-toc[hidden] { display: none; }
.help-toc-title {
  margin: 5px 0 4px;
  color: var(--tx3);
  font-family: var(--sans);
  font-size: var(--help-font-small);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .035em;
}
.help-toc-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.help-toc-list li { margin: 0; }
/* Section links use the shared UI sans (not the article reading face) and sit
   one step under the chapter name, so they stay legible without competing. */
.help-toc-link {
  display: block;
  padding: 4px 6px;
  border-radius: 0;
  font-family: var(--sans);
  font-size: calc(var(--help-font-base) - 2px);
  line-height: 1.4;
  color: var(--tx2);
  text-decoration: none;
}
.help-toc-link:hover {
  color: var(--tx);
  background: transparent;
}
.help-toc-link.is-active {
  color: var(--tx);
  background: transparent;
  font-weight: 500;
}
.help-content.help-markdown h1 {
  font-size: calc(var(--help-font-base) + 10px);
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 10px;
  color: var(--tx);
}
.help-content.help-markdown h2 {
  font-size: calc(var(--help-font-base) + 5px);
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 44px 0 14px;
  color: var(--tx);
}
.help-content.help-markdown h3 {
  font-size: calc(var(--help-font-base) + 1px);
  font-weight: 650;
  margin: 28px 0 8px;
  color: var(--tx);
}
.help-content.help-markdown p {
  line-height: 1.75;
  margin-bottom: 18px;
  color: var(--tx);
}
.help-content.help-markdown #helpMarkdownContent a {
  color: color-mix(in srgb, var(--acc) 72%, var(--tx));
  text-decoration: none;
  font-weight: 600;
  border-radius: 3px;
  padding: 0 1px;
}
.help-content.help-markdown #helpMarkdownContent a:hover {
  color: var(--acc);
  background: color-mix(in srgb, var(--acc2) 82%, transparent);
}
.help-content.help-markdown #helpMarkdownContent a:focus-visible {
  outline: 2px solid var(--acc);
  outline-offset: 2px;
}
.help-content.help-markdown ul,
.help-content.help-markdown ol {
  padding-left: 1.5em;
  margin-bottom: 14px;
  color: var(--tx);
}
.help-content.help-markdown li {
  line-height: 1.75;
  margin-bottom: 10px;
}
.help-content.help-markdown code {
  font-family: var(--mono);
  font-size: .875em;
  background: color-mix(in srgb, var(--sur) 88%, var(--bdr2));
  border: 1px solid var(--bdr);
  color: var(--tx);
  border-radius: 3px;
  padding: 1px 5px;
}
.help-content.help-markdown pre {
  background: color-mix(in srgb, var(--sur) 84%, var(--bdr2));
  border: 1px solid var(--bdr);
  border-radius: 4px;
  padding: 12px 16px;
  overflow-x: auto;
  font-size: var(--help-font-small);
  line-height: 1.6;
  margin: 10px 0 18px;
}
.help-content.help-markdown pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: inherit;
}
.help-content.help-markdown table {
  border-collapse: collapse;
  width: 100%;
  margin-bottom: 26px;
  font-size: calc(var(--help-font-base) - 2px);
  background: var(--sur);
}
.help-content.help-markdown th,
.help-content.help-markdown td {
  border: 1px solid var(--bdr2);
  padding: 11px 16px;
  text-align: left;
  vertical-align: top;
}
.help-content.help-markdown th {
  background: color-mix(in srgb, var(--bg) 78%, var(--sur));
  color: var(--tx);
  font-weight: 700;
  font-size: calc(var(--help-font-small) - 1px);
  text-transform: uppercase;
  letter-spacing: .06em;
  white-space: nowrap;
}
.help-content.help-markdown blockquote {
  border-left: 3px solid var(--acc);
  margin: 0 0 14px;
  padding: 8px 16px;
  background: var(--acc2);
  color: var(--tx2);
  font-style: italic;
}

@media (max-width: 900px) {
  .help-layout {
    flex-direction: column;
  }
  .help-layout .help-sidebar {
    width: 100%;
    min-width: 0;
    max-height: 34vh;
    border-right: 0;
    border-bottom: 1px solid var(--bdr);
  }
  .help-sidebar-resizer,
  #helpSidebarResizer {
    display: none;
  }
  .help-content.help-markdown {
    padding: 16px;
  }
  .help-article {
    padding: 24px 22px 30px;
  }
  .help-doc-head {
    margin-bottom: 16px;
  }
}

/* ── Help comments: select-to-comment + margin bubbles ───────────────────── */
.help-content.help-markdown { position: relative; }
.hc-bubble-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 0;
  pointer-events: none;
}
/* Connector lines: hidden at rest, revealed for one thread on hover/focus so
   overlapping lines never clutter. Shares the bubble-layer coordinate space. */
.hc-connectors {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}
/* Rest opacity multiplies with the stroke's own alpha, so keep both high enough
   that the line is actually readable on the page background. */
.hc-connector,
.hc-connector-dot {
  opacity: 0.7; /* visible at rest so the text↔bubble link is always shown */
  transition: opacity 0.12s ease;
}
.hc-connector {
  fill: none;
  stroke-width: 2;
  stroke: color-mix(in srgb, var(--hc-color, var(--bdr)) 85%, transparent);
}
.hc-connector-dot {
  stroke: none;
  fill: color-mix(in srgb, var(--hc-color, var(--bdr)) 90%, transparent);
}
/* Long stacked-layout lines run the full article height: dashed + slightly
   lighter so many of them read as connectors rather than page rules. */
.hc-connector--long {
  opacity: 0.5;
  stroke-dasharray: 5 4;
}
.hc-connector--active { opacity: 1; }
path.hc-connector--active { stroke-width: 2; }
/* Drag: the bubble's header strip is the handle (tool icons keep their own
   cursor). While dragging, lift the bubble and drop the transition so it
   tracks the pointer exactly. */
.hc-drag-handle { cursor: grab; }
.hc-drag-handle:active { cursor: grabbing; }
.hc-drag-handle button { cursor: pointer; }
.hc-bubble--dragging {
  cursor: grabbing;
  user-select: none;
  transition: none;
  box-shadow: 0 6px 14px rgba(15, 23, 42, .12), 0 18px 40px rgba(15, 23, 42, .18);
  opacity: 0.96;
}
.hc-bubble {
  position: absolute;
  pointer-events: auto;
  box-sizing: border-box;
  background: var(--sur);
  border: 1px solid var(--bdr);
  /* Colored accent on the OUTER edge (away from the paper), so it never shares
     an edge with the tail/connector. Default = left (left-side + stacked); the
     right-side bubble flips it to the right below. */
  border-left: 3px solid var(--hc-color, var(--bdr));
  border-radius: 8px;
  /* The accent edge is 3px and the opposite edge 1px, so symmetric padding puts
     the content 2px off-center inside a border-box width: take the difference
     off the accent side, and flip it with the border on --right. */
  padding: 8px 10px 8px 8px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 8px 20px rgba(15, 23, 42, .08);
  cursor: pointer;
}
.hc-bubble--right {
  border-left: 1px solid var(--bdr);
  border-right: 3px solid var(--hc-color, var(--bdr));
  padding-right: 8px;
  padding-left: 10px;
}
/* Hover recolor applies to posted bubbles only — the compose box keeps the
   author accent while you type instead of flipping to blue. */
.hc-bubble:hover:not(.hc-compose) { border-color: var(--acc); }
/* No tail triangle: the connector's end dot marks where the line meets the
   bubble, and it tracks the bubble when it is dragged (a fixed CSS tail could
   not). */
.hc-bubble--focus { animation: hc-bubble-focus 1.2s ease-out; }
@keyframes hc-bubble-focus {
  0% { border-color: var(--acc); box-shadow: 0 0 0 3px var(--acc2); }
  100% { border-color: var(--bdr); }
}
.hc-stack {
  max-width: 860px;
  margin: 12px auto 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.hc-bubble--stacked {
  position: static;
  width: auto;
}
.hc-bubble-tool {
  background: none;
  border: 0;
  padding: 2px;
  cursor: pointer;
  color: var(--tx3);
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
}
.hc-bubble-tool--delete:hover { color: var(--red); }
.hc-bubble-tool--edit:hover { color: var(--acc); }
.hc-thread-edited {
  font-style: italic;
  color: var(--tx3);
}
.hc-thread-meta-right {
  display: flex;
  align-items: center;
  gap: 6px;
}
.hc-compose { cursor: default; z-index: 3; }
.hc-quote {
  border-left: 3px solid var(--acc);
  background: var(--acc2);
  padding: 4px 8px;
  margin: 0 0 6px;
  font-size: var(--font-ui-xs);
  color: var(--tx2);
  border-radius: var(--radius-sm);
  overflow-wrap: anywhere;
  max-height: 72px;
  overflow: hidden;
}
.hc-compose-actions {
  display: flex;
  gap: 6px;
  margin-top: 6px;
  /* Reply + Cancel need 230px at the shared .btn size (mono label, padding and
     the reserved `< />` brackets). BUBBLE_W in help-comments.js is sized to
     hold that pair on one line; wrapping is only the last resort, so a future
     narrower host stacks the buttons instead of hanging them outside the edge. */
  flex-wrap: wrap;
}
/* A margin bubble leaves ~8px of slack after the pair; left alone it all piles
   up on the right and the row reads as pushed off-center. Let the two buttons
   share the row instead, so each edge keeps the same gap and the buttons line up
   with the textarea above them. The wide stacked bubble keeps natural widths. */
.hc-bubble:not(.hc-bubble--stacked) .hc-compose-actions .btn {
  flex: 1 1 0;
}
.hc-thread-meta {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  font-size: var(--font-ui-xs);
  color: var(--tx3);
  margin-bottom: 4px;
}
.hc-thread-author {
  font-weight: 650;
  color: var(--hc-color, var(--tx2));
}
.hc-thread-text {
  font-size: var(--font-ui-sm);
  color: var(--tx);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.hc-thread-missing {
  font-size: var(--font-ui-xs);
  color: var(--amb);
  margin-top: 4px;
}
.hc-thread-missing--ack {
  color: var(--tx2);
}
.hc-keep-btn {
  margin-top: 4px;
  padding: 2px 8px;
  font-size: var(--font-ui-xs);
}
/* ── @-mentions: highlighted token + autocomplete dropdown ── */
.hc-mention {
  color: var(--acc);
  font-weight: 650;
  background: color-mix(in srgb, var(--acc) 12%, transparent);
  border-radius: 3px;
  padding: 0 2px;
  /* Two-word names wrap in a narrow bubble: give each line its own pill
     instead of one box cut open at the line break. */
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}
.hc-mention-menu {
  margin-top: 4px;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--bdr);
  border-radius: 6px;
  background: var(--sur);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.14);
  overflow: hidden;
  max-height: 168px;
  overflow-y: auto;
}
.hc-mention-opt {
  text-align: left;
  padding: 5px 9px;
  background: none;
  border: 0;
  font-size: var(--font-ui-sm);
  color: var(--tx);
  cursor: pointer;
}
.hc-mention-opt:hover {
  background: color-mix(in srgb, var(--acc) 12%, transparent);
}
/* ── Privacy toggle + share-with picker ── */
.hc-privacy-toggle {
  margin-top: 8px;
  font-size: var(--font-ui-xs);
}
.hc-private-mark {
  color: var(--tx2);
  vertical-align: middle;
}
/* Shared share-with picker (createSharePicker) sits under the privacy toggle */
.hc-privacy-toggle + .share-picker-wrap { margin-top: 6px; }
/* ── Replies: one-level thread rendered inside the parent bubble ── */
.hc-replies {
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px solid var(--bdr);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.hc-reply {
  padding-left: 8px;
  border-left: 2px solid color-mix(in srgb, var(--hc-color, var(--bdr)) 60%, transparent);
}
.hc-reply-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  font-size: var(--font-ui-xs);
  margin-bottom: 2px;
}
.hc-reply-author {
  font-weight: 650;
  color: var(--hc-color, var(--tx2));
}
.hc-reply-text {
  font-size: var(--font-ui-sm);
  color: var(--tx);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.hc-reply-bar { margin-top: 6px; }
.hc-reply-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 4px;
  background: none;
  border: 0;
  cursor: pointer;
  font: 600 var(--font-ui-xs) var(--sans);
  color: var(--tx3);
  border-radius: var(--radius-sm);
}
.hc-reply-link svg { width: 12px; height: 12px; }
.hc-reply-link:hover { color: var(--acc); }
.hc-reply-form { margin-top: 6px; }
mark.hc-highlight {
  background: color-mix(in srgb, var(--hc-color, var(--amb)) 24%, transparent);
  color: inherit;
  border-radius: 2px;
  padding: 0 1px;
}
mark.hc-highlight.hc-flash { animation: hc-flash 1.2s ease-out; }
@keyframes hc-flash {
  0% { background: color-mix(in srgb, var(--hc-color, var(--amb)) 60%, transparent); }
  100% { background: color-mix(in srgb, var(--hc-color, var(--amb)) 24%, transparent); }
}
/* Element anchors: images and whole-block equations get an outline, not a text
   highlight (there is no text run to wrap). */
.hc-el-highlight {
  outline: 2px solid color-mix(in srgb, var(--hc-color, var(--amb)) 55%, transparent);
  outline-offset: 3px;
  border-radius: 3px;
  cursor: pointer;
}
.hc-el-highlight.hc-flash { animation: hc-el-flash 1.2s ease-out; }
@keyframes hc-el-flash {
  0% {
    outline-color: color-mix(in srgb, var(--hc-color, var(--amb)) 100%, transparent);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--hc-color, var(--amb)) 28%, transparent);
  }
  100% { outline-color: color-mix(in srgb, var(--hc-color, var(--amb)) 55%, transparent); }
}
/* Per-user color dot (admin users table; --uc set per row). */
.user-color-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--uc, var(--bdr));
  margin-right: 6px;
}
/* Floating select-to-comment pill — compact and neutral so it does not
   compete with the page content it sits on top of. */
.hc-selection-btn {
  position: fixed;
  z-index: 1200;
  gap: 5px;
  min-height: 0;
  padding: 5px 9px;
  font-size: var(--font-ui-xs);
  font-weight: 600;
  line-height: 1;
  border-radius: 999px;
  color: var(--acc);
  background: var(--sur);
  border: 1px solid var(--acc-bdr);
  box-shadow: 0 2px 6px rgba(15, 23, 42, .10), 0 8px 18px rgba(15, 23, 42, .12);
  transition: color .1s, background .1s, border-color .1s, transform .1s;
  animation: hc-pill-in 0.12s ease-out;
}
@keyframes hc-pill-in {
  from { opacity: 0; transform: translateY(3px) scale(0.96); }
  to { opacity: 1; transform: none; }
}
.hc-selection-btn svg {
  width: 13px;
  height: 13px;
  color: currentColor;
}
/* Fills with the accent on hover (needs :not(:disabled) to out-specify the
   generic .btn:hover which would otherwise force a dark border). */
.hc-selection-btn:hover:not(:disabled) {
  color: var(--tx-on-fill);
  border-color: var(--acc);
  background: var(--acc);
  transform: translateY(-1px);
}
.hc-selection-btn:hover svg { color: var(--tx-on-fill); }
/* Admin help-comments overview — clickable row; author/date plain; comment ellipsis + ov-tip. */
.admin-table.admin-table--help-comments.perf-table {
  table-layout: fixed;
  width: 100%;
  min-width: 0;
}
.admin-table--help-comments th,
.admin-table--help-comments td {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.admin-table--help-comments td.ov-cell { overflow: visible; }
.admin-table--help-comments td.hc-admin-author {
  vertical-align: middle;
}
.hc-admin-author .user-color-dot {
  flex: none;
  margin-right: 0;
}
.hc-admin-author .ov-tip-text { flex: 0 1 auto; }
.admin-table--help-comments td.hc-admin-date {
  vertical-align: middle;
}
.admin-table--help-comments tbody tr[data-hc-view] { cursor:pointer; }
.admin-table--help-comments tbody tr[data-hc-view]:focus-visible {
  outline:2px solid var(--acc);
  outline-offset:-2px;
}
.hc-admin-tag {
  flex: none;
  font-size: var(--font-ui-xs);
  white-space: nowrap;
}
.hc-admin-tag--review {
  padding: 1px 6px;
  border-radius: 9px;
  color: var(--tx-on-fill);
  background: var(--amb);
  font-weight: 600;
}
.admin-table.admin-table--help-comments th:nth-child(1),
.admin-table.admin-table--help-comments td:nth-child(1) { width: 12.75rem; }
.admin-table.admin-table--help-comments th:nth-child(2),
.admin-table.admin-table--help-comments td:nth-child(2) { width: auto; }
.admin-table.admin-table--help-comments th:nth-child(3),
.admin-table.admin-table--help-comments td:nth-child(3) { width: 9rem; }
@media (max-width: 640px) {
  .admin-panel:has(.admin-table--help-comments) {
    --admin-content-pad-x: 6px;
  }
  .admin-table.admin-table--help-comments.perf-table {
    --admin-list-pad-x: 4px;
  }
  .admin-table.admin-table--help-comments th:nth-child(1),
  .admin-table.admin-table--help-comments td:nth-child(1) { width: 43%; }
  .admin-table.admin-table--help-comments th:nth-child(3),
  .admin-table.admin-table--help-comments td:nth-child(3) { width: 5.75rem; }
  .hc-admin-author .ov-tip { gap: 3px; }
  .admin-table.admin-table--help-comments.perf-table:not(.mat-props-table):not(.tbl-excel) :is(th, td).admin-actions {
    width: 3.25rem;
    min-width: 3.25rem;
    max-width: 3.25rem;
    padding-inline: 2px;
  }
}

/* History block on the release page: table, then the comment box under it.
   A column, so that on a `--fill` card the table takes the leftover height and
   scrolls while the comment box stays where it is instead of being pushed off
   the bottom by a long story. */
.comp-release-history {
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.comp-panel--fill > .comp-release-history { flex: 1 1 auto; }

/* Release-page history: When / Who / What / Version. When and Version take
   exactly their text; Who gets a reading width and ellipsises past it; What
   absorbs the rest and ellipsises with the full text as a hover tooltip
   (`.ov-tip` + overflow-tooltip.js), so a long comment never wraps the row.
   Same mechanism as --help-comments; a separate name because the column
   order differs and nth-child rules would otherwise point at the wrong cell. */
.admin-table--release-log th,
.admin-table--release-log td {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}
.admin-table--release-log td.ov-cell { overflow: visible; }
/* Fixed layout, so the two content-sized columns get real widths: a `1%`
   here is literally 1% and clipped them to nothing. When fits one stamp
   ("03 Sep 2026 17:30"); Version fits chip + eye + Restore. */
.admin-table.admin-table--release-log th:nth-child(1),
.admin-table.admin-table--release-log td:nth-child(1) { width: 9.5rem; }
.admin-table.admin-table--release-log th:nth-child(2),
.admin-table.admin-table--release-log td:nth-child(2) { width: 14%; }
.admin-table.admin-table--release-log th:nth-child(3),
.admin-table.admin-table--release-log td:nth-child(3) { width: auto; }
.admin-table.admin-table--release-log th:nth-child(4),
.admin-table.admin-table--release-log td:nth-child(4) { width: 8rem; }
/* A save that moved something can be opened where it stands: the row is the
   control, and the fields it moved unfold underneath it. The eye beside it
   still opens the full side-by-side compare. */
.release-log-row { cursor: pointer; }
/* The row you point at, the row you opened, and the fields it unfolds all take the
   shared table hover tint -- one token, defined in both themes. They read `--sur2`
   until 2026-09-12, which is a colour this stylesheet has never had: an opened row
   was painted with nothing and stayed flat. */
.release-log-row:hover td,
.release-log-row:focus-visible td { background: var(--table-row-hover-bg); }
.release-log-row--open td { background: var(--table-row-hover-bg); }
.admin-table--release-log tr.release-log-changes td {
  white-space: normal;
  padding: 6px 10px 10px;
  background: var(--table-row-hover-bg);
}
.release-change-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.release-change {
  display: flex;
  gap: 8px;
  align-items: baseline;
  font-size: var(--font-ui-sm);
}
.release-change-key {
  font-family: var(--mono);
  color: var(--tx2);
  min-width: 10rem;
}
.release-change-move { font-family: var(--mono); color: var(--tx); }
/* What somebody said about this change, under the fields it moved. Plain text,
   not monospace: it is a sentence, not a value. */
.release-change--said .release-change-key { font-family: inherit; font-weight: 600; }
.release-change--said { color: var(--tx2); }
.hc-admin-view-modal .hc-quote {
  max-height: none;
  overflow: visible;
}
.hc-admin-view-page {
  margin: 0 0 10px;
  font-size: var(--font-ui-sm);
}
.hc-admin-view-no-quote { margin: 0 0 10px; }

/* ── Production help fragment utilities (docs/help/**) ──────────────────── */
.help-markdown .doc-lede {
  /* Same type as body copy. Do not bump size — rewritten chapters
     used +3px and looked off next to migrated ones. */
  font-size: inherit;
}
.help-markdown .doc-section {
  margin-bottom: 12px;
}
/* Plain-language callout — friendly aside for non-experts. */
.help-markdown .doc-callout {
  border-left: 3px solid var(--acc);
  background: var(--acc2);
  border-radius: 0 4px 4px 0;
  padding: 16px 20px;
  margin: 0 0 26px;
  color: var(--tx);
}
.help-markdown .doc-callout p:last-child { margin-bottom: 0; }
.help-markdown .doc-callout ul { margin-bottom: 0; }
/* App card grid — the whole card is the link, no separate link row. */
.help-markdown .doc-apps {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 14px;
  margin: 0 0 26px;
}
/* The id selector out-specifies the generic help-body link styling, which would
   otherwise turn a card into inline blue link text. */
.help-markdown .doc-app,
.help-content.help-markdown #helpMarkdownContent a.doc-app {
  display: block;
  border: 1px solid var(--bdr);
  border-radius: 4px;
  background: var(--sur);
  padding: 20px 22px;
  color: var(--tx);
  font-weight: 400;
  text-decoration: none;
  transition: border-color .12s, box-shadow .12s, transform .12s;
}
.help-content.help-markdown #helpMarkdownContent a.doc-app:hover,
.help-content.help-markdown #helpMarkdownContent a.doc-app:focus-visible {
  border-color: var(--acc);
  background: var(--sur);
  color: var(--tx);
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(15, 23, 42, .05), 0 10px 22px rgba(15, 23, 42, .07);
}
.help-content.help-markdown #helpMarkdownContent a.doc-app:hover .doc-app-name { color: var(--acc); }
.help-markdown .doc-app--plain { background: color-mix(in srgb, var(--sur) 88%, var(--bg)); }
.help-markdown .doc-app-name {
  display: block;
  font-size: calc(var(--help-font-base) + 1px);
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--tx);
  margin-bottom: 8px;
}
.help-markdown .doc-app-what {
  display: block;
  font-size: calc(var(--help-font-base) - 2px);
  line-height: 1.65;
  color: var(--tx2);
}
.help-markdown .doc-app-note {
  display: block;
  margin-top: 8px;
  color: var(--tx3);
}
.help-markdown .doc-known-gap {
  border-left: 3px solid var(--amb);
  background: color-mix(in srgb, var(--amb) 12%, var(--sur));
  border-radius: 0 6px 6px 0;
  padding: 12px 16px;
  margin: 18px 0;
  color: var(--tx);
  font-size: var(--help-font-small);
}
/* Code-owned technical contract — exact formulas injected from code. */
.help-markdown .doc-technical-contract {
  display: block;
  border: 1px solid var(--bdr);
  border-radius: 6px;
  background: color-mix(in srgb, var(--sur) 92%, var(--bdr2));
  padding: 14px 18px;
  margin: 16px 0 20px;
}
.help-markdown .doc-contract-title {
  font-weight: 700;
  color: var(--tx);
  margin-bottom: 6px;
}
.help-markdown .doc-contract-frame {
  font-size: var(--help-font-small);
  color: var(--tx2);
  margin-bottom: 10px;
}
.help-markdown .doc-contract-formula {
  overflow-x: auto;
  margin: 8px 0;
}
.help-markdown .doc-contract-symbols {
  width: 100%;
  margin: 10px 0 4px;
  font-size: var(--help-font-small);
}
.help-markdown .doc-contract-sym {
  white-space: nowrap;
  width: 1%;
  color: var(--tx2);
}
.help-markdown .doc-contract-source {
  margin: 10px 0 0;
  font-size: var(--help-font-small);
  color: var(--tx2);
}
.help-markdown .verif-pass,
.help-markdown .verif-fail {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: var(--help-font-small);
  font-weight: 600;
}
.help-markdown .verif-pass {
  color: #166534;
  background: color-mix(in srgb, #22c55e 18%, var(--sur));
}
.help-markdown .verif-fail {
  color: var(--tx-on-fill);
  background: #dc2626;
}
.help-index-inner {
  max-width: var(--content-width);
  width: 100%;
  margin: 32px auto;
  padding: 0 24px;
  font-size: var(--help-font-base);
}
.help-index-inner h1 {
  font-size: var(--help-font-heading);
  margin-bottom: 16px;
}
.help-chapter-list {
  line-height: 2;
  padding-left: 24px;
}
.help-chapter-list a {
  color: var(--acc);
  text-decoration: none;
}
.help-chapter-list a:hover {
  text-decoration: underline;
}

/* ── Projects ─────────────────────────────────────────────────────── */
.proj-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 6px;
  border-radius: 10px;
  font-size: var(--font-ui-xs);
  font-weight: 600;
  letter-spacing: 0.02em;
}
.proj-badge--private  { background: var(--bdr2); color: var(--tx3); }
.proj-badge--shared   { background: var(--info-bg); color: var(--info-fg); }
.proj-badge--public   { background: #dcfce7; color: #15803d; }
.proj-badge--warn     { background: var(--warn-bg); color: var(--warn-fg); }
html[data-theme="dark"] .proj-badge--public  { background: #14532d; color: #86efac; }
/* Whose project this is, beside its name. Muted: it answers a question you
   only ask about the few rows that are not yours. */
.proj-owner {
  margin-left: 6px;
  font-size: var(--font-ui-xs);
  font-weight: 500;
  color: var(--tx3);
}

/* App cell in the projects list: the app's own logo at a size it is
   recognizable at, with its name beside it. The logo replaces what used to be
   a text pill -- an app is easier to pick out of thirty rows by its picture. */
.proj-app {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  /* Table cells line up on the text baseline, and a flex box with no text in it
     offers its bottom edge as that baseline -- which is why the logo hung above
     the row's words. This puts it on the row's middle instead. */
  vertical-align: middle;
  /* How big the artwork itself comes out. The box it sits in is wider. */
  --proj-app-logo-size: 15px;
}
/* Same correction the topbar and the hub tile make, for the same reason: these
   marks are wider than they are tall, so each is drawn inside a square box and
   asking for 15px buys 15px of *box* and only 15/2.35 of visible machine. Scale
   the box by the mark's own --app-mark-box. The row grows to hold that box: the
   topbar claws the empty overhang back with negative margins, which cannot work
   here because a table cell clips what leaves it -- the logo would be trimmed
   top and bottom instead. */
.proj-app-logo {
  flex: 0 0 auto;
  width: calc(var(--proj-app-logo-size) * var(--app-mark-box, 1)) !important;
  height: calc(var(--proj-app-logo-size) * var(--app-mark-box, 1)) !important;
}

.proj-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 16px;
  font-size: var(--font-ui-sm);
  border-bottom: 1px solid transparent;
}
.proj-banner--readonly {
  background: var(--info-bg);
  border-color: var(--info-bdr);
  color: var(--info-fg);
}
.proj-banner--warn {
  background: var(--warn-bg);
  border-color: var(--warn-bdr);
  color: var(--warn-fg);
}
.proj-banner-link { margin-left:8px; color:inherit; font-weight:600; }
.flex-spacer { flex:1; }
.btn-plain-inherit {
  background:none;
  border:none;
  cursor:pointer;
  color:inherit;
  padding:0;
}

/* ── Override tracking ─────────────────────────────────────────────── */
.input--overridden {
  background: #fefce8 !important;
  border-color: #ca8a04 !important;
}
html[data-theme="dark"] .input--overridden {
  background: #422006 !important;
  border-color: #d97706 !important;
}

#override-summary {
  position: absolute;
  bottom: 12px;
  left: 8px;
  right: 8px;
  background: var(--sur);
  border: 1px solid var(--bdr);
  border-radius: var(--radius-md);
  padding: 8px 10px;
  font-size: var(--font-ui-xs);
  z-index: 10;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.override-summary-head {
  font-weight: 600;
  color: var(--tx2);
  margin-bottom: 4px;
  font-size: var(--font-ui-xs);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
#override-summary-list .ov-row {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 1px 0;
  color: var(--tx);
}
#override-summary-list .ov-field { font-weight: 600; min-width: 60px; }
#override-summary-list .ov-arrow { color: var(--tx3); }
#override-summary-list .ov-new   { color: #ca8a04; font-weight: 600; }
.override-summary-hidden { display:none; }

/* Save-to-server modal (using native <dialog> but styled as .modal-box) */
.modal-dialog {
  border: none;
  padding: 0;
  background: transparent;
  /* A native <dialog> does not inherit from body — without this it falls back to
     the UA's CanvasText, which painted the modal title pure black on the dark
     surface (1.23:1). Light mode hid the bug because black was right there. */
  color: var(--tx);
  box-shadow: none;
  margin: 0;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  max-width: 100vw;
  max-height: 100vh;
  overflow: visible;
  outline: none;
}
.modal-dialog::backdrop {
  background: var(--modal-backdrop);
}

/* Image modal: one box size while the picture loads and after (`.pic-frame`, the picture loader);
   a small picture is not blown up. */
.modal-img-frame { height: min(78vh, 720px); }
.modal-img-frame > img { object-fit: scale-down; }
.r-plot img { cursor: zoom-in; }

.save-project-label {
  display:block;
  margin-bottom:4px;
}
.save-project-input {
  width:100%;
  box-sizing:border-box;
}
.save-mode-option {
  display:flex;
  align-items:center;
  justify-content:flex-start;
  gap:8px;
  margin:6px 0 0;
  font-size:var(--font-small);
  color:var(--tx2);
  text-transform:none;
  letter-spacing:0;
  font-weight:500;
  cursor:pointer;
}
.save-mode-option input[type="radio"] {
  margin:0;
  width:13px;
  height:13px;
  accent-color:var(--acc);
}
.save-mode-option span {
  display:inline-block;
}

/* ── Share picker (tag input) ─────────────────────────────────────── */
.share-picker {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid var(--bdr);
  border-radius: var(--radius-input);
  background: var(--sur);
  cursor: text;
}
/* Wrapper is layout-transparent so pills + input are one flex row: input can sit after the last chip */
.share-pills {
  display: contents;
}
.share-picker:focus-within {
  border-color: var(--acc);
  box-shadow: 0 0 0 1px var(--acc2);
}
html[data-theme="dark"] .share-picker:focus-within {
  box-shadow: 0 0 0 1px var(--acc2);
}
/* Neutral chips — same stone language as .proj-badge--private / table chrome, not accent blue */
.share-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px 3px 10px;
  background: var(--bdr2);
  border: 1px solid var(--bdr);
  border-radius: 10px;
  font-size: var(--font-ui-xs);
  color: var(--tx2);
  font-weight: 600;
  white-space: nowrap;
}
html[data-theme="dark"] .share-pill {
  background: var(--bdr2);
  border-color: var(--bdr);
  color: var(--tx2);
}
.share-pill-x {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--tx3);
  opacity: 0.85;
  font-size: 13px;
  line-height: 1;
  padding: 0 1px;
}
.share-pill-x:hover { opacity: 1; color: var(--tx); }
/* Inner field: no border — outer .share-picker wrapper provides the border */
.share-picker-input,
input.share-picker-input {
  flex: 1 1 120px;
  min-width: 120px;
  width: auto;
  border: none;
  outline: none;
  box-shadow: none;
  background: transparent;
  font: inherit;
  font-size: var(--field-font-size);
  color: var(--tx);
  padding: 4px 6px;
}
.share-picker-input:focus,
input.share-picker-input:focus {
  border: none;
  box-shadow: none;
  outline: none;
}
.share-picker-input::placeholder { color: var(--tx3); }

/* dropdown */
.share-picker-drop {
  position: absolute;
  background: var(--sur);
  border: 1px solid var(--bdr);
  border-radius: var(--radius-md);
  box-shadow: 0 4px 16px rgba(0,0,0,.12);
  z-index: 400;
  overflow-y: auto;
  max-height: 220px;
}
html[data-theme="dark"] .share-picker-drop {
  box-shadow: 0 4px 16px rgba(0,0,0,.5);
}
.share-drop-row {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  cursor: pointer;
  font-size: var(--font-ui-sm);
}
.share-drop-row:hover { background: var(--bdr2); }
html[data-theme="dark"] .share-drop-row:hover { background: color-mix(in srgb, var(--tx) 8%, var(--sur)); }
.share-drop-name { color: var(--tx); font-weight: 500; }
.share-drop-row mark {
  background: #fef08a;
  color: #78350f;
  border-radius: 2px;
  padding: 0 1px;
}
html[data-theme="dark"] .share-drop-row mark {
  background: #78350f;
  color: #fde68a;
}

/* modal-box needs position:relative for dropdown absolute positioning */
.modal-box { position: relative; }

/* ── Design check badge ── */
.dc-badge {
  display:inline-flex; align-items:center; gap:4px;
  font:600 var(--font-tiny) var(--sans);
  padding:2px 7px; border-radius:3px;
  border:none; cursor:pointer; margin-left:8px;
  vertical-align:middle; line-height:1.4;
}
.dc-badge--warning { background:var(--warn-bg); color:var(--warn-fg); }
.dc-badge--muted { background:var(--muted-bg); color:var(--muted-fg); cursor:default; }
.dc-badge--warning:hover { background:var(--warn-bdr); }
.dc-badge--error { background:var(--danger-bg); color:var(--danger-fg); }
.dc-badge--error:hover { background:var(--danger-bdr); }

/* ── Design checks modal sizing ── */
.modal-box--w-560 { width:min(560px, 94vw); }
.modal-box--w-680 { width:min(680px, 94vw); }
.modal-box--w-900 { width:min(900px, 96vw); max-width:96vw; }

/* ── Design check status chips (used inside perf-table rows) ── */
.dc-status {
  font-size:var(--font-tiny); font-weight:700;
  padding:1px 5px; border-radius:2px;
  text-transform:uppercase; white-space:nowrap;
}
.dc-status--ok      { background:var(--success-bg); color:var(--success-fg); }
.dc-status--warning { background:var(--warn-bg); color:var(--warn-fg); }
.dc-status--error   { background:var(--danger-bg); color:var(--danger-fg); }
/* An always-shown checks badge (`checksSummary`): green when every check passes. */
.dc-badge--ok { background:var(--success-bg); color:var(--success-fg); }
.dc-badge--ok:hover { background:var(--success-bdr); }
/* Every check by page section (`renderCheckGroups`): a heading per section, each check a button that takes the
   person to its field. */
.dc-check-list__title { margin:14px 0 6px; color:var(--tx2); font:600 var(--font-ui-xs)/1.2 var(--sans); letter-spacing:.06em; text-transform:uppercase; }
.dc-check-list__title:first-child { margin-top:0; }
.dc-check-list { margin:0; padding:0; list-style:none; display:flex; flex-direction:column; gap:2px; }
.dc-check { display:flex; align-items:baseline; gap:8px; width:100%; padding:6px 8px; border:1px solid transparent; border-radius:var(--radius-sm); background:none; color:var(--tx); font:inherit; font-size:var(--font-ui-sm); line-height:1.4; text-align:left; cursor:pointer; }
.dc-check:hover, .dc-check:focus-visible { border-color:var(--bdr); background:var(--sur-raised); }
.dc-check .dc-status { flex-shrink:0; }
/* The rows a picked check reads: a soft mark on the parameter row (or the select's field). */

/* ── EOL import UI ─────────────────────────────────────────────────────────── */
.eol-import-bar {
  display:flex; align-items:center; gap:8px;
  margin-top:18px; margin-bottom:4px;
}
.btn-eol { background:#eab308; border-color:#eab308; color:var(--tx-on-fill); }
.btn-eol:hover:not(:disabled) { background:#ca8a04; border-color:#ca8a04; color:var(--tx-on-fill); }
.btn-eol svg { color:var(--tx-on-fill); }

/* Segmented toggle button group (unit / decimal selector) */
.eol-toggle-group {
  display:inline-flex; align-items:center; gap:4px; flex-wrap:wrap;
}
.eol-toggle-btn {
  border-color:var(--bdr);
}
.eol-toggle-btn--active {
  background:var(--acc); color:var(--tx-on-fill); border-color:var(--acc);
}
html[data-theme="dark"] .eol-toggle-btn--active {
  color:var(--bg);
}

/* Modal sections */
.eol-section {
  display:flex; align-items:center; gap:10px;
  padding:6px 0; border-bottom:1px solid var(--bdr);
}
.eol-section:last-of-type { border-bottom:none; }
.eol-row-label {
  min-width:130px; font-size:.8rem; color:var(--tx2); flex-shrink:0;
}

/* η unit-check details table */
.eol-eta-details {
  margin:6px 0; font-size:.8rem;
}
.eol-eta-details summary {
  cursor:pointer; color:var(--acc); user-select:none;
}
.eol-eta-table {
  border-collapse:collapse; margin-top:6px; width:100%;
}
.eol-eta-table th, .eol-eta-table td {
  padding:2px 8px; border:1px solid var(--bdr); text-align:left; font-size:.78rem;
}
.eol-eta-table th { background:var(--table-head-bg); }
.eol-eta-row--ok td { color:var(--grn); }

/* Summary row */
.eol-summary {
  display:flex; flex-wrap:wrap; gap:6px 16px;
  padding:6px 0; font-size:.8rem; color:var(--tx2);
}
.eol-summary strong { color:var(--tx); }

/* Warnings block */
.eol-warnings {
  margin:6px 0; padding:6px 8px;
  background:var(--warn-bg); border-left:3px solid var(--amb);
  font-size:.8rem;
}
.eol-warnings ul { margin:4px 0 0 16px; padding:0; }
.eol-consistency-pct {
  font-family: var(--sans);
  font-size: var(--font-ui-sm);
  font-variant-numeric: tabular-nums;
  white-space: pre;
}
.eol-consistency-table {
  margin: 6px 0 0;
  border-collapse: collapse;
  font-family: var(--sans);
  font-size: var(--font-ui-sm);
  font-variant-numeric: tabular-nums;
  color: var(--tx);
}
.eol-consistency-table th {
  text-align: left;
  font-weight: 500;
  color: var(--tx2);
  padding: 1px 12px 1px 0;
  white-space: nowrap;
}
.eol-consistency-table td {
  padding: 1px 0;
  color: var(--tx);
  font-family: var(--mono);
}
.eol-consistency-note {
  margin: 6px 0 0;
  font-family: var(--sans);
  font-size: var(--font-ui-sm);
  color: var(--tx2);
}

/* Error modal */
.eol-error-body { padding:4px 0; }
.eol-error-msg {
  display:flex; align-items:flex-start; gap:6px;
  color:var(--red); font-size:.85rem; margin-bottom:8px;
}

/* Input highlight on field pre-fill */
@keyframes eol-field-flash {
  0%   { box-shadow:0 0 0 2px var(--acc, #2563eb); border-color:var(--acc, #2563eb); }
  80%  { box-shadow:0 0 0 2px var(--acc, #2563eb); border-color:var(--acc, #2563eb); }
  100% { box-shadow:none; border-color:var(--bdr); }
}
.eol-field-highlight {
  animation:eol-field-flash 1.6s ease-out forwards;
}

/* ── Materials app ─────────────────────────────────────────────────────── */

/* Inline action form — keeps POST forms in flex/inline row with sibling buttons */
.form-inline-action { display: contents; }

/* Small neutral icon button — for non-destructive row actions (move up/down) */

.mat-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.mat-toolbar .panel-heading { margin-bottom: 0; }
.mat-toolbar-actions { display: flex; align-items: center; gap: 6px; }
/* The way to the story is not part of the release state beside it: the 6px
   the toolbar gives every control put the clock hard against the status
   badge, and the two read as one lump. It keeps its own distance. */
/* The release corner: the way to the story, the status, and the actions.
   One gap between all three — the story link used to carry an extra margin
   of its own, which made the first space wider than the second and the row
   look badly set. Its ink is `--tx2`, not the `--tx3` an idle table icon
   wears: this one sits beside a coloured badge and a bordered button, and at
   `--tx3` it read as disabled in both themes. */
.mat-toolbar-actions--release { gap: 10px; }
/* No chrome on any of the three: a bordered button beside two bare glyphs was
   the thing that read as "off", and the owner's answer was to take the boxes
   away rather than add more of them. The colour survives it — `.btn` paints
   its ink from `--btn-hue`, and `admin-action-btn` only drops the border and
   the background — so the stamp stays green.

   `admin-action-btn` is a fixed 22px square built for one glyph; this one
   carries the glyph and its count, so it sizes to them. */
.comp-release-story {
  --btn-hue:var(--mark-read);
  position:relative;   /* the count is pinned to it, not laid out beside it */
  overflow:visible;
}

/* The row actions on the release history carry their own ink instead of the
   one grey every table action wears. On this table an icon is the only thing
   in its cell — there is no label beside it to say which is which — so colour
   is what tells them apart at a glance: the accent for reading and talking
   (compare, comment, edit), blue for putting a state back, red for removing.
   Scoped to this table on purpose: recolouring every action icon in the app is
   a bigger decision than one page. */
.admin-table--release-log .btn.admin-action-btn { --btn-hue:var(--mark-read); }
.admin-table--release-log .btn.admin-action-btn[aria-label*="omment"] { --btn-hue:var(--mark-read); }
.admin-table--release-log .btn.admin-action-btn[aria-label="Restore"] { --btn-hue:var(--warn-fg); }
.admin-table--release-log .btn.admin-action-btn[data-comment-remove] { --btn-hue:var(--red); }
/* Full strength. Every row action is dimmed to 80% so a wall of them stays
   quiet, but a dimmed colour is just a grey with a hint in it — these carry
   meaning in their hue, so they are painted at full strength. */
.admin-table--release-log .btn.admin-action-btn svg,
.comp-release-story svg { opacity:1; }
.comp-release-story-count { color: inherit; }
.comp-release-story-count {
  font-size: var(--font-tiny);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}



/* Category tiles (`panels.category_tile`): one per category, with the
   category's picture, its label and its count. The tile's own `color` is the
   category ink -- the badge's `.mat-cat-badge--<color>` class, reused so the
   tile and the row badge cannot disagree -- and only the lit tile shows it:
   label, count and a faint wash. Nothing at rest -- no fill, no border, no
   shadow -- and hover is the hub tile's wash, a 9 % tint of the tile's own hue
   (see `.hub-module`). No lift and no shadow: the pictures already read as
   objects, and a card rising under each one was two effects doing one job.
   There is no tiles-only state: a page with no category open shows the first
   one, so the row always sits above a table.

   `--shelf` is the landing state: no table under it, so the tiles take the
   room and the pictures come up to full size. */
.mat-cat-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}
.mat-cat-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 8px 8px;
  border-radius: var(--radius-sm);
  background: transparent;
  text-decoration: none;
  transition: background .14s;
}
.mat-cat-tile:hover {
  background: color-mix(in srgb, currentColor 9%, transparent);
  cursor: pointer;
}
.mat-cat-tile:focus { outline: none; }
.mat-cat-tile:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }
.mat-cat-tile--active,
.mat-cat-tile--active:hover {
  background: color-mix(in srgb, currentColor 14%, transparent);
}
/* The picture box is a fixed height so a shorter drawing does not move the
   label of its tile out of line with its neighbours. */
.mat-cat-tile-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 84px;
}
.mat-cat-tile-mark img { width: 100%; height: 100%; object-fit: contain; }
.mat-cat-tile-name {
  display: flex;
  align-items: baseline;
  gap: 6px;
}
.mat-cat-tile-label {
  font-size: var(--font-ui-sm);
  font-weight: 600;
  color: var(--tx2);
}
/* Count under the label. Muted and lighter than the label: it is how big the
   shelf is, not what it is called. */
.mat-cat-tile-count {
  font-family: var(--mono);
  font-size: var(--font-ui-xs);
  color: var(--tx3);
}
.mat-cat-tile--active .mat-cat-tile-label,
.mat-cat-tile--active .mat-cat-tile-count { color: inherit; }
@media (prefers-reduced-motion: reduce) {
  .mat-cat-tile { transition: none; }
}

/* The table while a category tab is loading its replacement.

   The box holds the height it had (set inline, measured), the old rows step
   out of the way, and the spinner sits in the middle of that space. Nothing
   above or below the table moves; the page resizes once, when the real rows
   arrive. */
.mat-list-region { position: relative; }
.mat-list-region--busy > :not(.mat-list-loader) { visibility: hidden; }
.mat-list-loader {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* How many rows each kind has, beside its tick box in the Kind column filter.
   It replaced a strip of pills above the table: those repeated what the column
   already said, and cost a row of the page to say it. */
.mat-kind-filter-count { color: var(--tx3); font-weight: 500; }

/* Numeric list columns. The property's short name over its unit, so a header
   stays two short words wide and the numbers underneath line up on the right. */
/* The header may wrap to two lines; the numbers under it may not. A nowrap
   header clipped "Initial permeability" mid-word against the next column.
   Scoped through the table so it outranks `.admin-table.perf-table th`, which
   sets nowrap for every cell. */
.mat-materials-table :is(th, td).mat-num-col {
  text-align: right;
  white-space: normal;
}
/* The property name carries its unit after it: "Br (T)". The unit was its own
   line under the name, and the sort toggle pushed the name 20px left of it and
   of the numbers, so nothing in the column shared an edge. */
.mat-num-col-name { display: block; white-space: nowrap; }
/* Slate, never the category hue: inside a category the kind is the only chip
   on the row, and giving it a colour would invent a second identity. */
.mat-kind-badge { font-weight: 600; }
/* The unit rides on the name at the name's own size -- smaller was tried and
   was unreadable at this weight. Lighter and muted is what keeps it secondary;
   the room it needs comes out of the Label column below. */
.mat-num-col-unit {
  font-weight: 500;
  color: var(--tx3);
  text-transform: none;
}
.mat-materials-table :is(th, td).mat-num-cell {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
/* A name reads from the left. The materials tables are excluded from the
   shared left-align rule because their value columns are centred on purpose;
   a supplier is not a value. */
.mat-materials-table :is(th, td).mat-text-col,
.mat-materials-table :is(th, td).mat-text-col .mat-th-filter { text-align: left; }
.mat-materials-table :is(th, td).mat-text-col .mat-th-filter { justify-content: flex-start; }


/* Category badge */
.mat-cat-badge {
  font-size: var(--font-ui-xs);
  padding: 1px 6px;
  border-radius: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .03em;
  vertical-align: middle;
  /* Identity chip: variants set `color` only; the fill is the ink washed
     over the raised surface at the shared --identity-chip-fill strength, so
     dark needs no patch rule -- the --mat-cat-* inks already flip. */
  background: color-mix(in srgb, currentColor var(--identity-chip-fill), var(--sur-raised));
}
/* Badge palette. Categories are data, so a badge is colored by the color token
   stored with the category (built-ins keep the colors they always had):
   magnet=amber, steel=indigo, conductor=green, fluid=sky, plastic=purple.
   This list mirrors CATEGORY_COLORS in `app/stores/materials.py`. */
.mat-cat-badge--amber   { color: var(--mat-cat-amber); }
.mat-cat-badge--indigo  { color: var(--mat-cat-indigo); }
.mat-cat-badge--green   { color: var(--mat-cat-green); }
.mat-cat-badge--sky     { color: var(--mat-cat-sky); }
.mat-cat-badge--purple  { color: var(--mat-cat-purple); }
.mat-cat-badge--rose    { color: var(--mat-cat-rose); }
.mat-cat-badge--teal    { color: var(--mat-cat-teal); }
.mat-cat-badge--slate   { color: var(--mat-cat-slate); }

/* New-category modal: existing custom categories + the color choice. Badges
   double as the swatches, so the choice shows exactly how the badge will look. */
.cat-existing-list,
.cat-color-choices {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.cat-existing-list { margin-bottom: var(--form-section-gap); }
.cat-color-swatch {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}

/* Active-filter badge used as a one-click reset (materials list heading):
   shows the filtered category with a trailing × that clears back to All. */
.mat-cat-badge--reset {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  text-decoration: none;
  cursor: pointer;
  transition: filter .12s, box-shadow .12s;
}
.mat-cat-badge--reset:hover {
  filter: brightness(.96);
  box-shadow: inset 0 0 0 1px currentColor;
}
.mat-cat-badge--reset svg { opacity: .65; }
.mat-cat-badge--reset:hover svg { opacity: 1; }

/* Categorical axis cycle badge (modal point editor) */
.mat-cat-cycle-badge {
  display: inline-block;
  font-size: var(--font-ui-xs);
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .03em;
  background: #e0f2fe;
  color: #075985;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  transition: background .12s, color .12s;
}
.mat-cat-cycle-badge:hover { background: #bae6fd; color: #0c4a6e; }
.mat-cat-cycle-badge:focus-visible { outline: 2px solid #3b82f6; outline-offset: 2px; }
.mat-cycle-counter {
  font-size: .7em;
  opacity: .6;
  margin-left: 4px;
  font-weight: 400;
  letter-spacing: 0;
}

/* Type badge (linear / nonlinear) */
/* The axes of a nonlinear property, in the catalog's Unit / Axes column:
   a formula line, `T [°C] · H [A/m] · J [T]`. Symbol in the row's ink, unit
   muted, a middle dot between axes -- no fill and no border, because a filled
   chip on a table row reads as highlighted text, which is what these were.
   One unit means a plain measurement and several mean a curve, so the shape
   of this cell is what the old Type column said in words on every row. That
   badge is gone; its nonlinear colours were hardcoded hex with no dark rule,
   so it stayed light purple while the table around it flipped. */
/* The axis count: a number for a curve, the word "linear" for a plain
   measurement. Muted, because it is a property of the row rather than a
   reading -- and because "linear" is on more than half the rows. */
.mat-axes-col {
  text-align: center;
  color: var(--tx3);
  font-variant-numeric: tabular-nums;
}
.mat-axes-linear { font-size: var(--font-ui-xs); }

.mat-axis { white-space: nowrap; }
.mat-axis-unit { color: var(--tx3); }
.mat-axis-sep {
  color: var(--tx3);
  margin: 0 5px;
}

/* Detail page */
.mat-detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  gap: 12px;
}
.mat-detail-title { margin-bottom: 4px; }
.mat-detail-desc { color: var(--tx2); font-size: var(--font-small); margin: 0; }
/* Kind rides the title line as plain muted text, never a second coloured chip:
   the category badge already carries the one colour this header is allowed. */
.mat-detail-kind {
  font-size: var(--font-ui-sm);
  font-weight: 500;
  color: var(--tx2);
  margin-left: 2px;
}
/* Composition / manufacturer / material number, stacked right under the title —
   same muted-label look as .mat-detail-kind, just one fact per line instead
   of riding the title line. */
.mat-detail-subline {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 4px 0;
}
.mat-detail-subline .mat-detail-kind { margin-left: 0; }
/* Standard — the paper trail, one muted line, only shown when set. */
.mat-detail-facts {
  color: var(--tx3);
  font-size: var(--font-ui-xs);
  margin: 3px 0 0;
}
.mat-detail-actions { display: flex; gap: 6px; flex-shrink: 0; }


/* Shared read-only property table primitive.
   Use on detail/compare-style property tables only. Editable tables with inputs
   and row actions stay on .mat-props-table.tbl-excel. */
/* Hugs its content. `width:100%` with a `width:100%` label column gave the
   label every spare pixel — on a 1600px screen the property name sat in a
   ~1100px cell and the eye had to cross it to reach nom/min/max on every row.
   The label now takes a reading width and the numbers follow it. */
.admin-table.perf-table.property-table {
  table-layout:auto;
  width:auto;
  min-width:min(100%, 520px);
  max-width:100%;
  /* `.perf-table` centres itself with `margin:0 auto`. Harmless while the
     table was full width; once it hugs its content that parked it in the
     middle of the page, away from its own section heading. */
  margin-left:0;
  margin-right:auto;
}
.admin-table.perf-table.property-table :is(th, td) {
  vertical-align:middle;
}
.admin-table.perf-table.property-table .property-table__key {
  width:1px;
  min-width:132px;
  white-space:nowrap;
  text-align:left;
}
.admin-table.perf-table.property-table .property-table__label {
  width:auto;
  min-width:220px;
  text-align:left;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.admin-table.perf-table.property-table .property-table__unit {
  width:1px;
  white-space:nowrap;
  text-align:center;
}
.admin-table.perf-table.property-table .property-table__num {
  width:1px;
  white-space:nowrap;
  text-align:right;
}
.admin-table.perf-table.property-table td.mat-props-plot-cell {
  text-align:center;
}

/* Properties table: shrink-wrap to content (Property left-aligned). Beats the
   default .admin-table 20/24/46% column widths. Override .perf-table's
   margin:0 auto so the shrink-wrapped table sits on the left, not centered.
   np-evidence keep full panel width below so Effective can absorb leftover
   space; np-plain shrink-wraps unless it has a Configuration column. */
.mat-props-table.admin-table,
.mat-props-table.perf-table {
  table-layout: auto;
  width: max-content;
  max-width: 100%;
  margin-left: 0;
  margin-right: 0;
}
.mat-props-table.perf-table th:nth-child(1),
.mat-props-table.perf-table td:nth-child(1) {
  width: 1px;
  white-space: nowrap;
  text-align: left;
}
.mat-props-table th:nth-child(2),
.mat-props-table td:nth-child(2) { width: 1px; max-width: 180px; white-space: nowrap; text-align: left; overflow: hidden; text-overflow: ellipsis; }
.mat-props-table th:nth-child(3),
.mat-props-table td:nth-child(3) { width: 1px; white-space: nowrap; text-align: center; }
.mat-props-table th:nth-child(4),
.mat-props-table td:nth-child(4),
.mat-props-table th:nth-child(5),
.mat-props-table td:nth-child(5),
.mat-props-table th:nth-child(6),
.mat-props-table td:nth-child(6) { width: 70px; min-width: 70px; white-space: nowrap; text-align: right; }
/* Detail (read-only) table: nom/min/max shrink to content. */
.mat-props-table:not(.tbl-excel) th:nth-child(4),
.mat-props-table:not(.tbl-excel) td:nth-child(4),
.mat-props-table:not(.tbl-excel) th:nth-child(5),
.mat-props-table:not(.tbl-excel) td:nth-child(5),
.mat-props-table:not(.tbl-excel) th:nth-child(6),
.mat-props-table:not(.tbl-excel) td:nth-child(6) { width: 1px; min-width: 0; white-space: nowrap; text-align: right; }
.mat-props-table td.admin-actions,
.mat-props-table th.admin-actions { width: 90px; min-width: 90px; text-align: right; }

/* Property editors (materials / commutator / inverter): roomier cells than the
   dense default .tbl-excel / .perf-table pads (4–5px). Keep nameplate
   np-plain / np-evidence on the shared denser rhythm. */
.mat-props-table.tbl-excel:not(.np-plain-table):not(.np-evidence-table) thead th {
  padding: 7px 12px;
}
.mat-props-table.tbl-excel:not(.np-plain-table):not(.np-evidence-table) tbody tr {
  height: 36px;
}
.mat-props-table.tbl-excel:not(.np-plain-table):not(.np-evidence-table) tbody td {
  padding-left: 12px;
  padding-right: 12px;
}
.mat-props-table.tbl-excel:not(.np-plain-table):not(.np-evidence-table) td:has(input[type="number"]),
.mat-props-table.tbl-excel:not(.np-plain-table):not(.np-evidence-table) td:has(input[type="text"]) {
  padding-left: 0;
  padding-right: 0;
}
.mat-props-table.tbl-excel:not(.np-plain-table):not(.np-evidence-table) td input[type="number"],
.mat-props-table.tbl-excel:not(.np-plain-table):not(.np-evidence-table) td input[type="text"] {
  height: 36px;
  padding: 0 10px;
}

/* Plain build-fact table (Parameter | Unit | Value, no evidence columns):
   shrink-wrap like chokes / materials property grids. Stretch full panel only
   when a 4th column (Configuration) needs leftover space — DC geometry. */
.mat-props-table.np-plain-table.admin-table,
.mat-props-table.np-plain-table.perf-table {
  width: max-content;
  max-width: 100%;
}
.mat-props-table.np-plain-table.admin-table:has(thead th:nth-child(4)),
.mat-props-table.np-plain-table.perf-table:has(thead th:nth-child(4)) {
  width: 100%;
}
.mat-props-table.np-plain-table th:nth-child(1),
.mat-props-table.np-plain-table td:nth-child(1) {
  text-align: left;
}
/* Value stays a narrow, content-sized number-input column (unchanged);
   Configuration (only present on the DC geometry table's length row: a live
   capability summary + edit button) gets extra room via min-width. Matches
   .admin-table--auto's own selector weight (it otherwise wins nth-child
   width with width:auto). */
.admin-table.admin-table--auto.mat-props-table.np-plain-table th:nth-child(4),
.admin-table.admin-table--auto.mat-props-table.np-plain-table td:nth-child(4) {
  width: auto;
  min-width: 14rem;
  text-align: right;
}

/* Nameplate evidence (Parameter | Unit | Calculated | Measured | Rel err |
   Effective). Full-width fixed layout — content is ignored for column sizing,
   so Parameter/Unit need real widths (1% + overflow:visible overlaps).
   Calculated/Measured/Rel-err stay compact; Effective absorbs leftover width. */
.mat-props-table.np-evidence-table.admin-table,
.mat-props-table.np-evidence-table.perf-table {
  table-layout: fixed;
  width: 100%;
}
.mat-props-table.np-evidence-table th:nth-child(1),
.mat-props-table.np-evidence-table td:nth-child(1) {
  width: 7rem;
  min-width: 7rem;
  max-width: 7rem;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mat-props-table.np-evidence-table th:nth-child(2),
.mat-props-table.np-evidence-table td:nth-child(2) {
  width: 7.5rem;
  min-width: 7.5rem;
  max-width: 7.5rem;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mat-props-table.np-evidence-table th:nth-child(3),
.mat-props-table.np-evidence-table td:nth-child(3),
.mat-props-table.np-evidence-table th:nth-child(4),
.mat-props-table.np-evidence-table td:nth-child(4) {
  width: 7.5rem;
  min-width: 7.5rem;
  max-width: 7.5rem;
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mat-props-table.np-evidence-table th:nth-child(3),
.mat-props-table.np-evidence-table th:nth-child(4) {
  white-space: normal;
  line-height: 1.2;
}
.np-evidence-temp {
  display: block;
  color: var(--tx2);
  font-size: var(--font-ui-xs);
  line-height: 1.2;
}
/* One line, never a wrapped block that stretches the row — the full text is on
   the span's tooltip. */
.np-evidence-table [data-evidence-decision],
.np-evidence-table [data-evidence-check-status] {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
/* Provenance and check status are context for the number above them, so they
   sit a step quieter than the column headers that share this class. */
.np-evidence-table [data-evidence-decision],
.np-evidence-table [data-evidence-check-status] {
  color: var(--tx3);
}
/* Over-limit check: colour + label (never colour alone). */
.np-evidence-check-value--over-limit,
.np-evidence-check-status--over-limit,
.np-evidence-check--over-limit [data-evidence-check-status] {
  color: var(--red);
}
.np-evidence-table td[data-check-detail-field] {
  cursor: pointer;
}
.np-evidence-table td[data-check-detail-field]:hover > span {
  text-decoration: underline;
}
.np-evidence-unsaved {
  display: block;
  color: var(--amb);
  font-size: var(--font-ui-xs);
  line-height: 1.2;
}
/* Check difference now carries the deviation and its verdict, so it needs the
   room the Effective column can spare — that one is width:auto and absorbs
   whatever is left. */
.mat-props-table.np-evidence-table th:nth-child(5),
.mat-props-table.np-evidence-table td:nth-child(5) {
  width: 9.5rem;
  min-width: 9.5rem;
  max-width: 9.5rem;
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mat-props-table.np-evidence-table th:nth-child(6),
.mat-props-table.np-evidence-table td:nth-child(6) {
  width: auto;
  min-width: 7.5rem;
  max-width: none;
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Excel-like editable tables (.tbl-excel) ───────────────────────────────
   Shared primitive applied via class. Covers number + text inputs in cells.
   Applied to: .mat-props-table, .mat-points-edit-table, #axesTable          */
.tbl-excel tbody tr {
  height: var(--admin-table-row-h);
}
.tbl-excel tbody td {
  padding-top: 0;
  padding-bottom: 0;
  line-height: 1;
  vertical-align: middle;
  overflow: hidden;
}
.tbl-excel td:has(input[type="number"]),
.tbl-excel td:has(input[type="text"]) {
  padding: 0;
  line-height: 0;
}
.tbl-excel td input[type="number"],
.tbl-excel td input[type="text"] {
  display: block;
  width: 100%;
  height: var(--admin-table-row-h);
  line-height: 1;
  padding: 0 4px;
  margin: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  color: var(--tx);
  font-size: var(--table-font-size);
  font-family: inherit;
  box-sizing: border-box;
  outline: none;
}
.tbl-excel td input[type="number"] { text-align: right; }
.tbl-excel td input[type="text"]   { text-align: right; }
.tbl-excel td input[type="number"]::-webkit-inner-spin-button,
.tbl-excel td input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.tbl-excel td input[type="number"] { -moz-appearance: textfield; }
.mat-props-table td.mat-props-plot-cell { text-align: center; }
.mat-nonlin-view-btn svg { color: var(--chart-series-5); }
.mat-nonlin-edit-btn svg { color: var(--chart-series-5); }

.mat-section-head {
  display: block;
  font-size: var(--font-ui-sm);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--tx2);
  margin: 20px 0 10px;
}

.mat-derived-chart-grid {
  display: grid;
  /* auto-fit, not a fixed 3: three long labels only fit on a wide card, and
     below that the row drops to two columns instead of cutting every label. */
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 8px;
  margin-bottom: 18px;
}
/* The tooltip wrapper is the grid item; without min-width:0 it keeps the
   button's max-content width and the button spills into the next column. */
.mat-derived-chart-grid > * {
  min-width: 0;
}
.mat-derived-chart-btn {
  justify-content: flex-start;
  min-height: 38px;
  width: 100%;
  min-width: 0;
}
.mat-derived-chart-btn span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* Property block on detail */
.mat-prop-block {
  border: 1px solid var(--bdr);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  margin-bottom: 10px;
}
.mat-prop-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 6px;
}
.mat-prop-name  { font-weight: 700; font-size: var(--font-small); font-family: var(--mono); }
.mat-prop-label { color: var(--tx2); font-size: var(--font-small); }
.mat-prop-unit  { color: var(--unit-color); font-size: var(--font-ui-xs); font-family: var(--mono); }

/* Linear values on detail */
.mat-linear-vals { display: flex; gap: 16px; }
.mat-val { font-size: var(--font-small); }
.mat-val-label {
  font-size: var(--font-ui-xs);
  text-transform: uppercase;
  color: var(--tx3);
  margin-right: 3px;
}

/* Nonlinear point table */
.mat-points-table td, .mat-points-table th {
  font-family: var(--mono);
  text-align: right;
  padding: 2px 8px;
}

/* Nonlinear modal: 1/3 table | 2/3 chart */
.mat-nonlin-modal-box {
  width:min(1180px, 96vw) !important;
  max-height:92vh;
}
.mat-nonlin-modal-box--table-only {
  width:min(520px, 94vw) !important;
}
.mat-nonlin-modal-box--edit-table .modal-content {
  overflow: visible;
}
.mat-nonlin-modal-box .modal-content {
  overflow:hidden;
  min-height:0;
}
.mat-nonlin-modal-box--table-only .modal-content {
  overflow:visible;
}
.mat-modal-nonlin {
  display: flex;
  align-items: center;
  gap: 16px;
  height: min(620px, calc(92vh - 116px));
  min-height: 420px;
}
.mat-modal-nonlin--table-only {
  display:block;
  height:auto;
  min-height:0;
}
.mat-modal-table-wrap {
  flex: 0 0 34%;
  min-width: 0;
  overflow-y: auto;
  overflow-x: auto;
  align-self: stretch;
}
.mat-modal-nonlin--table-only .mat-modal-table-wrap {
  max-height:min(420px, 60vh);
  overflow:auto;
}
.mat-modal-table-wrap .mat-points-table { width: 100%; }
.mat-modal-table-wrap .mat-points-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  /* Axis symbols are case-significant: uppercase turned ε / σ into Ε / Σ. */
  text-transform: none;
}
.mat-chart-wrap { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; align-self: stretch; position: relative; }
.mat-chart-controls { flex-shrink: 0; margin-bottom: 8px; display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; font-size: var(--font-small); }
.mat-chart-hover-actions {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px;
  border: 1px solid color-mix(in srgb, var(--bdr) 82%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--sur) 92%, transparent);
  box-shadow: 0 6px 18px rgba(15, 23, 42, .12);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition: opacity .14s ease, transform .14s ease;
}
.mat-chart-wrap:hover .mat-chart-hover-actions,
.mat-chart-wrap:focus-within .mat-chart-hover-actions,
.mat-compare-chart-canvas-wrap:hover .mat-chart-hover-actions,
.mat-compare-chart-canvas-wrap:focus-within .mat-chart-hover-actions {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}
.mat-chart-hover-btn {
  border: none;
  background: transparent;
  color: var(--tx2);
}
.mat-chart-hover-btn:hover:not(:disabled),
.mat-chart-hover-btn:focus-visible {
  color: var(--acc);
  background: color-mix(in srgb, var(--acc) 10%, transparent);
}
.mat-chart-hover-btn svg {
  opacity: .92;
}
.mat-chart-filter-label { display: flex; align-items: center; gap: 5px; color: var(--tx2); white-space: nowrap; }
.mat-chart-filter-label select,
.mat-chart-filter-label input[type="number"],
.mat-x-axis-sel,
.mat-group-axis-sel {
  appearance: none; -webkit-appearance: none; -moz-appearance: none;
  background: var(--sur);
  border: 1px solid var(--bdr);
  color: var(--tx);
  font: var(--field-font-size) var(--mono);
  min-height: 26px;
  border-radius: var(--radius-input);
  padding: 2px calc(var(--field-pad-x) + 16px) 2px var(--field-pad-x);
  outline: none;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23888' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 6px center;
}
/* The stress–strain card's "Interpolate" temperature: the select's frame, no arrow. */
.mat-chart-filter-label input[type="number"] { background-image: none; padding-right: var(--field-pad-x); cursor: text; width: 7em; }
.mat-chart-filter-label select:hover,
.mat-chart-filter-label input[type="number"]:hover,
.mat-x-axis-sel:hover,
.mat-group-axis-sel:hover { border-color: var(--acc-bdr); }
.mat-chart-filter-label select:focus,
.mat-chart-filter-label input[type="number"]:focus,
.mat-x-axis-sel:focus,
.mat-group-axis-sel:focus { border-color: var(--acc); box-shadow: 0 0 0 1px color-mix(in srgb, var(--acc) 14%, transparent); }
.mat-chart-canvas { flex: 1; min-height: 260px; width: 100% !important; height: 100% !important; }

/* Categorical multi-select checklist (media, state…) in the chart controls */
.mat-chart-ms-slot { display: contents; }
.ms-drop { position: relative; display: inline-flex; }
.ms-drop-trigger {
  appearance: none; -webkit-appearance: none; -moz-appearance: none;
  background-color: var(--sur);
  border: 1px solid var(--bdr);
  color: var(--tx);
  font: var(--field-font-size) var(--mono);
  min-height: 26px;
  border-radius: var(--radius-input);
  padding: 2px var(--field-pad-x);
  outline: none;
  cursor: pointer;
  white-space: nowrap;
}
.mat-chart-ms-slot .ms-drop-trigger {
  min-height: 26px;
  padding: 2px var(--field-pad-x);
}
.ms-drop-trigger:hover { border-color: var(--acc-bdr); }
.ms-drop-trigger strong { font-weight: 600; }
.ms-drop-caret { color: var(--tx3); margin-left: 2px; }
.ms-drop-panel { top: 100%; left: 0; margin-top: 2px; min-width: 160px; }
.ms-drop-head {
  position: sticky;
  top: 0;
  display: flex;
  gap: 6px;
  padding: 6px 10px;
  background: var(--sur);
  border-bottom: 1px solid var(--bdr);
}
.ms-drop-act {
  appearance: none; -webkit-appearance: none; -moz-appearance: none;
  background: transparent;
  border: 1px solid var(--bdr);
  border-radius: var(--radius-input);
  color: var(--acc);
  font: var(--font-small) var(--mono);
  padding: 1px 8px;
  cursor: pointer;
}
.ms-drop-act:hover { border-color: var(--acc); }
.ms-drop-row { gap: 8px; cursor: pointer; }
.ms-drop-row input { margin: 0; cursor: pointer; }
.f .ms-drop-trigger {
  line-height: 1.3;
  min-height: 28px;
  padding: var(--field-pad-y) calc(var(--field-pad-x) + 16px) var(--field-pad-y) var(--field-pad-x);
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23888' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 6px center;
}
.wire-allowlist-picker .ms-drop-panel {
  width: 100%;
  max-height: 260px;
}

/* ── Catalog dropdown picker (wire + magnet) ─────────────────────────────── */
.cat-drop-wrap { position: relative; display: block; }
.f .cat-drop-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  text-align: left;
}
.cat-drop-trigger-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; gap: 6px; }
.cat-drop-trigger-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-drop-row-badge,
.cat-drop-trigger-label .product-type-badge {
  flex-shrink: 0;
  font-size: 10px;
  line-height: 1.2;
  padding: 1px 5px;
}
.cat-drop-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 6px 8px;
  border-bottom: 1px solid var(--bdr);
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--sur);
}
.cat-drop-filter-chip {
  border: 1px solid var(--bdr);
  border-radius: 999px;
  background: var(--bg);
  color: var(--tx2);
  font: 600 10px var(--sans);
  padding: 2px 8px;
  cursor: pointer;
}
.cat-drop-filter-chip:hover { color: var(--acc); border-color: var(--acc-bdr-strong); }
.cat-drop-filter-chip.is-active {
  color: var(--acc);
  border-color: var(--acc-bdr-solid);
  background: color-mix(in srgb, var(--acc) 10%, var(--bg));
}
/* Identity variants. Same mapping as .product-type-badge (copper -> the
   market_reports hue, aluminium -> --tx2); fill and rim follow currentColor at
   the shared identity-chip strengths. The state selectors are repeated so the
   base :hover / .is-active accent rules above do not recolour an identity. */
.cat-drop-filter-chip--copper,
.cat-drop-filter-chip--copper:hover,
.cat-drop-filter-chip--copper.is-active { color: var(--app-hue-market_reports); }
.cat-drop-filter-chip--aluminium,
.cat-drop-filter-chip--aluminium:hover,
.cat-drop-filter-chip--aluminium.is-active { color: var(--tx2); }
.cat-drop-filter-chip--copper,
.cat-drop-filter-chip--copper:hover,
.cat-drop-filter-chip--copper.is-active,
.cat-drop-filter-chip--aluminium,
.cat-drop-filter-chip--aluminium:hover,
.cat-drop-filter-chip--aluminium.is-active {
  background: color-mix(in srgb, currentColor var(--identity-chip-fill), var(--bg));
  border-color: color-mix(in srgb, currentColor var(--identity-chip-bdr), var(--bdr));
}
.cat-drop-filter-chip--copper:hover,
.cat-drop-filter-chip--copper.is-active,
.cat-drop-filter-chip--aluminium:hover,
.cat-drop-filter-chip--aluminium.is-active {
  box-shadow: 0 0 0 1px color-mix(in srgb, currentColor 65%, transparent);
}
.cat-drop-filter-chip--generic:hover,
.cat-drop-filter-chip--generic.is-active {
  color: var(--tx2);
  background: color-mix(in srgb, var(--bg) 88%, var(--sur));
  border-color: var(--bdr);
}
.f .wire-conductor-filter {
  width: 100%;
  margin-bottom: 6px;
}
.cat-drop-panel {
  top: calc(100% + 2px);
  left: 0;
  width: 100%;
  max-height: 300px;
}
.cat-drop-search {
  display: block;
  width: 100%;
  box-sizing: border-box;
  border: none;
  border-bottom: 1px solid var(--bdr);
  padding: 7px 10px;
  font: var(--field-font-size) var(--mono);
  background: var(--sur);
  color: var(--tx);
  outline: none;
  position: sticky;
  top: 0;
}
.cat-drop-search:focus { border-bottom-color: var(--bdr); }
.cat-drop-search::placeholder {
  font-family: var(--mono);
  color: var(--tx3);
}
.cat-drop-list { padding: 2px 0; }
/* Match closed .f .cat-drop-trigger (field mono + size), not product-menu 11px sans. */
.cat-drop-list .product-menu-name {
  font: var(--field-font-size) var(--mono);
  font-weight: 400;
  color: var(--tx);
}
/* Selected/hover: background only — keep label color (no accent blue while typing). */
.cat-drop-list .product-menu-row.is-active .product-menu-name,
.cat-drop-list .product-menu-name:hover {
  color: var(--tx);
}
.cat-drop-actions {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 0;
}
.cat-drop-actions .admin-action-btn {
  flex: 0 0 auto;
}
.cat-drop-star { color: var(--tx3); }
.cat-drop-star:hover { color: #f59e0b; }
.cat-drop-star.is-default { color: #f59e0b; cursor: default; }
.cat-drop-star.is-default svg { fill: #f59e0b; }

/* Picker trigger + compact secondary selects on one row (admin wire/magnet) */
.catalog-picker-toolbar {
  display: flex;
  align-items: stretch;
  gap: 8px;
}
.catalog-picker-toolbar__main {
  flex: 1;
  min-width: 0;
}
.catalog-picker-toolbar > select {
  flex: 0 0 auto;
  width: 3.8rem;
  min-width: 3.8rem;
  padding-left: var(--field-pad-x);
  padding-right: calc(var(--field-pad-x) + 12px);
}
/* One-off: puts a derived-value badge beside a `.f` label instead of inside it,
   for a picker whose label has no single input to attach a suffix to. */
.catalog-picker-label-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.catalog-picker-label-row label {
  margin: 0;
}
/* One-off: small pill badge for a derived read-only value next to a field
   label — same shape (radius, padding, border) as the status pills used
   elsewhere (e.g. `.doc-status-badge`), and the same accent-tint recipe as
   `.r-empty-action` (color-mix against `--acc`/`--red`, so it reads correctly
   in both themes without a separate dark override). `--red` tint once the
   value passes its limit. */
.field-value-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 8px;
  border: 1px solid var(--acc-bdr-strong);
  border-radius: 999px;
  background: color-mix(in srgb, var(--acc) 14%, var(--bg));
  color: var(--acc);
  font-size: var(--font-ui-xs);
  font-weight: 600;
  white-space: nowrap;
}
.field-value-badge.field-value-badge--err {
  border-color: color-mix(in srgb, var(--red) 45%, var(--bdr));
  background: color-mix(in srgb, var(--red) 14%, var(--bg));
  color: var(--red);
}
.catalog-picker-toolbar > select#np_magnet_br_basis {
  width: auto;
  min-width: 8.5rem;
  max-width: 11rem;
}

@media (max-width: 860px) {
  .mat-nonlin-modal-box .modal-content {
    overflow-y:auto;
  }
  .mat-modal-nonlin {
    flex-direction:column;
    height:auto;
    min-height:0;
  }
  .mat-modal-table-wrap {
    flex:0 0 auto;
    width:100%;
    max-height:32vh;
  }
  .mat-chart-wrap {
    width:100%;
    min-height:360px;
  }
}

/* Edit form */
.mat-required { color: var(--red); }
.mat-form-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  padding-top: var(--admin-panel-pad-y);
}
.mat-props-section { margin-top: 10px; }
.mat-props-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}
.mat-add-prop-wrap { margin-left: auto; }
.mat-add-prop-wrap select { min-width: 240px; }

/* Nonlinear expansion row (detail + edit) */
.mat-axes-summary { color: var(--tx2); font-size: var(--font-small); font-family: var(--mono); }
.mat-nonlin-qual { font-size: 10px; color: var(--tx3); margin-left: 4px; }
.mat-pt-count { color: var(--tx3); font-size: var(--font-tiny); margin-left: 6px; }
.mat-unit-cell { color: var(--tx2); text-align: center; white-space: nowrap; }
.mat-modal-points-wrap { display: flex; flex-direction: column; gap: 10px; }
.mat-modal-bottom-row { display: flex; gap: 6px; align-items: center; }
.mat-modal-points-wrap .mat-points-edit-table { margin: 0; }

/* Nonlinear edit table — equal-width data columns, borderless inputs */
.mat-points-edit-table { table-layout: fixed; width: 100%; }
.mat-points-edit-table th:not(.admin-actions),
.mat-points-edit-table td:not(.admin-actions) { width: auto; }
.mat-points-edit-table th.admin-actions,
.mat-points-edit-table td.admin-actions {
  width: 96px;
  min-width: 96px;
  text-align: right;
}
.mat-points-edit-table td input {
  width: 100%;
  box-sizing: border-box;
  font-family: var(--mono);
  font-size: var(--font-small);
  padding: 0 2px;
  margin: 0;
  border: 1px solid transparent;
  border-radius: var(--radius-input);
  background: transparent;
  color: var(--tx);
  cursor: text;
  transition: border-color 0.1s, background 0.1s;
}
.mat-points-edit-table td input:hover {
  border-color: var(--bdr);
  background: var(--sur);
}
.mat-points-edit-table td input:focus {
  outline: none;
  border-color: var(--acc);
  background: var(--sur);
}

/* Linear property inputs inside table cells */
.mat-lin-nom, .mat-lin-min, .mat-lin-max {
  width: 100px;
  font-family: var(--mono);
  font-size: var(--font-small);
  padding: 0 2px;
  margin: 0;
  border: 1px solid transparent;
  border-radius: var(--radius-input);
  background: transparent;
  color: var(--tx);
  cursor: text;
  transition: border-color 0.1s, background 0.1s;
  box-sizing: border-box;
  width: 100%;
}
.mat-lin-nom:hover, .mat-lin-min:hover, .mat-lin-max:hover {
  border-color: var(--bdr);
  background: var(--sur);
}
.mat-lin-nom:focus, .mat-lin-min:focus, .mat-lin-max:focus {
  outline: none;
  border-color: var(--acc);
  background: var(--sur);
}

/* Compare trigger button & badge */
.mat-compare-trigger {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: var(--font-small);
}
.mat-compare-trigger--disabled {
  opacity: .4;
  cursor: default;
  pointer-events: none;
}
.mat-compare-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 9px;
  background: var(--acc);
  color: var(--tx-on-fill);
  font-size: var(--font-ui-xs);
  font-weight: 700;
  line-height: 1;
}
.mat-compare-check-col { width: 52px; text-align: center; padding-right: 0; white-space: nowrap; }
.mat-check-all-label { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; font-size: var(--table-head-font-size); color: var(--tx2); user-select: none; }

/* Materials index table — 6-col layout: checkbox | label | category | manufacturer | standard | actions */
/* mat-materials-table column widths are set via #catalogTable below. */

/* Header column filter (tables.th_filter macro + mat-col-filter.js).
   Single source of truth — do not add per-table stretch overrides. */
/* No resting dim, unlike `.admin-action-btn svg`: this icon is part of the
   column label, not a row action, so it carries the header's own colour and
   weight. At .45 it measured 2.89:1 on the dark header and 2.4:1 on the light
   one; even at the shared .8 it still read faint beside 700-weight uppercase
   text, because a lucide glyph this small paints a sub-pixel hairline. Full
   --tx2 plus a thicker stroke puts it at the label's weight. */
.mat-th-filter-btn { cursor: pointer; color: var(--tx2); flex-shrink: 0; display: inline-flex; align-items: center; }
.mat-th-filter-btn svg { stroke-width: 2.75; }
.mat-th-filter-btn:hover { color: var(--tx); }
.mat-th-filter {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 4px;
  min-height: 22px;
  min-width: 0;
  box-sizing: border-box;
}
.mat-th-filter--center { justify-content: center; }
.mat-th-filter .mat-th-input-wrap,
.mat-th-filter .admin-head-search-wrap {
  display: flex;
  flex: 1;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}
/* The choice variant (`th_filter_choice`) drops a panel under its heading
   rather than swapping the heading for a row of boxes. Four kinds never fitted
   the column the label was sized for, and the two that did left the header
   blank while open. The panel is free of the column width, so a column can
   offer as many options as it has. */
.mat-th-filter { position: relative; }
.mat-th-filter .mat-th-choices {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 7px;
  min-width: max(100%, 150px);
  width: max-content;
  padding: 9px 11px;
  background: var(--sur-raised, var(--sur));
  border: 1px solid var(--bdr);
  border-radius: 7px;
  box-shadow: 0 6px 18px rgb(0 0 0 / 12%);
  white-space: nowrap;
  text-align: left;
}
.mat-th-filter--center .mat-th-choices { left: 50%; transform: translateX(-50%); }
/* The cell clips its own overflow, which would cut the panel off at the header
   rule. Only while it is open, and only on that cell. */
.admin-table th.is-choice-open { overflow: visible; }
.admin-table th.is-choice-open .mat-th-filter { z-index: 31; }
.mat-th-filter .admin-head-name-search,
.mat-th-filter .mat-th-input {
  flex: 1;
  width: 0;
  min-width: 0;
  height: 18px;
  padding: 0;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--tx);
  font-size: var(--font-ui-xs);
  font-family: var(--sans);
  outline: none;
  box-shadow: none;
  -webkit-appearance: none;
  appearance: none;
}
.mat-th-filter .admin-head-name-search:focus,
.mat-th-filter .mat-th-input:focus {
  outline: none;
  border: 0;
  box-shadow: none;
}
.mat-th-filter input[type="search"]::-webkit-search-decoration,
.mat-th-filter input[type="search"]::-webkit-search-cancel-button {
  -webkit-appearance: none;
}

/* Keep th stable when the search input replaces the label — no height/width jump */
.admin-table.mat-materials-table { table-layout: fixed; width: 100%; }
/* Room to breathe. A catalog row is read across, not down: at the shared list
   rhythm (38px rows, 12px sides) eight columns of digits ran together into a
   wall of text. These are the shared tokens, retuned for this one table, so
   every rule that already uses them follows without a second padding rule. */
.mat-materials-table {
  --admin-list-row-h: 46px;
  --admin-list-pad-y: 11px;
  --admin-list-pad-x: 20px;
}
.mat-materials-table th { white-space: nowrap; overflow: hidden; text-align: center; }
.mat-materials-table td { text-align: center; }
.mat-materials-table td:nth-child(2) { text-align: left; }
.mat-materials-table th.admin-actions,
.mat-materials-table td.admin-actions { text-align: right; }
/* Materials index widths, by what the column IS, never by where it sits. The
   table used to be a fixed six (checkbox | label | category | manufacturer |
   standard | actions) and carried `#materialsIndexTable td:nth-child(n)` rules
   to match. The column count is now per category — 4 for fluid, 9 for metal —
   so those rules pointed at Br and Hcj and centred them under a right-aligned
   header, at ID specificity that nothing could override. This is the trap
   06_DESIGN_LANGUAGE.md warns about under "Column widths". */
/* Column widths. Only the two structural columns are pinned; every other
   column is sized by the browser from its own content.

   Three earlier attempts hand-set a percentage per column and none balanced,
   for a reason worth writing down: the column count changes with the category
   (6 for fluid, 9 for metal), so one set of percentages is always wrong
   somewhere. Under `table-layout:fixed` a column with **no** width declared
   takes an equal share of whatever the pinned columns leave, so leaving them
   all undeclared balances the row by construction and widens the columns
   automatically when a category has fewer of them. That is the whole rule.

   `table-layout:auto` is not an option here, whatever it looks like in one
   screenshot: every cell is nowrap, so the table's minimum width became the
   sum of the longest values and it ran 1065px wide inside a 980px panel whose
   overflow is clipped — the Actions column simply disappeared off the right.
   06_DESIGN_LANGUAGE.md records the same failure for the products table.

   `resizable-tables.js` also had to go: it wrote a <colgroup> measured from
   content that beat the stylesheet outright and handed all the slack to
   Supplier (375px beside 79px number columns). The table opts out of the
   resizer, as the sibling catalog list already did. */
.admin-table.perf-table.mat-materials-table { table-layout: fixed; }
/* Clear the shared 20/24/46% `nth-child` defaults first. They are tuned for the
   standard three-column entity list and, on a table whose column count varies,
   they land on whatever happens to sit third — here they gave BH max 398px and
   left the other three numbers 32px each. Position-based widths cannot survive
   a per-category column set. */
.admin-table.perf-table.mat-materials-table :is(th, td) { width: auto; }
/* The tick plus the table's own 20px side padding does not fit in a narrow
   column, and the overflow renders as a stray ellipsis beside every checkbox. */
.admin-table.perf-table.mat-materials-table :is(th, td).mat-compare-check-col {
  width: 46px;
  padding-left: 14px;
  padding-right: 0;
  overflow: visible;
}
/* One width for every materials list, because every one of them holds the same
   three icon buttons: 3 x 22px + 2 x 4px gap + 6px of side padding. The shared
   admin default reserves 90px. */
.admin-table.perf-table.mat-materials-table:not(.mat-props-table) :is(th, td).admin-actions {
  width: 86px;
  min-width: 86px;
  max-width: 86px;
  padding-left: 6px;
  padding-right: 6px;
}
/* A chip needs room for its own padding, not the cell's. */
.admin-table.perf-table.mat-materials-table :is(th, td).mat-kind-col {
  padding-left: 10px;
  padding-right: 10px;
}
/* No `overflow:visible` here. Every cell is nowrap, so a visible name column
   makes the table's minimum width the longest name in the category and the
   table then overflows its card (1065px inside an 866px panel) instead of
   shrinking. Ellipsis plus the row's hover text is the shared behaviour. */
/* Two exceptions to the equal share: a name and a company name are words, and
   words need more room than a five-character number. Everything else still
   splits what is left, so fewer columns still means wider columns. */
.admin-table.perf-table.mat-materials-table :is(th, td).mat-label-col {
  width: 19%;
  text-align: left;
}
/* 24, not 16: the column reads `manufacturer` now, which is filled on the rows
   `supplier` never was, so real company names ("Barlog Plastics GmbH", "Toda
   Kogyo Corporation") are what it actually has to hold rather than the handful
   of short ones `supplier` carried. 24 is where the number columns still keep
   their own headers — past it "Density (g/cm3)", the widest of them, starts
   losing characters, and one 32-character supplier name is not worth that. */
.admin-table.perf-table.mat-materials-table :is(th, td).mat-text-col { width: 24%; }
/* A sortable numeric header keeps its name and toggle on the right, over the
   numbers they describe. */
.mat-materials-table th.mat-num-col .admin-head-name-tools {
  justify-content: flex-end;
  /* Tighter than a text header's: every pixel here is a pixel the name and its
     unit do not have, and the toggle is already touching the name it sorts. */
  gap: 2px;
}
/* One line, always: name, unit and toggle. `flex: none` is the half that is
   easy to miss -- a flex item shrinks below its content by default, so the
   header wrapped even in a column wide enough for it, and widening the column
   did nothing. A property whose name cannot hold that line gets a shorter one
   in SHORT_COLUMN_LABELS rather than a second row here. */
.mat-materials-table th.mat-num-col .admin-head-name-tools > span { flex: none; }
/* These columns are numbers, so the room goes to them: a narrower gutter than
   the text columns, which have whole words to breathe around. */
.mat-materials-table :is(th, td).mat-num-col,
.mat-materials-table :is(th, td).mat-num-cell { padding-left: 4px; padding-right: 4px; }

/* Shared property catalog list: Label / Category / Type / Unit (auto) [/ Actions].
   The technical key lives on the property detail/edit page, not in this list. */
.admin-table.perf-table.property-catalog-table th:nth-child(1),
.admin-table.perf-table.property-catalog-table td:nth-child(1) { width: 34%; }
.admin-table.perf-table.property-catalog-table th:nth-child(2),
.admin-table.perf-table.property-catalog-table td:nth-child(2) { width: 15%; }
/* 3 is the axis count, 4 is Unit / Axes -- which takes what is left, because
   an axis list is the widest thing in the table. */
.admin-table.perf-table.property-catalog-table th:nth-child(3),
.admin-table.perf-table.property-catalog-table td:nth-child(3) { width: 8%; }
.admin-table.perf-table.property-catalog-table th:nth-child(4),
.admin-table.perf-table.property-catalog-table td:nth-child(4) { width: auto; }
.admin-table.perf-table.property-catalog-table th.admin-actions,
.admin-table.perf-table.property-catalog-table td.admin-actions {
  width:90px;
  min-width:90px;
  max-width:90px;
  text-align:right;
  overflow:visible;
}
/* Label cell (col 1): left-aligned; overflow visible so the CSS tooltip can
   escape the cell. Truncation is handled by the inner .mat-catalog-label-text span. */
.admin-table.perf-table.property-catalog-table td:nth-child(1) {
  overflow: visible;
  text-align: left;
}
/* Category badge (col 2): centered. Overrides the shared .mat-materials-table
   td:nth-child(2) left rule (which targets the Label column on the index page). */
.admin-table.perf-table.property-catalog-table td:nth-child(2) {
  text-align: center;
}

/* Material name link (index list, col 2): clean clickable text — dark,
   no underline, accent on hover. Not a default blue underline link. */
.mat-name-link {
  display: inline-block;
  max-width: 100%;
  font-weight: 600;
  color: var(--tx);
  text-decoration: none;
  cursor: pointer;
  transition: color .12s;
}
.mat-name-link:hover { color: var(--acc); }
.mat-name-link:focus-visible {
  outline: 2px solid var(--acc);
  outline-offset: 1px;
}
.mat-name-text {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Compare page */
.mat-compare-scroll { overflow-x: auto; }
.mat-compare-table { table-layout: auto; min-width: 500px; width: 100%; }
.mat-compare-prop-col { width: 140px; min-width: 100px; max-width: 160px; }
.mat-compare-mat-col { min-width: 160px; text-align: center; }
.mat-compare-mat-link {
  display: block;
  font-weight: 600;
  font-size: var(--font-small);
  margin-bottom: 4px;
  color: var(--acc);
  text-decoration: none;
}
.mat-compare-mat-link:hover { text-decoration: underline; }
.mat-compare-meta-row td { font-size: var(--font-small); }
.mat-compare-key {
  font-weight: 600;
  font-size: var(--font-small);
  color: var(--tx2);
  max-width: 160px;
  overflow: hidden;
}
.mat-compare-prop-name {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: default;
}
.mat-compare-label-unit {
  display: block;
  color: var(--unit-color);
  font: 600 var(--font-ui-xs) var(--mono);
}
.mat-compare-table[data-unit-mode="inline"] .mat-compare-label-unit,
.mat-compare-table[data-unit-mode="row"] .mat-compare-value-unit {
  display: none;
}
.mat-compare-table[data-unit-mode="row"] .mat-compare-range {
  margin-left: 0;
  display: block;
}
.mat-compare-divider-row td {
  padding-top: 14px;
  padding-bottom: 2px;
  border-top: 2px solid var(--bdr2);
}
.mat-compare-section-label {
  font-size: var(--font-ui-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--tx3);
}
.mat-compare-diff { background: color-mix(in srgb, var(--acc) 8%, transparent); }
.mat-compare-diff .mat-compare-nom { font-weight: 700; color: var(--acc); }
.mat-compare-nom { font-family: var(--mono); font-size: var(--font-small); }
.mat-compare-range {
  margin-left: 4px;
  font-size: var(--font-tiny);
  color: var(--tx3);
  font-family: var(--mono);
}
.mat-compare-missing { color: var(--tx3); }
.mat-compare-detail-only { color: var(--tx3); font-size: var(--font-small); }
.mat-compare-nonlin { font-size: var(--font-small); color: var(--tx2); font-family: var(--mono); }
.mat-compare-state-badge { font-size: 10px; color: var(--tx3); font-weight: 400; margin-left: 4px; text-transform: uppercase; letter-spacing: 0.04em; }
.mat-compare-entry { display: block; white-space: nowrap; line-height: 1.6; }
.mat-compare-entry-key { font-size: 10px; color: var(--tx3); }
.mat-compare-curve-table { border-collapse: collapse; font-size: var(--font-small); font-family: var(--mono); width: 100%; }
.mat-compare-curve-table th { color: var(--tx2); font-weight: 600; text-align: right; padding: 1px 6px; border-bottom: 1px solid var(--bdr); white-space: nowrap; }
.mat-compare-curve-table th:first-child { text-align: left; }
.mat-compare-curve-table td { text-align: right; padding: 1px 6px; color: var(--tx); }
.mat-compare-curve-table td:first-child { text-align: left; color: var(--tx2); }
.mat-compare-prop-name { font-size: var(--font-small); }
.mat-compare-chart-section { margin-top: 24px; }
.mat-compare-chart-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; font-size: var(--font-small); }
.mat-compare-chart-canvas-wrap { position: relative; height: 480px; }

/* Catalog page */
/* Axes picker input — inline transparent style, border only on hover/focus */
.ax-picker-input {
  width: 100%;
  box-sizing: border-box;
  font: inherit;
  font-size: var(--font-small);
  color: var(--tx);
  padding: 2px 4px;
  border: 1px solid transparent;
  border-radius: var(--radius-input);
  background: transparent;
  outline: none;
  cursor: text;
  transition: border-color .1s, background .1s;
}
.ax-picker-input:hover {
  border-color: var(--bdr);
  background: var(--sur);
}
.ax-picker-input:focus {
  border-color: var(--bdr);
  background: var(--sur);
}
.ax-picker-input::placeholder { color: var(--tx3); font-style: italic; }

.mat-catalog-note { margin-bottom: 12px; }
.mat-catalog-label {
  min-width:0;
  display:inline-flex;
  align-items:center;
  justify-content:flex-start;
  gap:5px;
  max-width:100%;
}
.mat-catalog-label[data-tooltip] {
  cursor:default;
}
.mat-catalog-label-text {
  flex:1 1 auto;
  min-width:0;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}

/* Axis property badge */
.ax-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 6px; border-radius: 4px;
  background: var(--acc2);
  border: 1px solid var(--acc-bdr);
  color: var(--tx); font-size: var(--font-small);
  white-space: nowrap; max-width: 100%;
}
.ax-badge-remove {
  display: inline-flex; align-items: center; justify-content: center;
  background: none; border: none; padding: 0; cursor: pointer;
  color: var(--tx2); line-height: 1;
}
.ax-badge-remove:hover { color: var(--red); }
.ax-prop-cell { vertical-align: middle; }

/* ── Scatter tool ─────────────────────────────────────────────────────────── */

/* Scatter uses the shared Motool/DQModel column shell over the graph-paper canvas. */
.mat-scatter-layout {
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* Area right of sidebar — flex column so panel fills full height */
.mat-scatter-scroll {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  /* Same board inset the Pump Designer's `.dwg-page` uses -- one token, so the two
     boards cannot drift apart at the bottom edge. */
  padding: var(--page-wrap-pad-y) var(--page-wrap-pad-x);
  overflow: hidden;
}

/* Chart surface — fills the shared results column. */
.mat-scatter-main {
  flex: 1;
  min-height: 0;
  width: 100%;
  max-width: min(1450px, 100%);
  margin: 0 auto;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
/* The board is always the wide one: the Selection card and the lock bar keep
   their slots whether or not they have anything in them, so the plot box is the
   same rectangle from first paint on. */
.mat-scatter-main { max-width: min(1450px, 100%); }

/* Sidebar: reuses .col shell — just set width */
.mat-scatter-sidebar {
  width: 286px;
  min-width: 180px;
}
/* Category switch: the sidebar keeps its place, but everything below the
   category picker still describes the previous category until the data lands. */
.mat-scatter-sidebar.is-switching #scatterClassPicker,
.mat-scatter-sidebar.is-switching #scatterUseAll,
.mat-scatter-sidebar.is-switching #scatterGroupSection,
.mat-scatter-sidebar.is-switching #scatterCondSection,
.mat-scatter-sidebar.is-switching #scatterPropPicker,
.mat-scatter-selection-pane.is-switching {
  opacity: .38;
  pointer-events: none;
  transition: opacity .12s ease;
}

.mat-scatter-body {
  padding: 12px 12px 20px;
  display: flex;
  flex-direction: column;
  gap: 0;
}


.mat-scatter-section { margin-bottom: 12px; }

.mat-scatter-label {
  display: block;
  font-size: var(--font-ui-sm);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--tx2);
  margin-bottom: 5px;
}

.mat-scatter-use-all-label {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 0;
  cursor: pointer;
  user-select: none;
}

/* Full-width select reusing mat-group-axis-sel chevron style */
.mat-scatter-select-full { width: 100%; }

.mat-scatter-group-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-height: 150px;
  overflow-y: auto;
  padding: 2px 0;
}

.mat-scatter-group-list label,
.mat-scatter-cond-row label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: var(--field-font-size);
  cursor: pointer;
  user-select: none;
}

.mat-scatter-cond-row { display: flex; gap: 12px; }

/* Property picker */
.mat-scatter-prop-picker { display: flex; flex-direction: column; gap: 5px; margin-top: 10px; }

.mat-scatter-prop-group-head {
  font-size: var(--font-ui-sm);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--tx3);
  margin-bottom: 3px;
}
.mat-scatter-selection-head { margin-top: 10px; }

/* Collapsible property groups — one open at a time, so every domain heading
   stays visible and only the open group scrolls. */
.mat-scatter-prop-group { display: flex; flex-direction: column; min-height: 0; }

button.mat-scatter-prop-group-head {
  display: flex;
  align-items: center;
  gap: 5px;
  width: 100%;
  padding: 4px 6px;
  margin-bottom: 0;
  background: none;
  border: none;
  border-radius: 4px;
  text-align: left;
  cursor: pointer;
}
button.mat-scatter-prop-group-head:hover { background: var(--table-row-hover-bg); color: var(--tx2); }
.mat-scatter-prop-group.is-open > button.mat-scatter-prop-group-head { color: var(--tx2); }

.mat-scatter-prop-group-chev { flex: none; transition: transform .12s ease; }
.mat-scatter-prop-group.is-open .mat-scatter-prop-group-chev { transform: rotate(90deg); }

.mat-scatter-prop-group-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }

.mat-scatter-prop-group-marks { flex: none; display: flex; gap: 3px; }

.mat-scatter-prop-group-mark {
  flex: none;
  font-size: 9px;
  line-height: 1;
  font-weight: 700;
  padding: 2px 4px;
  border-radius: 3px;
  /* 9px bold on an accent tint is the hardest text in the sidebar to read, and a
     16% fill under a plain --acc ink measured 4.03:1 in light and 3.72:1 in
     buehler — under the 4.5:1 small-text bar. A lighter fill alone could not fix
     buehler (4.60:1 even with no fill at all: its accent is that close to its
     page), so the ink carries 15% of --tx as well. Worst theme is now 4.88:1
     (buehler), best 7.20:1 (dark). Worn by the group heading and by the axis
     letter on a property row — measure both if you change either number. */
  background: color-mix(in srgb, var(--acc) 8%, transparent);
  color: color-mix(in srgb, var(--acc) 85%, var(--tx));
}

.mat-scatter-prop-group-count {
  flex: none;
  font-size: 9px;
  font-weight: 600;
  color: var(--tx3);
  opacity: .7;
}

.mat-scatter-prop-rows {
  display: flex;
  flex-direction: column;
  gap: 1px;
  max-height: min(52vh, 440px);
  overflow-y: auto;
  /* Indented under the heading text; the right gap keeps an ellipsised name off
     the scrollbar. Rows sit tight together — each one paints its own hover
     background, and a gap between them would break that band up. */
  padding: 2px 6px 4px 7px;
}

/* A property row is a button, not a form control: the name is the whole target,
   and the only mark is the axis letter it earned. */
.mat-scatter-prop-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 15px;
  gap: 8px;
  align-items: center;
  width: 100%;
  padding: 3px 5px 3px 7px;
  background: none;
  border: none;
  border-radius: 4px;
  color: inherit;
  font: inherit;
  font-size: var(--field-font-size);
  text-align: left;
  cursor: pointer;
  transition: background .12s ease, color .12s ease;
}
.mat-scatter-prop-row:hover { background: var(--table-row-hover-bg); color: var(--tx2); }
.mat-scatter-prop-row:focus-visible { outline: 2px solid var(--acc); outline-offset: -2px; }

/* One signal, not three. Accent text alone was too close to the ordinary ink to
   find in a 31-row list; a tinted band plus a left bar plus a filled letter was
   too loud for two rows out of thirty-one. The filled letter carries it, and the
   accent name confirms it. */
.mat-scatter-prop-row[data-axis="x"],
.mat-scatter-prop-row[data-axis="y"] { color: var(--acc); font-weight: 600; }

/* The letter is the *same chip* as the mark on a collapsed group heading — it
   wears `.mat-scatter-prop-group-mark`, so there is one look for "this owns an
   axis" and no second style to keep in step. Empty on an unpicked row, so the
   column stays reserved and no name shifts when a pick lands. */
.mat-scatter-prop-axis { text-align: center; }
.mat-scatter-prop-axis:empty { background: none; padding: 0; }


/* One line per property. A wrapped name breaks the scan down the radio column,
   and these labels run long ("Heat deflection temperature (method C, 8.00 MPa)"),
   so the name ellipsises and the tooltip carries label + description in full. */
.mat-scatter-prop-name {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}


/* Axis locks — a caption bar at the top of the plot card. A multi-input property
   (Creep modulus, Isochronous stress-strain) needs its other inputs pinned before
   one dot per material exists; saying so next to the plot beats hiding three more
   dropdowns at the bottom of the sidebar, where they fell below the fold. */
/* Axis locks — their own card above Selection, on the side away from the plot.
   A multi-input property (Creep modulus, Isochronous stress-strain) needs its
   other inputs pinned before one dot per material exists. Keeping it out of the
   plot card leaves that card evenly padded on all four sides, and a property
   that pins nothing simply drops the card without resizing anything. */
.mat-scatter-axis-locks {
  flex: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px 12px;
  border: 1px solid color-mix(in srgb, var(--bdr) 70%, transparent);
  border-radius: 8px;
  background: color-mix(in srgb, var(--sur) 88%, transparent);
}
.mat-scatter-axis-locks.is-empty { display: none; }
.mat-scatter-axis-locks.is-empty { visibility: hidden; }
.mat-scatter-lock-lead {
  font-size: var(--font-ui-sm);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--tx3);
  margin-bottom: 2px;
}
.mat-scatter-lock-row { display: flex; align-items: center; gap: 8px; }
.mat-scatter-lock-label {
  font-size: var(--field-font-size);
  color: var(--tx2);
  white-space: nowrap;
}
.mat-scatter-lock-label { min-width: 22px; }
.mat-scatter-lock-sel { flex: 1; min-width: 0; height: 28px; }

/* Chart area — fills remaining panel height */
.mat-scatter-chart-wrap {
  flex: 1;
  min-height: 0;
  min-width: 0;
  position: relative;
  display: flex;
  padding: 14px;
  border: 1px solid color-mix(in srgb, var(--bdr) 70%, transparent);
  border-radius: 8px;
  background: color-mix(in srgb, var(--sur) 88%, transparent);
}

.mat-scatter-canvas-box { flex: 1; min-width: 0; min-height: 0; position: relative; }
.mat-scatter-chart-wrap canvas { width: 100% !important; height: 100% !important; }
.mat-scatter-chart-wrap.mode-drag canvas { cursor: crosshair; }
.mat-scatter-chart-wrap.mode-pan  canvas { cursor: grab; }
.mat-scatter-chart-wrap.mode-pan  canvas:active { cursor: grabbing; }

/* A group of tools in the corner of a picture, on a small plate of its own. The plate
   is the point: an icon dropped straight onto a chart or a drawing is the page's text
   colour over whatever happens to be under it -- light grey on white in one theme,
   and invisible in the other. Position is the caller's (top-right of a chart,
   bottom-right of a sheet); everything else is here, once. */
.chart-tools {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 1px;
  background: var(--sur);
  border: 1px solid var(--bdr);
  border-radius: var(--radius-md, 6px);
  padding: 2px;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
  z-index: 10;
}
/* Chart tool pill — top right of the chart */
.mat-scatter-chart-tools {
  top: 14px;
  right: 14px;
  left: auto;
  transform: none;
}
.mat-scatter-tool-btn {
  padding: 4px 6px;
  line-height: 1;
  border-radius: 4px;
}
.mat-scatter-tool-btn.is-active {
  background: color-mix(in srgb, var(--acc) 12%, var(--sur));
  color: var(--acc);
}
/* Per-button icon colors */
#scatterZoomArea svg  { color: #3b82f6; }
#scatterPanToggle svg { color: #f97316; }
#scatterResetZoom svg { color: #6b7280; }
.mat-scatter-clear-fav svg { color: #ef4444; }
.mat-scatter-index-btn { color: var(--tx-on-fill); background: #eab308; border-color: #eab308; }
.mat-scatter-index-btn:hover { background: #ca8a04; border-color: #ca8a04; color: var(--tx-on-fill); }
.mat-scatter-index-btn svg { color: var(--tx-on-fill); }
#scatterZoomArea.is-active  { background: #eff6ff; }
#scatterPanToggle.is-active { background: #fff7ed; }
.tool-sep {
  width: 1px;
  height: 16px;
  background: var(--bdr2);
  margin: 0 2px;
}

.mat-scatter-no-data {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--tx3);
  font-size: var(--font-small);
  pointer-events: none;
}

/* Materials route loader — shown only during click navigation (JS-injected) */
.mat-route-loader {
  position: fixed;
  left: 0;
  right: 0;
  top: var(--topbar-h);
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  z-index: 200;
}

/* Scatter chart fetch overlay — the frame and the sidebar stay put, only the
   plot area dims, so a category switch never looks like a page reload. */
.mat-content-loader {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  pointer-events: none;
  border-radius: inherit;
  /* Wash only — do not re-tile the html grid (double density / seams). */
  background-color: color-mix(in srgb, var(--sur) 72%, transparent);
  background-image: none;
}
.mat-scatter-chart-wrap.is-loading canvas {
  opacity: .3;
  transition: opacity .12s ease;
}
.mat-scatter-chart-wrap.is-loading .mat-scatter-chart-tools,
.mat-scatter-chart-wrap.is-loading .mat-scatter-no-data {
  visibility: hidden;
}

/* Favorites lists in sidebar — two columns side by side */
/* Selection pane — a card beside the plot inside the same padded board, not a
   second sidebar rail. It appears only once both axes are picked. Its two lists
   stack vertically and share the pane height, each with its own scroll: side by
   side in 250 px would truncate every material name, and that truncation is what
   pushed this out of the sidebar in the first place. */
.mat-scatter-board {
  flex: 1;
  min-height: 0;
  min-width: 0;
  display: flex;
  gap: 12px;
}

.mat-scatter-side {
  flex: none;
  width: 250px;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mat-scatter-selection-pane {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 10px 12px 12px;
  border: 1px solid color-mix(in srgb, var(--bdr) 70%, transparent);
  border-radius: 8px;
  background: color-mix(in srgb, var(--sur) 88%, transparent);
}
.mat-scatter-selection-pane .mat-scatter-selection-head { margin: 0 0 8px; }
.mat-scatter-selection-pane.is-empty { visibility: hidden; }

.mat-scatter-lists-wrap {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.mat-scatter-sidebar-lists {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  min-height: 0;
}
.mat-scatter-sidebar-list-col {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1 1 0;
  min-height: 0;
}

.mat-scatter-list-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  border-bottom: 1px solid var(--bdr2);
  background: var(--sur);
  flex-shrink: 0;
  font-size: var(--font-small);
}
.mat-scatter-list-cond {
  font-size: var(--font-ui-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: 1px 7px;
  border-radius: 10px;
}
.mat-scatter-list-cond--dry  { background: #fee2e2; color: #991b1b; }
.mat-scatter-list-cond--cond { background: #dbeafe; color: #1d4ed8; }

.mat-scatter-select-all {
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  font-size: var(--font-small);
  color: var(--tx2);
  user-select: none;
}

.mat-scatter-list { padding: 4px 0; flex: 1; min-height: 0; overflow-y: auto; }

.mat-scatter-list-item {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  font-size: var(--font-ui-sm);
  cursor: pointer;
  user-select: none;
  min-width: 0;
}
.mat-scatter-list-item-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.mat-scatter-list-item:hover { background: var(--table-row-hover-bg); }

/* Clicking a dot in the plot ticks a row that may be off screen in a 60-row
   list. `_revealInList` scrolls it into view and flashes it once, so the click
   has a visible answer. */
@keyframes matScatterPickFlash {
  from { background: color-mix(in srgb, var(--acc) 45%, transparent); }
  to   { background: transparent; }
}
.mat-scatter-list-item.is-just-picked { animation: matScatterPickFlash 1.1s ease-out; }
@media (prefers-reduced-motion: reduce) {
  .mat-scatter-list-item.is-just-picked { animation: none; }
}
.mat-scatter-list-item input[type="checkbox"] { cursor: pointer; flex-shrink: 0; }
.mat-scatter-list-empty {
  color: var(--tx3);
  padding: 2px 8px;
  font-size: var(--font-ui-sm);
}

/* Compare shortcut from scatter */
.mat-scatter-compare-row { padding: 8px 0 0; flex: none; }
.mat-scatter-compare-btn { width: 100%; justify-content: center; }

/* Toolbar actions in mat-toolbar */
.mat-toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.mat-toolbar-actions { margin-left: auto; display: flex; gap: 6px; }


/* ── AI Chat panel ─────────────────────────────────────────────────────────── */
.chat-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 0 16px 12px;
  box-sizing: border-box;
}

.chat-thread {
  flex: 1;
  overflow-y: auto;
  padding: 16px 0 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chat-welcome {
  color: var(--tx2);
  font-size: 0.88rem;
  padding: 24px 0 8px;
}
.chat-welcome-examples { margin-top: 6px; }

.chat-message { display: flex; }
.chat-message--user { justify-content: flex-end; }
.chat-message--ai,
.chat-message--error { justify-content: flex-start; }

.chat-bubble {
  display: inline-block;
  padding: 8px 12px;
  border-radius: 10px;
  max-width: 80%;
  font-size: 0.88rem;
  line-height: 1.5;
  word-break: break-word;
}
.chat-message--user .chat-bubble {
  background: var(--acc);
  color: var(--tx-on-fill);
  border-bottom-right-radius: 3px;
}
.chat-message--ai .chat-bubble {
  background: var(--sur-step);
  color: var(--tx);
  border-bottom-left-radius: 3px;
}
.chat-message--error .chat-bubble {
  background: var(--danger-bg);
  color: var(--danger-fg);
  border-bottom-left-radius: 3px;
}

.chat-input-bar {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  padding-top: 8px;
  border-top: 1px solid var(--bdr);
}

.chat-textarea {
  flex: 1;
  resize: none;
  font-size: 0.88rem;
  padding: 6px 10px;
  border: 1px solid var(--bdr);
  border-radius: 6px;
  background: var(--sur);
  color: var(--tx);
  line-height: 1.4;
}
.chat-textarea:focus { outline: 2px solid var(--acc); border-color: transparent; }

.chat-footer { min-height: 18px; padding-top: 4px; }

.chat-usage {
  font-size: 0.75rem;
  color: var(--tx3);
}

/* ── AI Chat floating overlay ──────────────────────────────────────────────*/
.chat-fab {
  position: fixed;
  bottom: var(--fab-inset);
  right: var(--fab-inset);
  z-index: 900;
  width: var(--fab-size);
  height: var(--fab-size);
  border-radius: 50%;
  background: var(--acc);
  color: var(--tx-on-fill);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
  transition: background 0.15s, transform 0.15s;
}
.chat-fab:hover { background: var(--acc-strong); transform: scale(1.08); }
.chat-fab--active { background: var(--acc-strong); }
.chat-fab svg { pointer-events: none; }

/* hidden attribute must win over display:flex — explicit override */
.chat-overlay-panel[hidden],
#chat-fab[hidden] { display: none !important; }

.chat-overlay-panel {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 900;
  width: 360px;
  max-width: calc(100vw - 32px);
  height: 480px;
  max-height: calc(100vh - 100px);
  background: var(--sur);
  border: 1px solid var(--bdr);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chat-overlay-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--bdr);
  flex-shrink: 0;
}
.chat-overlay-title {
  font-size: 0.83rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--tx);
}
.chat-overlay-close {
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px;
  color: var(--tx3);
  display: flex;
  align-items: center;
  border-radius: 4px;
}
.chat-overlay-close:hover { color: var(--tx); background: var(--bg); }

.chat-overlay-thread {
  flex: 1;
  overflow-y: auto;
  padding: 10px 12px 4px;
  gap: 8px;
}

.chat-input-wrap {
  margin: 8px 12px;
  border: 1px solid var(--bdr);
  border-radius: 14px;
  background: var(--sur);
  display: flex;
  align-items: center;
  padding: 6px 6px 6px 12px;
  gap: 6px;
}
.chat-input-wrap:focus-within {
  border-color: var(--acc);
  box-shadow: 0 0 0 2px rgba(59,130,246,0.15);
}
.chat-textarea-inner {
  flex: 1;
  resize: none;
  border: none;
  outline: none;
  background: transparent;
  color: var(--tx);
  font-size: 0.85rem;
  line-height: 1.45;
  max-height: 120px;
  overflow-y: auto;
  font-family: inherit;
}
.chat-send-btn {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--acc);
  color: var(--tx-on-fill);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.chat-send-btn:hover { background: #2563eb; }
.chat-send-btn:disabled { background: var(--bdr); cursor: default; }
.chat-send-btn svg { pointer-events: none; }
.chat-overlay-panel .chat-footer { padding: 0 12px 6px; }
.chat-overlay-panel .chat-usage { font-size: 0.72rem; }

/* Chat setup / coming-soon box */
.chat-setup-box {
  margin-top: 14px;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--bdr);
  border-radius: 8px;
  font-size: 0.78rem;
  color: var(--tx);
}
.chat-setup-title {
  font-weight: 600;
  margin: 0 0 8px;
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--acc);
}
.chat-setup-step {
  margin: 6px 0 2px;
  color: var(--tx2);
}
.chat-setup-code {
  display: block;
  font-family: monospace;
  font-size: 0.75rem;
  background: var(--bg);
  border: 1px solid var(--bdr);
  border-radius: 4px;
  padding: 4px 8px;
  color: var(--tx);
  line-height: 1.6;
  word-break: break-all;
}

/* Markdown rendering inside AI chat bubbles */
.chat-bubble--md { max-width: 100%; }
.chat-bubble--md p { margin: 0 0 6px; }
.chat-bubble--md p:last-child { margin-bottom: 0; }
.chat-bubble--md ul, .chat-bubble--md ol { margin: 4px 0 6px 16px; padding: 0; }
.chat-bubble--md li { margin-bottom: 2px; }
.chat-bubble--md code {
  background: rgba(0,0,0,0.08);
  border-radius: 3px;
  padding: 1px 4px;
  font-size: 0.82em;
  font-family: monospace;
}
.chat-bubble--md pre {
  background: rgba(0,0,0,0.06);
  border-radius: 5px;
  padding: 8px 10px;
  overflow-x: auto;
  margin: 6px 0;
}
.chat-bubble--md pre code { background: none; padding: 0; }
.chat-bubble--md table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.8em;
  margin: 6px 0;
}
.chat-bubble--md th, .chat-bubble--md td {
  border: 1px solid rgba(0,0,0,0.15);
  padding: 4px 8px;
  text-align: left;
}
.chat-bubble--md th { background: rgba(0,0,0,0.05); font-weight: 600; }
.chat-bubble--md h1, .chat-bubble--md h2, .chat-bubble--md h3 {
  font-size: 0.9em;
  font-weight: 700;
  margin: 8px 0 4px;
}
.chat-bubble--md strong { font-weight: 600; }
.chat-bubble--md blockquote {
  border-left: 3px solid var(--acc);
  margin: 4px 0;
  padding: 2px 8px;
  opacity: 0.8;
}

/* AI Chat settings panel */
.settings-ai-actions { margin-top: var(--form-row-gap); display: flex; align-items: center; gap: 12px; }
.settings-ai-status { font-size: 0.82rem; }
.settings-ai-status--ok { color: #16a34a; }
.settings-ai-status--err { color: #dc2626; }

/* ── modal-back backdrop (used by modal_shell macro) ──────────────────────── */
.modal-back {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--modal-backdrop);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}
.modal-back.is-open { display: flex; }

/* ── Parameter editor mode ─────────────────────────────────────────────────── */
#paramEditorRoot {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* ── Diagram strip — floats over the graph-paper canvas ─────────────────── */
.col-results { position: relative; }
/* Push rcontent down so the floating strip doesn't cover the paper.
   Matched on the shared class, not on `#paramDiagramStrip`: the strip macro
   takes a `strip_id`, so an id selector silently skipped every page that passes
   its own — Market Reports named its view switch `marketReportsViewStrip` and
   its paper came out 24px under the strip. The clearance belongs to the strip,
   whatever a page calls it. */
.col-results:has(.param-diagram-strip:not([hidden])) .rcontent {
  padding-top: var(--hud-float-pad-top);
}
/* ── Console nav: HUD strip (Motool/DQ param diagram + Settings tabs) ── */
/* Blinking block cursor is hub-console only — not on these nav strips. */
.console-nav,
.param-diagram-strip {
  --term-tick-len: 12px;
  position: relative;
  display: flex;
  align-items: center;
  gap: 0;
  padding: 0 10px;
  background: var(--term-bg);
  border: 1px solid var(--term-bdr);
  border-radius: var(--radius-md);
  box-shadow: var(--term-glow);
  white-space: nowrap;
  font-family: var(--mono);
}
/* prompt caret before the first item */
.console-nav::before,
.param-diagram-strip::before {
  content: '›';
  color: var(--term-prompt);
  font-size: 0.85rem;
  margin-right: 4px;
  font-family: var(--mono);
  flex-shrink: 0;
}
.console-nav::after,
.param-diagram-strip::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: var(--term-ticks);
}
.console-nav-item,
.param-diagram-node {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  border-radius: 0;
  border: none;
  background: transparent;
  color: var(--nav-icon);
  --nav-icon: var(--term-tx2);
  font-size: 0.8rem;
  font-family: var(--mono);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s, color 0.12s;
  position: relative;
  letter-spacing: 0.03em;
}
.console-nav-item[data-settings-tab="motool"] { --nav-icon: var(--app-hue-motool); }
.console-nav-item[data-settings-tab="pmsm"] { --nav-icon: var(--app-hue-dqmodel); }
.console-nav-item[data-settings-tab="maps"] { --nav-icon: var(--app-hue-maps); }
.console-nav-item[data-settings-tab="appearance"] { --nav-icon: var(--app-hue-help); }
.console-nav-item[data-settings-tab="materials"] { --nav-icon: var(--app-hue-materials); }
.console-nav-item[data-settings-tab="account"] { --nav-icon: var(--app-hue-admin); }
.console-nav-item[data-settings-tab="ai"] { --nav-icon: var(--app-hue-maps); }
.console-nav-item[data-me-tab="account"] { --nav-icon: var(--app-hue-admin); }
.console-nav-item[data-part="impeller"] { --nav-icon: var(--pump-part-impeller); }
.console-nav-item[data-part="blade"] { --nav-icon: var(--pump-part-blade); }
.console-nav-item[data-part="volute"] { --nav-icon: var(--pump-part-volute); }
.console-nav-item[data-part="diffusor"] { --nav-icon: var(--pump-part-diffusor); }
/* The 3D tab is not a part of the pump, so it wears the app's own mark rather than
   borrowing one part's ink. */
.console-nav-item[data-part="view3d"] { --nav-icon: var(--app-hue-ipump); }
/* The most crowded strip in the app, on a page capped at `--paper-max-w` (1040 px),
   which leaves the strip 1020. Measured in a browser at that width: eight tabs want
   1079 px, and what hangs over is cut off -- the rounded corners, the corner ticks and
   the prompt caret with them. It has now happened twice, at seven tabs and again the
   moment the 3D tab made it eight, because both times the answer was a smaller number.

   So this is two rules instead. The first buys the room: 6 px an item, which brings the
   eight to 1013 px with 27 to spare. The second makes a NINTH tab shorten a label
   rather than cut the strip -- the items may shrink (`min-width: 0`) and a label with
   nowhere to go ends in an ellipsis. A tab added later is then shorter, never severed.
   Everything else -- colours, ticks, glow, the `<` `/>` marks -- stays shared. */
.pump-part-tabs { max-width: 100%; min-width: 0; }
/* Owner, 2026-09-16: the ellipsis was showing at the width they actually work at
   ("Meridio...", "Slowdo..."), because the sidebar takes its share and what is left is
   well under the 1020 the eight tabs were measured against. A name half-printed tells
   nobody which part it is, so the third rule buys back what the label needs: the icon
   sits closer to the word, the tracking of a strip nobody reads as code goes, and the
   type drops one step. Eight full labels now want ~620 px instead of ~1013. The
   ellipsis stays as the last resort below that -- a ninth tab still shortens a label
   rather than cutting the strip. `.console-nav--compact` is that tighter strip for any page
   whose tabs share a narrow row (the Pump Designer's parts; the gerotor pump's views). */
.console-nav--compact .console-nav-item {
  padding-left: 5px;
  padding-right: 5px;
  min-width: 0;
  gap: 4px;
  letter-spacing: 0;
  font-size: 0.75rem;
}
.console-nav--compact .console-nav-item > span { overflow: hidden; text-overflow: ellipsis; }
/* The gear's dialog labels each field with the parameter's own name, and a parameter
   name is case-sensitive: `Tip_Angle` is not `TIP_ANGLE`, and `c` shown as `C` reads as a
   different value altogether. The shared `.f label` uppercases, which is right for
   "Rated voltage" and wrong for a name somebody has to type or search for. Scoped to the
   dialog by id rather than given a class of its own: nothing else on the page labels a
   field with a name. */
#pumpExpertModal .f label { text-transform: none; letter-spacing: 0; }
.console-nav-item[data-me-tab="work"] { --nav-icon: var(--app-hue-catalog); }
.console-nav-item[data-me-tab="files"] { --nav-icon: var(--app-hue-field_viewer); }
.console-nav-item svg,
.param-diagram-node svg {
  flex-shrink: 0;
  color: var(--nav-icon, currentColor);
}
.console-nav-item::before,
.param-diagram-node::before { content: '<'; color: transparent; font-family: var(--mono); }
.console-nav-item::after,
.param-diagram-node::after  { content: '/>'; color: transparent; font-family: var(--mono); }
.console-nav-item:hover::before,
.console-nav-item.is-active::before,
.console-nav-item.is-act::before,
.param-diagram-node:hover::before,
.param-diagram-node.is-active::before { color: var(--nav-icon); }
.console-nav-item:hover::after,
.console-nav-item.is-active::after,
.console-nav-item.is-act::after,
.param-diagram-node:hover::after,
.param-diagram-node.is-active::after { color: var(--nav-icon); }
.console-nav-item:hover,
.param-diagram-node:hover { color: var(--nav-icon); }
.console-nav-item.is-active,
.console-nav-item.is-act,
.param-diagram-node.is-active { color: var(--nav-icon); }
/* A tab that cannot be opened now (the gerotor Performance tab's Size for duty, for a timed kidney): muted, no hover
   brackets; the page says why beside it. */
.console-nav-item:disabled { color: var(--term-tx3); cursor: not-allowed; }
.console-nav-item:disabled svg { color: currentColor; }
.console-nav-item:disabled:hover::before,
.console-nav-item:disabled:hover::after { color: transparent; }

/* Component diagram strip: floating placement above results area */
.param-diagram-strip {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 30;
  pointer-events: auto;
}
.param-diagram-node > i, .param-diagram-node > span:not(.param-diagram-dot):not(.param-diagram-off-badge) { pointer-events: none; }
.param-diagram-off-badge {
  margin-left: 4px;
  padding: 0 4px;
  border: 1px solid #fbbf24;
  border-radius: 3px;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1.3;
  color: #fbbf24;
}
.param-diagram-node.is-off { color: var(--term-tx3); }
.param-diagram-node.is-off svg { opacity: 0.65; }

/* Optional components: prominent include toggle (sidebar + modal) */
.param-comp-enable {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  margin: 0 0 12px;
  border: none;
  border-radius: 0;
  background: transparent;
  font-size: var(--font-ui-sm);
  font-weight: 600;
  color: var(--tx);
  cursor: pointer;
}
.param-comp-enable:has(input:not(:checked)) {
  color: var(--tx2);
}
/* The modal is the only home for the include toggle (legacy sidebar removed),
 * so it must stay visible — it is the control that re-enables an OFF component. */
#param-modal-body .param-comp-enable {
  margin-bottom: 10px;
  padding-left: 0;
  padding-right: 0;
}
/* Per-component icon colors — same identity hues as the hub. */
.param-diagram-node[data-comp-key="battery"]     { --nav-icon: var(--app-hue-materials); }
.param-diagram-node[data-comp-key="motor"]       { --nav-icon: var(--app-hue-motool); }
.param-diagram-node[data-comp-key="cable"]       { --nav-icon: var(--app-hue-dqmodel); }
.param-diagram-node[data-comp-key="dc_cable"]    { --nav-icon: var(--app-hue-dqmodel); }
.param-diagram-node[data-comp-key="ac_cable"]    { --nav-icon: var(--app-hue-dqmodel); }
.param-diagram-node[data-comp-key="inverter"]    { --nav-icon: var(--app-hue-maps); }
.param-diagram-node[data-comp-key="commutator"]  { --nav-icon: var(--app-hue-catalog); }
.param-diagram-node[data-comp-key="gearbox"]     { --nav-icon: var(--app-hue-admin); }
.param-diagram-node[data-comp-key="load"]        { --nav-icon: var(--app-hue-rfq_search); }
.param-diagram-node[data-comp-key="environment"] { --nav-icon: var(--app-hue-market_reports); }
/* Market Reports uses the strip as a view switch, not a component row, so its
   two keys are views. Scoped to the strip id: "report"/"tables" are generic
   words and must not colour a component node that ever takes the same key. */
#marketReportsViewStrip .param-diagram-node[data-comp-key="report"] { --nav-icon: var(--app-hue-market_reports); }
#marketReportsViewStrip .param-diagram-node[data-comp-key="tables"] { --nav-icon: var(--app-hue-catalog); }
.param-diagram-arrow { color: var(--tx2, #6b7280); font-size: 0.8rem; padding: 0 1px; user-select: none; }
.param-diagram-dot { display: none; }

/* ── Param editor modal ──────────────────────────────────────────────────────
   Size to content; only scroll vertically when modal-box hits max-height:90vh.
   overflow-x must be explicit: with only overflow-y:auto, CSS pairs x→auto too,
   and a 1px-wide child paints a horizontal scrollbar right above Done. */
#param-modal-body {
  padding: 12px 16px;
  flex: 0 1 auto;
  min-width: 0;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
}
#param-modal-body.param-modal-body--select-open {
  overflow: visible;
}

/* Force sections expanded when inside the modal body */
#param-modal-body .psec-head { pointer-events: none; cursor: default; background:transparent; }
#param-modal-body .psec-head:hover { background:transparent; }
#param-modal-body .psec-head .comp-var-sel,
#param-modal-body .psec-head .comp-var-dropdown { pointer-events: auto; }
#param-modal-body .psec-head .psec-arr { display: none; }
/* Only the active component's section group is shown (set by parameter-editor-mode.js) */
#param-modal-body .psec { display: none; }
#param-modal-body .psec.is-active-comp { display: block; }
#param-modal-body .psec.is-active-comp .psec-body {
  display: flex !important;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
  max-width: 100%;
}
#param-modal-body .fg { gap: 10px 12px; min-width: 0; }

/* Variant picker — full width under modal title (not cramped in section head).
   Contain body scroll; native <select> menus still escape via
   .param-modal-body--select-open + fixed catalog dropdowns. */
#param-editor-modal .modal-box { overflow: hidden; }
#param-modal-body .psec-head {
  display: block;
  padding: 0 10px 10px;
}
#param-modal-body .psec-head .psec-title { display: none; }
#param-modal-body .psec-head-left {
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  width: 100%;
}
#param-modal-body .comp-var-sel:not(:empty)::before {
  content: "Variant";
  display: block;
  font-size: var(--label-font-size);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--tx3);
  margin-bottom: 4px;
}
#param-modal-body .comp-var-sel {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 2px;
  margin-left: 0;
  width: 100%;
}
#param-modal-body .comp-var-dropdown {
  width: 100%;
  max-width: none;
  box-sizing: border-box;
  font-size: var(--field-font-size);
  font-family: var(--mono);
  color: var(--tx);
}
#param-modal-body .psec-head-row { pointer-events: none; cursor: default; }
#param-modal-body .psec-head-row .psec-arr { display: none; }
/* Load points: scroll list only; keep action bar pinned below */
#param-modal-body #ps-load .psec-body {
  display: flex !important;
  flex-direction: column;
  max-height: 36vh;
  overflow: hidden;
  min-height: 0;
  padding-top: 2px;
}
#param-modal-body #ps-load #lp-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}
#param-modal-body #ps-load .lp-actions {
  flex-shrink: 0;
}
#param-modal-body #ps-load .lp-apply-all-label {
  font-size: var(--font-small);
}

/* LP modal table — match other param-modal field typography */
#param-modal-body #ps-load .lp-table {
  font-size: var(--field-font-size);
}
#param-modal-body #ps-load .lp-table thead th {
  font-size: var(--label-font-size);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}
#param-modal-body #ps-load .lp-table tbody td {
  vertical-align: middle;
}
#param-modal-body #ps-load .lp-table input[type="text"],
#param-modal-body #ps-load .lp-table input[type="number"] {
  border: none;
  background: transparent;
  border-radius: 0;
  padding: var(--field-pad-y) var(--field-pad-x);
  font: var(--field-font-size) var(--mono);
  line-height: 1.3;
  min-height: 28px;
}
#param-modal-body #ps-load .lp-table input[type="text"]:focus,
#param-modal-body #ps-load .lp-table input[type="number"]:focus {
  background: color-mix(in srgb, var(--acc) 10%, transparent);
  outline: none;
  box-shadow: inset 0 -1px 0 var(--acc);
}
#param-modal-body #ps-load .lp-table input:disabled {
  background: transparent;
}
#param-modal-body #ps-load .lp-table td.lp-speed-toggle {
  text-align: center;
}
#param-modal-body #ps-load .lp-table td.lp-speed-toggle input[type="checkbox"],
#param-modal-body #ps-load .lp-table td.lp-cap-temp-toggle input[type="checkbox"] {
  display: block;
  margin: 0 auto;
}
#param-modal-body #ps-load .lp-table td:last-child {
  text-align: center;
}
#param-modal-body #ps-load .lp-table .lp-del {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
}

/* modal-box--w-680 size modifier */
.modal-box--w-680 { width: min(680px, 96vw); max-width: 96vw; }

.maps-runs-bar {
  position: absolute;
  left: 18px;
  bottom: 18px;
  z-index: 45;
  width: min(520px, calc(100% - 36px));
  pointer-events: none;
}
.maps-runs-bar.is-empty {
  display: none;
}
.maps-jobs-reopen {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--paper-bg);
  border: 1px solid var(--paper-border);
  border-radius: 999px;
  box-shadow: var(--paper-shadow);
  color: var(--tx3);
  cursor: pointer;
  padding: 7px 13px;
  font: 700 var(--font-tiny) var(--sans);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.maps-jobs-reopen:hover {
  color: var(--tx);
}
.maps-jobs-panel {
  pointer-events: auto;
  background: var(--paper-bg);
  border: 1px solid var(--paper-border);
  border-radius: var(--paper-radius);
  box-shadow: var(--paper-shadow);
  overflow: hidden;
}
.maps-jobs-head {
  display: flex;
  align-items: stretch;
  border-bottom: 1px solid var(--paper-border);
}
.maps-jobs-toggle {
  flex: 1;
  min-width: 0;
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 0;
  background: color-mix(in srgb, var(--paper-bg) 88%, var(--bg));
  color: var(--tx);
  cursor: pointer;
  padding: 8px 11px;
  font: 700 var(--font-small) var(--sans);
  text-align: left;
}
.maps-jobs-title {
  flex: 1;
  min-width: 0;
}
.maps-jobs-summary {
  flex: 0 0 auto;
  color: var(--tx3);
  font: 700 var(--font-tiny) var(--sans);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.maps-jobs-toggle svg {
  flex: 0 0 auto;
  color: var(--tx3);
  transition: transform .14s ease;
}
.maps-jobs-close {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  border: 0;
  border-left: 1px solid var(--paper-border);
  background: color-mix(in srgb, var(--paper-bg) 88%, var(--bg));
  color: var(--tx3);
  cursor: pointer;
}
.maps-jobs-close:hover {
  color: var(--tx);
  background: color-mix(in srgb, var(--paper-bg) 80%, var(--bg));
}
.maps-jobs-panel.is-collapsed .maps-jobs-head {
  border-bottom: 0;
}
.maps-jobs-panel.is-collapsed .maps-jobs-toggle svg {
  transform: rotate(180deg);
}
.maps-jobs-panel.is-collapsed .maps-jobs-list {
  display: none;
}
.maps-jobs-list {
  display: grid;
  gap: 8px;
  max-height: min(300px, calc(100vh - 210px));
  overflow: auto;
  padding: 10px;
}
#mapsRcontent.rcontent-empty .rpanel-stack,
#mapsRcontent.rcontent-empty #maps-paper,
#mapsRcontent.rcontent-empty #maps-result {
  display: flex;
  flex: 1;
  min-height: 0;
}
#mapsRcontent.rcontent-empty .rpanel-stack,
#mapsRcontent.rcontent-empty #maps-paper {
  flex-direction: column;
}
.maps-run-card {
  min-width: 0;
  background: color-mix(in srgb, var(--paper-bg) 94%, var(--bg));
  border: 1px solid var(--bdr);
  border-radius: var(--paper-radius);
  box-shadow: none;
  padding: 10px 12px;
  cursor: default;
}
.maps-run-card.is-selectable { cursor: pointer; }
.maps-run-card.is-selected { border-color: var(--acc); }
.maps-run-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.maps-run-card-head strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--font-small);
}
.maps-run-card-status {
  margin-top: 7px;
  color: var(--tx2);
  font-size: var(--font-tiny);
}
.maps-run-pill {
  flex: 0 0 auto;
  border: 1px solid var(--bdr);
  border-radius: 999px;
  padding: 2px 7px;
  color: var(--tx3);
  font: 700 var(--font-tiny) var(--sans);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.maps-run-pill--running,
.maps-run-pill--queued,
.maps-run-pill--cancelling { color: var(--acc); border-color: var(--acc-bdr-strong); }
.maps-run-pill--done { color: var(--grn); border-color: color-mix(in srgb, var(--grn) 42%, var(--bdr)); }
.maps-run-pill--error,
.maps-run-pill--cancelled { color: var(--red); border-color: color-mix(in srgb, var(--red) 42%, var(--bdr)); }
@media (max-width: 720px) {
  .maps-runs-bar {
    left: 10px;
    right: 10px;
    bottom: 10px;
    width: auto;
  }
  .maps-jobs-list {
    max-height: 220px;
  }
}

/* Strip: [hidden] must beat display:flex/inline-flex on strip and its children */
.param-diagram-strip[hidden] { display: none !important; }
.param-diagram-node[hidden] { display: none !important; }
.param-diagram-arrow[hidden] { display: none !important; }

/* Param editor modal — no section rule above Done footer */
#param-modal-body .psec { border-bottom: none; }
#param-editor-modal .modal-box > .modal-foot {
  border-top: none;
  padding-top: 8px;
}

/* Maps job-run list (sidebar) */
.maps-run-row {
  border: 1px solid var(--bdr);
  border-radius: 6px;
  padding: 8px 10px;
  margin-bottom: 8px;
  cursor: default;
}
.maps-run-row.is-selectable { cursor: pointer; }
.maps-run-row.is-selected { border-color: var(--acc); }
.maps-run-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.maps-run-status { font-size: 12px; opacity: 0.8; }
.maps-run-actions { display: flex; gap: 6px; margin-top: 6px; }
.maps-empty { opacity: 0.6; }

/* Maps component strip: Battery and FEM nodes (not yet configurable) use muted color */
.param-diagram-node.maps-locked { opacity: 0.55; cursor: default; }
.param-diagram-node.maps-locked:hover::before,
.param-diagram-node.maps-locked:hover::after { color: transparent; }
.param-diagram-node.maps-locked:hover { color: inherit; }


.admin-count-col { width: 4rem; }
.admin-shrink-nowrap-col { width: 1%; white-space: nowrap; }
.admin-center-cell { text-align: center; }
.admin-count-badge-sm { font-size: 11px; }
.catalog-axis-picker-wrap { position: relative; }
.catalog-axis-index-col { width: 70px; }
.catalog-axis-symbol-col { width: 100px; }
.catalog-axis-unit-col { width: 80px; }
.catalog-axis-actions-col { width: 40px; }
.catalog-axis-index-cell { width: 60px; white-space: nowrap; }
.catalog-axis-prop-cell { min-width: 180px; }
.btn-compare-hidden { display: none; }
.file-input-hidden { display: none; }
.note-normal-weight { font-weight: normal; }




/* ── Catalog performance warnings ──
   The curve itself reuses the shared `.r-plot` result-image wrapper; only the
   warning list needs its own rule. */
.perf-warning-list { margin:0; padding:0; list-style:none; display:flex; flex-direction:column; gap:4px; }
.perf-warning-list li { color:var(--amb); font-size:var(--font-ui-sm); display:flex; align-items:center; gap:6px; }

/* ── Narrow topbar: Back / Exit stay operable (nav plan Phase 6) ── */
@media (max-width: 560px) {
  .topbar-account-actions {
    flex-shrink: 0;
    gap: 4px;
  }
  .topbar-account-actions .projects-user-label {
    display: none;
  }
  .topbar-account-actions [data-theme-menu-open],
  .topbar-account-actions #spa-back-btn:not([hidden]),
  .topbar-account-actions a[aria-label="Back"],
  .topbar-account-actions a[aria-label="Exit"],
  .topbar-account-actions a[aria-label="Log out"] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    min-width: 44px;
  }
  /* Secondary workspace tools live in the variant sidebar; collapse brand chrome. */
  .topbar-badge--brand {
    display: none;
  }
}

#gerotorPerformancePreviewPlots .r-plot img { cursor: default; }


/* ------------------------------------------------------------------------------------
   Drawing editor (shared/drawing-editor.js): a drawing whose numbers are the fields.
   The SVG carries `.dwg-callout` texts tagged `data-param`; the contract is in
   docs/guides/shared/06_DESIGN_LANGUAGE.md §13. Colours are tokens only.
   ------------------------------------------------------------------------------------ */
/* A drawing page, shaped like the Materials scatter board: the page fills what is left
   of the window, the tab strip sits on top, and the drawing box takes the rest of the
   height. One box, one size, whichever part is open -- the server fits the drawing to
   it, so a wide short part is drawn BIGGER rather than padded out. */
/* Same mechanism as Motool's diagram strip, not the same hand-counted numbers: the strip
   FLOATS over the page (so its height never moves anything) and the box below starts at the
   shared --hud-float-pad-top. Both pages read the one token, so they cannot drift apart. */
.dwg-page {
  /* The colour of paper, written once and read by everything that has to agree with
     it: the box the sheet sits in, the veil over a redraw, the sheet's own rect, the
     halo behind every number and dot, and the ground each hatch tint is mixed back
     toward. It is `--sur-raised` -- the raised surface a modal and the drawing
     lightbox already wear -- so the sheet is paper in a light theme and a visible
     sheet one shade lighter than the page in a dark one. It could only become this
     once the package named its ink by style (plan §8.4): a dark box under a
     sheet still printed in hex would have been a dark box that flashes white. */
  --dwg-paper: var(--sur-raised);
  position: relative;
  flex: 1;
  min-height: 0;
  padding-top: 0;
  /* `.rcontent` pays --results-wrap-pad-y (32px) below; a drawing board is not a
     paper page, so it takes the same 24px the Materials scatter board takes. */
  padding-bottom: var(--page-wrap-pad-y);
  width: 100%;
  /* The same page width the motor apps use -- `--paper-max-w`, the cap on
     `.rpanel-wrap.is-act`. It used to be 1450 px, copied from the Materials
     scatter board, and owner, 2026-09-13: the paper is wider than on Motool and
     DQModel. It is one app; the page is one width. */
  max-width: min(var(--paper-max-w), 100%);
  margin: 0 auto;
  overflow: hidden;
  gap: 10px;
}
.dwg-page > .admin-nav-row {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  gap: 14px;
}
.dwg-page > .dwg-stage { margin-top: var(--hud-float-pad-top); }
/* One box on this page, and it IS the paper: the stage wears the sheet's colour
   itself, so there is no edge between the box and the paper in it and nothing to
   notice when a part's drawing is trimmed shorter than the box. No border and no
   padding either -- a dark theme shows the dark page and then the sheet, not a
   second, slightly different dark panel in between. (Until 2026-09-12 the stage was
   a plate of its own and the white came off the <svg> element; a sheet then changed
   height from tab to tab, which is what gave this away.) */
.dwg-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--dwg-paper);
  border-radius: 6px;
}
/* The drawings, under the wheel and the drag (shared/pan-zoom.js). Nothing here
   moves: zooming changes the window the SVG shows (its viewBox), so the paper always
   fills its box and the part spreads out instead of being magnified. The pen must
   not spread with it -- `non-scaling-stroke` holds every line, and the white halo
   behind a callout, at the width the sheet was drawn with, however far in you go.
   Text, dots, arrowheads and hatch are held by the module, attribute by attribute.
   It is `.dwg-layer`, not `.dwg-view`: a VIEW is one drawing of the part inside the
   sheet (`<g class="dwg-view" data-view>`, written by the package), and one class
   cannot mean both the thing that is moved and the thing everything moves inside. */
.dwg-layer {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  touch-action: none;
}
.dwg-stage.is-zoomed .dwg-layer { cursor: grab; }   /* only once there is somewhere to move to */
/* The 3D tab's box, filling the stage exactly as a drawing does -- one box, one size,
   whichever tab is open (D22). `position: absolute` rather than a flex child: the viewer
   measures the element it is given and builds a canvas of that size ONCE, so it must have
   its size before it is handed over, and a `hidden` flex child has none. Everything
   inside it is the viewer's own (`vendor/three-cad-viewer.css`). */
.dwg-scene {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: 6px;
}
/* The TCAE tab's page: the same box every drawing and the 3D scene fill, so nothing
   on the page moves when it opens. It scrolls inside itself rather than growing the
   stage, because what goes in here only gets taller as the runs list and the results
   table land. Padding and nothing else -- every control in it is a shared primitive. */
.dwg-tcae {
  position: absolute;
  inset: 0;
  overflow: auto;
  border-radius: 6px;
  /* The gap between the paper's edge and the form, now that the form fills the
     paper (`.tcae-form` below no longer caps at 680px). First halved, then -- once
     the form had nothing but this padding standing between it and the paper's
     rounded corner -- owner, 2026-09-21: "add x3 more padding as now pls". Three
     times that halved value is 1.5x the shared token, so this is `calc()` off it
     rather than a literal for the same reason as before: it stays in step with
     `--page-wrap-pad-x` if that ever changes. Top/bottom keep the shared value:
     only the sides were ever called out. */
  padding: var(--page-wrap-pad-y) calc(var(--page-wrap-pad-x) * 1.5);
}
/* Reverted, 2026-09-21: widening the paper itself (`max-width: 100%`) was the wrong
   fix -- owner: "you made paper with larger!!!! i wanted inner margins smaller
   inside paper". The paper stays the same 1040px sheet on every tab, TCAE included.
   The real gap the owner meant was never `.dwg-tcae`'s own padding above (a few
   pixels) -- it is `.tcae-form`'s 680px cap, centred with `margin: 0 auto` inside a
   1040px paper: (1040 - 680) / 2, roughly 180px, of blank paper on each side. See
   `.tcae-form` below. */
/* The case form on that page. Originally capped at 680px -- the Motool parameter
   window's own width (`modal-box--w-680`), so the two pages would read as one app
   (owner, 2026-09-17: "this is how motool looks like"). Centred with `margin: 0
   auto` inside the 1040px paper, that cap is what was actually leaving the wide
   blank margin the owner circled today -- roughly 180px of empty paper on each
   side, no matter how small `.dwg-tcae`'s own padding was made. Owner, 2026-09-21:
   "i wanted inner margins smaller inside paper". The cap is gone; the form now
   fills the paper down to `.dwg-tcae`'s padding, the same way the Fluid and Mesh
   rows' `.fg-3` grids were already sized to.

   What was there before 2026-09-17: two `.comp-block` boxes painting `--sur` on a
   `--sur-raised` sheet (a darker box in a lighter box, saying nothing) under an
   amber `.param-readout` card, which is the app's colour for a DERIVED value --
   the Motool window uses it correctly, for Copper area / Slot fill / R. Here it
   carried the pump's name, which the sheet already shows in its corner. */
.tcae-form {
  width: 100%;
}
/* The shared head carries 24px above it for the section it ends; the first one
   ends nothing and the page already has its own padding. */
.tcae-form > .admin-section-head:first-child { margin-top: 0; }
/* The Export button, which `export-control.js` injects into the 3D viewer's OWN
   toolbar row. A new class, and the change summary says why: the vendor's `.tcv_btn`
   is a 30x30 icon-only button with a background image, and this one carries words
   that change ("Export", "impeller...", "Download"). The app's `btn` is the other
   candidate and is wrong for the opposite reason -- it would sit in that row looking
   like something dropped into it.

   So: this app's own tokens and the vendor's own 30px row height. The tokens are the
   app's rather than the viewer's `--tcv-*` for two reasons -- those are defined in the
   vendored stylesheet, which is injected at runtime and scoped to the box, so reading
   them here would be reading a token `motool.css` never defines (a test says so); and
   they would be the same colours anyway, because `scene-view.js` gives the box the
   page's own `data-theme`.

   A FIXED width, not a minimum: that row is `overflow-x: clip` and minimises itself
   below a width threshold, so a button that grew as its label changed would push the
   viewer's own buttons out of sight mid-export -- and `min-width` stops shrinking,
   which is the opposite problem. The label is its own element because that is what
   `text-overflow` needs: on the button itself it would not apply to a bare text node
   (an anonymous flex item), so a long word was clipped mid-letter instead of ending
   in an ellipsis. With the span, the button owns its own width and nothing upstream
   has to write short English to protect a layout. */
.pump-export-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  /* Hugs its label, and never grows past the old fixed 132px. It WAS a flat
     `width: 132px`, reserved for the working face's body names ("impeller…"), which
     left a hole beside "Export ▾" the whole time the button is idle -- which is
     almost always. Growth mid-export is still bounded, and this button is the
     toolbar's last child, so the vendor's `margin-left: auto` is what it eats into
     first rather than the viewer's own buttons. Past 132px the label ellipsizes,
     which is what `.pump-export-btn-label` was always for. */
  max-width: 132px;
  height: 30px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background-color: transparent;
  color: var(--tx);
  font-family: inherit;
  font-size: 12px;
  white-space: nowrap;
  cursor: pointer;
}
.pump-export-btn:hover {
  background-color: var(--bdr2);
}
.pump-export-btn.is-loading {
  cursor: default;
  opacity: 0.75;
}
/* No spinner rule here on purpose. The working face appends `.spin`, the app's one
   shared loader -- one shape, one keyframe, one duration, and the only one
   `prefers-reduced-motion` slows down. `.is-loading` rather than `is-busy` because
   `.dwg-stage.is-busy` on this same page is the drawing veil. */
.pump-export-btn-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pump-export-btn[data-face="ready"] {
  color: var(--success-fg);
  font-weight: 600;
}
.dwg-canvas svg polyline,
.dwg-canvas svg polygon,
.dwg-canvas svg circle,
.dwg-canvas svg text,
.dwg-canvas svg > rect { vector-effect: non-scaling-stroke; }
/* The ink follows the theme.

   The package prints every mark twice over: the hex a printed sheet needs, as a
   presentation attribute, AND the NAME of the style that hex came from, as a class
   (`class="dwg-ink dwg-ink-<style>"`, plan 8.4). Anywhere else -- the package's own
   doc images, a sheet saved to disk -- the hex is all there is and the drawing looks
   the way it always did. Here the class answers first, because a class beats a
   presentation attribute, and the sheet becomes part of the page: brown hub, blue
   shroud, purple blade, teal inlet in light; the same four lightened in dark; the
   greys, the reds and the type from the page's own text tokens.

   Every selector is wrapped in `:where()` down to a single class of weight, so the
   states a callout wears on top -- hover, warn, error, held by the model -- still win
   without having to be rewritten heavier. `--dwg-ink` is the one value each rule sets;
   what it paints depends on the element, because SVG strokes a line and fills a
   letter. */
:where(.dwg-canvas svg) .dwg-ink { --dwg-ink: var(--tx); }
:where(.dwg-canvas svg) .dwg-ink-hub,
:where(.dwg-canvas svg) .dwg-ink-dim-hub { --dwg-ink: var(--pump-part-impeller); }
:where(.dwg-canvas svg) .dwg-ink-shroud,
:where(.dwg-canvas svg) .dwg-ink-dim-shr { --dwg-ink: var(--pump-part-volute); }
:where(.dwg-canvas svg) .dwg-ink-blade,
:where(.dwg-canvas svg) .dwg-ink-tip,
:where(.dwg-canvas svg) .dwg-ink-dim-bld { --dwg-ink: var(--pump-part-blade); }
:where(.dwg-canvas svg) .dwg-ink-inlet,
:where(.dwg-canvas svg) .dwg-ink-dim-inl { --dwg-ink: var(--pump-part-inlet); }
:where(.dwg-canvas svg) .dwg-ink-diffusor,
:where(.dwg-canvas svg) .dwg-ink-dim-dif { --dwg-ink: var(--pump-part-diffusor); }
/* The flow channel is nobody's part -- it is the water's path through all of them --
   so it takes the page's green rather than a fifth part colour. */
:where(.dwg-canvas svg) .dwg-ink-channel { --dwg-ink: var(--grn); }
:where(.dwg-canvas svg) .dwg-ink-dim,
:where(.dwg-canvas svg) .dwg-ink-od,
:where(.dwg-canvas svg) .dwg-ink-rule,
:where(.dwg-canvas svg) .dwg-ink-name { --dwg-ink: var(--tx); }
:where(.dwg-canvas svg) .dwg-ink-ext,
:where(.dwg-canvas svg) .dwg-ink-ref,
:where(.dwg-canvas svg) .dwg-ink-thin,
:where(.dwg-canvas svg) .dwg-ink-note,
:where(.dwg-canvas svg) .dwg-ink-expr { --dwg-ink: var(--tx2); }
:where(.dwg-canvas svg) .dwg-ink-ghost,
:where(.dwg-canvas svg) .dwg-ink-frame { --dwg-ink: var(--bdr); }
:where(.dwg-canvas svg) .dwg-ink-stamp { --dwg-ink: var(--tx3); }
:where(.dwg-canvas svg) .dwg-ink-datum { --dwg-ink: var(--red); }
/* The three CFD interfaces. NOT the axis red, which is what they were first: the datum
   is on every sheet and a dash-dot against a plain dash does not separate two red lines
   at drawing scale. `ink_name` gives a LINE its style, so without this rule they fall
   back to --tx and the three surfaces a TCAE case is built on turn grey with nothing
   failing. */
:where(.dwg-canvas svg) .dwg-ink-iface { --dwg-ink: var(--pump-iface); }
:where(.dwg-canvas svg) :where(polyline, line).dwg-ink { stroke: var(--dwg-ink); }
:where(.dwg-canvas svg) :where(polygon, circle, text).dwg-ink { fill: var(--dwg-ink); }
/* The halo the package puts behind a number and a dot is the paper it sits on, so it
   still hides the line under it when the paper is dark. */
:where(.dwg-canvas svg) :where(circle, text).dwg-ink { stroke: var(--dwg-paper); }
/* Section hatch is the part's own colour taken most of the way back to the paper: it
   has to read as a tint of that body and never compete with the outline drawn on top.
   After the stroke rule above on purpose -- a hatch line is `dwg-ink` too, and this is
   the more specific answer at the same weight. */
:where(.dwg-canvas svg) .dwg-hatch-hub {
  stroke: color-mix(in srgb, var(--pump-part-impeller) 55%, var(--dwg-paper));
}
:where(.dwg-canvas svg) .dwg-hatch-shroud {
  stroke: color-mix(in srgb, var(--pump-part-volute) 55%, var(--dwg-paper));
}
:where(.dwg-canvas svg) .dwg-hatch-blade {
  stroke: color-mix(in srgb, var(--pump-part-blade) 55%, var(--dwg-paper));
}
:where(.dwg-canvas svg) .dwg-hatch-inlet {
  stroke: color-mix(in srgb, var(--pump-part-inlet) 55%, var(--dwg-paper));
}
/* And the sheet itself. One rect, `width="100%"`, written by the package under
   everything else. */
:where(.dwg-canvas svg) .dwg-paper { fill: var(--dwg-paper); }
.dwg-stage.is-panning .dwg-layer,
.dwg-stage.is-panning .dwg-layer * { cursor: grabbing; }
/* Each view of a part -- the plan, the section -- is one thing you can pick up
   (shared/drawing-objects.js). The move cursor is on at any zoom, unlike the pan hand,
   because a view can be moved whether or not there is anywhere to pan to. `.dwg-callout`
   sets `cursor: text` after this rule, so a number under the pointer still says "type". */
.dwg-view { cursor: move; }
.dwg-stage.is-moving .dwg-view,
.dwg-stage.is-moving .dwg-view * { cursor: grabbing; }
/* The three sizes of thing say which one you are about to get, before you press. The
   whole picture is `move`, the four arrows of a part that goes anywhere; one dimension
   and one number are `grab`, the hand you pick a single thing up with. A number keeps
   the hand rather than an I-beam: a click still opens it for typing, and the editor
   puts a real text box under the pointer the moment it does. */
.dwg-dim { cursor: grab; }
.dwg-stage.is-moving .dwg-dim,
.dwg-stage.is-moving .dwg-dim * { cursor: grabbing; }
/* Under the pointer, a dimension says what a drag will take -- its line, its arrows and
   its number -- with a box drawn round exactly those and not round its two help lines,
   which stay behind on the part. Fainter and finer than the one a picture gets, because
   it is a smaller thing to say. Two louder cues were tried and both were wrong: a
   heavier recoloured line read as a thick black border, and a dashed line put holes in
   what you were trying to press -- a pointer finds a line only where it is painted, so
   five of the ten dimensions on the inlet stopped being grabbable the moment the cue
   appeared under the pointer. A box cannot do that: it takes no pointer events at all. */
.dwg-stage.is-moving .dwg-callout { cursor: grabbing; }
/* The line a dragged number grows, so it still says what it measures. Thin, quiet, and
   never a target: the number at the end of it is what you click. */
.dwg-leader {
  fill: none; stroke: var(--tx3); stroke-width: 0.8;
  pointer-events: none; vector-effect: non-scaling-stroke;
}
/* An SVG <g> takes no CSS outline, so the hover box is a real <rect> inside the group. */
.dwg-view-outline {
  fill: none; stroke: var(--acc); stroke-width: 1; stroke-dasharray: 4 3;
  pointer-events: none; vector-effect: non-scaling-stroke; opacity: .55;
}
/* The dimension's own box, finer and fainter than a picture's, because it is a smaller
   thing to say. It has to come AFTER `.dwg-view-outline`: both are one class, so the
   later rule is the one that wins, and defined above it this said nothing at all. */
.dwg-dim-outline { stroke-width: .6; stroke-dasharray: 3 3; opacity: .3; }
/* ...and the dimension itself lights up, so it is plain which line you have hold of. A
   glow, because it is the only cue that neither moves the line nor recolours it: three
   other ways were tried and each was wrong. A heavier line reads as a thick border round
   the drawing. A dashed one puts holes in the thing you are pressing -- a pointer finds
   a line only where it is painted -- which cost five of the ten dimensions on the inlet.
   And painting it `--acc` did nothing at all on the sheets that matter: the accent is
   #0f766e and the inlet is already drawn in #006554, so the highlight and the ink were
   the same colour. A glow reads on every one of the five drawing inks. */
.dwg-dim.is-hover polyline:not(.dwg-ext),
.dwg-dim.is-hover polygon,
.dwg-dim.is-hover .dwg-callout { filter: drop-shadow(0 0 2.5px var(--acc)); }
/* The zoom tools, on the shared `.chart-tools` plate, in the BOTTOM-RIGHT corner of the
   sheet -- 12 px in, the same inset the title keeps at the top. It is where a drawing
   board keeps its view tools, and owner, 2026-09-13: "i want controls in bottom right".

   Nothing is moved to make room. Three answers were tried and all three were wrong:
   pushing the plate `--fab-inset + --fab-size + 12px` clear of the right edge left the
   tools floating a hand's width from any corner ("the controls are not in corner");
   moving them to the top-right (0.4.90) put them in a real corner but not this one; and
   lifting the chat button off the corner instead (0.4.91) made a fixed button in the
   window's corner jump whenever a board appeared, which is what a reader notices
   ("nothing moves why it needs to move at all", owner, 2026-09-13).

   What moves instead is the plate, and only once it has to. The chat button owns the
   rightmost `--fab-inset + --fab-size` (64 px) of the WINDOW, and the gear is the
   plate's last button, so the two meet as soon as the paper's right edge comes within
   ~52 px of the window's. Measured in Chromium on the designer, pointer landing read
   with `elementFromPoint`, not reasoned about:

       window   page margin   gear -> button   lands on
       1280          0 px         -31 px       the chat button   <- gear unreachable
       1340          6 px         -25 px       the chat button   <- gear unreachable
       1400         36 px           5 px       the gear
       1440         56 px          25 px       the gear
       1600        136 px         105 px       the gear

   An earlier note here put the meeting point "under about 1100 px" by assuming the
   paper stays centred and capped at `--paper-max-w`. It does not: the pump list takes
   the left, so below ~1400 the paper runs flush to the window's right edge and the
   plate arrives in the button's corner a full 300 px earlier than that. 1280 x 720 is
   Playwright's default and an ordinary laptop, so this was not the rare case it was
   written down as -- the gear could not be pressed at all.

   Below the breakpoint the plate steps `--fab-inset + --fab-size` clear, which is the
   rule the tokens are declared with (see `--fab-inset`). It moves only while the
   READER is resizing the window, never when a board appears, which is the motion 0.4.91
   was rejected for. */
.dwg-zoom { right: 12px; bottom: 12px; gap: 4px; }
@media (max-width: 1420px) {
  .dwg-zoom { right: calc(12px + var(--fab-inset) + var(--fab-size)); }
}
.dwg-canvas:not([hidden]) { flex: 1; min-height: 0; display: block; }
/* A drawing shown as a PICTURE rather than as a board: the upload modal's preview of the
   pump in the file. It wants the two things `.dwg-page` and `.dwg-canvas` carry -- the
   paper colour and the ink named by style, so the sheet follows the theme here too -- and
   none of the designer's layout, no wheel, no drag, no callouts. So the only thing it
   adds is a height for the SVG to fill, and the column that gives the canvas one. */
.dwg-preview { display: flex; flex-direction: column; height: 300px; }
.dwg-canvas svg:not(.gerotor-section-drawing svg) { width: 100%; height: 100%; }
.gerotor-section-drawing .dwg-canvas > svg { width:100%; height:auto; }
:where(.dwg-canvas svg) :where(polyline).dwg-ink-suction { --dwg-ink:var(--grn); }
:where(.dwg-canvas svg) :where(polyline).dwg-ink-pressure { --dwg-ink:var(--red); }
/* A redraw keeps the last drawing on the paper, dimmed under the picture loader
   (`panels.picture_wait`, whose `.is-busy` / `.is-failed` / `.is-empty` the stage carries). */
/* The 3D scene too: the last model dims under the loader while the new one builds. */
.dwg-stage.is-busy:not(:has(> .pic-wait[data-compact])) :is(.dwg-canvas, .dwg-scene) { opacity: .45; }
/* The sheet paints no ground of its own: the stage under it already has the paper
   colour, and two of them is how the box and the paper got different heights. Nor may
   a canvas carry a margin -- a part is one drawing on one canvas since the sheets were
   merged, and the gap that once separated two of them only pushed every tab but the
   first 24 px down the page. */
.dwg-stage svg { display: block; }
/* The value stands exactly where the author put the name; the name is a hover away.
   `.dwg-stage--names` shows the names instead. */
.dwg-callout-name { display: none; }
.dwg-stage--names .dwg-callout-name { display: initial; }
.dwg-stage--names .dwg-callout-value { display: none; }
.dwg-callout { cursor: grab; outline: none; }
.dwg-callout.is-hover,
.dwg-callout:focus-visible { fill: var(--acc); text-decoration: underline; }
/* Being edited: the input carries this number's own glyphs in its place, so the text
   under it must not show through. It is hidden, not repainted -- `drawing-editor.js`
   reads the colour and the font off it while it is hidden, which is how a hub value
   stays hub-orange in the box. */
.dwg-callout.is-act { visibility: hidden; }
.dwg-callout.is-busy { opacity: .45; }
.dwg-callout.is-warn { fill: var(--warn-fg); }
.dwg-callout.is-err { fill: var(--danger-fg); }
.dwg-callout[data-pin="1"] { font-weight: 700; }           /* pinned: held by hand, not by the formula */
/* The padlock beside a pinnable number, built by drawing-editor.js because an SVG <text>
   takes no ::before. Shut = its formula owns it; open = a person is holding it. It is a
   mark, never a target: the number next to it is what you click. */
/* fill: the sheet's <g fill="none"> is inherited, and an unfilled glyph draws nothing. */
.dwg-pin { cursor: pointer; opacity: .75; fill: var(--tx2); }
.dwg-pin:hover { opacity: 1; }
.dwg-pin--open { opacity: 1; }
.dwg-callout.is-fixed,
.dwg-callout.is-fixed.is-hover { fill: var(--tx3); cursor: default; text-decoration: none; }  /* held by the model; hover says why */
/* Not a box over the drawing: the number becomes live. Font, weight, size, colour and
   alignment are copied off the SVG text by `drawing-editor.js` (they change with the
   zoom and with the pin), so everything written here is what must NOT be drawn -- no
   plate, no border, no glow, no padding. The only sign that a number is being typed
   into is the accent line under it and the accent caret in it. */
.dwg-edit {
  /* Over the zoom plate (`.chart-tools`, z-index 10): a dimension in the corner of a
     wide sheet is typed into under those buttons otherwise. */
  position: absolute; z-index: 11; box-sizing: border-box;
  padding: 0; background: transparent; box-shadow: none;
  border: 0; border-bottom: 1px solid var(--acc); border-radius: 0;
  caret-color: var(--acc);
}
.dwg-edit:focus { outline: none; }
.dwg-edit.is-err { border-bottom-color: var(--danger-fg); }
/* The one exception: a native list cannot be made transparent, and there are few of
   them, so a `choice` keeps the plate the rest gave up. */
select.dwg-edit {
  min-width: 96px; padding: 0 6px; line-height: 1;
  color: var(--tx); background: var(--sur);
  border: 1.5px solid var(--acc); border-radius: 4px; box-shadow: var(--acc-glow);
}
/* A plate has four sides, so a refused choice colours all four -- `.dwg-edit.is-err`
   alone would leave three of them accent and turn the bottom one red. */
select.dwg-edit.is-err { border-color: var(--danger-fg); }
/* How wide is what has been typed? Asked of a hidden twin in the number's own font. */
.dwg-ruler {
  position: absolute; top: 0; left: 0; visibility: hidden;
  white-space: pre; pointer-events: none;
}
/* A sheet not redrawn since the last edit: a dot on its tab, gone once it is opened. */
.console-nav-item[data-stale]::after {
  content: ""; display: inline-block; width: 6px; height: 6px; margin-left: 6px;
  border-radius: 50%; background: var(--warn-fg); vertical-align: middle;
}

/* ================================================================================
   Field Viewer stage (`/viewer/`, `templates/field_viewer/index.html`; drawn by
   `shared/field-viewer.js`). One box on the page: the WebGL canvas fills it, and the
   controls float on it as ordinary HTML -- `btn admin-action-btn` with `data-tooltip`,
   the shared select -- so the picture wears the page's own buttons, fonts and theme
   rather than vtk.js's canvas-painted widgets. Every colour is a token: the canvas
   background is read from `.fv-stage` by the script, so dark mode needs no second rule.
   `.fv-hud[hidden]` is spelled out because `display:flex` beats the `hidden` default. */
/* Edge to edge -- owner, 2026-09-18: "why don't you use full page". The picture IS the
   page here; a margin round a 3D view is a frame round a window. */
.fv-page { padding: 0; }
.fv-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  background: var(--sur);
}
.fv-canvas { position: absolute; inset: 0; }
/* The stage mounted in a box rather than filling a page. On its own page it is a flex
   child that takes what is left of the window; in a dialog there is no such parent, so
   it is given a height. Two thirds of the window, the same share the drawing modal
   takes, and a floor so a short laptop screen shows a model rather than a slit.
   A class and not `#pumpMeshStage`: the same stage is mounted in a second box later
   (C5 of the TCAE plan), and that one must not arrive as a second id rule. */
/* The mesh preview's picture. Grown 20% with its modal -- owner, 2026-09-21. */
.fv-stage--boxed { height: min(78vh, 672px); min-height: 320px; }
/* TCAE's own numbers under the picture: cells, worst skewness, skew faces. A row of
   plain readings, not a table -- there are three of them and they carry no units. */
.pump-mesh-report {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  padding-top: 8px;
  color: var(--tx2);
  font-size: 12px;
}
.pump-mesh-stat b { color: var(--tx); font-variant-numeric: tabular-nums; }
.fv-canvas canvas { outline: none; }
.fv-pins { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.fv-hud {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 6px;
  background: color-mix(in srgb, var(--sur) 88%, transparent);
  border: 1px solid var(--bdr);
  border-radius: var(--radius-btn);
  backdrop-filter: blur(6px);
}
.fv-hud[hidden], .fv-empty[hidden] { display: none; }
.fv-hud .btn:disabled, .fv-hud select:disabled { opacity: .4; }
/* The field picker wears the picture's clothes, not a form's: no fill, no frame, the
   stage's ink, the shared caret, and only as wide as the name it shows. It is still
   the plain <select> of `forms.select_input` -- the keyboard, a phone's wheel and the
   screen reader all keep working, which is why it is not a menu of divs. The `.field-*`
   rules never reached it (they need a `.f` wrapper this HUD has no room for), so the
   browser's own widget is what stood here. */
.fv-hud select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-btn);
  color: var(--tx);
  font: var(--font-ui-xs) var(--mono);
  line-height: 1;
  height: 22px;
  padding: 0 16px 0 4px;
  cursor: pointer;
  outline: none;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23888' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 3px center;
}
.fv-hud select:hover, .fv-hud select:focus-visible { color: var(--acc); }
/* The open list is drawn by the browser and takes the page's surface, never the
   stage's transparency -- an option on a see-through background is unreadable. */
.fv-hud select option { background: var(--sur); color: var(--tx); }
.fv-hud--tools { top: 12px; left: 50%; transform: translateX(-50%); }
.fv-hud--views { top: 12px; right: 12px; }
/* No frame around the colour bar: the bar, its numbers and the Levels field read as
   part of the picture, not as a window laid over it. */
.fv-hud--legend {
  border: none;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
}
/* A pressed control takes the accent hue, the one line a `.btn` variant may add. */
.fv-hud .btn[aria-pressed="true"] { --btn-hue: var(--acc); }
.fv-cap { color: var(--tx2); display: inline-flex; padding: 0 2px; }
/* The viewer's own 3-D glyphs (`field_viewer/_glyphs.html`): same box and stroke as
   lucide, so the row reads as one set. */
.fv-glyph { display: block; flex: none; }
.fv-cost { color: var(--tx2); font-size: 11px; font-variant-numeric: tabular-nums; white-space: nowrap; min-width: 5ch; }
.fv-legend-title { font-size: 12px; color: var(--tx); }
/* Bar and numbers side by side, both spanning the same fixed height, so the numbers
   land next to the point on the bar they name. */
.fv-legend-body { display: flex; align-items: stretch; gap: 6px; height: 160px; }
.fv-legend-bar { width: 10px; border-radius: 3px; border: 1px solid var(--bdr); }
.fv-legend-nums {
  display: flex;
  flex-direction: column-reverse;   /* the low end is first in the markup and sits at the bottom */
  justify-content: space-between;
  font-size: 11px;
  color: var(--tx2);
  font-variant-numeric: tabular-nums;
}
/* The low/high labels double as buttons: click one to type a new scale limit. Reset
   to plain text until touched, so the legend does not read as a form. */
.fv-legend-num {            /* on `.btn-plain-inherit`: the shared "button as text" reset */
  cursor: text;
  font: inherit;
  border-radius: 2px;
  padding: 0 2px;
}
.fv-legend-num:hover, .fv-legend-num:focus-visible {
  color: var(--tx);
  outline: 1px dashed var(--bdr);
}
/* Editing looks like typing over the number, not like filling a form: no frame, no
   fill, no spinner -- the text itself becomes editable, with the caret as the only
   sign. The reading and the editing state measure the same, so nothing moves on the
   click (same font, same padding, same line height as `.fv-legend-num`). */
.fv-legend-num-input {
  /* No width here: `editNumber` gives it the measured width of the text it replaced. */
  min-height: 0;
  font: inherit;
  line-height: 1.3;
  color: var(--tx);
  background: none;
  border: none;
  border-radius: 2px;
  padding: 0 2px;
  outline: none;
  appearance: textfield;
  -moz-appearance: textfield;
}
.fv-legend-num-input::-webkit-outer-spin-button,
.fv-legend-num-input::-webkit-inner-spin-button { appearance: none; margin: 0; }
.fv-legend-levels {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--tx2);
  cursor: default;
}
.fv-axes { position: absolute; left: 12px; bottom: 12px; pointer-events: none; }
/* A value pinned ON the picture: a dot on the face that was hit, a thin leader from it up
   to its tag, all re-projected on every camera change (`paintPins`). The dot is the pin's
   own `::after` at its origin, ringed in the surface colour so it reads on any field colour. */
.fv-pin { position: absolute; width: 0; height: 0; }
.fv-pin.is-behind { display: none; }
.fv-pin::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 34px;
  height: 1px;
  background: var(--tx);
  transform-origin: 0 0;
  transform: rotate(-45deg);
}
.fv-pin::after {
  content: "";
  position: absolute;
  left: -4px;
  top: -4px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--tx);
  border: 2px solid var(--sur);
  box-sizing: border-box;
}
.fv-pin-tag {
  position: absolute;
  left: 24px;
  bottom: 24px;
  display: flex;
  gap: 4px;
  align-items: center;
  padding: 2px 4px 2px 8px;
  white-space: nowrap;
  color: var(--tx);
  background: var(--sur);
  border: 1px solid var(--bdr);
  border-radius: var(--radius-btn);
  font: 12px/1.35 ui-monospace, Consolas, monospace;
  pointer-events: auto;
}
.fv-pin-tag small { display: block; color: var(--tx2); font-size: 10px; }
.fv-empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: var(--tx2);
}
/* The Parts box: a `.fv-hud` strip stood on end, top-left, one shared `.f-check` row per
   part of a model that came in pieces (a FLOEFD scene). The rows keep the field shell's
   markup but wear the part's name as a name, not as a form label: no capitals, the text
   ink, and a hand, because the name is a button (click it to see that part alone). */
.fv-parts {
  top: 12px;
  left: 12px;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 6px 10px 8px;
  max-height: calc(100% - 24px);
}
/* The rows scroll, the box does not: a scene brings 32 parts and a box that grew with
   them stood on the whole picture. Capped like the materials scatter's property groups
   (`.mat-scatter-prop-group`, the house answer for a long list), and the box's own
   `max-height` still keeps it inside a short window. */
.fv-parts-list { max-height: min(52vh, 420px); overflow: auto; align-self: stretch; }
/* Folded: the caption alone, so the model can be put away without hiding its parts. */
.fv-parts.is-folded .fv-parts-list { display: none; }
/* The caption sits in the same column as the tick boxes below it -- same left edge,
   same width -- so the box reads as one column of controls and not as an icon parked
   above a list. */
.fv-parts .fv-cap { padding: 0 0 6px; width: 13px; justify-content: center; }
.fv-cap[role="button"] { cursor: pointer; }
.fv-parts .f-check label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  color: var(--tx);
  white-space: nowrap;
}
.fv-parts [data-fv-solo] { cursor: pointer; }
.fv-parts [data-fv-solo]:hover { color: var(--acc); }
/* The heading of a group of parts ("Results", "Model"), and the switch for all of it. A
   row like the others -- the boxes stay in one column -- wearing a caption's ink and
   weight, which is what tells it apart from a part. */
.fv-parts .fv-parts-head label {
  font-size: var(--font-ui-xs);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--tx2);
}
.fv-parts .fv-parts-head { margin-top: 6px; }
.fv-parts .fv-parts-head:first-child { margin-top: 0; }

/* === Files view (macros/job_files.html, static/js/my-files.js) ===
   A file-manager layout on shared parts: `.mat-toolbar` heading, `.cat-drop-filter-chip`
   filters, an `.f` search field, the admin list table, `.admin-action-btn` row actions.
   What is new is only the arrangement: storage readout beside Upload, the selection bar
   that replaces the toolbar while rows are ticked (pure CSS `:has`, so it works before
   the script runs), the name cell with icon + subtitle, and the drop overlay. */
.files-panel { position:relative; }
.files-head { gap:10px; flex-wrap:wrap; }
.files-head-actions { margin-left:auto; gap:16px; flex-wrap:wrap; }
.files-usage { display:flex; flex-direction:column; gap:4px; min-width:150px; }
.files-usage .f-hint { white-space:nowrap; }
/* A thin bar with a visible fill. The UA meter ignores accent-color and draws a
   tiny amount as nothing, so the bar is drawn here: track `--bdr2`, fill `--acc`,
   `--amb` from 80 % (the `.is-warn` the server sets). Any non-zero use keeps a
   3px sliver so "almost empty" never reads as "broken". */
.files-usage meter {
  --files-fill:var(--acc);
  appearance:none;
  width:100%;
  height:8px;
  border:0;
  border-radius:999px;
  background:var(--bdr2);
  overflow:hidden;
}
.files-usage.is-warn meter { --files-fill:var(--amb); }
.files-usage meter::-webkit-meter-bar { background:var(--bdr2); border:0; border-radius:999px; height:4px; }
.files-usage meter::-webkit-meter-optimum-value,
.files-usage meter::-webkit-meter-suboptimum-value,
.files-usage meter::-webkit-meter-even-less-good-value { background:var(--files-fill); border-radius:999px; min-width:3px; }
.files-usage meter::-moz-meter-bar { background:var(--files-fill); border-radius:999px; min-width:3px; }
.files-usage meter[value="0"]::-webkit-meter-optimum-value { min-width:0; }
.files-usage meter[value="0"]::-moz-meter-bar { min-width:0; }
/* Upload: the script hides the native input and the button opens the picker. */
.files-upload { display:flex; align-items:center; gap:8px; margin:0; }
.files-upload.is-enhanced input[type="file"] {
  position:absolute; width:1px; height:1px; margin:-1px; overflow:hidden;
  clip:rect(0, 0, 0, 0); border:0; opacity:0; pointer-events:none;
}
/* One toolbar row: the folder path on the left, the tools on the right; ticking a row swaps the tools for
   the selection bar and keeps the path, as a file explorer does. */
.files-toolbar {
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
  min-height:36px;
  margin-bottom:8px;
}
.files-tools,
.files-selbar { display:flex; align-items:center; gap:10px; margin-left:auto; }
.files-tools { flex:0 0 auto; }  /* the whole group wraps under the path, never one tool at a time */
.files-tool-form { margin:0; }
.files-selbar {
  display:none;
  min-height:36px;
  padding:0 6px 0 12px;
  border-radius:var(--radius-md);
  background:var(--acc2);
  color:var(--tx);
}
.files-selbar-count { font:600 var(--font-ui-sm) var(--sans); margin-right:auto; }
.files-panel:has([data-files-select]:checked) .files-tools { display:none; }
.files-panel:has([data-files-select]:checked) .files-selbar { display:flex; }
/* Path: Home > folder > folder, the last one the folder shown. */
.files-crumbs { display:flex; align-items:center; flex-wrap:wrap; gap:2px; min-width:0; font:500 var(--font-ui-sm) var(--sans); }
.files-crumb { padding:4px 6px; border-radius:var(--radius-sm); color:var(--tx2); text-decoration:none; }
.files-crumb:hover { color:var(--acc); background:var(--table-row-hover-bg); }
.files-crumb.is-current { color:var(--tx); font-weight:600; }
.files-crumb-sep { color:var(--tx3); flex:0 0 auto; }
/* Folder tree beside the list; under 720px the path alone says where you are. */
.files-body { display:grid; grid-template-columns:minmax(150px, 200px) minmax(0, 1fr); gap:16px; align-items:start; }
.files-main { min-width:0; }
.files-tree { display:flex; flex-direction:column; gap:1px; padding-right:12px; border-right:1px solid var(--bdr); font-size:var(--font-ui-sm); }
.files-tree-list { list-style:none; margin:0; padding:0 0 0 14px; }
.files-tree > .files-tree-list { padding-left:0; }
.files-tree-link {
  display:flex;
  align-items:center;
  gap:6px;
  min-width:0;
  padding:5px 6px;
  border-radius:var(--radius-sm);
  color:var(--tx2);
  text-decoration:none;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.files-tree-link svg { flex:0 0 auto; color:var(--tx3); }
.files-tree-link:hover { color:var(--tx); background:var(--table-row-hover-bg); }
.files-tree-link.is-current { color:var(--tx); font-weight:600; background:var(--acc2); }
.files-tree-link.is-current svg { color:var(--acc); }
/* The tree's folds are plain rows: none of the shared `details` margin, tiny caption type or marker. */
.files-tree-fold { margin:0; }
.files-tree-fold > summary { display:block; padding:0; font:inherit; color:inherit; list-style:none; cursor:pointer; }
.files-tree-fold > summary::-webkit-details-marker { display:none; }
/* Dragging rows: the row lifts, the folder under the pointer lights up. */
.files-table tbody tr.is-dragging > td { opacity:.45; }
.files-panel .is-drop-target,
.files-table tbody tr.is-drop-target > td { background:var(--acc2); box-shadow:inset 0 0 0 1px var(--acc); }
/* Move to: every folder, indented by the tree list's own nesting. */
.files-move-list { display:flex; flex-direction:column; gap:2px; margin:0; padding:0; border:0; max-height:50vh; overflow:auto; }
.files-move-list legend { margin-bottom:8px; }
.files-move-target { display:flex; align-items:center; gap:6px; padding:5px 6px; border-radius:var(--radius-sm); font-size:var(--font-ui-sm); cursor:pointer; }
.files-move-target:hover,
.files-move-target:has(input:checked) { background:var(--acc2); }
.files-move-target svg { color:var(--tx3); }
/* Rows: icon, name, muted subtitle; less important columns leave on a phone. */
/* width:100% takes the slack; max-width:0 lets the column be squeezed so a long name
   truncates (see .files-name-text span) rather than widening the table past its wrap. */
.admin-table.perf-table.admin-table--auto.files-table .files-col-name { width:100%; max-width:0; }
.admin-table.perf-table.admin-table--auto.files-table :is(th, td).files-check { width:32px; padding-right:0; }
.files-table tbody tr { height:52px; }
.files-name { display:flex; align-items:center; gap:12px; min-width:0; }
/* The icon sits in the thumbnail's 36px box, so names line up with or without a picture. */
.files-icon { flex:0 0 auto; width:36px; color:var(--tx2); }
/* A real folder: a larger, filled, accent-tinted folder in the thumbnail's 36px box, so it cannot be
   taken for a result (a picture or the icon of its domain). */
.files-icon--folder { height:36px; color:var(--acc); fill:currentColor; fill-opacity:.22; stroke-width:1.6; }
/* A job that left a picture.png shows it instead of the folder: fixed 36px, cropped,
   on the plot plate (the picture is drawn on white), lazy so a long list loads none
   it does not show. */
.files-thumb {
  flex:0 0 auto;
  width:36px;
  height:36px;
  object-fit:cover;
  border:1px solid var(--bdr2);
  border-radius:var(--radius-sm);
  background:var(--plot-plate);
}
.files-name-text { display:flex; flex-direction:column; align-items:flex-start; gap:2px; min-width:0; max-width:100%; }
/* The name and its subtitle truncate with an ellipsis instead of widening the table.
   A long job label (`thermal_run_motorA_variant3`) otherwise pushed the table past its
   `overflow-x:hidden` wrap, clipping the right-most column — the row actions — so the
   download/pin/delete icons looked cut. Pairs with `max-width:0` on the name cell below. */
.files-name-text > span { max-width:100%; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
/* A truncating cell (`tables.ov_tip_cell`) in a list that sizes to its text: a share of the row, the rest cut
   with an ellipsis and told in the tooltip, instead of the text widening the table. */
.files-table td.ov-cell { width:40%; max-width:0; }
.files-name .admin-table-link { font-weight:500; }
.files-sub,
.files-muted { color:var(--tx3); font-size:var(--font-ui-xs); font-weight:400; white-space:nowrap; }
.files-muted svg { vertical-align:-2px; }
.files-sub-narrow { display:none; }
.files-table tbody tr:has([data-files-select]:checked) > td { background:var(--acc2); }
/* The checkbox shows on the row's hover / focus, and on every row once one is ticked
   (same opacity reveal as the shared action column). */
.files-table td.files-check input { opacity:0; transition:opacity .12s ease; accent-color:var(--acc); }
.files-table tbody tr:hover td.files-check input,
.files-table tbody tr:focus-within td.files-check input,
.files-panel:has([data-files-select]:checked) td.files-check input { opacity:1; }
@media (hover:none) { .files-table td.files-check input { opacity:1; } }
@media (max-width: 720px) {
  .files-table tbody tr td.admin-actions > * { opacity:1; }
  .files-table td.files-check input { opacity:1; }
  .files-table :is(.files-col-date, .files-col-size, .files-col-expires, .files-col-status) { display:none; }
  .admin-table.perf-table.admin-table--auto.files-table .files-col-name { width:auto; max-width:none; }
  /* Phone: columns are hidden and the name owns the row, so it wraps instead of truncating. */
  .files-name-text { white-space:normal; }
  .files-name-text > span { overflow:visible; text-overflow:clip; white-space:normal; }
  .files-name .admin-table-link { overflow-wrap:anywhere; }
  .files-name { gap:8px; }
  .files-icon,
  .files-thumb { width:24px; }
  .files-thumb { height:24px; }
  .files-icon--folder { height:24px; }
  .files-sub { white-space:normal; }
  .files-sub-narrow { display:inline; }
  .files-body { display:block; }
  .files-tree { display:none; }
  .files-tools,
  .files-selbar { flex-wrap:wrap; margin-left:0; width:100%; }
  .files-selbar { padding:6px 6px 6px 12px; }
  .files-selbar-count { flex-basis:100%; }
  .files-head-actions { margin-left:0; width:100%; justify-content:flex-start; }
  .files-usage { flex:1; }
}
.files-empty {
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:6px;
  padding:48px 16px;
  color:var(--tx3);
  text-align:center;
}
.files-empty-title { margin:6px 0 0; font:600 var(--font-small) var(--sans); color:var(--tx2); }
.files-empty .f-hint { margin:0; }
/* Drop overlay: shown by my-files.js while a file is dragged over the panel. */
.files-drop {
  position:absolute;
  inset:-8px;
  z-index:3;
  display:none;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:8px;
  border:2px dashed var(--acc);
  border-radius:var(--radius-md);
  /* Built from --acc over --sur, not --acc2: dark's --acc2 is a 20 % tint, which
     let the rows show through the words. */
  background:color-mix(in srgb, color-mix(in srgb, var(--acc) 10%, var(--sur)) 94%, transparent);
  color:var(--acc);
  font:600 var(--font-ui-sm) var(--sans);
  pointer-events:none;
}
.files-panel.is-dragover .files-drop { display:flex; }

/* === Jobs (macros/job_rows.html, node_job_detail.html) ===
   My jobs and the job page wear the Files list (`.files-table` / `.files-name` /
   `.files-sub`); these add only what a job has and a file does not: the live
   status under the badge, a meta strip, number tiles, key / value rows and the
   result picture. */
.jobs-status { display:flex; flex-direction:column; align-items:flex-start; gap:4px; min-width:128px; }
/* Drawn like the storage bar: the native bar's 4px fill all but vanished on the dark page. */
.jobs-status progress {
  appearance:none;
  width:128px;
  height:8px;
  border:0;
  border-radius:999px;
  background:var(--bdr2);
  overflow:hidden;
}
.jobs-status progress::-webkit-progress-bar { background:var(--bdr2); border-radius:999px; }
.jobs-status progress::-webkit-progress-value { background:var(--acc); border-radius:999px; }
.jobs-status progress::-moz-progress-bar { background:var(--acc); border-radius:999px; }
/* The one modifier for a running job's bar: the fill colour drifts to a lighter tone and back. */
@keyframes run-progress-pulse { 50% { background-color:color-mix(in srgb, var(--acc) 55%, var(--bg)); } }
.jobs-status progress.run-progress--live::-webkit-progress-value { animation:run-progress-pulse 2.4s ease-in-out infinite; }
.jobs-status progress.run-progress--live::-moz-progress-bar { animation:run-progress-pulse 2.4s ease-in-out infinite; }
@media (prefers-reduced-motion:reduce) {
  .jobs-status progress.run-progress--live::-webkit-progress-value,
  .jobs-status progress.run-progress--live::-moz-progress-bar { animation:none; }
}
.ov-tip > .ov-tip-text:has(+ .files-sub) { flex:0 1 auto; }
.ov-tip > .files-sub { flex:none; margin-left:6px; }
.jobs-status--wide { margin:0 0 12px; }
.jobs-status--wide progress { width:min(320px, 100%); }
/* Meta strip and key / value rows: a muted label over (strip) or beside (rows)
   its value, wrapping instead of scrolling. */
.jobs-meta {
  display:flex;
  flex-wrap:wrap;
  gap:10px 28px;
  margin:0 0 16px;
}
.jobs-meta > div { min-width:0; }
.jobs-meta dt,
.jobs-stats dt { color:var(--tx3); font:600 var(--font-ui-xs) var(--sans); margin:0 0 2px; }
:is(.jobs-meta, .jobs-stats, .jobs-kv) dd { margin:0; color:var(--tx); overflow-wrap:anywhere; }
.jobs-meta dd { font-weight:500; font-size:var(--font-ui-sm); }
.jobs-stats {
  display:grid;
  grid-template-columns:repeat(auto-fill, minmax(140px, 1fr));
  gap:8px;
  margin:0 0 16px;
}
.jobs-stats > div {
  padding:8px 12px;
  border:1px solid var(--bdr2);
  border-radius:var(--radius-md);
  background:var(--sur);
  min-width:0;
}
.jobs-stats dd { font-size:var(--font-small); }
.jobs-kv { margin:0 0 12px; }
.jobs-kv > div {
  display:grid;
  grid-template-columns:minmax(0, 2fr) minmax(0, 3fr);
  gap:12px;
  padding:6px 0;
  border-bottom:1px solid var(--bdr2);
}
.jobs-kv dt { color:var(--tx2); font-size:var(--font-ui-sm); overflow-wrap:anywhere; }
.jobs-kv dd { font-size:var(--font-ui-sm); }
/* The result picture: as wide as the card allows, never taller than a screenful. */
.jobs-picture { margin:0 0 16px; }
.jobs-picture img {
  display:block;
  max-width:100%;
  max-height:min(60vh, 520px);
  border:1px solid var(--bdr2);
  border-radius:var(--radius-md);
  background:var(--plot-plate);
}
.jobs-pre { margin:0; max-height:420px; overflow:auto; font:var(--font-ui-xs) var(--mono); white-space:pre-wrap; overflow-wrap:anywhere; }
@media (max-width: 720px) {
  .jobs-status,
  .jobs-status progress { min-width:0; width:100%; }
  .jobs-kv > div { grid-template-columns:1fr; gap:2px; }
  .jobs-stats { grid-template-columns:repeat(auto-fill, minmax(110px, 1fr)); }
}

/* Admin -> Virtual tests. Overview: a grid of motor-editor cards (.motor-section-card--link: the whole card is the link). Test page: Parameters and Outputs side by side, one line per row:
   label | control | default (with the "changed" mark and the row's way back). */
.vt-domain { display:flex; flex-direction:column; gap:10px; }
.vt-cards { display:grid; grid-template-columns:repeat(auto-fill, minmax(240px, 1fr)); gap:12px; }
.motor-section-card--link { display:block; color:var(--tx); text-decoration:none; transition:border-color .12s; }
.motor-section-card--link:hover, .motor-section-card--link:focus-visible { border-color:var(--acc); }
.vt-card-body { display:flex; flex-direction:column; gap:6px; }
.vt-card-name { display:flex; align-items:center; gap:8px; font-weight:700; }
.motor-section-card--link:hover .vt-card-name { color:var(--acc); }
.vt-card-what {
  color:var(--tx2); font-size:var(--font-ui-sm); line-height:1.5;
  display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden;
}
.vt-card-solvers { color:var(--tx3); font-size:var(--font-ui-xs); }
.vt-cols { display:grid; grid-template-columns:repeat(auto-fit, minmax(min(100%, 380px), 1fr)); gap:14px 28px; align-items:start; }
.vt-cols .admin-section-head { margin-top:0; }
.setting-row {
  display:grid; grid-template-columns:minmax(11rem, 13rem) minmax(7rem, 12rem);
  align-items:center; gap:8px; padding:5px 0;
}
.setting-row label { display:flex; align-items:center; gap:4px; min-width:0; font-size:var(--label-font-size); font-weight:600; color:var(--tx2); }
.setting-default { grid-column:2; display:flex; flex-wrap:wrap; align-items:center; gap:6px; min-width:0; color:var(--tx3); font-size:var(--font-ui-sm); }
.setting-default-value { display:none; }
.setting-row.is-changed .setting-default-value { display:inline; }
.setting-note { overflow-wrap:anywhere; font-size:var(--font-ui-xs); line-height:1.3; }
.setting-changed { display:none; align-items:center; gap:4px; white-space:nowrap; }
.setting-row.is-changed .setting-changed { display:inline-flex; }
.setting-row-reset { padding:2px; min-width:0; width:22px; height:22px; justify-content:center; }
.admin-panel > .files-crumbs { margin-bottom:8px; }
