﻿/* ===== Machine Metrics ===== */

/* ─── Session / event type text ──────────────────────────────────────────────── */

.session-type-running       { color: var(--chart-running); }
.session-type-flagged       { color: var(--chart-flagged); }
.session-type-standby       { color: var(--chart-standby); }
.session-type-dormant       { color: var(--chart-dormant-tt); }
.session-type-offline       { color: var(--chart-offline); }
.session-type-disconnected  { color: var(--chart-disconnected); }
.session-type-unknown       { color: var(--chart-unknown); }
.event-type-steady          { color: var(--chart-running); }
.event-type-ongoing         { color: var(--chart-ongoing); }
.event-type-dormant         { color: var(--chart-dormant-tt); }
.event-type-offline         { color: var(--chart-offline); }
.event-type-disconnected    { color: var(--chart-disconnected); }

/* ─── Instance state text ────────────────────────────────────────────────────── */

.instance-state-active       { color: var(--type-active); }
.instance-state-idle         { color: var(--type-idle); }
.instance-state-offline      { color: var(--type-offline); }
.instance-state-disconnected { color: var(--type-disconnected); }
.instance-state-unknown      { color: var(--type-unknown); }
/* a sheet arriving is the machine working, one leaving is it waiting — same colors as active and idle */
.instance-state-sheet_in     { color: var(--type-active); }
.instance-state-sheet_out    { color: var(--type-idle); }

/* ─── Instances panels ───────────────────────────────────────────────────────── */

.instances-anchor-banner {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.3rem 0.75rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border-light);
  font-size: 0.72rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

.table-load-more {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0.6rem 1rem;
  border-top: 1px solid var(--border-light);
  background: var(--surface);
}

/* ─── Column resize handle ───────────────────────────────────────────────────── */

.col-resize-handle {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  cursor: col-resize;
  z-index: var(--z-raise-2);
  background: transparent;
  transition: background 0.12s;
}
.col-resize-handle:hover,
.col-resize-handle.active {
  background: var(--primary);
}

/* Full-height line anchored to mouse x during drag — position:fixed so it never jumps */
.col-resize-line {
  display: none;
  position: fixed;
  top: 0;
  bottom: 0;
  width: 2px;
  transform: translateX(-1px);
  background: var(--primary);
  opacity: 0.5;
  pointer-events: none;
  z-index: var(--z-toast);
}

/* ─── Open session row ───────────────────────────────────────────────────────── */

tr.session-open td {
  background: var(--session-open-row-bg) !important;
  border-right-color: var(--border-light) !important;
}
tr.session-open td:first-child {
  border-left: 3px solid var(--session-open-border);
}

/* ─── Flagged session row ────────────────────────────────────────────────────── */

tr.session-flagged td {
  background: var(--warning-bg) !important;
  border-right-color: var(--border-light) !important;
}
tr.session-flagged td:first-child {
  border-left: 3px solid var(--warning);
}

/* ─── Performance not counted ────────────────────────────────────────────────── */

/* The console's flagged line shrunk beside a table pill · the same tint, since none of it counts against anyone */
.perf-cell-row { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.perf-not-counted {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 0.72rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.perf-not-counted svg { width: 11px; height: 11px; flex-shrink: 0; color: var(--success); }

/* ─── Unknown session row ────────────────────────────────────────────────────── */

tr.session-unknown td {
  background: var(--unknown-row-bg) !important;
  border-right-color: var(--border-light) !important;
}
tr.session-unknown td:first-child {
  border-left: 3px solid var(--type-unknown);
}

/* a timesheet's machine or activity, its kind's icon before the name */
.timesheet-where { display: inline-flex; align-items: center; gap: 0.35rem; }
.timesheet-where svg { width: 13px; height: 13px; color: var(--text-muted); flex-shrink: 0; }

/* ─── Session status badges ──────────────────────────────────────────────────── */

.session-status-open,
.session-status-closed {
  display: inline-block;
  padding: 0 0.35rem;
  border-radius: 3px;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.03em;
}
.session-status-open {
  background: var(--session-open-bg);
  color: var(--type-idle);
}
.session-status-closed {
  background: var(--session-closed-bg);
  color: var(--session-closed-color);
}

.session-flag-cell {
  text-align: center !important;
  padding: 0 !important;
  width: 6px !important;
  min-width: 6px !important;
  max-width: 6px !important;
  color: var(--warning);
  font-size: 0.7rem;
  overflow: hidden;
}
.session-flag-clickable {
  cursor: pointer;
}
.session-flag-clickable:hover {
  background: var(--warning-bg) !important;
}
.session-flag-ghost {
  opacity: 0.15;
}
.session-flag-clickable:hover .session-flag-ghost {
  opacity: 0.5;
}

/* ─── Session notes (detail modal) ───────────────────────────────────────────── */

.session-notes-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
  max-height: 160px;
  overflow-y: auto;
}
.session-note {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: 4px;
  padding: 0.35rem 0.5rem;
}
.session-note-text {
  font-size: 0.82rem;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}
.session-note-meta {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}
.session-note-empty {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-style: italic;
  padding: 0.25rem 0;
  margin-bottom: 0.75rem;
}
.session-note-form {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.session-note-textarea {
  width: 100%;
  box-sizing: border-box;
  resize: vertical;
  font-size: 0.82rem;
  font-family: inherit;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
  color: var(--text);
}
.session-note-submit {
  align-self: flex-end;
  font-size: 0.78rem;
  padding: 0.25rem 0.75rem;
}

/* ─── Dense analytics grid table ─────────────────────────────────────────────── */

.grid-table {
  border-radius: 0;
  box-shadow: none;
  border: 2px solid var(--border);
  line-height: 1.2;
  table-layout: fixed;
  width: auto;
  min-width: 100%;
}
/* Opt-in: columns size to their content instead of the fixed widths a colgroup pins.
   For tables whose cells vary in width, a kit list beside a percentage, where one set of
   fixed widths cannot suit both. Drop the colgroup when using it, or it fights the content. */
.grid-table--auto {
  table-layout: auto;
}
.grid-table th {
  padding: 0.25rem 0.3rem;
  font-size: 0.8rem;
  text-align: center;
  border-right: 1px solid var(--navbar-overlay-soft);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  overflow: hidden;
  position: sticky;
  top: 0;
  z-index: var(--z-raise-1);
  background: var(--navbar-bg);
  color: var(--navbar-text);
  /* Stated here rather than inherited: shared.css's .data-table header is now light, ranged left
     and underlined in --primary. This grid deliberately keeps the dark centred header it was built
     around, so it declares its own type and cancels that underline. */
  font-weight: 500;
  letter-spacing: 0.04em;
  box-shadow: none;
}
.grid-table th:last-child { border-right: none; }
.grid-table td {
  padding: 0.15rem 0.3rem;
  font-size: 0.8rem;
  text-align: center;
  border-right: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border-light);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.grid-table td:last-child { border-right: none; }
.grid-table tbody tr:nth-child(odd)  td { background: var(--surface); }
.grid-table tbody tr:nth-child(even) td { background: var(--row-stripe); }
.grid-table tbody tr:last-child td { border-bottom: none; }
.grid-table tbody tr:hover td { background: var(--row-hover); cursor: default; }

/* ─── Tab full-viewport layout ───────────────────────────────────────────────── */

#tab-metrics .data-table {
  border-radius: 0;
  box-shadow: none;
}

/* height and overflow come from .is-fullbleed; the inset doesn't — Metrics is a wall dashboard read from across the room, so it runs edge to edge and spends every pixel on the grid */
#tab-metrics.active {
  display: flex;
  flex-direction: column;
  padding: 0;  /* the one full-bleed tab that opts out of --page-inset-x/y */
}


/* .slim-page-header / .pill-tab-bar / .pill-tab archetypes now live in shared.css */
.btn-metrics-hamburger {
  display: none;
}

.metrics-tab-dropdown {
  display: none;
}

.metrics-main-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}


/* Outer body below the page header */
.metrics-panel-body {
  flex: 1;
  display: flex;
  flex-direction: row;
  overflow: hidden;
  align-items: stretch;
  background: var(--row-stripe);
}

/* Area containing overview/review views */
.machines-views-area {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}

/* Table columns: compress with the pane, scroll instead of collapsing further */
.machines-content table th,
.machines-content table td { min-width: 72px; white-space: nowrap; }

#view-machines-summary {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ─── Left filter sidebar ────────────────────────────────────────────────────── */

.metrics-sidebar {
  width: 210px;
  min-width: 210px;
  border-right: 1px solid var(--border);
  overflow-y: auto;
  background: var(--row-stripe);
  flex-shrink: 0;
}

.sidebar-section {
  padding: 0.45rem 0.65rem;
  border-bottom: 1px solid var(--border-light);
  background: var(--row-stripe);
}

.sidebar-section-title,
.sidebar-collapse-label {
  font-size: 0.63rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
}
.sidebar-section-title {
  margin-bottom: 0.3rem;
  /* the pick count sits at the far edge, so a long label can never run into it */
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.4rem;
}

/* The tally and the Active toggle share the far edge of the section title */
.pick-meta {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

/* An Active toggle reads as a control, not as part of the uppercase label above it */
.pick-active {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  font-size: 0.58rem;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
}
.pick-active input {
  /* the default box dwarfs a 0.58rem label */
  width: 0.7rem;
  height: 0.7rem;
  margin: 0;
  accent-color: var(--primary);
}

/* The picked count reads as a tally beside its label, not as more of the label */
.pick-hint {
  flex: none;
  font-size: 0.6rem;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
  color: var(--primary);
  background: var(--surface-deep);
  border-radius: var(--radius-pill);
  padding: 0.05rem 0.35rem;
  font-variant-numeric: tabular-nums;
}
/* an empty hint would otherwise still paint its pill */
.pick-hint:empty { display: none; }
.sidebar-collapse-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: var(--z-raise-1);
  background: var(--row-stripe);
}
.btn-sidebar-collapse {
  background: none;
  border: 1px solid var(--border-light);
  border-radius: 3px;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.75rem;
  line-height: 1;
  width: 10%;
}
.btn-sidebar-collapse:hover { color: var(--text); border-color: var(--text-muted); background: var(--row-selected); }
.metrics-sidebar.sidebar-collapsed {
  width: 0;
  min-width: 0;
  border-right: none;
  overflow: hidden;
}
.btn-sidebar-expand {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  z-index: var(--z-local-badge);
  background: var(--row-stripe);
  border: 1px solid var(--border);
  border-left: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.75rem;
  padding: 6px 3px;
  border-radius: 0 3px 3px 0;
  line-height: 1;
}
.btn-sidebar-expand:hover { color: var(--text); }
.machines-views-area { position: relative; }


/* Sidebar layout only — the date/time look itself comes from .dt-input/.dt-label in shared.css */
.sidebar-dt-group { margin-bottom: 0.45rem; }
.sidebar-dt-input {
  display: block;
  width: 100%;
  margin-bottom: 0.2rem;
}

.btn-sidebar-apply {
  width: 100%;
  padding: 0.2rem 0;
  font-size: 0.68rem;
  font-weight: 600;
  border-radius: 2px;
  letter-spacing: 0.03em;
  margin-top: 0.3rem;
}
.btn-sidebar-apply:hover { opacity: 0.85; }

.sidebar-type-group { border-bottom: 1px solid var(--border-light); }

.sidebar-type-header {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.65rem;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  background: var(--surface);
  cursor: pointer;
  user-select: none;
  width: 100%;
}
.sidebar-type-header:hover { background: var(--row-selected); }
.sidebar-type-header input { cursor: pointer; flex-shrink: 0; }

/* Disclosure caret for a machine-type group — a peer of the type checkbox, never a replacement */
.sidebar-type-caret {
  cursor: pointer;
  flex-shrink: 0;
  width: 0.75rem;
  color: var(--text-muted);
  font-size: 0.6rem;
  line-height: 1;
  user-select: none;
}
.sidebar-type-caret:hover { color: var(--text); }
.sidebar-type-caret:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.sidebar-type-group.is-collapsed .sidebar-machine-item { display: none; }

.sidebar-machine-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.22rem 0.65rem 0.22rem 1.4rem;
  font-size: 0.73rem;
  color: var(--text-sub);
  cursor: pointer;
  user-select: none;
}
.sidebar-machine-item:hover { background: var(--row-hover); }
.sidebar-machine-item input { cursor: pointer; flex-shrink: 0; }

/* ─── Right content area ─────────────────────────────────────────────────────── */

.machines-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Timekeeping's sub-view wrappers join the flex chain, so the inner .metrics-table-wrap scrolls instead of growing unbounded */
#tc-view-timesheets,
#tc-view-timecards {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.machines-status-bar {
  padding: 0.25rem 0.75rem;
  font-size: 0.72rem;
  color: var(--text-muted);
  background: var(--row-stripe);
  border-bottom: 1px solid var(--border-light);
  flex-shrink: 0;
  min-height: 1.6rem;
}

/* More than one machine type in scope: the rows split per type, which is worth saying out loud */
.machines-status-bar.is-mixed-type {
  color: var(--warning);
  background: var(--warning-bg);
}

/* Sub-tab bar */
.subtab-bar {
  display: flex;
  align-items: center;
  min-height: 2.25rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
  margin-bottom: 1.1rem; /* every context that uses the bar wants this gap; was an override in engineering.css */
}
/* the bar's trailing slot, for a pane's own controls or status after its tabs */
.subtab-bar-end { margin-left: auto; margin-right: 0.5rem; display: flex; align-items: center; gap: 0.4rem; }
.subtab,
.metrics-review-tab,
.metrics-stats-tab {
  align-self: stretch;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0 1rem;
  font-size: 0.72rem;
  font-weight: 500;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  color: var(--text-muted);
  margin-bottom: -1px;
}
.subtab:hover,
.metrics-review-tab:hover,
.metrics-stats-tab:hover { color: var(--text); }
.subtab.active,
.metrics-review-tab.active,
.metrics-stats-tab.active { color: var(--text); border-bottom-color: var(--primary); }

/* Subtab wrap — transparent on desktop; becomes a positioned hamburger on mobile */
.btn-metrics-subtab-hamburger { display: none; }
.metrics-subtab-wrap { display: contents; }
.metrics-subtab-dropdown { display: contents; }

/* Open-chart toggle button in the tab bar */
.btn-chart-open {
  display: flex;
  align-items: center;
  padding: 0.28rem 0.9rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  color: var(--text-muted);
  margin: auto 0.75rem auto 0.75rem;
  transition: background 0.15s, color 0.15s;
}
.btn-chart-open:hover { background: var(--surface-deep); color: var(--text); }
.btn-chart-open.active { background: var(--surface-deep); color: var(--primary); border-color: var(--primary); }

/* Machine select in the chart pane header */
.chart-machine-select {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text);
  background: none;
  border: none;
  border-bottom: 1px solid var(--border);
  padding: 0.1rem 0.2rem;
  min-width: 80px;
  max-width: 150px;
  cursor: pointer;
  flex-shrink: 0;
}
.chart-machine-select:focus { outline: none; border-bottom-color: var(--primary); }

.metrics-table-wrap {
  flex: 1;
  overflow-y: auto;
  overflow-x: auto;
}

/* ─── Shift view (table + chart side by side) ────────────────────────────────── */

#view-shift {
  display: flex;
  flex-direction: row;
  overflow: hidden;
}

.shift-table-pane {
  flex: 1;
  overflow-y: auto;
  min-width: 300px;
}

.chart-pane-handle {
  width: 5px;
  flex-shrink: 0;
  cursor: col-resize;
  background: var(--border);
  transition: background 0.15s;
}
.chart-pane-handle:hover,
.chart-pane-handle.dragging { background: var(--primary); }


/* Chart view tab switcher (bar / pie / events) */
.chart-view-tabs {
  display: flex;
  gap: 2px;
  align-items: center;
}
.chart-view-tab {
  background: none;
  border: 1px solid transparent;
  border-radius: 3px;
  cursor: pointer;
  color: var(--text-muted);
  padding: 3px 5px;
  line-height: 1;
  display: flex;
  align-items: center;
  transition: background 0.1s, color 0.1s, border-color 0.1s;
}
.chart-view-tab:hover {
  background: var(--row-selected);
  color: var(--text);
  border-color: var(--border);
}
.chart-view-tab.active {
  color: var(--primary);
  border-color: var(--primary);
  background: var(--row-selected);
}

.chart-tab-inner-sep {
  width: 1px;
  height: 14px;
  background: var(--border);
  margin: 0 5px;
  flex-shrink: 0;
}
/* A titlebar control: a glyph naming the dimension, then the select answering it */
.chart-ctl {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-right: 5px;
  flex-shrink: 0;
}
/* generalises what .scope-glyph does beside the machine select, so the whole row is dressed alike */
.chart-ctl-glyph {
  display: inline-flex;
  align-items: center;
  color: var(--navbar-link);
  opacity: 0.65;
  flex-shrink: 0;
  transition: opacity 0.12s;
}
/* a character has no viewBox to size it, so it is matched to its SVG siblings by font instead */
.chart-ctl-glyph.is-text { font-size: 0.95rem; line-height: 1; }

/* the glyph brightens with its own control, so the pair reads as one thing */
.chart-ctl:hover .chart-ctl-glyph,
.chart-ctl:focus-within .chart-ctl-glyph { opacity: 1; }

/* the glyph carries the dimension now, so the select only has to fit its own answers */
.chart-ctl .chart-step-select { min-width: 54px; }
.chart-ctl .chart-period-select { min-width: 56px; }
.chart-ctl .chart-split-select { min-width: 62px; }
.chart-ctl .chart-level-select { min-width: 72px; }

.chart-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  z-index: var(--z-raise-2);
}
#machines-chart { width: 100%; height: 100%; }
#machines-pie-chart, #machines-events-chart, #machines-perf-chart, #machines-util-chart { width: 100%; height: 100%; }
.canvas-bar, .canvas-pie, .canvas-events, .canvas-perf, .canvas-util { width: 100%; height: 100%; }

/* Scope marker beside the chart's scope select — names what the visible tabs are scoped to */
.scope-glyph {
  display: inline-flex;
  align-items: center;
  color: var(--navbar-link);
  opacity: 0.55;
  flex-shrink: 0;
  cursor: help;
}
.scope-glyph.hidden { display: none; }

/* ─── Floating chart docker (new structure) ──────────────────────────────────── */

.chart-pane {
  flex-shrink: 0;
  width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-left: none;
}
.chart-pane:not(.collapsed) { width: 380px; }
.chart-pane.collapsed { display: none; }

/* Placeholder shown when chart is floating outside the docker */
.chart-pane-placeholder {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  color: var(--text-muted);
  font-style: italic;
}
.chart-pane-placeholder.hidden { display: none; }

/* Drop-target highlight when dragging a detached float back over the docker */
.chart-pane.drop-target { background: var(--surface); }

/* Detached / floating-over-page state */
.machines-chart-float.detached {
  position: fixed;
  z-index: var(--z-panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.2);
  overflow: hidden;
  resize: both;
  min-width: 320px;
  min-height: 200px;
  flex: none;
}
.machines-chart-float.detached.hidden { display: none; }

/* The floating chart window — lives inside the docker when docked */
.machines-chart-float {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
  background: var(--surface);
}

/* Titlebar */
.chart-float-titlebar {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 0.22rem 0.5rem;
  background: var(--navbar-bg);
  color: var(--navbar-text);
  border-bottom: 1px solid var(--border);
  cursor: grab;
  flex-shrink: 0;
  user-select: none;
  gap: 0.4rem;
}
/* two rows · what the chart is drawn over, then how it reads */
.chart-titlebar-row { display: flex; align-items: center; gap: 0.4rem; min-width: 0; }
.chart-titlebar-row .chart-view-tabs { flex: 1; min-width: 0; flex-wrap: wrap; }
.chart-titlebar-spacer { flex: 1; }
.chart-view-tab:disabled { opacity: 0.35; cursor: not-allowed; background: none; border-color: transparent; }
.machines-chart-float:not(.detached) .chart-float-titlebar { cursor: default; }

/* the Machines picker · its button names the scope, its popover picks it */
.chart-scope-btn { display: inline-flex; align-items: center; gap: 5px; background: none; border: 1px solid var(--navbar-overlay-soft); border-radius: 4px; color: var(--navbar-text); font: inherit; font-size: 0.78rem; padding: 1px 7px; cursor: pointer; flex-shrink: 0; }
.chart-scope-btn:hover, .chart-scope-btn[aria-expanded="true"] { border-color: var(--navbar-link); }
.chart-scope-btn svg { width: 13px; height: 13px; }
.chart-scope-count { color: var(--navbar-link); font-size: 0.7rem; }
.chart-scope-panel { width: min(260px, calc(100% - 1rem)); display: flex; flex-direction: column; gap: 0.4rem; padding: 0.5rem; }
.chart-scope-panel.hidden { display: none; }
.chart-scope-seg { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--border); border-radius: 4px; overflow: hidden; }
.chart-scope-seg button { display: inline-flex; align-items: center; justify-content: center; gap: 5px; font: inherit; font-size: 0.75rem; background: var(--surface); color: var(--text-sub); border: 0; padding: 3px 6px; cursor: pointer; }
.chart-scope-seg button + button { border-left: 1px solid var(--border); }
.chart-scope-seg button[aria-checked="true"] { background: var(--primary); color: var(--on-primary); }
.chart-scope-seg svg { width: 13px; height: 13px; }
.chart-scope-link { display: inline-flex; opacity: 0.8; }
.chart-scope-list { display: flex; flex-direction: column; gap: 2px; font-size: 0.78rem; }
.chart-scope-list.hidden { display: none; }
.chart-scope-type { display: flex; align-items: center; gap: 5px; font-size: 0.68rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); margin-top: 4px; }
.chart-scope-type svg { width: 12px; height: 12px; }
.chart-scope-row { display: flex; align-items: center; gap: 6px; color: var(--text-sub); cursor: pointer; }
.chart-scope-row input { margin: 0; }
.chart-scope-row:has(input:disabled) { color: var(--text-faint); cursor: default; }
.chart-scope-sub { font-size: 0.7rem; color: var(--text-faint); }


/* the sidebar's Machines section says what its checks are doing to the chart */
.sidebar-chart-tag { font-size: 0.7rem; color: var(--text-muted); display: inline-flex; align-items: center; gap: 4px; padding: 0 0.6rem 0.3rem; }
.sidebar-chart-tag:empty { display: none; }
.sidebar-chart-tag.is-linked { color: var(--primary); }
.sidebar-chart-tag svg { width: 12px; height: 12px; }
.chart-float-titlebar:active { cursor: grabbing; }

/* Machine select in titlebar */
.chart-float-titlebar .chart-machine-select { color: var(--navbar-text); border-bottom-color: var(--navbar-overlay-soft); }

/* the sampling reading as an info mark, its words in the tooltip */
.chart-status {
  font-size: 0.85rem;
  line-height: 1;
  color: var(--navbar-link);
  cursor: help;
  flex-shrink: 0;
}
.chart-status:hover, .chart-status:focus-visible { color: var(--navbar-text); }
.chart-status.hidden { display: none; }

/* Titlebar icon buttons (fullscreen, etc.) */
.chart-float-icon-btn {
  background: none;
  border: none;
  color: var(--navbar-link);
  font-size: 0.95rem;
  cursor: pointer;
  padding: 0 0.3rem;
  line-height: 1;
  flex-shrink: 0;
}
.chart-float-icon-btn:hover { color: var(--navbar-text); }
.chart-float-icon-btn svg { display: block; }
.chart-float-icon-btn:disabled { opacity: 0.4; cursor: default; }
.chart-float-icon-btn.is-linked { color: var(--navbar-text); }

/* The chart's popovers, Machines and Filters · each hangs under the titlebar */
.machines-chart-float:not(.detached) { position: relative; }
.chart-popover-panel {
  position: absolute;
  left: 0.5rem;
  z-index: var(--z-dropdown);
  width: min(300px, calc(100% - 1rem));
  max-height: calc(100% - 3rem);
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 8px 24px var(--shadow-lg);
  padding: 0.25rem 0.5rem 0.5rem;
}

/* The experiment flask · staged orange while on, its count showing either way */
.chart-exp-btn { gap: 3px; }
.chart-exp-btn svg { width: 13px; height: 13px; }
.chart-exp-btn.is-on { color: var(--chart-flagged); border-color: var(--chart-flagged); background: var(--row-selected); }
.chart-exp-badge { font-size: 0.62rem; font-weight: 700; background: var(--chart-flagged); color: var(--surface); border-radius: 8px; padding: 0 5px; line-height: 14px; }
.chart-exp-badge.hidden { display: none; }

/* The info panel under the chart · the chart's flex takes whatever height the panel leaves */
.chart-panel-split { flex: none; height: 5px; background: var(--border); cursor: row-resize; touch-action: none; }
.chart-panel-split.hidden { display: none; }
.chart-panel { flex: none; height: 190px; display: flex; flex-direction: column; border-top: 1px solid var(--border); min-height: 0; }
.chart-panel.is-collapsed { height: auto !important; }
.chart-panel.is-collapsed .chart-panel-body { display: none; }
.chart-panel-head { display: flex; align-items: center; gap: 2px; padding: 0 0.4rem; border-bottom: 1px solid var(--border-light); background: var(--surface); min-height: 28px; }
.chart-panel.is-collapsed .chart-panel-head { border-bottom: 0; }
.chart-panel-chev { background: none; border: 0; color: var(--text-muted); cursor: pointer; padding: 0 4px; font-size: 0.75rem; transition: transform 0.15s; }
.chart-panel.is-collapsed .chart-panel-chev { transform: rotate(-90deg); }
.chart-panel-title { font-size: 0.75rem; font-weight: 600; color: var(--text-sub); display: inline-flex; gap: 5px; align-items: center; padding: 0.3rem 0.3rem; }
.chart-panel-title svg { width: 12px; height: 12px; }
.chart-panel-actions { margin-left: auto; display: inline-flex; gap: 0.5rem; align-items: center; font-size: 0.75rem; }
.chart-panel-actions button { padding: 0.1rem 0.5rem; font-size: 0.72rem; }
.chart-panel-body { flex: 1; overflow-y: auto; min-height: 0; }
.chart-panel-empty { padding: 0.6rem; font-size: 0.8rem; color: var(--text-faint); }
.chart-panel-up { color: var(--success); font-weight: 600; }
.chart-panel-down { color: var(--danger); font-weight: 600; }

/* Titlebar close and dock-back buttons */
.chart-float-close,
.chart-float-dock-back {
  background: none;
  border: none;
  color: var(--navbar-text);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0 0.15rem;
  opacity: 0.7;
  transition: opacity 0.1s;
  flex-shrink: 0;
}
.chart-float-close { margin-left: auto; font-size: 1.1rem; }
.chart-float-close:hover,
.chart-float-dock-back:hover { opacity: 1; }
.chart-float-dock-back.hidden { display: none; }

/* Canvas wrap inside the float */
.chart-wrap {
  flex: 1;
  position: relative;
  padding: 0.5rem 0.5rem 0.25rem;
  min-height: 200px;
  overflow-x: auto;
  overflow-y: hidden;
}

/* ─── Chart hover tooltip ────────────────────────────────────────────────────── */

.chart-tooltip {
  position: fixed;
  display: none;
  left: 0;
  top: 0;
  background: var(--tooltip-bg);
  border: 1px solid var(--tooltip-border);
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 11px;
  color: var(--tooltip-text);
  pointer-events: none;
  z-index: var(--z-float);
  white-space: nowrap;
  line-height: 1.6;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
  will-change: transform;
  transition: transform 55ms ease-out;
}
.chart-tooltip .tt-title { font-weight: 600; color: var(--tt-active); }
.chart-tooltip .tt-time               { color: var(--tt-time); }
.chart-tooltip .tt-detail             { color: var(--tt-muted); }
/* width 0 with min-width 100% wraps the note to the lines above it, so a long note never widens the tooltip */
.chart-tooltip .tt-note               { color: var(--tt-muted); font-style: italic; margin-top: 3px; border-top: 1px solid var(--border); padding-top: 3px; white-space: normal; width: 0; min-width: 100%; }
.chart-tooltip .tt-hint               { color: var(--tt-muted); font-style: italic; margin-top: 2px; }
.chart-tooltip .tt-affirm             { color: var(--tt-running);  font-size: 0.8em; margin-top: 2px; }
.chart-tooltip .tt-warn               { color: var(--tt-flagged); font-size: 0.8em; margin-top: 2px; }

/* ─── Inline review response / notes ────────────────────────────────────────── */

/* Override grid-table td defaults for cells containing form elements */
.review-td-edit {
  padding: 0.05rem 0.15rem !important;
  text-align: left !important;
  overflow: visible !important;
}

.review-category-select {
  width: 100%;
  font-size: 0.75rem;
  padding: 0.12rem 0.2rem;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  box-sizing: border-box;
}
.review-category-select:focus { outline: none; border-color: var(--primary); }

.review-notes-input {
  width: 100%;
  font-size: 0.75rem;
  padding: 0.12rem 0.25rem;
  border: 1px solid transparent;
  border-radius: 3px;
  background: transparent;
  color: var(--text);
  box-sizing: border-box;
}
.review-notes-input:hover { border-color: var(--border); }
.review-notes-input:focus { border-color: var(--primary); outline: none; background: var(--bg); }

/* ─── Reports / Accept inline forms ─────────────────────────────────────────── */

.reports-resolve-cell {
  padding: 0.5rem 1rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.reports-fix-input {
  font-size: 0.8rem;
  padding: 0.25rem 0.4rem;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--bg);
  color: var(--text);
  min-width: 160px;
  flex: 1 1 160px;
}

.reports-fix-cell { color: var(--text-muted); font-size: 0.8rem; }

/* ─── Logs ───────────────────────────────────────────────────────────────────── */

.log-message-cell { max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.log-traceback { margin-top: 0.4rem; padding: 0.6rem; background: var(--surface); border: 1px solid var(--border); border-radius: 4px; font-size: 0.72rem; white-space: pre-wrap; word-break: break-all; max-height: 260px; overflow-y: auto; }

.info-row--full { flex-direction: column; align-items: flex-start; gap: 0.3rem; }

/* ─── Dashboard ──────────────────────────────────────────────────────────────── */

.dashboard-loading-bar {
  height: 2px;
  width: 100%;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
  background: var(--border);
}
.dashboard-loading-bar::after {
  content: '';
  position: absolute;
  top: 0;
  left: -50%;
  width: 50%;
  height: 100%;
  background: var(--primary);
  animation: dashboard-loading-sweep 1.1s ease-in-out infinite;
}
@keyframes dashboard-loading-sweep {
  0%   { left: -50%; }
  100% { left: 100%; }
}

.dashboard-view-body {
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow-y: auto;
  flex: 1;
}

.dashboard-group {
  display: flex;
  flex-direction: column;
}

.dashboard-group-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  padding: 0.9rem 1.1rem 0.3rem;
  border-bottom: 1px solid var(--border-light, var(--border));
}

.dashboard-shifts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(max(240px, 50%), 1fr));
  gap: 1.1rem;
  padding: 1.1rem;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(max(240px, 25%), 1fr));
  gap: 1.1rem;
  padding: 1.1rem;
  align-content: flex-start;
}

#main-view-dashboard .dashboard-shifts-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (min-width: 1500px) {
  #main-view-dashboard .dashboard-shifts-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 1900px) {
  #main-view-dashboard .dashboard-shifts-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  #main-view-dashboard .dashboard-shifts-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

.dashboard-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.2rem;
  box-shadow: 0 1px 3px var(--shadow-sm, rgba(0,0,0,0.06));
  cursor: default;
  transition: opacity 0.15s;
}

.dashboard-card.dragging {
  opacity: 0.12;
  pointer-events: none;
}

/* Row + column highlight for cards adjacent to the drag target */
.dashboard-card.drop-highlight {
  background: color-mix(in srgb, var(--primary) 7%, var(--surface));
  border-color: color-mix(in srgb, var(--primary) 30%, var(--border));
}

.dashboard-card-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.6rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dashboard-drag-handle {
  color: var(--text-muted);
  cursor: grab;
  flex-shrink: 0;
  opacity: 0.5;
  transition: opacity 0.15s;
}
.dashboard-drag-handle:hover { opacity: 1; }
.dashboard-card:active .dashboard-drag-handle { cursor: grabbing; }

.dashboard-card-section {
  padding-top: 0.6rem;
  margin-top: 0.6rem;
  border-top: 1px solid var(--border-light, var(--border));
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.dashboard-card-header + .dashboard-card-section {
  padding-top: 0;
  margin-top: 0;
  border-top: none;
}

.dashboard-section-title {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 0.15rem;
}

.dashboard-section-range {
  font-weight: 500;
  text-transform: none;
  letter-spacing: normal;
  font-size: 0.65rem;
  color: var(--text-muted);
  opacity: 0.7;
  cursor: help;
}


.dashboard-activity-block {
  display: flex;
  flex-direction: column;
  gap: 0.22rem;
  /* --surface-deep, not --surface — this sits directly on .dashboard-card, which is
     also --surface; without a border/shadow here it would blend flat into the card. */
  background: var(--surface-deep);
  border-radius: 6px;
  padding: 0.32rem 0.5rem;
}

.dashboard-activity-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  font-size: 0.82rem;
}

.dashboard-activity-context {
  font-size: 0.73rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dashboard-stats-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 400;
}

.dashboard-stats-ok {
  font-size: 0.8rem;
  color: var(--success);
  font-weight: 600;
}

.dashboard-activity-file-chip {
  font-size: 0.7rem;
  font-family: monospace;
  font-weight: 600;
  color: var(--text-muted);
  background: color-mix(in srgb, var(--border) 55%, transparent);
  border-radius: 4px;
  padding: 0.05rem 0.35rem;
  white-space: nowrap;
  flex-shrink: 0;
}

.dashboard-review-badge {
  display: inline-block;
  padding: 0.1rem 0.45rem;
  border-radius: 10px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: lowercase;
}

.dashboard-open-badge {
  border: none;
  cursor: pointer;
  font-family: inherit;
  line-height: inherit;
  transition: opacity 0.15s;
}
.dashboard-open-badge:hover { opacity: 0.75; }

/* orange — needs operator response */
.dashboard-review-unresponded {
  background: var(--badge-warning-bg, rgba(255,152,0,0.15));
  color: var(--warning);
}

/* slate blue — responded but not yet accepted/rejected */
.dashboard-review-unresolved {
  background: var(--info-bg);
  color: var(--info-color);
}

/* green — all resolved */
.dashboard-review-resolved {
  background: var(--badge-success-bg);
  color: var(--success);
}

.dashboard-review-counter {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-left: auto;
  cursor: default;
}

.dashboard-review-sep {
  margin: 0 0.3rem;
  opacity: 0.35;
  font-weight: 400;
}

.dashboard-review-badges { flex-wrap: wrap; gap: 0.25rem; justify-content: flex-start; }


/* ─── Machine Endpoints editor (Add/Edit Machine modal) ──────────────────────── */

.ep-row {
  display: grid;
  grid-template-columns: 1fr 1.4fr 1fr auto;
  gap: 0.5rem;
  align-items: center;
  padding: 0.35rem 0;
}
.ep-row + .ep-row { border-top: 1px solid var(--border-light); }
.ep-row input,
.ep-row select {
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 0.8rem;
  background: var(--bg);
  color: var(--text);
}

/* ─── Standards view ─────────────────────────────────────────────────────── */

/* one card · its bar across the top, its rows below, growing up to the view's height where its .metrics-table-wrap scrolls */
.metrics-std-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; display: flex; flex-direction: column; flex: 0 1 auto; min-height: 0; }
.metrics-std-card > .metrics-std-bar { flex-shrink: 0; }
.metrics-std-bar { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; padding: 0.4rem 0.6rem; border-bottom: 1px solid var(--border-light); }
/* the search and formula toggle take the bar's free space, so they and the banner after them sit at the right end the way Statistics' do */
.metrics-std-bar > .filter-row { margin-left: auto; gap: 0.4rem; }
.metrics-std-banner { display: inline-flex; align-items: center; gap: 0.5rem; font-size: 0.8rem; font-weight: 600; color: var(--chart-flagged); }
.metrics-std-banner.hidden { display: none; }
.metrics-std-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.metrics-std-table.hidden { display: none; }
.metrics-std-table th { text-align: left; font-size: 0.7rem; font-weight: 600; color: var(--text-muted); padding: 0.3rem 0.6rem; border-bottom: 1px solid var(--border-light); white-space: nowrap; }
/* the header row stays put while the rows scroll under it */
.metrics-std-card .metrics-table-wrap thead th { position: sticky; top: 0; z-index: 1; background: var(--surface); }
.metrics-std-table td { padding: 0.3rem 0.6rem; border-bottom: 1px solid var(--border-light); font-size: 0.8rem; vertical-align: middle; white-space: nowrap; }
.metrics-std-table td small { display: block; font-size: 0.7rem; color: var(--text-faint); }
/* the p10 – p90 range under a nominal rate · the numbers lead, their labels sit small and faint at either end */
.metrics-std-spread { color: var(--text-muted); }
.metrics-std-pct { font-size: 0.58rem; color: var(--text-faint); letter-spacing: 0.02em; margin: 0 0.2rem; }
.metrics-std-pct:first-child { margin-left: 0; }
/* the module default is the parent row, a shade off the surface, and its files sit indented under it */
.metrics-std-table tr.is-module td { background: color-mix(in srgb, var(--surface-deep) 35%, var(--surface)); }
.metrics-std-table tr.is-locked td { opacity: 0.8; }
.metrics-std-name { display: flex; align-items: flex-start; gap: 0.4rem; }
.metrics-std-name.is-file { padding-left: 2rem; }
/* A square hit target the size of the row's first line, so the fold is easy to land on · the glyph itself stays small */
.metrics-std-caret { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 1.5rem; height: 1.5rem; margin: -0.2rem 0 -0.2rem -0.3rem; padding: 0; background: none; border: 0; border-radius: 4px; color: var(--text-muted); cursor: pointer; font-size: 1rem; transition: transform 0.15s, background 0.15s; }
.metrics-std-caret:hover { background: var(--row-selected); color: var(--text); }
.metrics-std-caret.is-open { transform: rotate(90deg); }
.metrics-std-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 0.3rem; flex: none; }
.metrics-std-own { font-size: 0.62rem; font-weight: 700; color: var(--primary); border: 1px solid currentColor; border-radius: 8px; padding: 0 0.3rem; margin-left: 0.3rem; }
.metrics-std-none { color: var(--text-faint); }
.metrics-std-lock { background: none; border: 0; cursor: pointer; font-size: 0.85rem; padding: 0 0.2rem; color: var(--text); }
.metrics-std-lock.is-off { opacity: 0.35; }

/* the standard is a button that opens the editor · staged is the chart's orange, the same hue the staged line draws in */
.std-value { font: inherit; font-weight: 600; background: none; border: 1px dashed transparent; border-radius: 4px; padding: 0 0.25rem; color: var(--text); cursor: text; display: inline-flex; align-items: center; gap: 0.25rem; }
.std-value:hover { border-color: var(--border); }
.std-value.is-locked { cursor: default; padding: 0 0.25rem; }
.std-pen { font-size: 0.7rem; color: var(--text-faint); }
.std-staged { color: var(--chart-flagged); font-weight: 600; }

/* the Standards editor's Takes Effect section, drawn into the modal editor's right column */
.pe-label { font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); }
.pe-modes { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; }
.pe-modes button { font: inherit; font-size: 0.72rem; border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 4px; padding: 0.15rem 0.4rem; cursor: pointer; }
.pe-modes button.is-on { background: var(--primary); border-color: var(--primary); color: var(--surface); }
.pe-range { display: grid; grid-template-columns: 2.2rem minmax(0, 1fr) 5.2rem; gap: 4px; align-items: center; font-size: 0.72rem; color: var(--text-muted); }
.pe-range input, .pe-reason { font: inherit; font-size: 0.72rem; min-width: 0; padding: 0.1rem 0.3rem; border: 1px solid var(--border); border-radius: 4px; background: var(--surface-deep); color: var(--text); }
.pe-rail { display: grid; grid-template-columns: 3.6rem minmax(0, 1fr); align-items: center; gap: 4px; font-size: 0.7rem; color: var(--text-muted); }
.rail-window { fill: none; stroke: var(--text-faint); stroke-dasharray: 2 2; }
.rail-seg { fill: var(--primary); opacity: 0.28; }
.rail-seg.is-alt { opacity: 0.45; }
.rail-seg.is-staged { fill: var(--chart-flagged); opacity: 0.85; }
.rail-val { font-size: 9.5px; font-weight: 600; fill: var(--text); }
.rail-end { fill: var(--primary); }
.rail-end.is-staged { fill: var(--chart-flagged); }
.rail-now { stroke: var(--text-muted); stroke-width: 1; }
.pe-spans { display: flex; flex-wrap: wrap; gap: 0.15rem 0.6rem; font-size: 0.72rem; padding-left: 3.85rem; }
.pe-spans small { color: var(--text-faint); }
.pe-spans .is-staged, .pe-spans .is-staged small { color: var(--chart-flagged); }
.pe-block { font-size: 0.72rem; color: var(--chart-flagged); }

/* ─── Definitions ────────────────────────────────────────────────────────── */

/* the dock's other pane · its titlebar the chart's own, a scrolling stack of cards below */
.defs-pane { flex: 1; display: flex; flex-direction: column; min-height: 0; overflow: hidden; background: var(--surface); }
.defs-pane.hidden { display: none; }
.defs-title { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.8rem; font-weight: 600; color: var(--navbar-text); }
.defs-title svg { width: 14px; height: 14px; }
.defs-pane-body { flex: 1; overflow-y: auto; min-height: 0; }

/* each section · its icon and name pinned while its cards scroll */
.defs-section-head { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; gap: 0.4rem; padding: 0.4rem 0.7rem; font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); background: color-mix(in srgb, var(--surface-deep) 45%, var(--surface)); border-top: 1px solid var(--border-light); }
.defs-section-head svg { width: 13px; height: 13px; color: var(--primary); }
/* a card's own key · one muted line under its equation, the way a textbook writes "where" */
.defs-where { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.1rem 0.35rem; font-size: 0.72rem; color: var(--text-muted); line-height: 1.5; }
.defs-where-label { font-style: italic; }
.defs-where-item { display: inline-flex; align-items: baseline; gap: 0.25rem; white-space: nowrap; }
.defs-where-item[title] { cursor: help; }
.defs-where-sep { color: var(--text-faint); }
.defs-muted { color: var(--text-muted); }

/* one term · name and symbol, the equation, what it means, the fields that return it */
.defs-term { display: flex; flex-direction: column; gap: 0.2rem; padding: 0.55rem 0.7rem; border-bottom: 1px solid var(--border-light); }
.defs-term-head { display: flex; align-items: baseline; justify-content: space-between; gap: 0.5rem; font-size: 0.8rem; }
.defs-symbol { color: var(--text-muted); }
.defs-eq { padding: 0.1rem 0; overflow-x: auto; }
/* Chromium ignores MathML's columnalign, so a stacked equation's left columns are set here */
.defs-pane mtd[columnalign="left"] { text-align: left; }
.defs-means { font-size: 0.78rem; color: var(--text-sub); line-height: 1.4; }
/* what a term leaves out · quiet outlined tags, read beside the where line */
.defs-excludes { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.25rem; font-size: 0.72rem; color: var(--text-muted); }
.defs-excludes .defs-where-label { margin-right: 0.1rem; }
.defs-tag { padding: 0 0.4rem; border: 1px solid var(--border-light); border-radius: 999px; color: var(--text-sub); line-height: 1.5; }
.defs-fields code { font-size: 0.7rem; color: var(--text-muted); }
.defs-notes { padding: 0.5rem 0.7rem; font-size: 0.72rem; color: var(--text-muted); }
.defs-notes p { margin: 0 0 0.25rem; }
/* one face and one size rule for every equation Definitions hands out · normal style, so a fraction inside a line of text keeps its full size */
.defs-pane math,
.chart-tooltip math { math-style: normal; font-family: "STIX Two Math", "Cambria Math", "Latin Modern Math", math, serif; }
.defs-pane math { font-size: 1rem; color: var(--text); }
.defs-where math { font-size: 0.85rem; color: var(--text-sub); }
/* a formula tooltip's equation reads in its main text, not the muted working under it */
.chart-tooltip math { font-size: 15px; color: var(--tooltip-text); }
.chart-tooltip .tt-detail:has(> math) { padding: 3px 0; }

/* something the code computes that the list doesn't cover · said in the pane as well as in the log */
.metrics-defs-gaps { flex-shrink: 0; padding: 0.5rem 0.7rem; border-bottom: 1px solid var(--border-light); background: var(--danger-bg); color: var(--danger); font-size: 0.78rem; }
.metrics-defs-gaps.hidden { display: none; }
