/* fttune. Colours are roles; the two themes set them once, below. */

:root {
  color-scheme: light;
  --mode: light;
  --plane: #f9f9f7;
  --surface: #fcfcfb;
  --ink-1: #0b0b0b;
  --ink-2: #52514e;
  --ink-3: #898781;
  --line: #e1e0d9;
  --axis: #c3c2b7;
  --border: rgba(11, 11, 11, 0.10);
  --wash: rgba(11, 11, 11, 0.05);
  --series-1: #2a78d6;          /* blue: lines, selection */
  --series-2: #eb6834;          /* orange: where the engine is right now */
  --series-3: #8a55c9;          /* violet: the ECU's own lambda correction, beside lambda's blue */
  --good: #0ca30c;
  --warning: #fab219;
  --serious: #ec835a;
  --critical: #d03b3b;
  --tip: #262624;
  --tip-ink: #f5f4f1;
}

@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --mode: dark;
    --plane: #0d0d0d;
    --surface: #1a1a19;
    --ink-1: #f0efec;
    --ink-2: #c3c2b7;
    --ink-3: #898781;
    --line: #2c2c2a;
    --axis: #383835;
    --border: rgba(255, 255, 255, 0.10);
    --wash: rgba(255, 255, 255, 0.06);
    --series-1: #3987e5;
    --series-2: #d95926;
    --series-3: #a77ee0;
    --tip: #2f2f2d;
    --tip-ink: #f0efec;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --mode: dark;
  --plane: #0d0d0d;
  --surface: #1a1a19;
  --ink-1: #f0efec;
  --ink-2: #c3c2b7;
  --ink-3: #898781;
  --line: #2c2c2a;
  --axis: #383835;
  --border: rgba(255, 255, 255, 0.10);
  --wash: rgba(255, 255, 255, 0.06);
  --series-1: #3987e5;
  --series-2: #d95926;
  --series-3: #a77ee0;
  --tip: #2f2f2d;
  --tip-ink: #f0efec;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  display: flex;
  flex-direction: column;
  background: var(--plane);
  color: var(--ink-1);
  font: 13px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

[hidden] { display: none !important; }

:focus-visible { outline: 2px solid var(--series-1); outline-offset: 2px; }

h1 { margin: 0; font-size: 18px; font-weight: 650; letter-spacing: -0.01em; }
h2 { margin: 0; font-size: 14px; font-weight: 650; }
.sub { margin: 2px 0 0; color: var(--ink-2); }
.quiet { color: var(--ink-3); }

/* ---- always in view: what is connected, and the engine's main values ---- */

.top { flex: none; background: var(--surface); border-bottom: 1px solid var(--line); }

.bar { display: flex; align-items: center; gap: 20px; height: 48px; padding: 0 16px; }

/* the name, with its mark: a table as a heat map, and the ring that says where the engine is on it */
.brand {
  display: inline-flex; align-items: center; gap: 7px; flex: none;
  font-size: 15px; font-weight: 700; letter-spacing: -0.02em; color: var(--ink-1); text-decoration: none;
}
.brand .mark { width: 20px; height: 20px; flex: none; }
.brand .ft { font-weight: 500; color: var(--ink-2); }

/* the menu beside the name: files and changes, behind one small button */
.menu { position: relative; flex: none; margin: 0 -6px 0 -10px; }
.menu-open {
  display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px;
  border: 0; border-radius: 6px; background: none; color: var(--ink-2); cursor: pointer;
}
.menu-open:hover, .menu-open[aria-expanded="true"] { background: var(--wash); color: var(--ink-1); }
.menu-open svg { width: 16px; height: 16px; }
.menu-list {
  position: absolute; z-index: 40; left: 0; top: calc(100% + 6px); min-width: 264px; padding: 6px;
  background: var(--surface); border-radius: 10px; box-shadow: 0 0 0 1px var(--border), 0 16px 40px rgba(0, 0, 0, 0.22);
}
.menu-list button {
  display: flex; align-items: center; justify-content: space-between; gap: 28px; width: 100%; padding: 6px 10px;
  border: 0; border-radius: 6px; background: none; font: inherit; color: var(--ink-1); text-align: left; white-space: nowrap; cursor: pointer;
}
.menu-list button[hidden] { display: none; }
.menu-list button:hover:not(:disabled), .menu-list button:focus-visible { background: var(--wash); outline: none; }
.menu-list button:disabled { color: var(--ink-3); cursor: default; }
.menu-list button.sure { font-weight: 600; }
.menu-list kbd { font: inherit; font-size: 11px; color: var(--ink-3); }
.menu-list hr { height: 1px; margin: 5px 4px; border: 0; background: var(--line); }
/* changes that are not saved yet: always in view, and a way into the menu */
.unsaved {
  flex: none; padding: 3px 10px; border: 0; border-radius: 999px; background: none; box-shadow: inset 0 0 0 1px var(--series-1);
  font: inherit; font-weight: 600; color: var(--ink-1); white-space: nowrap; cursor: pointer;
}
.unsaved:hover { background: var(--wash); }
/* changes that are on the unit already, and gone with the ignition unless kept */
.unsaved.live { box-shadow: inset 0 0 0 1.5px var(--serious); }
/* saving them to the unit: one press, in the same place whether there is something to save or not */
.save-unit {
  flex: none; padding: 5px 12px; border: 0; border-radius: 6px; background: var(--series-1);
  font: inherit; font-weight: 600; color: #fff; white-space: nowrap; cursor: pointer;
}
.save-unit:hover:not(:disabled) { filter: brightness(1.1); }
.save-unit:disabled { background: none; box-shadow: inset 0 0 0 1px var(--line); color: var(--ink-3); cursor: default; }
#cells-picked.live span:first-child { font-weight: 600; color: var(--ink-1); }
#cells-picked.live span:first-child::before {
  content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: var(--serious);
}
/* something to tell that is not about the table on screen: under the top bar, until it is closed */
.said {
  position: fixed; z-index: 45; left: 12px; top: 56px; display: flex; align-items: flex-start; gap: 12px;
  max-width: min(480px, calc(100vw - 24px)); padding: 10px 10px 10px 14px; border-radius: 10px;
  background: var(--surface); color: var(--ink-1); box-shadow: 0 0 0 1px var(--border), 0 16px 40px rgba(0, 0, 0, 0.22);
}
.said p { flex: 1; margin: 3px 0; line-height: 1.45; }
.said .ghost { flex: none; }
/* Michroma (The Michroma Project Authors, SIL Open Font License 1.1, see fonts/Michroma-OFL.txt): the squarish figures
   of instrument faces of the early nineties, for the dash design drawn after one */
@font-face { font-family: "Michroma"; src: url("fonts/Michroma-Regular.ttf") format("truetype"); font-display: swap; }

/* the dash: gauges over the whole window, dark whatever the page's theme, its controls out of sight when left alone */
.dash {
  position: fixed; inset: 0; z-index: 30; background: #050607; color: #f0efec; color-scheme: dark;
  --ink-1: #f0efec; --ink-2: #c3c2b7; --ink-3: #898781; --surface: #1a1a19; --border: rgba(255, 255, 255, 0.12);
  --wash: rgba(255, 255, 255, 0.08); --series-1: #3987e5;
}
.dash.idle { cursor: none; }
/* two sheets, one over the other: what never moves at the back, what moves in front; each is kept as a picture of
   its own, so a frame redraws only the front one */
.dash svg {
  position: absolute; inset: 0; display: block; width: 100%; height: 100%; fill: #f4f7fa; transition: opacity 0.4s; will-change: transform;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}
.dash.stale svg { opacity: 0.28; }
.dash .d-num { font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.dash .d-big { font-weight: 800; letter-spacing: -0.045em; }
.dash .d-thin { font-weight: 200; font-variant-numeric: tabular-nums; letter-spacing: -0.045em; }
.dash .d-label { fill: #6c7682; font-weight: 600; letter-spacing: 0.22em; }
.dash .d-unit { fill: #6c7682; font-weight: 500; }
.dash-wait { position: absolute; left: 0; right: 0; top: 45%; margin: 0; text-align: center; font-size: 20px; color: #c3ccd5; }
.dash-bar {
  position: absolute; left: 50%; bottom: 22px; transform: translateX(-50%); display: flex; align-items: center; gap: 14px;
  padding: 8px 12px; border-radius: 12px; background: rgba(22, 26, 31, 0.94); white-space: nowrap;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08), 0 12px 40px rgba(0, 0, 0, 0.5); transition: opacity 0.4s;
}
.dash.idle .dash-bar { opacity: 0; pointer-events: none; }
.dash-bar .ghost { text-decoration: none; }
.dash-bar .switch button { width: auto; padding: 5px 12px; }
.dash-shift { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); }
.dash-shift b { min-width: 76px; text-align: center; color: var(--ink-1); font-variant-numeric: tabular-nums; }
.dash-shift .ghost { padding: 3px 9px; }

/* sending a tune to the unit: one dialog, from choosing the slot to what came of it */
.send-box {
  width: min(560px, 92vw); margin: 12vh auto 0; padding: 18px 20px 16px; background: var(--surface); border-radius: 12px;
  box-shadow: 0 0 0 1px var(--border), 0 24px 70px rgba(0, 0, 0, 0.4);
}
.send-box h2 { margin: 0 0 10px; font-size: 16px; }
.send-box p { margin: 0 0 10px; line-height: 1.45; }
.send-slots { display: grid; gap: 6px; margin: 4px 0 12px; }
.send-slots button {
  display: flex; align-items: baseline; gap: 10px; padding: 8px 12px; border: 0; border-radius: 8px; background: none;
  box-shadow: inset 0 0 0 1px var(--border); font: inherit; color: var(--ink-1); text-align: left; cursor: pointer;
}
.send-slots button span { flex: 1; min-width: 0; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.send-slots button i { font-style: normal; font-size: 12px; color: var(--ink-3); }
.send-slots button:disabled { color: var(--ink-3); cursor: default; }
.send-slots button[aria-pressed="true"] { box-shadow: inset 0 0 0 2px var(--series-1); }
.send-how { margin: 0 0 12px; padding-left: 18px; color: var(--ink-2); font-size: 12px; line-height: 1.5; }
.send-warn { padding: 8px 12px; border-radius: 8px; background: var(--wash); font-size: 12px; }
.send-stage { font-weight: 600; font-variant-numeric: tabular-nums; }
.send-bar { height: 6px; margin-bottom: 14px; border-radius: 3px; background: var(--wash); overflow: hidden; }
.send-bar i { display: block; height: 100%; border-radius: 3px; background: var(--series-1); transition: width 0.2s; }
.send-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.send-actions:empty { display: none; }
.primary {
  font: inherit; font-weight: 600; color: #fff; background: var(--series-1); border: 0; border-radius: 6px; padding: 5px 12px; cursor: pointer;
}
.primary:disabled { opacity: 0.5; cursor: default; }
/* a line that runs along the top of the page while something is being fetched */
.busy { position: fixed; z-index: 70; left: 0; top: 0; width: 100%; height: 2px; overflow: hidden; pointer-events: none; }
.busy::before {
  content: ""; position: absolute; left: 0; top: 0; width: 40%; height: 100%; background: var(--series-1);
  animation: busy 1.1s ease-in-out infinite;
}
@keyframes busy { from { transform: translateX(-100%); } to { transform: translateX(250%); } }
@media (prefers-reduced-motion: reduce) { .busy::before { width: 100%; animation: none; } }

/* what does not fit of it is cut off, never drawn over its neighbours */
.connection { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; overflow: hidden; }

.state {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px 3px 8px; border-radius: 999px;
  box-shadow: inset 0 0 0 1px var(--border);
  font-weight: 600; white-space: nowrap; flex: none;
}
.state .icon { display: inline-flex; width: 12px; height: 12px; color: var(--ink-3); }
.state .icon svg { width: 12px; height: 12px; }
.state.good .icon { color: var(--good); }
.state.warning .icon { color: var(--warning); }
.state.critical .icon { color: var(--critical); }
.state.sim .icon { color: var(--series-1); }

.facts { color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.connection #tune-close { flex: none; padding: 3px 10px; }
.facts b { color: var(--ink-1); font-weight: 600; }

.views { display: flex; gap: 2px; flex: none; }
.views a { white-space: nowrap; }
#agent-on svg, #autotune-on svg { width: 15px; height: 15px; vertical-align: -3px; }
#autotune-on b { font-variant-numeric: tabular-nums; }
.views a {
  padding: 6px 12px; border-radius: 6px;
  color: var(--ink-2); text-decoration: none; font-weight: 600;
}
.views a:hover { background: var(--wash); color: var(--ink-1); }
.views a[aria-current="page"] { background: var(--wash); color: var(--ink-1); }

.ghost {
  font: inherit; color: var(--ink-2); background: none; border: 0; cursor: pointer;
  padding: 5px 10px; border-radius: 6px; box-shadow: inset 0 0 0 1px var(--border); white-space: nowrap;
}
.ghost:hover { background: var(--wash); color: var(--ink-1); }

.vitals { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); border-top: 1px solid var(--line); }
.vital { min-width: 0; padding: 7px 12px 8px; box-shadow: inset 1px 0 0 var(--line); }
.vital:first-child { box-shadow: none; }
.vital .label { font-size: 11px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* tabular figures here although these are not a column: the numbers change twenty times a second,
   and with proportional figures the unit beside them would shake */
.vital .value { font-size: 20px; font-weight: 600; line-height: 1.2; letter-spacing: -0.01em; white-space: nowrap;
  font-variant-numeric: tabular-nums; }
.vital .unit { margin-left: 3px; font-size: 11px; font-weight: 400; letter-spacing: 0; color: var(--ink-3); }
.vitals.stale .value { color: var(--ink-3); }

@media (max-width: 1359px) {
  .vitals { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .vital:nth-child(6n + 1) { box-shadow: none; }
  .vital:nth-child(n + 7) { border-top: 1px solid var(--line); }
}
/* A narrower window. What can be reached another way goes first (the theme follows the system, search has its
   key), then the words that an icon or a number can stand for, then the name. Nothing wraps or overlaps. */
@media (max-width: 1279px) { #theme { display: none; } }
@media (max-width: 1139px) { .facts { display: none; } #spot-open .quiet { display: none; } }
@media (max-width: 1039px) {
  .bar { gap: 12px; }
  .roomy { display: none; }
  #spot-open { display: none; }
  #agent-on { padding: 3px 8px; }
}
@media (max-width: 799px) {
  .bar { gap: 8px; padding: 0 10px; }
  .brand > span, .state .label { display: none; }
  .menu { margin-left: -4px; }
  .state { padding: 5px; }
  .views a { padding-left: 8px; padding-right: 8px; }
}
/* A narrow or a low window: the live values take less of it, and in a low one only the first row of them is shown. */
@media (max-width: 899px), (max-height: 759px) {
  .vital { padding: 4px 10px 5px; }
  .vital .label { font-size: 10px; }
  .vital .value { font-size: 16px; }
}
@media (max-height: 639px) and (min-width: 720px) { .vital:nth-child(n + 7) { display: none; } }
@media (max-width: 719px) {
  .vitals { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .vital:nth-child(n + 7) { display: none; }
  .vital .unit { display: none; }
}

/* ---- the views ---- */

main { flex: 1; min-height: 0; }
.view { height: 100%; }

input[type="search"] {
  font: inherit; color: var(--ink-1); background: var(--plane);
  border: 0; border-radius: 6px; padding: 6px 10px; outline: none;
  box-shadow: inset 0 0 0 1px var(--border);
}
input[type="search"]:focus-visible { box-shadow: inset 0 0 0 2px var(--series-1); }
input[type="search"]::placeholder { color: var(--ink-3); }

/* tables */

#view-tables, #view-logs { display: grid; grid-template-columns: var(--sidebar, 264px) minmax(0, 1fr); }
.resizer { position: absolute; top: 0; right: -4px; z-index: 6; width: 8px; height: 100%; cursor: col-resize; }
.resizer:hover, .resizer.dragging { background: var(--wash); }

.sidebar { position: relative; display: flex; flex-direction: column; min-height: 0; background: var(--surface); border-right: 1px solid var(--line); }
.sidebar input { margin: 12px 12px 4px; }

.table-list { flex: 1; overflow-y: auto; padding: 0 8px 12px; }
.table-list h3 {
  position: sticky; top: 0; z-index: 1; margin: 0; padding: 10px 8px 4px;
  background: var(--surface); color: var(--ink-3); font-size: 11px; font-weight: 600;
}
.table-list button {
  display: block; width: 100%; padding: 5px 8px; border: 0; border-radius: 6px; background: none;
  font: inherit; color: var(--ink-2); text-align: left; cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.table-list button:hover { background: var(--wash); color: var(--ink-1); }
.table-list button[aria-current="true"] {
  background: var(--wash); color: var(--ink-1); font-weight: 600; box-shadow: inset 2px 0 0 var(--series-1);
}
.table-list .none { padding: 12px 8px; color: var(--ink-3); }
.table-list .unused { color: var(--ink-3); }
/* a menu of FT Manager: a label that folds, set apart from what is inside it */
.table-list .group {
  position: sticky; top: 0; z-index: 2; margin-top: 6px; padding: 7px 8px; border-radius: 0;
  background: var(--surface); color: var(--ink-1); font-size: 12px; font-weight: 700; letter-spacing: 0.02em;
  box-shadow: inset 0 -1px 0 var(--line);
}
.table-list .group:hover { background: var(--surface); color: var(--ink-1); }
.table-list .group .quiet { font-weight: 500; }
/* what folds says so at its right edge, so that every label starts at the same place */
.table-list .group, .table-list .bundle { display: flex; align-items: center; gap: 6px; }
.table-list .group .name, .table-list .bundle .name { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.table-list .group .tag, .table-list .bundle .tag { margin-left: 0; }
.table-list .twist {
  flex: none; width: 0; height: 0; margin: 0 2px 0 auto;
  border-left: 5px solid var(--ink-3); border-top: 4px solid transparent; border-bottom: 4px solid transparent;
}
.table-list [aria-expanded="true"] > .twist { transform: rotate(90deg); }
.table-list .holds { color: var(--ink-1); box-shadow: inset 2px 0 0 var(--series-1); }
.table-list .group.holds { box-shadow: inset 2px 0 0 var(--series-1), inset 0 -1px 0 var(--line); }
.table-list .inside { padding: 2px 0 4px; }
.table-list .members { margin: 0 0 4px 14px; padding-left: 6px; box-shadow: inset 1px 0 0 var(--line); }

/* a very quiet label: "off" for what the tune does not use, "extra" for what FT Manager does not show */
.tag {
  display: inline-block; margin-left: 5px; padding: 0 4px; border-radius: 3px; vertical-align: 1px;
  box-shadow: inset 0 0 0 1px var(--border); color: var(--ink-3); font-size: 10px; font-weight: 500; line-height: 14px;
}

.crumb { margin: 0 0 2px; color: var(--ink-3); font-size: 12px; }
.crumb a { color: inherit; text-decoration: none; }
.crumb a:hover { color: var(--ink-1); text-decoration: underline; }
.note { margin: 6px 0 0; color: var(--ink-2); }

.switch { display: inline-flex; border-radius: 6px; box-shadow: inset 0 0 0 1px var(--border); overflow: hidden; }
/* every button as wide as the next, and no bolder when chosen: choosing one must not move anything */
.switch button { font: inherit; color: var(--ink-2); background: none; border: 0; padding: 5px 0; width: 58px; text-align: center; cursor: pointer; }
.switch button + button { box-shadow: inset 1px 0 0 var(--border); }
.switch button:hover { color: var(--ink-1); background: var(--wash); }
.switch button[aria-pressed="true"] { color: var(--ink-1); background: var(--wash); box-shadow: inset 0 -2px 0 var(--series-1); }

.surface { display: block; width: 100%; height: clamp(280px, calc(100vh - 400px), 560px); cursor: grab; }
.surface:active { cursor: grabbing; }
.curve.many { height: clamp(280px, calc(100vh - 400px), 560px); }
.curve .now { fill: none; stroke: var(--series-2); stroke-width: 3; }
.curve .now-halo { fill: none; stroke: var(--surface); stroke-width: 7; }
.curve .now-line { stroke: var(--series-2); stroke-width: 1; opacity: 0.6; }

.feature { flex: 0 1 auto; min-height: 0; overflow-y: auto; }
.feature h2 { margin: 18px 0 8px; color: var(--ink-2); font-size: 12px; font-weight: 600; }
.feature h2:first-child { margin-top: 4px; }
.feature .settings {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 0 28px;
  padding: 6px 14px; background: var(--surface); border-radius: 10px; box-shadow: 0 0 0 1px var(--border);
}
.feature .settings div { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; border-bottom: 1px solid var(--line); min-width: 0; }
.feature .settings dt, .feature .settings span:first-child { color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.feature .settings b { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
button.toggle { border: 0; cursor: pointer; }
.feature .settings input, .grid td input {
  width: 84px; font: inherit; color: var(--ink-1); background: var(--plane); border: 0; border-radius: 4px; padding: 1px 4px; text-align: right;
  box-shadow: inset 0 0 0 2px var(--series-1); outline: none;
}
.grid td input { width: 100%; text-align: center; }
.feature .settings b.can-edit { cursor: text; border-bottom: 1px dashed var(--axis); }
/* on and off as a switch; it only shows the state for now */
.toggle { flex: none; align-self: center; width: 26px; height: 15px; padding: 2px; border-radius: 8px; background: var(--axis); }
.toggle i { display: block; width: 11px; height: 11px; border-radius: 50%; background: var(--surface); }
.toggle.on { background: var(--series-1); }
.toggle.on i { margin-left: 11px; }
.feature .cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.feature .cards button {
  font: inherit; color: var(--ink-1); text-align: left; cursor: pointer; padding: 9px 12px; border: 0; border-radius: 8px;
  background: var(--surface); box-shadow: 0 0 0 1px var(--border); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.feature .cards button:hover { background: var(--wash); }
.feature .cards button.unused { color: var(--ink-3); }

.stage { display: flex; flex-direction: column; min-width: 0; min-height: 0; padding: 16px 20px 12px; }
.stage-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 10px 16px; margin-bottom: 12px; }
.stage-head > div:first-child { min-width: 0; flex: 1 1 360px; }
.stage-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; flex: none; }

/* a fixed width whatever it says, so that nothing beside it moves when the way a table is drawn changes */
.scale { display: flex; align-items: center; gap: 8px; width: 330px; color: var(--ink-2); font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.scale > span:first-child { flex: 1; text-align: right; }
.scale > span:last-child { flex: 1; text-align: left; }
#table-split[aria-pressed="true"] { background: var(--wash); color: var(--ink-1); box-shadow: inset 0 0 0 1px var(--border), inset 0 -2px 0 var(--series-1); }
#table-split:disabled { opacity: 0.45; cursor: default; }
.ft-help { flex: none; margin: 14px 2px 0; color: var(--ink-3); font-size: 12px; }
.ft-help[open] { max-height: 40vh; overflow-y: auto; }
.ft-help summary { cursor: pointer; }
.ft-help summary:hover { color: var(--ink-2); }
.ft-help div { max-width: 78ch; margin-top: 6px; padding: 10px 14px; border-radius: 8px; background: var(--surface); box-shadow: 0 0 0 1px var(--border); color: var(--ink-2); }
.ft-help p { margin: 0 0 6px; }
.ft-help .caution { color: var(--ink-3); font-style: italic; }
.scale-ramp { width: 132px; height: 8px; border-radius: 4px; }

/* what can be done to the chosen cells. Always there over a grid, and what it says is on one line at its end,
   so that choosing cells or a message moves nothing */
.cell-tools { position: relative; flex: none; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-bottom: 8px; }
.tool-set { display: inline-flex; flex: none; border-radius: 6px; box-shadow: inset 0 0 0 1px var(--border); overflow: hidden; }
.tool-set > * + * { box-shadow: inset 1px 0 0 var(--border); }
.tool-set button { font: inherit; color: var(--ink-2); background: none; border: 0; padding: 4px 8px; white-space: nowrap; cursor: pointer; }
.tool-set button:hover:not(:disabled) { color: var(--ink-1); background: var(--wash); }
.tool-set button:disabled { color: var(--ink-3); opacity: 0.6; cursor: default; }
/* the one Enter carries out while a number is being typed */
.tool-set button.armed { color: var(--ink-1); background: var(--wash); box-shadow: inset 1px 0 0 var(--border), inset 0 -2px 0 var(--series-1); }
.tool-set kbd {
  display: inline-block; min-width: 15px; margin-left: 5px; padding: 0 3px; border-radius: 3px; box-shadow: inset 0 0 0 1px var(--border);
  font: inherit; font-size: 10px; line-height: 14px; color: var(--ink-3); text-align: center; vertical-align: 1px;
}
.tool-set input {
  width: 76px; font: inherit; font-variant-numeric: tabular-nums; color: var(--ink-1); background: none; border: 0;
  padding: 4px 8px; text-align: right; outline: none;
}
.tool-set input::placeholder { color: var(--ink-3); }
.tool-set input:focus { box-shadow: inset 0 0 0 2px var(--series-1); }
.tool-set input:disabled { opacity: 0.6; }
/* its parts sit on one line from the right; a part that does not fit falls to a second line, which is not shown */
.cell-tools .picked {
  flex: 1 1 160px; min-width: 0; height: 18px; display: flex; flex-wrap: wrap; justify-content: flex-end; overflow: hidden;
  color: var(--ink-2); font-size: 12px; line-height: 18px; font-variant-numeric: tabular-nums; white-space: nowrap;
}
.cell-tools .picked span { min-width: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.cell-tools .picked span + span::before { content: "\00b7"; margin: 0 7px; color: var(--ink-3); }
/* what there is to tell about the last thing asked for: laid over the top of the grid, so that it has room and moves nothing */
.tool-said {
  position: absolute; z-index: 6; right: 0; top: calc(100% + 6px); max-width: min(560px, 100%); margin: 0; padding: 7px 11px;
  border-radius: 8px; background: var(--ink-1); color: var(--surface); font-size: 12px; line-height: 1.4;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.grid-wrap {
  flex: 0 1 auto; min-height: 0; overflow: auto;
  background: var(--surface); border-radius: 10px; box-shadow: 0 0 0 1px var(--border);
}
.grid-inner { padding: 8px; }
/* the views of a table side by side; they fall under each other when there is no room */
.panes { display: flex; gap: 4px; align-items: stretch; }
.pane { position: relative; min-width: 0; }
.pane-grid { flex: 1 1 0; }
.pane-charts { flex: 1 1 0; display: flex; flex-direction: column; }
.divider { display: none; flex: none; width: 6px; border-radius: 3px; cursor: col-resize; }
.divider:hover, .divider.dragging { background: var(--wash); }
/* table and chart side by side: the table takes its share of the width (six tenths unless dragged), its columns
   sharing what there is; a table with too many columns for that takes more (--grid-width, set by the page) as long
   as the chart keeps a useful width; the chart is as tall as the table beside it */
.panes.both .divider { display: block; }
.panes.both .pane-grid { flex: 0 0 var(--grid-width, calc(var(--split, 60%) - 7px)); overflow-x: auto; }
.panes.both .surface, .panes.both .curve.many { flex: 1 1 auto; height: 0; min-height: 300px; }
.panes.one-row { flex-direction: column; flex-wrap: nowrap; align-items: stretch; }
.panes.one-row .pane { flex: none; }
.panes.one-row .pane-charts { order: -1; }

/* the grid always shares the width it has between its columns; the page sets the size of its numbers to what fits
   (--cell-font), the room between cells (--gap) and the width of the row headings (--head) */
.grid {
  width: 100%; table-layout: fixed; border-collapse: separate; border-spacing: var(--gap, 2px);
  font-size: var(--cell-font, 12px); line-height: 1.15; font-variant-numeric: tabular-nums;
  -webkit-user-select: none; user-select: none;
}
.grid:focus { outline: none; }
.grid th {
  height: var(--row, 24px); padding: 0 2px; overflow: hidden; background: var(--surface);
  color: var(--ink-2); font-weight: 500; white-space: nowrap; text-align: center; cursor: pointer;
}
.grid thead th { position: sticky; top: 0; z-index: 2; }
.grid tbody th { position: sticky; left: 0; z-index: 1; padding: 0 6px 0 2px; text-align: right; }
.grid thead th.corner {
  left: 0; z-index: 3; width: var(--head, 46px); padding: 1px 6px 1px 2px; color: var(--ink-3);
  font-size: calc(var(--cell-font, 12px) * 0.84); line-height: 1.15;
}
.grid th.corner span { display: block; white-space: nowrap; }
.grid th.corner span:first-child { text-align: right; }
.grid th.corner span:last-child { text-align: left; }
.grid th.now { color: var(--ink-1); font-weight: 700; }
.grid thead th.now { box-shadow: inset 0 -2px 0 var(--series-2); }
.grid tbody th.now { box-shadow: inset -2px 0 0 var(--series-2); }
.grid th.hover { color: var(--ink-1); }
/* cells are chosen by dragging over them. The ring of a chosen cell is two rings, one light and one dark,
   so that it shows on any fill and against the page in both themes */
.grid td { height: var(--row, 24px); padding: 0; border-radius: 3px; text-align: center; white-space: nowrap; cursor: cell; }
.grid td:hover, .grid td.hover { box-shadow: inset 0 0 0 1px var(--ink-1), inset 0 0 0 2px var(--surface); }
.grid td.sel { box-shadow: inset 0 0 0 2px var(--ink-1), inset 0 0 0 3px var(--surface); }
/* a number changed in this session: the number says so, the cell stays as it is */
.grid td.edited { font-weight: 600; text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 2px; }
.grid td input { -webkit-user-select: text; user-select: text; cursor: text; }
.grid-probe {
  position: absolute; left: 0; top: 0; visibility: hidden; pointer-events: none; white-space: nowrap;
  font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums;      /* as heavy as a changed number is */
}

.overlay { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.overlay line { stroke: var(--series-2); stroke-width: 2; stroke-linecap: round; }
/* a ring, not a dot: the number of the cell the engine is in stays readable */
#cursor circle { fill: none; }
#cursor .halo { stroke: var(--surface); stroke-width: 7; }
#cursor .ring { stroke: var(--series-2); stroke-width: 3; }

.curve { display: block; width: 100%; height: 240px; margin-bottom: 6px; }
.curve .gridline { stroke: var(--line); stroke-width: 1; }
.curve .baseline { stroke: var(--axis); stroke-width: 1; }
.curve .tick { fill: var(--ink-3); font-size: 11px; font-variant-numeric: tabular-nums; }
.curve .line { fill: none; stroke: var(--series-1); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.curve .dot { fill: var(--series-1); stroke: var(--surface); stroke-width: 2; }
.curve .dot.hover { stroke: var(--ink-1); }
.curve .line.hover { stroke-width: 3.5; }
.curve .hit { fill: transparent; }
/* a one-row table whose tune can be changed: its points can be pulled up and down */
.curve.can-pull .hit, .curve.can-pull .dot { cursor: ns-resize; }
.curve.can-pull .dot { r: 5px; }

.readout { min-height: 20px; margin: 10px 2px 0; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.readout b { color: var(--ink-1); font-weight: 600; }
.readout .key {
  display: inline-block; width: 11px; height: 11px; margin-right: 6px; border-radius: 50%;
  border: 2.5px solid var(--series-2); vertical-align: -1px;
}
.empty { margin: 24px 2px; color: var(--ink-2); }

/* live data */

#view-live { overflow-y: auto; padding: 16px 20px 32px; }
.live-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.filters { display: flex; gap: 8px; }
.filters input { width: 220px; }

.channels { display: grid; grid-template-columns: repeat(auto-fill, minmax(196px, 1fr)); gap: 10px; }
.tile { min-width: 0; padding: 10px 12px 8px; background: var(--surface); border-radius: 10px; box-shadow: 0 0 0 1px var(--border); }
.tile .label { font-size: 12px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .value { font-size: 22px; font-weight: 600; line-height: 1.25; letter-spacing: -0.01em; white-space: nowrap;
  font-variant-numeric: tabular-nums; }
.tile .unit { margin-left: 4px; font-size: 12px; font-weight: 400; letter-spacing: 0; color: var(--ink-3); }
.tile .range { font-size: 11px; color: var(--ink-3); font-variant-numeric: tabular-nums; white-space: nowrap; }
.tile canvas { display: block; width: 100%; height: 30px; margin-top: 6px; }

.picker {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 40; width: min(440px, 100vw);
  display: flex; flex-direction: column; background: var(--surface);
  box-shadow: -1px 0 0 var(--border), -12px 0 40px rgba(0, 0, 0, 0.22);
}
.picker-head { display: flex; align-items: center; gap: 8px; padding: 14px 16px 6px; }
.picker-head h2 { flex: 1; }
.picker > .sub { margin: 0; padding: 0 16px 10px; }
.picker > input { margin: 0 16px 10px; }
.picker-list { flex: 1; overflow-y: auto; padding: 0 8px 16px; border-top: 1px solid var(--line); }
.picker-list label, .checks label { display: flex; align-items: baseline; gap: 8px; padding: 4px 8px; border-radius: 6px; cursor: pointer; }
.picker-list label:hover, .checks label:hover { background: var(--wash); }
.picker-list input, .checks input { margin: 0; align-self: center; accent-color: var(--series-1); }
.picker-list .name, .checks .name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.picker-list .more, .checks .more { color: var(--ink-3); font-size: 11px; white-space: nowrap; }

.debug { margin-top: 20px; color: var(--ink-2); }
.debug summary { cursor: pointer; font-weight: 600; }
.debug pre {
  margin: 8px 0 0; padding: 12px; overflow: auto; background: var(--surface); color: var(--ink-1);
  border-radius: 10px; box-shadow: 0 0 0 1px var(--border); font: 12px/1.5 ui-monospace, "SF Mono", Menlo, monospace;
}

/* logs */

body.dropping #view-logs .stage, body.dropping #view-tables .stage, body.dropping #view-live {
  outline: 2px dashed var(--series-1); outline-offset: -8px;
}
/* The logs of the ECU and those of this computer are two tabs over one list, so that the channels under it keep the
   room: quiet words, the one on show underlined; the ECU's greyed while there is none. */
.log-tabs { display: flex; flex: none; gap: 14px; padding: 6px 16px 0; border-bottom: 1px solid var(--line); }
.log-tabs button {
  flex: 0 1 auto; min-width: 0; padding: 6px 0 7px; border: 0; background: none; font: inherit; font-size: 12px; font-weight: 600;
  color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; box-shadow: inset 0 -2px 0 transparent;
}
.log-tabs button:hover { color: var(--ink-1); }
.log-tabs button[aria-selected="true"] { color: var(--ink-1); box-shadow: inset 0 -2px 0 var(--series-1); }
.log-tabs button[aria-disabled="true"] { color: var(--ink-3); opacity: 0.55; cursor: default; }
.log-tabs .quiet { margin-left: 5px; font-weight: 400; font-variant-numeric: tabular-nums; }
.table-list.files { flex: 0 1 auto; max-height: 34%; padding-top: 4px; border-bottom: 1px solid var(--line); }
.table-list.files[hidden] { display: none; }
.table-list.files button { white-space: normal; line-height: 1.3; padding: 6px 8px; }
.table-list.files small { display: block; color: var(--ink-3); font-size: 11px; font-weight: 400; }
/* a log file's row: its name on one line (cut short where long), its size and where it came from under it */
#log-list button[data-file] { display: block; }
#log-list button[data-file] .name, #log-list button[data-file] small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* the logs the ECU keeps in its own memory: its rows as the files' rows, and the one being read out filled from the
   left as far as it is */
#ecu-logs h3 { position: static; display: flex; align-items: center; gap: 4px; padding-top: 6px; }
/* the views: a quiet button at the end of the heading of the channels shown; their list lies over the channels and,
   where the sidebar is narrow, over the page beside it (nothing moves) */
.checks h3.shown { display: flex; align-items: center; gap: 6px; }
#log-views-open {
  flex: none; margin-left: auto; padding: 1px 6px; border: 0; border-radius: 5px; background: none; font: inherit;
  font-size: 11px; font-weight: 600; color: var(--ink-3); cursor: pointer; white-space: nowrap;
}
#log-views-open:hover, #log-views-open[aria-expanded="true"] { color: var(--ink-1); background: var(--wash); }
.log-views {
  position: absolute; left: 12px; z-index: 30; width: max(calc(100% - 24px), min(340px, calc(100vw - 32px))); padding: 6px;
  border-radius: 10px; background: var(--surface); box-shadow: 0 0 0 1px var(--border), 0 10px 28px rgba(0, 0, 0, 0.18);
}
.log-views[hidden] { display: none; }
.view-row { display: flex; align-items: center; }
.view-go {
  display: flex; flex: 1; align-items: baseline; gap: 8px; min-width: 0; padding: 5px 8px; border: 0; border-radius: 6px;
  background: none; font: inherit; color: var(--ink-1); text-align: left; cursor: pointer;
}
.view-go:hover, .view-drop:hover { background: var(--wash); }
.view-go span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.view-go small { flex: none; margin-left: auto; color: var(--ink-3); font-size: 11px; }
.view-drop { flex: none; padding: 1px 8px; border: 0; border-radius: 6px; background: none; font: inherit; font-size: 15px; color: var(--ink-3); cursor: pointer; }
.view-drop:hover { color: var(--ink-1); }
.view-save { display: flex; gap: 6px; margin-top: 6px; padding-top: 8px; border-top: 1px solid var(--line); }
.log-views .view-save input {
  flex: 1; min-width: 0; margin: 0; padding: 5px 8px; border: 0; border-radius: 6px; outline: none; font: inherit;
  color: var(--ink-1); background: var(--plane); box-shadow: inset 0 0 0 1px var(--border);
}
.log-views .view-save input:focus-visible { box-shadow: inset 0 0 0 2px var(--series-1); }
.view-note { margin: 6px 4px 2px; color: var(--ink-3); font-size: 11px; }
/* the name of the log on show, with its pencil; renamed in place, in a box of its size */
.log-name { display: flex; align-items: center; gap: 4px; min-width: 0; }
.log-name h1 { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.log-name h1:has(input) { flex: 1; overflow: visible; }
#log-rename { flex: none; padding: 0 6px; font-size: 14px; line-height: 22px; color: var(--ink-3); }
#log-rename:hover { color: var(--ink-1); }
.log-title-input {
  width: min(100%, 48ch); margin: 0 -6px; padding: 0 6px; border: 0; border-radius: 6px; outline: none; font: inherit;
  line-height: inherit; letter-spacing: inherit; color: inherit; background: var(--plane); box-shadow: inset 0 0 0 2px var(--series-1);
}
#ecu-logs h3 button {
  display: inline-flex; flex: none; align-items: center; width: auto; padding: 1px 6px; border-radius: 5px;
  box-shadow: inset 0 0 0 1px var(--border); font-size: 11px; font-weight: 500; line-height: 16px; color: var(--ink-2);
}
#ecu-logs h3 button:disabled { opacity: 0.5; cursor: default; }
#ecu-logs h3 kbd {
  margin-left: 4px; padding: 0 3px; border-radius: 3px; box-shadow: inset 0 0 0 1px var(--border);
  font: inherit; font-size: 10px; line-height: 13px; color: var(--ink-3);
}
#ecu-logs button[data-ecu-log] { white-space: nowrap; align-items: baseline; }
#ecu-logs button[data-ecu-log] small { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
#ecu-logs button.reading { background: linear-gradient(to right, var(--wash) var(--done, 0%), transparent var(--done, 0%)); }
#ecu-logs .none { padding: 4px 8px 8px; font-size: 12px; }
#ecu-logs button.more { color: var(--ink-3); font-size: 12px; }
.sub .link { font: inherit; line-height: inherit; color: var(--series-1); background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; }
.checks { flex: 1; min-height: 0; overflow-y: auto; padding: 0 8px 12px; color: var(--ink-2); }
.checks h3 { margin: 0; padding: 8px 8px 4px; color: var(--ink-3); font-size: 11px; font-weight: 600; }

/* A colour for each channel of a log that is shown: a few cool hues, in an order in which each is far from the one
   before and the one after it, also for eyes that do not tell red from green. The warm hues are the cuts'. */
:root { --line-1: #2a78d6; --line-2: #008300; --line-3: #6250d6; --line-4: #d4589a; --line-5: #22529a; --line-6: #1baf7a; }
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    --line-1: #3987e5; --line-2: #0ca30c; --line-3: #9085e9; --line-4: #d55181; --line-5: #5a96e2; --line-6: #199e70;
  }
}
:root[data-theme="dark"] { --line-1: #3987e5; --line-2: #0ca30c; --line-3: #9085e9; --line-4: #d55181; --line-5: #5a96e2; --line-6: #199e70; }

/* The strips share the height the view has (logs.js gives each its height): none lies out of sight, and nothing here
   scrolls up or down. A strip's name lies in the room above its line, at the left, and its value under the pointer at
   the right. */
.strips {
  position: relative; flex: 0 1 auto; min-height: 0; overflow: hidden; cursor: crosshair;
  background: var(--surface); border-radius: 10px; box-shadow: 0 0 0 1px var(--border);
}
.strip { position: relative; padding: 0 14px; border-bottom: 1px solid var(--line); overflow: hidden; }
.strip .head {
  position: absolute; z-index: 1; left: 14px; right: 14px; top: 5px; display: flex; align-items: baseline; gap: 8px;
  white-space: nowrap; pointer-events: none;
}
/* where the room runs out, what says most stays whole: the value, then the name, and the rest is cut short first */
.strip .label { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.strip.cuts .label { flex: none; }
.strip .unit, .strip .span { color: var(--ink-3); font-size: 11px; font-variant-numeric: tabular-nums; }
.strip .span { flex: 0 1000 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.strip .now { flex: none; margin-left: auto; font-weight: 600; font-variant-numeric: tabular-nums; }
.strip canvas { display: block; width: 100%; height: 100%; }
/* A channel's line takes the whole height of its strip: its name, unit and range lie over the line ("over"), each on a
   little of the surface to be read by; so do the cuts' names in the lowest strips. Many strips: each is lower, so a
   name says less. */
.strip.over .head { top: 4px; gap: 6px; }
.strip.over .head > span:not(:empty) { padding: 0 3px; border-radius: 3px; background: color-mix(in srgb, var(--surface) 78%, transparent); }
.strip.over .head > .label:first-child { margin-left: -3px; }
/* channels drawn together in one strip: each name with its colour, each value under the pointer in it */
.strip .member i { display: inline-block; width: 8px; height: 8px; margin-right: 4px; border-radius: 2px; vertical-align: 0; }
.strip .now b { font-weight: 600; }
.strip .now .unit { font-weight: 400; }
.strip.over .head > .now { margin-right: -3px; }
.strips.tight .strip .head { top: 0; gap: 6px; font-size: 12px; line-height: 16px; }
.strips.tight .strip .span, .strips.tight .strip .head > .unit { display: none; }
.time-axis { padding: 0 14px 6px; background: var(--surface); }
.time-axis canvas { display: block; width: 100%; height: 24px; }
/* moved about in as the Scope's capture is: a strip is dragged, the strip of the whole log under the time axis
   frames the part shown */
#strips { cursor: default; }
#strips .strip canvas { cursor: grab; }
body.grabbing #strips canvas { cursor: grabbing !important; }
.time-axis canvas.overview { height: 34px; border-radius: 4px; }
/* what cut the engine: one strip, a hue for each cause, and in its head the causes that cut, each with what set it off
   where the ECU noted that */
.strip .causes { display: flex; flex: 0 1000 auto; gap: 12px; min-width: 0; overflow: hidden; white-space: nowrap; font-size: 11px; color: var(--ink-2); }
.strip .cause { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.strip .cause i { display: inline-block; width: 8px; height: 8px; margin-right: 4px; border-radius: 2px; vertical-align: 0; }
.checks .cuts-entry { margin-top: 6px; }
/* among the channels shown: one drawn in another's strip sits under that one, and the quiet button that draws a
   channel in another's strip (or gives it one of its own again) */
.checks label.joined { margin-left: 12px; border-radius: 0 6px 6px 0; box-shadow: inset 2px 0 0 var(--border); }
.checks .join {
  flex: none; align-self: center; padding: 0 4px; border: 0; border-radius: 4px; background: none;
  font: inherit; font-size: 13px; line-height: 16px; color: var(--ink-3); cursor: pointer;
}
.checks .join:hover { background: var(--plane); color: var(--ink-1); }
/* ⊕ shows with the pointer on its row (its room kept: nothing moves); ⊖ of one drawn in another's strip always */
/* a family (each cylinder's, each bank's) as one row, ▸ to list each of them under it; ▾ folds them again */
.checks label.member { margin-left: 12px; }
.checks .fold {
  flex: none; align-self: center; padding: 0 4px; border: 0; border-radius: 4px; background: none; font: inherit;
  font-size: 13px; line-height: 16px; color: var(--ink-3); cursor: pointer;
}
.checks .fold:hover { background: var(--plane); color: var(--ink-1); }
.checks .join[data-join] { opacity: 0; }
.checks label:hover .join[data-join], .checks .join[data-join]:focus-visible { opacity: 1; }
/* rows are dragged (logs.js: dropAt): nothing in the list moves meanwhile; the row dragged is faint, the row whose
   strip it would join is ringed, a line lies where it would go (indented where it would join the strip around it) */
.checks { position: relative; }
.checks label[data-id] { user-select: none; -webkit-user-select: none; }
.checks label.dragged { opacity: 0.4; }
.checks label.drop-into { background: var(--wash); box-shadow: inset 0 0 0 2px var(--series-1); }
.drop-line { position: absolute; left: 8px; right: 8px; z-index: 2; height: 2px; border-radius: 1px; background: var(--series-1); pointer-events: none; }
.drop-line.inside { left: 22px; }
.drop-line[hidden] { display: none; }
body.dragging-channel, body.dragging-channel * { cursor: grabbing !important; }
body.dragging-channel .checks label:hover { background: none; }
body.dragging-channel .checks label.drop-into { background: var(--wash); }
.drag-ghost {
  position: fixed; z-index: 100; display: flex; flex-direction: column; gap: 1px; max-width: 260px; padding: 5px 9px;
  border-radius: 8px; background: var(--ink-1); color: var(--surface); font-size: 12px; line-height: 1.35;
  pointer-events: none; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
}
.drag-ghost b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.drag-ghost span { opacity: 0.75; white-space: nowrap; }
.checks .cuts-entry input:disabled + .name { color: var(--ink-3); }
/* the channels worked out here (computed.py): their heading holds the settings of the power estimate and a new
   channel's formula; a person's own channel has ✎ with the pointer on its row (its room kept: nothing moves) */
.checks h3.computed { display: flex; align-items: center; gap: 6px; }
.checks h3.computed > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-tools { display: inline-flex; flex: none; gap: 2px; margin-left: auto; }
.list-tool {
  flex: none; padding: 1px 6px; border: 0; border-radius: 5px; background: none; font: inherit;
  font-size: 11px; font-weight: 600; color: var(--ink-3); cursor: pointer; white-space: nowrap;
}
.list-tool:hover { color: var(--ink-1); background: var(--wash); }
.checks .edit {
  flex: none; align-self: center; padding: 0 4px; border: 0; border-radius: 4px; background: none; font: inherit;
  font-size: 12px; line-height: 16px; color: var(--ink-3); cursor: pointer; opacity: 0;
}
.checks label:hover .edit, .checks .edit:focus-visible { opacity: 1; }
.checks .edit:hover { background: var(--plane); color: var(--ink-1); }
/* a channel of one's own, written by a formula: the last row of the channels worked out */
.checks .list-add {
  display: block; width: 100%; margin: 2px 0 6px; padding: 4px 8px; border: 0; border-radius: 6px; background: none; font: inherit;
  color: var(--ink-3); text-align: left; cursor: pointer;
}
.checks .list-add:hover { background: var(--wash); color: var(--ink-1); }
.log-nav { margin-right: 2px; }
/* the part looked at, in words: room for the longest, so that the tools beside it never move */
#log-range { display: inline-block; min-width: 9.5em; text-align: right; font-variant-numeric: tabular-nums; }
#log-sub.noted { display: flex; white-space: nowrap; }
#log-sub.noted .sub-facts { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
#log-sub.noted .sub-note { flex: none; }
/* what lies over the log while one is opened: the log under it blurred, a card with how far it is and Cancel */
#view-logs .stage { position: relative; }
.log-loading {
  position: absolute; inset: 0; z-index: 20; display: grid; place-items: center;
  background: color-mix(in srgb, var(--plane) 45%, transparent); backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px);
}
.log-loading[hidden] { display: none; }
.log-loading .card {
  width: min(380px, calc(100% - 32px)); padding: 16px 18px 14px; border-radius: 12px; background: var(--surface);
  box-shadow: 0 0 0 1px var(--border), 0 16px 40px rgba(0, 0, 0, 0.25);
}
.log-loading .what { margin: 0 0 4px; font-weight: 600; overflow-wrap: anywhere; }
.log-loading .doing { min-height: 1.4em; margin: 0 0 10px; color: var(--ink-2); font-size: 12px; font-variant-numeric: tabular-nums; }
.log-loading .meter { height: 4px; margin-bottom: 12px; border-radius: 2px; background: var(--wash); overflow: hidden; }
.log-loading .meter span { display: block; width: 0; height: 100%; background: var(--series-1); }

/* search everything */

.spot { position: fixed; inset: 0; z-index: 60; background: rgba(0, 0, 0, 0.32); }
.spot-box {
  width: min(680px, 92vw); max-height: 70vh; margin: 11vh auto 0; display: flex; flex-direction: column;
  background: var(--surface); border-radius: 12px; box-shadow: 0 0 0 1px var(--border), 0 24px 70px rgba(0, 0, 0, 0.4);
}
.spot-box input { margin: 12px 12px 8px; padding: 10px 12px; font-size: 15px; }
.spot-results { flex: 1; min-height: 0; overflow-y: auto; padding: 0 8px; }
.spot-results button {
  display: block; width: 100%; padding: 7px 10px; border: 0; border-radius: 8px; background: none;
  font: inherit; color: var(--ink-1); text-align: left; cursor: pointer;
}
.spot-results button:hover, .spot-results button[aria-current="true"] { background: var(--wash); }
.spot-results .what { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.spot-results .detail { display: block; color: var(--ink-2); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.spot-results .none { padding: 14px 10px; color: var(--ink-3); }
.spot-results mark { background: none; color: var(--series-1); }
.spot-results button.more { color: var(--ink-2); font-size: 12px; }
.spot-hint { margin: 0; padding: 8px 18px 10px; border-top: 1px solid var(--line); color: var(--ink-3); font-size: 11px; }

/* hover readout */

/* what a thing says about itself (tips.js): over the page, beside the thing */
.tip {
  position: fixed; z-index: 60; max-width: min(360px, calc(100vw - 16px)); padding: 7px 10px; border-radius: 7px;
  background: var(--tip); color: var(--tip-ink); box-shadow: 0 0 0 1px var(--border), 0 8px 24px rgba(0, 0, 0, 0.22);
  font-size: 12px; font-weight: 400; line-height: 1.45; white-space: normal; overflow-wrap: break-word; pointer-events: none;
}

.tooltip {
  position: fixed; z-index: 50; pointer-events: none; padding: 6px 9px; border-radius: 6px;
  background: var(--ink-1); color: var(--surface); font-size: 12px; line-height: 1.4; white-space: nowrap;
  font-variant-numeric: tabular-nums; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}
.tooltip b { font-weight: 650; }
.tooltip .where { opacity: 0.75; }

/* A narrower window: the list of tables stays beside the table and takes less of the width. In a really narrow
   one it becomes what the search field opens, over the table, so that the table and its charts keep the room. */
@media (max-width: 899px) {
  #view-tables, #view-logs { grid-template-columns: min(var(--sidebar, 264px), 30vw) minmax(0, 1fr); }
  .stage { padding: 12px 14px 10px; }
  /* one under the other; the title then takes its own height and no more (its 360px is a width, when beside) */
  .stage-head { flex-direction: column; align-items: flex-start; }
  .stage-head > div:first-child { flex: none; }
}
@media (max-width: 719px) {
  #view-tables { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  #view-tables .sidebar { border-right: 0; border-bottom: 1px solid var(--line); }
  #view-tables .sidebar input { margin: 8px 12px; }
  #view-tables .resizer { display: none; }
  #view-tables .table-list {
    display: none; position: absolute; z-index: 30; left: 0; right: 0; top: 100%; max-height: 62vh;
    background: var(--surface); box-shadow: 0 0 0 1px var(--border), 0 16px 40px rgba(0, 0, 0, 0.22);
  }
  #view-tables .sidebar.open .table-list { display: block; }
}


/* ---- the list: what is off, and the line that says how much of it is left out ---------------------------------- */
.table-list button:not(.group):not(.bundle) { display: flex; align-items: center; gap: 6px; }
.table-list button .name { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.table-list button .tag { flex: none; margin-left: 0; }
.tag.off { color: var(--ink-2); box-shadow: inset 0 0 0 1px var(--axis); background: var(--wash); }
.menu-part { margin: 6px 10px 2px; color: var(--ink-3); font-size: 11px; font-weight: 600; letter-spacing: 0.02em; }
.menu-part:first-child { margin-top: 2px; }
.menu-part:not(:first-child) { padding-top: 7px; box-shadow: inset 0 1px 0 var(--line); }
.ghost.sure { font-weight: 600; color: var(--ink-1); box-shadow: inset 0 0 0 1px var(--serious); }

/* a table that is not in use: there to be looked at, and greyed so that nobody takes it for a live one */
.grid-wrap.unused .grid td { filter: grayscale(1); opacity: 0.45; }
.grid-wrap.unused .curve, .grid-wrap.unused .surface { filter: grayscale(1); opacity: 0.5; }

/* ---- a page of settings: blocks as FT Manager's screen has them, fields that are changed in place --------------- */
.feature .feature-switch {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 2px 0 12px; padding: 8px 14px;
  background: var(--surface); border-radius: 10px; box-shadow: 0 0 0 1px var(--border); color: var(--ink-2);
}
.feature .feature-switch b { color: var(--ink-1); }
.feature .feature-switch.off { box-shadow: 0 0 0 1px var(--axis); }
.feature .blocks { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
/* which blocks share a row, and how wide each is, pages.js works out: a row is filled, and its blocks are one height */
.feature .block {
  grid-column: span 12; min-width: 0; margin: 0; padding: 10px 14px 10px; background: var(--surface); border-radius: 10px;
  box-shadow: 0 0 0 1px var(--border);
}
/* a wide block sets its fields in columns; the line over a field that begins a column is cut away with the top edge */
.feature .block > .body { column-count: var(--columns, 1); column-gap: 28px; clip-path: inset(1px -8px -8px -8px); }
.feature .block > .body .row, .feature .block.inner, .feature .foot .fact, .feature .foot .note { break-inside: avoid; }
/* a block is a column: its fields first, then at its foot, as low as the block reaches, what is only shown and FT
   Manager's notes, quiet, so that they read as remarks and take no room from the fields */
.feature .block:not(.inner) { display: flex; flex-direction: column; }
.feature .block > .body + .foot { margin-top: auto; }
.feature .foot { column-count: var(--columns, 1); column-gap: 28px; padding-top: 8px; color: var(--ink-3); font-size: 12px; line-height: 1.4; }
.feature .block.inner .foot { column-count: 1; padding-top: 4px; }
.feature header + .foot, .feature .why + .foot { padding-top: 2px; }
.feature .facts { margin: 0; }
.feature .fact { display: block; padding: 1px 0; }
.feature .fact b { margin-left: 6px; color: var(--ink-2); font-weight: 600; font-variant-numeric: tabular-nums; }
.feature .fact b:first-child { margin-left: 0; }
.feature .fact .unit { margin-left: 3px; }
.feature .note { margin: 4px 0 0; }
.feature .foot > :first-child { margin-top: 0; }
.feature .note.long { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; cursor: help; }
.feature .note.long:hover { color: var(--ink-2); }
.feature .block.inner { margin: 8px 0 0; padding: 8px 0 0; border-radius: 0; box-shadow: inset 0 1px 0 var(--line); background: none; }
.feature .block > .body > .block.inner:first-child { margin-top: 0; padding-top: 0; box-shadow: none; }
.feature .block header { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 24px; margin-bottom: 4px; }
.feature .block h2 { margin: 0; color: var(--ink-1); font-size: 13px; font-weight: 650; }
.feature h2.part { margin: 10px 0 8px; color: var(--ink-2); font-size: 12px; font-weight: 600; }
.feature .row { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 30px; padding: 2px 0; }
.feature .row + .row { box-shadow: inset 0 1px 0 var(--line); }
.feature .row.own { min-height: 0; padding: 0; box-shadow: none; }
.feature .row .what { min-width: 0; color: var(--ink-2); line-height: 1.3; }
.feature .row .what small, .pref small { display: block; margin-top: 1px; color: var(--ink-3); font-size: 11px; line-height: 1.35; }
.feature .row .field { display: inline-flex; align-items: center; justify-content: flex-end; gap: 6px; flex: none; max-width: 62%; }
.feature .row .field b { font-weight: 600; font-variant-numeric: tabular-nums; }
/* the room for a unit beside every box, whether it has one or not: the boxes of a block line up */
.feature .row .unit { flex: none; min-width: 34px; color: var(--ink-3); font-size: 12px; white-space: nowrap; }
/* a number is typed where it stands: it looks like the box it is */
.num {
  width: 78px; padding: 3px 7px; border: 0; border-radius: 6px; background: var(--plane); box-shadow: inset 0 0 0 1px var(--axis);
  font: inherit; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--ink-1); text-align: right; outline: none;
}
.num:hover:not(:disabled) { box-shadow: inset 0 0 0 1px var(--ink-3); }
.num:focus { box-shadow: inset 0 0 0 2px var(--series-1); }
.num:disabled { background: none; box-shadow: inset 0 0 0 1px var(--line); color: var(--ink-3); }
.num.bad { box-shadow: inset 0 0 0 2px var(--critical); }
.feature select, .pick select, .pick input {
  max-width: 100%; padding: 3px 6px; border: 0; border-radius: 6px; background: var(--plane); box-shadow: inset 0 0 0 1px var(--axis);
  font: inherit; font-weight: 600; color: var(--ink-1);
}
.feature select { text-overflow: ellipsis; }
.feature select:disabled { color: var(--ink-3); box-shadow: inset 0 0 0 1px var(--line); }
/* one of a few: side by side, the chosen one filled */
.seg { display: inline-flex; flex-wrap: nowrap; border-radius: 6px; box-shadow: inset 0 0 0 1px var(--axis); overflow: hidden; }
/* on a page of settings every field to choose in is the same width, whatever it offers, so that they line up. It is
   buttons side by side where they fit that width, never one over another, and a list where they do not */
.feature .row.choice .field { flex: 0 0 min(264px, 62%); min-width: 0; max-width: none; }
.feature .row.choice.bare .field { flex: 1 1 0; }
.feature .row.choice .seg { display: flex; flex: 1; min-width: 0; }
.feature .row.choice .seg button { flex: 1 1 auto; }
.feature .row.choice select { display: none; flex: 1; width: 100%; min-width: 0; }
.feature .row.choice.squeezed .seg { display: none; }
.feature .row.choice.squeezed select { display: block; }
/* FT Manager's note on a field: a small mark after its name; the note is its tip */
.info {
  display: inline-grid; place-items: center; width: 15px; height: 15px; margin: 0 0 0 6px; padding: 0; vertical-align: 0;
  border: 0; border-radius: 50%; background: none; box-shadow: inset 0 0 0 1px var(--ink-3); color: var(--ink-3);
  font: italic 600 10px/1 Georgia, "Times New Roman", serif; cursor: help;
}
.info:hover, .info:focus-visible { color: var(--ink-1); box-shadow: inset 0 0 0 1px var(--ink-2); }
.seg button { padding: 3px 9px; border: 0; background: none; font: inherit; color: var(--ink-2); white-space: nowrap; cursor: pointer; }
.seg button + button { box-shadow: inset 1px 0 0 var(--axis); }
.seg button:hover:not(:disabled) { background: var(--wash); color: var(--ink-1); }
.seg button[aria-pressed="true"] { background: var(--series-1); color: #fff; font-weight: 600; }
.seg button:disabled { cursor: default; color: var(--ink-3); }
.seg button:disabled[aria-pressed="true"] { background: var(--axis); color: var(--ink-1); }
.toggle { width: 30px; height: 17px; border-radius: 9px; }
.toggle i { width: 13px; height: 13px; transition: margin-left 0.12s; }
.toggle.on i { margin-left: 13px; }
button.toggle:disabled { cursor: default; opacity: 0.5; }
span.toggle { opacity: 0.5; }
.feature .row.off .what { color: var(--ink-3); }
.feature .block.off > header h2 { color: var(--ink-2); }
.feature .block.off > .rows, .feature .block.off > .body > .rows { opacity: 0.6; }
.feature .why, .panel .why { margin: 0 0 6px; color: var(--ink-3); font-size: 12px; line-height: 1.4; }
.feature .hint { margin: 6px 0 0; color: var(--ink-3); font-size: 12px; line-height: 1.4; }
.pending { animation: pending 0.9s ease-in-out infinite alternate; }
@keyframes pending { from { opacity: 1; } to { opacity: 0.45; } }
@media (prefers-reduced-motion: reduce) { .pending { animation: none; opacity: 0.6; } .toggle i { transition: none; } }

/* ---- what lies over the page: the changes, the preferences, what an agent may do ------------------------------ */
#sheet { display: grid; place-items: center; -webkit-backdrop-filter: blur(7px); backdrop-filter: blur(7px); }
.sheet-box { width: min(620px, 94vw); max-height: 82vh; margin: 0; display: flex; flex-direction: column; }
.sheet-box #sheet-body { min-height: 0; overflow-y: auto; margin: 0 -6px; padding: 0 6px 6px; }
.sheet-box h3 { margin: 12px 0 4px; font-size: 12px; font-weight: 650; color: var(--ink-2); }
.sheet-box h3 a { color: var(--ink-1); }
.sheet-lead { color: var(--ink-2); }
.changes { border-radius: 8px; box-shadow: inset 0 0 0 1px var(--border); padding: 2px 12px; }
.changes div { display: flex; align-items: baseline; gap: 10px; padding: 4px 0; font-variant-numeric: tabular-nums; }
.changes div + div { box-shadow: inset 0 1px 0 var(--line); }
.changes .what { flex: 1; min-width: 0; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.changes .was { color: var(--ink-3); text-decoration: line-through; }
.changes .to { color: var(--ink-3); }
.pref { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 6px 0; }
label.pref { justify-content: flex-start; gap: 10px; cursor: pointer; }
label.pref input { flex: none; margin: 0; accent-color: var(--series-1); }
.pref > span { min-width: 0; }
.pref b { font-weight: 600; }
.panel {
  position: fixed; z-index: 45; top: 54px; right: 12px; width: min(400px, calc(100vw - 24px)); padding: 12px 16px 10px;
  background: var(--surface); border-radius: 12px; box-shadow: 0 0 0 1px var(--border), 0 16px 40px rgba(0, 0, 0, 0.22);
}
.panel h2 { margin: 0 0 4px; font-size: 14px; }

/* ---- live data: the top row's values are the first tiles there, so the row itself is left out ------------------ */
body[data-view="live"] .vitals { display: none; }
.tile { position: relative; }
.tile .star {
  position: absolute; top: 5px; right: 6px; padding: 2px 4px; border: 0; background: none; font-size: 13px; line-height: 1;
  color: var(--axis); cursor: pointer; opacity: 0;
}
.tile:hover .star, .tile .star:focus-visible, .tile .star.on { opacity: 1; }
.tile .star:hover { color: var(--ink-2); }
.tile .star.on { color: #e3a008; }
.tile.fav { box-shadow: 0 0 0 1px rgba(227, 160, 8, 0.45); }
/* the value a search was sent here for: ringed for a moment (an outline: nothing moves) */
.tile.spotlit { outline: 2px solid transparent; outline-offset: 2px; animation: spotlit 2.8s ease-out; }
@keyframes spotlit { 0%, 55% { outline-color: var(--series-1); } 100% { outline-color: transparent; } }
.tile .label { padding-right: 18px; }

/* ---- the oscilloscope ------------------------------------------------------------------------------------------ */
/* the two plots share whatever height the window leaves, so that all of it is seen without scrolling */
#view-scope { display: flex; flex-direction: column; overflow-y: auto; padding: 16px 20px 14px; }
.scope-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 16px; margin-bottom: 10px; flex: none; }
.pick { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); white-space: nowrap; }
.pick input { width: 58px; text-align: right; outline: none; }
.scope-plots { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.scope-plot {
  display: flex; flex-direction: column; flex: 1; min-height: 170px; margin-bottom: 10px; padding: 10px 12px 8px;
  background: var(--surface); border-radius: 10px; box-shadow: 0 0 0 1px var(--border);
}
.scope-plot canvas { display: block; flex: 1 1 0; width: 100%; height: 0; min-height: 0; cursor: grab; }
.scope-plot.scope-strip { flex: none; min-height: 0; padding: 8px 12px; }
.scope-strip canvas { flex: none; height: 46px; cursor: pointer; }
.scope-plots .readout { flex: none; margin: 0 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
body.grabbing, body.grabbing .scope-plot canvas { cursor: grabbing !important; user-select: none; }
.scope-nav button { min-width: 30px; }
.scope-nav button:disabled { opacity: 0.45; }
.scope-name { margin: 0 0 4px; font-weight: 600; }
.scope-name .quiet { font-weight: 400; }
.scope-seen { margin: 4px 0 0; color: var(--ink-2); font-size: 12px; font-variant-numeric: tabular-nums; }
.spot-results button.unused .what { color: var(--ink-2); }
.pref .seg { flex: none; flex-wrap: nowrap; }
/* the units, a sheet of their own: a kind on each line, one list of one width for every kind */
#sheet[data-kind="units"] .sheet-box { width: min(500px, 94vw); }
.unit-rows { display: flex; flex-direction: column; margin: 2px 0 8px; padding: 2px 14px; border-radius: 10px; box-shadow: inset 0 0 0 1px var(--border); }
.unit-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 40px; cursor: pointer; }
.unit-row + .unit-row { box-shadow: inset 0 1px 0 var(--line); }
.unit-row > span { min-width: 0; color: var(--ink-1); font-weight: 600; }
.unit-row select {
  flex: none; width: 210px; padding: 4px 8px; border: 0; border-radius: 6px; background: var(--plane); box-shadow: inset 0 0 0 1px var(--axis);
  font: inherit; font-weight: 600; color: var(--ink-1); cursor: pointer;
}
.unit-row select:focus-visible { box-shadow: inset 0 0 0 2px var(--series-1); outline: none; }
.feature .row.own { flex: none; gap: 0; }
.feature .row.own .what { display: none; }
.feature .row.own .field { max-width: none; }
.feature .row .what:empty { display: none; }
.feature .row .what:empty + .field { max-width: 100%; }

/* ---- a page that draws its tables, and a page of ours that puts several of FT Manager's entries together -------- */
.feature .part-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 20px 0 8px; }
.feature > .part-head:first-child, .feature > .why:first-child + .part-head { margin-top: 2px; }
.feature .part-head h2 { margin: 0; color: var(--ink-1); font-size: 14px; font-weight: 650; }
/* small tables two to a row, the cards of a row one height; a wide one, or one without a partner, takes the row
   (pages.js works out which, from the width there is) */
.feature .t-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-bottom: 14px; }
.feature .t-card { min-width: 0; display: flex; flex-direction: column; }
.feature .t-card.wide { grid-column: 1 / -1; }
.feature .t-slot { flex: 1 1 auto; display: flex; flex-direction: column; min-width: 0; }
.feature .t-slot > .grid-wrap { flex: 1 1 auto; }
/* one line, whatever the width: what the axes are is cut short, and its tip holds the whole */
.feature .t-card > header { display: flex; align-items: baseline; gap: 12px; margin: 0 2px 6px; min-width: 0; white-space: nowrap; }
.feature .t-card h2 { flex: none; margin: 0; color: var(--ink-1); font-size: 13px; font-weight: 650; }
.feature .t-card .sub { min-width: 0; overflow: hidden; text-overflow: ellipsis; color: var(--ink-3); font-size: 12px; }
.feature .t-card .grid-wrap { overflow-x: auto; overflow-y: visible; }
/* the table worked on has a quiet ring; a copy is drawn as it is, and a press on it makes it the table */
.feature .t-card.here .grid-wrap:not(.copy) { box-shadow: 0 0 0 1px var(--series-1); }
.feature .t-slot:has(> .copy) { cursor: cell; }
.feature .t-card .surface, .feature .t-card .curve.many { height: 300px; }
.feature .t-card .curve:not(.many) { height: 170px; }
/* the tools of a table in a narrow window: they wrap within the width, not past it */
.stage-tools { max-width: 100%; }

/* ---- autotune: the fuel table corrected from lambda as the engine runs ----------------------------------------- */
/* the map takes what the window leaves; the right column's cards keep their rows; nothing moves when its state changes */
#view-autotune { display: flex; flex-direction: column; overflow-y: auto; padding: 16px 20px 14px; }
.at-head { flex: none; display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 10px 16px; margin-bottom: 10px; }
.at-title { flex: 1 1 320px; min-width: 0; }
.at-title .sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.at-warn { color: var(--serious); font-weight: 600; cursor: help; }
.at-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 10px; max-width: 100%; }
/* buttons side by side, each as wide as the widest of them in the language shown */
.at-even { display: inline-grid; grid-auto-flow: column; grid-auto-columns: 1fr; }
.at-even button { padding: 4px 12px; }
.at-tools .seg button:disabled { opacity: 0.6; }
.at-key-button kbd, .at-go kbd, .at-layers kbd {
  display: inline-block; min-width: 15px; margin-left: 6px; padding: 0 3px; border-radius: 3px; box-shadow: inset 0 0 0 1px var(--border);
  font: inherit; font-size: 10px; font-weight: 500; line-height: 14px; color: var(--ink-3); text-align: center; vertical-align: 1px;
}
.at-go { display: inline-grid; grid-template-columns: auto auto; align-items: center; padding: 5px 10px 5px 14px; }
.at-go > span { grid-area: 1 / 1; text-align: center; }
.at-go kbd { grid-area: 1 / 2; color: rgba(255, 255, 255, 0.8); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.45); }
.at-go.running { background: var(--critical); }
.at-go.running .at-go-start, .at-go:not(.running) .at-go-stop { visibility: hidden; }

/* the gate row: eight marks in fixed places, then one sentence */
.at-gates { flex: none; display: flex; align-items: center; gap: 18px; height: 26px; margin-bottom: 10px; white-space: nowrap; min-width: 0; }
.at-marks { display: flex; gap: 14px; flex: none; }
.at-gate { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-3); font-size: 12px; cursor: default; }
.at-gate i { flex: none; width: 9px; height: 9px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px var(--axis); }
.at-gate[data-on="yes"] { color: var(--ink-1); }
.at-gate[data-on="yes"] i { background: var(--good); box-shadow: none; }
.at-gate[data-on="no"] { color: var(--ink-2); }
.at-gate[data-on="no"] i { box-shadow: inset 0 0 0 1.5px var(--ink-3); }
.at-gate.blocking { color: var(--ink-1); }
.at-gate.blocking i { box-shadow: inset 0 0 0 2.5px var(--serious); }
.at-said { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; text-align: right; font-weight: 600; color: var(--ink-2); }
.at-said.ok { color: var(--ink-1); }

.at-body { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 336px; gap: 12px; }
.at-main { display: flex; flex-direction: column; gap: 10px; min-width: 0; min-height: 0; }
.at-map, .at-trace, .at-card { background: var(--surface); border-radius: 10px; box-shadow: 0 0 0 1px var(--border); }
.at-map { flex: 1 1 0; min-height: 240px; display: flex; flex-direction: column; padding: 8px 10px; }
.at-map-head { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 14px; height: 28px; margin-bottom: 6px; }
.at-layers { display: inline-grid; grid-auto-flow: column; grid-auto-columns: 1fr; flex: none; }
.at-layers button { width: auto; padding: 4px 12px; white-space: nowrap; }
.at-layers button:disabled { color: var(--ink-3); background: none; cursor: default; }
/* a fixed width whatever it says: the ends of the scale and what the colours mean */
.at-legend { flex: 0 1 480px; min-width: 0; display: flex; align-items: center; gap: 8px; color: var(--ink-2); font-size: 12px;
  font-variant-numeric: tabular-nums; white-space: nowrap; }
.at-legend > span:first-child { flex: none; width: 78px; text-align: right; }
.at-legend > span:nth-child(3) { flex: none; width: 78px; }
.at-legend .scale-ramp { flex: none; width: 120px; }
.at-legend-key { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; color: var(--ink-3); }
.at-canvas { position: relative; flex: 1 1 0; min-height: 0; }
.at-canvas canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; cursor: crosshair; }
.at-empty { position: absolute; inset: 0; margin: 0; display: grid; place-items: center; padding: 20px; text-align: center; background: var(--surface); }
.at-trace { flex: none; height: 148px; display: flex; flex-direction: column; padding: 6px 10px 4px; }
.at-trace-head { flex: none; display: flex; align-items: baseline; gap: 8px; height: 18px; margin: 0 0 2px; font-size: 12px; white-space: nowrap; overflow: hidden; }
.at-trace-head b { font-weight: 600; }
.at-keys { display: flex; gap: 14px; margin-left: auto; color: var(--ink-2); min-width: 0; overflow: hidden; }
.at-keys i { display: inline-block; width: 14px; height: 0; margin-right: 5px; vertical-align: middle; border-top: 2px solid var(--series-1); }
.at-keys .k-target { border-top: 1.5px dashed var(--ink-2); }
.at-keys .k-corr { border-top-color: var(--series-3); }
.at-keys .k-used { height: 3px; border: 0; background: var(--series-1); opacity: 0.5; }
.at-keys .k-write { width: 1px; height: 11px; border: 0; background: var(--ink-3); vertical-align: -2px; }
#at-trace { flex: 1 1 0; display: block; width: 100%; height: 0; min-height: 0; }
.readout.at-readout { flex: none; height: 20px; min-height: 0; margin: 0 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.at-side { display: flex; flex-direction: column; gap: 12px; min-width: 0; min-height: 0; }
.at-card { padding: 10px 14px 12px; min-width: 0; }
.at-card h2 { margin: 0 0 6px; color: var(--ink-2); font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.at-big { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 4px; }
.at-big i { display: block; color: var(--ink-3); font-size: 11px; font-style: normal; }
.at-big b { font-size: 24px; font-weight: 600; line-height: 1.2; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.at-big small { margin-left: 6px; color: var(--ink-3); font-size: 11px; }
.at-rows > div, .at-run-body > div { display: flex; align-items: center; gap: 8px; height: 26px; box-shadow: inset 0 1px 0 var(--line); }
.at-rows span:first-child, .at-run-body span:first-child { flex: 1; min-width: 0; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.at-rows b, .at-run-body b { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.at-rows b { min-width: 58px; text-align: right; }
#at-error-way { flex: none; width: 34px; color: var(--ink-3); font-size: 11px; }
.at-meter { position: relative; flex: none; width: 76px; height: 6px; border-radius: 3px; background: var(--wash); }
.at-meter::before { content: ""; position: absolute; left: 50%; top: -2px; width: 1px; height: 10px; background: var(--axis); }
.at-meter i { position: absolute; top: -3px; width: 4px; height: 12px; border-radius: 2px; transform: translateX(-50%); box-shadow: 0 0 0 1px var(--surface); }
.at-run-body { height: 104px; overflow: hidden; }
.at-run-body .v { flex: none; display: inline-flex; align-items: baseline; gap: 5px; }
.at-run-body small { color: var(--ink-3); font-size: 11px; white-space: nowrap; }
.at-run-body.at-will { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 6; color: var(--ink-2); font-size: 12px; line-height: 17px; }
.at-why { color: var(--ink-1); font-weight: 600; }
.at-run-body b.at-stuck { color: var(--serious); cursor: help; }
.at-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; margin-top: 10px; }
.at-actions .at-wide { grid-column: 1 / -1; }
.at-actions button { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.at-card .ghost:disabled { color: var(--ink-3); opacity: 0.6; cursor: default; background: none; }
.at-latest { flex: 1 1 0; min-height: 120px; display: flex; flex-direction: column; }
.at-log { flex: 1 1 0; min-height: 0; margin: 0; padding: 0; list-style: none; overflow: hidden; }
.at-log li { display: flex; align-items: center; gap: 8px; height: 24px; box-shadow: inset 0 1px 0 var(--line); font-size: 12px;
  font-variant-numeric: tabular-nums; white-space: nowrap; }
.at-log li.none { height: auto; padding-top: 6px; box-shadow: none; color: var(--ink-3); white-space: normal; }
.at-log .sw { flex: none; width: 10px; height: 10px; border-radius: 2px; }
.at-log .k-carried .sw { opacity: 0.55; outline: 1px dashed var(--ink-3); outline-offset: 0; }
.at-log .where { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; color: var(--ink-2); }
.at-log .vals { color: var(--ink-2); }
.at-log s { color: var(--ink-3); }
.at-log .vals b { color: var(--ink-1); font-weight: 600; }
.at-log .pct { flex: none; width: 58px; text-align: right; font-weight: 600; }
.at-log .kind { flex: none; width: 10px; color: var(--ink-3); text-align: center; }

/* its settings, in the sheet */
.at-go.cannot { opacity: 0.55; }
/* its settings, in the sheet: four blocks as cards in two columns, one line a setting, all of it in view */
#sheet[data-kind="autotune"] .sheet-box { width: min(1060px, 96vw); max-height: 96vh; }
.at-blocks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 4px; }
.at-blocks > div { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
/* the two columns end level: the last card of the shorter one reaches the foot of the longer */
.at-blocks > div > .at-block:last-child { flex: 1 1 auto; }
.at-block { min-width: 0; padding: 4px 14px 6px; border-radius: 10px; box-shadow: inset 0 0 0 1px var(--border); }
.sheet-box .at-block h3, .at-unfold { display: flex; align-items: center; gap: 8px; height: 28px; margin: 0; color: var(--ink-1); font-size: 12px; font-weight: 650; }
.at-unfold { width: 100%; padding: 0; border: 0; background: none; font: inherit; font-size: 12px; font-weight: 650; text-align: left; cursor: pointer; }
.at-unfold .twist { flex: none; width: 0; height: 0; border-left: 5px solid var(--ink-3); border-top: 4px solid transparent; border-bottom: 4px solid transparent; }
.at-unfold[aria-expanded="true"] .twist { transform: rotate(90deg); }
/* folded, its room is kept: the sheet is the same size either way */
.at-folds[data-open="false"] .at-folded { visibility: hidden; }
.at-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 31px; }
.at-row + .at-row, .at-block h3 + .at-row, .at-folded > .at-row:first-child { box-shadow: inset 0 1px 0 var(--line); }
.at-name { display: flex; align-items: center; min-width: 0; color: var(--ink-1); }
.at-name > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.at-name .info { flex: none; }
.at-field { flex: none; display: inline-flex; align-items: center; gap: 6px; }
.at-field .at-box { flex: none; width: 78px; }
.at-field span.at-box { display: inline-flex; justify-content: flex-end; }
.at-field .unit { flex: none; width: 34px; color: var(--ink-3); font-size: 12px; white-space: nowrap; }
.at-field .seg button { padding: 2px 9px; }
.at-block .why { margin: 0 0 4px; }
.sheet-box .why { margin: 0 0 6px; color: var(--ink-3); font-size: 12px; line-height: 1.4; }
.sheet-box p.at-sheet-said { flex: 1; min-width: 0; align-self: center; margin: 0; color: var(--critical); font-size: 12px; line-height: 1.35; }

/* a narrow window: the cards go under the map, and the page scrolls at its edge */
@media (max-width: 979px) {
  #view-autotune { padding: 12px 14px 14px; }
  .at-body { flex: none; grid-template-columns: minmax(0, 1fr); }
  .at-map { flex: none; height: clamp(360px, 64vh, 620px); }
  .at-side { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .at-latest { grid-column: 1 / -1; min-height: 0; }
  .at-log { flex: none; height: 240px; }
  .at-gates { flex-wrap: wrap; height: auto; row-gap: 4px; }
  .at-marks { flex-wrap: wrap; row-gap: 4px; }
  .at-said { flex: 1 0 100%; height: 20px; text-align: left; }
  .at-keys span:nth-child(n + 4) { display: none; }
  .at-legend-key { display: none; }
  .at-legend { flex: none; }
}
@media (max-width: 899px) { .at-blocks { grid-template-columns: minmax(0, 1fr); } }

/* the settings of the power estimate, as autotune's are laid out; its fuel is a list as wide as a box with its unit */
#sheet[data-kind="estimate"] .sheet-box { width: min(900px, 96vw); max-height: 96vh; }
#sheet[data-kind="estimate"] .at-field .unit { width: 52px; }
.at-field .at-choice {
  width: 172px; padding: 3px 6px; border: 0; border-radius: 6px; background: var(--plane); box-shadow: inset 0 0 0 1px var(--axis);
  font: inherit; font-weight: 600; color: var(--ink-1); text-overflow: ellipsis;
}
.sheet-box .est-facts { margin: -4px 0 8px; }

/* a channel of one's own: its name, unit, decimals and formula, the log's channels offered as a name is typed between
   brackets (six rows' room, kept whether there are any or not), and what it gives over the log on show */
#sheet[data-kind="formula"] .sheet-box { width: min(640px, 94vw); }
.formula { display: flex; flex-direction: column; gap: 8px; }
.formula .f-row { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--ink-2); }
.formula .f-pair { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; }
.formula input, .formula textarea {
  padding: 5px 8px; border: 0; border-radius: 6px; background: var(--plane); box-shadow: inset 0 0 0 1px var(--axis);
  font: inherit; font-size: 13px; color: var(--ink-1); outline: none;
}
.formula textarea { resize: none; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; line-height: 1.45; }
.formula input:focus, .formula textarea:focus { box-shadow: inset 0 0 0 2px var(--series-1); }
.formula .seg button { padding: 4px 11px; }
.f-offer {
  display: flex; flex-direction: column; gap: 1px; height: 152px; padding: 4px; border-radius: 8px;
  box-shadow: inset 0 0 0 1px var(--line); overflow: hidden;
}
.f-offer button {
  display: flex; flex: none; align-items: baseline; gap: 8px; height: 23px; padding: 2px 8px; border: 0; border-radius: 5px;
  background: none; font: inherit; font-size: 12px; color: var(--ink-1); text-align: left; cursor: pointer;
}
.f-offer button .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.f-offer button .more { color: var(--ink-3); font-size: 11px; }
.f-offer button:hover, .f-offer button[aria-selected="true"] { background: var(--wash); }
.f-offer p { margin: 6px 4px; font-size: 12px; }
.sheet-box .f-said { height: 34px; margin: 0; overflow: hidden; color: var(--ink-2); font-size: 12px; line-height: 1.4; }
.sheet-box .f-said[data-kind="bad"] { color: var(--critical); }
.sheet-box .f-said[data-kind="warn"] { color: var(--ink-1); }
.f-grow { flex: 1; }
.ghost.f-drop { color: var(--critical); }
@media (max-width: 639px) { .at-side { grid-template-columns: minmax(0, 1fr); } .at-legend-key { display: none; } }
