/* Fonts (static/fonts, OFL): Inter for the text, Pretendard for Korean (downloaded only when Korean
   text is on the page: unicode-range), JetBrains Mono for values and code, Josefin Sans (the logo's)
   for the box titles. Served from here, so every browser and computer shows the same letters. */
@font-face { font-family: "Inter"; src: url("../fonts/InterVariable.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("../fonts/JetBrainsMonoVariable.woff2") format("woff2"); font-weight: 100 800; font-display: swap; }
@font-face { font-family: "Josefin Sans"; src: url("../fonts/JosefinSans-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Pretendard"; src: url("../fonts/PretendardVariable.woff2") format("woff2"); font-weight: 45 920; font-display: swap;
  unicode-range: U+1100-11FF, U+3000-303F, U+3130-318F, U+A960-A97F, U+AC00-D7AF, U+D7B0-D7FF, U+FF00-FFEF; }
:root {
  color-scheme: light;
  --font-ui: "Inter", "Pretendard", sans-serif;
  --font-mono: "JetBrains Mono", "Pretendard", monospace;
  --font-title: "Josefin Sans", "Inter", "Pretendard", sans-serif;
  --bg: #f0f0f1;
  --surface: #ffffff;
  --surface-2: #f5f5f6;
  --surface-3: #eaeaec;
  --text: #1c1c1f;
  --text-secondary: #4a4a50;
  --muted: #66666d;
  --border: rgba(28,28,31,0.12);
  --border-strong: rgba(28,28,31,0.22);
  --accent: #4a50c8;   /* indigo, as the dark box titles (until 2026-11-21 blue #2a6fdb) */
  --accent-fill: #4a50c8;   /* the accent under white text (buttons, picked chips) */
  --accent-hover: #3d43b0;
  --accent-soft: rgba(74,80,200,0.10);
  --red: #c4302b;
  --red-soft: rgba(196,48,43,0.10);
  --orange: #b35309;
  --yellow: #8a6500;
  --green: #0f7656;
  --shadow-sm: 0 1px 2px rgba(23,22,26,0.06);
  --shadow-md: 0 4px 16px rgba(23,22,26,0.08);
  --shadow-lg: 0 12px 40px rgba(23,22,26,0.18);
  --radius: 4px;
  --radius-sm: 3px;
  --section-header-bg: #4a4a50;   /* until 2026-11-21 #3a5a80 */
  --section-header-fg: #ffffff;
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --bg: #131315;
    --surface: #1c1c1f;
    --surface-2: #242427;
    --surface-3: #2d2d31;
    --text: #f2f2f3;
    --text-secondary: #c6c6cb;
    --muted: #a0a0a7;
    --border: rgba(255,255,255,0.10);
    --border-strong: rgba(255,255,255,0.20);
    --accent: #9ea3f5;
    --accent-fill: #4b52c9;   /* deeper than --accent: white text on it */
    --section-header-bg: #3a3f8c;   /* indigo: the boxes stand out on the dark page (white text 9.3) */
    --accent-hover: #5a61d6;
    --accent-soft: rgba(158,163,245,0.16);
    --red: #f07a76;
    --red-soft: rgba(240,122,118,0.16);
    --orange: #f0a35e;
    --yellow: #e3c048;
    --green: #4cc79f;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.35);
    --shadow-lg: 0 16px 48px rgba(0,0,0,0.5);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #131315;
  --surface: #1c1c1f;
  --surface-2: #242427;
  --surface-3: #2d2d31;
  --text: #f2f2f3;
  --text-secondary: #c6c6cb;
  --muted: #a0a0a7;
  --border: rgba(255,255,255,0.10);
  --border-strong: rgba(255,255,255,0.20);
  --accent: #9ea3f5;
  --accent-fill: #4b52c9;   /* deeper than --accent: white text on it */
  --section-header-bg: #3a3f8c;   /* indigo: the boxes stand out on the dark page (white text 9.3) */
  --accent-hover: #5a61d6;
  --accent-soft: rgba(158,163,245,0.16);
  --red: #f07a76;
  --red-soft: rgba(240,122,118,0.16);
  --orange: #f0a35e;
  --yellow: #e3c048;
  --green: #4cc79f;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.35);
  --shadow-lg: 0 16px 48px rgba(0,0,0,0.5);
}

* { box-sizing: border-box; }
html, body {
  /* Page itself never scrolls (every panel below scrolls internally) -- this
     is also the backstop for scroll chaining: without it, wheel-scrolling
     an inner box (e.g. .run-case-log, #tab-content) past its own top/bottom
     "chains" to this outer level once the inner box can't consume any more
     scroll delta, which reads as the whole page lurching/bouncing. Each
     inner scrollable element below also sets its own overscroll-behavior:
     contain (belt-and-suspenders -- this alone stops the outermost chain,
     but a chain between two nested inner scrollers still needs the inner
     one's own rule to stop there instead of continuing outward). */
  overscroll-behavior: none;
}
body {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 14px;
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
  height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* Slim, refined scrollbars everywhere */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
*::-webkit-scrollbar-track { background: transparent; }

a { color: var(--accent); }

/* ---------------------------------------------------------------- header */
#app-header {
  padding: 8px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}
#app-header h1 {
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.01em;
  margin: 0;
}
/* the MUPHI mark (J, dark, with the name; until 2026-11-20 the title as text) */
#app-header h1 { flex-shrink: 0; line-height: 0; }
#app-header h1 img { display: block; height: 48px; width: auto; }
/* the logo: the name under the box in the page's text colour -- dark on a light page, white in dark mode */
img.logo-on-dark { display: none !important; }
:root[data-theme="dark"] img.logo-on-light { display: none !important; }
:root[data-theme="dark"] img.logo-on-dark { display: block !important; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) img.logo-on-light { display: none !important; }
  :root:not([data-theme="light"]) img.logo-on-dark { display: block !important; }
}
/* Admin-set notice (see announcement_store.py) -- sits between the title
   and the status pills, growing to fill whatever space #app-header's own
   `justify-content: space-between` would otherwise leave empty (rather
   than staying a small auto-sized chunk with big gaps on either side).
   min-width:0 overrides flex's own default min-width:auto, which would
   otherwise refuse to shrink below the text's natural width and defeat
   text-overflow entirely. Empty (no announcement set) collapses to
   nothing visible -- no border/background of its own to show as an empty
   pill-shaped gap. */
/* the middle of the header: the notice, and under it the remote's loading
   line -- a column filling the room between the mark and the pills */
.header-center {
  flex: 1 1 auto; min-width: 0;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.header-center > * { max-width: 100%; }
.header-center #announcement-banner { flex: none; }
/* a long notice, cut with an ellipsis, opens whole on hover: a panel over
   the header at the notice's own place and width, wrapping (the header
   itself does not move) */
#announcement-banner { position: relative; cursor: default; }
#announcement-banner[data-full]:not([data-full=""]):hover { overflow: visible; color: transparent; }   /* the cut line under the panel: hidden */
#announcement-banner[data-full]:not([data-full=""]):hover::after {
  content: attr(data-full);
  position: absolute; left: -10px; right: -10px; top: -7px; z-index: 60;
  padding: 6px 10px; white-space: pre-wrap; text-align: center; color: var(--accent);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-md);
}
#remote-loading-slot { height: 17px; }   /* kept while the line is hidden: the notice does not move */
#remote-loading-slot .remote-loading-line { display: block; width: auto; text-align: center; line-height: 17px; }
#announcement-banner {
  flex: 1 1 auto; min-width: 0; text-align: center;
  font-size: 13px; color: var(--accent); font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.status-pills { display: flex; gap: 8px; flex-wrap: wrap; }
/* the page header's pills: never squeezed by the notice (which shortens with
   an ellipsis instead), the state and the actions as two groups -- in one
   row, a rule between them; on a narrow window the actions under the state,
   both flush right (until 2026-11-20 one wrapping row: the pills broke
   anywhere, in uneven rows) */
#app-header .status-pills { flex-shrink: 0; flex-wrap: nowrap; align-items: center; }
.status-pills-grouped { gap: 12px; }
.status-group { display: flex; align-items: center; gap: 8px; }
.status-group > form { display: flex; }
.status-actions { padding-left: 12px; border-left: 1px solid var(--border); }
@media (max-width: 1400px) {
  #app-header .status-pills-grouped { flex-direction: column; align-items: flex-end; gap: 6px; }
  .status-actions { padding-left: 0; border-left: none; }
}
.status-pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--text-secondary);
  background: var(--surface-2); border: 1px solid var(--border);
  padding: 5px 12px 5px 10px; border-radius: 4px;
  white-space: nowrap;
  position: relative; /* anchors #remote-status-popover below -- harmless on every other pill, none of which have one */
}
/* Remote pill's node-status popover (built/kept in sync by remote.js's
   renderNodeStatusPopover(), called from main.js's syncTdbHeaderLabel() on
   every state change) -- pure CSS :hover reveal, plus :focus-within so
   it's also reachable via keyboard (Tab onto the pill). A click-to-toggle
   version (matching .menu-dropdown above) was tried in between, but once
   the layout bug below was actually fixed, hover was preferred back.
   width, NOT max-width alone, is the actual layout fix: an absolutely-
   positioned block with no explicit width shrinks-to-fit its content
   first, and .node-status-grid's auto-fill columns (see its own comment)
   have no real "preferred" width of their own to shrink-to-fit AROUND --
   the two fought each other and settled on the grid's bare minimum,
   collapsing it to a single column regardless of how much room was
   actually available. A definite width breaks that feedback loop by
   giving the grid something concrete to lay its columns out against. */
.node-status-popover {
  display: none;
  position: absolute; top: calc(100% + 6px); right: 0;
  z-index: 50;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
  padding: 10px 12px; width: min(92vw, 560px);
  max-height: 70vh; overflow-y: auto; /* a large cluster's grid can end up several rows tall (auto-fill wraps at ~104px/box, see .node-status-grid) -- scroll rather than run off-screen */
  white-space: normal; text-align: left; cursor: default;
}
#remote-status:hover .node-status-popover,
#remote-status:focus-within .node-status-popover {
  display: block;
}
.status-dot {
  /* inline-block (not this span's default, inline) -- width/height are
     otherwise ignored, which only went unnoticed before because every
     existing use sits inside a flex container (.status-pill), which
     blockifies it anyway. Needed explicitly now that My Batches' status
     dots (see .status-dot-green/-yellow/-gray below) sit inside a plain,
     non-flex .file-name span instead. */
  display: inline-block;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--muted); flex-shrink: 0;
  box-shadow: 0 0 0 3px transparent;
  transition: background-color 0.2s, box-shadow 0.2s;
}
.status-pill.active .status-dot { background: var(--green); box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 18%, transparent); }
.status-pill #tdb-status-label, .status-pill #remote-status-label, .tdb-name { color: var(--text); font-weight: 600; }
/* My Batches list run-status dot (see renderMyBatchesTab() in batch.js) --
   green: every case running, yellow: some running, gray: none running
   (or not yet checked). */
.status-dot-green { background: var(--green); }
.status-dot-yellow { background: var(--orange); }
.status-dot-gray { background: var(--muted); }

/* ----------------------------------------------------------------- menu */
#menu-bar {
  position: relative; /* anchors #tray-nav, centered on the bar */
  display: flex;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 2px 12px;
  gap: 2px;
}
.menu { position: relative; }
.menu-btn {
  background: none; border: none; padding: 8px 12px; cursor: pointer;
  font-size: 13px; color: var(--text-secondary); border-radius: var(--radius-sm);
  transition: background-color 0.12s, color 0.12s;
}
.menu-btn:hover { background: var(--surface-2); color: var(--text); }
.menu-dropdown {
  display: none;
  position: absolute; top: calc(100% + 4px); left: 0;
  background: var(--surface); border: 1px solid var(--border);
  min-width: 230px; z-index: 50; flex-direction: column;
  box-shadow: var(--shadow-lg); border-radius: var(--radius-sm); padding: 6px;
}
.menu-dropdown.open { display: flex; }
.menu-dropdown button {
  background: none; border: none; text-align: left; padding: 8px 10px;
  cursor: pointer; font-size: 13px; color: var(--text); white-space: nowrap;
  border-radius: 6px;
}
.menu-dropdown button:hover { background: var(--accent-soft); color: var(--accent); }
.menu-sep { height: 1px; background: var(--border); margin: 6px 2px; }

/* --------------------------------------------------------------- layout */
#main-layout {
  flex: 1;
  display: flex;
  overflow: hidden;
}
#editor-panel {
  width: 50%;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  overflow: hidden;
}
#tab-body {
  display: flex;
  flex: 1;
  overflow: hidden;
}
#tab-buttons {
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  width: 92px;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--surface-2);
  border-right: 1px solid var(--border);
  padding: 8px 6px;
  gap: 3px;
}
#tab-buttons button {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  background: none; border: none; padding: 9px 4px; cursor: pointer;
  color: var(--text-secondary); text-align: center;
  border-radius: var(--radius-sm);
  border-left: 3px solid transparent;
  transition: background-color 0.12s, color 0.12s;
}
#tab-buttons .tab-icon { font-size: 17px; line-height: 1; display: flex; align-items: center; justify-content: center; height: 17px; }
#tab-buttons .tab-icon svg { display: block; }
#tab-buttons .tab-label { font-size: 10.5px; font-weight: 550; letter-spacing: 0.01em; }
#tab-buttons button:hover { background: var(--surface-3); color: var(--text); }
#tab-buttons button.active {
  color: var(--accent); border-left-color: var(--accent); font-weight: 600;
  background: var(--surface); box-shadow: var(--shadow-sm);
}
#tab-content {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 16px 18px;
  min-width: 0;
}
#action-buttons {
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  background: var(--surface);
}

/* Sticks a tab-specific action bar to the bottom of #tab-content's own
   scroll area, like #action-buttons does for the whole editor panel --
   used e.g. by the Batch tab's Preview/Generate/Load buttons so they stay
   reachable without scrolling past a long case/variation list. The
   negative margins cancel #tab-content's own padding so the bar spans
   full width and sits flush against the true bottom edge; `bottom`
   matches that same padding so the sticky offset is measured from there. */
.sticky-tab-actions {
  position: sticky;
  bottom: -16px;
  margin: 14px -18px -16px -18px;
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  z-index: 5;
}

/* Same "pin to the true bottom of #tab-content's scroll area" trick as
   .sticky-tab-actions, applied to a .section-box instead of a bare
   field-row -- used by the Remote tab's Status section (connection summary
   + Connect/Disconnect) so it stays visible without scrolling past the
   Connection Log above it. .section-box has no background of its own
   (transparent, showing the page underneath), so it needs one here or the
   Connection Log would visibly show through as it scrolls under this. */
.sticky-status-box {
  position: sticky;
  bottom: -16px;
  margin: 14px -18px -16px -18px;
  border-radius: 0;
  border-left: none;
  border-right: none;
  border-bottom: none;
  background: var(--bg);
  box-shadow: var(--shadow-sm);
  z-index: 5;
}

/* --------------------------------------------------------------- trays */
/* The row of trays and connector seams (see tray_nav.js): tray and seam
   widths are set in px by tray_nav.js, and #tray-strip is translated so two
   trays and the seam between them fill #tray-viewport. The narrow
   .tray-edge rails on both sides show the connectors to off-screen trays. */
#tray-viewport {
  flex: 1;
  min-width: 0;
  height: 100%;
  overflow: hidden;
}
#tray-strip {
  display: flex;
  height: 100%;
  width: max-content;
  transition: transform 0.25s ease;
}
.tray {
  display: flex;
  flex-shrink: 0;
  min-width: 0;
  height: 100%;
  overflow: hidden;
  transition: width 0.25s ease;
}
#tray-strip.no-transition,
#tray-strip.no-transition .tray,
#tray-strip.no-transition .seam { transition: none; }
@media (prefers-reduced-motion: reduce) {
  #tray-strip, .tray, .seam { transition: none; }
}

/* connector seam between two trays: a rail with one node, or, open, the
   connector panel */
.seam {
  flex-shrink: 0;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: var(--surface-2);
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  transition: width 0.25s ease;
}
.seam.open { align-items: stretch; background: var(--surface); }
/* the connector nodes as the minimap's connector chips: "C" (and the arrow
   when linked), a solid border -- the accent between the two trays on
   screen, grey on the edge rails (to off-screen trays) -- and the rail's
   whole height (until 2026-11-20 a small pill with a ◇ / ◆ in the middle of
   an empty rail, dashed when unlinked) */
.seam-node, .edge-node {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  height: 100%;   /* as tall as the trays (until 2026-11-21 8px short at each end) */
  background: var(--surface); border: 1px solid var(--muted);
  border-radius: var(--radius-sm); padding: 0 2px; cursor: pointer;
  color: var(--text-secondary); font-size: 14px; line-height: 1;
  box-shadow: var(--shadow-sm);
}
.seam-glyph { font-weight: 650; }
/* the word turned 270 degrees: read from the bottom up */
.seam-node .seam-glyph, .edge-node .seam-glyph { writing-mode: vertical-rl; transform: rotate(180deg); white-space: nowrap; }
.seam-node { color: var(--accent); border-color: var(--accent); box-shadow: none; }
.seam-node:hover { background: var(--accent-soft); }
.edge-node:hover:not(:disabled) { border-color: var(--text-secondary); background: var(--surface-2); }
.tray-edge[data-state="idle"] .edge-node { color: var(--accent); }
.tray-edge[data-state="none"] .edge-node .seam-glyph,
.seam[data-state="none"] .seam-node .seam-glyph { color: var(--muted); font-weight: 500; }
.seam-panel {
  width: 100%;
  min-width: 330px;
  overflow-y: auto;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 13px;
}
.seam-panel-head { display: flex; align-items: center; justify-content: space-between; }
.seam-panel-title { font-weight: 650; font-size: 14.5px; }
.seam-close-btn { padding: 2px 9px; }
.seam-row { display: flex; gap: 10px; align-items: baseline; }
.seam-key { flex: 0 0 64px; color: var(--text-secondary); font-size: 12px; }
.seam-val { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; min-width: 0; }
.seam-ports { font-size: 12px; color: var(--text-secondary); font-family: var(--font-mono); }
.seam-radio { display: inline-flex; gap: 4px; align-items: center; color: var(--text-secondary); }
.seam-sep { height: 1px; background: var(--border); }
.seam-note, .seam-muted { color: var(--text-secondary); }
.seam-actions { display: flex; justify-content: flex-end; }

.tray-edge {
  flex: 0 0 14px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
}
.tray-edge-left { border-right: 1px solid var(--border); }
.tray-edge-right { border-left: 1px solid var(--border); }
.tray-edge .edge-node { padding: 0; width: 12px; font-size: 10px; }
/* the modules fill their tray instead of their old 50% of the window */
.tray > #editor-panel,
.tray > #preview-panel,
.tray > #icg-panel,
.tray > #tpg-panel {
  width: 100%;
  border-right: none;
}
.tray { position: relative; border-radius: var(--radius-sm); }   /* the connector nodes' radius */
/* the tray's border, drawn over the module so the layout does not move; the accent while the
   pointer is on its minimap chip (tray_nav.js renderNav) */
.tray::after {
  content: ''; position: absolute; inset: 0; z-index: 50; pointer-events: none;
  border: 1px solid var(--border-strong); border-radius: inherit; transition: border-color 0.12s ease;   /* as the connector nodes */
}
.tray.mm-hover::after { border-color: var(--accent); }
/* take an optional module out of its tray (tray_nav.js fillTray) */
.tray-takeout {
  position: absolute; top: 8px; right: 10px; z-index: 6;
  padding: 2px 8px; font-size: 13px; line-height: 1.3;
}
.tray-place { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: center; }
.seam-link-title { font-weight: 600; font-size: 13.5px; }
.seam-adaptors { display: flex; flex-direction: column; gap: 8px; }
.seam-adaptor-title { font-weight: 600; color: var(--accent); font-size: 13px; }
.seam-note.warn { color: var(--red); }
.seam-log pre { font-size: 11.5px; max-height: 160px; overflow: auto; margin: 4px 0 0; white-space: pre-wrap; }
.seam-actions { gap: 8px; flex-wrap: wrap; }

/* ------------------------------------------------- Initial Condition Generator */
#icg-panel,
#tpg-panel {
  outline: none;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}
.icg-head {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 8px 52px 8px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.icg-title { font-weight: 650; font-size: 15px; }
.icg-steptabs { display: inline-flex; gap: 2px; background: var(--surface-2); border-radius: var(--radius-sm); padding: 2px; }
.icg-steptabs button { border: none; background: none; padding: 4px 12px; border-radius: var(--radius-sm); cursor: pointer; color: var(--text-secondary); font-weight: 600; }
.icg-steptabs button.on { background: var(--surface); color: var(--accent); box-shadow: var(--shadow-sm); }
.icg-status {
  font-size: 12px; color: var(--text-secondary);
  border: 1px dashed var(--border); border-radius: 4px; padding: 2px 10px;
}
.icg-status.on { color: var(--accent); border-style: solid; border-color: var(--accent); background: var(--accent-soft); }
.icg-sysline { display: flex; flex-wrap: wrap; gap: 4px 12px; padding: 5px 16px; font-size: 12px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.icg-sys { color: var(--text-secondary); }
.icg-sys-diff { color: var(--orange); font-weight: 600; }
.icg-shapes.icg-nosys > * { display: none; }
.icg-body { flex: 1; overflow-y: auto; scrollbar-gutter: stable; overscroll-behavior: contain; padding: 10px 14px 24px; }
.icg-toolbar { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.icg-bar { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.icg-bar-lab { font-size: 11.5px; color: var(--text-secondary); min-width: 38px; }
.icg-gap { width: 10px; }
.icg-chip {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--border); background: var(--surface); border-radius: 4px;
  padding: 3px 10px; font-size: 12px; cursor: pointer; color: var(--text);
}
.icg-chip.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); font-weight: 600; }
.icg-tool, .icg-seg {
  border: 1px solid var(--border); background: var(--surface); border-radius: var(--radius-sm);
  padding: 3px 9px; font-size: 13px; cursor: pointer; color: var(--text); min-width: 30px;
}
.icg-tool.on, .icg-seg.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.icg-tool:disabled { opacity: 0.4; cursor: default; }
.icg-snap { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--text-secondary); }
.icg-main { display: flex; gap: 10px; align-items: flex-start; }
.icg-canvas-host { flex: 1; min-width: 0; }
.icg-svg { display: block; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); outline: none; user-select: none; touch-action: none; }
.icg-svg:focus { border-color: var(--accent); }
.icg-svg .icg-domain { fill: #efe6cf; stroke: var(--text-secondary); stroke-width: 1; }
.icg-svg .icg-cells { image-rendering: pixelated; }
.icg-svg .icg-shape { stroke-width: 1.6; cursor: move; }
.icg-svg .icg-shape.sel { stroke-width: 2.4; stroke-dasharray: 5 3; }
.icg-svg .icg-shape.ghost { stroke-dasharray: 4 3; pointer-events: none; }
.icg-tip {
  position: absolute; z-index: 20; pointer-events: none; max-width: 320px;
  background: var(--surface); color: var(--text); border: 1px solid var(--border);
  border-radius: var(--radius-sm); box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
  padding: 6px 9px; font-size: 11.5px; line-height: 1.45; font-variant-numeric: tabular-nums; white-space: nowrap;
}
.icg-tip-head { font-weight: 650; margin-bottom: 2px; }
.icg-tip div:last-child { color: var(--text-secondary); font-style: italic; }
.icg-dlg { display: flex; flex-direction: column; gap: 10px; min-width: 420px; }
.icg-dlg-label { font-weight: 600; font-size: 12.5px; min-width: 84px; }
.icg-dlg-table td { padding: 3px 12px 3px 0; }
.icg-dlg-table input { width: 130px; padding: 2px 5px; font-size: 12px; }
.icg-dlg input.icg-missing { border-color: #d93025; box-shadow: 0 0 0 1px #d93025 inset; }
.icg-dlg-status { font-size: 12.5px; font-weight: 600; padding: 5px 8px; border-radius: var(--radius-sm); }
.icg-dlg-status.todo { color: #d93025; background: rgba(217, 48, 37, 0.08); }
.icg-dlg-status.done { color: #2e9e4f; background: rgba(46, 158, 79, 0.10); }
.icg-dlg-actions { display: flex; justify-content: flex-end; }
.icg-svg .icg-label { font-size: 11px; text-anchor: middle; fill: var(--text); paint-order: stroke; stroke: var(--surface); stroke-width: 3px; pointer-events: none; }
.icg-svg .icg-handle { fill: #fff; stroke: var(--accent); stroke-width: 1.5; }
.icg-svg .icg-rothandle { fill: var(--accent); stroke: #fff; stroke-width: 1.5; cursor: grab; }
.icg-svg .icg-rotline { stroke: var(--accent); stroke-width: 1; }
.icg-svg .icg-tick { stroke: var(--text-secondary); }
.icg-svg .icg-ticklab { font-size: 10px; fill: var(--text-secondary); text-anchor: middle; }
.icg-svg .icg-ticklab.end { text-anchor: end; }
.icg-vtk { width: 100%; height: 440px; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; position: relative; }
.icg-side { flex: 0 0 250px; display: flex; flex-direction: column; gap: 8px; }
.icg-side-box { border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); padding: 8px 10px; display: flex; flex-direction: column; gap: 6px; }
.icg-side-title { font-weight: 650; font-size: 12.5px; }
.icg-side-actions { display: flex; flex-wrap: wrap; gap: 4px; }
.icg-side-actions button { padding: 2px 8px; font-size: 12px; }
.icg-layers { display: flex; flex-direction: column; gap: 2px; max-height: 210px; overflow-y: auto; }
.icg-layer {
  display: flex; align-items: center; gap: 6px; padding: 3px 6px; border-radius: var(--radius-sm);
  font-size: 12.5px; cursor: pointer; border: 1px solid transparent;
}
.icg-layer:hover { background: var(--surface-2); }
.icg-layer.sel { background: var(--accent-soft); border-color: var(--accent); }
.icg-layer.err { box-shadow: inset 3px 0 0 var(--red); }
.icg-layer.drop { border-top: 2px solid var(--accent); }
.icg-layer-no { color: var(--text-secondary); font-size: 11px; min-width: 16px; font-variant-numeric: tabular-nums; }
.icg-layer-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icg-layer-tag { font-size: 10.5px; color: var(--text-secondary); }
.icg-eye { border: none; background: none; cursor: pointer; color: var(--text-secondary); padding: 0 2px; }
.icg-swatch { display: inline-block; width: 11px; height: 11px; border-radius: 3px; border: 1px solid rgba(0,0,0,0.15); flex-shrink: 0; }
.icg-tsub { font-size: 11.5px; color: var(--text-secondary); margin-top: 4px; }
.icg-trow { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.icg-num { display: inline-flex; align-items: center; gap: 3px; }
.icg-num input { width: 58px; padding: 2px 4px; font-size: 12px; }
.icg-num-lab { font-size: 11.5px; color: var(--text-secondary); min-width: 14px; }
.icg-steps { display: inline-flex; flex-direction: column; }
.icg-step { padding: 0 4px; font-size: 8px; line-height: 1.15; border: 1px solid var(--border); background: var(--surface-2); cursor: pointer; }
.icg-step.wide { font-size: 11px; padding: 1px 6px; line-height: 1.3; }
.icg-steprow input { width: 34px; padding: 1px 3px; font-size: 11.5px; }
.icg-below { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.icg-details summary { cursor: pointer; font-size: 12.5px; font-weight: 600; }
.icg-summary { display: flex; flex-direction: column; gap: 6px; }
.icg-section { image-rendering: pixelated; border: 1px solid var(--border); }
.icg-inline { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.icg-checks { margin: 4px 0 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; }
.icg-checks .icg-lvl { font-weight: 650; margin-right: 6px; }
.icg-err .icg-lvl { color: var(--red); }
.icg-warn .icg-lvl { color: var(--orange); }
.icg-table { border-collapse: collapse; font-size: 12px; margin: 4px 0 6px; font-variant-numeric: tabular-nums; }
.icg-table td { border-bottom: 1px solid var(--border); padding: 3px 10px 3px 0; vertical-align: middle; }
.icg-table thead td { color: var(--text-secondary); font-weight: 600; }
.icg-table tr.err td:first-child { box-shadow: inset 3px 0 0 var(--red); padding-left: 6px; }
.icg-table-wrap { overflow-x: auto; }
.icg-data input { width: 92px; padding: 2px 4px; font-size: 12px; }
.icg-mole { color: var(--text-secondary); }
.icg-range { font-size: 10.5px; color: var(--text-secondary); white-space: nowrap; margin-top: 1px; }
.icg-mole.icg-out { color: var(--red); font-weight: 600; }
.icg-mole.icg-out .icg-range, .icg-range.icg-out { color: var(--red); }
.icg-eq-btn { font-size: 11.5px; padding: 1px 7px; }
.icg-eq-note { font-size: 10.5px; color: var(--text-secondary); margin-top: 2px; max-width: 260px; }
.icg-eq-note.icg-eq-fail { color: var(--orange); }
.icg-thermo-line { margin: 2px 0 4px; }
.icg-mean { font-size: 12px; font-variant-numeric: tabular-nums; }
.icg-text { font-size: 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px; overflow-x: auto; margin: 0; }
.tray-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 16px;
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text-secondary);
  text-align: center;
  padding: 16px;
}
.tray-empty-title { font-size: 15px; font-weight: 600; }
.tray-empty-note { font-size: 12.5px; max-width: 320px; }
.tray-remove-btn { margin-top: 6px; }

#tray-nav {
  /* in the middle of the menu bar (until 2026-11-02 at its right end, after
     the Lounge button); in the flow again on a narrow window, where it would
     cover the menus */
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  gap: 2px;
  min-width: 0;
}
#tray-nav > .tray-nav-btn { flex-shrink: 0; }
@media (max-width: 1100px) {
  #tray-nav { position: static; transform: none; margin-left: 4px; }
}
.tray-nav-btn {
  background: none; border: 1px solid transparent; padding: 4px 9px; cursor: pointer;
  font-size: 12.5px; color: var(--text-secondary); border-radius: var(--radius-sm);
  font-variant-numeric: tabular-nums;
  transition: background-color 0.12s, color 0.12s;
}
.tray-nav-btn:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }
.tray-nav-btn:disabled { opacity: 0.35; cursor: default; }
/* minimap: tray chips and connector nodes, see tray_nav.js renderNav() */
/* scrolls sideways when the chips need more room than the bar has (tray_nav.js fitNav()) */
.minimap {
  display: flex; align-items: center; gap: 1px; margin: 0 4px;
  position: relative; /* the offsets fitNav() scrolls by */
  min-width: 0; overflow-x: auto; overflow-y: hidden; scrollbar-width: thin;
}
.minimap > * { flex-shrink: 0; }
/* an off-screen chip: a solid, plainly visible border, so it reads as a
   button (until 2026-11-20 var(--border), and dashed for an empty tray --
   too faint to tell from "nothing there") */
.mm-tray {
  display: inline-flex; gap: 4px; align-items: baseline;
  background: var(--surface); border: 1px solid var(--muted);
  border-radius: var(--radius-sm); padding: 3px 7px; cursor: pointer;
  font-size: 12px; color: var(--text-secondary); box-shadow: var(--shadow-sm);
  white-space: nowrap;
}
/* an on-screen chip: its own border too, in the accent, so the two trays in
   view read as two buttons (until 2026-11-20 no border, only the view's box) */
.mm-tray.on { color: var(--accent); border-color: var(--accent); background: var(--surface); font-weight: 600; box-shadow: none; }
/* the view: the two trays on screen and their connector, boxed as one selection */
.mm-view {
  display: flex; align-items: center; gap: 2px;
  background: var(--accent-soft); border: 1.5px solid var(--accent);
  border-radius: var(--radius-sm); padding: 2px 3px; margin: 0 2px;
}
.mm-view .mm-tray.on:hover:not(:disabled) { color: var(--accent); background: var(--accent-soft); border-color: var(--accent); }
.mm-tray:hover:not(:disabled) { color: var(--text); }
.mm-tray:not(.on):hover:not(:disabled) { border-color: var(--text-secondary); background: var(--surface-2); }
.mm-num { font-variant-numeric: tabular-nums; font-weight: 650; }
/* a connector chip: bordered as the tray chips are -- grey off screen, the
   accent in the view (until 2026-11-20 no border) */
.mm-conn {
  background: var(--surface); border: 1px solid var(--muted); border-radius: var(--radius-sm);
  padding: 3px 7px; cursor: pointer; font-size: 12px; color: var(--text-secondary);
  box-shadow: var(--shadow-sm);
}
.mm-conn[data-state="idle"] { color: var(--accent); }
.mm-conn-c { font-weight: 650; }
/* unlinked: a grey "C", on screen too (the arrow that told it is gone) */
.mm-conn[data-state="none"] .mm-conn-c { color: var(--muted); font-weight: 500; }
.mm-conn.on { color: var(--accent); border-color: var(--accent); box-shadow: none; }
.mm-conn.open { background: var(--accent-soft); border-color: var(--accent); }
.mm-conn:hover:not(:disabled) { background: var(--surface-2); }
.mm-conn:not(.on):not(.open):hover:not(:disabled) { border-color: var(--text-secondary); }
.minimap button:disabled { opacity: 0.45; cursor: default; }
.tray-nav-add { font-weight: 700; }

#lounge-btn { margin-left: auto; font-weight: 600; white-space: nowrap; flex-shrink: 0; }
#lounge-btn.active {
  color: var(--accent); background: var(--accent-soft); border-color: var(--accent);
}
#tray-nav.locked { opacity: 0.5; }

/* --------------------------------------------------------------- floors */
/* #floor-stack holds two floors of #main-layout's full height, the Lounge
   above and the trays below (see lounge.js); it is translated up by one
   floor unless the Lounge is shown. */
#floor-stack {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 200%;
  flex-shrink: 0;
  transform: translateY(-50%);
  transition: transform 0.3s ease;
}
#floor-stack.show-lounge { transform: translateY(0); }
#floor-stack.no-transition { transition: none; }
@media (prefers-reduced-motion: reduce) { #floor-stack { transition: none; } }
#lounge-floor,
#tray-floor {
  height: 50%;
  flex-shrink: 0;
  overflow: hidden;
}
#tray-floor { display: flex; }
#lounge-floor {
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

/* --------------------------------------------------------------- lounge */
.lounge-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 28px 32px 40px;
}
.lounge-header { margin-bottom: 20px; }
.lounge-title { margin: 0 0 4px; font-size: 22px; font-weight: 650; }
.lounge-subtitle { color: var(--text-secondary); font-size: 13.5px; }
.lounge-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.lounge-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 130px;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.lounge-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.lounge-card-title { font-size: 15px; font-weight: 600; }
.lounge-card-desc { font-size: 13px; color: var(--text-secondary); }
.lounge-badge {
  flex-shrink: 0;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  background: var(--surface-2);
}
.lounge-card-wide { grid-column: 1 / -1; min-height: 200px; }
/* Data Milky Way: a faint field of dots as a placeholder for the graph */
.lounge-milky-way {
  background-color: var(--surface);
  background-image:
    radial-gradient(circle, var(--accent-soft) 1.5px, transparent 1.6px),
    radial-gradient(circle, var(--border) 1px, transparent 1.1px);
  background-size: 46px 46px, 23px 23px;
  background-position: 0 0, 11px 13px;
}
.lounge-milky-way .lounge-card-title { font-size: 17px; }

/* -------------------------------------------------------------- preview */
#preview-panel {
  width: 50%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface);
}
/* Generic tab bar/button look -- shared by the top Preview/Results switch
   (#preview-tabs, see main.js's switchPreviewTab()) and the Results panel's
   own PPM Image/Curves/VTK sub-tabs (see results_view.js). Kept as one
   reusable pair of classes rather than duplicating the visuals, but the two
   bars stay independently addressable (#preview-tabs vs .tab-bar alone) so
   main.js's top-level tab-switch listener can stay scoped to just its own
   bar and never accidentally attach to the sub-tab buttons underneath. */
.tab-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.tab-btn {
  padding: 6px 14px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: none;
  box-shadow: none;
  color: var(--text-secondary);
  font-size: 12.5px;
  font-weight: 600;
}
.tab-btn:hover { background: var(--surface-3); color: var(--text); }
.tab-btn.active {
  background: var(--surface);
  border-color: var(--border);
  color: var(--accent);
  box-shadow: var(--shadow-sm);
}

/* My Batches' sort control (static/js/batch.js's buildSortButtonsRow()) --
   one pill-shaped segmented group (Created / Last Loaded / Name), pushed
   to the right edge of its toolbar row via margin-left:auto on the group
   itself rather than a wrapper, so it shares a row with Refresh/Browse
   without needing a second row just for it. */
.sort-group {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  margin-left: auto;
}
.sort-group-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  padding: 0 8px 0 8px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.sort-btn {
  padding: 5px 12px;
  border: none;
  border-radius: 4px;
  background: none;
  box-shadow: none;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.sort-btn:hover { background: var(--surface-3); color: var(--text); }
.sort-btn.active { background: var(--accent-fill); color: white; box-shadow: var(--shadow-sm); }
.sort-btn.active:hover { background: var(--accent-hover); }
#btn-popout-preview {
  margin-left: auto;
  padding: 6px 12px;
  font-size: 12px;
}
#preview-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
  position: relative;
  border: 2px dashed transparent;
  transition: border-color 0.15s, background-color 0.15s;
}
#preview-view.drag-over {
  border-color: var(--accent);
  background-color: var(--accent-soft);
}
#preview-view.drag-over::after {
  content: 'Drop input file to load';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 600;
  color: var(--accent);
  background: color-mix(in srgb, var(--surface) 85%, transparent);
  pointer-events: none;
  z-index: 10;
}
#preview-header {
  padding: 11px 18px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
#preview-text {
  flex: 1;
  margin: 0;
  padding: 16px 20px;
  overflow: auto;
  overscroll-behavior: contain;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.6;
  white-space: pre;
  background: var(--surface-2);
}
.pv-comment { color: var(--muted); font-style: italic; }
.pv-section { color: var(--accent); font-weight: 700; }
.pv-param { color: var(--green); }
.pv-value { color: var(--text); font-weight: 600; }

/* --------------------------------------------------------------- results */
#results-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overscroll-behavior: contain;
  /* Asymmetric on purpose -- this container has no `gap`, so its bottom
     "padding" is never actually visible on its own (the sub-tab body
     below fills all remaining height and scrolls internally); what IS
     visible is the space above the FIRST child (the Batch/case summary
     line) vs. the (zero) space between later siblings like the Case row
     and the tab-bar right below it, which was the actual inconsistency
     being reported -- not unequal top/bottom padding on this box. */
  padding: 2px 18px 6px;
  min-height: 0;
}
/* The active sub-tab's own body (Images/Curves/VTK) -- flex:1 makes it
   claim all height left over after the Case/cache-stats/sub-tab-bar rows
   above it (which keep their natural height), and its own overflow-y:auto
   makes IT the scroll container for that sub-tab rather than #results-view.
   Its own clientHeight/clientWidth (a page-layout-driven size, independent
   of its content) is also what syncViewportSizes() (results_view.js) reads
   as "how much room is there to scale the PPM image/legend up into" -- see
   .results-viewport-row below.

   scrollbar-gutter:stable makes that clientWidth measurement stable no
   matter whether a scrollbar is actually showing -- without it, a normal
   (non-overlay) scrollbar removes ~15-17px from clientWidth only WHILE
   showing. In a narrow window, sizing is normally width-bound (see
   syncViewportSizes' maxHeightByWidth), so that removed/restored width
   directly shrank/grew the computed height -- and since a shorter render
   can itself make content fit without scrolling (removing the scrollbar,
   restoring the width, growing the render again, re-triggering the
   scrollbar...), the two kept flipping each other back and forth, visibly
   shifting .results-details below up and down as it happened. Reserving
   the gutter's space unconditionally removes the only thing that was
   changing between those two states. */
.results-subtab-body {
  scrollbar-gutter: stable;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
/* A single-line toolbar row: nowrap (unlike .field-row, which wraps) so a
   narrow panel doesn't scatter these across many lines with dead
   space on the right -- exactly what made the old layout look broken.
   align-items:flex-end (not center) to match .field-row's own convention --
   a bare button() sits directly beside field()-wrapped controls (label
   stacked above input), and centering the whole row makes those bare,
   single-line buttons float noticeably off the input/select's own baseline
   since they don't have that label's height above them to match. */
.results-nav-row {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  flex-wrap: nowrap;
}
/* Batch/current-case summary in the Case row (see formatCaseSummary() in
   results_view.js) -- flex:1 lets it absorb the row's remaining width
   instead of forcing the row to grow, and min-width:0 (flex items default
   to min-width:auto, i.e. "never shrink below your own content's width")
   is what actually lets text-overflow:ellipsis kick in rather than just
   pushing Refresh/Batch Details/cache-stats out of this nowrap row when
   the batch name + parameter list run long. */
/* Its own line above the Case:/buttons row (see renderPanel() in
   results_view.js) -- overflow/ellipsis is just a defensive floor for an
   unusually long batch name + parameter list on an unusually narrow
   panel, not the normal case now that it isn't sharing a row (and fighting
   for width) with the buttons. */
/* Shares a row with cacheStatsBox now (see renderPanel() in
   results_view.js) -- flex:1 + min-width:0 lets it shrink and ellipsize
   into whatever width is left, instead of pushing the cache-stats/Clear
   Cache button out of this nowrap row when the batch name + parameter
   list run long. */
.results-case-summary {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  align-self: center;
}
/* Field:/Step size: labels beside (not above) their control -- see the
   toolbar row in renderImagesTab(). Normal text color/size (not .hint's
   small muted style, which read as too faint here) and align-self:center
   (this row's own align-items:flex-end otherwise bottom-aligns a bare
   span's text against the select/input's own bottom padding, landing
   noticeably lower than their text). */
.results-inline-label {
  color: var(--text);
  font-size: 13px;
  align-self: center;
}
/* Fixed width so the Frame # and Time labels line up, which in turn makes
   both sliders start at the same x position -- otherwise "Frame #:" being
   wider than "Time:" would make the two bars different lengths even though
   both are flex:1 within their own row. */
.results-slider-label { display: inline-block; min-width: 62px; }
.results-slider-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
}
.results-frame-slider { width: 100%; }
/* VTK tab's own frame/time sliders read narrower than the Images tab's, on
   request -- flex:1 1 auto (grow to fill available space, same as the
   Images tab) but capped at max-width, with margin:auto splitting whatever
   width is left over evenly as left/right breathing room. Both the Frame #
   and Time rows use this SAME rule (no per-row structural differences left
   -- see renderVtkTab()'s comment on frameStatusBarEl for why the frame
   row no longer wraps its slider in an extra div), which is what keeps the
   two bars the same rendered length. */
.vtk-slider-wrap { flex: 1 1 auto; max-width: 640px; margin: 0 auto; }
/* Shared custom look for BOTH the VTK tab's Frame # and Time sliders (picked
   from a side-by-side comparison, "Option B": a white/ring thumb over a
   bordered, native-looking track) -- kept identical between the two so
   they read as the same control, unlike an earlier version where only the
   Frame slider was restyled (to let the compression-status strip show
   through, see .vtk-progress-slider below) and the Time slider was left in
   its native look, which was visually inconsistent. -webkit-appearance:none
   is required on the INPUT itself for Chromium to honor ANY of these
   pseudo-element overrides at all -- overriding e.g. background alone
   without it is a silent no-op, the browser still paints its own themed
   track/thumb underneath. box-sizing:border-box on the track makes its
   1px border part of the declared height (not added on top of it), which
   is what makes the thumb's margin-top math below exact. Firefox/other
   engines that don't match either -moz-/-webkit- pseudo-element just keep
   the default native look -- no functional loss, same posture as this
   tab's tick marks. */
.vtk-styled-slider { -webkit-appearance: none; appearance: none; background: transparent; }
.vtk-styled-slider::-webkit-slider-runnable-track {
  height: 6px;
  box-sizing: border-box;
  border: 1px solid var(--border-strong);
  border-radius: 3px;
  background: var(--surface-3);
}
/* Gray circle with a white ring border -- matches the ACTUAL look of the
   Images (PPM) tab's own sliders' native (unstyled) thumb in this
   browser/OS: a gray knob with a light border for contrast against the
   track, not a flat blue disc (an earlier version used var(--accent) on
   the mistaken assumption, from a differently-themed test environment,
   that the native thumb was blue) and not as dark/borderless as the very
   next attempt after that either. box-sizing:border-box keeps the total
   16px diameter the border eats into, rather than adding to it. This
   tab's thumb can't literally BE that native thumb (appearance:none is
   required for the transparent track the compression-status strip shows
   through -- see .vtk-progress-slider below), so this approximates its
   look instead. */
.vtk-styled-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  margin-top: -5px; /* (6px track - 16px thumb) / 2, centers the thumb on the track */
  border-radius: 50%;
  box-sizing: border-box;
  background: #6b6b70;
  border: 2px solid #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,.25);
  cursor: pointer;
}
.vtk-styled-slider::-moz-range-track {
  height: 6px;
  box-sizing: border-box;
  border: 1px solid var(--border-strong);
  border-radius: 3px;
  background: var(--surface-3);
}
.vtk-styled-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  box-sizing: border-box;
  background: #6b6b70;
  border: 2px solid #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,.25);
  cursor: pointer;
}
/* Hovered (cursor anywhere over the slider, not pressed) -- a soft glow on
   BOTH the thumb and the track itself (fill unchanged on either, just the
   glow), as a lighter cue than an actual press. Narrower/dimmer than an
   earlier version (was a 4px ring on the thumb, 3px blur on the track) --
   reported as too strong. */
.vtk-styled-slider:hover::-webkit-slider-thumb {
  box-shadow: 0 0 0 2px rgba(0,0,0,.12), 0 1px 2px rgba(0,0,0,.25);
}
.vtk-styled-slider:hover::-moz-range-thumb {
  box-shadow: 0 0 0 2px rgba(0,0,0,.12), 0 1px 2px rgba(0,0,0,.25);
}
/* Black/neutral, not accent-tinted -- blue here read as too colorful for a
   plain hover cue. border-color is deliberately left alone -- only the
   glow itself should change on hover, not the track's own edge color. */
.vtk-styled-slider:hover::-webkit-slider-runnable-track {
  box-shadow: 0 0 2px 0px rgba(0,0,0,0.22);
}
.vtk-styled-slider:hover::-moz-range-track {
  box-shadow: 0 0 2px 0px rgba(0,0,0,0.22);
}
/* Actively pressed/dragged ONLY (:active, not :focus -- :focus stays true
   after the mouse button is released and would leave this lit well past
   the actual press, which is exactly what was reported here) -- thumb
   switches to var(--accent) blue, matching the Images (PPM) tab's own
   native thumb, which is gray at rest but turns blue while being
   clicked/dragged (the white ring border stays put) -- the clearest "this
   is the one currently engaged" signal, automatically covering a drag too
   (a drag is just a sustained :active). */
.vtk-styled-slider:active::-webkit-slider-thumb {
  background: var(--accent);
  box-shadow: 0 0 0 2px rgba(0,0,0,.12), 0 1px 2px rgba(0,0,0,.25);
}
.vtk-styled-slider:active::-moz-range-thumb {
  background: var(--accent);
  box-shadow: 0 0 0 2px rgba(0,0,0,.12), 0 1px 2px rgba(0,0,0,.25);
}
/* Frame slider only, layered on top of .vtk-styled-slider: the track's
   fill (not its border) goes transparent so the compression-status strip
   behind it (frameStatusBarEl, see renderVtkTab()/renderFrameStatusBar()
   in vtk_view.js) shows through -- same border/radius/height as the Time
   slider's track, so the two still look like the same control, just with
   different content inside. */
.vtk-progress-slider::-webkit-slider-runnable-track { background: transparent; }
.vtk-progress-slider::-moz-range-track { background: transparent; }
.results-slider-tooltip {
  position: absolute;
  bottom: 100%;
  transform: translateX(-50%);
  margin-bottom: 6px;
  background: var(--text);
  color: var(--bg);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 5;
}

/* Row pairing the image viewport with the IPF legend beside it (not below
   -- ppm_viewer.py's own desktop layout put them side by side too).

   Both this row AND its two frames (.results-viewport, .results-legend-
   panel) are flex:0 0 auto -- sized to their own content, not stretched.
   syncViewportSizes() (results_view.js) sets .results-image-body's and
   .results-legend-body's explicit pixel width/height directly, computed
   from .results-subtab-body's own clientHeight (a stable reference --
   .results-subtab-body's size comes from the page's overall layout, not
   from what's inside it, so reading it back after WE'VE resized our own
   content doesn't create a shrink-only feedback loop) and this row's
   available width. This used to be flex:1 + a 45vh min-height instead --
   a deliberately generous floor/target for how big to scale small images
   up to -- but that sized the ROW ITSELF that big even once its content
   (now synced to a specific, possibly much smaller, computed size) no
   longer needed the space, which is what left a large blank gap between
   the frames and .results-details below. align-items:flex-start (not the
   flex default, stretch) additionally keeps each frame top-aligned to its
   own content instead of being stretched to match whatever height the
   OTHER one happens to need. */
.results-viewport-row {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.results-viewport {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px;
  overflow: hidden;
}
.results-time-label {
  flex-shrink: 0;
  min-height: 22px;
  text-align: center;
  font-weight: 700;
  font-size: 14px;
  color: var(--text);
}
.results-image-body {
  flex-shrink: 0;
  display: flex;
}
/* width/height:100% + object-fit:contain (not just max-width/max-height)
   so the frame always fills its viewport box consistently -- small-grid
   PPMs get scaled UP (not just left at native pixel size) as well as large
   ones scaled down, both preserving aspect ratio. image-rendering:
   pixelated keeps upscaled grid cells crisp/blocky instead of blurred. */
.results-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
}
/* IPF legend's own frame, beside the image (not a section within
   .results-details below it). Two earlier attempts tried to derive the
   legend's size from a single CSS rule shared with the row (a height-only
   aspect-ratio, then a flex-basis % of the row's width) -- neither tracks
   the PPM image correctly at ALL window sizes, because the image's own
   displayed size is bound by BOTH the row's width and height together
   (object-fit:contain): it grows with width only until it fills the row's
   height, then plateaus regardless of further width increases. A plain
   CSS rule can only follow one of those two dimensions, not "whichever
   one the image itself is currently bound by".

   So .results-legend-body's height is instead set directly, in JS
   (syncViewportSizes() in results_view.js), to the PPM image's own current
   rendered height -- computed the same way object-fit:contain would, from
   img.naturalWidth/naturalHeight vs. its box's actual size. width:auto +
   aspect-ratio then derives the correct width from that height the same
   way _render_ebsd_legend() in app.py always draws it (a fixed 320x580
   canvas). The aspect-ratio here is also this rule's fallback size before
   JS has run once (before the first frame's image has loaded). */
.results-legend-panel {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.results-legend-body {
  flex-shrink: 0;
  width: auto;
  aspect-ratio: 320 / 580;
}
.results-legend-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
/* Metadata/Save-Image-etc actions, below the viewport row -- never
   flex-grown (flex-shrink:0), so that row above always gets first claim
   on available height; reachable via .results-subtab-body's own scroll. */
.results-details {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.results-metadata-text {
  max-height: 160px;
  overflow-y: auto;
  overscroll-behavior: contain;
  white-space: pre-wrap;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-family: var(--font-mono);
  font-size: 12px;
}
/* Buttons and download <a> links (e.g. "Save Image as PNG") need to look
   identical -- both trigger an equivalent "get me a file" action, so the
   HTML element choice underneath shouldn't be visible to the user. */
a.button-link {
  display: inline-flex;
  align-items: center;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-size: 12.5px;
  font-weight: 550;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
}
a.button-link:hover { background: var(--surface-2); }

/* ------------------------------------------------------------ statusbar */
#status-bar {
  padding: 6px 18px;
  font-size: 12px;
  background: var(--surface-2);
  border-top: 1px solid var(--border);
  color: var(--text-secondary);
}

/* ------------------------------------------------ section / field atoms */
.section-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 14px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.section-header {
  font-family: var(--font-ui);
  background: var(--section-header-bg);
  /* 28px tall (until 2026-11-21 10px above and below); the capitals centred: the line box keeps
     room for descenders below them, so less padding below */
  padding: 7.5px 14px 4.5px;
  font-weight: 650;
  font-size: 12.5px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--section-header-fg);
  border-bottom: 1px solid var(--border);
}
.section-header.collapsible { cursor: pointer; user-select: none; }
.section-header.collapsible:hover { filter: brightness(1.15); }
.section-content { padding: 14px; display: flex; flex-direction: column; gap: 10px; }
/* dom.js helpSection(): the parameters at the left, what they mean in the
   box's free right column (under them on a narrow box) */
.help-body { display: flex; flex-wrap: wrap; align-items: flex-start; }
.help-body > .help-main { flex: 1 1 360px; min-width: 0; }   /* shrinks: long hints wrap instead of pushing the help under */
.help-side {
  flex: 1 1 300px; max-width: 520px; margin: 14px 14px 14px 0;
  padding: 10px 14px; border-left: 3px solid var(--accent-soft);
  font-size: 12.5px; color: var(--text-secondary); line-height: 1.5;
}
.help-summary { margin: 0 0 6px; color: var(--text); }
ul.help-summary { list-style: none; padding: 0; }
ul.help-summary li + li { margin-top: 3px; }
.help-summary b { font-weight: 650; }
.help-toggle {
  background: none; border: none; padding: 0; cursor: pointer;
  color: var(--accent); font-size: 12.5px; font-weight: 600;
}
.help-toggle:hover { text-decoration: underline; }
.help-details { margin: 8px 0 0; }
.help-details dt { color: var(--text); font-weight: 650; margin-top: 8px; }
.help-details dd { margin: 2px 0 0; }
.field-row { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end; }
.field {
  display: flex; flex-direction: column; gap: 4px; font-size: 13px;
  /* Without this, the default flex-column "stretch" cross-axis alignment
     forces the (short, size=N) input to widen to match its own label's text
     width whenever that label is the wider of the two -- e.g. a label like
     "Range for plotting, min (K):" stretched its own input way out compared
     to a neighboring field whose label ("max (K):") was short. Both label
     and input should size to their own natural width regardless of the
     other's length. */
  align-items: flex-start;
}
.field label { color: var(--text-secondary); font-size: 12px; font-weight: 500; }
/* Scoped by input type (not by ".field ") so any text input/select/textarea
   is styled consistently whether or not it happens to be wrapped in a
   field() -- an unwrapped input (e.g. inline rows like Initial Composition)
   otherwise falls back to the browser's own default border/padding, which
   differs subtly from this styling and visibly shifts on focus as the two
   borders swap. type=checkbox/radio are excluded on purpose -- they must
   keep their native appearance, not this text-field padding/border. */
input[type="text"], input[type="number"], input[type="password"], input:not([type]), select, textarea {
  font-size: 13px; padding: 6px 9px; border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); background: var(--surface); color: var(--text);
  transition: border-color 0.12s, box-shadow 0.12s;
}
/* <select> renders its native dropdown chrome (arrow icon, internal spacing)
   a bit taller than <input> even with identical padding/font-size/border --
   an explicit height (textareas excluded; they size by `rows`, not this)
   forces every single-line control to line up exactly regardless of that
   native rendering difference. */
input[type="text"], input[type="number"], input[type="password"], input:not([type]), select {
  height: 32px;
}
input[type="text"]:disabled, input[type="number"]:disabled, input[type="password"]:disabled, select:disabled, textarea:disabled {
  background: var(--surface-2); color: var(--muted); cursor: not-allowed;
}
.hint { font-size: 11.5px; color: var(--muted); line-height: 1.4; }
.hint.warn, .accent-red { color: var(--red); }
.accent-blue { color: var(--accent); }
.accent-orange { color: var(--orange); }
.accent-green { color: var(--green); }
/* Sticky per-case header: .listbox (run list) and .run-case-log (that
   case's own log <pre>, up to 220px tall) each scroll internally, so a
   long log can easily be taller than the whole run-list box. Pinning each
   row to the TOP of the shared .listbox scroll area (rather than the
   bottom, like .sticky-tab-actions elsewhere) means Run/Cancel/Cleanup
   stay onscreen while that case's log scrolls underneath, and the next
   case's row naturally displaces it once scrolled that far -- the classic
   "sticky list section header" pattern. Needs its own opaque background
   since .run-case-log (a later, non-positioned sibling) would otherwise
   show through as it scrolls past underneath.
*/
.run-case-row {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 5px 0;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 2;
  background: var(--surface);
}
.run-case-row:last-child { border-bottom: none; }
.run-case-name { font-weight: 600; min-width: 90px; }
/* a locked case (case.lock): kept as it is -- greyed name, see batch.js toggleCaseLock() */
.run-case-locked .run-case-name { color: var(--muted); }
.extend-lock-list { display: flex; flex-direction: column; gap: 2px; max-height: 260px; overflow-y: auto;
  border: 1px solid var(--border); border-radius: 4px; padding: 4px 8px; }
.extend-lock-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.run-case-log {
  width: 100%; margin-top: 6px; max-height: 400px; overflow-y: auto; white-space: pre-wrap;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 6px 8px; font-family: var(--font-mono); font-size: 11px;
  overscroll-behavior: contain;
}
/* a run's outcome under its row: what happened (log lines) and what to do */
.run-outcome {
  margin: 4px 0 6px 12px; padding: 6px 10px; border-left: 3px solid var(--border);
  background: var(--surface-2); border-radius: var(--radius-sm); font-size: 12px;
  overflow-wrap: anywhere;   /* case paths in the evidence / repair lines */
}
.run-outcome-title { font-weight: 600; margin-bottom: 2px; }
.run-outcome-evidence {
  margin: 4px 0; white-space: pre-wrap; overflow-wrap: anywhere; font-family: var(--font-mono);
  font-size: 11px; max-height: 120px; overflow-y: auto;
}
.run-outcome-guidance { margin: 4px 0 2px 18px; padding: 0; }
.run-outcome-guidance li { margin: 1px 0; }
/* installation check dialog (install_check.js) */
.install-check { min-width: 520px; max-width: 760px; }
.install-item { display: flex; align-items: flex-start; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.install-item .btn-sm { margin-left: auto; white-space: nowrap; }
.install-mark { font-weight: 700; width: 14px; text-align: center; }
.install-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.install-title { font-weight: 600; }
.install-guidance { font-family: var(--font-mono); font-size: 11px; }
.install-good { margin-top: 6px; overflow-wrap: anywhere; }
/* Work History (replay.js) */
.replay-layout { display: grid; grid-template-columns: minmax(220px, 300px) 1fr; gap: 12px; min-height: 360px; }
.replay-sessions { max-height: 60vh; overflow-y: auto; }
.replay-detail { min-width: 0; }
.replay-list { max-height: 56vh; overflow-y: auto; margin-top: 6px; }
.replay-row { display: flex; align-items: center; gap: 8px; padding: 3px 0; border-bottom: 1px solid var(--border); font-size: 12px; }
.replay-row .btn-sm { white-space: nowrap; }
.replay-time { color: var(--text-muted, #888); font-variant-numeric: tabular-nums; width: 70px; flex: none; }
.replay-what { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.replay-command .replay-what { font-weight: 600; }
.replay-failed .replay-what { color: var(--red); }
.replay-state .replay-what { color: var(--text-muted, #888); }
.replay-cmd-title { font-weight: 600; margin-top: 4px; }
.replay-cmd-body { max-height: 260px; overflow: auto; font-size: 11px; background: var(--surface-2); padding: 6px; white-space: pre-wrap; overflow-wrap: anywhere; }
.replay-settings select { margin: 0 4px; }
.replay-notice { border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); padding: 6px 10px; margin-bottom: 8px; font-size: 12px; }
.replay-notice-title { font-weight: 600; margin-bottom: 2px; }
.replay-notice ul { margin: 2px 0 0 18px; padding: 0; }
.replay-notice li { margin: 1px 0; }
@media (max-width: 700px) { .replay-layout { grid-template-columns: 1fr; } }
/* input wizard (wizard.js) */
.wiz-body { min-height: 380px; max-height: 68vh; overflow-y: auto; }
.wiz-steps { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-bottom: 12px; font-size: 12px; }
.wiz-step { color: var(--text-muted, #888); }
.wiz-step.done { color: var(--text-secondary, #555); }
.wiz-step.on { color: var(--accent); font-weight: 700; }
.wiz-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; margin-top: 10px; }
.wiz-card { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 10px; cursor: pointer; background: var(--surface); }
.wiz-card:hover { border-color: var(--accent); }
.wiz-card.selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.wiz-card.dim { opacity: 0.35; }
.wiz-card-title { font-weight: 600; }
.wiz-badge { display: inline-block; margin-top: 4px; font-size: 11px; color: var(--text-secondary, #666); }
.wiz-badge.ok { color: var(--green); font-weight: 600; }
.wiz-hits { margin-top: 6px; max-height: 160px; overflow-y: auto; }
.wiz-label { font-weight: 600; margin: 10px 0 4px; font-size: 13px; }
.wiz-grid { display: grid; grid-template-columns: minmax(160px, 260px) 1fr; gap: 4px 10px; align-items: center; margin: 4px 0; font-size: 13px; }
.wiz-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.wiz-chip { border: 1px solid var(--border); border-radius: 4px; padding: 2px 10px; background: var(--surface); cursor: pointer; }
.wiz-chip.on { background: var(--accent-fill); color: #fff; border-color: var(--accent-fill); }
.wiz-radio { display: block; margin: 4px 0; }
.wiz-nav { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }
@media (max-width: 700px) { .wiz-grid { grid-template-columns: 1fr; } }
/* nucleation check (nucleation_check.js) */
.nuc-table { border-collapse: collapse; font-size: 12px; margin: 6px 0; }
.nuc-table th, .nuc-table td { padding: 3px 8px; border-bottom: 1px solid var(--border); text-align: left; }
.nuc-table th { color: var(--text-secondary, #666); font-weight: 600; }
.nuc-result { overflow-x: auto; }
.solvent-label { font-style: italic; color: var(--accent); margin-bottom: 4px; }
.phase-label {
  font-weight: 600; color: var(--accent);
  /* min-width does nothing on an inline element (the default for <span>) --
     without inline-block, longer phase names simply grew past 140px with no
     effect from this rule, so each row's Grains:/Cycles: columns started at
     a different x position depending on that row's own phase name length. */
  display: inline-block; min-width: 180px;
}
.inline-field-label {
  color: var(--text-secondary); font-size: 13px; font-weight: 500;
  display: inline-block; min-width: 110px;
}
.dynamic-group { display: flex; flex-direction: column; gap: 8px; }

/* Ordered-list editor (Elements tab's ABi list, Phases tab's PHi list) --
   see orderedListEditor() in dom.js. Fixed-width index badge and tag
   columns keep the Up/Down/Remove buttons lined up at the same x position
   on every row, regardless of how long that row's own text happens to be
   (the previous field()-per-row layout let a single long label, e.g. "AB1
   (global solvent):", push just that row's buttons out of line with the
   rest). */
.ordered-list-editor { display: flex; flex-direction: column; gap: 4px; }
.ordered-list-row { display: flex; align-items: center; gap: 6px; }
.ordered-list-index {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 20px; flex-shrink: 0;
  font-size: 11px; font-weight: 700; color: var(--text-secondary);
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px;
}
.ordered-list-tag {
  display: inline-block; min-width: 108px; flex-shrink: 0;
  font-size: 11px; font-style: italic; color: var(--accent);
}
/* Fixed width AND height (not just padding) -- glyphs like the Results
   panel's First/Prev/Next/Last (⏮◀▶⏭) render at different intrinsic
   widths *and* line-heights per character (⏮/⏭ get emoji-presentation
   rendering by default in some fonts, which carries its own box metrics
   taller than a plain-text glyph like ◀/▶), so padding-based sizing alone
   left the buttons visibly uneven heights even with a fixed width. Forcing
   both dimensions and flex-centering the glyph inside removes any
   dependency on the content's own rendered metrics. */
.icon-btn {
  width: 34px;
  height: 32px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* Same ◀/▶ glyphs as Prev/Next, colored to read as a distinct "jump to
   nearest compressed frame" action (VTK tab) rather than a plain step. */
.icon-btn-green { color: var(--green); }

h2 { font-size: 16px; font-weight: 650; letter-spacing: -0.01em; margin: 4px 0 2px; }

input, select, textarea, button { font-family: inherit; }
/* small text at the font's own glyph widths (not rounded to whole pixels: "Domain" read "Doma in"); set on
   the form controls too, as the browser's own style resets it there */
html, button, input, select, textarea { text-rendering: geometricPrecision; }
/* equal-width digits where values line up (not on buttons and labels: Inter widens the hyphen with it) */
input, select, textarea, td, .prow-text code { font-variant-numeric: tabular-nums; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.phases-textarea, .results-text, .machine-textarea {
  width: 100%; font-family: var(--font-mono); font-size: 12.5px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: 8px 10px; background: var(--surface);
  overscroll-behavior: contain;
}

/* ------------------------------------------------------------- buttons */
button {
  padding: 7px 14px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); cursor: pointer; font-size: 12.5px;
  font-weight: 550; box-shadow: var(--shadow-sm);
  transition: background-color 0.12s, border-color 0.12s, transform 0.08s, box-shadow 0.12s;
}
button:hover { background: var(--surface-2); border-color: var(--border-strong); }
button:active { transform: translateY(1px); }
button.accent { background: var(--accent-fill); color: white; border-color: var(--accent-fill); }
button.accent:hover { background: var(--accent-hover); border-color: var(--accent-hover); box-shadow: var(--shadow-md); }

button:disabled { opacity: 0.5; cursor: not-allowed; box-shadow: none; transform: none; }
button.cancel-btn { border-color: var(--red); color: var(--red); background: var(--red-soft); }
/* Shorter variant for a row with several buttons packed together (VTK
   tab's compression controls) -- same footprint as a plain text label
   next to it, rather than the default button's own taller padding. */
button.btn-sm { padding: 3px 10px; font-size: 11.5px; white-space: nowrap; }
button.cancel-btn:not(:disabled):hover { background: var(--red); color: white; }
button.cancel-btn:disabled { opacity: 0.4; }

/* -------------------------------------------------------------- lists */
.listbox {
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); max-height: 160px;
  overflow-y: auto; background: var(--surface);
  overscroll-behavior: contain;
}
/* Batch tab's run list -- taller than the generic .listbox default since
   each entry can carry its own .run-case-log (now up to 400px) rather
   than a single line of text. Horizontal padding here (not on .listbox
   itself, which other lists' own .listbox-item/.listbox-item-file already
   pad individually) since .run-case-row/.run-case-log are placed directly
   in this container with no horizontal padding of their own -- without it,
   the case name/buttons sit flush against the box's left/right border. */
.run-listbox { max-height: 440px; padding: 0 11px; }
/* My Batches list (see renderMyBatchesTab() in batch.js) -- this IS the
   tab's main content, not a small in-page picker, so the generic
   .listbox cap (160px, its own inner scroll) just boxed it into a tiny
   pane with the rest of the already-scrollable page sitting empty below
   it. No cap here -- grows with its content and scrolls with the page. */
.batch-list-box { max-height: none; overflow-y: visible; }
.listbox-item { padding: 7px 11px; font-size: 12.5px; cursor: pointer; border-bottom: 1px solid var(--border); transition: background-color 0.1s; }
.listbox-item:last-child { border-bottom: none; }
.listbox-item:hover { background: var(--surface-2); }
.listbox-item.selected { background: var(--accent-fill); color: white; }

.listbox-item-file { display: flex; flex-direction: column; gap: 2px; padding: 6px 11px; }
/* My Batches: the currently expanded row (see toggleBatchExpand()) gets a
   soft accent tint so it reads as "active" at a glance -- a lighter touch
   than .selected's solid --accent fill (that one means "explicitly picked
   for removal" elsewhere, a different concept), and still readable since
   it doesn't need to override every descendant's text color the way
   .selected does. */
.listbox-item-file.expanded, .listbox-item-file.expanded:hover { background: var(--accent-soft); }
.file-row-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.file-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-path {
  font-size: 11px; color: var(--text-secondary); font-family: var(--font-mono);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.listbox-item-file.selected .file-path { color: rgba(255,255,255,0.85); }
.file-loc-badge {
  flex-shrink: 0; font-size: 10px; font-weight: 700; letter-spacing: 0.03em;
  padding: 2px 7px; border-radius: 4px; text-transform: uppercase;
}
.file-loc-badge.local { background: var(--surface-3); color: var(--text-secondary); }
.file-loc-badge.remote { background: var(--accent-soft); color: var(--accent); }
.listbox-item-file.selected .file-loc-badge.local { background: rgba(255,255,255,0.25); color: white; }
.listbox-item-file.selected .file-loc-badge.remote { background: rgba(255,255,255,0.25); color: white; }

/* My Batches' per-batch thumbnail (static/js/batch.js's renderBatchListItems())
   -- on a 404 (no thumbnail generated yet), the <img> swaps for a same-size
   .batch-thumbnail-placeholder instead of collapsing away, so the row's
   layout stays put rather than a box appearing then vanishing. */
.batch-thumbnail {
  width: 56px; height: 56px; flex-shrink: 0;
  object-fit: cover; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface-2);
}
.batch-thumbnail-placeholder {
  display: flex; align-items: center; justify-content: center;
  text-align: center; font-size: 9.5px; font-weight: 600;
  color: var(--text-secondary); line-height: 1.3;
}

.phase-group-label { font-weight: 650; font-size: 12px; margin-top: 6px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.02em; }
.phase-checkbox-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.phase-checkbox { font-size: 12.5px; display: flex; align-items: center; gap: 5px; }

/* Remote tab's Node Status grid (populateRemoteTab()/renderNodeStatus() in
   remote.js, also reused as-is by the header pill's hover popover and
   batch.js's "Check Cluster Load" modal -- see buildNodeStatusGrid()'s own
   docstring) -- auto-fill with a guaranteed-minimum box width, NOT a fixed
   column count: however many boxes of at least 104px fit in the actual host
   width is how many render per row, wrapping the rest to more rows. A
   fixed count (tried first: 10, then a narrower 6 for the popover
   specifically) was confirmed broken on a real 30-node cluster regardless
   of which fixed number was chosen -- forcing N equal-width columns into
   ANY container eventually produces unreadably narrow boxes for SOME
   combination of node count and container width; a real per-box minimum
   is the only constraint that actually holds up. Each box splits top
   (name) / bottom (load) via two stacked divs, colored by raw load1 vs.
   this node's own core count -- green: load1 < 1, yellow: load1 > 1 but
   with headroom before the node's own core count, orange: fewer than 5
   "load units" of headroom left before that count, red: fewer than 1 left
   (see nodeLoadClass() in remote.js for the exact thresholds), gray/
   unknown: no load data for that node yet. --yellow is its own token (not
   reused from --orange, unlike this app's other yellow-ish uses
   elsewhere) specifically so this grid's warning tiers stay visually
   distinct from each other. */
.node-status-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 6px; margin: 8px 0; }
.node-box {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-2); padding: 6px 4px; text-align: center;
  min-width: 0; /* lets the name below actually ellipsize instead of overflowing the grid track */
}
.node-box-name { font-size: 11px; font-weight: 650; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.node-box-load {
  font-size: 13px; font-weight: 700; margin-top: 2px;
  /* Without this, a value that doesn't fit the box (e.g. "49.67") spilled
     visibly into the NEXT box over instead of truncating -- confirmed on
     a real 30-node cluster crammed into the header pill's own narrow
     popover (since fixed to a lower column cap there too, see
     buildNodeStatusGrid()'s own maxCols param in remote.js). */
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.node-box-load-unknown { color: var(--muted); }
.node-box-load-green { color: var(--green); }
.node-box-load-yellow { color: var(--yellow); }
.node-box-load-orange { color: var(--orange); }
.node-box-load-red { color: var(--red); }
.node-box-green { background: color-mix(in srgb, var(--green) 12%, var(--surface-2)); border-color: color-mix(in srgb, var(--green) 40%, var(--border)); }
.node-box-yellow { background: color-mix(in srgb, var(--yellow) 14%, var(--surface-2)); border-color: color-mix(in srgb, var(--yellow) 40%, var(--border)); }
.node-box-orange { background: color-mix(in srgb, var(--orange) 14%, var(--surface-2)); border-color: color-mix(in srgb, var(--orange) 45%, var(--border)); }
.node-box-red { background: color-mix(in srgb, var(--red) 16%, var(--surface-2)); border-color: color-mix(in srgb, var(--red) 50%, var(--border)); }

/* Batch tab's "Specify HPC Nodes" matrix (openSpecifyNodesDialog() in
   batch.js) -- interactive sibling of .node-status-grid/.node-box above
   (same auto-fill/minmax approach so it can't repeat that grid's own
   "fixed column count breaks for some node-count/width combo" bug, see
   its own comment), just with a wider per-box minimum (112px vs 104px) --
   each box holds a live number input plus two stepper buttons side by
   side, which needs more room than a read-only name+number ever did. */
.node-input-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 8px; margin: 8px 0; }
.node-input-box { transition: background-color 0.15s, border-color 0.15s; }
/* Applied once a box's own allocation is > 0 -- distinguishes "specified"
   from "unspecified" nodes at a glance, echoing the header's own
   Specified/Unspecified counts (see renderSpecifyHeader() in batch.js). */
.node-box-specified { border-color: var(--accent); background: var(--accent-soft); }
.node-input-row { display: flex; align-items: center; justify-content: center; gap: 3px; margin-top: 4px; }
.node-input-row input[type="number"] {
  width: 38px; font-size: 12px; text-align: center; padding: 2px 0;
  border: 1px solid var(--border); border-radius: 4px; background: var(--surface);
  /* Hides the native up/down spinner arrows -- the dedicated +/- buttons
     right next to it already cover that, and the native spinner at this
     width just crowds the digits. */
  -moz-appearance: textfield;
}
.node-input-row input[type="number"]::-webkit-outer-spin-button,
.node-input-row input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.node-stepper-btn {
  width: 20px; height: 20px; padding: 0; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  line-height: 1; font-size: 13px; font-weight: 700;
}
/* A box whose own input currently has focus -- same accent ring the rest
   of this app uses for focus states, standing in for "selected" (matches
   the mockup this feature was designed from, which highlighted whichever
   box the user was actively typing into). */
.node-box:focus-within { box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 45%, transparent); }

/* Batch tab's "Specify HPC Nodes" dialog (openSpecifyNodesDialog() in
   batch.js) -- narrow Unspecified/Specified summary column on the left,
   the node-input matrix in its own panel on the right. Colors come from
   this app's own existing tokens throughout (surface/border/accent/
   green/orange), not a new palette -- there's nothing about this feature
   that calls for one. */
.node-specify-layout { display: flex; gap: 14px; align-items: flex-start; flex-wrap: wrap; }
.node-specify-summary { display: flex; flex-direction: column; gap: 10px; width: 128px; flex-shrink: 0; }
.node-specify-card {
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px 10px; text-align: center; background: var(--surface-2);
}
.node-specify-card-label { font-size: 11.5px; color: var(--text-secondary); margin-bottom: 6px; }
.node-specify-card-value { font-size: 26px; font-weight: 700; }
.node-specify-card.specified { background: color-mix(in srgb, var(--green) 14%, var(--surface-2)); border-color: color-mix(in srgb, var(--green) 40%, var(--border)); }
.node-specify-card.specified .node-specify-card-value { color: var(--green); }
/* Specifying MORE than the target is explicitly NOT a problem (confirmed
   by the user -- an earlier version flagged this case in orange, removed)
   -- the Specified card only ever turns red for the one case that DOES
   matter, not having specified ENOUGH yet (unspecified > 0), overriding
   its own normal green above while incomplete. */
.node-specify-card.specified.incomplete { background: var(--red-soft); border-color: color-mix(in srgb, var(--red) 45%, var(--border)); }
.node-specify-card.specified.incomplete .node-specify-card-value { color: var(--red); }
.node-specify-panel {
  flex: 1 1 320px; min-width: 0;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px;
  max-height: 60vh; overflow-y: auto; /* a real cluster's node count can run the grid several rows tall */
}

/* Specify Nodes: case x node matrix (batch.js caseNodeAssign) */
.case-node-matrix-section { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; }
.case-node-matrix-wrap { max-height: 45vh; overflow: auto; border: 1px solid var(--border); border-radius: var(--radius); }
.case-node-matrix { border-collapse: collapse; font-size: 12.5px; white-space: nowrap; }
.case-node-matrix th, .case-node-matrix td { padding: 3px 6px; border-bottom: 1px solid var(--border); text-align: center; }
.case-node-matrix thead th { position: sticky; top: 0; background: var(--surface-2); z-index: 1; }
.case-node-matrix tfoot th, .case-node-matrix tfoot td { position: sticky; background: var(--surface-2); font-weight: 600; }
.case-node-matrix tfoot tr:first-child > * { bottom: 26px; }
.case-node-matrix tfoot tr:last-child > * { bottom: 0; }
.case-node-matrix td.cnm-params { text-align: left; color: var(--muted); max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.case-node-matrix input { width: 46px; text-align: center; }
.case-node-matrix input.cnm-set { font-weight: 700; background: color-mix(in srgb, var(--accent, #2563eb) 12%, transparent); }
.cnm-ok { color: var(--green, #15803d); }
.cnm-warn { color: var(--orange, #c2410c); font-weight: 700; }
.cnm-bad { color: var(--red); font-weight: 700; }

/* 2D Analyzer (analyzer2d_module.js) */
#analyzer2d-panel { display: flex; flex-direction: column; width: 100%; box-sizing: border-box; height: 100%; min-height: 0; padding: 10px 12px; gap: 8px; outline: none; }
.an2d-head { display: flex; align-items: baseline; gap: 12px; }
.an2d-title { font-weight: 650; font-size: 15px; }
.an2d-status { color: var(--text-secondary); font-size: 12.5px; }
.an2d-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13px; }
.an2d-frame { color: var(--text-secondary); font-size: 12.5px; }
.an2d-frame.an2d-warn { color: var(--orange); font-weight: 600; }
.an2d-badge { font-size: 11.5px; padding: 1px 8px; border-radius: 4px; background: var(--accent-soft); color: var(--accent); }
.an2d-main { flex: 1 1 auto; min-height: 0; display: flex; gap: 10px; }
.an2d-view { position: relative; flex: 1 1 auto; min-width: 0; min-height: 240px; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; cursor: crosshair; touch-action: none; }
.an2d-view.an2d-panning { cursor: grabbing; }
.an2d-view canvas.an2d-base, .an2d-view canvas.an2d-over { position: absolute; inset: 0; width: 100%; height: 100%; }
.an2d-empty { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 24px;
  text-align: center; color: var(--text-secondary); font-size: 13px; }
.an2d-banner { position: absolute; left: 12px; right: 12px; top: 12px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 8px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 2px 10px rgba(0,0,0,.12); font-size: 13px; z-index: 2; }
.an2d-bar { flex: 1 1 100%; height: 4px; background: var(--surface-2); border-radius: 2px; overflow: hidden; order: 3; }
.an2d-bar > span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.an2d-spinner { width: 14px; height: 14px; border: 2px solid var(--accent-soft); border-top-color: var(--accent);
  border-radius: 50%; animation: an2d-spin .8s linear infinite; }
@keyframes an2d-spin { to { transform: rotate(360deg); } }
.an2d-colorbar { display: flex; gap: 6px; font-size: 11.5px; font-variant-numeric: tabular-nums; }
.an2d-colorbar canvas { width: 14px; height: 140px; border: 1px solid var(--border); }
.an2d-cb-labels { display: flex; flex-direction: column; justify-content: space-between; }
.an2d-side { flex: 0 0 230px; min-width: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; font-size: 12.5px; }
.an2d-side-title { font-weight: 600; display: flex; align-items: center; gap: 6px; }
.an2d-probe-pos { font-variant-numeric: tabular-nums; color: var(--text-secondary); margin-bottom: 4px; }
.an2d-table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
.an2d-table td, .an2d-table th { padding: 2px 6px; border-bottom: 1px solid var(--border); text-align: left; }
.an2d-table td.an2d-num { text-align: right; }
.an2d-table tr.an2d-cur td { font-weight: 650; }
.an2d-muted { color: var(--text-secondary); }
.an2d-stale { color: var(--orange); }
.an2d-x { padding: 0 6px; line-height: 1.2; }
.an2d-seam-fields { display: inline-flex; flex-wrap: wrap; gap: 4px 10px; }

/* -------------------------------------------------------------- charts */
.chart-container { width: 100%; }
.chart-title { font-size: 13px; font-weight: 650; margin-bottom: 8px; white-space: pre-line; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 10px; }
.legend-item { font-size: 12.5px; display: inline-flex; align-items: center; gap: 5px; }
.legend-swatch { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }

/* Curves sub-tab: one independently-configured chart per .curve-plot-card
   (X-axis select + Y-axis column checkboxes above its own chart), see
   renderPlotCard() in results_view.js. */
.curve-plot-card { flex-shrink: 0; }
.checkbox-item { font-size: 12.5px; display: inline-flex; align-items: center; gap: 5px; cursor: pointer; }

.case-preview-list { max-height: 400px; overflow-y: auto; overscroll-behavior: contain; }

/* --------------------------------------------------------------- busy */
.busy-indicator {
  font-size: 12.5px; color: var(--accent); display: inline-flex; align-items: center; gap: 7px;
  min-height: 18px; font-weight: 550;
}
.spinner {
  display: inline-block; width: 13px; height: 13px; border-radius: 50%;
  border: 2px solid var(--border-strong); border-top-color: var(--accent);
  animation: spin 0.7s linear infinite; flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* -------------------------------------------------------------- modal */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(10,10,12,0.45);
  backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center; z-index: 100;
}
.modal-dialog {
  background: var(--surface); border-radius: var(--radius); min-width: 380px;
  max-width: 90vw; max-height: 85vh; display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg); border: 1px solid var(--border);
}
.modal-dialog.modal-wide { min-width: 600px; }
.modal-header {
  padding: 14px 18px; font-weight: 650; font-size: 14px; border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
}
.modal-close {
  background: none; border: none; font-size: 20px; line-height: 1; cursor: pointer; padding: 2px 6px;
  border-radius: 6px; color: var(--muted);
}
.modal-close:hover { background: var(--surface-2); color: var(--text); }
.modal-body { padding: 18px; overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; gap: 12px; }
/* Without this, a tall modal-body (e.g. Anisotropy Function Preview's
   NFOLD/param controls + a fixed-height 3D plot + "Apply to Phase(s)")
   lets flexbox shrink children below their natural size instead of
   scrolling -- and any shrunk child that also has overflow:hidden (like
   .section-box, just below) then clips its own content invisibly rather
   than showing it, since CSS treats overflow:hidden's automatic minimum
   size as 0, same as overflow:auto/scroll. Pinning every direct child to
   its natural size instead makes modal-body's own scrollHeight grow past
   its clientHeight, so the intended overflow-y:auto scrollbar appears. */
.modal-body > * { flex-shrink: 0; }

/* ---- Report Issue floating panel (issue_report.js): non-modal, draggable ---- */
.fb-panel {
  position: fixed; right: 16px; bottom: 16px; width: 420px; max-width: calc(100vw - 32px);
  max-height: calc(100vh - 32px); overflow: auto; z-index: 900;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius);
  box-shadow: 0 8px 28px rgba(0,0,0,0.3);
}
.fb-header {
  display: flex; justify-content: space-between; align-items: center; padding: 8px 12px;
  font-weight: 600; cursor: move; user-select: none; border-bottom: 1px solid var(--border);
}
.fb-body { padding: 10px 12px; }
.fb-label { font-weight: 600; margin: 8px 0 4px; font-size: 0.85rem; }
.fb-boxes { display: flex; flex-direction: column; gap: 2px; max-height: 150px; overflow: auto; }
.fb-box { display: flex; align-items: center; gap: 6px; cursor: pointer; font-size: 0.85rem; }
.fb-msg { width: 100%; box-sizing: border-box; padding: 8px; font-family: inherit; font-size: 0.9rem; }
.fb-preview { max-width: 100%; max-height: 180px; margin-top: 6px; border: 1px solid var(--border); }
.fb-actions { margin-top: 10px; display: flex; gap: 8px; align-items: center; }

/* Report Issue for the tray layout (issue_report.js): areas by group,
   attached information */
.ir-panel { width: 460px; }
.ir-areas { max-height: 300px; overflow: auto; }
.ir-group { font-size: 0.72rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; margin: 6px 0 3px; }
.ir-area-row { display: flex; flex-wrap: wrap; gap: 4px; }
.ir-area { padding: 3px 8px; font-size: 0.8rem; cursor: pointer; }
.ir-area.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.ir-ctx-details { margin-top: 10px; font-size: 0.82rem; }
.ir-ctx-details summary { cursor: pointer; font-weight: 600; }
.ir-ctx-head { display: flex; align-items: center; gap: 6px; margin-top: 6px; cursor: pointer; }
.ir-ctx-body { margin-left: 22px; color: var(--muted); word-break: break-all; }

/* ------------------------------------------------- registered-TDB picker
   Popover on the header's "TDB:" pill (built by tdb_registry.js). Pure CSS
   :hover / :focus-within reveal, so the filter box and buttons inside stay
   usable while open. */
.tdb-popover {
  display: none;
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 50;
  width: min(92vw, 480px); max-height: 75vh; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
  padding: 10px 12px; white-space: normal; text-align: left; cursor: default;
}
#tdb-status:hover .tdb-popover,
#tdb-status:focus-within .tdb-popover { display: block; }
.tdb-popover.busy { opacity: 0.6; }  /* no pointer-events:none -- that would drop :hover and close the popover mid-load */
.tdbreg-title { font-weight: 600; color: var(--text); margin-bottom: 6px; }
.tdbreg-search { width: 100%; box-sizing: border-box; padding: 5px 8px; margin-bottom: 8px; font-size: 12px; }
.tdbreg-list { display: flex; flex-direction: column; gap: 4px; }
.tdbreg-item {
  display: flex; flex-direction: column; align-items: flex-start; gap: 3px;
  width: 100%; text-align: left; padding: 7px 9px; border-radius: 3px; cursor: pointer;
  background: var(--surface-2); border: 1px solid var(--border);
}
.tdbreg-item:hover { border-color: var(--accent); background: var(--accent-soft); }
.tdbreg-item.current { border-color: var(--green); }
.tdbreg-name { font-weight: 600; color: var(--text); }
.tdbreg-elems { display: flex; flex-wrap: wrap; gap: 3px; }
.tdbreg-chip { font-size: 11px; padding: 0 6px; border-radius: 4px; background: var(--surface-3); color: var(--text-secondary); }
.tdbreg-pick { cursor: pointer; user-select: none; border: 1px solid transparent; }
.tdbreg-pick.on { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.tdbreg-ordering { background: transparent; border: 1px dashed var(--border); }
.tdbreg-gaps .tdbreg-chip { display: inline-block; margin: 1px 3px 1px 0; }
.tdbreg-gapt { margin: 4px 0; font-size: 12px; }
.tdbreg-gaptin { width: 90px; }
.tdbreg-gapbadge { margin-left: 6px; font-size: 10px; padding: 0 5px; border-radius: 4px; border: 1px solid var(--orange); color: var(--orange); cursor: help; }
.tdbreg-meta { font-size: 11px; color: var(--muted); }
.tdbreg-assessed { opacity: 0.85; }
.tdbreg-note { margin-top: 6px; font-size: 11px; color: var(--muted); }
.tdbreg-empty { color: var(--muted); padding: 6px 2px; }
.tdbreg-requests { margin-top: 8px; }
.tdbreg-sub { font-size: 11px; font-weight: 600; color: var(--text-secondary); margin-bottom: 3px; }
.tdbreg-req { font-size: 12px; color: var(--text); }
.tdbreg-state { font-size: 11px; padding: 0 6px; border-radius: 4px; border: 1px solid var(--border); }
.tdbreg-state.pending { color: var(--orange); }
.tdbreg-state.approved { color: var(--green); }
.tdbreg-state.rejected { color: var(--red); }
.tdbreg-request-btn { margin-top: 8px; width: 100%; font-size: 12px; padding: 6px 8px; cursor: pointer; }
.tdbreg-overlay {
  position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.35);
}
.tdbreg-dialog {
  width: min(92vw, 460px); background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 16px 18px;
}
.tdbreg-dialog h3 { margin: 0 0 6px; font-size: 15px; }
.tdbreg-hint { margin: 0 0 10px; font-size: 12px; color: var(--text-secondary); }
.tdbreg-field { display: block; margin-bottom: 10px; font-size: 12px; }
.tdbreg-field span { display: block; margin-bottom: 3px; color: var(--text-secondary); }
.tdbreg-field input, .tdbreg-field textarea { width: 100%; box-sizing: border-box; padding: 6px 8px; font: inherit; }
.tdbreg-msg { min-height: 1.2em; font-size: 12px; color: var(--red); }
.tdbreg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }

/* Hover bridge for the header popovers (TDB + Remote pills). The popover sits
   a few px below its pill (top: calc(100% + 6px)); that strip belongs to
   neither element, so moving the cursor down through it ended :hover and hid
   the popover (a click kept it open via :focus-within, hover alone did not).
   An invisible strip hanging off the pill, as wide as the popover and only
   present while the popover is open, keeps the cursor "on the pill" across
   the gap. It is a pseudo-element of the pill, so it counts as pill hover. */
/* a click on the Remote pill opens the Remote tab (main.js) */
#remote-status { cursor: pointer; }
#tdb-status:hover::after, #tdb-status:focus-within::after,
#remote-status:hover::after, #remote-status:focus-within::after {
  content: '';
  position: absolute; top: 100%; right: 0; height: 12px;
}
#tdb-status:hover::after, #tdb-status:focus-within::after { width: min(92vw, 480px); }
#remote-status:hover::after, #remote-status:focus-within::after { width: min(92vw, 560px); }

/* registered-TDB detail view (inside the TDB popover) */
.tdbreg-listview[hidden], .tdbreg-detailview[hidden] { display: none; }
.tdbreg-back { font-size: 12px; padding: 3px 8px; margin-bottom: 8px; cursor: pointer; }
.tdbreg-dhead { display: flex; align-items: center; gap: 8px; margin-bottom: 2px; }
.tdbreg-notes { margin: 6px 0; font-size: 12px; white-space: pre-wrap; color: var(--text-secondary); }
.tdbreg-chiplist { margin: 6px 0; }
.tdbreg-sys { margin-top: 8px; font-size: 12px; color: var(--text); }
.tdbreg-details { margin-top: 6px; font-size: 12px; }
.tdbreg-details summary { cursor: pointer; color: var(--text-secondary); }
.tdbreg-phhead { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 10px; }
.tdbreg-phfilter { width: 150px; margin: 0; }
.tdbreg-phwrap { max-height: 220px; overflow-y: auto; margin-top: 6px; border: 1px solid var(--border); border-radius: 3px; }
.tdbreg-phtable { width: 100%; border-collapse: collapse; font-size: 11.5px; }
.tdbreg-phtable th { position: sticky; top: 0; background: var(--surface-2); text-align: left; padding: 4px 6px; color: var(--text-secondary); }
.tdbreg-phtable td { padding: 3px 6px; border-top: 1px solid var(--border); vertical-align: top; color: var(--text); }
.tdbreg-phname { font-weight: 600; white-space: nowrap; }
.tdbreg-loadbar { position: sticky; bottom: -10px; margin: 10px -12px -10px; padding: 8px 12px; background: var(--surface); border-top: 1px solid var(--border); }
.tdbreg-load-btn { width: 100%; padding: 7px 8px; cursor: pointer; }
.tdbreg-warn { margin-bottom: 6px; font-size: 12px; color: var(--orange); }
.tdbreg-elwrap { max-height: 190px; }
.tdbreg-eltable td:nth-child(n+2), .tdbreg-eltable th:nth-child(n+2) { text-align: right; }
.tdbreg-flag { color: var(--orange); cursor: help; }

/* Thermo Data tab: element picker (thermo_elements.js) */
.elpick { margin: 4px 0 10px; }
.elpick-title { font-size: 12px; font-weight: 600; color: var(--text-secondary); margin: 10px 0 6px; }
.elpick-grid { display: flex; flex-wrap: wrap; gap: 5px; }
.elpick-chip { min-width: 38px; padding: 4px 8px; border-radius: 3px; cursor: pointer; font-weight: 600;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text); }
.elpick-chip:hover { border-color: var(--accent); }
.elpick-chip.on { background: var(--accent-fill); border-color: var(--accent-fill); color: #fff; }
.elpick-list { display: flex; flex-direction: column; gap: 4px; }
.elpick-row { display: grid; grid-template-columns: 52px auto 44px 82px 1fr auto; align-items: center; gap: 8px;
  padding: 4px 8px; border: 1px solid var(--border); border-radius: 3px; background: var(--surface-2); }
.elpick-idx { font-size: 11px; color: var(--muted); }
.elpick-sym { font-weight: 700; }
.elpick-aw { font-size: 11px; color: var(--muted); }
.elpick-comp input { padding: 3px 6px; }
.elpick-balance { font-size: 12px; color: var(--text-secondary); }
.elpick-balance.bad { color: var(--red); font-weight: 600; }
.elpick-btns button, .elpick-arrows button { padding: 1px 7px; cursor: pointer; }
.elpick-arrows { display: inline-flex; gap: 3px; }
.elpick-summary { margin-top: 10px; font-size: 12px; color: var(--text-secondary); }
.elpick-warn { color: var(--orange); font-size: 12px; cursor: help; }

/* Thermo Data tab: registered-TDB menu (thermo_tdb_menu.js). Own classes (tdbmenu-*), independent of the
   header pill's picker (tdbreg-*). The popover is fixed-positioned by the script, directly under the button. */
.tdbmenu { display: inline-block; }
.tdbmenu-pop {
  display: none; position: fixed; z-index: 60; width: min(92vw, 480px); overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); padding: 10px 12px; text-align: left; white-space: normal; cursor: default;
}
.tdbmenu:hover .tdbmenu-pop, .tdbmenu:focus-within .tdbmenu-pop { display: block; }
.tdbmenu-title { font-weight: 600; color: var(--text); margin-bottom: 6px; }
.tdbmenu-search { width: 100%; box-sizing: border-box; padding: 5px 8px; margin-bottom: 8px; font-size: 12px; }
.tdbmenu-list { display: flex; flex-direction: column; gap: 4px; }
.tdbmenu-item { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; width: 100%; text-align: left;
  padding: 7px 9px; border-radius: 3px; cursor: pointer; background: var(--surface-2); border: 1px solid var(--border); }
.tdbmenu-item:hover { border-color: var(--accent); background: var(--accent-soft); }
.tdbmenu-item.current { border-color: var(--green); }
.tdbmenu-name { font-weight: 600; color: var(--text); }
.tdbmenu-chips { display: flex; flex-wrap: wrap; gap: 3px; margin: 4px 0; }
.tdbmenu-chip { font-size: 11px; padding: 0 6px; border-radius: 4px; background: var(--surface-3); color: var(--text-secondary); }
.tdbmenu-meta { font-size: 11px; color: var(--muted); }
.tdbmenu-note { margin-top: 6px; font-size: 11px; color: var(--muted); }
.tdbmenu-empty { color: var(--muted); padding: 6px 2px; }
.tdbmenu-back { font-size: 12px; padding: 3px 8px; margin-bottom: 8px; cursor: pointer; }
.tdbmenu-head { display: flex; align-items: center; gap: 8px; margin-bottom: 2px; }
.tdbmenu-badge { font-size: 11px; padding: 0 6px; border-radius: 4px; border: 1px solid var(--border); color: var(--green); }
.tdbmenu-notes { margin: 6px 0; font-size: 12px; white-space: pre-wrap; color: var(--text-secondary); }
.tdbmenu-sub { font-size: 11px; font-weight: 600; color: var(--text-secondary); margin-top: 10px; }
.tdbmenu-scroll { overflow-y: auto; margin-top: 6px; border: 1px solid var(--border); border-radius: 3px; }
.tdbmenu-table { width: 100%; border-collapse: collapse; font-size: 11.5px; }
.tdbmenu-table th { position: sticky; top: 0; background: var(--surface-2); text-align: left; padding: 4px 6px; color: var(--text-secondary); }
.tdbmenu-table td { padding: 3px 6px; border-top: 1px solid var(--border); vertical-align: top; color: var(--text); }
.tdbmenu-num td:nth-child(n+2), .tdbmenu-num th:nth-child(n+2) { text-align: right; }
.tdbmenu-strong { font-weight: 600; white-space: nowrap; }
.tdbmenu-flag { color: var(--orange); cursor: help; }
.tdbmenu-sys { margin-top: 8px; font-size: 12px; color: var(--text); }
.tdbmenu-fold { margin-top: 6px; font-size: 12px; }
.tdbmenu-fold summary { cursor: pointer; color: var(--text-secondary); }
.tdbmenu-phhead { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 10px; }
.tdbmenu-phfilter { width: 150px; margin: 0; }
.tdbmenu-loadbar { position: sticky; bottom: -10px; margin: 10px -12px -10px; padding: 8px 12px; background: var(--surface); border-top: 1px solid var(--border); }
.tdbmenu-warn { margin-bottom: 6px; font-size: 12px; color: var(--orange); }
.tdbmenu-load { width: 100%; padding: 7px 8px; cursor: pointer; }

/* Thermo Data tab: registration prompt after a TDB has loaded (thermo_register_notice.js) */
.regnote:empty { display: none; }
.regnote { margin-top: 8px; }
.regnote-line { font-size: 12px; color: var(--text-secondary); display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.regnote-btn { font-size: 12px; padding: 3px 10px; cursor: pointer; }
.regnote-overlay { position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,0.35); }
.regnote-dialog { width: min(92vw, 460px); background: var(--surface); color: var(--text); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 16px 18px; }
.regnote-dialog h3 { margin: 0 0 6px; font-size: 15px; }
.regnote-hint { margin: 0 0 10px; font-size: 12px; color: var(--text-secondary); }
.regnote-field { display: block; margin-bottom: 10px; font-size: 12px; }
.regnote-field span { display: block; margin-bottom: 3px; color: var(--text-secondary); }
.regnote-field input, .regnote-field textarea { width: 100%; box-sizing: border-box; padding: 6px 8px; font: inherit; }
.regnote-msg { min-height: 1.2em; font-size: 12px; color: var(--red); }
.regnote-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }

/* Thermo Data tab: phase picker (thermo_phases.js) */
.phpick-title { font-size: 12px; font-weight: 600; color: var(--text-secondary); margin: 2px 0 6px; }
.phpick-warn { color: var(--orange); font-size: 12px; margin-bottom: 6px; }
.phpick-bar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 6px; }
.phpick-filter { flex: 1; min-width: 140px; padding: 4px 8px; font-size: 12px; }
.phpick-bar button { padding: 3px 9px; cursor: pointer; font-size: 12px; }
.phpick-rows { max-height: 300px; overflow-y: auto; border: 1px solid var(--border); border-radius: 3px; }
.phpick-row { display: grid; grid-template-columns: 20px minmax(90px, 140px) 64px 1fr 96px; align-items: center; gap: 8px;
  padding: 3px 8px; border-top: 1px solid var(--border); cursor: pointer; font-size: 12px; }
.phpick-row:first-child { border-top: none; }
.phpick-row:hover { background: var(--accent-soft); }
.phpick-name { font-weight: 600; color: var(--text); }
.phpick-tag { font-size: 10px; padding: 0 6px; border-radius: 4px; border: 1px solid var(--border); }
.phpick-tag.stable { color: var(--green); border-color: var(--green); }
.phpick-tag.old { color: var(--muted); }
.phpick-model { color: var(--text-secondary); font-family: var(--font-mono); font-size: 11px; overflow-wrap: anywhere; }
.phpick-range { color: var(--muted); font-size: 11px; text-align: right; white-space: nowrap; }
.phpick-range.out { color: var(--orange); cursor: help; }
.phpick-count { margin-top: 6px; font-size: 12px; color: var(--text-secondary); }
.phpick-empty { padding: 8px; color: var(--muted); font-size: 12px; }
.phpick-apply { margin-top: 8px; padding: 5px 12px; cursor: pointer; }
.phpick-sec { position: sticky; top: 0; z-index: 1; padding: 3px 8px; font-size: 11px; font-weight: 600;
  color: var(--text-secondary); background: var(--surface-3); border-top: 1px solid var(--border); }
.phpick-sec.picked { color: var(--accent); background: var(--accent-soft); border-top: none; }
.phpick-tag.notstable { color: var(--orange); border-color: var(--orange); }
.phpick-notstable { margin-top: 4px; font-size: 12px; color: var(--orange); }
.phpick-notstable[hidden] { display: none; }
.phpick-liquid { margin: 4px 0 6px; font-size: 12px; color: var(--text-secondary); }
.phpick-liquid select { padding: 2px 6px; font-size: 12px; max-width: 260px; }

/* Elements tab: element selection + initial composition (elements_picker.js) */
.elsel-title { font-size: 12px; font-weight: 600; color: var(--text-secondary); margin: 10px 0 6px; }
.elsel-title:first-child { margin-top: 0; }
.elsel-grid { display: flex; flex-wrap: wrap; gap: 5px; }
.elsel-chip { min-width: 38px; padding: 4px 8px; border-radius: 3px; cursor: pointer; font-weight: 600;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text); }
.elsel-chip:hover { border-color: var(--accent); }
.elsel-chip.on { background: var(--accent-fill); border-color: var(--accent-fill); color: #fff; }
.elsel-list { display: flex; flex-direction: column; gap: 4px; }
.elsel-row { display: grid; grid-template-columns: 40px auto 44px 82px 1fr auto; align-items: center; gap: 8px;
  padding: 4px 8px; border: 1px solid var(--border); border-radius: 3px; background: var(--surface-2); }
.elsel-idx { font-size: 11px; color: var(--muted); }
.elsel-sym { font-weight: 700; }
.elsel-aw { font-size: 11px; color: var(--muted); }
.elsel-tag { font-size: 11px; color: var(--accent); }
.elsel-tag.bad { color: var(--red); font-weight: 600; }
.elsel-btns button, .elsel-arrows button { padding: 1px 7px; cursor: pointer; }
.elsel-arrows { display: inline-flex; gap: 3px; }
.elsel-other { display: flex; gap: 6px; align-items: center; margin-top: 8px; }
.elsel-warn { color: var(--orange); font-size: 12px; margin-top: 8px; cursor: help; }

/* Phases tab: phase selection (phases_picker.js) */
.phsel-title { font-size: 12px; font-weight: 600; color: var(--text-secondary); margin: 10px 0 6px; }
.phsel-title:first-child { margin-top: 0; }
.phsel-filter { width: 100%; box-sizing: border-box; padding: 4px 8px; margin-bottom: 6px; font-size: 12px; }
.phsel-grid { display: flex; flex-wrap: wrap; gap: 5px; max-height: 170px; overflow-y: auto; }
.phsel-chip { padding: 3px 9px; border-radius: 3px; cursor: pointer; font-size: 12px; font-weight: 600;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text); }
.phsel-chip:hover { border-color: var(--accent); }
.phsel-chip.on { background: var(--accent-fill); border-color: var(--accent-fill); color: #fff; }
.phsel-list { display: flex; flex-direction: column; gap: 4px; }
.phsel-row { display: grid; grid-template-columns: 38px auto 1fr auto auto auto; align-items: center; gap: 2px 8px;
  padding: 4px 8px; border: 1px solid var(--border); border-radius: 3px; background: var(--surface-2); font-size: 12px; }
.phsel-idx { font-size: 11px; color: var(--muted); }
.phsel-name { font-weight: 700; }
.phsel-model { color: var(--text-secondary); font-family: var(--font-mono); font-size: 11px; overflow-wrap: anywhere; }
.phsel-range { color: var(--muted); font-size: 11px; text-align: right; white-space: nowrap; }
.phsel-tag { font-size: 11px; color: var(--accent); white-space: nowrap; }
.phsel-tag.bad { color: var(--red); font-weight: 600; }
.phsel-tag.warn { color: var(--orange); }
.phsel-btns button, .phsel-arrows button { padding: 1px 7px; cursor: pointer; font-size: 12px; }
.phsel-other { display: flex; gap: 6px; align-items: center; margin-top: 8px; }
.phsel-warn { color: var(--orange); font-size: 12px; margin-top: 8px; }
.phsel-matrix { margin-top: 10px; font-size: 12px; color: var(--text-secondary); }
.phsel-matrix select { padding: 2px 6px; font-size: 12px; }
.phsel-idx { grid-area: 1 / 1; }
.phsel-arrows { grid-area: 1 / 2; display: inline-flex; gap: 3px; }
.phsel-name { grid-area: 1 / 3; }
.phsel-range { grid-area: 1 / 4; }
.phsel-tag { grid-area: 1 / 5; }
.phsel-btns { grid-area: 1 / 6; }
.phsel-model { grid-area: 2 / 3 / 3 / -1; }
.phsel-model:empty { display: none; }
.phsel-btns button.is-matrix { background: var(--accent-fill); border-color: var(--accent-fill); color: #fff; font-weight: 600; }

/* Tools > Estimate Time Steps (timestep_estimator.js) */
.tsest-overlay { position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,0.35); }
.tsest-dialog { width: min(96vw, 940px); max-height: 92vh; overflow-y: auto; background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 16px 20px; }
.tsest-head { display: flex; align-items: center; justify-content: space-between; }
.tsest-head h3 { margin: 0; font-size: 16px; }
.tsest-hint { margin: 6px 0 10px; font-size: 12px; color: var(--text-secondary); }
.tsest-form { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px 14px; margin-bottom: 8px; }
.tsest-field { display: flex; flex-direction: column; gap: 2px; font-size: 12px; }
.tsest-field.wide { grid-column: span 2; }
.tsest-field span { color: var(--text-secondary); }
.tsest-field input, .tsest-field select { padding: 4px 6px; font: inherit; width: 100%; box-sizing: border-box; }
.tsest-field small { color: var(--muted); font-size: 11px; }
.tsest-msg { color: var(--red); font-size: 13px; margin: 8px 0; }
.tsest-msg:empty { display: none; }
.tsest-summary { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 4px 18px; margin: 10px 0; font-size: 13px; }
.tsest-kv { display: flex; justify-content: space-between; gap: 10px; border-bottom: 1px solid var(--border); padding: 2px 0; }
.tsest-kv span { color: var(--text-secondary); }
.tsest-notes { grid-column: 1 / -1; font-size: 11.5px; color: var(--muted); margin-top: 4px; }
.tsest-svg { width: 100%; height: auto; display: block; }
.tsest-grid { stroke: var(--border); stroke-width: 1; }
.tsest-axis { stroke: var(--text-secondary); stroke-width: 1; }
.tsest-tick { fill: var(--text-secondary); font-size: 11px; }
.tsest-tick.temp { fill: var(--muted); font-size: 10px; }
.tsest-label { fill: var(--text-secondary); font-size: 12px; }
.tsest-line { fill: none; stroke: var(--accent); stroke-width: 2.2; stroke-linejoin: round; }
.tsest-dot { fill: var(--accent); }
.tsest-end { fill: var(--text); font-size: 12px; font-weight: 600; }
.tsest-sub { font-size: 12px; font-weight: 600; color: var(--text-secondary); margin: 10px 0 4px; }
.tsest-grid-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.tsest-grid-table th { text-align: left; padding: 3px 6px; color: var(--text-secondary); background: var(--surface-2); }
.tsest-grid-table td { padding: 3px 6px; border-top: 1px solid var(--border); }
.tsest-grid-table tr.dominant td { color: var(--accent); font-weight: 600; }

/* Diffusion tab: diffusivities in effect (diffusivity_view.js) */
.dview-intro { font-size: 12px; color: var(--text-secondary); margin-bottom: 6px; }
.dview-temp { font-size: 12px; color: var(--text-secondary); margin: 6px 0; }
.dview-temp input { padding: 2px 6px; }
.dview-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.dview-table th { text-align: left; padding: 4px 8px; background: var(--surface-2); color: var(--text-secondary); font-weight: 600; }
.dview-table td { padding: 3px 8px; border-top: 1px solid var(--border); }
.dview-strong { font-weight: 700; }
.dview-default { color: var(--muted); }
.dview-entered { color: var(--accent); font-weight: 600; cursor: help; }
.dview-over td { background: var(--accent-soft); }
.dview-missing td { color: var(--muted); }
.dview-notes { margin-top: 8px; font-size: 11.5px; color: var(--muted); }

/* Elements tab, merged block: the middle cell of a row (wt% input, or the solvent's balance) */
.elsel-mid { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; font-size: 12px; min-width: 0; }
.elsel-mid input { padding: 3px 6px; }
.elsel-zv { display: inline-flex; align-items: center; gap: 3px; margin-left: 6px; font-size: 11px; color: var(--muted); cursor: pointer; }
.elsel-mid .elsel-zv input { padding: 0; margin: 0; }
.elsel-balance { color: var(--text-secondary); }
.elsel-balance.bad { color: var(--red); font-weight: 600; }

/* Nucleation tab: parents and sites (nucleation_ext_ui.js) */
.nucl-line { margin-bottom: 6px; }
.nucl-group { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; font-size: 12px; margin: 2px 0; }
.nucl-label { color: var(--text-secondary); min-width: 54px; }
.nucl-check { cursor: pointer; }

/* virtual (non-thermodynamic) phase in the Phases box */
.phsel-chip.virtual { border-style: dashed; color: #7a4fc7; }
.phsel-chip.virtual.on { background: #7a4fc7; border-color: #7a4fc7; color: #fff; }
.phsel-row.virtual { border-style: dashed; border-color: #7a4fc7; }
.phsel-row.virtual .phsel-name { color: #7a4fc7; }
.phsel-tag.virtual { color: #7a4fc7; font-weight: 600; }

/* required_marks.js: red * on the label, red outline on a required input that is still blank / not a number */
.req::after { content: " *"; color: var(--red); font-weight: 700; }
.req-missing { border-color: var(--red) !important; box-shadow: 0 0 0 1px var(--red); }
.req-legend { font-size: 12px; color: var(--muted); margin: 0 0 8px 2px; }
.req-legend .req-star { color: var(--red); font-weight: 700; }   /* only the star: ::first-letter took "* r" */

/* Phases box: the optional Liquid phase row while auto-detection is on */
.phsel-auto { color: var(--muted); }
.phsel-matrix .phsel-auto + button { margin-left: 8px; font-size: 12px; padding: 1px 8px; }

/* vapor_preview_ui.js */
.vprev-invert { display: block; margin: 6px 0; font-size: 13px; cursor: pointer; }
.vprev-group { font-size: 12px; color: var(--muted); margin: 0 4px 0 10px; }
.vprev-group:first-child { margin-left: 0; }

/* restart_dialog.js */
.rsd-msg { margin: 6px 0; }
.rsd-msg.rsd-bad { color: var(--red); }
.rsd-table { border-collapse: collapse; font-size: 12.5px; margin: 6px 0; width: 100%; }
.rsd-table th, .rsd-table td { border-bottom: 1px solid var(--border); padding: 4px 6px; text-align: left; vertical-align: top; }
.rsd-table tr.rsd-bad td { color: var(--red); }
.rsd-key { font-family: var(--font-mono); white-space: nowrap; }
.rsd-buttons { display: flex; gap: 8px; margin-top: 10px; }
.rsd-list { display: flex; flex-direction: column; gap: 4px; margin: 4px 0 8px; }
.rsd-snap { display: flex; gap: 8px; align-items: baseline; cursor: pointer; }
.rsd-snap-label { font-family: var(--font-mono); min-width: 280px; }
.rsd-snap-detail { color: var(--muted); font-size: 12.5px; }
.rsd-msg.rsd-warn { color: var(--orange); }

/* archive_dialog.js */
.arc-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 4px 0; border-bottom: 1px solid var(--border); }
.arc-name { font-family: var(--font-mono); min-width: 220px; }
.arc-detail { color: var(--muted); font-size: 12.5px; flex: 1 1 260px; }
.arc-msg { font-size: 12.5px; }
.arc-bad { color: var(--red); }

/* snapshot_output.js */
.sov-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 1000; display: flex; align-items: center; justify-content: center; }
.sov-dialog { background: var(--surface, #fff); width: min(1500px, 96vw); height: min(940px, 94vh); border-radius: 3px; display: flex; flex-direction: column; overflow: hidden; }
.sov-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; border-bottom: 1px solid var(--border); font-weight: 600; }
.sov-close { font-size: 20px; line-height: 1; padding: 2px 10px; }
.sov-body { flex: 1; display: flex; min-height: 0; }
.sov-side { width: 300px; flex: none; overflow-y: auto; padding: 10px; border-right: 1px solid var(--border); }
.sov-view { flex: 1; overflow: auto; padding: 10px; min-width: 0; }
.sov-item { padding: 8px; border-bottom: 1px solid var(--border); }
.sov-item.on { background: rgba(70,140,225,0.10); }
.sov-name { font-family: var(--font-mono); font-weight: 600; }
.sov-detail { color: var(--muted); font-size: 12px; margin: 2px 0 4px; }
.sov-status { font-size: 12px; margin-top: 4px; }
.sov-bad { color: var(--red); }
.sov-caption { font-size: 13px; margin-bottom: 6px; }
@media (max-width: 800px) { .sov-body { flex-direction: column; } .sov-side { width: auto; max-height: 35vh; border-right: none; border-bottom: 1px solid var(--border); } }
.arc-allrow { margin: 6px 0; }
.arc-armed { background: var(--red) !important; color: #fff !important; border-color: var(--red) !important; }
/* Thermo Data: Composition Set Check results */
.cs-result { margin-top: 6px; }
.cs-head { margin: 8px 0 4px; font-size: 12.5px; font-weight: 600; }
.cs-ok { font-size: 12px; color: var(--green); }
.cs-warn { font-size: 12px; color: var(--orange); }
.cs-wrap { max-height: 320px; overflow: auto; border: 1px solid var(--border); border-radius: 3px; }
.cs-table { width: 100%; border-collapse: collapse; font-size: 11.5px; }
.cs-table th { position: sticky; top: 0; background: var(--surface-2); text-align: left; padding: 4px 6px; color: var(--text-secondary); white-space: nowrap; }
.cs-table td { padding: 3px 6px; border-top: 1px solid var(--border); vertical-align: top; color: var(--text); }
.cs-table td.cs-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cs-table tr.cs-first td { border-top: 1px solid var(--text-secondary); }
.cs-phase { font-weight: 600; white-space: nowrap; }
.cs-tag { margin-left: 4px; font-size: 10px; padding: 0 5px; border-radius: 4px; border: 1px solid var(--border); color: var(--text-secondary); white-space: nowrap; }
.cs-tag.stable { border-color: var(--orange); color: var(--orange); }
.cs-region { color: var(--text-secondary); }
.cs-table th.cs-num { text-align: right; }

/* Anisotropy tab, Crystal Symmetry per Phase: one card per phase (tabs_advanced.js renderNfold) */
.nfold-card { border: 1px solid var(--border-strong); border-radius: 6px; background: var(--surface); margin: 0 0 6px; overflow: hidden; }
.nfold-card.iso { background: transparent; border-color: var(--border); }
.nfold-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; padding: 5px 8px; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.nfold-head select { max-width: 160px; }
.nfold-head button { padding: 3px 8px; font-size: 12px; }
.nfold-sep { width: 1px; align-self: stretch; background: var(--border); margin: 0 4px; }
.nfold-card.iso .nfold-head { background: transparent; border-bottom: none; }
.nfold-phase { font-weight: 700; font-size: 14px; }
.nfold-idx { font-size: 11px; color: var(--muted); margin-right: 6px; }
.nfold-label { font-size: 12px; color: var(--text-secondary); }
.nfold-badge { margin-left: auto; padding: 2px 10px; border-radius: 4px; font-size: 12px; font-weight: 700; background: var(--accent-fill); color: #fff; }
.nfold-badge.iso { background: var(--surface-3); color: var(--muted); font-weight: 600; }
.nfold-body { padding: 4px 8px 6px; display: flex; flex-direction: column; gap: 4px; }
/* Energy / Mobility: a caption column and the inputs beside it */
.nfold-line { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 8px; align-items: start; }
.nfold-line + .nfold-line { border-top: 1px solid var(--border); padding-top: 4px; }
.nfold-line-title { font-size: 12px; font-weight: 600; color: var(--text-secondary); padding-top: 6px; }
.nfold-line-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.nfold-scalars { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; }
.nfold-scalars .prow-ax input[type=text] { width: 92px; }
.nfold-list-head { display: flex; align-items: center; gap: 8px; }
.nfold-list-grid { display: grid; grid-template-columns: repeat(3, 46px) 72px 72px 28px; gap: 3px 6px; align-items: center; }
.nfold-list-grid input[type=text] { width: 100%; box-sizing: border-box; }
.nfold-list-h { font-size: 11px; color: var(--muted); font-weight: 600; }
.nfold-sub { margin: 8px 0 0; padding: 6px 10px 6px 10px; background: var(--surface); border: 1px solid var(--border); border-radius: 6px; }
.nfold-sub-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-secondary); margin-bottom: 4px; }
.nfold-sub .field-row { margin-left: 8px; }
/* ICG temperature bar above the drawing (icg_module.js buildSettings) */
.icg-blockbar { display: flex; flex-direction: column; gap: 4px; padding: 6px 8px; margin: 2px 0 8px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 12.5px; }
.icg-bar-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 18px; }
.icg-bar-item { display: inline-flex; align-items: center; gap: 6px; }
.icg-bar-label { font-weight: 600; }
.icg-blockbar input.icg-tstart { width: 80px; padding: 2px 5px; font-size: 12.5px; }
.icg-blockbar input.icg-missing { border-color: #d93025; box-shadow: 0 0 0 1px #d93025 inset; }
.icg-dt { color: var(--text-secondary); font-size: 12px; }

/* ------------------------------------------------- Temperature Profile Generator (tpg_module.js) */
.tpg-tools { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 4px; }
.tpg-tools button { padding: 3px 9px; font-size: 12.5px; }
.tpg-sep { width: 1px; height: 20px; background: var(--border); margin: 0 4px; }
.tpg-chips { display: inline-flex; flex-wrap: wrap; gap: 3px; margin-left: 8px; }
.tpg-chip { border: 1px solid var(--border); background: var(--surface); border-radius: 4px; padding: 1px 9px !important; font-size: 12px; box-shadow: inset 3px 0 0 var(--chip); }
.tpg-chip.on { border-color: var(--chip); color: var(--text); font-weight: 650; background: var(--accent-soft); }
.tpg-segs { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.tpg-seg { border: none; background: var(--surface); padding: 2px 10px; font-size: 12.5px; cursor: pointer; }
.tpg-seg.on { background: var(--accent-fill); color: #fff; }
.icg-blockbar input.tpg-n { width: 56px; }
.tpg-charts { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.tpg-chart { position: relative; }
.tpg-svg { display: block; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); outline: none; user-select: none; touch-action: none; }
.tpg-svg:focus { border-color: var(--accent); }
.tpg-svg .tpg-plot { fill: var(--surface); }
.tpg-svg .tpg-band { fill: rgba(217, 48, 37, 0.07); }
.tpg-svg .tpg-grid { stroke: var(--border); stroke-width: 1; }
.tpg-svg .tpg-tick { font-size: 10.5px; fill: var(--text-secondary); font-variant-numeric: tabular-nums; }
.tpg-svg .tpg-axis { font-size: 11.5px; fill: var(--text-secondary); }
.tpg-svg .tpg-line { fill: none; stroke-width: 1.6; opacity: 0.55; }
.tpg-svg .tpg-line.active { stroke-width: 2.2; opacity: 1; }
.tpg-svg .tpg-hit { fill: none; stroke: transparent; stroke-width: 10; cursor: pointer; }
.tpg-svg .tpg-pt { fill: var(--surface); stroke-width: 2; cursor: move; }
.tpg-svg .tpg-pt.sel { fill: var(--accent); }
.tpg-svg .tpg-ref { stroke-width: 1.2; fill: none; }
.tpg-svg .tpg-ref-label { font-size: 10.5px; paint-order: stroke; stroke: var(--surface); stroke-width: 3px; }
.tpg-svg .tpg-rate { font-size: 10.5px; fill: var(--text-secondary); paint-order: stroke; stroke: var(--surface); stroke-width: 3px; pointer-events: none; }
.tpg-svg .tpg-mark { stroke: var(--surface); stroke-width: 1.5; }
.tpg-map { display: block; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.tpg-map-legend { margin-top: 2px; }
.tpg-help { font-size: 11.5px; }
.tpg-side { flex: 0 0 270px; min-width: 0; }
.tpg-f { display: flex; align-items: center; gap: 6px; font-size: 12.5px; }
.tpg-f > span:first-child { min-width: 78px; color: var(--text-secondary); }
.tpg-f input[type=text] { width: 90px; padding: 2px 5px; font-size: 12.5px; }
.tpg-table-box { min-width: 0; }
.tpg-table-host { overflow: auto; max-height: 320px; max-width: 100%; }
.tpg-table { margin: 0; }
.tpg-table td { padding: 1px 4px 1px 0; }
.tpg-table input { width: 74px; padding: 1px 4px; font-size: 12px; }
.tpg-table tr.sel td { background: var(--accent-soft); }
.tpg-summary { display: flex; flex-direction: column; gap: 2px; margin: 6px 0; }
.tpg-paste { width: 100%; font-family: var(--font-mono); font-size: 12px; }
.tpg-svg .tpg-zoombox { fill: rgba(42, 111, 219, 0.10); stroke: var(--accent); stroke-width: 1; stroke-dasharray: 4 3; pointer-events: none; }
.tpg-reset { position: absolute; top: 8px; left: 66px; z-index: 5; padding: 2px 9px; font-size: 12px; }
/* 2D Analyzer profiles (step 2) */
.an2d-tools { display: inline-flex; gap: 2px; }
.an2d-hint { font-size: 12px; color: var(--text-secondary); min-height: 16px; }
.an2d-center { flex: 1 1 auto; min-width: 0; min-height: 0; display: flex; flex-direction: column; gap: 8px; }
.an2d-center > .an2d-view { flex: 3 1 0; }
.an2d-plots { flex: 2 1 0; min-height: 170px; display: flex; flex-direction: column; gap: 4px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 6px 8px; }
.an2d-plots-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 12px; }
.an2d-plots-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
canvas.an2d-plot { display: block; width: 100%; height: 132px; }
.an2d-legend { display: inline-flex; align-items: center; gap: 4px; }
.an2d-swatch { display: inline-block; width: 10px; height: 10px; border-radius: 2px; flex: 0 0 auto; }
.an2d-prof { display: flex; align-items: center; gap: 5px; padding: 3px 4px; border-radius: var(--radius-sm); cursor: pointer;
  white-space: nowrap; font-size: 12px; }
.an2d-prof .btn-sm { padding: 1px 6px; }
.an2d-prof:hover { background: var(--surface-2); }
.an2d-prof.an2d-prof-sel { background: var(--accent-soft); }
.an2d-prof-name { font-weight: 600; }
.an2d-prof-len { margin-left: auto; font-variant-numeric: tabular-nums; }

/* Publisher (publisher_module.js) */
#publisher-panel { display: flex; flex-direction: column; width: 100%; box-sizing: border-box; height: 100%; min-height: 0; padding: 10px 12px; gap: 8px; outline: none; }
.pub-head { display: flex; align-items: baseline; gap: 10px; }
.pub-title { font-weight: 650; font-size: 15px; }
.pub-status { color: var(--text-secondary); font-size: 12.5px; }
.pub-badge { font-size: 11.5px; padding: 1px 8px; border-radius: 4px; background: color-mix(in srgb, var(--orange) 16%, transparent); color: var(--orange); font-weight: 600; }
.pub-badge.pub-badge-final { background: color-mix(in srgb, var(--green) 16%, transparent); color: var(--green); }
.pub-toolbar { display: flex; align-items: center; gap: 10px; font-size: 13px; flex-wrap: wrap; }
.pub-toolbar .pub-hint { flex: 1 1 120px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pub-main { position: relative; flex: 1 1 auto; min-height: 0; display: flex; gap: 10px; }
.pub-preview { flex: 1 1 auto; min-width: 0; overflow: auto; background: var(--surface-3); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-sizing: border-box; }
.pub-preview-host { display: flex; justify-content: center; }
.pub-canvas { box-shadow: var(--shadow-md); cursor: pointer; background: #fff; }
.pub-side { flex: 0 0 290px; min-width: 0; overflow-y: auto; font-size: 12.5px; display: flex; flex-direction: column; gap: 6px; }
.pub-tabs { display: flex; gap: 4px; position: sticky; top: 0; background: var(--surface); padding-bottom: 4px; z-index: 1; }
.pub-panel { display: flex; flex-direction: column; gap: 4px; }
.pub-sec { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 4px 8px; }
.pub-sec > summary { cursor: pointer; font-weight: 600; padding: 2px 0; }
.pub-row { display: flex; align-items: center; gap: 6px; padding: 2px 0; }
.pub-key { flex: 0 0 82px; color: var(--text-secondary); }
.pub-val { display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; min-width: 0; }
.pub-val select { max-width: 170px; }
.pub-val input[type=text] { width: 150px; }
.pub-val input.pub-name { width: 110px; }
.pub-val input[type=range] { width: 110px; }
.pub-val input[type=color] { width: 28px; height: 20px; padding: 0; border: 1px solid var(--border); }
.pub-num { width: 58px; }
.pub-check { display: inline-flex; align-items: center; gap: 3px; }
.pub-muted { color: var(--text-secondary); font-size: 12px; }
.pub-err { color: var(--red); font-size: 12px; }
.pub-actions { display: flex; gap: 6px; justify-content: flex-end; padding-top: 4px; }
.pub-slot-title { font-size: 13px; padding: 2px 0 4px; }
.pub-layer { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 4px 8px; }
.pub-layer-head { display: flex; align-items: center; gap: 6px; padding-bottom: 2px; }
.pub-kind { font-size: 11px; font-weight: 650; padding: 0 6px; border-radius: 4px; background: var(--accent-soft); color: var(--accent); }
.pub-src { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pub-x { padding: 0 6px; line-height: 1.3; }
.pub-export { position: absolute; right: 0; top: 0; width: 380px; max-height: 100%; overflow-y: auto; background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 10px 12px; font-size: 12.5px; z-index: 3;
  display: flex; flex-direction: column; gap: 4px; }
.pub-export-head { display: flex; justify-content: space-between; align-items: center; font-size: 14px; }
.pub-side-title { font-weight: 600; margin-top: 4px; }
.pub-checks { margin: 0; padding-left: 18px; }
.pub-checks li { padding: 1px 0; }
.pub-check-ok { color: var(--green); }
.pub-check-warn { color: var(--orange); }
.pub-check-bad { color: var(--red); font-weight: 600; }
.pub-check-info { color: var(--text-secondary); }
.pub-conn .pub-conn-sel { max-width: 230px; }
.pub-conn .pub-conn-base { width: 220px; }
.pub-field { display: flex; flex-direction: column; gap: 2px; color: var(--text-secondary); }
.pub-wide { width: 100%; box-sizing: border-box; }
.pub-thumb img { max-width: 100%; border: 1px solid var(--border); background: #fff; }
.pub-export.pub-list { width: 560px; }
.pub-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.pub-card { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px; display: flex; flex-direction: column; gap: 4px; background: var(--surface); }
.pub-card img { width: 100%; aspect-ratio: 4 / 3; object-fit: contain; background: #fff; border: 1px solid var(--border); }
.pub-card-name { font-weight: 650; }
.pub-card-kw { display: flex; flex-wrap: wrap; gap: 3px; }
.pub-chip { font-size: 11px; padding: 0 6px; border-radius: 4px; background: var(--accent-soft); color: var(--accent); }
a.pub-link-btn { text-decoration: none; color: var(--text); border: 1px solid var(--border-strong); border-radius: 6px; display: inline-flex; align-items: center; }
.pub-tpl-box { display: flex; justify-content: center; align-items: center; min-height: 110px; background: var(--surface-2); border: 1px solid var(--border); }
.pub-tpl-preview { display: block; }
.pub-case-list { display: flex; flex-direction: column; gap: 2px; max-height: 140px; overflow-y: auto; }
.pub-case-box { white-space: nowrap; }
.pub-drag-item { cursor: grab; }
.pub-drag-row { white-space: nowrap; padding: 1px 4px; border-radius: 3px; }
.pub-drag-row:hover, .pub-case-box.pub-drag-item:hover { background: var(--surface-3); }
.pub-preview { position: relative; }
.pub-slot-mark { position: absolute; pointer-events: none; box-sizing: border-box; border-radius: 3px; display: none; z-index: 2; }
.pub-slot-drop { border: 3px dashed #2a6fdb; background: rgba(42, 111, 219, 0.12); }
.pub-slot-retry { z-index: 1; }
.pub-retry-card { position: absolute; left: 50%; top: 50%; transform: translate(-50%, 10px); pointer-events: auto; display: flex; align-items: center; gap: 8px;
  white-space: nowrap; font-size: 12px; color: var(--text-secondary); background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 3px 4px 3px 10px; }
.pub-retry-btn { padding: 1px 10px; font-size: 12px; }
.pub-legend-item { display: inline-flex; align-items: center; gap: 3px; margin-right: 8px; }
.pub-movie-slots { display: inline-flex; flex-wrap: wrap; gap: 4px 10px; }
.pub-movie-bar { margin-top: 4px; }
.pub-doc-tabs { display: inline-flex; gap: 2px; }

/* Scale Estimator (scale_module.js) */
#scale-panel { display: flex; flex-direction: column; width: 100%; box-sizing: border-box; height: 100%; min-height: 0; padding: 10px 12px; gap: 8px; outline: none; overflow-y: auto; font-size: 13px; }
.sce-head { display: flex; align-items: baseline; gap: 10px; }
.sce-title { font-weight: 650; font-size: 15px; }
.sce-status { color: var(--text-secondary); font-size: 12.5px; }
.sce-body { display: flex; flex-direction: column; gap: 10px; }
.sce-controls { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; }
.sce-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 10px; }
.sce-sec { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 6px 10px; background: var(--surface); }
.sce-sec > summary { cursor: pointer; font-weight: 600; }
.sce-sec-title { font-weight: 650; margin-bottom: 4px; }
.sce-kv { display: flex; justify-content: space-between; gap: 10px; padding: 2px 0; border-bottom: 1px solid var(--border); }
.sce-kv:last-child { border-bottom: none; }
.sce-k { color: var(--text-secondary); }
.sce-v { font-variant-numeric: tabular-nums; text-align: right; }
.sce-table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
.sce-table td, .sce-table th { padding: 3px 8px; border-bottom: 1px solid var(--border); text-align: right; }
.sce-table td:first-child, .sce-table th:first-child { text-align: left; color: var(--text-secondary); }
.sce-notes { margin: 6px 0 0; padding-left: 18px; }
.sce-notes li { padding: 1px 0; }
.sce-ok { color: var(--green); }
.sce-warn { color: var(--orange); }
.sce-bad { color: var(--red); font-weight: 600; }
.sce-info { color: var(--text-secondary); }
.sce-muted { color: var(--text-secondary); font-size: 12.5px; }
.sce-err { color: var(--red); }
.sce-actions { display: flex; gap: 6px; justify-content: flex-end; margin-top: 6px; }

/* Work History opened at an issue report's moment (replay.js markFocus) */
.replay-row.replay-focus { outline: 2px solid var(--accent); }
.replay-focus-marker { color: var(--accent); font-weight: 600; }

/* Publisher "Final image…" (publisher_module.js openFinalView): the exported
   raster at its own size, over the whole window */
.pub-final {
  position: fixed; inset: 16px; z-index: 800; display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius);
  box-shadow: 0 8px 28px rgba(0,0,0,0.3);
}
.pub-final-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--border); }
.pub-final-tools { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.pub-final > .pub-muted:not(:empty) { padding: 4px 12px 0; }
.pub-final-main { flex: 1; display: flex; min-height: 0; }
.pub-final-body { flex: 1; min-width: 0; overflow: auto; padding: 12px; background: repeating-conic-gradient(#e6e6e6 0% 25%, #f6f6f6 0% 50%) 0 0 / 16px 16px; }
.pub-final-side { width: 300px; flex: none; overflow: auto; padding: 10px 12px; border-left: 1px solid var(--border); }
.pub-final-stage { position: relative; margin: 0 auto; box-shadow: 0 1px 6px rgba(0,0,0,0.25); }
.pub-final-img { display: block; width: 100%; height: auto; }
.pub-final-sel { position: absolute; border: 2px dashed #e0752c; pointer-events: none; box-sizing: border-box; }
.pub-nudge { min-width: 28px; }
.pub-final-side .pub-num { width: 66px; }
.pub-stepper { display: inline-flex; align-items: center; gap: 3px; }

/* remote_queue.js: what the remote is answering now, beside the Remote pill */
.remote-loading-line { align-self: center; font-size: 12px; color: var(--text-secondary); white-space: nowrap;
  width: 340px; overflow: hidden; text-overflow: ellipsis; cursor: help; }   /* fixed: the header's buttons don't move as it changes */
/* Publisher connector: the figure's list of cases */
.pub-ci-list { display: flex; flex-direction: column; gap: 4px; max-height: 320px; overflow-y: auto; }
.pub-ci { border: 1px solid var(--border, #ccc); border-radius: 4px; padding: 3px 4px; display: flex; flex-direction: column; gap: 3px; }
.pub-ci-head { display: flex; align-items: center; gap: 4px; padding: 1px 2px; border-radius: 3px; }
.pub-ci-head:hover { background: var(--surface-3); }
.pub-ci-name { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.pub-ci-set { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.pub-ci-set .pub-conn-sel { max-width: 150px; height: 24px; padding: 0 4px; font-size: 12px; }
.pub-ci-set .pub-num { height: 24px; font-size: 12px; }
.pub-ci-frames { max-height: 120px; margin-left: 18px; }
/* Publisher connector: the Batch list with thumbnails */
.pub-batch-list { display: flex; flex-direction: column; gap: 2px; max-height: 240px; overflow-y: auto; }
.pub-batch-dd { position: relative; width: 260px; max-width: 100%; }
.pub-batch-row.pub-batch-btn { border-color: var(--border-strong); background: var(--surface); }
.pub-batch-row > .seam-muted { white-space: nowrap; font-size: 12px; }
.pub-batch-caret { color: var(--text-secondary); }
.pub-batch-menu { position: absolute; left: -74px; right: 0; top: calc(100% + 2px); z-index: 20; max-height: 320px;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 4px; padding: 2px; box-shadow: 0 4px 14px rgba(0,0,0,0.18); }
.pub-batch-row { display: flex; align-items: center; gap: 8px; padding: 2px 4px; border-radius: 4px; cursor: pointer; border: 1px solid transparent; }
.pub-batch-row:hover { background: var(--surface-3); }
.pub-batch-row.pub-batch-on { border-color: var(--accent, #2a6fdb); background: var(--surface-2); }
.pub-batch-thumb { width: 40px; height: 40px; }
.pub-batch-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Publisher: the connector part of a clicked slot, marked for a moment */
@keyframes pub-sec-flash { 0%, 60% { background: color-mix(in srgb, var(--accent) 22%, transparent); } 100% { background: transparent; } }
.pub-sec-flash { animation: pub-sec-flash 1.6s ease-out; border-radius: 3px; }
.pub-ci-about { padding: 0 6px; font-size: 11.5px; height: 20px; }
/* Publisher's case About: long paths and slot lines wrap inside the window */
.pub-about-details .hint { white-space: pre-wrap; overflow-wrap: anywhere; }
.pub-ci-actions { display: flex; gap: 4px; justify-content: flex-end; align-items: center; }
.pub-ci-slot { margin-right: auto; font-size: 12px; color: var(--text-secondary); white-space: nowrap; }
.pub-ci-slot .pub-conn-sel { height: 22px; padding: 0 4px; font-size: 12px; width: 64px; }
.pub-fill-plan { display: flex; flex-direction: column; gap: 1px; font-size: 12px; padding: 4px 6px; border: 1px solid var(--border); border-radius: 4px; overflow-wrap: anywhere; }
.pub-fill-plan-head { color: var(--text-secondary); font-weight: 600; }
/* Publisher layout designer: the borders between slots, dragged on the figure */
.pub-div-handle { position: absolute; z-index: 3; box-sizing: border-box; border-radius: 3px; }
.pub-div-v { cursor: col-resize; }
.pub-div-h { cursor: row-resize; }
.pub-div-handle:hover, .pub-div-handle.pub-div-drag { background: color-mix(in srgb, var(--accent) 45%, transparent); }
.pub-div-handle.pub-div-drag::after { content: attr(data-ratio); position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  background: var(--accent-fill); color: #fff; font-size: 11px; padding: 1px 5px; border-radius: 3px; white-space: nowrap; pointer-events: none; }
.pub-num-s { width: 56px; }
.pub-num-on { outline: 2px solid var(--accent); }
/* Publisher caption */
.pub-cap-text { width: 100%; box-sizing: border-box; font-size: 12px; resize: vertical; }
.pub-cap-need { outline: 2px solid var(--red, #d33); }
.pub-cap-name { width: 150px; }
.pub-preview-caption { margin: 6px auto 0; font-size: 12.5px; line-height: 1.45; color: var(--text); white-space: pre-wrap; overflow-wrap: anywhere; }
.pub-preview-caption { cursor: pointer; border-radius: 3px; }
.pub-preview-caption:hover { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.pub-ci-draw { background: var(--accent-fill); color: #fff; border-color: var(--accent-fill); }
.pub-ci-draw:disabled { opacity: 0.45; }
.pub-fill-plan-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.pub-fill-take { font-weight: normal; }
.pub-stash-img { max-width: 100%; max-height: 140px; display: block; margin: 0 auto; }
/* Parameter rows of the editor tabs (param_rows.js): name | input(s) | key and meaning */
.plist { display: flex; flex-direction: column; gap: 8px; container-type: inline-size; }
.prow {
  display: grid; grid-template-columns: 132px 248px minmax(0, 1fr);
  border: 1px solid var(--border); border-radius: 6px; background: var(--surface); font-size: 13px;
}
.prow-name {
  background: var(--surface-2); padding: 7px 10px; font-weight: 600; font-size: 12.5px; line-height: 1.3;
  border-right: 1px solid var(--border); border-radius: 6px 0 0 6px; display: flex; align-items: center; overflow-wrap: anywhere;
}
.prow-req .prow-name > span::after { content: ' *'; color: var(--red); white-space: pre; }
.prow-ctl { padding: 5px 8px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; border-right: 1px solid var(--border); min-width: 0; }
.prow-ctl input[type=text], .prow-ctl input[type=number] { width: 96px; }
.prow-ctl input.wide { width: 100%; }
.prow-ctl select { max-width: 100%; }
.prow-ctl .unit { color: var(--muted); font-size: 12px; }
.prow-ctl .chk { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--text-secondary); }
.prow-axes { display: inline-flex; gap: 6px; flex-wrap: nowrap; }
.prow-ax { display: inline-flex; align-items: center; gap: 3px; }
.prow-ax > b { font-size: 11px; color: var(--muted); font-weight: 600; }
.prow-axes .prow-ax input[type=text] { width: 50px; }
.prow-ax input[type=text] { width: 64px; }
.prow-desc { position: relative; padding: 6px 10px; display: flex; flex-direction: column; justify-content: center; min-width: 0; }
.prow-text, .prow-full { font-size: 12.5px; color: var(--text-secondary); line-height: 1.45; }
.prow-text { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.prow-text code, .prow-full code { font-family: var(--font-mono); font-size: 11.5px; font-weight: 600; color: var(--text); margin-right: 5px; }
.prow-desc.open .prow-text { display: block; -webkit-line-clamp: unset; }
.prow-more { display: none; align-self: flex-start; border: none; background: none; padding: 0; margin-top: 2px; font-size: 12px; color: var(--accent); cursor: pointer; }
.prow-desc.clamped .prow-more, .prow-desc.open .prow-more { display: inline; }
.prow-full {
  display: none; position: absolute; left: -1px; right: -1px; top: -1px; z-index: 20; padding: 6px 10px;
  background: var(--surface); border: 1px solid var(--accent); border-radius: 0 6px 6px 6px; box-shadow: 0 6px 18px rgba(0, 0, 0, .15);
}
.prow-desc.clamped:not(.open):hover .prow-full { display: block; }
.prow-note { grid-template-columns: minmax(0, 1fr); background: var(--surface-2); border-style: dashed; }
.prow-note .prow-text b { color: var(--text); }
.plist-sub { font-size: 12px; font-weight: 600; color: var(--text-secondary); margin: 4px 0 -2px 2px; }
/* a narrow tray: the meaning goes under the name and the input */
@container (max-width: 560px) {
  .prow { grid-template-columns: 120px minmax(0, 1fr); }
  .prow-ctl { border-right: none; }
  .prow-desc { grid-column: 1 / -1; border-top: 1px solid var(--border); }
  .prow-note .prow-desc { border-top: none; }
}
.prow-group { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 10px; width: 100%; }
.prow-group-cap { font-size: 11px; color: var(--muted); font-weight: 600; width: 100%; }
.prow-ctl .nucl-check { font-size: 12px; }
/* Anisotropy preview: the wheel zooms only after a click on the view (aniso_view.js) */
.aniso-wheel-hint { position: absolute; right: 8px; top: 8px; padding: 2px 8px; border-radius: 4px; font-size: 11.5px;
  color: #fff; background: rgba(0, 0, 0, .55); pointer-events: none; }
.aniso-wheel-on .aniso-wheel-hint { display: none; }
.aniso-wheel-on { outline: 2px solid var(--accent); outline-offset: -2px; }
/* Thermal values entered on the Process tab (heat_inline_ui.js) */
.heat-inline { display: flex; flex-direction: column; gap: 6px; border: 1px solid var(--border); border-radius: 6px; padding: 8px 10px; }
.heat-inline-table { display: grid; grid-template-columns: 70px 150px 90px 80px 80px minmax(120px, 1fr) 28px; gap: 4px 8px; align-items: center; font-size: 12.5px; }
.heat-inline-head, .heat-inline-row { display: contents; }
.heat-inline-head span { font-size: 11px; font-weight: 600; color: var(--muted); }
.heat-inline-row input[type=text], .heat-inline-row select { width: 100%; min-width: 0; box-sizing: border-box; }
.heat-inline-actions { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; }
/* the interface energy the run uses for every pair (sigma_applied_ui.js) */
.sigma-applied-table { border-collapse: collapse; font-size: 12.5px; }
.sigma-applied-table th { text-align: left; font-size: 11px; color: var(--muted); font-weight: 600; padding: 2px 12px 4px 0; border-bottom: 1px solid var(--border); }
.sigma-applied-table td { padding: 3px 12px 3px 0; border-bottom: 1px solid var(--border); }
.sigma-applied-table td:nth-child(3) { font-family: var(--font-mono); font-size: 11.5px; color: var(--text-secondary); }
.sigma-applied-table tr.warn td { color: var(--orange); }
.sigma-wetting { margin-top: 8px; padding: 6px 10px; border: 1px solid var(--border); border-radius: 6px; font-size: 12.5px; display: flex; flex-direction: column; gap: 2px; }
.sigma-wetting.on { border-color: var(--orange); }
.sigma-wetting.on > div:not(.hint) { color: var(--orange); }
.nfold-list:empty { display: none; }
.nfold-list { padding-left: 132px; }   /* the rows of a list under its inputs column */
/* the fields an output option writes (Output tab) */
.prow-ctl .field-list { width: 100%; font-size: 11.5px; color: var(--text-secondary); line-height: 1.35; }

/* Explanatory text (parameter descriptions, hints, notes, the lines explaining a list or a picker,
   the "* required" legend): one readable size and colour everywhere, set here last so it holds. */
.hint:not(.warn), .req-legend, .seam-note, .help-side, .an2d-hint, .an2d-empty, .icg-tsub, .icg-eq-note,
.tsest-hint, .tsest-notes, .tsest-sub, .dview-intro, .dview-notes, .regnote-line, .regnote-hint,
.tdbreg-note, .tdbreg-notes, .tdbreg-hint, .tdbreg-sub, .tdbreg-empty,
.tdbmenu-note, .tdbmenu-notes, .tdbmenu-sub, .tdbmenu-empty, .phpick-empty,
.sov-detail, .arc-detail, .rsd-snap-detail, .pub-check-info, .sce-info,
.elpick-title, .elpick-summary, .elsel-title, .phpick-title, .phpick-count, .phsel-title, .plist-sub,
.prow-text, .prow-full, .prow-group-cap, .prow-ctl .field-list {
  font-size: 13px; color: var(--text-secondary); line-height: 1.45;
}
