    :root {
      color-scheme: dark;
      --bg: #101214;
      --panel: #181b1f;
      --panel-2: #20242a;
      --text: #e8edf2;
      --muted: #9aa6b2;
      --ok: #20c997;
      --warn: #ffd166;
      --bad: #ff6b6b;
      --info: #4dabf7;
      --line: #323841;
    }
    * { box-sizing: border-box; }
    body {
      margin: 0;
      font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
      background: var(--bg);
      color: var(--text);
    }
    main {
      width: min(1120px, calc(100vw - 32px));
      margin: 24px auto;
    }
    header {
      display: flex;
      align-items: baseline;
      justify-content: space-between;
      gap: 16px;
      margin-bottom: 18px;
    }
    h1 {
      font-size: 24px;
      line-height: 1.2;
      margin: 0;
      font-weight: 650;
    }
    /* The InnoSpector mark is white on transparent: it needs the dark header. */
    .brand-logo { height: 1.3em; vertical-align: -0.28em; margin-right: 10px; }
    .subtle { color: var(--muted); font-size: 13px; }
    .grid {
      display: grid;
      grid-template-columns: repeat(4, minmax(0, 1fr));
      gap: 12px;
    }
    /* Always-visible run summary. Sticky, so it still answers "как оно там" from
       the bottom of the event log. It wraps to a second row instead of scrolling
       sideways: a chip parked off-screen is a chip nobody reads. Everything here
       is sized to keep those rows short — 11px text, tight padding, icons instead
       of words — because the bar costs its height on every screen, phone
       included. */
    .statusbar {
      position: sticky;
      top: 0;
      z-index: 20;
      display: flex;
      flex-wrap: wrap;
      align-content: flex-start;
      gap: 5px;
      padding: 6px 0;
      margin-bottom: 12px;
      background: var(--bg);
      border-bottom: 1px solid var(--line);
    }
    .sbar-chip {
      display: inline-flex;
      align-items: center;
      gap: 4px;
      padding: 3px 8px;
      border-radius: 999px;
      font-size: 11px;
      line-height: 1.35;
      color: var(--muted);
      /* Values change length every poll; wrapping one would resize the bar and
         shove the whole page down mid-read. */
      white-space: nowrap;
    }
    /* The icon is what the chip is; on a phone it is the only thing saying so,
       because the word next to it is the first casualty of the width budget. */
    .sbar-icon {
      font-size: 12px;
      line-height: 1;
    }
    .sbar-key {
      color: var(--muted);
    }
    /* The value carries the verdict, so it also carries the colour: a separate
       status dot would cost a seventh of the chip's width to say the same thing. */
    .sbar-val {
      color: var(--text);
      font-variant-numeric: tabular-nums;
    }
    .sbar-val.ok { color: var(--ok); }
    .sbar-val.warn { color: var(--warn); }
    .sbar-val.bad { color: var(--bad); }
    /* No fresh reading behind the number: shown, but not as a live value. */
    .sbar-val.stale { color: var(--muted); }
    /* The dashboard stopped answering: every chip but the link one describes a
       moment that has passed, so they fade together instead of one by one. */
    .statusbar.offline .sbar-chip:not(#sb_conn) { opacity: 0.45; }
    /* "9мс" and "999мс" take the same room: the chip is the first in the bar
       and a width that follows the digits would shift every chip after it. */
    /* Fixed widths: a chip that changes size nudges every chip after it. "ch" is
       the width of a digit, so the Cyrillic units need room of their own. */
    #sb_conn_val, #sb_conn_rate, #sb_lio_val, #sb_speed_val {
      display: inline-block; text-align: right; font-variant-numeric: tabular-nums;
    }
    #sb_conn_val { min-width: 5.5ch; }
    #sb_conn_rate:not(:empty) { min-width: 4.5ch; }
    #sb_lio_val { min-width: 7ch; }
    #sb_speed_val { min-width: 6ch; }
    /* Journal badge: the colour is the worst level among entries the operator
       has not seen yet; grey means nothing new. */
    .sbar-log-dot {
      width: 9px;
      height: 9px;
      border-radius: 50%;
      background: var(--muted);
      flex: none;
    }
    .sbar-chip.log-info .sbar-log-dot { background: var(--info); }
    .sbar-chip.log-warn .sbar-log-dot { background: var(--warn); }
    .sbar-chip.log-error .sbar-log-dot { background: var(--bad); }
    .sbar-chip.log-info .sbar-val { color: var(--info); }
    .sbar-chip.log-warn .sbar-val { color: var(--warn); }
    .sbar-chip.log-error .sbar-val { color: var(--bad); }
    .control-grid {
      display: grid;
      grid-template-columns: max-content max-content max-content minmax(0, 1fr);
      gap: 10px;
      align-items: end;
    }
    .button-row {
      display: flex;
      flex-wrap: wrap;
      align-items: end;
      gap: 10px;
    }
    .mode-tabs {
      display: inline-flex;
      gap: 6px;
      padding: 4px;
      border: 1px solid var(--line);
      border-radius: 8px;
      background: var(--panel-2);
      margin-bottom: 12px;
    }
    .mode-tab {
      border: 0;
      padding: 8px 10px;
      background: transparent;
      color: var(--muted);
    }
    .mode-tab.active {
      background: var(--panel);
      color: var(--text);
      border: 1px solid var(--line);
    }
    .mode-panel.hidden {
      display: none;
    }
    /* Utility class: it has to win over whatever display the element declares
       (.field is display:grid and is defined later in this file). */
    .hidden {
      display: none !important;
    }
    /* Lives inside the sticky statusbar as its own full-width row: seeking and
       watching the effect happen at opposite ends of the page, so the bar has
       to follow the scroll. */
    /* Fixed height whatever the bar does: the bar only fades in and out
       (visibility keeps its box), and a seekable track's extra thickness fits
       inside the reserved height. */
    .status-strip {
      flex: 1 1 100%;
      display: grid;
      grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
      gap: 16px;
      align-items: center;
      height: 40px;
      margin-top: 2px;
    }
    .status-strip-text {
      font-size: 13px;
      color: var(--muted);
    }
    .status-strip-progress {
      visibility: hidden;
    }
    .status-strip-progress.active {
      visibility: visible;
    }
    .replay-progress-head {
      display: flex;
      justify-content: space-between;
      font-size: 12px;
      color: var(--muted);
      margin-bottom: 4px;
    }
    .replay-progress-right {
      display: flex;
      align-items: center;
      gap: 8px;
    }
    .replay-pause-btn {
      padding: 0 8px;
      font-size: 12px;
      line-height: 18px;
    }
    .replay-progress-track {
      height: 8px;
      border-radius: 4px;
      background: var(--panel-2);
      border: 1px solid var(--line);
      overflow: hidden;
    }
    /* Fatter and clickable only when the player accepts seeks: the height is
       the affordance, a thin bar reads as an indicator. */
    .replay-progress-track.seekable {
      height: 14px;
      cursor: pointer;
    }
    .replay-progress-bar {
      height: 100%;
      width: 0%;
      background: var(--ok);
      transition: width 0.5s linear;
    }
    /* ── Transfer warnings ─────────────────────────────────────────────────
       Full-width orange banners shown while files leave over the network or a
       USB copy runs. They sit above everything (sticky, high z-index) because
       their whole job is to stop the operator powering the unit down mid-write.
       Each is hidden when its channel is idle and carries a live progress bar. */
    .xfer-banners {
      position: sticky;
      top: 0;
      z-index: 40;               /* over the statusbar (20) — the warning wins */
      display: flex;
      flex-direction: column;
    }
    .xfer-banner {
      display: flex;
      align-items: center;
      gap: 12px;
      padding: 10px 16px;
      /* Dark text on orange, not the page's light-on-dark: the banner is meant
         to read as an alert, not another panel. */
      color: #1c1206;
      background: linear-gradient(180deg, #ff9838 0%, #ff7a18 100%);
      border-bottom: 2px solid #b34d00;
      cursor: pointer;
    }
    /* Not an alert like the transfer banners: nothing breaks, the page is old. */
    .reload-banner {
      color: #fff;
      background: linear-gradient(180deg, #3a8ee6 0%, #2a74c9 100%);
      border-bottom-color: #1d5596;
    }
    .reload-banner .xfer-banner-warn { margin-bottom: 0; }
    .xfer-banner-icon {
      font-size: 22px;
      line-height: 1;
      flex: none;
    }
    .xfer-banner-body {
      flex: 1 1 auto;
      min-width: 0;
    }
    .xfer-banner-line {
      display: flex;
      justify-content: space-between;
      align-items: baseline;
      gap: 12px;
      font-weight: 650;
      font-size: 14px;
    }
    .xfer-banner-title {
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
    .xfer-banner-pct {
      flex: none;
      font-variant-numeric: tabular-nums;
    }
    .xfer-banner-warn {
      font-size: 12px;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.04em;
      margin: 2px 0 6px;
    }
    .xfer-banner-track {
      height: 8px;
      border-radius: 4px;
      background: rgba(0, 0, 0, 0.28);
      overflow: hidden;
    }
    .xfer-banner-bar {
      height: 100%;
      width: 0%;
      background: #2a1a06;
      border-radius: 4px;
      transition: width 0.4s linear;
    }
    /* No total to divide by (a zip is still being built, or the stream reported
       no size): sweep a partial bar instead of guessing a percentage. */
    .xfer-banner-bar.indeterminate {
      width: 35%;
      transition: none;
      animation: xfer-sweep 1.3s ease-in-out infinite;
    }
    @keyframes xfer-sweep {
      0%   { margin-left: -35%; }
      100% { margin-left: 100%; }
    }
    /* Launch options of a scenario: one titled row instead of checkboxes
       scattered down the card. */
    .option-row {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      gap: 8px 18px;
      margin-top: 6px;
    }
    .option-row label {
      display: inline-flex;
      align-items: center;
      gap: 6px;
    }
    .pose-form {
      display: grid;
      grid-template-columns: repeat(4, 84px) max-content;
      align-items: end;
      gap: 8px;
    }
    .pose-controls {
      padding-left: 10px;
      border-left: 1px solid var(--line);
    }
    .field {
      display: grid;
      gap: 4px;
    }
    .field label {
      color: var(--muted);
      font-size: 12px;
    }
    /* Checkboxes are not text fields: the 84px width below would stretch the
       box away from its label. */
    input[type="checkbox"] {
      width: auto;
    }
    input {
      width: 84px;
      border: 1px solid var(--line);
      border-radius: 8px;
      background: var(--panel-2);
      color: var(--text);
      padding: 9px 10px;
      font: inherit;
    }
    select {
      width: 100%;
      border: 1px solid var(--line);
      border-radius: 8px;
      background: var(--panel-2);
      color: var(--text);
      padding: 9px 10px;
      font: inherit;
    }
    button {
      appearance: none;
      border: 1px solid var(--line);
      border-radius: 8px;
      background: var(--panel-2);
      color: var(--text);
      padding: 10px 12px;
      font: inherit;
      cursor: pointer;
    }
    button:hover { border-color: var(--muted); }
    /* The action of the section — one per row at most. */
    button.primary {
      border-color: var(--ok);
      color: var(--ok);
    }
    button.primary:hover { background: rgba(32, 201, 151, 0.12); }
    /* The publish button takes its colour from the run, not from the page:
       green while a running localizer waits for a pose (the one action needed
       then), a short pulse after the pose fields change under a running
       scenario (a republish is how a drifted localization gets corrected),
       plain otherwise — published is done, and nothing runs means nobody to
       publish to. */
    button.needed {
      border-color: var(--ok);
      color: var(--ok);
    }
    button.needed:hover { background: rgba(32, 201, 151, 0.12); }
    button.pulse { animation: publish-pulse 1.2s ease-in-out infinite; }
    button.kiss-working {
      border-color: var(--warn);
      color: var(--warn);
      animation: publish-pulse 1.2s ease-in-out infinite;
    }
    button.kiss-failed {
      border-color: var(--bad);
      color: var(--bad);
    }
    button.kiss-success {
      border-color: var(--ok);
      color: var(--ok);
      background: rgba(32, 201, 151, 0.12);
    }
    @keyframes publish-pulse {
      0%, 100% { border-color: var(--line); color: var(--text); }
      50% { border-color: var(--ok); color: var(--ok); }
    }
    @media (prefers-reduced-motion: reduce) {
      button.pulse {
        animation: none;
        border-color: var(--ok);
        color: var(--ok);
      }
    }
    /* A section whose only content is one row: its title on the left of the
       row, in a column as wide for each such section, so the rows line up and
       the card is a line shorter for each. */
    .labeled-row {
      display: flex;
      align-items: center;
      gap: 12px;
      margin-top: 12px;
    }
    .labeled-row > .group-title {
      flex: 0 0 13em;
      margin: 0;
    }
    .labeled-row > .select-row {
      flex: 1 1 auto;
      min-width: 0;
      margin-top: 0;
    }
    #lio_source { flex: 0 0 auto; }
    /* The scenario's one button: its labels stacked in one cell, the current
       one shown (data-mode), so the width is the longest label's. */
    button.scenario-toggle { display: inline-grid; }
    button.scenario-toggle > span { grid-area: 1 / 1; visibility: hidden; }
    button.scenario-toggle[data-mode="start"] > [data-mode="start"],
    button.scenario-toggle[data-mode="stop"] > [data-mode="stop"],
    button.scenario-toggle[data-mode="kill"] > [data-mode="kill"] { visibility: visible; }
    /* Recovery action: stops the scenario and kills leftover processes. */
    button.danger {
      color: var(--bad);
      border-color: var(--bad);
    }
    button.danger:hover { background: rgba(255, 107, 107, 0.12); }
    button:disabled {
      cursor: not-allowed;
      color: var(--muted);
      opacity: 0.7;
    }
    .card {
      background: var(--panel);
      border: 1px solid var(--line);
      border-radius: 8px;
      padding: 14px;
      min-height: 92px;
      /* Grid items default to min-width:auto, so a nowrap child (.single-line)
         contributes its full text width as the card's minimum size: the card
         then overflows its 1fr track instead of ellipsizing, and the page width
         twitches every time a number changes length. Pin it to 0 so the track,
         not the text, decides the width. */
      min-width: 0;
    }
    /* A folded card is its title line: the minimum height meant for tiles
       left a band of empty panel under it. */
    .card:has(> details:not([open])) { min-height: 0; }
    .wide { grid-column: span 2; }
    .full { grid-column: 1 / -1; }
    /* Kept for reuse; the tacheometer cards now stack full-width (the marker
       setup lays itself out horizontally inside its own card, see
       .markers-columns). */
    .narrow { grid-column: span 1; }
    .span3 { grid-column: span 3; }
    .label {
      color: var(--muted);
      font-size: 12px;
      text-transform: uppercase;
      letter-spacing: 0;
      margin-bottom: 8px;
    }
    .value {
      font-size: 28px;
      line-height: 1.1;
      font-variant-numeric: tabular-nums;
      overflow-wrap: anywhere;
    }
    .small-value {
      font-size: 16px;
      line-height: 1.35;
      overflow-wrap: anywhere;
    }
    .single-line {
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
    /* A value too long for one phone-width line, split into several
       independently ellipsized rows (see setLinesWithTitle in dashboard.js). */
    .value-lines {
      min-width: 0;
      font-variant-numeric: tabular-nums;
    }
    .value-lines > div {
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
    /* Card head: what the card is and what state it is in on the left, the way
       into it on the right (3D viewer, 2D initial-pose panel). */
    .card-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      flex-wrap: wrap;
    }
    .pointcloud-viewer-head-controls {
      display: flex;
      flex-wrap: wrap;
      min-width: 0;
      margin-left: auto;
      align-items: center;
      gap: 10px;
    }
    #pointcloud_viewer_card > .card-head .label { margin-bottom: 0; }
    #pointcloud_viewer_status:empty { display: none; }
    .pointcloud-view-menu { position: relative; }
    .pointcloud-view-menu summary {
      list-style: none;
      border: 1px solid var(--line);
      border-radius: 8px;
      padding: 9px 12px;
      background: var(--panel-2);
      cursor: pointer;
    }
    .pointcloud-view-menu summary::-webkit-details-marker { display: none; }
    .pointcloud-view-menu summary::after { content: " ▾"; color: var(--muted); }
    .pointcloud-view-menu summary:hover { border-color: var(--muted); }
    .pointcloud-view-options {
      position: absolute;
      top: calc(100% + 6px);
      left: 0;
      z-index: 12;
      display: grid;
      gap: 12px;
      width: min(290px, calc(100vw - 64px));
      padding: 14px;
      border: 1px solid var(--line);
      border-radius: 8px;
      background: var(--panel-2);
      box-shadow: 0 8px 24px #0006;
    }
    .pointcloud-view-options label { display: flex; align-items: center; gap: 8px; }
    .pointcloud-view-options input[type="checkbox"] { flex: none; margin: 0; }
    .pointcloud-view-options select { min-width: 0; width: 100%; max-width: 100%; }
    #pointcloud_live_source_control { display: grid; }
    #pointcloud_color_mode_control { display: grid; border-top: 1px solid var(--line); padding-top: 12px; }
    .pointcloud-viewer-stage {
      position: relative;
      width: 100%;
      height: min(68vh, 680px);
      min-height: 360px;
      margin-top: 12px;
      overflow: hidden;
      border: 1px solid var(--line);
      border-radius: 8px;
      background: #090b0d;
      touch-action: none;
    }
    /* The align stage is a third shorter than the 3D viewer's: it is one part of a
       card that also holds the pose fields, the actions and the map controls, and
       the whole section has to fit a phone screen at once. */
    #align_stage {
      height: min(45vh, 460px);
      min-height: 240px;
    }
    #pointcloud_canvas,
    #align_canvas {
      display: block;
      width: 100%;
      height: 100%;
      cursor: grab;
    }
    #pointcloud_reference_labels {
      position: absolute;
      inset: 0;
      width: 100%;
      height: 100%;
      pointer-events: none;
      z-index: 1;
    }
    #pointcloud_canvas.dragging,
    #align_canvas.dragging {
      cursor: grabbing;
    }
    #align_panel { margin-top: 12px; }
    .align-bar { align-items: center; margin: 10px 0; }
    /* Inside a flex row a select must not claim the whole width. */
    .align-bar select,
    .card-head select {
      width: auto;
      min-width: 140px;
    }

    #align_status.error {
      color: var(--bad);
    }
    #align_status { margin-top: 8px; }
    .pointcloud-viewer-overlay {
      position: absolute;
      top: 10px;
      left: 10px;
      max-width: calc(100% - 20px);
      padding: 6px 9px;
      border-radius: 6px;
      background: rgba(16, 18, 20, 0.78);
      color: var(--muted);
      font-size: 12px;
      pointer-events: none;
      z-index: 2;
    }
    .pointcloud-viewer-overlay.error {
      color: var(--bad);
    }
    .pointcloud-viewer-stats {
      display: flex;
      flex-wrap: wrap;
      gap: 8px 18px;
      margin-top: 10px;
      color: var(--muted);
      font-size: 12px;
      font-variant-numeric: tabular-nums;
    }
    .pointcloud-viewer-stats strong {
      color: var(--text);
      font-weight: 500;
    }
    /* Calibration card. The live picture and the coverage map sit side by
       side because the operator reads them together: the map says which wedge
       is short, the picture says where that wedge is in front of them. */
    .calib-setup {
      display: flex;
      flex-wrap: wrap;
      align-items: flex-end;
      gap: 10px 14px;
      margin-top: 12px;
    }
    .calib-setup label {
      display: flex;
      flex-direction: column;
      gap: 4px;
      font-size: 12px;
      color: var(--muted);
    }
    .calib-setup input,
    .calib-setup select,
    .calib-solve select {
      background: var(--panel-2);
      border: 1px solid var(--line);
      border-radius: 6px;
      color: var(--text);
      padding: 5px 7px;
      font-size: 13px;
    }
    .calib-grid {
      display: grid;
      grid-template-columns: minmax(0, 1fr) 260px;
      gap: 12px;
      margin-top: 12px;
    }
    .calib-view {
      position: relative;
      aspect-ratio: 16 / 9;
      overflow: hidden;
      border: 1px solid var(--line);
      border-radius: 8px;
      background: var(--panel-2);
    }
    .calib-view img,
    .calib-view canvas {
      position: absolute;
      inset: 0;
      width: 100%;
      height: 100%;
    }
    .calib-view img { object-fit: contain; }
    /* The overlay must not eat clicks meant for the picture underneath. */
    .calib-view canvas { pointer-events: none; }
    .calib-side {
      display: flex;
      flex-direction: column;
      gap: 10px;
      min-width: 0;
    }
    .calib-side canvas {
      width: 100%;
      height: auto;
      border: 1px solid var(--line);
      border-radius: 8px;
      background: var(--panel-2);
    }
    .calib-counters {
      display: grid;
      grid-template-columns: 1fr auto;
      gap: 2px 10px;
      font-size: 12px;
      color: var(--muted);
    }
    .calib-counters div { display: contents; }
    .calib-counters b { color: var(--text); font-variant-numeric: tabular-nums; }
    /* The one line the operator actually acts on, so it is the loudest thing
       in the card. */
    .calib-guidance {
      margin-top: 12px;
      padding: 10px 12px;
      border-radius: 8px;
      border: 1px solid var(--line);
      background: var(--panel-2);
      color: var(--text);
      font-size: 15px;
      font-weight: 600;
    }
    .calib-guidance.need { border-color: #b8860b; color: #f0c674; }
    .calib-guidance.done { border-color: #2f7d32; color: #8bd18d; }
    .calib-reason {
      font-size: 12px;
      color: #f0a0a0;
      min-height: 16px;
    }
    .calib-solve {
      display: flex;
      flex-wrap: wrap;
      align-items: flex-end;
      gap: 10px 14px;
      margin-top: 14px;
    }
    .calib-hint { font-size: 11px; color: var(--muted); }
    .calib-maint {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
      margin-top: 12px;
    }
    /* The one button here that cannot be undone. */
    .calib-maint button.danger { border-color: #a04040; color: #f0a0a0; }
    .calib-maint button.danger:hover { border-color: #d05050; }
    .calib-results-table {
      width: 100%;
      margin-top: 12px;
      border-collapse: collapse;
      font-size: 12px;
    }
    .calib-results-table th {
      text-align: left;
      color: var(--muted);
      font-weight: 500;
      padding: 4px 8px;
      border-bottom: 1px solid var(--line);
    }
    .calib-results-table td {
      padding: 4px 8px;
      border-bottom: 1px solid var(--line);
      font-variant-numeric: tabular-nums;
    }
    .calib-results-table tr.best td { color: #8bd18d; }
    .calib-results-table tr.best td:first-child::after { content: " ★"; }
    .calib-results-table td.dim { color: var(--muted); }
    /* Проверка установленной калибровки: строка на находку, слева -- метка
       уровня, чтобы плохое читалось не по тексту, а по цвету и месту. */
    .calib-check { margin-top: 10px; display: grid; gap: 2px; }
    .calib-check .row {
      display: grid;
      grid-template-columns: 92px 1fr;
      gap: 10px;
      align-items: baseline;
      padding: 4px 0;
      font-size: 12px;
      border-top: 1px solid var(--line);
    }
    .calib-check .row:first-child { border-top: none; }
    .calib-check .head {
      margin-top: 8px;
      font-size: 11px;
      letter-spacing: .06em;
      text-transform: uppercase;
      opacity: .65;
    }
    .calib-check .mark {
      font-size: 11px;
      letter-spacing: .04em;
      text-transform: uppercase;
      text-align: right;
    }
    .calib-check .ok   .mark { color: #7fc99a; }
    .calib-check .warn .mark { color: #e0b060; }
    .calib-check .bad  .mark { color: #f0a0a0; }
    .calib-check .bad  { color: #f0a0a0; }

    .calib-drop {
      margin-top: 14px;
      padding: 22px 16px;
      display: grid;
      justify-items: center;
      gap: 4px;
      text-align: center;
      cursor: pointer;
      border: 1px dashed var(--line);
      border-radius: 6px;
    }
    .calib-drop:hover, .calib-drop.over { border-color: #7a9fd0; }
    .calib-drop.over { background: rgba(122, 159, 208, .08); }
    .calib-drop.busy { opacity: .55; cursor: progress; }
    .calib-drop-title { font-size: 13px; }
    .calib-drop-hint { font-size: 11.5px; opacity: .7; }

    .calib-output {
      margin-top: 10px;
      padding: 10px;
      max-height: 320px;
      overflow: auto;
      border: 1px solid var(--line);
      border-radius: 8px;
      background: var(--panel-2);
      color: var(--text);
      font-size: 12px;
      white-space: pre;
    }
    .camera-viewer-grid {
      display: grid;
      grid-template-columns: repeat(3, minmax(0, 1fr));
      gap: 12px;
      margin-top: 12px;
    }
    .camera-viewer-panel {
      min-width: 0;
      overflow: hidden;
      border: 1px solid var(--line);
      border-radius: 8px;
      background: var(--panel-2);
    }
    .camera-viewer-title {
      padding: 8px 10px;
      color: var(--text);
      font-size: 13px;
      font-weight: 600;
    }
    .camera-viewer-image {
      position: relative;
      aspect-ratio: 16 / 9;
      overflow: hidden;
      background: #090b0d;
    }
    .camera-viewer-image img {
      display: block;
      width: 100%;
      height: 100%;
      object-fit: contain;
    }
    .camera-viewer-placeholder {
      position: absolute;
      inset: 0;
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 12px;
      color: var(--muted);
      font-size: 12px;
      text-align: center;
      background: rgba(9, 11, 13, 0.76);
    }
    .camera-viewer-placeholder.error {
      color: var(--bad);
    }
    .camera-viewer-meta {
      display: flex;
      flex-wrap: wrap;
      gap: 3px 10px;
      min-height: 38px;
      padding: 7px 10px;
      color: var(--muted);
      font-size: 11px;
      font-variant-numeric: tabular-nums;
    }
    /* The lamp of a camera, under its picture: icon, slider, value on one
       line. Same height rule as the master slider — a gloved finger. */
    .camera-light {
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 0 10px 8px;
      color: var(--muted);
      font-size: 12px;
      font-variant-numeric: tabular-nums;
    }
    .camera-light input[type="range"] {
      flex: 1 1 auto;
      min-width: 0;
      height: 28px;
      accent-color: var(--ok);
    }
    .camera-light span:last-child {
      min-width: 4ch;
      text-align: right;
    }
    .lights-panel {
      min-width: 0;
      padding: 10px;
      border: 1px solid var(--line);
      border-radius: 8px;
      background: var(--panel-2);
    }
    .lights-title {
      display: flex;
      align-items: baseline;
      justify-content: space-between;
      gap: 8px;
      font-size: 13px;
      font-weight: 600;
    }
    .lights-title span {
      color: var(--muted);
      font-size: 12px;
      font-variant-numeric: tabular-nums;
    }
    .lights-master {
      margin-top: 12px;
    }
    .lights-panel input[type="range"] {
      width: 100%;
      margin-top: 10px;
      height: 28px;  /* thumb big enough for a gloved finger on a phone */
      accent-color: var(--ok);
    }
    /* Presets and the camera toggle share the right side of the card head. */
    .lights-actions {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
      align-items: center;
    }
    /* Not button.primary: these mark the value the lamps are at, not the action
       of the section. */
    .lights-actions button.active {
      border-color: var(--ok);
      color: var(--ok);
    }
    .pill {
      display: inline-flex;
      align-items: center;
      min-height: 34px;
      padding: 6px 10px;
      border-radius: 999px;
      background: var(--panel-2);
      border: 1px solid var(--line);
      font-size: 15px;
    }
    /* Data-flow pipeline. Fixed height so content changes (chips appearing /
       disappearing, mode switches) never resize the card — wide content scrolls
       sideways instead of wrapping. */
    .dataflow {
      display: flex;
      align-items: center;
      gap: 8px;
      height: 92px;
      overflow-x: auto;
      overflow-y: hidden;
      padding: 4px 2px;
      margin-top: 6px;
    }
    .df-node {
      flex: 0 0 auto;
      min-width: 92px;
      border: 1px solid var(--line);
      border-radius: 10px;
      padding: 8px 10px;
      background: var(--panel-2);
      text-align: center;
    }
    .df-node.live { border-color: #2e7d32; }
    .df-node-title { font-weight: 600; font-size: 13px; white-space: nowrap; }
    .df-node-sub { color: var(--muted); font-size: 11px; margin-top: 2px; white-space: nowrap; }
    /* Stacked under the node title here, joined into one line on a phone. */
    .df-line { display: block; }
    .df-edge {
      flex: 0 0 auto;
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 3px;
      min-width: 104px;
    }
    .df-chips { display: flex; flex-direction: column; gap: 2px; font-size: 11px; }
    .df-chip { white-space: nowrap; color: var(--muted); }
    .df-arrow { color: var(--muted); font-size: 16px; line-height: 1; }
    .df-dot {
      display: inline-block;
      width: 7px; height: 7px;
      border-radius: 50%;
      margin-left: 4px;
      vertical-align: middle;
    }
    .df-dot.green { background: #2e7d32; }
    .df-dot.amber { background: #ef6c00; }
    .df-dot.grey { background: #9e9e9e; }

    /* Phone stepper for the state machine: three groups, and the steps of the one
       that is running. Hidden wherever the full graph fits. */
    .state-stepper {
      display: none;
      margin: 6px 0 8px;
    }
    .stepper-row {
      display: flex;
      align-items: center;
      gap: 5px;
      flex-wrap: wrap;
    }
    .stepper-group {
      padding: 4px 9px;
      border: 1px solid var(--line);
      border-radius: 999px;
      background: var(--panel-2);
      color: var(--muted);
      font-size: 11px;
      white-space: nowrap;
    }
    .stepper-group.active {
      color: var(--text);
      border-color: var(--ok);
      background: rgba(32, 201, 151, 0.1);
    }
    .stepper-group.error {
      color: var(--bad);
      border-color: var(--bad);
    }
    .stepper-arrow {
      color: var(--muted);
      font-size: 12px;
    }
    /* One row's worth of height whether or not there is a group to expand, so the
       first status of a run does not push the card open under the reader. */
    .stepper-subs {
      display: flex;
      flex-wrap: wrap;
      gap: 4px;
      margin-top: 6px;
      min-height: 20px;
    }
    .stepper-sub {
      padding: 2px 7px;
      border: 1px solid var(--line);
      border-radius: 999px;
      color: var(--muted);
      font-size: 10px;
      white-space: nowrap;
    }
    .stepper-sub.active {
      color: var(--text);
      border-color: var(--ok);
      background: rgba(32, 201, 151, 0.12);
    }
    .stepper-sub.warning {
      color: var(--warn);
      border-color: var(--warn);
    }
    .stepper-sub.error {
      color: var(--bad);
      border-color: var(--bad);
    }
    /* On a wide screen the graph is a plain block, so its fold has no summary to
       click; applyStateGraphMode() keeps the <details> open there. */
    #state_graph_summary {
      display: none;
      cursor: pointer;
    }
    .state-graph {
      display: block;
      overflow-x: auto;
      padding-bottom: 4px;
    }
    .state-graph-row {
      display: flex;
      align-items: stretch;
      gap: 6px;
      min-width: 900px;
    }
    .state-group {
      flex: 1 1 0;
      min-width: 0;
      padding: 8px;
      border-radius: 8px;
      border: 1px solid var(--line);
      background: rgba(255, 255, 255, 0.015);
    }
    .state-group.active {
      border-color: rgba(32, 201, 151, 0.65);
      background: rgba(32, 201, 151, 0.06);
    }
    .state-group.error {
      border-color: var(--bad);
    }
    #state_group_waiting_for_localization {
      flex-grow: 2.6;
    }
    .state-group-title {
      color: var(--muted);
      font-size: 11px;
      line-height: 1.2;
      margin-bottom: 6px;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    }
    .state-group-body {
      display: flex;
      align-items: stretch;
      gap: 5px;
    }
    .state-node {
      flex: 1 1 0;
      min-height: 48px;
      padding: 8px;
      border-radius: 8px;
      border: 1px solid var(--line);
      background: var(--panel-2);
      color: var(--muted);
    }
    .state-node.active {
      color: var(--text);
      border-color: var(--ok);
      box-shadow: inset 0 0 0 1px rgba(32, 201, 151, 0.45);
    }
    .state-node.error {
      color: var(--bad);
      border-color: var(--bad);
    }
    .state-node-title {
      font-size: 12px;
      font-weight: 650;
      margin-bottom: 4px;
    }
    .state-node-meta {
      font-size: 10px;
      line-height: 1.25;
      font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .state-arrow {
      flex: 0 0 14px;
      display: grid;
      place-items: center;
      color: var(--muted);
      font-size: 14px;
    }
    .state-group-arrow {
      flex: 0 0 18px;
      display: grid;
      place-items: center;
      color: var(--muted);
      font-size: 18px;
    }
    .state-chip-row {
      display: flex;
      gap: 4px;
      margin-top: 5px;
    }
    .state-chip {
      min-width: 0;
      padding: 2px 5px;
      border-radius: 999px;
      border: 1px solid var(--line);
      color: var(--muted);
      background: rgba(255, 255, 255, 0.02);
      font-size: 10px;
      line-height: 1.1;
      white-space: nowrap;
    }
    .state-chip.active {
      color: var(--text);
      border-color: var(--ok);
      background: rgba(32, 201, 151, 0.12);
    }
    .state-chip.error {
      color: var(--bad);
      border-color: var(--bad);
    }
    .state-chip.warning {
      color: var(--warn);
      border-color: var(--warn);
      background: rgba(255, 193, 7, 0.12);
    }
    .source-line {
      color: var(--muted);
      font-size: 11px;
      text-transform: none;
      font-weight: 400;
    }
    .group-title {
      color: var(--muted);
      font-size: 12px;
      text-transform: uppercase;
      letter-spacing: 0;
      margin-bottom: 8px;
    }
    .metrics-grid {
      display: grid;
      grid-template-columns: repeat(6, minmax(0, 1fr));
      gap: 12px;
    }
    /* The two numbers that say whether the match is any good — the only ones in
       the card that stay full size. */
    .metrics-quality {
      grid-template-columns: repeat(2, minmax(0, 180px));
    }
    /* Throughput, folded away: labelled values on a line, not a wall of tiles. */
    .conn-rows {
      display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px;
      margin: 8px 0 0; font-size: 13px;
    }
    .conn-rows dt { color: var(--muted); }
    .conn-rows dd { margin: 0; min-width: 0; }
    .conn-list { list-style: none; margin: 2px 0 0; padding: 0; color: var(--muted); white-space: pre-wrap; }
    .conn-table { border-collapse: collapse; }
    .conn-table th { color: var(--muted); font-weight: normal; text-align: right; padding: 0 0 2px 16px; }
    .conn-table td { padding: 1px 0 1px 16px; text-align: right; font-variant-numeric: tabular-nums; }
    .conn-table th:first-child, .conn-table td:first-child { text-align: left; padding-left: 0; }
    input.conn-name { width: 16ch; padding: 1px 6px; font-size: 13px; }
    .metrics-inline {
      display: flex;
      flex-wrap: wrap;
      gap: 4px 18px;
      margin-top: 6px;
      color: var(--muted);
      font-size: 13px;
      font-variant-numeric: tabular-nums;
    }
    .metrics-inline strong {
      color: var(--text);
      font-weight: 500;
    }
    .metrics-inline strong.ok { color: var(--ok); }
    .metrics-inline strong.warn { color: var(--warn); }
    .metrics-inline strong.bad { color: var(--bad); }
    /* Radio and client lists are one line per interface / station. */
    #conn_wifi, #conn_clients { white-space: pre-line; }
    /* Eight tiles of host telemetry, opened when a run misbehaves: two rows of
       four, and smaller than the readings anyone watches live. */
    .host-metrics-grid {
      grid-template-columns: repeat(4, minmax(0, 1fr));
      margin-top: 8px;
    }
    .host-metrics-grid .value {
      font-size: 18px;
    }
    .host-temperature-section {
      margin-top: 14px;
      padding-top: 12px;
      border-top: 1px solid var(--line);
    }
    .host-temperature-grid {
      grid-template-columns: repeat(3, minmax(0, 1fr));
      margin-top: 8px;
    }
    .host-temperature-grid .value {
      font-size: 18px;
    }
    /* The position in the LAS frame: the one number read at a glance. */
    .position-main {
      font-size: 20px;
      line-height: 1.3;
    }
    /* Both go from empty to their full height the moment the first pose and the
       map arrive — the same moment the operator is looking at the card and
       reaching for a button. The rows are reserved so that moment moves nothing.
       The local-frame line is one row and shows up only when it differs from the
       global one; the map takes two. */
    #current_position_detail {
      min-height: 1.35em;
    }
    #las_map {
      min-height: 2.7em;
    }
    /* One line: dataset dropdown + refresh button (select must not take 100%). */
    .select-row {
      display: flex;
      /* end, not center: a bare select must line up with the input of a
         labelled field standing next to it, not with the label above it. */
      align-items: end;
      gap: 8px;
      /* One line where it fits; on a phone the members stack instead of pushing
         the card past the screen edge. */
      flex-wrap: wrap;
    }
    .select-row select {
      width: auto;
      flex: 1 1 220px;
      /* min(...): the preferred floor on a wide screen, never wider than the
         row itself on a narrow one. */
      min-width: min(180px, 100%);
    }
    .select-row button {
      white-space: nowrap;
    }
    /* A field that shares a row with a select instead of stacking under it. */
    .inline-field {
      flex: 0 0 auto;
      max-width: 100%;
    }
    .inline-field select {
      width: auto;
      min-width: min(220px, 100%);
    }
    /* The run row: dataset name, its refresh icon and the start button. The
       select and the icon behave as one member of the row (own .select-row), so
       the pair grows with the card while the button keeps its size at the end. */
    .dataset-row > #dataset_block {
      flex: 1 1 260px;
    }
    .dataset-row select {
      flex: 1 1 240px;
    }
    /* The thumbnail is taller than a control, so the row centres instead of
       bottom-aligning, and the enlarged hover copy floats over the card below
       rather than pushing it. */
    .dataset-row, .dataset-row > #dataset_block {
      align-items: center;
    }
    .map-thumb {
      flex: 0 0 auto;
      /* Square: drifts come in any orientation, and a wide box leaves a
         north-south one a sliver. */
      width: 56px;
      height: 56px;
      padding: 0;
      overflow: visible;
      position: relative;
      background: #0b0d10;
    }
    .map-thumb img {
      display: block;
      width: 100%;
      height: 100%;
      object-fit: contain;
      border-radius: inherit;
      transform-origin: left top;
      transition: transform 0.12s ease;
    }
    .map-thumb.empty {
      font-size: 11px;
      line-height: 1.15;
      white-space: normal;
      border-style: dashed;
    }
    .map-thumb.empty img, .map-thumb:not(.empty) span {
      display: none;
    }
    .map-thumb:hover img {
      position: relative;
      z-index: 20;
      transform: scale(4.5);
      background: #0b0d10;
      /* The raster's background is as dark as the card: without a frame the
         enlarged copy has no edge and reads as a stray line on the page. */
      outline: 1px solid rgba(255, 255, 255, 0.35);
      box-shadow: 0 6px 24px rgba(0, 0, 0, 0.6);
    }
    .dataset-chips {
      display: flex;
      flex-wrap: wrap;
      gap: 6px;
    }
    .chip {
      padding: 5px 9px;
      border: 1px solid var(--line);
      border-radius: 999px;
      background: var(--panel-2);
      color: var(--muted);
      font-size: 12px;
      white-space: nowrap;
      cursor: help;
    }
    .chip.ok { color: var(--text); }
    .chip.warn { border-color: var(--warn); }
    .chip.bad { border-color: var(--bad); }
    /* Secondary action next to a select: an icon, not a second button competing
       with the choice itself. */
    .icon-button {
      padding: 9px 12px;
      color: var(--muted);
    }
    /* A rebuild that would add something (a raster from before the side views). */
    .icon-button.attention { color: var(--warn); border-color: var(--warn); }
    .icon-button.loading { cursor: progress; }
    .icon-button.loading > span {
      display: inline-block;
      animation: reload-spin 1s linear infinite;
    }
    @keyframes reload-spin {
      to { transform: rotate(360deg); }
    }
    #bag_select_field {
      position: relative;
      flex: 1 1 420px;
      min-width: min(260px, 100%);
    }
    #rename_run_bag_btn,
    #rename_run_bag_save {
      aspect-ratio: 1;
      flex: 0 0 auto;
    }
    .bag-rename-row {
      position: absolute;
      inset-inline: 0;
      top: calc(100% + 6px);
      z-index: 8;
      padding: 6px;
      border: 1px solid var(--line);
      border-radius: 8px;
      background: var(--panel);
      box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
    }
    .bag-rename-row input {
      width: auto;
      flex: 1 1 220px;
      min-width: min(180px, 100%);
    }
    #rename_run_bag_save {
      color: var(--ok);
      border-color: var(--ok);
    }
    .pose-row {
      display: grid;
      grid-template-columns: minmax(0, 1fr);
      gap: 8px 10px;
    }
    .pose-inputs {
      display: grid;
      grid-template-columns: repeat(6, minmax(0, 1fr));
      gap: 8px;
      max-width: 680px;
    }
    .pose-actions {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      gap: 8px;
    }
    .pose-inputs .field { min-width: 0; }
    .pose-inputs .field input {
      width: 100%;
      min-width: 0;
      box-sizing: border-box;
      -moz-appearance: textfield;
    }
    /* KISS-Matcher's button keeps one width through its states. */
    .pose-actions button.kiss-button {
      width: 8em;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    /* A unit shown inside a number field, after what is typed: the field holds
       the number alone. */
    .unit-input { position: relative; display: inline-block; }
    .unit-input input { padding-right: 1.6em; box-sizing: border-box; -moz-appearance: textfield; }
    /* No spin arrows: the unit sits where they would, and nobody steps a pose by them. */
    .unit-input input::-webkit-inner-spin-button,
    .unit-input input::-webkit-outer-spin-button,
    .pose-inputs input::-webkit-inner-spin-button,
    .pose-inputs input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
    .unit-input::after {
      content: attr(data-unit);
      position: absolute; right: 0.6em; top: 50%; transform: translateY(-50%);
      color: var(--muted); pointer-events: none; font-size: 0.9em;
    }
    #dataset_offset { width: 5.5em; }
    .pose-actions button {
      white-space: nowrap;
    }
    .pose-diff { display: flex; align-items: center; gap: 8px; min-width: 0; }
    .pose-diff:has(#pose_diff:empty) { display: none; }
    /* Compact editable dataset settings (offset + initial pose + save). */
    .dataset-form {
      display: flex;
      align-items: flex-end;
      gap: 12px;
      flex-wrap: wrap;
    }
    .dataset-form button {
      white-space: nowrap;
    }
    /* Measurement inputs on the left (two rows), comment on the right spanning
       both. The comment column stretches to the left block's height. */
    .tacheometer-measure {
      display: flex;
      flex-wrap: wrap;
      gap: 12px;
      align-items: stretch;
      margin-bottom: 10px;
    }
    /* Sized to its inputs (no grow) so the comment field can take the space to
       the right of the эталон boxes instead of the inputs stretching to fill. */
    .tacheometer-measure-left {
      flex: 0 1 auto;
      min-width: 0;
      display: flex;
      flex-direction: column;
      gap: 10px;
    }
    .tacheometer-comment-field {
      flex: 1 1 260px;
      min-width: 200px;
      grid-template-rows: auto 1fr;  /* label, then the textarea fills the rest */
    }
    .tacheometer-comment-field textarea {
      width: 100%;
      box-sizing: border-box;
      height: 100%;
      min-height: 80px;
      resize: vertical;
      border: 1px solid var(--line);
      border-radius: 8px;
      background: var(--panel-2);
      color: var(--text);
      padding: 9px 10px;
      font: inherit;
    }
    /* Single-marker measurement row: marker + репер + эталон xyz, wrapping on
       narrow screens instead of a fixed table. */
    .tacheometer-measure-grid {
      display: flex;
      flex-wrap: wrap;
      gap: 10px;
      align-items: flex-end;
    }
    .tacheometer-measure-grid .field {
      flex: 0 0 auto;
      min-width: 84px;
    }
    /* Start / RViz / publish-comment on one wrapping row. */
    .tacheometer-buttons {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
      margin-bottom: 10px;
    }
    .tacheometer-buttons button {
      flex: 1 1 200px;
    }
    .tacheometer-show-markers {
      display: inline-flex;
      align-items: center;
      gap: 8px;
      margin-bottom: 12px;
      color: var(--muted);
      font-size: 13px;
      user-select: none;
    }
    /* Sized to fit one grid column (271px at the 1120px page width) with the
       widest offset an operator types, "-0.235", still fully visible. The id is
       two characters and gives up the room for it. Same grid for the GCS table
       under the offsets. */
    /* The marker setup as horizontal columns across the full-width card
       (offsets · ГСК · computed pose), instead of one tall vertical stack. Wraps
       to fewer columns on a narrow screen. */
    .markers-columns {
      display: flex;
      flex-wrap: wrap;
      gap: 24px;
      align-items: flex-start;
      margin-top: 12px;
    }
    /* Three equal columns filling the full width of the card; they wrap on a
       narrow screen (flex-basis floor). */
    .markers-col,
    .markers-col-pose {
      flex: 1 1 240px;
      min-width: 240px;
      max-width: none;
    }
    /* Reserve two lines for the heading so the differing title lengths don't
       stagger the buttons (and everything below) across the three columns. */
    .markers-col .group-title {
      line-height: 1.35;
      min-height: 2.7em;
    }
    /* Save / compute buttons span the full width of their sub-column. */
    .markers-col button {
      width: 100%;
      box-sizing: border-box;
    }
    /* Pose result as a vertical label/value table filling its column (not the
       620px-wide horizontal one); table.<class> outranks .tacheometer-state-table
       (min-width:620px), which would otherwise win on source order and overflow. */
    table.markers-pose-table {
      min-width: 0;
      width: 100%;
    }
    table.markers-pose-table th {
      padding-right: 24px;
    }
    table.markers-pose-table td {
      text-align: right;
    }
    .device-markers-layout {
      display: flex;
      flex-wrap: wrap;
      gap: 16px;
      align-items: flex-start;
    }
    .device-markers-layout > * { flex: 1 1 300px; min-width: 0; }
    /* Six numbers of a few digits each: stretched over a full-width card the
       fields read as three separate forms. */
    #tab_device .marker-config-list { max-width: 420px; }
    .rig-sketch { margin: 0; }
    @media (min-width: 760px) {
      #lidar_imu_card .rig-sketch { position: sticky; top: 100px; }
    }
    .device-lidar-network { margin: 6px 0 8px; }
    .device-lidar-network input[type="text"] { width: 10em; }
    .device-lidar-form { max-width: 540px; }
    .device-fcu { display: grid; grid-template-columns: max-content minmax(0, 1fr); align-items: center; gap: 8px; }
    .device-fcu input { width: 100%; min-width: 0; box-sizing: border-box; }
    .device-lidar-section { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 8px; }
    .lidar-config-row {
      display: grid;
      grid-template-columns: 86px repeat(3, minmax(0, 1fr));
      gap: 5px;
      align-items: center;
      margin-bottom: 4px;
    }
    .lidar-config-network { grid-template-columns: 86px minmax(0, 5fr) minmax(0, 4fr); }
    .lidar-config-label { color: var(--muted); font-size: 12px; padding-left: 4px; }
    .lidar-config-row:not(.lidar-config-network) .lidar-config-label { white-space: nowrap; }
    .lidar-config-row input, .lidar-config-row select { width: 100%; min-width: 0; box-sizing: border-box; }
    .lidar-config-row input[type="number"] { appearance: textfield; padding-inline: 5px; }
    .external-lidar .lidar-model, .external-lidar .lidar-address { display: none; }
    .device-lidar-actions { margin: 10px 0 4px; }
    .device-lidar-presets { position: relative; }
    .device-lidar-presets summary {
      list-style: none;
      border: 1px solid var(--line);
      border-radius: 6px;
      padding: 7px 10px;
      cursor: pointer;
    }
    .device-lidar-presets summary::-webkit-details-marker { display: none; }
    .device-lidar-presets summary::after { content: " ▾"; color: var(--muted); }
    #device_lidar_preset_options {
      position: absolute;
      top: 100%;
      left: 0;
      z-index: 2;
      display: grid;
      min-width: max-content;
      gap: 4px;
      padding: 5px;
      background: var(--panel-2);
      border: 1px solid var(--line);
      border-radius: 6px;
    }
    #device_lidar_preset_options button { text-align: left; }
    @media (max-width: 520px) {
      .lidar-config-row { grid-template-columns: 66px repeat(3, minmax(0, 1fr)); }
      .lidar-config-network { grid-template-columns: 66px minmax(0, 5fr) minmax(0, 4fr); }
    }
    .rig-sketch svg {
      width: 100%;
      background: var(--panel-2);
      border: 1px solid var(--line);
      border-radius: 6px;
      cursor: grab;
      touch-action: none;
    }
    .rig-sketch figcaption { margin-top: 4px; }
    .marker-config-header,
    .marker-config-row {
      display: grid;
      grid-template-columns: 40px repeat(3, minmax(0, 1fr));
      gap: 5px;
      align-items: center;
    }
    .marker-config-header {
      color: var(--muted);
      font-size: 12px;
      margin-bottom: 6px;
    }
    .marker-config-list {
      display: grid;
      gap: 8px;
      overflow-x: auto;
      padding-bottom: 4px;
    }
    .marker-config-row input {
      width: 100%;
      box-sizing: border-box;
      padding: 8px 6px;
    }
    /* The spinner reserves ~16px of a 46px content box and steps by 0.001 —
       nobody has ever clicked it, and without it "-0.235" fits. */
    .marker-config-row input[type="number"]::-webkit-inner-spin-button,
    .marker-config-row input[type="number"]::-webkit-outer-spin-button,
    .lidar-config-row input[type="number"]::-webkit-inner-spin-button,
    .lidar-config-row input[type="number"]::-webkit-outer-spin-button {
      appearance: none;
      margin: 0;
    }
    .marker-config-row .marker-id-label {
      color: var(--muted);
      font-size: 13px;
      font-variant-numeric: tabular-nums;
      padding: 0 4px;
    }
    .marker-config-row input.marker-gcs-input {
      border-color: var(--muted);
    }
    /* C-markers: computed once from the Kabsch pose, shown but not editable. */
    .marker-config-subhead {
      color: var(--muted);
      font-size: 12px;
      margin: 8px 0 6px;
    }
    .marker-config-row input[readonly] {
      border-color: var(--line);
      color: var(--muted);
      background: transparent;
      cursor: default;
    }
    .tacheometer-state-table {
      border-collapse: collapse;
      min-width: 620px;
      font-size: 12px;
      margin-bottom: 12px;
    }
    .tacheometer-state-table th,
    .tacheometer-state-table td {
      border-top: 1px solid var(--line);
      padding: 4px 8px;
      text-align: left;
      white-space: nowrap;
    }
    .tacheometer-state-table th {
      color: var(--muted);
      font-weight: 500;
    }
    .tacheometer-list {
      margin: 0;
      padding-left: 0;
      list-style: none;
      max-height: 320px;
      min-height: 150px;
      overflow: auto;
    }
    .tacheometer-list li {
      margin-bottom: 8px;
    }
    .tacheometer-result-table {
      border-collapse: collapse;
      min-width: 760px;
      font-size: 12px;
      font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    }
    .tacheometer-result-table th,
    .tacheometer-result-table td {
      border-top: 1px solid var(--line);
      padding: 4px 8px;
      text-align: left;
      white-space: nowrap;
      vertical-align: top;
    }
    .tacheometer-result-table th {
      color: var(--muted);
      font-weight: 500;
    }
    .tacheometer-result-table .tacheometer-status {
      text-align: center;
      font-size: 16px;
      line-height: 1.2;
    }
    .metric {
      min-width: 0;
    }
    .metric .value {
      font-size: 23px;
    }
    .ok { color: var(--ok); }
    .warn { color: var(--warn); }
    .bad { color: var(--bad); }
    pre {
      white-space: pre-wrap;
      overflow-wrap: anywhere;
      margin: 0;
      color: var(--text);
      font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
      font-size: 13px;
      line-height: 1.45;
    }
    .event-log {
      max-height: 360px;
      overflow: auto;
    }
    /* Scenario commands panel: styled as a shell snippet so the commands do
       not blend into the surrounding UI text. */
    #scenario_commands {
      background: var(--bg);
      border: 1px solid var(--line);
      border-radius: 8px;
      padding: 10px 12px;
      font-size: 12.5px;
      line-height: 1.55;
    }
    #scenario_commands .cmd-comment {
      color: var(--muted);
    }
    #scenario_commands .cmd-line {
      color: var(--ok);
    }
    #scenario_commands .cmd-line::before {
      content: "$ ";
      color: var(--muted);
    }
    .event-line.debug { color: var(--muted); }
    .event-line.info { color: var(--text); }
    .event-line.warn { color: var(--warn); }
    .event-line.error { color: var(--bad); }
    /* ── Error pop-ups ─────────────────────────────────────────────────────
       Small cards in the bottom-right corner, one per distinct error line of
       the journal, each gone after a while (see TOAST_TTL_MS). They sit below
       the transfer banners in importance, so they stay out of the top of the
       page and never cover the status bar or the controls. */
    .toasts {
      position: fixed;
      right: 16px;
      bottom: 16px;
      z-index: 30;               /* under the banners (40), over the statusbar (20) */
      display: flex;
      flex-direction: column;
      gap: 8px;
      width: min(380px, calc(100vw - 32px));
      pointer-events: none;      /* the gaps between cards stay clickable */
    }
    .toast {
      pointer-events: auto;
      display: flex;
      align-items: flex-start;
      gap: 10px;
      padding: 10px 12px;
      border-radius: 10px;
      background: var(--panel-2);
      border: 1px solid var(--line);
      border-left: 4px solid var(--bad);
      box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
      color: var(--text);
      font-size: 13px;
      line-height: 1.4;
      cursor: pointer;
      animation: toast-in 0.18s ease-out;
    }
    .toast.summary { border-left-color: var(--warn); }
    .toast-icon { flex: none; font-size: 16px; line-height: 1.3; }
    .toast-body { flex: 1 1 auto; min-width: 0; }
    .toast-head {
      display: flex;
      align-items: baseline;
      gap: 8px;
      font-size: 11px;
      color: var(--muted);
    }
    .toast-source {
      font-weight: 650;
      text-transform: uppercase;
      letter-spacing: 0.04em;
      color: var(--bad);
    }
    .toast.summary .toast-source { color: var(--warn); }
    /* The same line again is a counter on the card, not another card. */
    .toast-count {
      margin-left: auto;
      padding: 0 6px;
      border-radius: 999px;
      background: var(--bad);
      color: #1a0a0a;
      font-weight: 700;
      font-variant-numeric: tabular-nums;
    }
    .toast-count:empty { display: none; }
    /* Long lines are cut: the full text is one tap away in the journal. */
    .toast-text {
      margin-top: 2px;
      overflow: hidden;
      display: -webkit-box;
      -webkit-line-clamp: 3;
      -webkit-box-orient: vertical;
      overflow-wrap: anywhere;
    }
    .toast-close {
      flex: none;
      background: none;
      border: 0;
      padding: 0 2px;
      color: var(--muted);
      font-size: 16px;
      line-height: 1;
      cursor: pointer;
    }
    .toast-close:hover { color: var(--text); }
    @keyframes toast-in {
      from { opacity: 0; transform: translateY(8px); }
      to   { opacity: 1; transform: none; }
    }
    @media (max-width: 640px) {
      .toasts { left: 12px; right: 12px; bottom: 12px; width: auto; }
    }
    @media (max-width: 900px) {
      .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
      .wide { grid-column: span 2; }
      .narrow, .span3 { grid-column: span 2; }
      .control-grid { grid-template-columns: 1fr; align-items: stretch; }
      .pose-controls { padding-left: 0; border-left: 0; }
      .metrics-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
      /* Re-stated after the .metrics-grid override above, which would otherwise
         win on source order and stretch these back to the default track count. */
      .metrics-quality { grid-template-columns: repeat(2, minmax(0, 1fr)); }
      .host-metrics-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
      .host-temperature-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
      .camera-viewer-grid { grid-template-columns: 1fr; }
      .calib-grid { grid-template-columns: 1fr; }
    }
    @media (max-width: 560px) {
      .pose-inputs { gap: 6px; }
      .pose-inputs input { font-size: 14px; padding: 8px 6px; }
      .pose-actions { gap: 6px; }
      .pose-actions button { padding: 8px; }
      main { width: min(100vw - 20px, 1120px); margin: 16px auto; }
      header { display: block; }
      /* Seven chips never fit one phone-wide row, so the bar is two rows here by
         design — and its height is reserved rather than measured. Chips come and
         go with the run (replay only while a bag plays, battery only with MAVROS)
         and a bar that re-wraps mid-run would shove the whole page under the
         reader's thumb. */
      .statusbar { min-height: 64px; }
      /* The icon already says which chip this is; the word is what the width
         budget spends first. */
      .sbar-key { display: none; }
      .grid { grid-template-columns: 1fr; }
      .wide, .full, .narrow, .span3 { grid-column: 1; }
      .metrics-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
      .metrics-quality { grid-template-columns: repeat(2, minmax(0, 1fr)); }
      .host-metrics-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
      .host-temperature-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
      .pose-form { grid-template-columns: repeat(2, 84px); }
      /* Which topic a number comes from, and what the state machine calls the
         current state, are questions asked with the code open — not on a phone in
         the field. Spelled out they are what wraps a heading onto a second and
         third line, and the raw state names change length as the run moves, so
         the heading changed height with them. They survive in the title. */
      .tech { display: none; }
      /* The pipeline runs down the screen instead of across it: three nodes and
         two edges are 500px wide side by side and 340px is all there is. Each
         link collapses to a single line — stacked boxes of the desktop size cost
         400px of scrolling to deliver three numbers. Height stops being fixed
         here: the chain only changes when the data source does, which is a
         deliberate act, not a live reading. */
      .dataflow {
        flex-direction: column;
        align-items: stretch;
        height: auto;
        gap: 4px;
        padding: 0;
        overflow-x: visible;
      }
      .df-node {
        min-width: 0;
        padding: 5px 9px;
        text-align: left;
      }
      .df-node-title { display: inline; font-size: 12px; }
      .df-node-sub { display: inline; margin-left: 6px; }
      /* The localizer node writes its state and rate on two lines; here they are
         one, with a separator standing in for the line break. */
      .df-line { display: inline; }
      .df-line + .df-line::before { content: " · "; }
      /* Arrow first, then the topics crossing that edge — one line, indented
         under the node it leaves. */
      .df-edge {
        flex-direction: row-reverse;
        justify-content: flex-end;
        flex-wrap: wrap;
        min-width: 0;
        gap: 2px 10px;
        padding-left: 9px;
      }
      .df-chips { flex-direction: row; flex-wrap: wrap; gap: 2px 10px; }
      /* Down, not right. */
      .df-arrow { transform: rotate(90deg); }
      /* The stepper replaces the graph; the graph moves behind its summary. */
      .state-stepper { display: block; }
      #state_graph_summary { display: list-item; }
      .position-main { font-size: 17px; }
      /* Every sub-state has its own sentence and they are not the same length, so
         the line under the stepper was one row deep on one state and two on the
         next — and everything below it moved. Two rows, always, clipped; the full
         sentence stays in the tooltip. */
      #state_explanation {
        font-size: 13px;
        line-height: 1.35;
        height: 35px;
        overflow: hidden;
      }
    }

    /* Tab bar between the status bar and the panels. Only one .tab-panel is
       visible at a time (the others carry .hidden). */
    .tabs {
      display: flex;
      gap: 8px;
      margin-bottom: 16px;
      border-bottom: 1px solid var(--line);
    }
    .tab-btn {
      border: none;
      border-bottom: 2px solid transparent;
      border-radius: 0;
      background: transparent;
      color: var(--muted);
      padding: 8px 4px;
      margin-bottom: -1px;
    }
    .tab-btn:hover { border-color: transparent; color: var(--text); }
    /* A capture running on the calibration tab while the operator is looking
       at another one: the only place left to say so is the tab itself. */
    .tab-btn.running::after {
      content: " ●";
      color: #8bd18d;
    }
    .tab-btn.active {
      color: var(--text);
      border-bottom-color: var(--ok);
    }

    /* Файлы прогонов: run | размер | архив | скачать. */
    .run-files-table {
      width: 100%;
      border-collapse: collapse;
      font-size: 13px;
    }
    .run-files-table th,
    .run-files-table td {
      border-top: 1px solid var(--line);
      padding: 8px 10px;
      text-align: left;
      vertical-align: middle;
    }
    .run-files-table th {
      color: var(--muted);
      font-weight: 500;
      border-top: none;
    }
    .run-files-table th.num,
    .run-files-table td.num {
      text-align: right;
      white-space: nowrap;
    }
    .run-files-table .run-id {
      font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
      word-break: break-all;
    }
    /* «Параметры»: a head with the note and the one save, then one table of
       sections (BIEVR-LIO, Локализация with its движение | стоянка columns,
       LAS прогона), every name in the first column and every value under the
       one before it. */
    #params_block { margin-top: 12px; }
    .params-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
    .params-head .group-title { margin: 0; flex: 1 1 auto; }
    .param-table { border-collapse: collapse; margin-top: 6px; font-size: 13px; }
    .param-table th,
    .param-table td { padding: 3px 10px 3px 0; text-align: left; font-weight: 400; }
    .param-table tbody th { color: var(--text); white-space: nowrap; min-width: 13em; }
    .param-table tr.param-section th { color: var(--muted); font-size: 12px; text-transform: uppercase;
      letter-spacing: 0.04em; padding-top: 10px; }
    .param-table tr.param-section th.param-column { text-transform: none; letter-spacing: 0; min-width: 0; }
    .param-table input { width: 84px; }
    .param-table select { width: calc(168px + 10px); }
    /* A value other than a bare launch's default: a bar on its left, the default in its tooltip. */
    .param-table .non-default { box-shadow: inset 3px 0 0 var(--info); }
    /* A static value that differs from its moving one: the run is an experiment. */
    .param-table input.profile-differs { border-color: var(--warn); color: var(--warn); }
    /* A value the selected dataset's dataset.yaml starts the field with. */
    .param-table input.from-dataset { background: rgba(32, 201, 151, 0.12); }
    .params-actions { display: flex; gap: 6px; flex: none; }
    /* «👁 YAML»: both files as a save would leave them; on a tablet, the whole screen. */
    .yaml-preview { width: min(760px, 96vw); max-height: 86vh; padding: 12px 14px; box-sizing: border-box;
      background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 10px; }
    .yaml-preview::backdrop { background: rgba(0, 0, 0, 0.55); }
    .yaml-preview-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
    .yaml-preview-tabs { display: flex; gap: 6px; flex: 1; }
    .yaml-preview-tabs button.active { border-color: var(--info); color: var(--info); }
    .yaml-preview pre { margin: 8px 0 0; max-height: calc(86vh - 90px); overflow: auto; font-size: 12px;
      line-height: 1.45; background: var(--bg); padding: 8px 10px; border-radius: 6px; }
    .yaml-preview pre span { display: block; white-space: pre; }
    /* confirmAction's paragraph, not a file: wrap it. */
    #save_confirm pre.plain { white-space: pre-wrap; }
    .yaml-preview pre .added { background: rgba(32, 201, 151, 0.18); color: var(--ok); }
    input.live-param { border-color: var(--ok); }
    .save-confirm-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }
    /* Room for the buttons under the file: they must never scroll away. */
    #save_confirm pre { max-height: calc(86vh - 150px); }
    .yaml-preview pre .removed { background: rgba(255, 107, 107, 0.14); color: var(--bad); text-decoration: line-through; }
    @media (max-width: 700px) { .yaml-preview { width: 100vw; max-width: 100vw; max-height: 100vh; height: 100vh; border-radius: 0; } }
    .run-summary-toggle {
      all: unset;
      cursor: pointer;
      font: inherit;
    }
    .run-summary-toggle:hover { color: var(--info); }
    .run-summary-row > td { background: var(--panel-2); border-top: none; }
    .run-summary {
      display: flex;
      flex-direction: column;
      gap: 6px;
      font-family: system-ui, sans-serif;
      word-break: normal;
    }
    .run-summary-title { color: var(--muted); margin-top: 4px; }
    .run-summary-error { color: var(--bad); font-size: 12px; }
    .run-summary-points { border-collapse: collapse; font-size: 12px; }
    .run-summary-points th,
    .run-summary-points td { padding: 3px 8px 3px 0; border: none; text-align: left; }
    .run-summary-points th { color: var(--muted); font-weight: 500; }
    .run-summary-points .num { text-align: right; white-space: nowrap; }
    .run-archive-btn,
    .run-usb-btn { padding: 6px 10px; }
    .run-archive-error { color: var(--bad); font-size: 12px; margin-top: 4px; }
    .warn-tag { color: var(--warn); font-size: 12px; white-space: nowrap; }
  
/* Joysticks are relative controls; release and blur always return to neutral. */
#simulation_controls { position:absolute; inset:0; z-index:3; pointer-events:none; }
.simulation-toolbar { display:flex; align-items:center; gap:12px; flex-wrap:wrap; position:absolute; top:44px; left:12px; right:12px; padding:8px; border-radius:8px; background:#19212cc9; pointer-events:auto; }
.simulation-toolbar label { margin-left:auto; display:flex; align-items:center; gap:8px; }
.simulation-toolbar input { width:80px; }
.simulation-toolbar .simulation-lock { margin-left:0; }
.simulation-toolbar input[type="checkbox"] { width:auto; }
.simulation-sticks { display:flex; justify-content:space-between; gap:16px; position:absolute; bottom:12px; left:12px; right:12px; }
.simulation-sticks>div { text-align:center; pointer-events:auto; }
.simulation-pad { width:130px; height:130px; border:2px solid #576578; border-radius:50%; position:relative; touch-action:none; background:radial-gradient(circle,#303b48bb,#20252c66); cursor:grab; margin:0 auto 8px; }
.simulation-pad:focus-visible { outline:2px solid #74b8ff; }
.simulation-pad span { width:48px; height:48px; border-radius:50%; position:absolute; top:calc(50% - 24px); left:calc(50% - 24px); background:#8496ad; border:2px solid #b4c4d9; pointer-events:none; }
.simulation-pad[aria-disabled=true] { opacity:.4; pointer-events:none; }
@media(max-width:500px) { .simulation-pad { width:116px; height:116px; } .simulation-sticks small { font-size:10px; } }
