/* ===== Shared UI Components ===== */

/* ─── Slim page header — icon+title on the left, a .pill-tab-bar centered, in one compact row
     instead of a separate .page-header block stacked above a full-width .tab-bar. Archetype,
     first extracted from Metrics' own header; Metrics is still the only thing built on it. */
.slim-page-header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
  min-height: 2.5rem;
  position: relative;
}
.slim-header-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
/* The third column's slot, for the page's own actions · pinned to the far edge */
.slim-header-right {
  grid-column: 3;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
}
.slim-page-header h2 {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.95rem;
  font-weight: 600;
  white-space: nowrap;
}
.slim-page-header h2 svg {
  flex-shrink: 0;
  color: var(--primary);
  opacity: 0.85;
}

/* Pill tab toggle — a slim, centered, boxed-on-active control. Deliberately not .tab-bar/.tab-btn's
   border-fusion-against-a-card-edge trick; this floats in a toolbar instead. */
.pill-tab-bar {
  display: flex;
  justify-content: center;
}
.pill-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.28rem 2rem;
  font-size: 0.8rem;
  font-weight: 600;
  background: none;
  border: 1px solid transparent;
  border-radius: 4px;
  cursor: pointer;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}
.pill-tab:hover { color: var(--text); background: var(--row-selected); }
.pill-tab.active {
  color: var(--text);
  border-color: var(--border);
  background: var(--surface-deep);
}

/* ─── Scroll panel — standardized scrollable-box shell used by any fixed-height,
     internally-scrolling list/log (System Logs terminal, NC Deploy pending list, etc.).
     Callers set their own height/max-height and any content-specific styling (font, etc.). */
.scroll-panel {
  background: var(--surface);
  border: 1px solid var(--border); /* --cell-border-h is for table-cell dividers, not panel outlines */
  border-radius: 6px;
  overflow-y: auto;
  padding: 6px 10px;
}

/* ─── App toast ──────────────────────────────────────────────────────────────── */

/* the one toast sits at the bottom centre · feedback.js keeps it to one at a time */
.toast-stack {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  z-index: var(--z-toast);
  max-width: min(40rem, calc(100vw - 2rem));
  pointer-events: none;
}
.app-toast {
  padding: 0.5rem 1.2rem;
  border-radius: 4px;
  font-size: 0.85rem;
  /* a click dismisses one early, so each toast takes the pointer the stack lets through */
  pointer-events: auto;
  cursor: pointer;
  animation: app-toast-in 0.2s ease;
  background: var(--success);
  color: var(--on-success);
}
.app-toast--error { background: var(--danger); color: var(--on-primary); }
.app-toast--info  { background: var(--primary); color: var(--on-primary); }
/* a refused action · nothing broke, so it reads in the page's own ink rather than red */
.app-toast--blocked { background: var(--text); color: var(--surface); }
/* a toast carrying an action (Undo) lays the button beside its words · how long it stays is the caller's duration */
.app-toast:has(.app-toast-action) { display: flex; align-items: center; gap: 0.75rem; cursor: default; }
.app-toast-action { border: 0; background: none; color: inherit; font: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; padding: 0.25rem 0; }

/* only the arrival animates · the timer in feedback.js decides when it leaves, so a refreshed repeat never fades early */
@keyframes app-toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─── Section headers ────────────────────────────────────────────────────────────
   A tab's own title is .pathbar's root segment now, not a .page-header block above it —
   every tab heads its page the same way, so the standalone header class is gone.
   ────────────────────────────────────────────────────────────────────────────── */

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
}

.section-header h3 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-sub);
}

.section-header h3 svg {
  flex-shrink: 0;
  color: var(--primary);
  opacity: 0.85;
}

.filter-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}
/* named variants, so a panel stacking several rows stops hand-tuning each one inline */
.filter-row--spaced { margin-bottom: 1rem; }
.filter-row--flush  { margin-bottom: 0; }
/* labelled fields of differing height line up on their inputs, not their middles */
.filter-row--baseline { align-items: flex-end; }

/* ── Field panel · the quiet panel a pane's controls sit in, above the rows they steer ── */
.field-panel {
  --field-h: 32px;  /* one height for every control, so nothing steps up or down */
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 0;
  background: var(--table-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 0.75rem 0.9rem;
  margin-bottom: 0.75rem;
}
.field-panel-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-width: 0;
  padding: 0 1rem;
  border-left: 1px solid var(--border-light);
}
.field-panel-group:first-child { padding-left: 0; border-left: none; }
.field-panel-group:last-child { padding-right: 0; }
.field-panel-group--grow { flex: 1 1 16rem; }
.field-panel-title { font-size: 0.72rem; font-weight: 700; color: var(--text-sub); }
/* a group's title with its quick picks on the same line */
.field-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; flex-wrap: wrap; }
/* top-aligned, so labels share a line and a chip under one box never moves its neighbours */
.field-panel-fields { display: flex; align-items: flex-start; gap: 0.6rem; flex-wrap: wrap; }
/* outranks .form-field.field-grow's 200px floor further down, so two growing fields share a narrow group side by side */
.field-panel-fields > .form-field.field-grow { flex: 1 1 8rem; min-width: 0; }
.field-panel .form-field { margin-bottom: 0; min-width: 0; }
.field-panel .form-field > label {
  display: flex; align-items: center; gap: 0.35rem;
  min-height: 1.1rem; margin-bottom: 0.25rem;
  font-size: 0.65rem; font-weight: 600; letter-spacing: 0.06em;
}
.field-panel .form-field input,
.field-panel .form-field select,
.field-panel .combo-input {
  height: var(--field-h);
  box-sizing: border-box;
  padding-block: 0;
}
/* a glyph between two fields, sat on the inputs' line rather than the labels' */
.field-panel-join {
  align-self: flex-end;
  height: var(--field-h);
  display: flex; align-items: center;
  color: var(--text-faint);
}
/* quick picks under a group's fields · small, so they read as shortcuts rather than fields */
.field-panel-picks { display: flex; gap: 0.3rem; flex-wrap: wrap; }
.field-panel-pick {
  border: 1px solid var(--border); background: var(--surface); color: var(--text-sub);
  border-radius: 999px; padding: 0.1rem 0.6rem; font: 500 0.7rem inherit; cursor: pointer;
}
.field-panel-pick:hover { background: var(--row-hover); }

/* field-panel--stack derivative · sections one above the other, split by the same hairline */
.field-panel--stack { flex-direction: column; flex-wrap: nowrap; gap: 0.6rem; }
.field-panel--stack > * + * { border-top: 1px solid var(--border-light); padding-top: 0.6rem; }

/* at phone width the groups stack, each taking the row, so the rules between them go */
@media (max-width: 700px) {
  .field-panel-group { flex: 1 1 100%; padding: 0; border-left: none; }
}

input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 13px;
  height: 13px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--checkbox-bg);
  cursor: pointer;
  flex-shrink: 0;
  position: relative;
  vertical-align: middle;
}
input[type="checkbox"]:checked {
  background: var(--primary);
  border-color: var(--primary);
}
input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: 3px;
  top: 0px;
  width: 4px;
  height: 8px;
  border: 2px solid var(--on-primary);
  border-top: none;
  border-left: none;
  transform: rotate(45deg);
}
input[type="checkbox"]:disabled {
  background: var(--border);
  border-color: var(--border);
  opacity: 0.5;
  cursor: not-allowed;
}

/* A checkbox and the sentence explaining it, on one line · the mobile sheets already assumed this rule existed */
.toggle-label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
}
.toggle-label:has(input:disabled) { cursor: not-allowed; opacity: 0.6; }
input[type="checkbox"]:disabled:checked {
  background: var(--border);
  border-color: var(--border);
}

.filter-row input[type="text"],
.filter-row input[type="date"],
.filter-row input[type="time"],
.filter-row input[type="datetime-local"],
.filter-row select {
  padding: 0.38rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 0.875rem;
  color: var(--text);
}

.filter-row input[type="text"] { min-width: 220px; background: var(--bg); }
.filter-row input[type="date"] { background: var(--bg); }
.filter-row input[type="time"] { background: var(--bg); }
.filter-row input[type="datetime-local"] { background: var(--bg); }
.filter-row select { background: var(--bg); }

/* A checkbox and its words · one look for it in a filter row and in a path bar alike */
.filter-row label,
.pathbar-active {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.875rem;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
}

.filter-sep {
  width: 1px;
  height: 1.1rem;
  background: var(--border);
  flex-shrink: 0;
}

.filter-inline-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
  cursor: default;
}

.header-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-left: auto;
}

/* ─── Form row ───────────────────────────────────────────────────────────────── */

.form-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.75rem;
}

.form-row label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-sub);
  white-space: nowrap;
}

.form-row select {
  flex: 1;
  min-width: 240px;
}

.form-row input[type="text"],
.form-row input[type="password"] {
  flex: 1;
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 0.875rem;
  background: var(--bg);
  color: var(--text);
}
.form-row input:focus,
.form-row select:focus { outline: none; border-color: var(--primary); }

.form-label-sm { min-width: 80px; }
.form-label-md { min-width: 110px; }

.form-error {
  color: var(--danger);
  font-size: 0.82rem;
  margin-top: 0.25rem;
}

.form-row-checkbox {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.input-short { max-width: 60px; }

/* ─── Kit/module-scoped entity header — Picker row (Model/Kit/Ext Rev/Int Rev [/Module]), Action
     row (import/export/domain-specific buttons, History last), and Identity+Lock row
     (.drill-header) stacked with one consistent spacing, instead of each screen picking its own
     margins. Shared by PQP, Design Sheet, and Nest Studio (any future kit-scoped checkout screen
     should reuse this too — see feedback_section_header_single_row: section_header only ever
     fits ONE row beside its title, so all three of these rows belong outside that call). */
.entity-header {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  margin-bottom: var(--space-7);
}
.entity-header .drill-header {
  margin-bottom: 0; /* the flex gap above already spaces it — avoid doubling up with drill-header's own margin */
}
/* Extra breathing room below the action row specifically — the base gap alone read as too
   tight between a row of buttons and the identity/lock bar right underneath it */
.entity-header-actions {
  margin-bottom: var(--space-2);
}

/* ─── Drill-down breadcrumb — one persistent header per multi-step tab, replacing what used
     to be a separate boxed .selection-header per tab/step. */
.drill-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-7);
  padding: 0.6rem 1rem;
  background: var(--surface-deep);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 1px 4px var(--shadow-sm);
}

.drill-breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.15rem;
}

.crumb {
  background: none;
  border: none;
  padding: 0.15rem 0.35rem;
  border-radius: 3px;
  font-size: 0.9rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.crumb:hover { background: var(--row-selected); color: var(--text); }
.crumb--current {
  color: var(--text);
  font-weight: 600;
  cursor: default;
}
.crumb--current:hover { background: none; }

/* Root crumb (e.g. "Models", "Accounting") — the top of the whole trail, styled a touch
   heavier than intermediate crumbs so the hierarchy's anchor point reads clearly. */
.crumb--root {
  font-weight: 600;
  color: var(--text-sub);
}
.crumb--root:hover { color: var(--text); }
.crumb--root.crumb--current { color: var(--text); }

.crumb-sep {
  margin: 0 0.15rem;
  color: var(--text-faint);
}

.group-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin: 0.85rem 0 0.15rem;
}
.group-label:first-child {
  margin-top: 0;
}

/* ─── Buttons ────────────────────────────────────────────────────────────────── */

/* Every button presses in while it's held, the operator keypad's press made the standard · scale composes with a transform a button already positions itself by, so none of them jump */
button:not(:disabled):active { scale: 0.96; }

/* Primal button shape — every labeled button (primary/secondary/danger) shares this; only
   color/border/hover-target vary by role. Primary keeps extra padding — the main CTA is meant
   to read as more prominent, a deliberate exception, not drift. */
.btn-primary,
.btn-secondary,
.btn-danger,
.btn-danger-sm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.38rem 0.8rem;
  border-radius: 4px;
  font-size: 0.875rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, scale 0.08s;
}
.btn-primary .icon-slot,
.btn-secondary .icon-slot,
.btn-danger .icon-slot { display: inline-flex; flex-shrink: 0; }

.btn-primary {
  background: var(--primary);
  color: var(--on-primary);
  border: none;
  padding: 0.5rem 1.25rem;
}
.btn-primary:hover { background: var(--primary-hover); }
.btn-primary:disabled { opacity: 0.5; cursor: default; }

.btn-secondary {
  background: var(--surface-deep);
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--row-selected); }
/* A Refresh action's ↻ · it leans on hover and turns while the re-read runs (runBusy sets data-busy), so the click visibly did something */
.btn-refresh .icon-slot { transition: transform 0.25s ease; }
.btn-refresh:hover:not([data-busy="1"]) .icon-slot { transform: rotate(90deg); }
.btn-refresh[data-busy="1"] { cursor: progress; color: var(--text); }
.btn-refresh[data-busy="1"] .icon-slot { animation: spin 0.6s linear infinite; }
@media (prefers-reduced-motion: reduce) {
  .btn-refresh .icon-slot, .btn-refresh[data-busy="1"] .icon-slot { transition: none; animation: none; }
}
/* A secondary button that holds a state rather than firing an action — same button, tinted while on, so a toggle never needs a colour of its own */
.btn-secondary[aria-pressed="true"] { background: var(--export-bg); border-color: var(--primary); color: var(--primary); }
.btn-secondary:disabled { opacity: 0.5; cursor: default; }

.btn-danger {
  background: none;
  color: var(--danger);
  border: 1px solid transparent;
}
.btn-danger:hover {
  background: var(--danger-bg);
  border-color: var(--danger-border);
}

.btn-info:disabled,
.btn-edit:disabled,
.btn-danger:disabled,
.cut-dupe-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

/* Two buttons sharing a row, each taking half — use this instead of an inline
   style="display:flex;gap:..." wrapper (a few older call sites still hand-roll one) */
.btn-pair { display: flex; gap: 0.5rem; }
.btn-pair > * { flex: 1; }

/* Primal inline row-action shape — every faint icon-only per-row button shares this;
   only the hover color (default/danger/primary) varies via the modifier classes below. */
.btn-edit,
.btn-info,
.btn-duplicate,
.cut-dupe-btn,
.btn-kit-export,
.btn-kit-import,
.btn-release,
.op-stats-info-btn,
.cut-qty-reset,
.btn-pseudo-mat,
.btn-pseudo-mat-revert,
.btn-delete,
.btn-remove-note,
.btn-remove-customer,
.btn-bom-info,
.pkg-cell-pencil,
.btn-row-info,
.btn-nc-files,
.btn-solid3d,
.btn-nest3d,
.btn-add-child,
.btn-commit,
.btn-console {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  color: var(--text-faint);
  padding: 0.1rem 0.3rem;
  margin: 0 0.2rem;
  border-radius: 3px;
  line-height: 1;
  transition: color 0.15s, background 0.15s;
}

/* Default hover: text + row-selected tint */
.btn-edit:hover,
.btn-info:hover,
.btn-duplicate:hover,
.cut-dupe-btn:hover,
.btn-kit-export:hover,
.btn-kit-import:hover,
.btn-release:hover,
.op-stats-info-btn:hover,
.cut-qty-reset:hover,
.btn-pseudo-mat:hover,
.btn-pseudo-mat-revert:hover,
.btn-solid3d:hover,
.btn-nest3d:hover,
.btn-add-child:hover,
.btn-nc-files:hover {
  color: var(--text);
  background: var(--row-selected);
}
.btn-pseudo-mat,
.btn-pseudo-mat-revert {
  font-size: 0.8rem;
  vertical-align: middle;
}

/* Danger hover: destructive actions */
.btn-delete:hover,
.btn-remove-note:hover,
.btn-remove-customer:hover {
  color: var(--danger);
  background: var(--danger-bg);
}

/* Primary hover: edit/duplicate affordances (some anchored/absolute — see bom.css / production.css) */
.btn-bom-info:hover,
.pkg-cell-pencil:hover,
.btn-row-info:hover {
  color: var(--primary);
  background: var(--row-selected);
}

/* Accent hover: opens a live/remote view (the Daemon Console) rather than editing a field */
.btn-console:hover {
  color: var(--accent);
  background: var(--info-bg);
}

.btn-sm {
  padding: 0.2rem 0.55rem;
  font-size: 0.7rem;
}

/* Monospace utility — identifiers, addresses, JSON, anything that lines up in columns */
.mono {
  font-family: ui-monospace, 'Cascadia Code', 'Fira Mono', monospace;
}

/* Check In — same footprint as btn-sm (matches Check Out) so the two don't visibly swap sizes
   as a document goes from unlocked to checked-out-by-you */
.btn-check-in {
  padding: 0.2rem 0.55rem;
  font-size: 0.7rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

/* Inline icon-only button (e.g. row check-out/check-in/discard/force-release, rename pencil) —
   shared across module sheets, packaging sheets, BOM kits, and quotes */
.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid transparent;
  border-radius: 4px;
  cursor: pointer;
  color: var(--text-muted);
  padding: 0.15rem 0.35rem;
  font-size: 0.85rem;
  line-height: 1;
  transition: background 0.1s, border-color 0.1s, color 0.1s;
}
.btn-icon:hover { background: var(--row-selected); border-color: var(--border); color: var(--text); }
/* Destructive .btn-icon (e.g. delete-this-version in the history modal) — same danger treatment as .btn-delete:hover */
.btn-icon-danger:hover { background: var(--danger-bg); border-color: var(--danger-border); color: var(--danger); }
/* Toggled .btn-icon (e.g. a task's N/A button while it's set) — same treatment as .btn-secondary[aria-pressed="true"] */
.btn-icon[aria-pressed="true"] { background: var(--export-bg); border-color: var(--primary); color: var(--primary); }

/* Icon-only action buttons (accept / reject) */
.btn-icon-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.6rem;
  height: 1.6rem;
  border: none;
  border-radius: 4px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  line-height: 1;
  margin-right: 0.2rem;
}
.btn-accept { background: var(--accept-bg);      color: var(--success); }
.btn-reject { background: var(--reject-bg);      color: var(--danger); }
.btn-accept:hover { background: var(--accept-bg-hover); }
.btn-reject:hover { background: var(--reject-bg-hover); }
.btn-export { background: var(--export-bg);      color: var(--accent); }
.btn-export:hover { background: var(--export-bg-hover); }
/* Filter-bar toggles: one styling for all of them, so a new toggle never brings its own colour */
.btn-flagged-toggle,
.btn-global-toggle { background: var(--surface); color: var(--text-muted); }
.btn-flagged-toggle:hover,
.btn-global-toggle:hover { background: var(--surface-deep); }
.btn-flagged-toggle.active,
.btn-global-toggle.active { background: var(--warning-bg); color: var(--warning); }

.btn-tooltip-toggle { background: var(--surface); color: var(--text-muted); font-style: italic; }
.btn-tooltip-toggle:hover { background: var(--surface-deep); }
.btn-tooltip-toggle.active { background: var(--export-bg); color: var(--accent); }
.td-last-info { position: relative; padding-right: 22px !important; }
.btn-row-info { position: absolute; top: 50%; right: 4px; transform: translateY(-50%); visibility: hidden; }
tr:hover .btn-row-info { visibility: visible; }

/* Status chip archetype — one shape/radius/size for entity-state indicators, color from a variant class only; see static/js/utils.js's chip() / _macros.html's chip() */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  border-radius: var(--radius-pill);
  padding: 0.15rem 0.6rem;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
}
.chip--neutral     { background: var(--surface-deep); color: var(--text-muted); }
.chip--success     { background: var(--success-bg);   color: var(--success); }
.chip--warning     { background: var(--warning-bg);   color: var(--warning); }
.chip--danger      { background: var(--danger-bg);    color: var(--danger); }
.chip--info        { background: var(--info-bg);      color: var(--info-color); }
.chip--exceptional { background: var(--exceptional-bg); color: var(--exceptional-color); }
/* identity tints · a chip that names what something is rather than a state */
.chip--assembled   { background: var(--assembled-bg); color: var(--assembled-color); }
.chip--standard    { background: var(--export-bg);    color: var(--primary); }
.chip--special     { background: var(--badge-special-bg); color: var(--badge-special-text); }
/* For chips sitting on an already-tinted surface, where a filled pill reads as too heavy
   (e.g. the BOM hierarchy step's "current" state) */
.chip--outline { background: transparent; border: 1.5px solid currentColor; }
/* For chips whose text is an identifier meant to be compared character-by-character (EC numbers, revisions) */
.chip--mono { font-family: ui-monospace, 'Cascadia Code', 'Fira Mono', monospace; font-variant-numeric: tabular-nums; }
.chip .chip-icon { font-size: 0.85em; line-height: 1; }
/* a line icon from SECTION_ICONS scales with the chip's text, the way a glyph from ICONS already does */
.chip .chip-icon svg { width: 1.1em; height: 1.1em; vertical-align: -0.15em; }
/* An icon-only chip · the same pill squared up around its glyph, its words in the title on hover */
.chip--icon { padding: 0.2rem 0.32rem; cursor: help; }
.chip--icon .chip-icon { font-size: 1em; }

/* infoTip's mark beside a label, muted until it's pointed at */
.info-tip { color: var(--text-muted); cursor: help; font-weight: normal; text-transform: none; }
.info-tip:hover, .info-tip:focus { color: var(--primary); outline: none; }

/* ─── Tone banner ────────────────────────────────────────────────────────────────
   Full-width dismissible message strip (icon + body + dismiss), tone-varied via a
   .tone-warning/.tone-danger modifier. Tone coloring mirrors .chip--* above — always
   var(--<tone>-bg)/var(--<tone>), never a hardcoded color — so it reads correctly in
   both light and dark themes. Derive new banners from this rather than hand-rolling
   a one-off (e.g. don't bake in a fixed dark background + fixed light text). ───── */

.tone-banner {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.65rem 0.9rem;
  border-radius: 8px;
  border: 1px solid var(--success-border, var(--success));
  background: var(--success-bg);
  box-shadow: 0 2px 12px var(--shadow-lg);
}
.tone-banner.tone-warning {
  border-color: var(--warning-border, var(--warning));
  background: var(--warning-bg);
}
.tone-banner.tone-danger {
  border-color: var(--danger-border);
  background: var(--danger-bg);
}

.tone-banner-icon {
  flex-shrink: 0;
  width: 1.3rem;
  height: 1.3rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 700;
  background: var(--success);
  color: var(--on-primary);
  margin-top: 0.05rem;
}
.tone-banner.tone-warning .tone-banner-icon { background: var(--warning); }
.tone-banner.tone-danger  .tone-banner-icon { background: var(--danger); }

.tone-banner-body { flex: 1; min-width: 0; }
.tone-banner-msg  { font-size: 0.82rem; font-weight: 600; color: var(--text); line-height: 1.4; }
.tone-banner-meta { font-size: 0.7rem; color: var(--text-muted); margin-top: 0.2rem; }

.tone-banner-dismiss {
  flex-shrink: 0;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1;
  padding: 0.15rem 0.3rem;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
}
.tone-banner-dismiss:hover { color: var(--text); background: var(--row-hover); }

/* Avatar — initials circle, id picks a deterministic color from _AVATAR_COLOR_VARS (see static/js/utils.js's avatarHtml()); pair with assigneeTag() rather than hand-rolling a circle per screen */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--on-primary);
}
.avatar--sm { width: 18px; height: 18px; font-size: 0.56rem; }
.avatar--unassigned {
  background: var(--surface-deep);
  color: var(--text-faint);
  border: 1px dashed var(--border);
}

/* Avatar stack — overlapping avatars for "who's on this team", e.g. a Group's member roster */
.avatar-stack { display: inline-flex; }
.avatar-stack .avatar { margin-left: -6px; border: 2px solid var(--surface); }
.avatar-stack .avatar:first-child { margin-left: 0; }
.avatar-stack--sm .avatar { margin-left: -5px; border-width: 1.5px; }
.avatar-stack--sm .avatar:first-child { margin-left: 0; }

.assignee-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.875rem;
  color: var(--text-sub);
}
.assignee-tag--unassigned { color: var(--text-faint); font-style: italic; }

/* Compact inline assignee picker — for tables that let you (re)assign in place instead of
   opening a full edit modal just to change who's responsible */
.assignee-select {
  font-size: 0.8rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
  color: var(--text);
  padding: 0.2rem 0.4rem;
}

/* ─── Row highlight + table loading ──────────────────────────────────────────── */

tr.row-highlight td {
  background: var(--row-selected) !important;
  border-right-color: transparent !important;
}

/* ─── Data table ─────────────────────────────────────────────────────────────── */

.table-scroll {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--table-surface);
  box-shadow: 0 1px 3px var(--shadow-md);
  margin-bottom: 2rem;
}

.data-table {
  /* Density is three properties, so a variant is three values rather than a second copy of the
     cell rules — see --compact below, .workspace-pane, and mobile.css, which all set these. */
  --pad-y: 0.5rem;
  --pad-x: 0.75rem;
  --cell-size: 0.85rem;
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: 0 1px 4px var(--shadow-md);
}

/* Inside the wrapper the wrapper draws the frame; two of them is what forced #tab-metrics to
   switch the inner one off. A bare table (JS-rendered into a modal or a pane) still frames itself. */
.table-scroll > .data-table { border-radius: 0; box-shadow: none; }

.data-table:not(.grid-table) {
  background: var(--table-surface);
}


.data-table thead {
  background: none;
  color: inherit;
  border-bottom: none;
}

/* The header labels the table instead of dominating it: a light ground and one --primary line where
   labels stop and data starts. That line is where the brand accent went after coming off the
   wrapper's left edge, which marked nothing in particular. Metrics' .grid-table opts out of all of
   this at its own site (metrics.css) — it stays a dark, centred, dense grid. */
.data-table th {
  background: var(--surface-deep);
  color: var(--text-muted);
  box-shadow: inset 0 -2px 0 var(--primary);
  text-align: left;
  padding: 0.45rem var(--pad-x);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}

.data-table td {
  padding: var(--pad-y) var(--pad-x);
  border-bottom: 1px solid var(--border);
  color: var(--text-sub);
  text-align: left;
  font-size: var(--cell-size);
}

.data-table:not(.grid-table) td {
  border-bottom: 1px solid var(--cell-border-h);
}

/* The first column is the row's identity, so it carries the weight rather than reading as one more
   value. Excluded from the dense grid, whose leading cell is just another cell. */
.data-table:not(.grid-table) td:first-child { color: var(--text); font-weight: 500; }

.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: var(--row-hover); cursor: pointer; }
/* Opt-out for a read-only table, so it stops offering a click that does nothing */
.data-table--static tbody tr:hover { cursor: default; }

/* Row state, one vocabulary for every table. The spine is what survives a hover tint or a striped
   ground, which a background alone doesn't; it goes on the leading cell rather than the row,
   since a box-shadow on a <tr> under border-collapse isn't reliably painted. */
.data-table tbody tr.is-selected { background: var(--row-selected); }
.data-table tbody tr.is-selected td:first-child { box-shadow: inset 3px 0 0 var(--primary); }
/* flagged is "needs attention", not "broken" — the warning treatment PQP already used */
.data-table tbody tr.is-flagged { background: var(--warning-bg); }
.data-table tbody tr.is-flagged td:first-child { box-shadow: inset 3px 0 0 var(--warning); }
.data-table tbody tr.is-flagged td { color: var(--text); }
/* the row you are looking at outranks one that needs attention, or a flagged part never shows it is the one open */
.data-table tbody tr.is-selected.is-flagged { background: var(--row-selected); }
.data-table tbody tr.is-selected.is-flagged td:first-child { box-shadow: inset 3px 0 0 var(--primary); }
/* inactive, superseded, unmeasured — present but not what you're looking at */
.data-table tbody tr.is-muted td { color: var(--text-faint); }

/* Totals belong in the table, not in a paragraph underneath it */
.data-table tfoot td {
  background: var(--surface-deep);
  color: var(--text);
  font-weight: 600;
  font-size: 0.8rem;
  border-top: 1px solid var(--border);
  border-bottom: none;
}

.data-table tbody tr.row-highlight td {
  background: var(--row-selected);
  outline: 2px solid var(--primary);
  outline-offset: -2px;
  transition: background 2s ease, outline-color 2s ease;
}

/* Vertical divider marking the end of a header/column group (e.g. Nominal vs Measured
   sections in a grouped table) — apply to the last th/td in each group, header and body alike */
/* Compact modifier for a .data-table living somewhere narrow — a side panel, an info pane, any
   dense read-only grid. Sets the density properties and nothing else. Cells stop wrapping, so a
   wide table scrolls sideways in its own overflow-x container rather than growing tall. Use this
   instead of hand-tuning padding on one page's table. */
.data-table--compact {
  --pad-y: 0.28rem;
  --pad-x: 0.5rem;
  --cell-size: 0.78rem;
}
.data-table--compact th { line-height: 1.25; }
.data-table--compact td { white-space: nowrap; }
/* a header's unit, on its own line so it never widens the column */
.data-table--compact .col-unit {
  display: block;
  font-size: 0.9em;
  font-weight: 400;
  opacity: 0.7;
  text-transform: none;
  letter-spacing: 0;
}

.data-table .col-group-end {
  border-right: 2px solid var(--cell-border-v) !important;
}

/* Group-divider row — e.g. subkit sections in the PQP parts table. A light band ranged left, so a
   table with several groups reads as one table with sections instead of alternating dark stripes. */
.data-table tbody tr.is-group:hover td { background: var(--surface-deep); cursor: default; }
.data-table tbody tr.is-group td {
  background: var(--surface-deep);
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.7rem;
  text-align: left;
  padding: 0.3rem var(--pad-x);
}

/* Collapsible group heading rows, paired with shared/entity_table_grouped.js · each level indents one chevron's width */
.data-table tbody tr.table-group-row td {
  background: var(--surface);
  font-weight: 600;
  cursor: pointer;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.data-table tbody tr.table-group-row:hover td { background: var(--row-hover); }
/* the indent lands on the label cell · the first cell, or the one past a select box, which keeps its own width */
.data-table tbody tr.table-group-row > td:first-child:not(.cell-check),
.data-table tbody tr.table-group-row > td.cell-check:first-child + td { padding-left: calc(var(--pad-x) + var(--depth, 0) * 1.4rem); }
.data-table tbody tr.table-group-row--nested td { font-weight: 500; color: var(--text-muted); }
.table-group-label { display: flex; align-items: center; gap: 0.4rem; min-width: 0; }
.table-group-name { white-space: nowrap; }
.table-group-toggle {
  flex: none; width: 1rem; padding: 0; border: none; background: none;
  color: var(--text-faint); font: inherit; line-height: 1; text-align: center; cursor: pointer;
}
.table-group-toggle:hover { color: var(--text); }
.table-group-toggle.is-empty { cursor: default; }
.table-group-count { font-weight: 400; color: var(--text-faint); }
.table-group-actions { margin-left: auto; display: inline-flex; align-items: center; gap: 0.2rem; }
.table-group-remove {
  border: none; background: transparent; color: var(--text-faint);
  cursor: pointer; font-size: 0.85rem; padding: 0.2rem 0.4rem;
}
.table-group-remove:hover { color: var(--warning); }
/* a group's own rows start under its label, past the chevron, on the same label cell */
.data-table tbody tr.table-row--child > td:first-child:not(.cell-check),
.data-table tbody tr.table-row--child > td.cell-check:first-child + td { padding-left: calc(var(--pad-x) + var(--depth, 1) * 1.4rem); }

/* PQP-specific delta/flag rules live in quality.css — .pqp-field-badge below stays here since
   Design Sheet reuses the same class for its own inline-edit validation badges */

/* PQP invalid-value badge â€” sits next to a parameter input whose current text isn't a valid
   number; tooltip (title attr) names the problem */
.pqp-field-badge {
  display: inline-block;
  margin-left: 0.25rem;
  color: var(--danger);
  cursor: help;
  font-size: 0.85rem;
}
.pqp-field-badge.hidden {
  display: none;
}

/* Sortable column headers */
.th-sort { cursor: pointer; user-select: none; white-space: nowrap; }
.th-sort::after {
  content: '';
  display: inline-block;
  width: 0.8em;
  margin-left: 0.3em;
  opacity: 0.3;
}
.th-sort.th-sort-active::after { opacity: 1; }
.th-sort.th-sort-active[data-dir="asc"]::after  { content: '↑'; }
.th-sort.th-sort-active[data-dir="desc"]::after { content: '↓'; }

/* Section separator between stacked tables */
.section-sep {
  margin: 1.75rem 0 0;
  border: none;
  border-top: 1px solid var(--border-light);
  padding-top: 1.75rem;
}

/* Column helpers — alignment is a column's job, so it's declared once per column here rather than
   left to the base rule. Text ranges left (the default), quantities right, glyphs and controls
   centred. .col-num is the one that has to be added per column; a numeric column without it simply
   ranges left, which is no worse to read than the centring it replaced. */
.col-num    { text-align: right; font-variant-numeric: tabular-nums; }
.col-center { text-align: center; }

.col-action { width: auto; text-align: center; white-space: nowrap; vertical-align: middle; }
td.col-action > * + * { margin-left: 0.2rem; }
thead .col-action { background: var(--surface-deep); }
/* the actions sit muted until the row is under the cursor, so a table of 40 rows isn't 80 glyphs */
td.col-action .btn-icon { opacity: 0.5; transition: opacity 0.12s; }
tr:hover td.col-action .btn-icon,
td.col-action .btn-icon:focus-visible { opacity: 1; }

/* Bulk-select checkbox column */
th.col-check, td.cell-check {
  width: 2rem;
  text-align: center;
  vertical-align: middle;
  padding: 0 0.25rem;
}
thead th.col-check { background: var(--surface-deep); }

/* Drag-to-reorder handle column — paired with static/js/drag_reorder.js; applies to both table
   rows and non-table row lists (e.g. a repeatable div-row list inside a modal) */
.col-drag {
  width: 28px;
  padding: 0 4px !important;
}

.drag-handle {
  cursor: grab;
  color: var(--text-faint);
  font-size: 0.85rem;
  user-select: none;
  display: block;
  text-align: center;
}

.drag-handle:active { cursor: grabbing; }

tr.dragging, .tpl-item-row.dragging { opacity: 0.35; }

tr.drop-above > td { box-shadow: 0 -2px 0 0 var(--primary); }
.tpl-item-row.drop-above { box-shadow: 0 -2px 0 0 var(--primary); }

/* Any non-table draggable row gets the same two states, so a new reorderable list doesn't have to
   add its own pair — a <tr> still needs the rules above, since the shadow has to land on its cells */
[draggable="true"].dragging { opacity: 0.35; }
[draggable="true"].drop-above { box-shadow: 0 -2px 0 0 var(--primary); }
/* the handle sits inline in a flex row here, not as its own centred table column */
.task-row .drag-handle, .workspace-row .drag-handle, .section-head .drag-handle { display: inline-flex; align-items: center; flex: none; font-size: 0.8rem; }

/* Bulk action buttons that appear in the filter-row when rows are selected */
.bulk-actions { display: flex; gap: 0.4rem; align-items: center; }
.bulk-actions.hidden { display: none; }
.btn-danger-sm {
  background: transparent;
  border: 1px solid var(--danger-border);
  color: var(--danger);
}
.btn-danger-sm:hover { background: var(--danger); color: var(--on-primary); }
.col-date   { white-space: nowrap; color: var(--text-faint); font-size: 0.8rem; }
.col-nowrap { white-space: nowrap; }
.col-truncate {
  max-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-muted);
}

/* ─── Status / empty states ──────────────────────────────────────────────────── */

.status-text {
  color: var(--text-faint);
  font-size: 0.875rem;
  margin-bottom: 0.75rem;
  min-height: 1.2em;
}
/* the same line, for a consequence the reader must not skim past */
.status-text.is-warning {
  color: var(--warning);
  background: var(--warning-bg);
  border-radius: 3px;
  padding: 0.4rem 0.5rem;
}

/* ─── Disclaimer banner — small muted notice above a table/section ── */

.disclaimer-banner {
  font-size: 0.8rem;
  color: var(--text-muted);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.5rem 0.75rem;
  margin-bottom: 0.75rem;
}

/* Toolbar row above a kit's detail */
.kit-checkout-row {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

/* ─── Collapsible side panel — the generic version of the fold, from back when NC Deploy had one
   of its own. NC Deploy's is .workspace-panel now, so this stands for the tabs that aren't
   workspaces and still stack a panel beside a list ─────────────────────────────────────────── */

.collapsible-panel {
  flex-shrink: 0;
  width: 320px;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  transition: width 0.15s ease;
}

.collapsible-panel.collapsed {
  width: 2.5rem;
}
.collapsible-panel.collapsed .collapsible-panel-header h4,
.collapsible-panel.collapsed .collapsible-panel-body {
  display: none;
}

.collapsible-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.5rem 0.6rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.collapsible-panel-header h4 {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-sub);
}

.collapsible-panel-body {
  padding: 1rem;
  overflow-y: auto;
}

.btn-collapse-panel {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 1rem;
  width: 1.5rem;
  height: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  flex-shrink: 0;
}
.btn-collapse-panel:hover {
  background: var(--row-hover);
  color: var(--text);
}

/* One collapsible level of a check-in diff (renderFieldChanges in utils.js) — every field/
   child-collection group folds independently, closed by default, so a deep change doesn't dump every
   nesting level expanded at once. Plain <div>s, not <details>/<summary> — a native disclosure marker
   kept rendering alongside .diff-nest-arrow no matter how it was CSS-suppressed, across every attempt,
   so there's now no native marker mechanism involved at all; checkout_ui.js wires the click-to-toggle. */
.diff-nest-summary {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  cursor: pointer;
  user-select: none;
}
.diff-nest-arrow {
  display: inline-block;
  width: 1rem;
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-faint);
  transition: transform 0.15s ease;
}
.diff-nest-arrow.open {
  transform: rotate(90deg);
}

/* One level of a check-in diff's <ul> (root or nested inside a .diff-nest) — each genuinely-nested
   level gets this same indent, so depth compounds naturally through ordinary DOM nesting. list-style:none
   throughout — a .diff-nest <li> gets its dropdown triangle instead, and a plain .diff-leaf <li> gets its
   own explicit ::before dot below (native list markers proved too unreliable across engines to trust here). */
.diff-list {
  margin: 0.25rem 0 0 1.25rem;
  font-size: 0.85rem;
  list-style: none;
}
.diff-leaf::before {
  content: '\2022';
  display: inline-block;
  width: 1rem;
  text-align: center;
  color: var(--text-faint);
}

/* Connective words/glyphs in a diff line (field label, "Updated"/"Added", arrows) — muted so the actual
   subject (an item's name, a value) stands out as the thing worth reading */
.diff-label, .diff-connector {
  color: var(--text-faint);
  font-weight: 400;
}
.diff-list strong {
  color: var(--text-sub);
  font-weight: 650;
}

.empty-state {
  /* in a flex shell it takes the room it is given, with the message centred in it · a no-op in a plain block */
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  place-content: center;
  text-align: center;
  padding: 3rem;
  color: var(--text-faint);
  background: var(--table-surface);
  border-radius: 6px;
  box-shadow: 0 1px 4px var(--shadow-md);
}
/* the derivatives sit inside something that already has a surface, so they drop the card look */
.empty-state--rail,
.empty-state--panel,
.empty-state--compact { background: none; box-shadow: none; border-radius: 0; }
/* a rail or tree with nothing in it · reads as one quiet row, so it opts out of filling and centring */
.empty-state--rail    { display: block; flex: none; text-align: left; padding: 0.6rem; font-size: 0.8rem; }
/* an inspector, board or dropdown with nothing to show · centred in the space it has */
.empty-state--panel   { padding: 2.2rem 0.5rem; font-size: 0.85rem; text-wrap: balance; }
/* a line inside a card or widget list */
.empty-state--compact { display: block; flex: none; text-align: left; padding: 0.5rem 0; font-size: 0.8rem; color: var(--text-muted); }

/* ─── Range slider ───────────────────────────────────────────────────────────── */

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  /* the input box is the grab target; the track pseudo-element below draws the 4px bar inside it.
     When the box itself was 4px the thumb only looked 14px — everything outside that 4px strip
     missed the control entirely, so the slider could barely be picked up. */
  height: 18px;
  background: transparent;
  outline: none;
  cursor: pointer;
  vertical-align: middle;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 2px;
  background: var(--border);
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  border: none;
  box-shadow: 0 1px 3px var(--shadow-md);
  margin-top: -5px;
}

input[type="range"]::-moz-range-track {
  height: 4px;
  border-radius: 2px;
  background: var(--border);
}

input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  border: none;
  box-shadow: 0 1px 3px var(--shadow-md);
}

input[type="range"]:focus-visible::-webkit-slider-thumb {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* ─── Shared overlay backdrop ────────────────────────────────────────────────── */

#loading-overlay,
.modal-overlay,
.login-overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ─── Loading overlay ────────────────────────────────────────────────────────── */

#loading-overlay {
  z-index: var(--z-toast);
}
#loading-overlay.hidden { display: none; }

.loading-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2rem 2.5rem;
  text-align: center;
  min-width: 240px;
}

.loading-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 0 auto 1rem;
}

.spinner-sm {
  display: inline-block;
  width: 11px;
  height: 11px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
  margin-right: 0.4rem;
}

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

@keyframes row-highlight-fade {
  0%   { background-color: var(--warning-highlight); }
  100% { background-color: transparent; }
}
.row-highlight { animation: row-highlight-fade 2.5s ease-out forwards; }

#loading-message {
  font-weight: 600;
  font-size: 0.95rem;
  margin: 0 0 0.25rem;
}
.loading-sub {
  font-size: 0.78rem;
  color: var(--text-faint);
  margin: 0;
}

/* ─── Modal ──────────────────────────────────────────────────────────────────── */

.modal-overlay {
  z-index: var(--z-panel);
}

.modal {
  background: var(--surface);
  border-radius: 8px;
  width: 520px;
  max-width: 95vw;
  box-shadow: 0 8px 32px var(--shadow-lg);
}
.modal-sm { width: 340px; }
.modal-lg { width: 820px; }
.modal-xl, .modal-point-editor { width: 1100px; max-width: 95vw; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem 0.75rem;
  border-bottom: 1px solid var(--border-light);
}
.modal-header h3 { font-size: 1rem; font-weight: 600; color: var(--text); }
/* A modal's heading · the flow it opens from in small capitals over the title, gone when there's none */
.modal-heading { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.modal-context { font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); }
.modal-context:empty { display: none; }
/* The Shared Modules prompt's scope line over its table */
.shared-modules-scope { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; font-size: 0.8rem; margin-bottom: 0.75rem; }

.modal-close {
  background: none;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  color: var(--text-faint);
  line-height: 1;
}
.modal-close:hover { color: var(--text-sub); }

.modal-body {
  padding: 1.25rem;
  max-height: 62vh;
  overflow-y: auto;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.25rem 1rem;
  border-top: 1px solid var(--border-light);
}
.modal-footer-right,
.modal-footer-left { display: flex; gap: 0.75rem; }
/* Held right even when a hidden Delete leaves it the footer's only child */
.modal-footer-right { margin-left: auto; }

/* The value editor, shared/modal_editor.js · a preview line across the top, the values on the left, the caller's section on the right */
.modal-editor .modal-body { padding: 0; font-size: 0.85rem; }
.me-preview { display: flex; flex-wrap: wrap; gap: 0.3rem 1.4rem; align-items: baseline; padding: 0.6rem 1.25rem; font-size: 0.8rem; color: var(--text-muted);
  background: color-mix(in srgb, var(--surface-deep) 35%, var(--surface)); border-bottom: 1px solid var(--border-light); }
.me-preview:empty { display: none; }
.me-preview b { color: var(--text); font-size: 0.95rem; }
.me-preview .me-to, .me-preview .me-to b { color: var(--chart-flagged); }
.me-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1.6rem; padding: 1.1rem 1.25rem; }
.me-values { display: flex; flex-direction: column; gap: 1rem; min-width: 0; }
.me-extra { display: flex; flex-direction: column; gap: 0.45rem; min-width: 0; border-left: 1px solid var(--border-light); padding-left: 1.6rem; }
.me-extra:empty { display: none; }
@media (max-width: 720px) {
  .me-cols { grid-template-columns: minmax(0, 1fr); }
  .me-extra { border-left: 0; padding-left: 0; border-top: 1px solid var(--border-light); padding-top: 1rem; }
}
/* one value's control · the same for every value an editor holds */
.me-value { display: flex; flex-direction: column; gap: 0.45rem; }
.me-label { font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); }
.me-val { display: flex; align-items: center; gap: 0.5rem; }
.me-val input { width: 4.5rem; font: inherit; font-size: 0.95rem; padding: 0.1rem 0.3rem; border: 1px solid var(--chart-flagged); border-radius: 4px; background: var(--surface-deep); color: var(--text); }
.me-note { font-size: 0.75rem; color: var(--text-muted); }
.me-slider { position: relative; height: 34px; }
.me-slider svg { position: absolute; inset: 0; width: 100%; height: 34px; }
.me-slider input[type="range"] { position: absolute; left: 0; right: 0; top: 4px; width: 100%; margin: 0; background: transparent; accent-color: var(--chart-flagged); }
.me-mark--committed { stroke: var(--primary); stroke-width: 1; }
.me-mark--default { stroke: var(--text-muted); stroke-width: 1; stroke-dasharray: 2 1.5; }
.me-snaps { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.me-snap { font: inherit; font-size: 0.72rem; border: 1px solid var(--border); background: var(--surface); color: var(--text-sub, var(--text)); border-radius: 10px; padding: 0.05rem 0.5rem; cursor: pointer; }
.me-snap:hover, .me-snap:focus-visible { border-color: var(--chart-flagged); color: var(--chart-flagged); outline: none; }

/* The box a confirm waits on before its yes wakes, set off from the list above it */
.confirm-agree {
  display: flex;
  gap: 0.45rem;
  align-items: flex-start;
  margin-top: 0.9rem;
  padding-top: 0.7rem;
  border-top: 1px solid var(--border-light);
  font-weight: 600;
  cursor: pointer;
}

.modal-error {
  margin-top: 0.75rem;
  padding: 0.6rem 0.75rem;
  background: var(--danger-bg);
  border: 1px solid var(--danger-border);
  border-radius: 4px;
  color: var(--danger);
  font-size: 0.85rem;
  font-weight: 600;
}

/* ─── Form fields ────────────────────────────────────────────────────────────── */

.form-section-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-faint);
  margin: 1rem 0 0.4rem;
}

.form-section-title,
.info-section-title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text);
  padding: 0.75rem 0 0.3rem;
  border-bottom: 2px solid var(--primary);
  margin-bottom: 0.75rem;
}
.info-section-title { padding: 0.6rem 0 0.2rem; margin-bottom: 0.2rem; }

.form-field { margin-bottom: 0.9rem; }

/* The parent chain under a Level/Parent pair · structure in place of a sentence explaining it */
.part-crumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem;
  padding-top: 0.25rem;
  font-size: 0.7rem;
  color: var(--text-muted);
}
.part-crumb i { font-style: normal; opacity: 0.5; }
.part-crumb .is-current { color: var(--text); font-weight: 600; }
.part-crumb:empty { display: none; }

/* The step that appears when a new parent needs a parent of its own */
.parent-step {
  border-left: 2px solid var(--primary);
  padding-left: 0.6rem;
  margin-left: 0.2rem;
}
.parent-step > label { color: var(--primary); font-weight: 600; }
/* a field that takes the whole form-grid row · the class the inline grid-column:span 2 / 1/-1 styles become */
.form-grid > .form-field--full { grid-column: 1 / -1; }

.form-field label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* De-emphasized aside inside a .form-field label — e.g. "(hold Ctrl to select multiple)" */
.label-hint {
  font-weight: 400;
  color: var(--text-faint);
}

.form-field input[type="text"],
.form-field input[type="number"],
.form-field input[type="date"],
.form-field input[type="time"],
.form-field select,
.form-field textarea {
  width: 100%;
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 0.875rem;
  background: var(--bg);
  color: var(--text);
}
.form-field textarea { font-family: inherit; resize: vertical; }
.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus { outline: none; border-color: var(--primary); }

/* Read-only counterpart to a .form-field input/select — same box weight (border + --bg fill)
   so a view/edit toggle (e.g. change Request/Order) doesn't flatten into bare text against
   the surrounding panel when not editable. */
.form-field .field-value {
  width: 100%;
  min-height: 1.9rem;
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 0.875rem;
  background: var(--bg);
  color: var(--text);
  box-sizing: border-box;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 1rem;
}

/* A .form-field that should span both .form-grid columns */
.form-field-wide { grid-column: span 2; }

.form-checks {
  display: flex;
  gap: 1.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border-light);
  margin-top: 0.5rem;
}
.form-checks label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.875rem;
  color: var(--text-muted);
  cursor: pointer;
}

/* ─── Info grid ──────────────────────────────────────────────────────────────── */

.info-grid {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.info-row {
  display: flex;
  justify-content: space-between;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border-light);
}

.info-label { font-weight: 600; color: var(--text-muted); }
.info-value { color: var(--text-sub); }

.info-block {
  font-size: 0.8rem;
  color: var(--text-sub);
  line-height: 1.5;
  padding: 0.5rem 0.75rem;
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
}

/* ─── Login card ─────────────────────────────────────────────────────────────── */

.login-overlay {
  z-index: var(--z-login);
}

.login-card {
  background: var(--surface);
  border-radius: 10px;
  width: 340px;
  max-width: 95vw;
  padding: 2rem;
  box-shadow: 0 8px 32px var(--shadow-lg);
  text-align: center;
}
.login-card .form-field label { text-align: left; }

.login-input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.875rem;
  background: var(--bg);
  color: var(--text);
  transition: border-color 0.15s;
  text-align: left;
}
.login-input:focus {
  outline: none;
  border-color: var(--navbar-bg);
  box-shadow: 0 0 0 2px rgba(26,26,46,0.12);
}

/* The card's other steps · a heading and a line saying what this step wants */
.login-code-title { font-size: 1rem; font-weight: 650; color: var(--text); margin-bottom: 0.3rem; }
.login-code-intro { font-size: 0.8rem; color: var(--text-muted); line-height: 1.5; margin-bottom: 1.1rem; }
.login-code-input { text-align: center; letter-spacing: 0.4em; font-size: 1.1rem; }
/* the small text links under the button · Forgot password, Resend, Back */
.login-links { display: flex; justify-content: center; gap: 0.5rem; margin-top: 0.9rem; font-size: 0.75rem; color: var(--text-faint); }
/* good news the card carries between steps, e.g. a link sent or a password changed */
.login-notice { font-size: 0.8rem; color: var(--success); margin-bottom: 0.5rem; text-align: center; }
.login-notice:empty { display: none; }

.login-error {
  font-size: 0.825rem;
  color: var(--danger);
  min-height: 1.2em;
  margin-bottom: 0.5rem;
  text-align: center;
}

/* The Allow step · who is signing in, then where the code goes and what it reads, each as a chip row */
.login-consent-who { display: flex; align-items: center; gap: 0.6rem; text-align: left; padding: 0.6rem 0.75rem; border: 1px solid var(--border-light); border-radius: 6px; margin-bottom: 1rem; }
.login-consent-who-text { min-width: 0; }
.login-consent-who-name { font-size: 0.85rem; font-weight: 600; color: var(--text); line-height: 1.2; }
.login-consent-who-sub { font-size: 0.72rem; color: var(--text-muted); overflow-wrap: anywhere; }
.login-consent-who .link-button { margin-left: auto; font-size: 0.72rem; flex-shrink: 0; }
.login-consent-reach { display: grid; gap: 0.4rem; text-align: left; margin-bottom: 1.2rem; }
.login-consent-reach-label { font-size: 0.8rem; font-weight: 500; color: var(--text-muted); }
.login-consent-reach-chips { display: flex; flex-wrap: wrap; gap: 0.35rem; }

/* ─── Palette items ──────────────────────────────────────────────────────────── */

.prod-palette-item,
.pkg-palette-item,
.bom-palette-item {
  font-size: 0.8rem;
  cursor: grab;
  border-radius: 4px;
  background: var(--surface-deep); /* inset against the --surface panel, not flush with it */
  user-select: none;
  transition: background 0.1s, border-color 0.1s;
}

/* ─── Palette sidebars ───────────────────────────────────────────────────────── */

.prod-file-palette,
.pkg-palette,
.bom-part-palette {
  border-radius: 6px;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 9.5rem; /* floor beneath the ResizeObserver max-height sync so the list stays at ~2 items */
}

/* Searchable combobox archetype — see static/js/shared/combo.js; markup: .combo > .combo-input-wrap > (.combo-input + optional .combo-clear), .combo-panel */

.combo { position: relative; }
.combo--md { width: 220px; }
.combo--sm { width: 9.5rem; }  /* for a row carrying several combos at once, e.g. a path bar's drill */
.combo--rev { width: 5.5rem; }  /* the two halves of a revision, which hold a letter and a number */
/* a combo in a filter row is sized by its wrapper, not by the 220px floor a bare search box gets */
.filter-row .combo .combo-input { min-width: 0; }

.combo-input-wrap { position: relative; display: flex; align-items: center; }

.combo-input {
  width: 100%;
  box-sizing: border-box;
  padding: 0.45rem 2rem 0.45rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.875rem;
  font-family: inherit;
}
.combo-input:focus { outline: none; border-color: var(--primary); }

.combo-clear {
  position: absolute;
  right: 0.35rem;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  border: none;
  background: none;
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}
.combo-clear:hover { background: var(--row-hover); color: var(--danger); }
.combo.is-selected .combo-clear { display: flex; }

.combo-panel {
  position: absolute;
  top: calc(100% + 3px);
  left: 0;
  right: 0;
  z-index: var(--z-dropdown);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
  max-height: 220px;
  overflow-y: auto;
  list-style: none;
  margin: 0;
  padding: 4px;
  display: none;
}
.combo-panel.is-open { display: block; }

/* Always-open, in-flow variant — same row styling, but a permanent pick-list rather than a dropdown
   over the input (a wizard step picking one record from a short list, with nothing to overlay) */
.combo-panel--static {
  position: static;
  display: block;
  box-shadow: none;
  margin-top: 0.4rem;
  max-height: 240px;
}

.combo-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.55rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--text);
}
.combo-row:hover, .combo-row.is-active { background: var(--row-hover); }
.combo-row.is-empty { color: var(--text-muted); cursor: default; font-style: italic; }
.combo-row.is-empty:hover { background: transparent; }
/* Group heading inside the panel — carries .group-label too, so it reads as the same heading the index uses; only the spacing is the panel's */
.combo-row.is-heading { cursor: default; margin: 0.4rem 0 0.1rem; padding: 0 0.55rem; }
.combo-row.is-heading:first-child { margin-top: 0; }
.combo-row.is-heading:hover { background: transparent; }
.combo-row.is-disabled { color: var(--text-muted); cursor: default; }
.combo-row.is-disabled:hover { background: transparent; }
.combo-row-reason { color: var(--text-faint); font-size: 0.85em; margin-left: 0.35rem; }
.combo-row .sub { color: var(--text-muted); font-size: 0.75rem; margin-left: auto; }

/* Popover — a .combo-panel positioned under a toolbar button, kept inside the viewport; see shared/popover.js */
.popover { position: relative; display: inline-flex; }
/* Columns menu — .combo-panel/.combo-row derivative listing one tickable row per parameter column; see shared/popover_columns.js */
.column-menu-panel {
  left: auto;
  right: 0;
  min-width: 14rem;
  max-height: 320px;
}
/* Action menu — the same anchored panel, rows that run something rather than tick a column */
.action-menu-panel { left: auto; right: 0; min-width: 22rem; max-width: min(30rem, 90vw); }  /* wide, so a row's hint reads on one line instead of wrapping into three */
.action-menu-row {
  width: 100%;
  background: none;
  border: 0;
  text-align: left;
  color: inherit;
  font: inherit;
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
}
.action-menu-row:disabled { opacity: 0.5; cursor: default; }
/* icon column, so a row with a hint keeps its glyph beside the label rather than above it */
.action-menu-icon { flex: none; display: inline-flex; align-items: center; color: var(--text-muted); padding-top: 0.1rem; }
.action-menu-text { display: flex; flex-direction: column; gap: 0.05rem; min-width: 0; }
.action-menu-text .sub { color: var(--text-faint); font-size: 0.75rem; white-space: normal; }
.column-menu-row { cursor: pointer; }
.column-menu-row input { margin: 0; accent-color: var(--primary); }
.column-menu-count { color: var(--text-faint); font-variant-numeric: tabular-nums; }
.column-menu-actions {
  display: flex;
  gap: 0.3rem;
  border-top: 1px solid var(--border-light);
  margin-top: 0.25rem;
  padding-top: 0.3rem;
}
.column-menu-action {
  flex: 1;
  background: none;
  border: none;
  font: inherit;
  font-size: 0.78rem;
  color: var(--text-muted);
  padding: 0.28rem 0.4rem;
  border-radius: 4px;
  cursor: pointer;
}
.column-menu-action:hover { background: var(--row-hover); color: var(--text); }

/* Chip row for bindComboMulti (shared/combo.js) — sits below the .combo input, one .combo-chip per pick */
.combo-chips { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.4rem; }
.combo-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.3rem 0.2rem 0.55rem;
  border-radius: 999px;
  background: var(--row-hover);
  color: var(--text);
  font-size: 0.8rem;
}
/* Muted qualifier on a chip or row — disambiguates names that repeat across models */
.combo-chip-ctx { color: var(--text-muted); }
.combo-chip-ctx::after { content: ' \00B7'; }
.combo-row-ctx { color: var(--text-muted); font-size: 0.72rem; margin-left: auto; padding-left: 0.5rem; }
/* A subject's kind, as the glyph BOM's tab for that kind wears · ahead of its name wherever a change names it */
.subject-kind { display: inline-flex; vertical-align: -0.15em; margin-right: 0.35rem; color: var(--text-muted); }
.subject-kind svg { width: 0.9rem; height: 0.9rem; }
.combo-chip-remove {
  border: none;
  background: none;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.combo-chip-remove:hover { background: var(--surface); color: var(--danger); }

/* ── Icon + label pairs ───────────────────────────────────────────────────────
   `<span class="icon-slot" data-icon>` beside `<span data-label>` is the same
   structure in every tab header and path bar. The slot is a flex box so its SVG
   can't sit on the text baseline and pick up descender space, and the spacing
   between them comes from the parent's own gap — never a margin declared here,
   which is what let it drift per context.
   ─────────────────────────────────────────────────────────────────────────── */
.icon-slot {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}
.icon-slot svg { display: block; }
[data-label] { margin: 0; }


/* ── Subtabs ──────────────────────────────────────────────────────────────────
   Every tab's inner tab strip. Underline rather than folder tabs: the active
   marker is one line under the label, so a strip reads as a row of choices
   instead of a stack of boxes fighting the panel edge below it.
   ─────────────────────────────────────────────────────────────────────────── */
.tab-bar {
  display: flex;
  gap: 0.1rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}
.tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.8rem;
  font-size: 0.8rem;
  font-weight: 600;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;  /* the underline sits on the strip's own rule rather than above it */
  cursor: pointer;
  color: var(--text-muted);
  letter-spacing: 0.02em;
  transition: color 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.tab-btn .icon-slot svg { opacity: 0.85; }  /* the flex/shrink half is the base .icon-slot rule's job now */
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--text); border-bottom-color: var(--primary); }
/* a count riding a tab's label — dimmer than the label, so the strip still reads as words first */
.tab-btn .count { font-size: 0.72rem; font-weight: 600; color: var(--text-faint); font-variant-numeric: tabular-nums; }
.tab-btn.active .count { color: var(--text-muted); }


/* ── Workspace archetype ──────────────────────────────────────────────────────
   A tab that owns the viewport: one path bar, then a rail beside a pane. Add
   `is-workspace` to the tab-panel and use these classes — Nest Studio and BOM
   are both derivatives, so a third tab of this shape reuses them, never copies.
   ─────────────────────────────────────────────────────────────────────────── */

/* ── Full-bleed tab · the archetype for any tab that owns the viewport instead of scrolling in it ──
   The inset itself isn't this class's job — .tab-panel in base.css gives every tab the same one,
   so a scrolling page and a full-bleed workspace sit the same distance off the edge. All this adds
   is the height contract: the panel is exactly the viewport minus the nav bar and never scrolls as
   a whole, so the scrolling happens in a rail or a pane inside it.
   Declare it in markup as class="tab-panel is-fullbleed"; add a derivative class for what goes
   inside. Anything needing "the rest of the screen" measures from --navbar-h, never a bare 52px. */
.tab-panel.is-fullbleed.active {
  height: calc(100vh - var(--navbar-h));  /* the shared inset is inside that height */
  overflow: hidden;
}

/* Workspace · a full-bleed tab laid out as a path bar above a rail/pane/panel row */
.tab-panel.is-workspace.active {
  display: flex;
  flex-direction: column;
}

/* The one row carrying position and actions, in place of a page header */
.pathbar {
  flex: none;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.25rem;
  margin-bottom: 0.6rem;
  border-bottom: 1px solid var(--border);
}
/* the tab's icon + label is itself a path segment, so it takes a segment's exact padding — without
   it the label sat flush while everything after the first separator was inset by 0.4rem */
.pathbar-root {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.4rem;
  /* the tab is context you already chose, so it sits quieter than the workspace segment beside it */
  font-weight: 500;
  color: var(--text-faint);
}
/* The root segment is the workspace selector (shared/workspace_switcher.js) · same control as every
   other segment, only weighted like the anchor of the trail it is */
.pathbar-workspace { font-weight: 700; color: var(--text); max-width: 11rem; }

.pathbar-sep { color: var(--text-faint); }
.pathbar-spacer { margin-left: auto; }

/* The working-change chip (changes/working_change.js), right after the chrome slot on every tab that edits product data */
.working-change { display: inline-flex; align-items: center; gap: var(--space-2); }
.working-change .chip.is-link { cursor: pointer; }

/* A tab with no working change reads only · every control marked edit-only goes */
.is-readonly [data-edit-only],
.is-readonly [data-sheet-edit-only] { display: none !important; }
/* actions never stretch or shrink, so the row stays one line however deep the trail gets */
.pathbar .btn-icon,
.pathbar .btn-secondary { flex: none; }
/* A wrapper that exists only for JS to address. display:contents dissolves its box, so its
   children become the path bar's own flex items — one row, not a row inside a row. */
.pathbar-group { display: contents; }

/* One path segment, whether it's a select you change or a crumb you click back to */
.pathbar-select,
.pathbar .crumb {
  appearance: none;
  border: 1px solid transparent;
  background-color: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.2rem 0.4rem;
  border-radius: var(--radius-sm);
  max-width: 14rem;
}
.pathbar-select:hover:not(:disabled),
.pathbar .crumb:not(.crumb--current):hover { border-color: var(--border); background-color: var(--surface); color: var(--text); }
.pathbar-select:disabled { color: var(--text-faint); }
.pathbar-select--rev { max-width: 5.5rem; font-variant-numeric: tabular-nums; }
/* A select's open list paints from the theme, never the select's own background · a transparent select like this one dropped to the browser's white list whenever it opened without hover */
select option, select optgroup { color: var(--text); background-color: var(--surface); }
/* a select needs room for its chevron, drawn rather than pulled in as an asset */
.pathbar-select {
  padding-right: 1.15rem;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-muted) 50%),
                    linear-gradient(135deg, var(--text-muted) 50%, transparent 50%);
  background-position: right 0.58rem center, right 0.35rem center;
  background-size: 0.24rem 0.24rem, 0.24rem 0.24rem;
  background-repeat: no-repeat;
}
/* the trail inside a path bar is segments, not the standalone card .drill-header paints */
.pathbar .drill-breadcrumb { gap: 0.1rem; }
.pathbar .crumb-sep { margin: 0; color: var(--text-faint); }

/* A searchable combo standing in for a path segment, where the level has too many values to
   pick from a select. Wears .pathbar-select's metrics so a typed segment and a chosen one
   read as the same control; the panel it drops keeps .combo-panel's own styling. */
.pathbar .combo-input {
  padding: 0.2rem 1.5rem 0.2rem 0.4rem;
  font-size: 0.9rem;
  font-weight: 600;
  border-color: transparent;
  background-color: transparent;
}
.pathbar .combo-input:hover { border-color: var(--border); background-color: var(--surface); }
.pathbar .combo-input::placeholder { color: var(--text-faint); font-weight: 600; }
.pathbar .combo-clear { right: 0.2rem; }

/* A short field living among the actions — naming or narrowing, not navigating.
   Bordered rather than transparent, since unlike a segment it's asking to be used, not read. */
.pathbar-input {
  flex: none;
  width: 11rem;
  padding: 0.25rem 0.45rem;
  font-size: 0.85rem;
  background: var(--bg);
}
/* a select sizes to its own options rather than to a text field's width, and keeps room for its chevron */
select.pathbar-input { width: auto; max-width: 11rem; padding-right: 1.4rem; }

/* Two selects the reader takes as one value — a revision's external.internal, joined by the same
   dot utils.js's revisionLabel() writes, so the path bar and every table cell read alike. */
/* A path segment is as wide as what it says · combo--sm/--rev are fixed widths meant for a filter row,
   which in a trail either clip a model name or leave a gap after a revision number. The input carries
   a size attribute set from its own text (shared/drill.js), so the width follows the content. */
.pathbar-combo { width: auto; max-width: 18rem; }
.pathbar-combo .combo-input { width: auto; min-width: 0; }

.pathbar-pair { display: flex; align-items: center; gap: 0.05rem; }
.pathbar-pair-joiner { color: var(--text-muted); font-weight: 700; }

/* A segment you can let go of · the × is .combo-clear's, sitting beside the select rather than over
   it, since a select already draws its chevron in that corner */
.pathbar-clearable { display: inline-flex; align-items: center; }
.pathbar-clear {
  flex: none;
  width: 16px;
  height: 16px;
  margin-left: 0.05rem;
  padding: 0;
  border: none;
  background: none;
  color: var(--text-faint);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}
.pathbar-clear:hover { background: var(--row-hover); color: var(--danger); }


.workspace {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr);  /* 1fr not auto, so the row fills and may shrink below content */
  gap: 0.75rem;
  transition: grid-template-columns 0.15s ease;
  /* A derivative declares its two widths and builds its columns out of --rail-col/--panel-col; the
     fold swaps whichever one it owns for the spine, so both folds come from one pair of rules
     rather than every derivative writing out four column sets. */
  --rail-w: 12rem;
  --panel-w: 20rem;
  --spine-w: 2.25rem;
  --rail-col: var(--rail-w);
  --panel-col: var(--panel-w);
}
/* The grab edge of a resizable column — sits on the boundary it moves, and widens invisibly so
   a 4px line is not the whole target */
.workspace-resize {
  position: absolute; top: 0; bottom: 0; width: 6px;
  cursor: ew-resize; background: transparent; border: 0; padding: 0;
  z-index: var(--z-local-badge);
}
/* a wider invisible grab area, since 6px of edge is a poor target */
.workspace-resize::before { content: ""; position: absolute; top: 0; bottom: 0; left: -4px; right: -4px; }
/* the grip is always visible — a handle nobody can see is a handle nobody finds */
.workspace-resize::after {
  content: ""; position: absolute; top: 50%; left: 1px;
  width: 4px; height: 2.5rem; margin-top: -1.25rem;
  border-radius: 2px; background: var(--border);
  transition: background 0.15s;
}
.workspace-resize:hover::after, .workspace-resize.is-dragging::after { background: var(--primary); }
.workspace-panel > .workspace-resize { left: 0; }
.workspace-rail  > .workspace-resize { right: 0; }
/* a folded column is a spine, and a spine has no width worth dragging */
.workspace.rail-collapsed .workspace-rail > .workspace-resize,
.workspace.panel-collapsed .workspace-panel > .workspace-resize { display: none; }

.workspace.rail-collapsed  { --rail-col: var(--spine-w); }
.workspace.panel-collapsed { --panel-col: var(--spine-w); }

/* Folded, a rail or panel keeps only its chevron: the head row stays so the button holds its place,
   whatever sits beside it goes, and the body goes with it. */
.workspace.rail-collapsed .workspace-rail-head > :not(.btn-collapse-panel),
/* everything else in a folded rail goes too · filter facets and a second heading, not only the body */
.workspace.rail-collapsed .workspace-rail > :not(.workspace-rail-head:has(> .btn-collapse-panel)),
.workspace.panel-collapsed .workspace-panel-head > :not(.btn-collapse-panel),
.workspace.panel-collapsed .workspace-panel > :not(.tab-bar):not(.workspace-panel-head),
.workspace.panel-collapsed .workspace-panel .tab-btn { display: none; }
.workspace.rail-collapsed .workspace-rail-head,
.workspace.panel-collapsed .workspace-panel-head { padding: 0.4rem 0.25rem; justify-content: center; }
.workspace.panel-collapsed .workspace-panel .tab-bar { padding: 0.25rem; border-bottom: none; }
/* the chevron sits at the end of whatever row it lives in — a rail head spaces it there already */
.workspace-panel .btn-collapse-panel { margin-left: auto; align-self: center; }

/* a docked pane folded by its own toggle (data-collapse="self") · down to the spine, its toggle the one thing left */
[data-resizable].self-collapsed { width: 2.25rem !important; min-width: 0; overflow: hidden; }
[data-resizable].self-collapsed > :not(:has(> .btn-collapse-panel)),
[data-resizable].self-collapsed > :has(> .btn-collapse-panel) > :not(.btn-collapse-panel) { display: none; }
[data-resizable].self-collapsed > :has(> .btn-collapse-panel) { justify-content: center; padding-inline: 0; }
/* a second control rides beside the first · two margin-left:autos would strand the earlier one mid-bar */
.workspace-panel .btn-collapse-panel ~ .btn-collapse-panel { margin-left: 0.15rem; }

/* Arrival origin / return only. The path bar already says where you are, so this row is earned by
   having come from somewhere that wants you back — the Documents launcher, today. */
.workspace-return-crumbs { flex: none; display: flex; align-items: center; margin: 0 0 0.6rem; }

@media (prefers-reduced-motion: reduce) {
  .workspace { transition: none; }
}

/* One panel treatment for every column beside the content, so two can't sit side by side with
   different border widths and radii */
.workspace-rail,
.workspace-panel {
  position: relative;  /* the resize handle pins to this edge */
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
}
/* head above a scrolling body, for the rail and for a side panel alike — both fold to the same spine */
.workspace-rail,
.workspace-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
/* .workspace-panel-head is for a side panel carrying one section rather than a tab band — same row
   as the rail's, so a rail and a panel beside it read as one family */
.workspace-rail-head,
.workspace-panel-head {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.4rem 0.6rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.workspace-rail-body { flex: 1; min-height: 0; overflow: auto; padding: 0.25rem; }

/* A row that groups rather than names a thing, so it reads as a label — BOM's tree and Documents' kinds both use it, so it belongs here rather than in one tab's file */
.workspace-row.is-branch {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.workspace-panel-body { flex: 1; min-height: 0; overflow-y: auto; padding: 0.8rem; display: flex; flex-direction: column; gap: 0.7rem; }

/* What a side panel is made of — Documents, Accounting and Workers all show the same four shapes:
   a title, some labelled fields, a read-only meta list, and the line before anything is selected.
   A fifth inspector uses these rather than drawing its own. */
.panel-title { font-size: 0.98rem; font-weight: 650; text-wrap: balance; }
.panel-empty {
  color: var(--text-faint);
  text-align: center;
  padding: 2.2rem 0.5rem;
  font-size: 0.85rem;
  text-wrap: balance;
}
/* a small heading inside the body, for a panel carrying more than one run of content */
.panel-sub {
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.panel-field { display: flex; flex-direction: column; gap: 0.2rem; }
/* Two short fields share a line · minmax(0) so a wide input shrinks to its half instead of pushing past the panel */
.panel-field-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.6rem; }
.panel-field > label { font-size: 0.66rem; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: var(--text-faint); }
.panel-field input:disabled,
.panel-field select:disabled { opacity: 0.5; cursor: not-allowed; }
/* read-only pairs — label left, value right, hairlines top and bottom */
.panel-meta {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.3rem 0.9rem;
  margin: 0;
  font-size: 0.82rem;
  padding: 0.6rem 0;
  border-top: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border-light);
}
.panel-meta dt { color: var(--text-faint); }
.panel-meta dd { margin: 0; color: var(--text-sub); text-align: right; }
/* pinned to the bottom, out of the way of the values above them */
.panel-actions { margin-top: auto; }
/* the small print under a field — where a value comes from, or what changing it also changes */
.panel-note { font-size: 0.76rem; color: var(--text-faint); line-height: 1.4; margin: 0; }

/* One rail row — label, optional sub-label, count pushed right */
.workspace-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.4rem;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
}
.workspace-row:hover { background: var(--row-hover); }
.workspace-row.is-current { background: var(--primary); color: var(--on-primary); font-weight: 700; }
.workspace-row-label { overflow: hidden; text-overflow: ellipsis; }
.workspace-row-sub { font-size: 0.7rem; color: var(--text-faint); font-variant-numeric: tabular-nums; }
.workspace-row-count { margin-left: auto; padding-left: 0.4rem; font-size: 0.68rem; color: var(--text-faint); font-variant-numeric: tabular-nums; }
/* badges a row carries, e.g. the revisions of a build's kits — they sit with the label, not pushed right like the count */
.workspace-row-chips { display: inline-flex; gap: 0.15rem; flex: none; }
.workspace-row-chips .chip { font-size: 0.62rem; padding: 0.05rem 0.35rem; }
.workspace-row.is-current .workspace-row-sub,
.workspace-row.is-current .workspace-row-count { color: var(--on-primary); opacity: 0.8; }

/* A structure tree's twisty (shared/structure_tree.js) · its own target for opening a node without navigating into it, so it gets a real one */
.structure-tree-twisty {
  flex: none;
  width: 1.1rem;
  margin: -0.22rem 0;
  padding: 0.22rem 0;
  font-size: 0.6rem;
  color: var(--text-muted);
  text-align: center;
}
.workspace-row.is-current .structure-tree-twisty { color: var(--on-primary); }
/* a tree row the Active only toggle would hide, when it's showing anyway */
.workspace-row.is-dim .workspace-row-label { color: var(--text-faint); }
/* A short facet of a filter rail · its label over one wrapping line of toggles (filter_rail.js renderFilterToggles), the pick filled like a current row */
.filter-facet { flex: none; padding: 0.35rem 0.5rem 0.45rem; border-bottom: 1px solid var(--border); }
.filter-facet-label { font-size: 0.62rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 0.25rem; }
.filter-toggles { display: flex; flex-wrap: wrap; gap: 0.25rem; }
.filter-toggle { display: inline-flex; align-items: center; gap: 0.25rem; border: 1px solid var(--border); background: var(--surface); color: var(--text-sub);
  border-radius: 999px; padding: 0.05rem 0.45rem; font: inherit; font-size: 0.72rem; cursor: pointer; white-space: nowrap; }
.filter-toggle:hover { background: var(--row-hover); color: var(--text); }
.filter-toggle[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: var(--on-primary); font-weight: 600; }
.filter-toggle:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.filter-toggle .icon-slot svg { width: 11px; height: 11px; }
.filter-toggle-count { font-variant-numeric: tabular-nums; opacity: 0.75; }

/* a tree row that's gone but can come back, e.g. a module a Revision removed */
.workspace-row.is-struck .workspace-row-label { color: var(--text-faint); text-decoration: line-through; }

/* A cell that opens something, styled as text rather than a control, so it doesn't compete with the row's own actions */
.link-button {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  color: var(--primary);
  cursor: pointer;
  text-align: left;
}
.link-button:hover { text-decoration: underline; }
.text-faint { color: var(--text-faint); }

.workspace-pane { min-width: 0; min-height: 0; }

/* Pane chrome, one rhythm: subtabs, a toolbar row, then the table */
.workspace-pane .section-header {
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border-light);
}
.workspace-pane .section-header h3 {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.workspace-pane .section-header h3 svg { width: 0.85rem; height: 0.85rem; }
.workspace-pane .filter-row { gap: 0.4rem; margin: 0; }
.workspace-pane .status-text { font-size: 0.75rem; margin-bottom: 0.35rem; }
.workspace-pane .data-table { --pad-y: 0.35rem; --pad-x: 0.5rem; }
/* a pane's own action row — right-aligned icons, same vocabulary as the path bar's */
.pane-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.5rem;
}

/* A control standing in for the rail wherever the rail is hidden. A rail that *navigates* (BOM's
   tree, Nest Studio's sheets) can simply go, since the path bar still gets you anywhere; a rail
   that *filters* would take the filter with it, so its derivative puts one of these in the path
   bar instead. Hidden until the rail actually goes away. */
/* ── Parameter grid — PQP and the Design Specification, the two derivatives of
     shared/parameter_grid.js. Rail on the left as a jump list, grid on the right. ───────────── */

.parameter-grid-workspace { --rail-w: 13rem; --panel-w: 24rem; grid-template-columns: var(--rail-col) minmax(0, 1fr); }

/* ── Solid panel — the turnable 3D view in a workspace's panel column (solid_panel macro, shared/solid_panel.js) ── */
.workspace.has-solid { grid-template-columns: var(--rail-col) minmax(0, 1fr) var(--panel-col); }  /* only while something is in it, so the table keeps its width */
/* expanded, the table steps out and the panel takes the room · the viewers re-read their canvas size every frame */
.workspace.solid-expanded { grid-template-columns: var(--rail-col) minmax(0, 1fr); }
.workspace.solid-expanded > .workspace-pane { display: none; }
.workspace.solid-expanded .workspace-resize { display: none; }
.workspace.solid-expanded .solid-stage { height: 60vh; }
.solid-stage { height: 17rem; flex: none; }
/* The assembly ladder and the generated-from pills sit above the stage · both flex:none, so nothing they add comes out of the viewer's own 17rem */
.solid-ladder { flex: none; margin-bottom: 0.5rem; gap: 0.1rem; }
.solid-ladder .crumb-sep { margin: 0; color: var(--text-faint); }
.solid-ladder .crumb { display: inline-flex; align-items: center; gap: 0.3rem; }
.solid-ladder .crumb .icon-slot svg { display: block; opacity: 0.8; }
.solid-generated-from { flex: none; display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.5rem; }
.solid-generated-from-label { font-size: 0.72rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-muted); font-weight: 700; line-height: 1; }
.solid-generated-from .tab-btn { padding: 0.3rem 0.65rem; font-size: 0.75rem; }
/* a design model's feature tree under its solid · a sketch indents under the feature that uses it */
.solid-feature-tree { display: grid; gap: 0.35rem; font-size: 0.8rem; }
.solid-feature-tree ul { list-style: none; margin: 0; padding: 0; }
.solid-feature-tree li { display: flex; justify-content: space-between; gap: 0.75rem; padding: 0.15rem 0; border-bottom: 1px solid var(--border); }
.solid-feature-tree li.is-nested { padding-left: 1rem; }
/* the part panel's engraving · its text and the button that centres it, on one row under the model */
.solid-engraving { display: grid; gap: 0.35rem; margin-bottom: 0.75rem; }
.solid-engraving-row { display: flex; gap: 0.5rem; align-items: center; }
.solid-engraving-row input { flex: 1; min-width: 0; }
/* laying the layup out · an action row, so real buttons rather than the pills above it, which only switch a view */
.solid-assemble { flex: none; display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.5rem; }
.solid-assemble .btn-secondary { padding: 0.25rem 0.6rem; font-size: 0.75rem; }
/* Six columns do not fit a side panel at 29 members, so the list scrolls both ways · expanding the panel gives it the full width */
.solid-members-scroll { max-height: 16rem; overflow-y: auto; }
.solid-members-scroll .data-table { min-width: 22rem; }
/* one member's place in its parent, typed · narrow and tabular, so a column of them still reads as numbers */
.solid-offset-input {
  width: 100%; max-width: 5.2rem; padding: 0.15rem 0.3rem; font-size: 0.78rem;
  text-align: right; font-variant-numeric: tabular-nums; border-radius: 3px;
}
/* a member that does not start where the one before it finished · components in a layup are attached, so this is worth seeing */
.data-table tbody tr.joint-open td { background: var(--warning-bg); }
.data-table tbody tr.joint-open td:first-child { box-shadow: inset 3px 0 0 var(--warning); }
/* a member is a rung you can stand on, so its name reads as the way in · the row's own hover already says it is clickable */
.solid-member-name { color: var(--primary); font-weight: 500; }
/* a measured value further than a millimetre off its spec */
.param-off { color: var(--danger); font-weight: 600; }
/* the cube is an svg, so it sits on the button's box rather than a text baseline */
.btn-solid3d svg, .btn-nest3d svg { display: block; }
/* where the browsed part sits in its list, between the two steps */
.solid-panel-count { align-self: center; font-size: 0.72rem; color: var(--text-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
/* a grid's part name with its cube ahead of it */
.part-cell { display: inline-flex; align-items: center; white-space: nowrap; }
/* a segment sits under the component it was cut from · the rail is the cut, not decoration */
.part-cell--segment { padding-left: 1.15rem; position: relative; color: var(--text-muted); }
.part-cell--segment::before {
  content: "\2514"; position: absolute; left: 0.2rem; color: var(--border);
}
/* a value that belongs to another level, told apart from one that belongs here and is missing */
.param-not-here { color: var(--border); }

/* The path bar is the header while a grid is up, so the tab's own title block and type breadcrumb
   stand down rather than stacking a second one above it. */
.tab-panel.is-parameter-grid > .pathbar,
.tab-panel.is-parameter-grid > .section-sep,
.tab-panel.is-parameter-grid > .drill-header { display: none; }

/* the section fills the tab's flex column */
.tab-panel.is-parameter-grid > .parameter-grid-section {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* the pane is the scroller, so the table's sticky header pins against the pane and not the page */
.parameter-grid-pane {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  padding: 0.5rem 0.6rem;
}
.parameter-grid-pane .table-scroll {
  flex: 1;
  min-height: 0;
  margin-bottom: 0;
  border: none;
  border-radius: 0;
  background: none;
  box-shadow: none;
}
/* the wrapper keeps its flex:1 while only the table inside it is hidden, so it holds the room the
   empty state should be filling · stand it down whenever it has no visible table to scroll */
.parameter-grid-pane .table-scroll:has(> table.hidden) { flex: none; }
/* a cell typed or filled but not saved yet wears the same tint a staged Standards row does, until its save lands */
.parameter-grid-pane input.is-dirty { background: var(--warning-bg); }
/* the grey hint in an empty cell is the scan's measurement, not a value · faint and italic so it never reads as typed */
.parameter-grid-pane input::placeholder { color: var(--text-faint); font-style: italic; }
/* the product cell holds its draw mark, number and shared chip on one line */
.parameter-grid-pane td.ds-product { white-space: nowrap; }
/* a product row's marks sit in a fixed slot so the column lines up, and its parts read as one quiet line */
.parameter-grid-pane td.ds-marks { width: 1%; white-space: nowrap; }
.parameter-grid-pane .ds-mark-slot { display: inline-block; width: 1.5rem; }
.parameter-grid-pane td.ds-parts { white-space: nowrap; }
.parameter-grid-pane .ds-part-count { margin-left: 0.3rem; color: var(--text-faint); font-size: 0.75rem; }
/* a value the open change drafted · its live value sits under it, small and struck */
.parameter-grid-pane input.is-drafted { border-color: var(--info-color); background: var(--info-bg); }
.parameter-grid-pane .ds-was { display: block; font-size: 0.7rem; color: var(--text-faint); text-decoration: line-through; line-height: 1.1; }

/* the tick that says whether a build is in the grid — sized down so it rides the row rather than setting its height */
.workspace-row-check { flex: none; margin: 0; width: 0.85rem; height: 0.85rem; accent-color: var(--primary); cursor: pointer; }
/* unticked reads as absent, not as disabled — the row is still there to tick back */
.workspace-row--head.is-unticked .workspace-row-label,
.workspace-row--head.is-unticked .workspace-row-count { color: var(--text-faint); }

/* A rolled row stands for a run of parts rather than one — tinted like the standard badge that names it, and kept to one line so it holds a part row's height */
.data-table tbody tr.is-rolled > td { background: var(--export-bg); white-space: nowrap; }
/* the span a standard covers, beside its badge — the same notation expand_part_range() reads back */
.part-span { margin-left: 0.35rem; font-size: 0.78rem; color: var(--text-muted); font-variant-numeric: tabular-nums; }
/* a count standing in for a per-part value the rolled row can't show */
.rolled-count { font-size: 0.78rem; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.rolled-count.is-complete { color: var(--success); }

/* a build heads its own run of subkits, so it reads as a heading rather than another entry */
.workspace-row--head { font-weight: 600; color: var(--text); }
.workspace-row--head:not(:first-child) { margin-top: 0.35rem; }
.workspace-row--sub { padding-left: 1.15rem; font-size: 0.76rem; }

/* the path bar carries the whole action set here, so its controls sit at one compact size */
.pathbar .btn-primary,
.pathbar .btn-secondary { padding: 0.26rem 0.6rem; font-size: 0.78rem; }
.pathbar .checkout { flex: none; }
.pathbar .popover { flex: none; }

.workspace-rail-fallback { display: none; }
/* the phone's rail-sheet opener (shared/workspace_phone.js) · css/mobile/workspace.css is the only place that shows it */
.pathbar-rail-btn { display: none; }
/* the phone_view_only_note() chip · css/mobile/shell.css is the only place that shows it */
.phone-view-only-note { display: none; }

@media (max-width: 940px) {
  .tab-panel.is-workspace.active { height: auto; overflow-y: auto; }
  .workspace { grid-template-columns: minmax(0, 1fr) !important; }
  .workspace-rail { display: none; }
  .workspace-rail-fallback { display: inline-flex; }
}


/* ── Nest Studio ──────────────────────────────────────────────────────────────
   The one canvas tab in an app of table tabs, so it drops the page-header /
   filter-row / action-row stack: a single path bar carries the drill, the
   actions and the checkout state, then rail / canvas / inspector fill the rest.
   ──────────────────────────────────────────────────────────────────────────── */

/* Nest Studio carries three extra children in the flex column that BOM keeps inside its pane, so
   they're pinned to the same rhythm here: the two thin rows take no height beyond their content,
   and the empty state fills the workspace's slot instead of sitting in it as a padded card —
   otherwise selecting a module changed the column's whole vertical geometry. */
#eng-nests:not(.hidden) >#nests-drill-header,
#eng-nests:not(.hidden) >#nests-status { flex: none; margin: 0; }
#eng-nests:not(.hidden) >#nests-status:not(.hidden) { margin-bottom: 0.35rem; }
/* the empty state lives in the canvas pane now, so it fills that side while the rail keeps navigating beside it */
.nest-canvas-pane > #nests-viewer-empty { position: absolute; inset: 0; margin: 0; display: grid; place-items: center; }

/* with no module loaded only the canvas and the inspector stand down · the rail is how you pick a module, so it stays */
.nest-workspace.is-empty { grid-template-columns: var(--rail-col) minmax(0, 1fr) 0; }
.nest-workspace.is-empty .nest-viewer-wrap,
.nest-workspace.is-empty .nest-canvas-overlay,
.nest-workspace.is-empty .nest-inspector { display: none; }
.nest-path-rev { display: flex; align-items: center; gap: 0.05rem; }
.nest-path-rev-dot { color: var(--text-muted); font-weight: 700; }

/* Native selects dressed as path segments, so the existing drill JS is untouched */

/* rail / canvas / inspector — the columns are all this derivative adds to .workspace, and the rail takes BOM's and Production's width now that it carries the same tree */
.nest-workspace { --rail-w: 15rem; --panel-w: 22rem; grid-template-columns: var(--rail-col) minmax(0, 1fr) var(--panel-col); }

/* the dot is Nest Studio's own: sheet state has no equivalent in the archetype */
.nest-sheet-dot { width: 7px; height: 7px; border-radius: 50%; flex: none; background: var(--success); }
.nest-sheet-dot--warn { background: var(--warning); }
.nest-sheet-dot--nosize { background: transparent; border: 1px solid var(--text-muted); }
.workspace-row.is-current .nest-sheet-dot { background: var(--on-primary); border-color: var(--on-primary); }

.nest-canvas-pane { position: relative; min-width: 0; min-height: 0; }
/* Pinned to the pane rather than sized by percentages: the SVG's viewBox gives it an intrinsic
   aspect ratio, so any indefinite height makes a tall sheet compute taller than the window and
   clip. inset:0 hands it a definite box, and preserveAspectRatio then fits the whole sheet. */
.nest-viewer-wrap { position: absolute; inset: 0; margin: 0; }

/* Chrome floats over the drawing rather than stacking above it */
.nest-canvas-overlay {
  position: absolute;
  z-index: 1;
  display: flex; align-items: center; gap: 0.25rem;
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  border: 1px solid var(--border); border-radius: 6px;
  padding: 0.22rem 0.35rem;
  backdrop-filter: blur(4px);
}
.nest-overlay-find { top: 0.6rem; left: 0.6rem; padding: 0.18rem; }
.nest-overlay-nav { bottom: 0.6rem; right: 0.6rem; }
.nest-ov-btn { color: var(--text-muted); padding: 0 0.3rem; font-size: 0.95rem; line-height: 1.4; }
.nest-ov-btn:hover { color: var(--text); }

.nest-inspector { display: flex; flex-direction: column; min-height: 0; margin-bottom: 0; }
.nest-inspector-tabs { flex: none; }
/* the body carries the padding the card used to, so the tab strip can span the panel edge to edge */
.nest-inspector-body { flex: 1; min-height: 0; overflow-y: auto; padding: 0.6rem; }

/* the archetype already collapses the rail and lets the tab scroll; the canvas needs its own height */
@media (max-width: 940px) {
  .nest-canvas-pane { height: 60vh; }
  .nest-inspector { max-height: none; }
}
.nest-viewer-loading { height: 100%; display: flex; align-items: center; justify-content: center; gap: 0.5rem; }
.nest-sheet-svg { background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 1rem; box-sizing: border-box; }
.nest-part-outline {
  fill: var(--surface-deep); /* inset against the --surface sheet, not flush with it */
  stroke: var(--border); /* --text-muted is too faint to read as a shape edge */
  stroke-width: 1; /* bumped from 0.5 so the boundary stays visible */
  transition: filter 0.1s;
}
.nest-part-selectable { cursor: pointer; }
/* same glow whether the pointer is on the shape or on its row in the parts list */
.nest-part-selectable:hover .nest-part-outline,
.nest-part-selectable--hover .nest-part-outline { filter: drop-shadow(0 0 3px var(--primary)) drop-shadow(0 0 3px var(--primary)); }
.nest-part-selectable--selected .nest-part-outline { fill: var(--primary); fill-opacity: 0.25; stroke: var(--primary); stroke-width: 1.2; }
.nest-part-label { fill: var(--text); font-family: monospace; }
.nest-part-shaper { fill: var(--accent); font-family: monospace; }
.nest-part-label-group--draggable { cursor: grab; touch-action: none; }
.nest-part-label-group--dragging { cursor: grabbing; }
.nest-part-label-group--dragging .nest-part-label { fill: var(--primary); }
.nest-sheet-outline { fill: none; stroke: var(--primary); stroke-width: 1; stroke-dasharray: 6 4; }
.nest-file-combo { width: 10rem; }
.nest-position-label { min-width: 5.5rem; text-align: center; font-size: 0.8rem; font-variant-numeric: tabular-nums; color: var(--text-muted); }
.nest-part-base-outline { fill: none; stroke: var(--accent); stroke-width: 0.5; stroke-dasharray: 4 3; }
.nest-part-inset-line { stroke: #b91c1c; stroke-width: 2; }

/* Measured parts with no nest behind them · the list picks, the stage turns what it picked */
.nest-measured { position: absolute; inset: 0; display: grid; grid-template-columns: 11rem minmax(0, 1fr) 18rem; gap: 0.75rem; padding: 0.75rem; }
.nest-measured-rail { overflow-y: auto; }
.nest-measured-stage { min-height: 0; }
.nest-measured-side { display: flex; flex-direction: column; gap: 0.6rem; min-height: 0; overflow-y: auto; }
/* two sections rather than one run of rows, so a sheet fact is never mistaken for a part's */
.nest-measured-block { border: 1px solid var(--border); border-radius: 6px; background: var(--surface); }
.nest-measured-block-title { display: flex; justify-content: space-between; gap: 0.5rem; align-items: baseline;
  margin: 0; padding: 0.4rem 0.6rem; border-bottom: 1px solid var(--border);
  font-size: 0.7rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); }
.nest-measured-block-title span { font-family: monospace; font-size: 0.78rem; letter-spacing: 0;
  text-transform: none; font-weight: 500; color: var(--text); }
.nest-measured-block .nest-measured-facts { padding: 0.2rem 0.6rem 0.45rem; }
/* the picker is the one block that can outgrow its panel, so it scrolls inside itself */
.nest-measured-block--list { display: flex; flex-direction: column; min-height: 0; max-height: 16rem; }
.nest-measured-block--list .nest-pick-head { margin-top: 0; padding: 0.3rem 0.6rem 0.25rem; }
.nest-measured-block--list .nest-pick-list { overflow-y: auto; margin-bottom: 0.25rem; }
.nest-measured-subtitle { font-size: 0.75rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); }
/* its own list · .nest-parts-list is a three-column grid for the Sheet tab, which squeezed
   these single-button rows into its first column and wrapped them */
.nest-cut-order { display: grid; gap: 0.2rem; margin-bottom: 0.5rem; }
.nest-cut-order span { font-size: 0.68rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--text-muted); }
.nest-cut-order select { width: 100%; font-size: 0.78rem; padding: 0.2rem 0.3rem; }
.nest-pick-list { list-style: none; margin: 0 0 0.6rem; padding: 0; }
.nest-pick-head { display: flex; justify-content: space-between; gap: 0.5rem; padding: 0 0.45rem 0.25rem;
  margin-top: 0.2rem; border-bottom: 1px solid var(--border); font-size: 0.68rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); }
.nest-measured-pick { display: flex; align-items: baseline; justify-content: space-between; gap: 0.5rem;
  width: 100%; padding: 0.28rem 0.45rem; background: none; border: 0; border-left: 3px solid transparent;
  color: var(--text); font: inherit; text-align: left; cursor: pointer; }
/* the name leads and truncates rather than wrapping; what is on it trails and never moves */
.nest-pick-name { font-family: monospace; font-size: 0.82rem; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; min-width: 0; }
.nest-pick-seq { display: inline-block; min-width: 1.4rem; color: var(--text-muted); font-weight: 600; }
.nest-pick-meta { flex: none; font-size: 0.7rem; color: var(--text-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.nest-measured-pick.is-selected .nest-pick-meta { color: var(--text); }
.nest-measured-pick:hover { background: var(--surface-deep); }
.nest-measured-pick.is-selected { background: var(--surface-deep); border-left-color: var(--primary); }
.nest-measured-pick:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.nest-measured-facts { margin: 0; font-size: 0.78rem; }
.nest-measured-facts > div { display: flex; justify-content: space-between; gap: 0.5rem; padding: 0.22rem 0; border-bottom: 1px solid var(--border-light); }
.nest-measured-facts > div:last-child { border-bottom: 0; }
.nest-measured-facts dt { color: var(--text-muted); margin: 0; }
.nest-measured-facts dd { margin: 0; font-family: monospace; font-variant-numeric: tabular-nums; text-align: right; }
@media (max-width: 1200px) { .nest-measured { grid-template-columns: 12rem minmax(0, 1fr); } .nest-measured-side { grid-column: 1 / -1; flex-direction: row; } .nest-measured-block { flex: 1; } }
@media (max-width: 820px) { .nest-measured { grid-template-columns: 1fr; grid-template-rows: 10rem minmax(0, 1fr) auto; } }
/* 3D part stage — the solid is drawn on a canvas, the engraving is html sitting over it */
.stage3d { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.stage3d-canvas { display: block; width: 100%; height: 100%; cursor: grab; touch-action: none; }
.stage3d-canvas--dragging { cursor: grabbing; }
/* bottom-left, since the sheet pager overlay now owns bottom-right */
.nest-legend-box {
  position: absolute;
  left: 0.5rem;
  bottom: 0.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.4rem 0.6rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.nest-legend-swatch {
  display: inline-block;
  width: 1rem;
  height: 0;
  border-top: 2px solid;
  margin-right: 0.35rem;
  vertical-align: middle;
}
.nest-legend-swatch--surface { border-top-style: solid; border-top-color: var(--text-muted); }
.nest-legend-swatch--base { border-top-style: dashed; border-top-color: var(--accent); }
.nest-legend-swatch--sheet { border-top-style: dashed; border-top-color: var(--primary); }
.nest-legend-swatch--inset { border-top-style: solid; border-top-color: #b91c1c; }
.nest-legend-swatch--shaper { border-top-style: solid; border-top-color: var(--accent); }
/* border, radius and background all come from .workspace-panel, so this column can't drift from
   the rail beside it — it used to carry a 2px border and 8px radius against the rail's 1px and 6px */
.nest-file-info-card {
  overflow: hidden;  /* .nest-inspector-body does the scrolling, so the tab bar stays put */
  box-sizing: border-box;
}
/* the tab strip is this panel's head, padded like the rail's so the two columns share a rhythm */
.nest-file-info-card .tab-bar { margin: 0; padding: 0 0.6rem; }
/* Part / Shaper / Orientation share one grid so the three columns actually line up.
   Segment rides inside the Part cell as a muted chip, the way the Part tab already shows it */
.nest-parts-list-header,
.nest-parts-list li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 4.75rem 5.25rem;
  gap: 0.4rem;
  align-items: center;
}
.nest-parts-list-header {
  padding: 0 0.3rem 0.3rem;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
.nest-parts-list { list-style: none; margin: 0; padding: 0; }
.nest-parts-list li {
  padding: 0.35rem 0.3rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
  border-radius: 3px;
  cursor: pointer;
}
.nest-parts-list li:hover { background: var(--surface-deep); }
.nest-parts-list li.is-selected { background: color-mix(in srgb, var(--primary) 12%, transparent); }
.nest-parts-list li:last-child { border-bottom: none; }
.nest-parts-list .nest-part-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nest-parts-list .nest-part-name em { color: var(--text-faint); font-size: 0.8rem; }
.nest-parts-list .nest-part-segment { color: var(--text-muted); text-transform: capitalize; }
/* the only place the engraved shaper mark, F included, reads outside the drawing itself */
.nest-parts-list .nest-part-shaper-cell { text-align: right; color: var(--primary); font-weight: 600; }
.nest-parts-list .nest-part-shaper-cell.is-none { color: var(--text-faint); font-weight: 400; }
/* the orientation behind that F, readable even on a part with no angle set to carry one */
.nest-parts-list .nest-part-orient-cell {
  text-align: right;
  font-size: 0.78rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nest-parts-list .nest-part-orient-cell.is-none { color: var(--text-faint); }
.nest-parts-list-header span:nth-child(2),
.nest-parts-list-header span:nth-child(3) { text-align: right; }

/* Part tab parameter table — parameters run DOWN, entities across, so width stays bounded */
.nest-param-component { font-size: 0.8rem; color: var(--text-muted); margin: 0 0 0.4rem; }
.nest-param-wrap { overflow-x: auto; }
.nest-param-table th:first-child { text-align: left; font-weight: 600; white-space: nowrap; }
.nest-param-table td { text-align: right; font-variant-numeric: tabular-nums; }
/* transposed, so the leading cell is a value like the rest and declines the archetype's identity weight */
.data-table.nest-param-table td:first-child { color: var(--text-sub); font-weight: 400; }
.nest-param-table thead th { text-align: right; }
.nest-param-table thead th:first-child { text-align: left; }
.nest-param-table .nest-param-tol { color: var(--text-muted); }
.nest-param-table .is-selected { background: color-mix(in srgb, var(--primary) 12%, transparent); }

/* Layout utilities (column widths, common flex rows) — replaces repeated inline style="width:Npx" on table header/cells across templates */
.col-w-60  { width: 60px; }
.col-w-70  { width: 70px; }
.col-w-75  { width: 75px; }
.col-w-80  { width: 80px; }
.col-w-90  { width: 90px; }
.col-w-100 { width: 100px; }
.col-w-110 { width: 110px; }
.col-w-120 { width: 120px; }
.col-w-130 { width: 130px; }
.col-w-140 { width: 140px; }
.col-w-150 { width: 150px; }
.col-w-160 { width: 160px; }

/* Small inline flex row — icon + label groups, etc. */
.flex-row-sm { display: flex; align-items: center; gap: 0.4rem; }

/* Standard top gap for a form-grid/info-grid that follows a section header */
.section-gap-top { margin-top: 1rem; }
.section-gap-top-sm { margin-top: 0.5rem; }
.section-gap-top-lg { margin-top: 1.5rem; }

/* Same gap the other way, for a note that sits above the section it speaks for */
.section-gap-bottom-sm { margin-bottom: 0.5rem; }

/* Right-aligned inline button row — stage/view nav controls, etc. */
.inline-nav-right { margin-left: auto; display: flex; gap: 0.5rem; align-items: center; }

/* ─── Card habitat · the chooser view a tab opens on ──────────────────────────────────────────
   Grouped .card-grid runs and nothing else. The habitat owns its inset rather than inheriting one
   from whatever shell it happens to sit in, so a landing looks the same whether its tab is a plain
   scrolling panel (System, Quality) or a full-bleed workspace pane (Production) — before this,
   those two shells insetted a chooser by 80vw-centred and by 1.25rem respectively, which is why
   the same grid of cards read as two different pages.
   Wrap the groups in one of these; don't set margins on the grids themselves. */
.card-habitat {
  width: 100%;
  max-width: var(--tab-width);
  margin: 0 auto;
  padding: var(--space-2) 0 var(--space-5);
}

/* Chooser card — clickable "pick a sub-page" tile (icon + name + description); used across Production/Engineering/Design/Quality/Quote/System, not module-specific, hence living here */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15.5rem, 1fr)); /* auto-fill, not a fixed 2: System's 9-card group used to stretch into a tall narrow stack */
  gap: 0.7rem;
  max-width: 68rem;
  margin-top: 0.75rem;
}

/* Two columns: the icon holds the first and spans both rows, name and description share the second */
.card {
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 0.7rem;
  align-items: start;
  padding: 0.8rem 0.95rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.card:hover {
  border-color: var(--primary);
  box-shadow: 0 2px 10px var(--shadow-md);
}

.card--disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.card--disabled:hover {
  border-color: var(--border);
  box-shadow: none;
}

/* Currently-chosen card in a pick-one group (wizard mode/bump-type tiles) — a card that persists a
   selection rather than navigating away on click, so it needs a resting "this is the one" state */
.card--selected {
  border-color: var(--primary);
  background: var(--info-bg);
}

/* Leading icon, spanning both rows so names line up down a column however long the description runs */
.card-icon {
  grid-row: 1 / span 2;
  display: grid;
  place-items: center;
  width: 1.85rem;
  height: 1.85rem;
  border-radius: 5px;
  background: var(--surface-deep);
  color: var(--primary);
}

.card-name {
  grid-column: 2;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-width: 0; /* lets the name truncate instead of widening the tile */
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text);
}

.card-name svg { flex-shrink: 0; }

/* Only the name truncates, so a long one never pushes its badge or count off the tile */
.card-name-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Live count the tab's JS fills in — pinned right so every tile's number lands on the same edge */
.card-meta {
  margin-left: auto;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  font-family: ui-monospace, 'Cascadia Code', 'Fira Mono', monospace;
  font-variant-numeric: tabular-nums;
}
.card-meta:empty { display: none; } /* nothing loaded yet, so no stray gap in the name row */

.card-desc {
  grid-column: 2;
  font-size: 0.76rem;
  color: var(--text-muted);
  line-height: 1.35;
}

/* JS-rendered tiles (wizard mode/bump pickers) carry no icon, so their text takes the whole width */
.card:not(:has(> .card-icon)) > .card-name,
.card:not(:has(> .card-icon)) > .card-desc { grid-column: 1 / -1; }

/* ─── History entry — collapsible <details> row for a single document check-in, used by every
     "History" modal (kit BOM, cutting list sheet, ...). Summary shows who/when; body (description
     + field diff) only renders once expanded. */
.history-entry {
  background: var(--surface);
  border-radius: 4px;
  margin-bottom: 0.3rem;
}

.history-entry summary {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  cursor: pointer;
  list-style: none;
  user-select: none;
  padding: 0.4rem 0.6rem;
  border-radius: 4px;
  font-size: 0.875rem;
  transition: background 0.15s ease, box-shadow 0.15s ease, color 0.15s ease;
}

.history-entry summary::-webkit-details-marker {
  display: none;
}

.history-entry summary::before {
  content: '\25B8';
  display: inline-block;
  width: 1rem;
  text-align: center;
  transition: transform 0.15s ease;
}

.history-entry[open] summary::before {
  transform: rotate(90deg);
}

.history-entry summary:hover {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent);
}

.history-entry summary .history-entry-version {
  color: var(--text-faint);
  font-size: 0.75rem;
  font-weight: 600;
  font-family: ui-monospace, 'Cascadia Code', 'Fira Mono', monospace;
}

.history-entry summary .history-entry-date {
  margin-left: auto;
  color: var(--text-faint);
  font-size: 0.8rem;
  white-space: nowrap;
}

.history-entry-body {
  padding: 0 0.6rem 0.6rem 2.2rem; /* summary's 0.6rem padding + 1rem fixed-width arrow + 0.6rem flex gap, kept in exact lockstep with .history-entry summary above */
}

/* The check-in description is what the person actually wrote, not a derived/auto-generated line like the
   diff below it — set apart as a quoted note (accent rule + italics) so the two read as visually distinct */
.history-entry-description {
  font-style: italic;
  color: var(--text-sub);
  font-size: 0.85rem;
  border-left: 2px solid var(--accent);
  padding: 0.1rem 0 0.1rem 0.6rem;
  margin-bottom: 0.6rem;
}

/* A class that sets `display` beats the UA [hidden] rule, so .form-field/.inline-check etc.
   stay visible despite the attribute — make [hidden] authoritative everywhere instead. */
[hidden] { display: none !important; }

/* Panes switched by a .subtab-bar; the bar itself is styled in metrics.css and used app-wide */
.subtab-pane.hidden { display: none; }

/* Revision picker — one labelled group holding the Int and Ext selects, mirroring the quote header */
.rev-group {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.rev-group .rev-select {
  min-width: 4.5rem;
}

.rev-group .rev-tag {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-faint);
}

.rev-group .rev-sep {
  color: var(--text-faint);
}

/* Date+time pair. The visual treatment lives here and is shared; callers own the layout —
   metrics' sidebar stacks them full-width, a filter row sits them side by side. */
.dt-input,
.form-field input.dt-input {  /* matched to the .form-field input rule so a pair inside a form field keeps this look */
  font-size: 0.72rem;
  padding: 0.3rem 0.35rem;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--bg);
  color: var(--text);
  box-sizing: border-box;
}

.dt-label {
  font-size: 0.63rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
}

/* Side-by-side layout for a date and its time, as used in a horizontal filter row */
.dt-group {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
/* side by side, each box sizes to its own value rather than taking the .form-field full width */
.form-field .dt-group input.dt-input { width: auto; }

/* .filter-sep for a row of labelled fields, where the rule runs the fields' full height rather than one line's */
.filter-sep--stretch {
  height: auto;
  align-self: stretch;
  min-height: 2rem;
}

/* Checkbox with its label on one line, for toggling chart series on and off */
.inline-check {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  cursor: pointer;
  user-select: none;
}

/* Filter-row field that should take the leftover width, e.g. a picker */
.form-field.field-grow { flex: 1 1 220px; min-width: 200px; }

/* ─── Summary strip — a row of figures, not a grid of cards ───────────────── */

.summary-strip { display: flex; flex-wrap: wrap; gap: 0.15rem 0; margin: 0.15rem 0 1.25rem; }
.summary-strip > div { flex: 1 1 150px; padding: 0.15rem 1.1rem; border-left: 1px solid var(--border); }
.summary-strip > div:first-child { border-left: none; padding-left: 0; }
.summary-strip .stat-value { display: block; font-size: 1.35rem; font-weight: 600; line-height: 1.25; font-variant-numeric: tabular-nums; }
.summary-strip .stat-head { display: flex; align-items: center; gap: 0.3rem; margin-top: 0.05rem; }
.summary-strip .stat-label {
  font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-muted); font-weight: 600;
}
/* What the figure is doing, under the label that names it — a figure nobody has to click into */
.summary-strip .stat-note { font-size: 0.71rem; color: var(--text-faint); margin-top: 0.1rem; }
/* The one figure on a strip that wants reading before the rest */
.summary-strip .stat-value.is-alert { color: var(--danger); }
.summary-strip .stat-note.is-alert { color: var(--danger); }

/* summary-strip--inline derivative — the same figures on one line, label beside value rather than
   under it, for a pane where the figures set the scene for a table rather than being the point of it */
.summary-strip--inline {
  align-items: center;
  gap: 0 1.1rem;
  margin: 0 0 0.6rem;
  padding: 0.35rem 0.8rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.summary-strip--inline > div {
  flex: none;
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
  padding: 0;
  border-left: none;
}
.summary-strip--inline .stat-value { display: inline; font-size: 0.85rem; }
.summary-strip--inline .stat-head { margin: 0; }
.summary-strip--inline .stat-label { font-size: 0.6rem; }
/* a strip with nothing to say yet takes no room */
.summary-strip--inline:empty { display: none; }
/* a figure's note and bar sit on its line · statHtmlNoted */
.summary-strip--inline .stat-note { margin: 0; }
.summary-strip--inline .stat-track { align-self: center; width: 3.5rem; height: 0.3rem; }
.summary-strip--inline .stat-fill { background: var(--accent); }
.summary-strip .stat-value.is-warning, .summary-strip .stat-note.is-warning { color: var(--warning); }
/* in a section's header row the strip stretches from the title to the filters */
.section-header > .summary-strip--inline { flex: 1 1 auto; margin: 0; }

/* A count pinned to a button's corner · the bell's notifications and the BOM Audit's issues */
:has(> .count-badge) { position: relative; }
.count-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 15px;
  height: 15px;
  padding: 0 3px;
  border-radius: 999px;
  background: var(--danger);
  color: var(--on-primary);
  font-size: 0.6rem;
  font-weight: 600;
  line-height: 15px;
  text-align: center;
}
.summary-strip .stat-value.is-success, .summary-strip .stat-note.is-success { color: var(--success); }

/* summary-strip--column derivative — the same figures stacked into a side column, for a pane where
   they sit beside a chart rather than in a band of their own. The rule between them turns with them. */
.summary-strip--column {
  flex-direction: column;
  /* a wrapping column that runs short starts a second column beside it, off the panel's edge · it scrolls instead */
  flex-wrap: nowrap;
  gap: 0;
  margin: 0;
}
.summary-strip--column > div {
  flex: none;
  width: 100%;
  padding: 0.5rem 0;
  border-left: none;
  border-top: 1px solid var(--border);
}
.summary-strip--column > div:first-child { padding-top: 0; border-top: none; }
/* a wide cell's 300px basis is a width in a row but a height in a column, so the column sizes it to its content */
.summary-strip.summary-strip--column > .stat-wide { flex: none; }
.summary-strip--column .stat-value { font-size: 1.15rem; }

/* summary-strip--boxed derivative — the same figures on a board, carrying the surface a page would give them */
.summary-strip--boxed {
  margin: 0;
  flex-wrap: nowrap;
  padding: 0.5rem 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
/* the page version runs its first figure flush to the margin; inside a box it needs the padding back */
.summary-strip--boxed > div:first-child { padding-left: 1.1rem; }

/* ⓘ opens the same formula tooltip metrics uses — title, equation, derivation, note */
.info-btn {
  flex: none; width: 0.9rem; height: 0.9rem; border-radius: 50%; padding: 0;
  border: 1px solid var(--border); background: transparent; color: var(--text-faint);
  font-size: 0.55rem; font-weight: 700; line-height: 1; cursor: pointer;
}
.info-btn:hover, .info-btn[aria-expanded="true"] { color: var(--primary); border-color: var(--primary); }

/* Composite strip cells — an icon+label head over bars or a marker track */
.summary-strip .stat-wide { flex: 1 1 300px; }
.summary-strip .stat-head-right { margin-left: auto; }

.stat-bar-row { display: grid; grid-template-columns: 5.5rem 1fr 3.2rem; align-items: center; gap: 0.55rem; margin-bottom: 0.35rem; }
.stat-bar-label { font-size: 0.65rem; color: var(--text-muted); display: flex; align-items: center; gap: 0.25rem; }
.stat-bar-num { font-size: 0.78rem; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.stat-swatch { width: 0.5rem; height: 0.5rem; border-radius: 2px; flex: none; display: inline-block; }
.stat-track { position: relative; height: 0.55rem; background: var(--surface-deep); border-radius: 3px; overflow: hidden; }
.stat-fill { position: absolute; top: 0; bottom: 0; left: 0; border-radius: 3px; }

.stat-axis { display: flex; justify-content: space-between; font-size: 0.6rem; color: var(--text-faint); }
.stat-axis--bars { padding-left: 6.05rem; padding-right: 3.75rem; }

/* One track carrying committed, experimental and baseline, with the change shaded between */
.perf-track { position: relative; height: 1.6rem; background: var(--surface-deep); border-radius: 4px; margin: 0.15rem 0 0.4rem; }
.perf-100 { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--text-faint); opacity: 0.6; }
.perf-span { position: absolute; top: 0; bottom: 0; opacity: 0.4; }
.perf-span.is-up { background: var(--success); }
.perf-span.is-down { background: var(--danger); }
.perf-pin { position: absolute; top: -0.2rem; bottom: -0.2rem; width: 2.5px; border-radius: 2px; }
/* the same track at row height, for a file line rather than a summary cell */
.perf-track--sm { height: 1rem; margin: 0; }
.perf-track-vals { font-size: 0.78rem; margin-top: 0.2rem; color: var(--text-sub); font-variant-numeric: tabular-nums; }
.perf-track-vals b { color: var(--text); }
.perf-legend { display: flex; flex-wrap: wrap; gap: 0.75rem; font-size: 0.68rem; color: var(--text-muted); margin-top: 0.3rem; }
.perf-legend span { display: flex; align-items: center; gap: 0.3rem; }
.perf-legend b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }


/* Commit is a write, so it hovers to the success colour rather than the neutral tint */
.btn-commit:hover { color: var(--success); background: var(--success-bg); }


/* ── Card row ──────────────────────────────────────────────────────────────────
   The grid row used wherever records are listed as cards rather than table rows.
   Derivatives set only grid-template-columns and their own left-border accents:
   .std-row (System > Standards), .exp-row (System > Experimentation). */
.card-row {
  display: grid;
  gap: 0.9rem;
  align-items: center;
  background: var(--table-surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--border);
  border-radius: 5px;
  padding: 0.7rem 0.9rem;
}

.card-row + .card-row { margin-top: 0.5rem; }
.card-row:hover { background: var(--row-hover); }

/* the small uppercase caption above a value inside a card row */
.cell-k {
  display: block;
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 0.1rem;
}


/* ── Timeline rail ─────────────────────────────────────────────────────────────
   History for interval-versioned entities: each entry is a period, not an event.
   Pairs with shared/timeline_rail.js. Use .history-entry instead for revisions. */
.rail { display: flex; flex-direction: column; }

.rail-entry { display: grid; grid-template-columns: 6.5rem 1.1rem 1fr; gap: 0.7rem; align-items: stretch; }

.rail-when {
  font-size: 0.76rem; color: var(--text-muted); text-align: right;
  padding-top: 0.65rem; font-variant-numeric: tabular-nums;
}

/* the continuous line, trimmed at the first and last dot so it doesn't overshoot */
.rail-line { position: relative; display: flex; justify-content: center; }
.rail-line::before { content: ""; position: absolute; top: 0; bottom: 0; width: 2px; background: var(--border); }
.rail-entry:first-child .rail-line::before { top: 0.75rem; }
.rail-entry:last-child .rail-line::before { bottom: calc(100% - 0.75rem); }

.rail-dot {
  position: relative; width: 0.62rem; height: 0.62rem; border-radius: 50%;
  background: var(--primary); margin-top: 0.62rem; box-shadow: 0 0 0 3px var(--surface);
}
.rail-dot.is-correction { background: var(--warning); }

.rail-card { padding: 0.55rem 0 0.9rem; min-width: 0; }
.rail-title { display: flex; align-items: baseline; gap: 0.5rem; flex-wrap: wrap; }
.rail-value { font-weight: 700; font-variant-numeric: tabular-nums; font-size: 0.95rem; }
.rail-from { color: var(--text-muted); font-size: 0.82rem; font-variant-numeric: tabular-nums; }
.rail-who { color: var(--text-muted); font-size: 0.8rem; }
.rail-actions { margin-left: auto; }

/* duration as a bar, so relative length reads without a time axis */
.rail-dur { display: flex; align-items: center; gap: 0.4rem; margin-top: 0.3rem; font-size: 0.72rem; color: var(--text-muted); }
.rail-bar { display: inline-block; height: 0.32rem; border-radius: 2px; background: color-mix(in srgb, var(--primary) 35%, transparent); flex: none; }

.rail-note { margin-top: 0.35rem; font-size: 0.84rem; color: var(--text-sub); }

/* what a correction replaced, folded into the entry that replaced it */
.rail-superseded {
  margin-top: 0.4rem; font-size: 0.78rem; color: var(--text-muted);
  border-left: 2px dashed var(--warning); padding-left: 0.55rem;
}
.rail-superseded s { color: var(--text-faint); }


/* Any pane refetching in place, via loading.dimWhileLoading */
.is-loading { opacity: 0.45; pointer-events: none; transition: opacity 0.12s; }

/* the words under a labelled spinner, via loading.spinWhileLoadingLabeled */
.is-loading-label {
  position: absolute;
  top: calc(50% + 1.1rem);
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.78rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* a quiet line of explanation inside a modal body */
.modal-note { font-size: 0.85rem; color: var(--text-faint); }

/* A loading pane never says "none found" · the answer is still on its way, unless the slot itself holds the spinner */
.is-loading .empty-state:not(:has(.spinner-sm)) { visibility: hidden; }

/* Add where the dim alone says nothing — a pane that is still empty, or whose content is a canvas · loading.js adds --empty itself */
.is-loading--spinner,
.is-loading--empty {
  position: relative;
  /* room for the spinner before a first load fills the pane, or a content-sized card collapses to nothing and clips it */
  min-height: 4rem;
}
.is-loading--spinner::after,
.is-loading--empty::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 22px;
  height: 22px;
  margin: -11px 0 0 -11px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}


/* ── Period strip ──────────────────────────────────────────────────────────────
   Pick a window by clicking a real interval or dragging the brush. One lane per
   series, since separate series rarely share boundaries. Pairs with
   shared/period_strip.js. */
/* inset past the name and reach columns and their gaps, so a tick's percentage lands on the same instant the track below it means */
.ps-axis {
  position: relative; height: 0.85rem;
  margin-left: calc(var(--ps-name-col, 4.5rem) + 1.4rem + 0.7rem); margin-right: calc(1.4rem + 0.35rem);
}
.ps-tick {
  position: absolute; font-size: 0.6rem; color: var(--text-muted);
  transform: translateX(-50%); font-variant-numeric: tabular-nums; white-space: nowrap;
}

.ps-lanes { display: flex; flex-direction: column; gap: 0.15rem; }
/* One template for a lane row and the grasp row, so the brush lines up with the lanes above it
   exactly — a track even a few pixels narrower puts every position at a different instant. The
   reach controls get their own column at each edge, left empty on the lanes. */
.ps-strip-grid {
  display: grid;
  /* the name column is sized to the longest lane name by period_strip.js, so a module name is never cut short */
  grid-template-columns: var(--ps-name-col, 4.5rem) var(--ps-reach-col) 1fr var(--ps-reach-col);
  gap: 0.35rem;
  align-items: center;
}
/* the lanes reserve the same reach columns the grasp row uses · the track is 1fr of what is left,
   so the two must agree exactly or the brush names a different instant than the lane under it */
.ps-lane-row { --ps-reach-col: 1.4rem; }
.ps-lane-name {
  font-size: 0.7rem; color: var(--text-muted); text-align: right;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ps-lane {
  /* the track's own column · left to auto-placement it fell into the 1.4rem reach column beside the name */
  grid-column: 3;
  position: relative; height: 0.95rem; background: var(--table-surface);
  border: 1px solid var(--border-light); border-radius: 3px; overflow: hidden;
}

.ps-seg {
  position: absolute; top: 0; bottom: 0; border-right: 1px solid var(--surface);
  cursor: pointer; display: flex; align-items: center; padding: 0 0.3rem;
}
.ps-seg:hover { filter: brightness(1.08); }
/* a period still running · filled as far as it's got, with a line at now */
.ps-seg-elapsed { position: absolute; left: 0; top: 0; bottom: 0; background: color-mix(in srgb, var(--primary) 40%, transparent); pointer-events: none; }
.ps-seg-now { position: absolute; top: -1px; bottom: -1px; width: 2px; margin-left: -1px; background: var(--primary); pointer-events: none; }
.ps-seg-v { font-size: 0.6rem; font-weight: 700; color: var(--text-sub); font-variant-numeric: tabular-nums; }

/* the grasped range, flanked by the controls that reach either end out to forever */
.ps-grasp { --ps-reach-col: 1.4rem; }
/* the label column is empty here, so the track starts where every lane does */
.ps-grasp .ps-track { grid-column: 3; }
/* the same ‹‹ / ›› the brush shows once an end is open, so the button and its result read as one idea · the words are in its title */
.ps-reach {
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.8rem; font-weight: 900; line-height: 1; padding: 0;
  width: var(--ps-reach-col); height: 1.15rem; margin-top: 0.2rem; box-sizing: border-box;
  border: 1px solid var(--border); border-radius: 4px;
  background: var(--table-surface); color: var(--text-sub);
}
.ps-reach[data-reach="back"] { grid-column: 2; }
.ps-reach[data-reach="fwd"] { grid-column: 4; }
.ps-reach:hover { background: var(--row-hover); }
/* grasped is a state, not a hover, so it reads without pointing at it */
.ps-reach.is-on {
  background: var(--info-bg); color: var(--info-color); border-color: var(--info-color);
}


/* the brush track sits under the lanes and spans the same width */
.ps-track {
  /* the grid column places it, so it carries no offset of its own to drift from the lanes */
  position: relative; height: 1.15rem; margin-top: 0.2rem;
  background: var(--table-surface); border: 1px solid var(--border-light);
  border-radius: 3px; touch-action: none;
}
.ps-snap { position: absolute; top: 0; bottom: 0; width: 0; border-left: 1px dashed var(--warning); }

.ps-brush {
  position: absolute; top: -2px; bottom: -2px;
  border: 2px solid var(--primary); border-radius: 3px;
  background: color-mix(in srgb, var(--primary) 12%, transparent);
}
.ps-handle {
  position: absolute; top: 50%; width: 6px; height: 0.9rem; margin-top: -0.45rem;
  background: var(--primary); border-radius: 2px; cursor: ew-resize;
}
.ps-handle.is-start { left: -4px; }
.ps-handle.is-end { right: -4px; }

/* a wider invisible grab area, since 6px of bar is a poor target */
.ps-handle::before {
  content: ""; position: absolute; top: -0.3rem; bottom: -0.3rem; left: -0.4rem; right: -0.4rem;
}

/* a glyph on a handle means only one thing: the window is open on that side */
.ps-handle-dir {
  position: absolute; top: 50%; transform: translateY(-50%); display: none;
  font-size: 0.95rem; font-weight: 900; line-height: 1; letter-spacing: -0.02em;
  color: var(--success); pointer-events: none; text-shadow: 0 0 3px var(--surface);
}
/* each glyph sits inside the brush beside its handle, so at the track's edge it never spills over the reach buttons */
.ps-handle-dir.is-fwd { right: 100%; padding-right: 0.2rem; }
.ps-handle-dir.is-back { left: 100%; padding-left: 0.2rem; }
.ps-brush.is-open-ended .ps-handle.is-end { background: var(--success); }
.ps-brush.is-open-ended .ps-handle.is-end .ps-handle-dir { display: block; }
.ps-brush.is-open-start .ps-handle.is-start { background: var(--success); }
.ps-brush.is-open-start .ps-handle.is-start .ps-handle-dir { display: block; }

/* a lane with no module-grain standard says so instead of rendering blank */
.ps-lane-empty {
  position: absolute; left: 0.4rem; top: 50%; transform: translateY(-50%);
  font-size: 0.62rem; color: var(--text-faint); font-style: italic;
}

/* an open end is said by its ‹‹‹ / ››› glyph, not a fade · a fade read as the period trailing off, and took the glyph with it */
.ps-seg.is-unbound { border-right: none; }
.ps-seg.is-open-start { border-left: none; }
.ps-seg-on, .ps-seg-back {
  position: absolute; top: 50%; transform: translateY(-50%);
  font-size: 0.72rem; font-weight: 900; line-height: 1; color: var(--primary);
  letter-spacing: -0.02em; text-shadow: 0 0 3px var(--surface);
}
.ps-seg-on { right: 0.2rem; }
.ps-seg-back { left: 0.2rem; }

/* a stretch with no standard: selectable, and visibly not a period */
.ps-gap {
  position: absolute; top: 0; bottom: 0; cursor: pointer;
  background: repeating-linear-gradient(45deg, transparent, transparent 3px,
              color-mix(in srgb, var(--text-faint) 18%, transparent) 3px,
              color-mix(in srgb, var(--text-faint) 18%, transparent) 6px);
}
.ps-gap:hover { background: color-mix(in srgb, var(--primary) 14%, transparent); }

/* the same idea on the rail: an in-force period has no closing date */
.rail-open { color: var(--success); font-weight: 700; }

/* which way a write reaches in time: forward from now, or back over a closed period */
.commit-dir {
  display: flex; align-items: center; gap: 0.5rem; margin-top: 0.7rem;
  padding: 0.5rem 0.6rem; border-radius: 3px; font-size: 0.84rem;
}
.commit-dir .dir-glyph { font-size: 1.05rem; font-weight: 900; line-height: 1; letter-spacing: -0.02em; }
.commit-dir.is-forward { background: var(--info-bg); color: var(--info-color); }
.commit-dir.is-back { background: var(--warning-bg); color: var(--warning); }

/* The rules modal (shared/rules_modal.js) · how a result was gathered, one numbered rule each */
.rules-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-3); }
.rules-item h4 { margin: 0 0 var(--space-1); }
.rules-item p { margin: 0; color: var(--text-muted); }

/* A segmented control · one choice among a few, drawn as one control rather than separate buttons. Mark the chosen one with aria-pressed="true" */
.segmented { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.segmented.hidden { display: none; }
.segmented-btn { background: var(--surface); border: none; border-right: 1px solid var(--border); padding: 0.22rem 0.7rem; font: inherit; font-size: 0.78rem; color: var(--text-sub); cursor: pointer; }
.segmented-btn:last-child { border-right: none; }
.segmented-btn:hover { background: var(--row-hover); color: var(--text); }
.segmented-btn[aria-pressed="true"] { background: var(--primary); color: var(--on-primary); font-weight: 600; }
.segmented-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }

/* ── span_lane · one lane of typed spans over a time range, styled per kind by its derivatives ── */
.span-lane { position: relative; height: 8px; border-radius: 2px; background: var(--surface-deep); overflow: hidden; }
.span-lane--tall { height: 16px; border-radius: 3px; }
.span-lane-seg { position: absolute; top: 0; bottom: 0; background: var(--seg); }
/* pending · shown before the server confirmed it, greyed and out of reach until it does */
.span-lane-seg.is-saving { filter: grayscale(1); opacity: 0.45; pointer-events: none; animation: span-lane-saving 1.2s ease-in-out infinite alternate; }
@keyframes span-lane-saving { to { opacity: 0.25; } }
.span-lane-now { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--text); opacity: 0.5; }
.span-lane-key { display: flex; flex-wrap: wrap; gap: 0.2rem 0.75rem; font-size: 0.66rem; color: var(--text-muted); }
.span-lane-key span { display: inline-flex; align-items: center; gap: 0.3rem; }
.span-lane-key i { position: static; display: inline-block; width: 10px; height: 8px; border-radius: 2px; }
.tl-axis { position: relative; height: 0.9rem; font-size: 0.62rem; color: var(--text-faint); font-variant-numeric: tabular-nums; }
.tl-axis span { position: absolute; transform: translateX(-50%); white-space: nowrap; }

/* ─── Month calendar · shared/calendar.js draws the grid, a derivative fills each day ─── */

.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.35rem; }
.cal-head b { font-size: 0.86rem; font-weight: 650; color: var(--text); }
.cal-nav { width: 1.6rem; height: 1.6rem; display: grid; place-items: center; border-radius: 6px; border: 1px solid var(--border-light); background: var(--surface); color: var(--text-muted); cursor: pointer; font-size: 0.85rem; }
.cal-nav:disabled { opacity: 0.35; cursor: default; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; }
.cal-dow { text-align: center; font-size: 0.56rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); padding-bottom: 0.1rem; }
.cal-day { display: grid; gap: 2px; align-content: start; min-width: 0; padding: 0.15rem 0.1rem 0.18rem; border-radius: 6px; }
.cal-num { text-align: center; font-size: 0.68rem; font-weight: 600; line-height: 1.2; color: var(--text-sub); font-variant-numeric: tabular-nums; }
.cal-day.is-today .cal-num { color: var(--primary); text-decoration: underline; text-underline-offset: 2px; }
.cal-day.is-future .cal-num { color: var(--text-faint); }

/* ─── Shift calendar · each day's crew over its night crew, in the crew's own colour ─── */

.shift-cal-half { display: grid; place-items: center; height: 0.95rem; padding: 0; border: none; border-radius: 3px; font: 750 0.56rem/1 inherit; color: var(--surface); background: var(--hc); }
/* the night half is the same crew, darker, so a day reads top to bottom as light then dark */
.shift-cal-half.is-night { color: #fff; background: color-mix(in srgb, var(--hc) 55%, #10111c); }
button.shift-cal-half { cursor: pointer; }
button.shift-cal-half:hover, button.shift-cal-half:focus-visible { outline: 2px solid var(--text-muted); outline-offset: 1px; }
.shift-cal-half.is-none { background: transparent; box-shadow: inset 0 0 0 1px var(--border-light); }
/* another crew's shift, shown so the pattern reads but never picked */
.shift-cal-half.is-dim { color: transparent; background: color-mix(in srgb, var(--hc) 18%, transparent); }
.shift-cal-half.is-live { box-shadow: 0 0 0 2px var(--success); }
.shift-cal-half.is-shown { outline: 2px solid var(--text); outline-offset: 1px; }
.shift-cal-key { display: flex; flex-wrap: wrap; gap: 0.25rem 0.7rem; margin-top: 0.5rem; padding-top: 0.45rem; border-top: 1px solid var(--border-light); font-size: 0.66rem; color: var(--text-muted); }
.shift-cal-key span { display: inline-flex; align-items: center; gap: 0.25rem; }
.shift-cal-key i { display: inline-block; width: 0.7rem; height: 0.55rem; border-radius: 2px; background: var(--text-muted); }
.shift-cal-key i.is-night { background: color-mix(in srgb, var(--text-muted) 55%, #10111c); }
.shift-cal-key i.is-live { background: transparent; box-shadow: 0 0 0 2px var(--success); }
.shift-cal-foot { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin-top: 0.5rem; }
.shift-cal-foot span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.72rem; color: var(--text-muted); }
.shift-cal-foot .btn-secondary { flex: none; font-size: 0.74rem; padding: 0.3rem 0.65rem; }

/* Quality Point panel · the measurement table beside BOM's solid, in the operator's modal and Quality's preview alike */
.point-panel { display: flex; flex-direction: column; gap: 0.6rem; min-height: 0; }
.point-panel-head { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.point-panel-param { margin-left: auto; color: var(--text-muted); font-size: 0.85rem; }
.point-panel .workspace.has-solid, .point-panel .workspace { grid-template-columns: minmax(0, 1fr) minmax(16rem, 22rem); }
.point-panel-main { display: flex; flex-direction: column; gap: 0.5rem; min-width: 0; }
.point-panel-where { font-size: 0.8rem; color: var(--text-muted); }
.point-panel-table tbody tr { cursor: pointer; }
.point-panel-part { font-weight: 600; }
.point-panel-input { width: 9rem; font-size: 1rem; font-variant-numeric: tabular-nums; }
.point-panel-state { color: var(--text-muted); }
.point-panel .solid-panel { min-height: 20rem; }
/* Quality Points' workspace and pane, exactly as BOM's (.bom-workspace, .bom-pane) · the pane scrolls as one, and each table scrolls sideways in its own frame */
.qp-workspace { --rail-w: 15rem; --panel-w: 24rem; grid-template-columns: var(--rail-col) minmax(0, 1fr); }
.qp-pane { overflow-y: auto; padding-right: 0.25rem; }
/* The parameter whose dimension the part beside it shows · the operator's panel and Quality's copies table alike */
.data-table thead th.is-measuring { color: var(--primary); box-shadow: inset 0 -2px 0 var(--primary); }
#qp-copies-table thead th[data-col], #qp-copies-table tbody tr { cursor: pointer; }
@media (max-width: 940px) { .qp-pane { overflow-y: visible; } }
/* The point editor fits the viewport rather than scrolling · the sheet takes the full height on the left, and the fields stand in one column beside it, the parts list taking the height the rest leave and scrolling in its own frame */
.modal-point-editor .modal-body { max-height: none; height: min(46rem, calc(100vh - 11rem)); overflow: hidden; }
.qp-editor { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 1rem; height: 100%; }
.qp-copies-sheet { min-width: 0; min-height: 0; position: relative; }
.qp-editor-side { display: flex; flex-direction: column; gap: 0.75rem; min-width: 0; min-height: 0; }
.qp-editor-side > .form-grid { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.qp-copies-field { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.qp-copies-list { flex: 1; min-height: 0; overflow-y: auto; }
.qp-copies-head { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.4rem; }
.qp-copies-head > span { flex: 1; color: var(--text-muted); }
#qp-f-copies tbody tr { cursor: pointer; }
@media (max-width: 760px) { .qp-editor { grid-template-columns: 1fr; grid-template-rows: 16rem minmax(0, 1fr); } }
/* the queue pill sits at the end of the panel's head row */
.modal-point .point-panel-head .op-review-queue { margin-left: auto; }

/* the Part MCP App · the feature tree beside the rebuilt solid, the picked feature's dimensions under it */
.design-panel { height: 100%; display: flex; flex-direction: column; background: var(--surface); }
.design-panel-head, .design-panel-foot { flex: none; display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; padding: 0.5rem 0.75rem; }
.design-panel-head { border-bottom: 1px solid var(--border); }
.design-panel-foot { border-top: 1px solid var(--border); font-size: 0.8rem; }
.design-panel-spacer { flex: 1; }
.design-panel-body { flex: 1; min-height: 0; display: grid; grid-template-columns: 15rem minmax(0, 1fr); }
.design-panel-tree { border-right: 1px solid var(--border); overflow-y: auto; padding: 0.25rem 0; }
.design-panel-node { display: flex; justify-content: space-between; gap: 0.5rem; width: 100%; border: 0; background: none; color: inherit;
  font: inherit; font-size: 0.82rem; text-align: left; padding: 0.2rem 0.75rem; cursor: pointer; }
.design-panel-node.is-nested { padding-left: 1.75rem; }
.design-panel-node.is-off { opacity: 0.55; }
.design-panel-node.is-selected { background: var(--surface-deep); }
.design-panel-main { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.design-panel-stage { flex: 1; min-height: 12rem; }
.design-panel-dims { flex: none; border-top: 1px solid var(--border); padding: 0.5rem 0.75rem; max-height: 12rem; overflow-y: auto; }
.design-panel-dim-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr)); gap: 0.4rem 1rem; }
.design-panel-dim { display: flex; align-items: center; gap: 0.5rem; font-size: 0.8rem; }
.design-panel-dim span { flex: 1; min-width: 0; }
.design-panel-dim input { width: 6.5rem; }
.design-panel-dim input.is-dirty { background: var(--warning-bg); }
