/* static/css/app.css
 * Everything that is not a design token. Organized by component, one section
 * each. May only reference custom properties that exist in tokens.css.
 *
 * Implements display.md. Target: a single fixed 1024x600 touch panel. No
 * breakpoints, no fluid layout.
 *
 * Two rules run through every component below:
 *   - Nothing depends on :hover. It sticks after a tap on a touchscreen, so
 *     press feedback is :active and focus is :focus-visible.
 *   - Depth is a tonal step (white card on the gray canvas) plus a hairline —
 *     never a heavy border, never a large blur.
 */

/* ===========================================================================
 * BASE / RESET
 * ======================================================================== */

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

html,
body {
  height: 100%;
  overflow: hidden;            /* the page itself never scrolls */
}

body {
  margin: 0;
  width: var(--screen-w);
  height: var(--screen-h);
  font-family: var(--font-ui);
  font-size: var(--fs-base);
  font-weight: var(--fw-regular);
  line-height: var(--lh-normal);
  color: var(--c-ink);
  background: var(--c-surface-2);   /* canvas; cards sit lighter on top */
  -webkit-tap-highlight-color: transparent;
}

/* One focus treatment for the whole app. Components that hide the native
   outline (the search wrapper, the segmented radios) re-draw this ring on the
   element that actually reads as focused — none of them simply remove it. */
:focus-visible {
  outline: var(--focus-w) solid var(--c-brand);
  outline-offset: var(--focus-offset);
}

/* ===========================================================================
 * APP SHELL
 * Persistent chrome (tab bar) sits outside the one scroll container.
 * ======================================================================== */

.app {
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* Transparent: the canvas shows through and the cards inside provide the
   surface. This is the page's only scroll container.
   Height is pinned to --content-h (544px) rather than left to flex, so the
   budget a page has to fit is stated in the code and not merely implied by
   what is left over. */
.app__content {
  flex: 0 0 var(--content-h);
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 0 var(--gutter) var(--gutter);
  overflow-y: auto;
}

/* The app version in the screen's bottom-right corner, floating in the
   content's bottom gutter on every page (it sat right of the clock in the
   tab bar first, 2026-10-14). Never takes height from a page and never
   blocks a tap (pointer-events: none); where a page's last card reaches the
   corner it may sit a few pixels into that card's edge, on its own chip.
   Styled like the tab bar's date (Calibri semibold, tabular figures, same
   size and grey), with --font-ui-dots so its decimal points paint (plain
   Calibri showed "v0 1 33"). Above the results view: same layer, later in
   the page. */
.app-version-tag {
  position: fixed;
  right: var(--gutter);
  bottom: 0;
  z-index: var(--z-overlay);
  font-family: var(--font-ui-dots);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  font-variant-numeric: tabular-nums;
  line-height: 1;
  white-space: nowrap;
  color: var(--c-ink-3);
  /* A canvas-coloured chip, so it stays legible over a card or plot
     scrolling underneath (Analysis is taller than the screen). */
  padding: var(--sp-1) var(--sp-2) 0;
  background: var(--c-surface-2);
  border-top-left-radius: var(--radius-control);
  pointer-events: none;
}

/* ===========================================================================
 * TAB BAR
 * Pills on the canvas, not folder tabs joined to a panel. The active pill is
 * tinted with a brand label; the rest are quiet gray text.
 * States: default, --active, :active (press), :focus-visible ring.
 * No hover, no disabled state.
 * ======================================================================== */

.tabbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  height: var(--tabbar-h);
  padding: 0 var(--gutter);
}

.tabbar__list {
  display: flex;
  gap: var(--sp-1);
  margin: 0;
  padding: 0;
  list-style: none;
}

.tabbar__tab {
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--tab-w);         /* equal width regardless of label length */
  min-height: var(--tap-min);
  padding: 0 var(--sp-3);
  /* The tab list is data-driven, so guard against a future label that does not
     fit: wrapping would make one tab taller than the rest and break the strip. */
  white-space: nowrap;
  overflow: hidden;
  font-size: var(--fs-lg);
  font-weight: var(--fw-regular);
  line-height: var(--lh-tight);
  text-decoration: none;
  color: var(--c-ink-2);
  background: none;
  border: none;
  border-radius: var(--radius-control);
  transition: background-color var(--dur-fast) var(--ease-out);
}

.tabbar__tab:active {
  background: var(--c-surface-2);
}

.tabbar__tab--active {
  font-weight: var(--fw-semibold);
  color: var(--c-brand);
  background: var(--c-brand-tint);
}

/* Ethernet indicator, just left of the clock (margin-left: auto pins the
   pair to the right edge). Status only, not a control — no tap target, no
   states beyond the three link states:
   --online:    cable in + IPv4 address — --c-brand-deep (read-only live
                data, same colour as .fieldtable__value--live)
   --no-ip:     cable in, no address — --c-ink-3
   --unplugged: no cable — --c-ink-3 with a slash over the icon */
/* Busy ring, left of the Ethernet indicator (it takes the margin-left: auto
   that pins the group right). Status only, not a control. Space is kept
   when idle so nothing shifts. States:
   default:  idle, invisible, no animation running
   --active: a job runs on some index; an --c-brand-deep quarter arc turns
             on a --c-brand-tint-strong track, once per --dur-spin. Under
             prefers-reduced-motion it stands still (still visible).
   The one looping animation in the app (display.md §1): transform only. */
.tabbar__busy {
  display: flex;
  width: var(--busy-icon);
  height: var(--busy-icon);
  margin-left: auto;
  margin-right: var(--sp-4);
  visibility: hidden;
}

.tabbar__busy--active {
  visibility: visible;
}

.tabbar__busy-ring {
  width: 100%;
  height: 100%;
  fill: none;
  stroke-width: var(--busy-stroke);
}

.tabbar__busy--active .tabbar__busy-ring {
  animation: tabbar-busy-spin var(--dur-spin) linear infinite;
}

.tabbar__busy-track {
  stroke: var(--c-brand-tint-strong);
}

.tabbar__busy-arc {
  stroke: var(--c-brand-deep);
  stroke-linecap: round;
  stroke-dasharray: 25 75;
}

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

@media (prefers-reduced-motion: reduce) {
  .tabbar__busy--active .tabbar__busy-ring { animation: none; }
}

.tabbar__net {
  position: relative;
  display: flex;
  width: var(--net-icon);
  height: var(--net-icon);
  margin-right: var(--sp-4);
  color: var(--c-ink-3);
}

.tabbar__net-icon {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.tabbar__net--online {
  color: var(--c-brand-deep);
}

.tabbar__net-slash {
  display: none;
}

.tabbar__net--unplugged .tabbar__net-slash {
  display: block;
}

/* Live clock, pinned to the tab bar's right edge via margin-left: auto on
   the flex row. Date ("Oct 12, 2026", no weekday) and time sit on one line,
   baseline-aligned. Static text otherwise — no interactive state.
   font-weight is semibold, not the --fw-regular this size would otherwise
   inherit — regular-weight Calibri has a much more severe form of the
   corrupt-glyph bug (tokens.css) at 17px+ than at the old 14px base: this
   exact string measured 757px instead of ~160px at regular 17px, but a
   correct ~167px at semibold 17px. Confirmed via direct measurement, not
   just visual inspection — see tokens.css for the fuller size/weight table. */
.tabbar__clock {
  display: flex;
  align-items: baseline;
  gap: var(--sp-2);
  font-weight: var(--fw-semibold);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  line-height: var(--lh-tight);
}

.tabbar__clock-date {
  font-size: var(--fs-sm);
  color: var(--c-ink-3);
}

.tabbar__clock-time {
  font-size: var(--fs-base);
  color: var(--c-ink-2);
}

/* ===========================================================================
 * FLASH MESSAGES
 * ======================================================================== */

.flash {
  margin: 0 0 var(--sp-3);
  padding: 0;
  list-style: none;
}

.flash__item {
  padding: var(--sp-2) var(--sp-3);
  font-size: var(--fs-base);
  background: var(--c-surface);
  border-radius: var(--radius-control);
  box-shadow: var(--shadow-1);
}

.flash__item + .flash__item {
  margin-top: var(--sp-2);
}

.flash__item--error {
  color: var(--c-danger);
}

/* ===========================================================================
 * SECTION
 * A card: white on the gray canvas, soft corners, one resting shadow. Replaces
 * the old <fieldset> group box. One major section per screen; a screen that
 * needs two needs two tabs.
 * ======================================================================== */

.section {
  min-width: 0;
  margin: 0;
  padding: var(--sp-4);
  background: var(--c-surface);
  border: none;
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-1);
}

.section + .section {
  margin-top: var(--sp-4);
}

/* Tighter card, for a screen that has to stack three groups plus a committing
   action inside 544px (Process Settings). Buys back ~12px per card without
   dropping below the 8px grid. */
.section--compact {
  padding: var(--sp-3);
}

.section--compact .section__title {
  margin-bottom: var(--sp-2);
}

.section--compact + .section--compact {
  margin-top: var(--sp-3);
}

/* A card that takes the whole content region and lets one child inside it
   absorb the leftover height — the PDF viewer, which should be as tall as the
   screen allows rather than a fixed size. */
.section--fill {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}


/* Inside the card, not straddling a border. Ink, not accent — blue now means
   interactive, and a title is not. */
.section__title {
  margin: 0 0 var(--sp-3);
  font-size: var(--fs-xl);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-tight);
  color: var(--c-ink);
}

/* Row of controls at the top of a section: path field, browse, action, info. */
.section__toolbar {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-bottom: var(--sp-3);
}

/* Chart on the left, fields on the right — horizontal room is not scarce. */
.section__split {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-4);
}

.section__split-main {
  flex: 1 1 auto;
  min-width: 0;
}

.section__split-side {
  flex: 0 0 auto;
}

/* ===========================================================================
 * SECTION ROW
 * Two cards side by side instead of stacked, both stretched to the same height
 * regardless of which holds more. __primary centers its content in the column;
 * __secondary takes the rest and scrolls internally if its list outgrows the
 * stretched card.
 * ======================================================================== */

.section-row {
  display: flex;
  align-items: stretch;
  flex: 1 1 auto;
  min-height: 0;
  gap: var(--sp-4);
}

/* Side by side, not stacked — override the base vertical-stacking margin. */
.section-row > .section + .section {
  margin-top: 0;
}

.section-row__primary {
  display: flex;
  flex-direction: column;
  flex: 1 1 0;
}

.section-row__primary-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1 1 auto;
  min-height: 0;
  gap: var(--sp-4);
}

/* No overflow of its own: display.md §1 allows exactly one scroll container per
   page, and that is .app__content. A nested scroller here also promoted the card
   to its own paint layer, which mis-painted the label column. */
/* Even split with the primary card: Overview's Readings needs the room for its
   two S/T columns. At 1:1 only Mask Sensor Array's Window value wraps; any
   narrower than this and Storage/other values start wrapping too. */
.section-row__secondary {
  display: flex;
  flex-direction: column;
  flex: 1 1 0;
}

/* ===========================================================================
 * FIELD TABLE
 * Read-only values. Gray label, ink value — never a filled box (it invites
 * tapping on a touchscreen) and never blue (blue means interactive now).
 * Numeric readouts use tabular figures so digits do not jitter as values update.
 * ======================================================================== */

.fieldtable {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  column-gap: var(--sp-3);
  row-gap: var(--sp-2);
  align-items: baseline;
  margin: 0;
}

/* Two label/value pairs per line. */
.fieldtable--dual {
  grid-template-columns: max-content minmax(0, 1fr) max-content minmax(0, 1fr);
}

.fieldtable__label {
  text-align: right;
  font-weight: var(--fw-regular);
  color: var(--c-ink-2);
}

.fieldtable__value {
  margin: 0;                   /* <dd> ships with an indent */
  font-weight: var(--fw-semibold);
  color: var(--c-ink);
  font-variant-numeric: tabular-nums;
}

/* Marks a value read from the device itself, not hardcoded placeholder data
   (Overview's Mask Sensor Array/Base cards mix both right now). --c-brand-deep,
   not --c-brand — display.md reserves plain brand blue for interactive/
   selected controls, and a field value here is neither. */
.fieldtable__value--live {
  color: var(--c-brand-deep);
}

/* Column heading over one label/value pair (Overview's Readings: "Acoustic
   Pressure [a.u.]" / "Temperature [°C]"). Spans the pair's two columns and is always
   normal text size, even inside --lg. */
.fieldtable__heading {
  grid-column: span 2;
  font-size: var(--fs-base);
  font-weight: var(--fw-semibold);
  color: var(--c-ink-2);
}

/* A row with no second pair runs to the end of the line. */
.fieldtable--dual .fieldtable__value--span {
  grid-column: span 3;
}

/* Emphasis modifier: a screen's star readout (Overview's S1–S6 / T1–T6), sized
   above even a section title so it reads as the primary content of the tab. */
.fieldtable--lg {
  row-gap: 0;
}

.fieldtable--lg .fieldtable__label,
.fieldtable--lg .fieldtable__value {
  font-size: var(--fs-3xl);
  letter-spacing: var(--track-tight);
  line-height: var(--lh-tight);
}

/* The S/T labels sit smaller than their values (2026-10-14), on the same
   baseline (.fieldtable aligns rows by baseline). Semibold, not the usual
   regular label weight: regular Calibri measures "6" with almost no width at
   every size from 20px to 48px (S6/T6 showed as "S"/"T"), and semibold
   measures every label correctly. Still --c-ink-2, so it reads as a label. */
.fieldtable--lg .fieldtable__label {
  font-size: var(--fs-reading-label);
  font-weight: var(--fw-semibold);
}

/* Dual + lg (Overview's Readings): extra room before each line's second
   label, so a big S value doesn't run into the T label beside it. Even <dt>s
   are the second pair on each line. */
.fieldtable--dual.fieldtable--lg .fieldtable__label:nth-of-type(even),
.fieldtable--dual.fieldtable--lg .fieldtable__heading:nth-of-type(even) {
  padding-left: var(--sp-8);
}

/* --lg has no row gap; give the headings their own room above the rows. */
.fieldtable--lg .fieldtable__heading {
  margin-bottom: var(--sp-2);
}

/* De-emphasis modifier: status detail that recedes below the primary content. */
.fieldtable--sm {
  row-gap: var(--sp-1);
}

.fieldtable--sm .fieldtable__label,
.fieldtable--sm .fieldtable__value {
  font-size: var(--fs-base);
}

/* A step up from the default/sm sizes (Overview's Mask Sensor Array / Base)
   — those two currently render identically at --fs-base (14px) per the
   Calibri stopgap noted in tokens.css, so this is the first modifier that
   actually reads larger than the plain default. */
.fieldtable--md {
  row-gap: var(--sp-2);
}

.fieldtable--md .fieldtable__label,
.fieldtable--md .fieldtable__value {
  font-size: var(--fs-lg);
}

/* ===========================================================================
 * BATTERY ICON
 * battery() in components.html, iPhone-style: faint outline + nub, a fill as
 * wide as the charge level. States: --ok (ink fill), --low (≤20%, red fill),
 * --charging (green fill plus a bolt, outlined in the card's surface colour
 * so it reads over the fill, as on iOS). Status only, never interactive.
 * ======================================================================== */

.battery {
  display: inline-block;
  width: var(--battery-w);
  height: calc(var(--battery-w) * 13 / 27);
  vertical-align: -0.1em;
}

.battery__body {
  fill: none;
  stroke: var(--c-ink-3);
  stroke-width: 1;
}

.battery__nub {
  fill: var(--c-ink-3);
}

.battery__level {
  fill: var(--c-ink);
}

.battery--low .battery__level {
  fill: var(--c-battery-low);
}

.battery--charging .battery__level {
  fill: var(--c-battery-charging);
}

.battery__bolt {
  fill: var(--c-ink);
  stroke: var(--c-surface);
  stroke-width: 1;
  stroke-linejoin: round;
  paint-order: stroke;
}

/* ===========================================================================
 * DATA TABLE
 * Row rules only — no cell grid. A quiet gray header band, not a solid blue bar.
 * ======================================================================== */

.datatable {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-sm);
}

.datatable__cell,
.datatable__head-cell {
  padding: var(--sp-2) var(--sp-3);
  text-align: left;
  border-bottom: var(--border-w-inner) solid var(--c-hairline);
}

.datatable__head-cell {
  font-weight: var(--fw-semibold);
  color: var(--c-ink-2);
  background: var(--c-surface-2);
}

/* The one table that reads as data, not prose. */
.datatable--mono .datatable__cell {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.datatable__cell--num {
  text-align: right;
}

/* ===========================================================================
 * WORKSPACE
 * One card holding a side column and a main region, split by a hairline —
 * the Finder/Settings shape. Both scroll together in the page's one scroll
 * container.
 * ======================================================================== */

.workspace {
  display: flex;
  align-items: stretch;        /* the divider runs the full card height */
  flex: 1 1 auto;
  min-height: 0;
  gap: var(--sp-4);
  padding: var(--sp-4);
  background: var(--c-surface);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-1);
}

/* Nav at the top, action buttons pushed to the bottom. This column owns the
   width and the dividing rule so the <nav> inside stays purely a nav — the
   data-management buttons are actions, not navigation. */
.workspace__side {
  display: flex;
  flex-direction: column;
  flex: 0 0 var(--sidenav-w);
  padding-right: var(--sp-4);
  border-right: var(--border-w-inner) solid var(--c-hairline);
}

.workspace__main {
  flex: 1 1 auto;
  min-width: 0;
}

/* Device Information's Chrome-settings shape: the sidenav shows one of these
   at a time (device_settings.js). A flex column so a .section-row pane (Wifi)
   gets the flex container it needs to stretch its two cards — a lone .section
   pane (Ethernet, Versions) just takes its natural content height inside it. */
.settings-pane {
  display: flex;
  flex-direction: column;
  /* Space between stacked cards. .section + .section can't do it when a
     card is wrapped in a <form> (Information's Timezone card). */
  gap: var(--sp-4);
  flex: 1 1 auto;
  min-height: 0;
}

/* [hidden] and .settings-pane both carry a single class/attribute selector —
   equal specificity, so without this the display:flex above wins the tie and
   a "hidden" pane still renders. Needs its own rule to actually win. */
.settings-pane[hidden] {
  display: none;
}

/* ===========================================================================
 * SIDE NAV
 * The current item is a tinted rounded row with a brand label and glyph — the
 * same "selected" vocabulary as a selected file row, so selection looks the
 * same everywhere. No rail, no fill on the rest.
 * States: default, --current, :active (press tint), :focus-visible ring.
 * No hover; no disabled state yet.
 * ======================================================================== */

.sidenav {
  flex: 0 0 auto;
}

.sidenav__list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.sidenav__row--divided {
  margin-top: var(--sp-2);
  padding-top: var(--sp-2);
  border-top: var(--border-w-inner) solid var(--c-hairline);
}

.sidenav__item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  width: 100%;
  min-height: var(--tap-min);
  padding: 0 var(--sp-3);
  font-family: inherit;
  font-size: var(--fs-base);
  text-align: left;
  color: var(--c-ink);
  background: none;
  border: none;
  border-radius: var(--radius-control);
  cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease-out);
}

.sidenav__item:active {
  background: var(--c-surface-2);
}

.sidenav__item--current {
  font-weight: var(--fw-semibold);
  color: var(--c-brand);
  background: var(--c-brand-tint);
}

.sidenav__item--current .sidenav__glyph {
  color: var(--c-brand);
}

.sidenav__glyph {
  flex: 0 0 auto;
  width: var(--icon);
  height: var(--icon);
  color: var(--c-ink-3);
}

.sidenav__label {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* ===========================================================================
 * FILE LIST
 * The file-table look: a plain header row, hairline row rules, and a tinted
 * pill for the selected row. Used by the Analysis tab's index table (INDEX
 * LIST below); the File Manager tab it was built for was removed on
 * 2026-10-14, along with its search box, breadcrumb and Size/Last modified
 * columns.
 * ======================================================================== */

.filelist__table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
}

.filelist__head-cell {
  padding: 0 var(--sp-3) var(--sp-2);
  text-align: left;
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  color: var(--c-ink-2);
  border-bottom: var(--border-w-inner) solid var(--c-hairline);
}

.filelist__row {
  height: var(--tap-min);      /* rows are tap targets once they act */
  cursor: pointer;
}

.filelist__cell {
  padding: 0 var(--sp-3);
  border-bottom: var(--border-w-inner) solid var(--c-hairline);
}

/* The inset: the rule starts where the text starts, so it never runs under the
   row's leading edge. Applied by clearing the border on the first cell's own
   left padding box rather than by insetting the whole table. */
.filelist__row:last-child .filelist__cell {
  border-bottom: none;
}

.filelist__cell--meta {
  font-size: var(--fs-sm);
  color: var(--c-ink-2);
  font-variant-numeric: tabular-nums;
}

/* Selected row: a tint fill and nothing else. No rail, no border change — so
   nothing shifts sideways as the selection moves. Corners are rounded on the
   end cells so the fill reads as one pill across the row. */
.filelist__row--selected .filelist__cell {
  background: var(--c-brand-tint);
}

.filelist__row--selected .filelist__cell:first-child {
  border-top-left-radius: var(--radius-control);
  border-bottom-left-radius: var(--radius-control);
}

.filelist__row--selected .filelist__cell:last-child {
  border-top-right-radius: var(--radius-control);
  border-bottom-right-radius: var(--radius-control);
}

.filelist__row--selected .filelist__name-text {
  font-weight: var(--fw-semibold);
  color: var(--c-brand);
}

.filelist__row--selected .filelist__glyph {
  color: var(--c-brand);
}

.filelist__name {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  min-width: 0;
}

.filelist__glyph {
  flex: 0 0 auto;
  width: var(--icon);
  height: var(--icon);
  color: var(--c-ink-3);
}

.filelist__name-text {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* ===========================================================================
 * BUTTON
 * Three variants and no more: primary (filled brand), tinted (brand on tint),
 * plain (brand on nothing). Sentence case, semibold, never uppercase. Only one
 * filled blue button may appear in a view.
 * States: default, :active (press fill + 0.97 scale), :focus-visible ring,
 * :disabled (gray on gray). No hover — it sticks after a tap.
 * ======================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);            /* only spends space when an icon is present */
  min-height: var(--tap-min);
  min-width: var(--tap-min);
  /* Top-only padding optically centres the label (see --btn-label-nudge) and is
     absorbed by min-height, so the control is still --tap-min tall. */
  padding: var(--btn-label-nudge) var(--sp-4) 0;
  font-family: inherit;
  font-size: var(--fs-base);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-tight);
  text-decoration: none;
  color: var(--c-brand-contrast);
  background: var(--c-brand);
  border: none;
  border-radius: var(--radius-control);
  cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease-out),
              transform var(--dur-fast) var(--ease-out);
}

.btn__icon {
  flex: 0 0 auto;
  width: var(--icon);
  height: var(--icon);
}

/* Stacked in a sidebar column, where ragged widths read as an accident. */
.btn--block {
  width: 100%;
}

/* A lone primary action (Overview's Record) that must hold its width regardless
   of its container, instead of stretching like --block or shrinking to its
   label like the bare default. */
.btn--fixed {
  width: var(--btn-w-fixed);
}

/* The one standout action on a screen — taller target, larger label. */
.btn--lg {
  min-height: var(--tap-lg);
  padding-top: calc(var(--btn-label-nudge) * 1.5);
  font-size: var(--fs-lg);
}

/* Secondary. Replaces the old outline button: a tint carries the accent without
   drawing a second hard edge next to the primary action. */
.btn--tinted {
  color: var(--c-brand);
  background: var(--c-brand-tint);
}

/* Tertiary: toolbar actions and anything that should not read as a control
   until you look for it. */
.btn--plain {
  color: var(--c-brand);
  background: none;
}

.btn:active {
  background: var(--c-brand-press);
  transform: scale(0.97);
}

.btn--tinted:active,
.btn--plain:active {
  background: var(--c-surface-2);
}

.btn:disabled,
.btn--disabled {
  color: var(--c-ink-3);
  background: var(--c-surface-2);
  cursor: not-allowed;
  transform: none;
}

/* ===========================================================================
 * CHECKBOX
 * Native checkbox, brand-colored via accent-color. The wrapping label is the
 * --tap-min square tap target; the box inside is --checkbox-size.
 * States: default, checked, :active (wrapper press tint), :focus-visible
 * (the global ring, on the input), :disabled (browser's own gray, no press).
 * No error state.
 * ======================================================================== */

.checkbox {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: var(--tap-min);
  height: var(--tap-min);
  border-radius: var(--radius-control);
  cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease-out);
}

.checkbox:active {
  background: var(--c-surface-2);
}

.checkbox__input {
  width: var(--checkbox-size);
  height: var(--checkbox-size);
  margin: 0;
  accent-color: var(--c-brand);
  cursor: inherit;
}

/* A control sitting in line with a field, e.g. Drive Frequency 2's checkbox
   beside its input. The field takes the rest of the row (text_field grow). */
.field-inline {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

/* ===========================================================================
 * CHOOSE LIST
 * The checkbox rows inside the results view's plot chooser (a dialog with
 * the INFO DIALOG look, below). Each row is a whole --tap-min label, so
 * tapping the text ticks the box too. A disabled box (the one-to-two rule)
 * greys its row's text. OK / Cancel share the row, right-aligned.
 * ======================================================================== */

.choose-list {
  display: flex;
  flex-direction: column;
}

.choose-list__option {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  min-height: var(--tap-min);
  font-size: var(--fs-base);
  font-weight: var(--fw-semibold);   /* Calibri regular-weight bug */
  color: var(--c-ink);
  cursor: pointer;
}

.choose-list__option:has(:disabled) {
  color: var(--c-ink-3);
  cursor: not-allowed;
}

.choose-list__actions {
  gap: var(--sp-2);
}

/* ===========================================================================
 * RUN DIALOG
 * The Analysis tab's Run processing popup (a dialog with the INFO DIALOG
 * look, below): two keypad fields, stacked (side by side the longer label
 * doesn't fit half the card), and Cancel / Start (.choose-list__actions).
 * The note line says when Start would only redo results the index already
 * has.
 * States: Start default / :disabled (the .btn's own).
 * ======================================================================== */

.run-dialog__fields {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.run-dialog__fields > .field-row {
  margin-top: 0;
}

.run-dialog__note {
  margin: 0;
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);   /* Calibri regular-weight bug */
  color: var(--c-ink-2);
}

/* ===========================================================================
 * INFO DIALOG
 * Modal <dialog> explaining one parameter (_partials/info_dialog.html,
 * js/info_dialog.js), built like the keypad below: no fill on the <dialog>,
 * .info-dialog__panel is the card, so a backdrop tap closes it. Static text
 * plus an ordinary .btn Close; no states of its own.
 * ======================================================================== */

.info-dialog {
  padding: 0;
  border: none;
  background: none;
  overflow: visible;
}

.info-dialog::backdrop {
  background: var(--c-scrim);
}

.info-dialog__panel {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  width: var(--info-dialog-w);
  padding: var(--sp-4);
  background: var(--c-surface);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-2);
}

.info-dialog__title {
  margin: 0;
  font-size: var(--fs-lg);
  font-weight: var(--fw-semibold);
  color: var(--c-ink);
}

.info-dialog__text {
  margin: 0;
  font-size: var(--fs-base);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-normal);
  color: var(--c-ink-2);
}

.info-dialog__actions {
  display: flex;
  justify-content: flex-end;
}

/* ===========================================================================
 * KEYBOARD
 * On-screen text keyboard, a modal <dialog> like the keypad below
 * (_partials/keyboard.html, js/keyboard.js): no fill on the <dialog>, so a
 * backdrop tap closes it. The typed text (pre-wrap, with a blinking caret at
 * the end) above an 11-column key grid, then Cancel / Save.
 * Key states: default (surface-2 fill), :active (hairline fill + 0.97 scale),
 * Shift on (.kbd--shift: brand-tint Shift key, letters shown uppercase),
 * :focus-visible ring (the global one). Keys and the typed text are in
 * --font-mono: the bundled Calibri left the p, . and ! keys blank (the
 * font bug in tokens.css), and a keyboard can't have blank keys.
 * ======================================================================== */

.kbd {
  padding: 0;
  border: none;
  background: none;
  overflow: visible;
}

.kbd::backdrop {
  background: var(--c-scrim);
}

.kbd__panel {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  padding: var(--sp-4);
  background: var(--c-surface);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-2);
}

.kbd__label {
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  color: var(--c-ink-2);
}

.kbd__value {
  height: var(--kbd-value-h);
  overflow-y: auto;
  padding: var(--sp-2) var(--sp-3);
  font-family: var(--font-mono);
  font-size: var(--fs-base);
  line-height: var(--lh-normal);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: var(--c-ink);
  border: var(--border-w-inner) solid var(--c-hairline);
  border-radius: var(--radius-control);
}

.kbd__caret {
  display: inline-block;
  width: 2px;
  height: 1.1em;
  margin-left: 1px;
  vertical-align: text-bottom;
  background: var(--c-brand);
  animation: kbd-caret 1s steps(1) infinite;
}

@keyframes kbd-caret {
  50% { opacity: 0; }
}

.kbd__keys {
  display: grid;
  grid-template-columns: repeat(11, var(--kbd-key-w));
  grid-auto-rows: var(--kbd-key-h);
  gap: var(--sp-1);
}

.kbd__key {
  font-family: var(--font-mono);
  font-size: var(--fs-lg);
  font-weight: var(--fw-semibold);
  color: var(--c-ink);
  background: var(--c-surface-2);
  border: none;
  border-radius: var(--radius-control);
  cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
}

.kbd__key--fn {
  color: var(--c-brand);
}

.kbd__key--small {
  font-size: var(--fs-base);
}

.kbd__key--wide {
  grid-column: span 2;
}

.kbd__key--space {
  grid-column: span 5;
}

.kbd--shift .kbd__key--letter {
  text-transform: uppercase;
}

.kbd--shift [data-key="shift"] {
  background: var(--c-brand-tint);
}

.kbd__key:active {
  background: var(--c-hairline);
  transform: scale(0.97);
}

.kbd__actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-2);
}

@media (prefers-reduced-motion: reduce) {
  .kbd__caret { animation: none; }
}

/* ===========================================================================
 * KEYPAD
 * On-screen number keypad, a modal <dialog> centered over a dimmed page
 * (_partials/keypad.html, js/keypad.js). The dialog itself has no padding and
 * no fill — .keypad__panel is the visible card — so a tap that reaches the
 * <dialog> element can only have landed on the backdrop, which closes it.
 * Display: field label above the value being typed; right after opening, the
 * value shows "fresh" (tinted, like a selection) until the first key.
 * Key states: default (surface-2 fill), :active (hairline fill + 0.97 scale),
 * :focus-visible ring (the global one). No disabled or error state — every key always works.
 * Cancel / OK are ordinary tinted / primary .btn with their own states.
 * ======================================================================== */

.keypad {
  padding: 0;
  border: none;
  background: none;
  overflow: visible;
}

.keypad::backdrop {
  background: var(--c-scrim);
}

.keypad__panel {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  padding: var(--sp-4);
  background: var(--c-surface);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-2);
}

.keypad__display {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
}

.keypad__label {
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  color: var(--c-ink-2);
}

/* Fixed width (the keys' own grid width), left-aligned: the Calibri bug in
   tokens.css makes right-aligned text land in the wrong place. */
.keypad__value {
  display: block;
  min-height: var(--tap-lg);
  padding: var(--sp-2) var(--sp-3) 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: var(--fs-keypad);
  font-weight: var(--fw-semibold);
  font-variant-numeric: tabular-nums;
  line-height: var(--lh-tight);
  color: var(--c-ink);
  border: var(--border-w-inner) solid var(--c-hairline);
  border-radius: var(--radius-control);
}

.keypad__value--fresh {
  background: var(--c-brand-tint);
}

.keypad__keys {
  display: grid;
  grid-template-columns: repeat(4, var(--keypad-key));
  grid-auto-rows: var(--keypad-key);
  gap: var(--sp-2);
}

.keypad__key {
  font-family: inherit;
  font-size: var(--fs-keypad);
  font-weight: var(--fw-semibold);
  color: var(--c-ink);
  background: var(--c-surface-2);
  border: none;
  border-radius: var(--radius-control);
  cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease-out),
              transform var(--dur-fast) var(--ease-out);
}

/* Backspace / Clear / sign: brand-colored so they read as actions, not
   characters. "Clear" is a word, so it drops to the normal text size. */
.keypad__key--fn {
  color: var(--c-brand);
}

.keypad__key[data-key="clear"] {
  font-size: var(--fs-base);
}

.keypad__key--wide {
  grid-column: span 2;
}

.keypad__key:active {
  background: var(--c-hairline);
  transform: scale(0.97);
}

.keypad__actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-2);
}

/* ===========================================================================
 * TEXT FIELD
 * Flat white, hairline border, no inner shadow and no gray fill. On focus the
 * border takes the accent and the ring appears.
 * States: default, :focus-visible, :disabled, --error.
 * ======================================================================== */

.field {
  min-height: var(--tap-min);
  padding: 0 var(--sp-3);
  font-family: inherit;
  font-size: var(--fs-base);
  color: var(--c-ink);
  background: var(--c-surface);
  border: var(--border-w-inner) solid var(--c-hairline);
  border-radius: var(--radius-control);
}

.field::placeholder {
  color: var(--c-ink-3);
}

.field:focus-visible {
  border-color: var(--c-brand);
}

.field--grow {
  flex: 1 1 auto;
  min-width: 0;
}

/* A field that shouldn't stretch to fill its column (Settings tab's Mode
   group) — left-aligned at a fixed, deliberately narrow width instead. */
.field--narrow {
  align-self: flex-start;
  width: var(--field-w-sm);
}

.field:disabled {
  color: var(--c-ink-3);
  background: var(--c-surface-2);
  border-color: var(--c-hairline);
  cursor: not-allowed;
}

.field--error {
  border-color: var(--c-danger);
}

/* ===========================================================================
 * ICON BUTTON
 * Bare accent glyph in a --tap-min tap area, no resting fill, so a toolbar of
 * these stays quiet next to the one filled .btn. The rule across the app: a
 * glyph you can press is blue; a glyph that only labels something (file kind,
 * search, chart axes) is gray.
 * States: default, :active (tint fill), :disabled (gray glyph),
 * :focus-visible ring. No hover.
 * ======================================================================== */

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--tap-min);
  height: var(--tap-min);
  padding: 0;
  color: var(--c-brand);
  background: none;
  border: none;
  border-radius: var(--radius-control);
  cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease-out);
}

.icon-btn__glyph {
  width: var(--icon);
  height: var(--icon);
}

.icon-btn:active {
  background: var(--c-brand-tint);
}

.icon-btn:disabled {
  color: var(--c-ink-3);
  background: none;
  cursor: not-allowed;
}

/* ===========================================================================
 * CHART PLACEHOLDER
 * Holds the ~200px chart slot until the real plot lands. Real charts draw their
 * series in --c-brand (a second in --c-brand-deep), gridlines 1px --c-hairline,
 * ticks and axis titles --c-ink-3 at --fs-xs.
 * ======================================================================== */

.chart-ph {
  display: flex;
  align-items: center;
  justify-content: center;
  height: var(--chart-h);
  font-size: var(--fs-sm);
  color: var(--c-ink-3);
  background: var(--c-surface-2);
  border-radius: var(--radius-control);
}

.chart-ph--sm {
  height: var(--chart-h-sm);
}

/* Two plots across. Equal columns, each allowed to shrink — min-width: 0 or the
   placeholder's own text would set a floor and push the pair wider than the
   card. */
.chart-row {
  display: flex;
  gap: var(--sp-4);
}

.chart-row > * {
  flex: 1 1 0;
  min-width: 0;
}

/* ===========================================================================
 * TOGGLE GRID
 * Push buttons that toggle — one per file. Multi-select counterpart to
 * .segmented: same hidden-input technique, but checkboxes, so any number can be
 * on at once and it submits without JavaScript.
 * States: default (outline), :checked (filled brand), :focus-visible ring,
 * :active (press). No hover.
 * ======================================================================== */

.togglegrid {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
}

.togglegrid__input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.togglegrid__option {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: var(--tap-min);
  min-height: var(--tap-min);
  padding: 0 var(--sp-3);
  font-size: var(--fs-base);
  color: var(--c-ink);
  background: var(--c-surface);
  border: var(--border-w-inner) solid var(--c-hairline);
  border-radius: var(--radius-control);
  cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease-out);
}

.togglegrid__input:checked + .togglegrid__option {
  font-weight: var(--fw-semibold);
  color: var(--c-brand-contrast);
  background: var(--c-brand);
  border-color: var(--c-brand);
}

.togglegrid__input:focus-visible + .togglegrid__option {
  outline: var(--focus-w) solid var(--c-brand);
  outline-offset: var(--focus-offset);
}

.togglegrid__option:active {
  background: var(--c-surface-2);
}

.togglegrid__input:checked + .togglegrid__option:active {
  background: var(--c-brand-press);
}

/* ===========================================================================
 * SELECT
 * Native <select> styled to match .field — the device's own picker is a better
 * tap target than anything we would build, and it needs no JavaScript.
 * States: default, :focus-visible, :disabled.
 * ======================================================================== */

.select {
  min-height: var(--tap-min);
  padding: 0 var(--sp-3);
  font-family: inherit;
  font-size: var(--fs-base);
  color: var(--c-ink);
  background: var(--c-surface);
  border: var(--border-w-inner) solid var(--c-hairline);
  border-radius: var(--radius-control);
  cursor: pointer;
}

.select:focus-visible {
  border-color: var(--c-brand);
}

.select:disabled {
  color: var(--c-ink-3);
  background: var(--c-surface-2);
  cursor: not-allowed;
}

/* ===========================================================================
 * WIFI LIST
 * Nearby networks (Device Settings). Row rules only, like .filelist.
 * States: default, --connected (tint fill), :active, :focus-visible ring.
 * ======================================================================== */

.wifilist {
  margin: 0;
  padding: 0;
  list-style: none;
}

.wifilist__row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  min-height: var(--tap-min);
  padding: 0 var(--sp-3);
  border-bottom: var(--border-w-inner) solid var(--c-hairline);
  border-radius: var(--radius-control);
  cursor: pointer;
}

.wifilist__row:last-child {
  border-bottom: none;
}

.wifilist__glyph {
  flex: 0 0 auto;
  width: var(--icon);
  height: var(--icon);
  color: var(--c-ink-3);
}

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

.wifilist__lock {
  flex: 0 0 auto;
  width: var(--fs-base);
  height: var(--fs-base);
  color: var(--c-ink-3);
}

/* Tint pill, not an outlined chip — a tag is not a control and should not look
   like one. */
.wifilist__tag {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  height: var(--fs-xl);
  line-height: var(--fs-xl);   /* matches height so the text has no leading to
                                  centre within — sidesteps the ascent/descent
                                  asymmetry flex centring alone cannot fix */
  padding: 0 var(--sp-2);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  color: var(--c-brand);
  background: var(--c-brand-tint);
  border-radius: var(--radius-pill);
}

/* The network actually in use — the same tint-fill vocabulary as a selected
   file row and the current side-nav item. */
.wifilist__row--connected {
  background: var(--c-brand-tint);
  border-bottom-color: transparent;
}

.wifilist__row--connected .wifilist__name {
  font-weight: var(--fw-semibold);
  color: var(--c-brand);
}

.wifilist__row--connected .wifilist__glyph {
  color: var(--c-brand);
}

/* The connected row already carries the tint, so its tag would disappear into
   it — invert to a solid chip there. */
.wifilist__row--connected .wifilist__tag {
  color: var(--c-brand-contrast);
  background: var(--c-brand);
}

/* ===========================================================================
 * SEGMENTED CONTROL
 * A gray track with a white pill on the selected option — the iOS shape. Built
 * on radio inputs, same technique as a native radio group: visually hidden but
 * focusable input, the label does the styling and the toggling, no JS needed.
 * States: default, :checked (white pill), :focus-visible ring, :active.
 * ======================================================================== */

.segmented {
  display: inline-flex;
  gap: var(--sp-1);
  padding: var(--sp-1);
  background: var(--c-surface-2);
  border-radius: var(--radius-control);
}

.segmented__radio {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.segmented__option {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--tap-min);
  padding: 0 var(--sp-4);
  font-size: var(--fs-base);
  font-weight: var(--fw-regular);
  color: var(--c-ink);
  background: none;
  border-radius: var(--radius-control);
  cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease-out);
}

.segmented__radio:checked + .segmented__option {
  font-weight: var(--fw-semibold);
  color: var(--c-brand);
  background: var(--c-surface);
  box-shadow: var(--shadow-1);
}

.segmented__radio:focus-visible + .segmented__option {
  outline: var(--focus-w) solid var(--c-brand);
  outline-offset: var(--focus-offset);
}

.segmented__option:active {
  background: var(--c-surface);
}

/* ===========================================================================
 * CONNECTION FORM
 * A labelled editable field (Wifi's Password) and the action row beneath it.
 * field_table covers read-only rows; this is the counterpart for the rare row
 * that takes real input.
 * ======================================================================== */

.field-row {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
  margin-top: var(--sp-3);
}

.field-row__label {
  font-size: var(--fs-sm);
  color: var(--c-ink-2);
}

/* A parameter the app really uses (field_label(..., used=true)); the
   Settings tab's other labels stay --c-ink-2 until something reads them. */
.field-row__label--used {
  color: var(--c-brand);
}

/* Label plus its info button (field_label() in components.html). Kept on
   one line: a wrapped label makes its row taller than its neighbours'. */
.field-row__head {
  display: flex;
  align-items: center;
  white-space: nowrap;
}

/* Info button after a field label. A --tap-min target, but negative margins
   keep its footprint to the --icon glyph (plus an --sp-1 gap from the label
   text) so the label row doesn't grow or wrap.
   States: default (brand glyph), :active (brand-tint fill), :focus-visible
   ring (the global one). Never disabled. */
.info-btn {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--tap-min);
  height: var(--tap-min);
  margin-block: calc((var(--icon) - var(--tap-min)) / 2);
  margin-inline: calc((var(--icon) - var(--tap-min)) / 2 + var(--sp-1)) calc((var(--icon) - var(--tap-min)) / 2);
  padding: 0;
  color: var(--c-brand);
  background: none;
  border: none;
  border-radius: var(--radius-control);
  cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease-out);
}

.info-btn:active {
  background: var(--c-brand-tint);
}

.info-btn__glyph {
  width: var(--icon);
  height: var(--icon);
}

/* A field paired with the controls that act on it — the path field with its
   Browse and Save buttons. The field takes the remaining width; the buttons
   keep their own, so the row never wraps. */
.field-row__controls {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.field-row__controls > .field,
.field-row__controls > .select {
  flex: 1 1 auto;
  min-width: 0;
}

/* One line of explanation under a field. Never carries an error — errors go to
   the flash region at the top of the content area. */
.field-row__hint {
  margin: 0;
  font-size: var(--fs-sm);
  color: var(--c-ink-3);
}

/* Short numeric fields sitting across rather than stacked — two of them cost
   two rows of height otherwise, and this screen has none to spare. */
.field-grid {
  display: flex;
  gap: var(--sp-4);
}

.field-grid > .field-row {
  flex: 1 1 0;
  min-width: 0;
  margin-top: 0;
}

/* ===========================================================================
 * SETTINGS FORM
 * The Settings tab's two groups side by side: Configuration (__main) takes
 * the wider column, since its rows hold two or three fields each; Mode
 * (__side) is a narrow column whose fields stack. Top-aligned, not
 * stretched — the two cards are different heights and neither needs to
 * fill. No states of its own; the fields inside carry theirs.
 * ======================================================================== */

.settings-form {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-4);
}

/* Side by side, not stacked — cancel .section--compact's stacking margin. */
.settings-form > .section--compact + .section--compact {
  margin-top: 0;
}

.settings-form__main {
  flex: 2 1 0;
  min-width: 0;
}

.settings-form__side {
  flex: 1 1 0;
  min-width: 0;
}

.settings-form__side .field-row:first-of-type {
  margin-top: 0;
}

/* A readout beside a control, as on Single File Overview's toolbar. */
.inline-readout {
  font-size: var(--fs-base);
  color: var(--c-ink-2);
}

.inline-readout__value {
  font-weight: var(--fw-semibold);
  color: var(--c-ink);
  font-variant-numeric: tabular-nums;
}

/* ===========================================================================
 * PDF VIEWER
 * One page of a report, drawn into a canvas by the vendored pdf.js. No browser
 * plugin and no network. Exactly one page exists at a time, scaled to the
 * container's width — overflow is hidden rather than scrollable, because the
 * pager is the only way pages are meant to change.
 * States: loading / error (via .pdfview__status), drawn (status hidden).
 * ======================================================================== */

/* The one place in the app with a second scroll container, and deliberately so:
   a portrait page fitted to this screen's width is ~1365px tall against ~370px
   of room, so the page itself has to pan vertically. It scrolls its own content
   only — the page chrome and the pager stay put, and the tab bar is untouched.
   Horizontal overflow stays hidden: fitting to width means there is never any. */
.pdfview {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  background: var(--c-surface-2);
  border-radius: var(--radius-control);
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;   /* panning the page must not scroll the tab away */
}

.pdfview__canvas {
  display: block;
  /* Fit to width: the script sizes the backing store, this holds the box to the
     container even for a moment before the first render lands. */
  width: 100%;
}

/* Centred over the canvas area so a loading or error message does not shift the
   layout when it appears and disappears. */
.pdfview__status {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  font-size: var(--fs-base);
  color: var(--c-ink-3);
}

.pdfview__status[hidden] {
  display: none;
}

/* ===========================================================================
 * PAGER
 * Previous / Next either side of a page count. The two controls are anchors,
 * not buttons, so each page is a real URL; at either end they become inert
 * spans carrying .btn--disabled rather than dead links.
 * ======================================================================== */

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-4);
  flex: 0 0 auto;
  margin-top: var(--sp-2);
}

.pager__status {
  min-width: var(--btn-w-fixed);
  text-align: center;
  font-size: var(--fs-base);
  color: var(--c-ink-2);
  font-variant-numeric: tabular-nums;
}

/* ===========================================================================
 * PAGE ACTIONS
 * The screen's committing action, below the last card rather than inside it —
 * it acts on every group above, not on one of them.
 * ======================================================================== */

.page-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--sp-2);
  margin-top: var(--sp-4);
}

/* Shared by any card whose actions sit at its foot (Ethernet's Save/Cancel,
   the Update pane's buttons) rather than after the last field in normal
   flow. Pins to the bottom only when its parent is itself a flex column
   that stretches (e.g. .section-row__secondary) — on a card that doesn't
   stretch, it just reads as the last thing in the card, which is also
   correct there. */
.form-actions {
  display: flex;
  gap: var(--sp-2);
  margin-top: auto;
  padding-top: var(--sp-4);
}

.form-actions > .btn {
  flex: 1 1 0;
}

/* ===========================================================================
 * UPDATE PANEL
 * The Update pane's status line: neutral while just informing (checked,
 * confirming), amber for the "this will restart" warning before the user
 * commits, red only for a real failure. No looping animation while an
 * update is in flight (display.md's hardware ceiling) — "Checking…" /
 * "Updating…" communicate progress through the disabled button label alone.
 * ======================================================================== */

/* App Version's value in Maintenance > Information, one line: the version
   number, "Check for Updates", then the update status and its buttons to the
   right (.update-panel, filled by device_settings.js; empty until a check
   runs). A long message wraps inside the panel instead of pushing the row. */
.app-version {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
}

.update-panel {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

/* Buttons keep their own width beside the message, not .form-actions' usual
   equal-width stretch or its top padding. */
.update-panel .form-actions {
  flex: 0 0 auto;
  margin-top: 0;
  padding-top: 0;
}

.update-panel .form-actions > .btn {
  flex: 0 0 auto;
}

/* .btn's display: inline-flex would otherwise beat [hidden] (the confirm
   step hides the check button). */
.app-version > .btn[hidden] {
  display: none;
}

.update-panel__message {
  margin: 0;
  font-size: var(--fs-sm);
  color: var(--c-ink-2);
}

.update-panel__message--warn {
  color: var(--c-brand-deep);
}

.update-panel__message--error {
  color: var(--c-danger);
}

/* Maintenance > Information > Timezone: why a Save failed, under the
   dropdown (device_settings.js). Nothing is shown on success. Semibold for
   the Calibri bug's sake (tokens.css). */
.timezone-error {
  margin: 0;
  font-size: var(--fs-base);
  font-weight: var(--fw-semibold);
  color: var(--c-danger);
}

/* ===========================================================================
 * RMS PLOT
 * The Analysis tab's CH4-over-time plot (helper script, part 1), drawn as SVG
 * by process_settings.js at the card's width and --chart-h-lg tall. One
 * series in --c-brand; the gaps between files already separate them, so no
 * per-file colours (display.md: one accent).
 * The WF RMS card's plot (2026-10-27) is the same component, one series per
 * list of .wfm files, one line per list like CH4's, through its files in
 * time order (they alternate between four sensors, which read close enough
 * on 303 that the line barely zigzags).
 * A row of file checkboxes (.rms-plot__files, the shared .checkbox) runs along
 * the top, one centred over each file's trace; an unchecked file's line turns
 * --c-hairline grey (.rms-plot__line--off).
 * Past 15 files (.rms-plot--scroll) the plot keeps each file's width and
 * scrolls sideways in .rms-plot__scroll, beside a fixed axis SVG. A second
 * scroll container on the page, deliberately (display.md §1), like the Log
 * Viewer's: the user asked for it, and squeezing the files would put their
 * checkboxes closer than a tap target.
 * States: processing / error (via .rms-plot__status, centred where the plot
 * will be), drawn (status hidden), scrolling, inspecting (tap or drag on the plot:
 * crosshair, marker and tooltip; a mouse leaving hides them, a finger
 * lifting leaves them up). No hover-only meaning: touch triggers the same.
 * Without JS: the last run's PNG in a <noscript>, if one exists.
 * ======================================================================== */

.rms-plot {
  position: relative;
  height: var(--chart-h-lg);
}

.rms-plot__status {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  font-size: var(--fs-base);
  color: var(--c-ink-3);
}

.rms-plot__status--error {
  color: var(--c-danger);
}

.rms-plot__status[hidden],
.rms-plot__body[hidden],
.rms-plot__tooltip[hidden] {
  display: none;
}

.rms-plot__body {
  display: flex;
  height: 100%;
}

.rms-plot__axis-svg {
  display: block;
  flex: 0 0 auto;
}

.rms-plot__scroll {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;   /* a swipe past the end must not navigate */
}

/* Width and height come from the script. */
.rms-plot__svg {
  display: block;
  touch-action: pan-y;   /* horizontal drags inspect; vertical still scrolls */
}

/* Scrolling: a horizontal swipe pans the plot instead; a tap still inspects. */
.rms-plot--scroll .rms-plot__svg {
  touch-action: pan-x pan-y;
}

.rms-plot__image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.rms-plot__grid {
  stroke: var(--c-hairline);
  stroke-width: 1;
}

.rms-plot__axis {
  stroke: var(--c-ink-3);
  stroke-width: 1;
}

/* Semibold, not the page's regular: anchored/auto-width text at 17px hits
   the Calibri advance bug (tokens.css) at regular weight. */
.rms-plot__tick,
.rms-plot__axis-title {
  fill: var(--c-ink-3);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
}

/* Numbers in mono: Calibri drops the decimal point, which turns 0.04 into
   "0 04". The bug was never seen in --font-mono (tokens.css). */
.rms-plot__tick,
.rms-plot__tooltip {
  font-family: var(--font-mono);
}

.rms-plot__line {
  fill: none;
  stroke: var(--c-brand);
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.rms-plot__line--off {
  stroke: var(--c-hairline);
}

/* Above the SVG, in the top margin the script leaves for it. Positions come
   from the script, one per file. */
.rms-plot__files {
  position: absolute;
  top: 0;
  left: 0;   /* width from the script: the full, possibly scrolling, plot */
  height: var(--tap-min);
}

.rms-plot__file {
  position: absolute;
  top: 0;
}

.rms-plot__crosshair {
  stroke: var(--c-ink-3);
  stroke-width: 1;
}

.rms-plot__marker {
  fill: var(--c-brand);
  stroke: var(--c-surface);
  stroke-width: 2;
}

/* At the plot's top edge, under the checkbox row, clamped inside the card by
   the script. Ink, not series colour, for the text. */
.rms-plot__tooltip {
  position: absolute;
  top: var(--tap-min);
  padding: var(--sp-1) var(--sp-2);
  background: var(--c-surface);
  border: 1px solid var(--c-hairline);
  border-radius: var(--radius-control);
  box-shadow: var(--shadow-2);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);   /* auto-width: see .rms-plot__tick */
  color: var(--c-ink);
  white-space: nowrap;
  pointer-events: none;
}

/* ===========================================================================
 * RESULTS VIEW
 * The Analysis tab's results, shown over the Analysis page by View results.
 * Not a modal: no backdrop, no focus trap. It covers exactly the content
 * region (below the tab bar, --content-h tall) on the same canvas, so it
 * reads as a page of its own; Back hides it again and the Analysis page
 * underneath is as it was. Scrolls vertically itself if its cards ever
 * outgrow 544px, as the page would.
 * States: hidden (default), shown.
 * ======================================================================== */

.results-view {
  position: fixed;
  z-index: var(--z-overlay);   /* above the index table's sticky header */
  top: var(--tabbar-h);
  left: 0;
  right: 0;
  height: var(--content-h);
  display: flex;
  flex-direction: column;
  padding: 0 var(--gutter) var(--gutter);
  background: var(--c-surface-2);
  overflow-y: auto;
}

.results-view[hidden] {
  display: none;
}

.results-view__header {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-bottom: var(--sp-3);
}

.results-view__title {
  margin: 0;
  font-size: var(--fs-xl);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-tight);
  color: var(--c-ink);
}

/* Result source: the radio buttons (a .segmented) above the 2D map strip, in
   a card of their own, the two options sharing its full width. States are
   .segmented's. */
.results-source .segmented {
  display: flex;
}

.results-source .segmented__option {
  flex: 1 1 0;
}

/* Cards that belong to one mode (data-results="rms" / "wf"); the other
   mode's are hidden. Needed because those cards set their own display. */
.results-view [data-results][hidden] {
  display: none;
}

/* ===========================================================================
 * EXPOSURE STRIP
 * The results view's 2D cavitation exposure maps, one per processed file,
 * in a row. Each tile is an eighth of the width whatever the file count, so
 * 8 show at once and fewer keep the same size (the rest of the row stays
 * empty); more scroll sideways with a horizontal scrollbar (asked for by the
 * user; 8 since 2026-10-14, after trying 10 and 6). File number under each map. Each tile is a button:
 * tapping it shows that map large in .exposure-detail below.
 * States: default, :active (surface-2 press), selected (aria-pressed: tint
 * fill + 2px brand ring), :focus-visible (the global ring). Maps paint as
 * they arrive.
 * ======================================================================== */

.exposure-strip {
  display: flex;
  gap: var(--sp-2);
  overflow-x: auto;
  overscroll-behavior-x: contain;
}

.exposure-strip__item {
  flex: 0 0 calc((100% - 7 * var(--sp-2)) / 8);
  min-width: 0;
  margin: 0;
  padding: var(--sp-1);
  font: inherit;
  background: none;
  border: none;
  border-radius: var(--radius-control);
  cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease-out);
}

.exposure-strip__item:active {
  background: var(--c-surface-2);
}

.exposure-strip__item[aria-pressed="true"] {
  background: var(--c-brand-tint);
  box-shadow: inset 0 0 0 2px var(--c-brand);
}

/* A fixed square box, map fitted inside: the script crops each map to its
   own content, so sizes differ slightly, and a map still loading has no
   height. Either would leave the labels ragged. */
.exposure-strip__image {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: contain;
}

.exposure-strip__label {
  display: block;
  margin-top: var(--sp-1);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);   /* see .rms-plot__tick */
  color: var(--c-ink-2);
  text-align: center;
}

/* The selected file in three equal columns: its SUMMARY_EE.txt values
   (.exposure-values), its 2D map, and a 1D profile, spectrum or waveform
   picked with the select in that column's heading. Each image fits inside
   its column. Anything the run didn't produce shows "Not available".
   States per cell: shown, missing. */
.exposure-detail {
  display: flex;
  flex-direction: column;
  flex: 0 0 var(--results-detail-h);
  min-height: 0;
}

/* Summary and the chosen plots at fixed widths, the 2D map everything left
   (2026-10-14; the three were equal before). Summary is fixed, not
   max-content: its values arrive after the card is drawn, and a column
   sized to them shifted the 2D map and the third column sideways as they
   did, a visible flicker. */
.exposure-detail__grid {
  display: grid;
  grid-template-columns: var(--detail-col1-w) minmax(0, 1fr) var(--detail-col3-w);
  gap: var(--sp-3);
  flex: 1 1 auto;
  min-height: 0;
}

.exposure-detail__cell {
  display: flex;
  flex-direction: column;
  min-height: 0;
  margin: 0;
}

/* Every column heading is --tap-min tall, the third column's select's
   height, so the three columns' contents start level. */
.exposure-detail__caption {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: var(--tap-min);
  margin: 0 0 var(--sp-1);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);   /* see .rms-plot__tick */
  color: var(--c-ink-2);
  text-align: center;
}

/* Third column's heading: the chosen plots' names, then the + button that
   opens the chooser dialog. */
.exposure-detail__chosen-names {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* The chosen plots (one or two), stacked; each takes an equal share of the
   column's height. A small label names each one only when there are two
   (with one, the heading already does). */
.exposure-detail__stack {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  min-height: 0;
}

.exposure-detail__chosen {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
  margin: 0;
}

.exposure-detail__chosen[hidden] {
  display: none;
}

.exposure-detail__subcaption {
  display: none;
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);   /* see .rms-plot__tick */
  color: var(--c-ink-2);
  text-align: center;
}

.exposure-detail__stack--two .exposure-detail__subcaption {
  display: block;
}

/* First column: label/value rows (.fieldtable), centred in the column
   both ways: align-self across, auto block margins down (in the space under
   the heading, level with the images' middle). Values styled like the tab
   bar's date and time (Calibri semibold, tabular figures), with
   --font-ui-dots so their decimal points paint. */
.exposure-values {
  align-self: center;
  margin-block: auto;
  row-gap: var(--sp-2);
}

.exposure-values[hidden] {
  display: none;
}

.exposure-values__value {
  font-family: var(--font-ui-dots);
  font-weight: var(--fw-semibold);
  font-variant-numeric: tabular-nums;
}

/* Labels semibold: regular-weight Calibri dropped the "x" of "Max". */
.exposure-values .fieldtable__label {
  font-weight: var(--fw-semibold);
}

/* Each image is a button: tapping it opens the zoom popup. */
.exposure-detail__zoom {
  flex: 1 1 auto;
  display: flex;
  min-height: 0;
  padding: 0;
  font: inherit;
  background: none;
  border: none;
  border-radius: var(--radius-control);
  cursor: zoom-in;
  transition: background-color var(--dur-fast) var(--ease-out);
}

.exposure-detail__zoom:active {
  background: var(--c-surface-2);
}

.exposure-detail__image {
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: contain;
}

.exposure-detail__missing {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  font-size: var(--fs-base);
  color: var(--c-ink-3);
}

.exposure-detail__zoom[hidden],
.exposure-detail__missing[hidden] {
  display: none;
}

/* ===========================================================================
 * ZOOM POPUP
 * One results image (2D map, 1D profile or spectrum) as large as the screen
 * allows: a modal <dialog> over a dimmed page, built like the keypad. The
 * dialog has no padding or fill (.zoom__panel is the card), so a tap that
 * reaches the <dialog> itself landed on the backdrop and closes it; Close
 * and Esc close it too. Header: which file and image, and Close.
 * States: closed, open. The image itself isn't interactive.
 * ======================================================================== */

.zoom {
  width: calc(var(--screen-w) - 2 * var(--gutter));
  max-width: none;
  height: calc(var(--screen-h) - 2 * var(--gutter));
  max-height: none;
  padding: 0;
  border: none;
  background: none;
  overflow: visible;
}

.zoom::backdrop {
  background: var(--c-scrim);
}

.zoom__panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: var(--sp-4);
  background: var(--c-surface);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-2);
}

.zoom__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  margin-bottom: var(--sp-3);
}

.zoom__title {
  margin: 0;
  font-size: var(--fs-xl);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-tight);
  color: var(--c-ink);
}

.zoom__image {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  object-fit: contain;
}

/* ===========================================================================
 * REPORT
 * The results view's first card, untitled: a comments box (the shared
 * .field, grown to a multi-line textarea). Tapping it opens the on-screen
 * keyboard (KEYBOARD above); Save there saves the comments for the index,
 * and the status beside the label says Saved, or why it couldn't.
 * (It was the last card, titled "Report", with a Save PDF report button,
 * until 2026-10-14.)
 * Textarea states: default, :focus-visible (brand border, from .field),
 * placeholder text. Status: --saved (ink-3), --error (danger).
 * ======================================================================== */

.report__head {
  display: flex;
  align-items: baseline;
  gap: var(--sp-3);
  margin-bottom: var(--sp-1);
}

.report__label {
  font-size: var(--fs-sm);
  color: var(--c-ink-2);
}

/* Semibold: auto-width text (see the font-bug note in tokens.css). */
.report__status {
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  color: var(--c-ink-3);
}

.report__status--error {
  color: var(--c-danger);
}

.report__comments {
  display: block;
  width: 100%;
  padding: var(--sp-2) var(--sp-3);
  font-family: var(--font-mono);     /* Calibri drops p . ! (tokens.css) */
  line-height: var(--lh-tight);
  resize: none;
  cursor: pointer;                   /* it opens the keyboard */
}

/* ===========================================================================
 * INDEX LIST
 * Analysis tab's Index Selection: one .filelist__table row per index folder
 * (Index, Files, Status, then View results / Run processing). Shows up to 5
 * rows, then scrolls inside its own box with a vertical scrollbar and the
 * header row staying put: a deliberate second scroll container, like the
 * Log Viewer's (display.md §1). The cap is --index-list-h, refined to the
 * 5th row's exact bottom by process_settings.js. With more than ~2 rows the
 * page itself scrolls to reach the RMS CH4 plot below. Row states come from
 * FILE LIST (selected = tint pill); the buttons are ordinary .btn.
 * Status text: --busy (brand-deep), --error (danger), else ink-2.
 * ======================================================================== */

.index-list {
  max-height: var(--index-list-h);
  overflow-y: auto;
}

.index-list__table thead th {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  background: var(--c-surface);
}

.index-list__head--check {
  width: var(--col-check);
}

/* The checkbox's own label is the --tap-min target; no extra padding. */
.index-list__check {
  padding: 0;
}

.index-list__head--files {
  width: var(--col-files);
}

.index-list__head--rpm {
  width: var(--col-rpm);
}

.index-list__head--arm {
  width: var(--col-arm);
}

.index-list__head--status {
  width: var(--col-status);
}

.index-list__head--actions {
  width: var(--col-actions);
}

/* Index names and file counts are semibold too: at regular weight the
   bundled Calibri drops "4" and "6" ("304" showed as "30"; see the font-bug
   note in tokens.css, and the Measure tab's S/T labels). */
.index-list__table .filelist__name-text,
.index-list__table .filelist__cell--meta {
  font-weight: var(--fw-semibold);
}

/* Semibold: auto-width text at 17px (see the font-bug note in tokens.css). */
.index-list__status {
  font-weight: var(--fw-semibold);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.index-list__status--busy {
  color: var(--c-brand-deep);
}

.index-list__status--error {
  color: var(--c-danger);
}

.index-list__actions {
  padding-top: var(--sp-1);
  padding-bottom: var(--sp-1);
  text-align: right;
  white-space: nowrap;
}

.index-list__actions .btn + .btn {
  margin-left: var(--sp-2);
}

/* Enabled tinted buttons in the rows (RMS results, WF results): the plain
   tint is the selected row's own fill, so on the selected row they'd vanish
   into it, and on the others they'd look like a selected row. A stronger
   tint with the navy label sets them apart on every row (2026-10-27, at the
   user's request; navy on it is 6.5:1). :active keeps the tinted press
   fill; disabled keeps its gray. */
.index-list__actions .btn--tinted:not(:disabled) {
  color: var(--c-brand-deep);
  background: var(--c-brand-tint-strong);
}

/* On the selected row the stronger tint still sits too close to the row's
   own tint (checked on 192.168.10.158's panel, 2026-10-27), so there they
   go white, a card-on-canvas step, keeping the navy label. */
.filelist__row--selected .index-list__actions .btn--tinted:not(:disabled) {
  background: var(--c-surface);
}

.index-list__actions .btn--tinted:not(:disabled):active {
  background: var(--c-surface-2);
}

/* Compare / Delete / Copy to USB, under the table: .form-actions' equal
   widths, with a little less room above than its default. */
.index-list__bulk {
  padding-top: var(--sp-3);
}

.index-list__empty {
  margin: 0;
  font-size: var(--fs-base);
  color: var(--c-ink-3);
}

/* ===========================================================================
 * ANALYSIS ACTIONS
 * The RMS CH4 card's foot: a status line (part 2's progress or its
 * outcome). States of the line: neutral, --busy while part 2 runs (no
 * animation — the text changes with each step), --error on a failure.
 * ======================================================================== */

.analysis-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-top: var(--sp-2);
}

.analysis-actions__status {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);   /* auto-width text: see .rms-plot__tick */
  color: var(--c-ink-2);
}

.analysis-actions__status--busy {
  color: var(--c-brand-deep);
}

.analysis-actions__status--error {
  color: var(--c-danger);
}

/* ===========================================================================
 * PLACEHOLDER
 * Stands in for a tab that has no content yet.
 * ======================================================================== */

.placeholder {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: var(--chart-h);
}

.placeholder__text {
  margin: 0;
  font-size: var(--fs-lg);
  color: var(--c-ink-3);
}

/* ===========================================================================
 * LOG VIEWER
 * Read-only, monospace, newest line first. Its own scroll box, capped at
 * --log-viewer-h — a deliberate, explicit exception to "one scroll
 * container per page" (display.md §1, tokens.css). Keeping this box's
 * height capped is what keeps the *page* from needing to scroll at all —
 * Device Settings still fits 544px outright, same as before this pane
 * existed.
 * ======================================================================== */

.log-viewer {
  margin: 0;
  max-height: var(--log-viewer-h);
  padding: var(--sp-3);
  background: var(--c-surface-2);
  border-radius: var(--radius-control);
  overflow-y: auto;
  font-family: var(--font-mono);
  font-size: var(--fs-log);
  line-height: var(--lh-normal);
  color: var(--c-ink-2);
  white-space: pre-wrap;
  word-break: break-all;
}

.log-viewer__empty {
  margin: 0;
  color: var(--c-ink-3);
}

/* ===========================================================================
 * WF RESULTS
 * The results view's WF mode (2026-11-01), under Comments: one card
 * (.wf-results, --wf-results-h tall). Its title row carries the legend;
 * below, the statistics (.wf-stats, --wf-stats-w, a hairline on its right)
 * beside the histogram chart (.wf-hist__plot, the rest). They were two
 * cards side by side until 2026-11-01.
 * .wf-stats: a note (how many waveforms), then a table of the STATISTICS
 * CSV, values to 4 significant digits. States: shown, missing ("Not
 * available").
 * Chart: P0/Ps/Pt/Ptot as lines (--c-series-1..4, fixed per series). The
 * legend has one checkbox per series (a full tap target) with its colour
 * swatch and name; unticking hides the series and the axes rescale to the
 * rest. Each line has a direct label (its name, in ink) at its peak. Tap
 * or drag reads the nearest point (marker + the shared .rms-plot__tooltip).
 * States: loading / error / none shown (.wf-hist__status), drawn,
 * inspecting. No hover-only meaning.
 * ======================================================================== */

.wf-results {
  display: flex;
  flex-direction: column;
  flex: 0 0 var(--wf-results-h);
  min-height: 0;
}

.wf-results__head {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

.wf-results .wf-results__title {
  margin: 0;
}

.wf-results__body {
  display: grid;
  grid-template-columns: var(--wf-stats-w) minmax(0, 1fr);
  gap: var(--sp-3);
  flex: 1 1 auto;
  min-height: 0;
}

.wf-stats {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding-right: var(--sp-3);
  border-right: 1px solid var(--c-hairline);
}

/* Semibold: auto-width text (see the font-bug note in tokens.css). */
.wf-stats__note {
  margin: 0 0 var(--sp-2);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  color: var(--c-ink-2);
}

.wf-stats__table {
  width: 100%;
  border-collapse: collapse;
}

.wf-stats__table[hidden],
.wf-stats__missing[hidden] {
  display: none;
}

.wf-stats__head {
  padding: var(--sp-1) var(--sp-2);
  border-bottom: 1px solid var(--c-hairline);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  color: var(--c-ink-2);
  text-align: right;
}

.wf-stats__head:first-child,
.wf-stats__label {
  text-align: left;
}

/* Read-only rows (nothing to tap), so shorter than a tap target. */
.wf-stats__label,
.wf-stats__value {
  height: var(--wf-stats-row-h);
  padding: 0 var(--sp-2);
  border-bottom: 1px solid var(--c-hairline);
  font-size: var(--fs-base);
  font-weight: var(--fw-semibold);   /* regular Calibri drops digits */
  color: var(--c-ink);
}

/* Like the tab bar's date: tabular figures, --font-ui-dots so the decimal
   point paints. */
.wf-stats__value {
  font-family: var(--font-ui-dots);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.wf-stats__missing {
  margin: auto;
  font-size: var(--fs-base);
  color: var(--c-ink-3);
}

.wf-hist__legend {
  display: flex;
  gap: var(--sp-3);
  margin-left: auto;
}

/* The whole key is the tap target (the checkbox's own label). */
.wf-hist__key {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  min-height: var(--tap-min);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);   /* auto-width text */
  color: var(--c-ink);
  cursor: pointer;
}

/* A short line in the series' colour, as on the chart. */
.wf-hist__swatch {
  width: var(--sp-6);
  height: 0;
  border-top: 2px solid currentColor;   /* the chart's line width */
}

.wf-hist__swatch--1 { color: var(--c-series-1); }
.wf-hist__swatch--2 { color: var(--c-series-2); }
.wf-hist__swatch--3 { color: var(--c-series-3); }
.wf-hist__swatch--4 { color: var(--c-series-4); }

.wf-hist__plot {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
}

.wf-hist__status {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  font-size: var(--fs-base);
  color: var(--c-ink-3);
}

.wf-hist__status--error {
  color: var(--c-danger);
}

.wf-hist__status[hidden],
.wf-hist__svg[hidden] {
  display: none;
}

/* Size from the script (the plot box's). */
.wf-hist__svg {
  display: block;
  touch-action: pan-y;   /* horizontal drags inspect; vertical still scrolls */
}

.wf-hist__line {
  fill: none;
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}

/* Bin markers: 8px, ringed in the card's surface so overlapping series
   stay apart. */
.wf-hist__dot {
  stroke: var(--c-surface);
  stroke-width: 2;
}

.wf-hist__series--1 { stroke: var(--c-series-1); fill: var(--c-series-1); }
.wf-hist__series--2 { stroke: var(--c-series-2); fill: var(--c-series-2); }
.wf-hist__series--3 { stroke: var(--c-series-3); fill: var(--c-series-3); }
.wf-hist__series--4 { stroke: var(--c-series-4); fill: var(--c-series-4); }
.wf-hist__line.wf-hist__series--1,
.wf-hist__line.wf-hist__series--2,
.wf-hist__line.wf-hist__series--3,
.wf-hist__line.wf-hist__series--4 { fill: none; }

/* Direct label at a series' peak: its name in ink, never the series colour. */
.wf-hist__label {
  fill: var(--c-ink);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  paint-order: stroke;
  stroke: var(--c-surface);
  stroke-width: 4;
  stroke-linejoin: round;
}

.wf-hist__marker {
  stroke: var(--c-surface);
  stroke-width: 2;
}

/* Clamped inside the plot by the script. */
.wf-hist__tooltip {
  top: 0;
}

/* ===========================================================================
 * WF RESULTS: WAVEFORMS CARD
 * (2026-11-01) .wf-list is a .wf-results card (same height) whose body is
 * just the chart (createLineChart(): the selected file's list's
 * P0/Ps/Pt/Ptot over time), above Histogram results. Its list follows the
 * 2D Cavitation Exposure strip since 2026-11-03 (it had a ΔT strip of its
 * own before). Its title row adds the sensor picker, a .segmented control
 * with one segment per sensor in the list's summary (default / checked /
 * :active / :focus-visible as .segmented); the legend is as in Histogram
 * results.
 * ======================================================================== */

.wf-list__sensors {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-left: auto;
}

.wf-list__sensors-label {
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  color: var(--c-ink-2);
}

/* Narrower segments (one digit each), semibold so the digit paints. */
.wf-list__sensor {
  min-width: var(--tap-min);
  padding: 0 var(--sp-3);
  font-weight: var(--fw-semibold);
}

.wf-list .wf-hist__legend {
  margin-left: var(--sp-4);
}
