/* Plate Kinetics Live - the look of the shell (web/shell.js). Loaded after the analysis page's own style sheet. The same
   file serves all programs (BMG, Archimed, CFX).

   Everything comes from the page's design tokens: its colours (--surface, --ink, --accent, --pos, --warn ...), its type
   sizes (--fs-caption, --fs-base, --fs-subtitle, --fs-title; the body size follows compact / standard / comfortable),
   corners (--r-ctl, --r-card, --r-pill), shadows (--elev-1, --card-shadow, --shadow), motion (--dur, --ease, and
   :root[data-motion="reduce"] where the user or Windows asks for less), and its classes (.btn, .seg, .hint, .chk,
   .modal ...). So light, dark, high contrast, the accent colour and the density follow the page's settings without
   anything here; no colour is written here. Where a token is not in the page yet, the size of before stands behind it.
   Everything made by the shell has a class beginning with "saa-"; rules for the page's own parts are written under
   .saa-shell and only change where they sit and how much room they get. Nothing here is layered above the page's own
   floating parts (tooltips 90, dialogs 100, popovers 120, toasts 200). */

:root {
  --saa-side: 232px;
  --saa-shadow: var(--elev-1);
  --saa-ok: var(--ok);         /* the page's colours of "good" and "done" (its series colours where it has none) */
  --saa-done: var(--info);
  --saa-alert-ink: var(--on-colour);     /* text on a strong colour (the red banner, the count of the bell) */
}

#btnShare, #btnOffline { display: none !important; }      /* both need the author's web host */

/* ===================== the window's title bar, drawn by the shell (the window's own buttons at its right) ===================== */
:root { --saa-tb-h: 0px; --saa-tb-room: 0px; }
.saa-titlebar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 60; height: var(--saa-tb-h); display: flex; align-items: center; gap: var(--sp-3);
  padding: 0 var(--saa-tb-room) 0 var(--sp-3); background: var(--surface); color: var(--text); border-bottom: 1px solid var(--border);
  app-region: drag; -webkit-app-region: drag; user-select: none;
}
.saa-titlebar.inactive { color: var(--text-3); }
.saa-titlebar[hidden] { display: none; }
.saa-tb-app { flex: 1 1 0; min-width: 0; display: flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.saa-tb-app b { font-weight: var(--fw-strong); }
.saa-tb-mark { display: grid; place-items: center; color: var(--accent); }
.saa-tb-mark svg { width: var(--icon-s); height: var(--icon-s); }
.saa-tb-search {
  flex: 0 1 420px; min-width: 120px; height: calc(var(--saa-tb-h) - 8px); display: flex; align-items: center; gap: var(--sp-2); padding: 0 var(--sp-2);
  border: 1px solid var(--border); border-radius: var(--r-ctl); background: var(--surface-2); color: var(--text-3); font: inherit; font-size: var(--fs-2); cursor: text;
  app-region: no-drag; -webkit-app-region: no-drag;
}
.saa-tb-search > span { flex: 1; min-width: 0; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.saa-tb-search svg { flex: none; width: 14px; height: 14px; }
.saa-tb-search kbd { flex: none; font: var(--fs-1) var(--font-mono); color: var(--text-3); }
.saa-tb-search:hover { border-color: var(--border-strong); color: var(--text-2); }
.saa-tb-search:focus-visible, .saa-tb-state:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.saa-tb-state {
  flex: 1 1 0; min-width: 0; display: flex; justify-content: flex-end; align-items: center; gap: var(--sp-2); padding: 0 var(--sp-2); border: 0; background: transparent;
  color: var(--text-2); font: inherit; font-size: var(--fs-2); white-space: nowrap; cursor: pointer; app-region: no-drag; -webkit-app-region: no-drag;
}
.saa-tb-state > span { overflow: hidden; text-overflow: ellipsis; }
.saa-tb-state > i { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--rule); }
.saa-tb-state[data-sev="ok"] > i { background: var(--saa-ok); }
.saa-tb-state[data-sev="error"] > i { background: var(--err); }
/* the page and the shell under the bar */
.saa-has-titlebar body { padding-top: var(--saa-tb-h); }
.saa-has-titlebar .saa-side { top: var(--saa-tb-h); height: calc(100vh - var(--saa-tb-h)); }
.saa-has-titlebar .saa-shell { min-height: calc(100vh - var(--saa-tb-h)); }
.saa-has-titlebar .saa-shell .topbar { top: var(--saa-tb-h); }

/* ===================== the frame ===================== */
.saa-shell { display: grid; grid-template-columns: var(--saa-side) minmax(0, 1fr); min-height: 100vh; }
.saa-main { min-width: 0; display: flex; flex-direction: column; }
.saa-view { flex: 1; min-width: 0; }
.saa-analysis { display: block; }
.saa-mode-shell body { min-width: 0; }

/* ---------- side bar ---------- */
.saa-side {
  position: sticky; top: 0; height: 100vh; min-width: 0;
  display: flex; flex-direction: column; gap: 2px;
  padding: 14px 10px 10px; overflow-y: auto; scrollbar-width: thin;
  background: var(--surface); border-right: 1px solid var(--border);
}
.saa-side .brand { padding: 2px 6px 14px; align-items: flex-start; }
.saa-side .brand .mark { margin-top: 1px; }
.saa-side .brand-name { font-size: var(--fs-4); gap: 3px 6px; }
.saa-side .brand-sub { margin-top: 5px; letter-spacing: .1em; }
.saa-nav { display: flex; flex-direction: column; gap: 2px; }
.saa-nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 36px; padding: 0 10px;
  border: 0; border-radius: var(--r-card); background: transparent; color: var(--text-2);
  font-size: var(--fs-3); font-weight: var(--fw-regular); text-align: left; cursor: pointer;
}
.saa-nav-item svg { flex: none; width: 16px; height: 16px; }
.saa-nav-item:hover { background: var(--surface-2); color: var(--text); }
.saa-nav-item.on { background: var(--accent-wash-2); color: var(--accent-strong); font-weight: var(--fw-strong); }
.saa-sec {
  display: flex; align-items: center; min-height: 26px; margin-top: 16px; padding: 0 4px 0 10px;
  color: var(--text-3); font-size: var(--fs-2); font-weight: var(--fw-strong); letter-spacing: .08em;
}
.saa-sec > span { flex: 1; }
.saa-mini {
  flex: none; display: grid; place-items: center; width: 26px; height: 26px; padding: 0;
  border: 0; border-radius: var(--r-ctl); background: transparent; color: var(--text-3); cursor: pointer;
}
.saa-mini svg { width: 15px; height: 15px; }
.saa-mini:hover { background: var(--border); color: var(--text); }
.saa-mini[hidden] { display: none; }
/* the page's switch of the datasets' names (file name | name in the file), under the list as in its own side bar */
.saa-dsnames { padding: 6px 4px 2px 10px; font-size: var(--fs-2); color: var(--text-3); }
.saa-dsnames:has(> .ds-names[hidden]) { display: none; }
.saa-side-foot { margin-top: auto; padding-top: 12px; display: flex; flex-direction: column; gap: 2px; border-top: 1px solid var(--border); }
.saa-side-note { margin: 0 4px 6px; padding: 7px 10px; font-size: var(--fs-2); line-height: 1.45; }
.saa-shell[data-offline="1"] .saa-readers, .saa-shell[data-offline="1"] .saa-title span { opacity: .45; }
/* the runs that ended more than a week ago and were not opened since: folded away, one line brings them back */
.saa-side .ds-tabs:not(.saa-show-older) .ds-tab[data-folded] { display: none; }
.saa-older {
  align-self: flex-start; margin: 2px 0 0 6px; padding: 3px 6px; border: 0; border-radius: var(--r-ctl); background: transparent;
  color: var(--accent); font-size: var(--fs-2); cursor: pointer; text-align: left;
}
.saa-older:hover { background: var(--accent-wash); }

/* an instrument in the side bar */
.saa-readers { display: flex; flex-direction: column; gap: 2px; }
.saa-reader { display: flex; align-items: center; gap: 2px; border-radius: var(--r-card); }
.saa-reader:hover { background: var(--surface-2); }
.saa-reader-main {
  flex: 1; min-width: 0; display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 0 10px;
  padding: 7px 4px 7px 8px; border: 0; background: transparent; color: inherit; text-align: left; cursor: pointer; border-radius: var(--r-card);
}
.saa-reader-text { min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.saa-reader-text b { font-size: var(--fs-3); font-weight: var(--fw-strong); }
.saa-reader-text span { font-size: var(--fs-2); color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.saa-reader .saa-bar { grid-column: 2; height: 3px; margin-top: 5px; }

/* the badge of an instrument, coloured by what it is doing */
.saa-badge {
  flex: none; display: grid; place-items: center; width: 24px; height: 24px; border-radius: var(--r-ctl);
  background: var(--surface-2); border: 1px solid var(--border-strong); color: var(--text-2);
  font: var(--fw-strong) var(--fs-2)/1 var(--font-mono);
}
[data-s="measuring"] > .saa-badge, [data-s="measuring"] .saa-reader-main > .saa-badge, [data-s="measuring"] .saa-tile-head > .saa-badge { background: var(--saa-ok); border-color: var(--saa-ok); color: var(--accent-ink); }
[data-s="finished"] > .saa-badge, [data-s="finished"] .saa-reader-main > .saa-badge, [data-s="finished"] .saa-tile-head > .saa-badge { background: var(--saa-done); border-color: var(--saa-done); color: var(--accent-ink); }
[data-s="unreadable"] > .saa-badge, [data-s="unreadable"] .saa-reader-main > .saa-badge, [data-s="unreadable"] .saa-tile-head > .saa-badge { background: var(--warn); border-color: var(--warn); color: var(--accent-ink); }
.saa-bar { display: block; height: 6px; border-radius: var(--r-pill); background: var(--border); overflow: hidden; }
.saa-bar > i { display: block; height: 100%; min-width: 3px; border-radius: var(--r-pill); background: var(--accent); transition: width var(--dur-slow) var(--ease); }
[data-s="finished"] .saa-bar > i { background: var(--saa-done); }
[data-early="1"] .saa-bar > i { background: var(--warn); }

/* the page's dataset tabs, as a list */
.saa-side .ds-tabs { flex: 0 1 auto; order: 0; flex-direction: column; gap: 2px; overflow: visible; padding: 0; }
.saa-side .ds-tabs:empty::after { content: attr(data-empty); padding: 4px 10px; color: var(--text-3); font-size: var(--fs-2); }
.saa-side .ds-tab, .saa-side .ds-tabs.measure .ds-tab {
  flex: none; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 0;
  height: auto; min-width: 0; max-width: none; padding: 7px 4px 7px 12px;
  border-color: transparent; background: transparent; position: relative;
}
.saa-side .ds-tab:hover { background: var(--surface-2); border-color: transparent; }
.saa-side .ds-tab.on { background: var(--accent-wash-2); border-color: transparent; }
/* every child of the page's tab has its place here: the notes button, the name, what it is, the close button */
.saa-side .ds-tab .nb { grid-column: 1; grid-row: 1; align-self: start; margin: 0 4px 0 -4px; }
.saa-side .ds-tab .nm { grid-column: 2; grid-row: 1; white-space: normal; overflow-wrap: anywhere; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.saa-side .ds-tab.on .nm { color: var(--accent-strong); font-weight: var(--fw-strong); }
.saa-side .ds-tab .meta, .saa-side .ds-tabs.tight .ds-tab .meta { grid-column: 2; grid-row: 2; display: block; margin-top: 2px; font-size: var(--fs-1); }
.saa-side .ds-tab .demo, .saa-side .ds-tabs.tight .ds-tab .demo { grid-column: 2; grid-row: 3; display: inline-block; justify-self: start; margin-top: 3px; }
.saa-side .ds-tab .x { grid-column: 3; grid-row: 1 / span 2; margin-left: 4px; opacity: 0; }
.saa-side .ds-tab:hover .x, .saa-side .ds-tab.on .x, .saa-side .ds-tab .x:focus-visible { opacity: 1; }
.saa-side .ds-tab input { grid-column: 2; grid-row: 1; width: 100% !important; }
/* the menu button of the dataset in front (splice, rename): under its close button */
.saa-side .ds-tab .mb { grid-column: 3; grid-row: 2; margin: 2px 0 0 4px; }
.saa-side .ds-tab .mb ~ .x { grid-row: 1; }
/* a run of an instrument: its badge in front; coloured while it is being measured */
.saa-side .ds-tab[data-reader] { padding-left: 36px; }
.saa-side .ds-tab[data-reader]::before {
  content: attr(data-reader); position: absolute; left: 11px; top: 8px; width: 18px; height: 18px; border-radius: var(--r-ctl);
  display: grid; place-items: center; background: var(--surface); border: 1px solid var(--border-strong); color: var(--text-2);
  font: var(--fw-strong) var(--fs-1)/1 var(--font-mono);
}
.saa-side .ds-tab[data-live]::before { background: var(--saa-ok); border-color: var(--saa-ok); color: var(--accent-ink); }
/* a row is moved by its grip at the left edge (shown on hover), as in the page's own side bar */
.saa-side .ds-tab .grip {
  position: absolute; left: 0; top: 4px; bottom: 4px; width: 10px; display: grid; place-items: center;
  color: var(--text-3); cursor: grab; opacity: 0; touch-action: none; border-radius: var(--r-ctl);
}
.saa-side .ds-tab .grip svg { width: 6px; height: 12px; }
.saa-side .ds-tab:hover .grip, .saa-side .ds-tab:focus-within .grip, .saa-side .ds-tab.on .grip { opacity: .75; }
.saa-side .ds-tab .grip:hover { background: var(--border); opacity: 1; }
.saa-side .ds-tabs.dragging, .saa-side .ds-tabs.dragging .ds-tab, .saa-side .ds-tabs.dragging .grip { cursor: grabbing; }
.saa-side .ds-tab.dragging { opacity: .45; }
.saa-side .ds-tab.drop-before { box-shadow: inset 0 2px 0 var(--accent); }
.saa-side .ds-tab.drop-after { box-shadow: inset 0 -2px 0 var(--accent); }

/* ---------- top bar: the title of the view, then the page's own actions ---------- */
.saa-shell .topbar { height: 56px; min-height: 56px; padding: 0 18px; gap: var(--sp-4); flex-wrap: nowrap; }
.saa-shell .top-actions { flex: none; flex-wrap: nowrap; }
.saa-title { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: var(--sp-3); }
.saa-title h1 { margin: 0; font-size: var(--fs-5); font-weight: var(--fw-strong); letter-spacing: .01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-wrap: nowrap; }
.saa-title h1 { flex: 0 1 auto; min-width: 0; }
.saa-title span { flex: 1 1 0; min-width: 0; color: var(--text-3); font-size: var(--fs-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* undo, save and export belong to the dataset of the analysis view */
.saa-shell:not([data-view="analysis"]) :is(#btnUndo, #btnRedo, #btnSave, #btnSaveMore, #btnExport, #btnSettings, .top-sep) { display: none; }
/* the page's first-use tour (its card at the bottom right) is about the analysis view: shown only there - hidden in the
   other views of the shell, and there again, where it was, on the way back (closed, it stays closed) */
:root[data-saa-view]:not([data-saa-view="analysis"]) .pk-tour { display: none !important; }

/* ---------- the analysis view: the page's cards ---------- */
.saa-shell .workspace { grid-template-columns: clamp(420px, 45%, 700px) minmax(0, 1fr); gap: var(--sp-4); padding: 16px 18px 24px; }
.saa-shell .col { gap: var(--sp-4); }
.saa-shell .notice { margin: 14px 18px 0; }
.saa-shell .card { border-radius: var(--r-card); box-shadow: var(--saa-shadow); }
.saa-shell .card-head h2 { font-size: var(--fs-4); }
/* the analysis settings: a strip across the top, shown with the page's own button in the top bar */
.saa-shell .workspace > #settingsCard { grid-column: 1 / -1; scroll-margin-top: 72px; }
.saa-shell #settingsCard .settings { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px 24px; }
@media (max-width: 1240px) {
  .saa-shell .workspace { grid-template-columns: minmax(0, 1fr); }
  .saa-shell #settingsCard .settings { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------- the experiment above its analysis: status, operator, Save ---------- */
.saa-exp {
  display: flex; align-items: center; flex-wrap: wrap; gap: var(--sp-2) var(--sp-3); margin: 14px 18px 0; padding: 8px 10px 8px 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card); box-shadow: var(--saa-shadow); font-size: var(--fs-3);
}
.saa-exp-state {
  flex: none; display: inline-flex; align-items: center; gap: 7px; min-height: 24px; padding: 0 10px 0 8px; border-radius: var(--r-pill);
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); font-weight: var(--fw-regular);
}
.saa-exp-state::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--rule); }
.saa-exp-state[data-status="measuring"]::before { background: var(--saa-ok); }
.saa-exp-state[data-status="completed"]::before { background: var(--saa-done); }
.saa-exp-state[data-status="stopped"], .saa-exp-state[data-status="unknown"] { color: var(--warn); }
.saa-exp-state[data-status="stopped"]::before, .saa-exp-state[data-status="unknown"]::before { background: var(--warn); }
.saa-exp-state[data-status="interrupted"] { color: var(--err); }
.saa-exp-state[data-status="interrupted"]::before { background: var(--err); }
.saa-exp-text { min-width: 0; color: var(--text-2); }
.saa-exp-op { display: inline-flex; align-items: center; gap: 6px; color: var(--text-3); }
.saa-exp-op > svg { width: 14px; height: 14px; }
.saa-exp-label { color: var(--text-3); }
.saa-exp-op .btn { font-weight: var(--fw-strong); color: var(--text); }
.saa-exp-op input[type="text"] { width: 180px; height: var(--fld-h); }
.saa-exp-saved { min-width: 0; color: var(--text-3); }
.saa-exp-saved[data-state="dirty"] { color: var(--warn); font-weight: var(--fw-regular); }
.saa-exp-saved[data-state="error"] { color: var(--err); font-weight: var(--fw-regular); }
/* where the annotation stands: the same as the instrument's (green), being saved (grey), changed only on this device
   (orange), newer on the instrument (blue) */
.saa-sync {
  flex: 0 1 auto; min-width: 0; max-width: 100%; display: inline-flex; align-items: center; gap: 6px; min-height: 24px; padding: 0 10px 0 8px;
  border-radius: var(--r-pill); background: var(--surface-2); color: var(--text-3); font-weight: var(--fw-strong); white-space: nowrap;
}
.saa-sync::before { content: ""; flex: none; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.saa-sync > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.saa-sync[data-sync="same"] { color: color-mix(in srgb, var(--ok) 62%, var(--text)); background: color-mix(in srgb, var(--ok) 14%, transparent); }
.saa-sync[data-sync="local"] { color: var(--warn); background: var(--warn-wash); }
.saa-sync[data-sync="newer"] { color: color-mix(in srgb, var(--info) 80%, var(--text)); background: color-mix(in srgb, var(--info) 13%, transparent); }
.saa-sync[data-sync="saving"]::before { animation: saa-blink 1.2s ease-in-out infinite; }
@keyframes saa-blink { 50% { opacity: .25; } }
:root[data-motion="reduce"] .saa-sync[data-sync="saving"]::before { animation: none; }

/* ---------- how a run was set up ("Protocol details"): collapsed, above its analysis and on its tile ---------- */
.saa-pd > summary { cursor: pointer; color: var(--text-2); font-weight: var(--fw-regular); width: max-content; max-width: 100%; }
.saa-pd > summary:hover { color: var(--text); }
.saa-pd-body { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr)); gap: 10px 28px; }
.saa-pd-sec { min-width: 0; }
.saa-pd-sec h4 { margin: 0 0 5px; color: var(--text-3); font-size: var(--fs-2); font-weight: var(--fw-strong); }
.saa-pd-sec dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 3px 14px; margin: 0; }
.saa-pd-sec dt { color: var(--text-3); }
.saa-pd-sec dd { margin: 0; color: var(--text); overflow-wrap: anywhere; }
.saa-pd-sec:has(.saa-pd-steps) { grid-column: 1 / -1; }
.saa-pd-steps p { margin: 0 0 3px; color: var(--text); overflow-wrap: anywhere; }
.saa-pd-steps .saa-pd-ramp { color: var(--text-3); }
.saa-pd-none { margin: 0; color: var(--text-3); }
.saa-pd-card {
  margin: 8px 18px 0; padding: 0 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card);
  box-shadow: var(--saa-shadow); font-size: var(--fs-3);
}
.saa-pd-card > summary { padding: 8px 0; }
.saa-pd-card[open] > summary { border-bottom: 1px solid var(--border); margin-bottom: 10px; }
.saa-pd-card > .saa-pd-body { padding-bottom: 12px; }
.saa-pd-tile { font-size: var(--fs-2); }
.saa-pd-tile > summary { color: var(--text-3); }
.saa-pd-tile > .saa-pd-body { grid-template-columns: minmax(0, 1fr); gap: var(--sp-2); padding: 8px 0 2px; }

/* ===================== the overview ===================== */
.saa-overview { padding: 18px; display: flex; flex-direction: column; gap: 18px; }
.saa-note { padding: 10px 14px; border: 1px solid var(--border); border-left: 3px solid var(--warn); border-radius: var(--r-card); background: var(--warn-wash); color: var(--text-2); }
/* grey tiles until the program has said which instruments it has */
.saa-tile-skel { min-height: 260px; justify-content: center; }
.saa-note-acts { margin-top: -6px; }
.saa-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr)); gap: var(--sp-4); align-items: stretch; }
.saa-tile {
  min-width: 0; display: flex; flex-direction: column; gap: 14px; padding: 16px 18px 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card); box-shadow: var(--saa-shadow);
  container-type: inline-size;
}
.saa-tile.flash { animation: saa-flash 1.1s var(--ease); }
@keyframes saa-flash { 0%, 55% { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-wash-2); } }
.saa-tile-head { display: flex; align-items: center; gap: var(--sp-3); }
.saa-tile-head > .saa-badge { width: 34px; height: 34px; border-radius: var(--r-card); font-size: var(--fs-5); }
.saa-tile-name { flex: 1; min-width: 0; display: flex; align-items: center; gap: var(--sp-3); line-height: 1.3; }
.saa-tile-head .saa-tile-name { flex-direction: column; align-items: flex-start; gap: 0; }
.saa-tile-name > div { min-width: 0; display: flex; flex-direction: column; }
.saa-tile-name b { font-size: var(--fs-5); font-weight: var(--fw-strong); }
.saa-tile-name span:not(.saa-badge) { color: var(--text-3); font: var(--fs-2) var(--font-mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.saa-tile-side { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: var(--sp-1); }
.saa-temp { color: var(--text-3); font: var(--fs-2) var(--font-mono); white-space: nowrap; }
.saa-state {
  flex: none; display: inline-flex; align-items: center; gap: 7px; min-height: 26px; padding: 0 11px 0 9px; border-radius: var(--r-pill);
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); font-size: var(--fs-3); font-weight: var(--fw-regular);
}
.saa-state::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--rule); }
[data-s="measuring"] .saa-state { color: var(--text); }
[data-s="measuring"] .saa-state::before { background: var(--saa-ok); animation: saa-pulse 1.8s ease-in-out infinite; }
[data-s="finished"] .saa-state::before { background: var(--saa-done); }
[data-early="1"] .saa-state { color: var(--warn); }
[data-early="1"] .saa-state::before { background: var(--warn); }
[data-s="unreadable"] .saa-state { background: var(--warn-wash); color: var(--warn); border-color: transparent; }
[data-s="unreadable"] .saa-state::before { background: var(--warn); }
@keyframes saa-pulse { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--saa-ok) 55%, transparent); } 60% { box-shadow: 0 0 0 6px transparent; } }
:root[data-motion="reduce"] [data-s="measuring"] .saa-state::before, :root[data-motion="reduce"] .saa-tile.flash { animation: none; }
:root[data-motion="reduce"] .saa-bar > i { transition: none; }

.saa-run { display: flex; flex-direction: column; gap: 7px; }
.saa-proto { display: flex; align-items: center; gap: 10px; min-width: 0; min-height: 24px; }
.saa-proto b { font-size: var(--fs-4); font-weight: var(--fw-strong); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.saa-proto > span { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-3); font: var(--fs-2) var(--font-mono); }
.saa-progress { display: flex; align-items: baseline; gap: 10px; margin-top: 3px; }
.saa-progress b { font-size: var(--fs-3); font-weight: var(--fw-strong); font-variant-numeric: tabular-nums; }
.saa-progress span { color: var(--text-2); font-size: var(--fs-3); font-variant-numeric: tabular-nums; }
/* looking back in a run: a dot on the progress bar of a tile (view only; at the right end it is live again) */
.saa-tile .saa-bar.look { position: relative; overflow: visible; cursor: ew-resize; touch-action: pan-y; }
.saa-tile .saa-bar.look::before { content: ''; position: absolute; left: 0; right: 0; top: -9px; bottom: -9px; }
.saa-knob { position: absolute; top: 50%; width: 13px; height: 13px; margin: -6.5px 0 0 -6.5px; border-radius: 50%; box-sizing: border-box; background: var(--surface); border: 2px solid var(--accent); box-shadow: var(--elev-1); cursor: ew-resize; }
/* (the dot is drawn 13 px wide; it is grabbed in 25 px: a target of at least 24 x 24) */
.saa-knob::before { content: ""; position: absolute; inset: -6px; border-radius: 50%; }
.saa-knob:focus { outline: none; }
.saa-knob:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.saa-progress span.look { color: var(--accent); font-weight: var(--fw-strong); }
.saa-times { color: var(--text-3); font-size: var(--fs-2); }
/* when the run is expected to end: what one looks for first, on a line of its own */
.saa-eta { color: var(--text); font-size: var(--fs-3); font-weight: var(--fw-strong); font-variant-numeric: tabular-nums; }
.saa-off p { color: var(--text-2); }
.saa-op { display: flex; align-items: center; gap: 6px; color: var(--text-2); font-size: var(--fs-2); }
.saa-op svg { flex: none; width: 13px; height: 13px; color: var(--text-3); }
.saa-warn { color: var(--warn); white-space: pre-line; }      /* one line for each thing the tile has to say */
.saa-err { color: var(--err); }

.saa-chart { position: relative; height: 190px; min-height: 0; border-radius: var(--r-card); }
.saa-chart.none { height: 120px; background: var(--surface-2); border: 1px dashed var(--border-strong); }
.saa-chart-hit { display: block; width: 100%; height: 100%; padding: 0; border: 0; border-radius: var(--r-card); background: transparent; cursor: pointer; }
.saa-chart-hit:hover { background: var(--accent-wash); }
.saa-chart.none .saa-chart-hit { display: none; }
.saa-chart canvas { display: block; width: 100%; height: 100%; }
.saa-chart-empty { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 12px; color: var(--text-3); text-align: center; }
.saa-channels { flex: none; margin-left: auto; }

.saa-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.saa-stat { min-width: 0; display: flex; flex-direction: column; gap: 1px; padding: 9px 12px 8px; border-radius: var(--r-card); background: var(--surface-2); }
.saa-stat > span { color: var(--text-3); font-size: var(--fs-2); }
.saa-stat > b { font-size: var(--fs-6); font-weight: var(--fw-strong); line-height: 1.25; font-variant-numeric: tabular-nums; white-space: nowrap; }
.saa-stat > em { color: var(--text-3); font-size: var(--fs-2); font-style: normal; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.saa-stat.pos.some > b { color: var(--pos); }
.saa-stat > em:empty { display: none; }

.saa-detail { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--sp-4); align-items: start; }
.saa-plate { display: flex; flex-direction: column; gap: 6px; min-width: 0; width: 184px; }
.saa-plate canvas { display: block; }
.saa-legend { display: flex; gap: 10px; color: var(--text-3); font-size: var(--fs-1); white-space: nowrap; }
.saa-legend span::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 4px; border-radius: 2px; background: var(--rule); opacity: .55; }
.saa-legend .p::before { background: radial-gradient(circle, var(--surface) 0 1.4px, var(--pos) 1.8px); opacity: 1; }      /* the dot of a positive well, as on the plate */
.saa-legend .e::before { background: transparent; border: 1px solid var(--border-strong); opacity: 1; }
.saa-samples { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.saa-samples p { margin: 0; line-height: 1.55; }
.saa-samples-head { display: flex; justify-content: space-between; gap: var(--sp-2); margin-bottom: 3px; color: var(--text-3); font-size: var(--fs-2); }
:lang(zh) .saa-samples-head { white-space: nowrap; }      /* short in Chinese: one line; the English may wrap */
.saa-sample { display: grid; grid-template-columns: auto minmax(0, 1fr) auto 34px; align-items: center; gap: 7px; min-height: 22px; font-size: var(--fs-3); }
.saa-sample > i { width: 9px; height: 9px; border-radius: 3px; background: var(--rule); }
.saa-sample > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.saa-sample > b { font: var(--fw-regular) var(--fs-2) var(--font-mono); color: var(--pos); }
.saa-sample > em { font: var(--fs-2) var(--font-mono); font-style: normal; color: var(--text-3); text-align: right; }

.saa-idle { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--sp-4); padding: 28px 0 2px; text-align: center; }
.saa-idle::before { content: ""; flex: 1; }
.saa-idle p { margin: 0; color: var(--text-2); line-height: 1.6; }
.saa-next { display: flex; align-items: center; gap: var(--sp-2); max-width: 100%; padding: 5px 6px 5px 12px; border-radius: var(--r-card); background: var(--accent-wash); color: var(--text-2); font-size: var(--fs-3); text-align: left; }
.saa-next > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.saa-last { flex: 1; align-self: stretch; display: flex; flex-direction: column; justify-content: flex-end; text-align: left; }
.saa-last > span { padding-top: 12px; border-top: 1px solid var(--border); }
.saa-idle:has(> .saa-last[hidden])::after { content: ""; flex: 1; }
.saa-last > span { color: var(--text-3); font-size: var(--fs-2); }
.saa-last .saa-runrow { border: 0; padding: 6px 0 0; }
.saa-last .saa-runrow > .saa-badge { display: none; }

.saa-live { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; margin-top: -4px; }
.saa-tile-foot { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; margin-top: auto; padding-top: 2px; }
.saa-tile-foot .chk { color: var(--text-3); font-size: var(--fs-2); }

.saa-recent { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card); box-shadow: var(--saa-shadow); }
.saa-recent-head { display: flex; align-items: center; gap: var(--sp-2); min-height: 46px; padding: 6px 12px 6px 18px; border-bottom: 1px solid var(--border); }
.saa-recent-head h2 { margin: 0; font-size: var(--fs-4); font-weight: var(--fw-strong); }
.saa-recent .saa-runs { padding: 2px 18px 6px; }
.saa-runrow { display: flex; align-items: center; gap: var(--sp-3); padding: 9px 0; border-bottom: 1px solid var(--border); }
.saa-runrow:last-child { border-bottom: 0; }
.saa-runrow:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: var(--r-ctl); }
.saa-runrow > div { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: var(--sp-3); flex-wrap: wrap; }
.saa-runrow b { font-weight: var(--fw-strong); }
/* the online view: an experiment's two files to download (.pkd and Excel); a narrow row puts them under its name */
.saa-dl, .saa-exp-dl { flex: none; display: inline-flex; align-items: center; gap: 6px; }
.saa-dl .btn > svg { width: 13px; height: 13px; }
.saa-runrow:has(> .saa-dl) { flex-wrap: wrap; row-gap: 6px; }
.saa-runrow:has(> .saa-dl) > div { flex-basis: 180px; }

/* the overview above a page that is not recognised */
.saa-mode-classic .saa-overview { border-bottom: 1px solid var(--border); }

.saa-dialog { width: min(500px, 100%); }
.saa-dialog-wide { width: min(720px, 100%); }
.saa-dialog p { margin: 0 0 4px; line-height: 1.6; color: var(--text-2); }
.saa-dialog .saa-runs { display: flex; flex-direction: column; }
.saa-dialog .saa-path { margin-top: 8px; }

/* ===================== banners: the problems of the program, errors first ===================== */
.saa-banners { display: flex; flex-direction: column; }
.saa-banner {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px 8px 18px; border-bottom: 1px solid var(--border);
  font-size: var(--fs-3); font-weight: var(--fw-regular); line-height: 1.45; background: var(--accent-wash); color: var(--text);
}
.saa-banner > svg { flex: none; width: 17px; height: 17px; color: var(--accent); }
.saa-banner > span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.saa-banner[data-sev="warning"] { background: var(--warn-wash); }
.saa-banner[data-sev="warning"] > svg { color: var(--warn); }
.saa-banner[data-sev="error"] { background: var(--err); color: var(--saa-alert-ink); border-bottom-color: transparent; }
.saa-banner[data-sev="error"] > svg { color: currentColor; }
.saa-banner-x { flex: none; display: grid; place-items: center; width: 26px; height: 26px; padding: 0; border: 0; border-radius: var(--r-ctl); background: transparent; color: inherit; cursor: pointer; opacity: .75; }
.saa-banner-x:hover { opacity: 1; background: color-mix(in srgb, currentColor 16%, transparent); }
.saa-banner-x svg { width: 14px; height: 14px; }
.saa-mode-classic .saa-banner { border-radius: var(--r-card); margin: 8px 18px 0; }
/* the notice of an update (the program's window): its buttons at the end of the line, wrapping in little room */
.saa-banner > .saa-banner-acts { flex: none; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; max-width: 100%; }
/* About: what the last check for updates came to, beside its button */
.saa-update-line { align-self: center; }

/* ===================== notifications of the runs: cards at the bottom right ===================== */
.saa-events { position: fixed; right: 18px; bottom: 18px; z-index: 80; display: flex; flex-direction: column; gap: var(--sp-2); width: min(360px, calc(100vw - 32px)); pointer-events: none; }
.saa-event {
  pointer-events: auto; padding: 10px 12px 10px 14px; border: 1px solid var(--border); border-left: 4px solid var(--saa-done); border-radius: var(--r-card);
  background: var(--surface); box-shadow: var(--elev-2); font-size: var(--fs-3); animation: saa-in var(--dur) var(--ease);
}
.saa-event[data-kind="completed"] { border-left-color: var(--saa-ok); }
.saa-event[data-kind="stopped"], .saa-event[data-kind="stuck"] { border-left-color: var(--warn); }
.saa-event[data-kind="interrupted"], .saa-event[data-kind="save-failed"] { border-left-color: var(--err); }
@keyframes saa-in { from { opacity: 0; transform: translateY(8px); } }
:root[data-motion="reduce"] .saa-event { animation: none; }
.saa-event-head { display: flex; align-items: center; gap: var(--sp-2); }
.saa-event-head > svg { flex: none; width: 15px; height: 15px; color: var(--text-3); }
.saa-event-head > b { flex: 1; min-width: 0; font-size: var(--fs-3); font-weight: var(--fw-strong); }
.saa-event-head > span { color: var(--text-3); font: var(--fs-2) var(--font-mono); }
.saa-event-x { flex: none; display: grid; place-items: center; width: 24px; height: 24px; padding: 0; border: 0; border-radius: var(--r-ctl); background: transparent; color: var(--text-3); cursor: pointer; }
.saa-event-x:hover { background: var(--surface-2); color: var(--text); }
.saa-event-x svg { width: 13px; height: 13px; }
.saa-event-name { margin-top: 3px; color: var(--text); font-weight: var(--fw-regular); overflow-wrap: anywhere; }
.saa-event p { margin: 3px 0 0; color: var(--text-2); line-height: 1.5; }
.saa-event-foot { display: flex; justify-content: flex-end; margin-top: 6px; }

/* ===================== messages at the bottom right: a success goes by itself, a failure stays with its × ===================== */
.saa-toast { display: flex; align-items: center; gap: 10px; max-width: min(480px, calc(100vw - 32px)); }
.saa-toast > svg { flex: none; width: 16px; height: 16px; }
.saa-toast-text { flex: 1; min-width: 0; line-height: 1.45; overflow-wrap: anywhere; }
.saa-toast-act { flex: none; color: inherit; }
.saa-toast-x { flex: none; display: grid; place-items: center; width: 24px; height: 24px; padding: 0; border: 0; border-radius: var(--r-ctl); background: transparent; color: inherit; cursor: pointer; opacity: .8; }
.saa-toast-x:hover { opacity: 1; background: color-mix(in srgb, currentColor 14%, transparent); }
.saa-toast-x svg { width: 13px; height: 13px; }
.saa-toast-err { border-left: 3px solid var(--err); }
.saa-toast-err > svg { color: var(--err); }

/* ===================== an empty list says why and leads on; a list being read shows grey rows ===================== */
.saa-empty { display: flex; flex-direction: column; align-items: flex-start; gap: var(--sp-2); padding: var(--sp-4) 0; color: var(--text-2); }
.saa-empty > p { margin: 0; line-height: 1.55; }
.saa-empty .saa-card-actions { margin-top: 0; }
.saa-skel { display: flex; flex-direction: column; gap: 10px; padding: 12px 0; }
.saa-skel-row { display: flex; flex-direction: column; gap: 6px; }
.saa-skel-row > i { display: block; height: 11px; border-radius: var(--r-ctl); background: linear-gradient(90deg, var(--surface-2) 25%, var(--border) 50%, var(--surface-2) 75%); background-size: 300% 100%; animation: saa-shimmer 1.4s ease-in-out infinite; }
.saa-skel-row > i:first-child { width: 46%; }
.saa-skel-row > i:last-child { width: 72%; height: 9px; }
@keyframes saa-shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }

/* ===================== the bell of the notifications and its list ===================== */
.saa-bell { position: relative; flex: none; display: grid; place-items: center; width: var(--ctl-h); height: var(--ctl-h); padding: 0; border: 0; border-radius: var(--r-ctl); background: transparent; color: var(--text-2); cursor: pointer; }
.saa-bell > svg { width: 17px; height: 17px; }
.saa-bell:hover, .saa-bell[aria-expanded="true"] { background: var(--surface-2); color: var(--text); }
.saa-bell:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.saa-bell-n {
  position: absolute; top: 1px; right: 0; display: grid; place-items: center; min-width: 16px; min-height: 16px; padding: 0 4px; border-radius: var(--r-pill);
  background: var(--err); color: var(--saa-alert-ink); font: var(--fw-strong) var(--fs-1)/1 var(--font-sans); text-align: center;
}
.saa-inbox {
  position: fixed; z-index: 86; width: min(400px, calc(100vw - 16px)); max-height: min(70vh, 560px); display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-card); box-shadow: var(--elev-2);
}
.saa-inbox-head { display: flex; align-items: center; gap: 6px; padding: 8px 8px 8px 14px; border-bottom: 1px solid var(--border); }
.saa-inbox-head > h2 { margin: 0; font-size: var(--fs-3); font-weight: var(--fw-strong); }
.saa-inbox-list { overflow: auto; padding: 4px; }
.saa-inbox > .saa-empty { padding: 14px; }
.saa-inbox-item {
  display: grid; grid-template-columns: 18px minmax(0, 1fr) auto; gap: 2px 10px; align-items: start; width: 100%; padding: 8px 10px;
  border: 0; border-radius: var(--r-ctl); background: transparent; color: var(--text); font: inherit; font-size: var(--fs-3); text-align: left;
}
button.saa-inbox-item { cursor: pointer; }
button.saa-inbox-item:hover, button.saa-inbox-item:focus-visible { background: var(--surface-2); outline: none; }
.saa-inbox-item > svg { width: 15px; height: 15px; margin-top: 1px; color: var(--text-3); }
.saa-inbox-item[data-group="completed"] > svg { color: var(--saa-ok); }
.saa-inbox-item[data-group="error"] > svg, .saa-inbox-item[data-group="disconnected"] > svg { color: var(--err); }
.saa-inbox-item[data-group="diskLow"] > svg { color: var(--warn); }
.saa-inbox-item[data-group="updateAvailable"] > svg { color: var(--accent); }
.saa-inbox-item.new { background: var(--accent-wash); }
.saa-inbox-text { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.saa-inbox-text > b { font-weight: var(--fw-strong); }
.saa-inbox-text > span { color: var(--text-2); overflow-wrap: anywhere; }
.saa-inbox-text > em { font-style: normal; color: var(--text-3); overflow-wrap: anywhere; }
.saa-inbox-time { color: var(--text-3); font: var(--fs-1) var(--font-mono); white-space: nowrap; }

:root[data-motion="reduce"] .saa-skel-row > i, :root[data-motion="reduce"] .saa-si.flash { animation: none; }

/* ===================== Experiments, All BMG experiments, layouts: a list with a search box ===================== */
.saa-list { padding: 18px; }
/* (on a wide screen a list keeps to a width that is read at a glance: its name and its buttons stay near) */
.saa-list-card, .saa-recent { max-width: 1440px; }
.saa-list-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card); box-shadow: var(--saa-shadow); }
.saa-list-head { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; min-height: 50px; padding: 8px 12px 8px 18px; border-bottom: 1px solid var(--border); }
.saa-search {
  flex: 0 1 360px; min-width: 0; height: var(--ctl-h); padding: 0 10px; border: 1px solid var(--border-strong); border-radius: var(--r-ctl);
  background: var(--surface); color: var(--text); font-size: var(--fs-3);
}
.saa-search::placeholder { color: var(--text-3); }
.saa-filters { display: flex; flex-wrap: wrap; gap: 6px 8px; padding: 8px 18px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.saa-select { height: var(--fld-h); max-width: 260px; font-size: var(--fs-3); }
.saa-compat { margin: 0; padding: 9px 18px; border-bottom: 1px solid var(--border); line-height: 1.5; }
.saa-list .saa-runs { padding: 2px 18px 6px; }
.saa-list .saa-runs > p { margin: 14px 0; }
.saa-runrow > .saa-file { flex-direction: column; align-items: flex-start; gap: 2px; }
.saa-file > b { overflow-wrap: anywhere; }
.saa-tag { display: inline-block; margin-left: 8px; padding: 0 6px; border: 1px solid var(--border-strong); border-radius: var(--r-pill); font-size: var(--fs-1); font-weight: var(--fw-regular); line-height: 16px; color: var(--text-2); vertical-align: 1px; }
.saa-why { color: var(--warn); font-size: var(--fs-2); }
.saa-exprow.bad > .saa-file > b { color: var(--text-2); }
.saa-list-foot { margin: 0; padding: 4px 18px 12px; }
.saa-path { padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--r-ctl); background: var(--surface-2); font: var(--fs-2)/1.5 var(--font-mono); overflow-wrap: anywhere; user-select: all; }
.saa-removed { border-top: 1px solid var(--border); }
.saa-archived > summary { color: var(--text-2); }
.saa-recent-log > pre { max-height: 220px; overflow: auto; margin: var(--sp-2) 0 0; white-space: pre-wrap; font-size: var(--fs-1); }
.saa-recent-log > summary { cursor: pointer; color: var(--text-2); }
.saa-removed > summary { padding: 11px 18px; color: var(--text-2); font-size: var(--fs-3); cursor: pointer; }
.saa-removed > summary:hover { color: var(--text); }
.saa-removed[open] > summary { border-bottom: 1px solid var(--border); }
.saa-menu {
  position: fixed; z-index: 85; min-width: 210px; padding: 4px; display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-card); box-shadow: var(--elev-2);
}
.saa-menu button { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4); width: 100%; padding: 7px 12px; border: 0; border-radius: var(--r-ctl); background: transparent; color: var(--text); font-size: var(--fs-3); text-align: left; cursor: pointer; }
.saa-menu button:hover:not(:disabled), .saa-menu button:focus-visible { background: var(--surface-2); outline: none; }
.saa-menu-key { color: var(--text-3); font: var(--fs-1) var(--font-mono); background: none; border: 0; padding: 0; }
.saa-menu button:disabled { color: var(--text-3); opacity: .55; cursor: default; }

/* ---------- plate layouts ---------- */
.saa-lay-intro { flex: 1 1 320px; margin: 0; line-height: 1.5; }
.saa-next-use { color: var(--accent-strong); font-size: var(--fs-2); }

/* ===================== Settings and About: cards ===================== */
.saa-settings { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(440px, 100%), 1fr)); gap: var(--sp-4); align-items: start; }
/* the settings view (the page's settings center is put into it; without one the shell draws the program's sections
   the same way): the sections on the left with a search, the items of one section on the right - each with its
   description, its control, a dot and "Default" where it differs from its default, and why it cannot be changed now */
.saa-settings-view { padding: var(--sp-4) var(--sp-5); }
.saa-sc { display: grid; grid-template-columns: 236px minmax(0, 1fr); gap: var(--sp-5); align-items: start; max-width: 1180px; }
.saa-sc-side { position: sticky; top: var(--sp-4); display: flex; flex-direction: column; gap: var(--sp-2); }
.saa-set-search { width: 100%; min-width: 0; height: var(--fld-h); }
.saa-sc-nav { display: flex; flex-direction: column; gap: 2px; }
.saa-sc-tab {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 34px; padding: 0 10px; border: 0; border-radius: var(--r-ctl);
  background: transparent; color: var(--text-2); font: inherit; font-size: var(--fs-3); text-align: left; cursor: pointer;
  transition: background var(--dur-fast) var(--ease);
}
.saa-sc-tab > svg { flex: none; width: 16px; height: 16px; }
.saa-sc-tab:hover { background: var(--surface-2); color: var(--text); }
.saa-sc-tab.on { background: var(--accent-wash-2); color: var(--accent-strong); font-weight: var(--fw-strong); }
.saa-sc-main { min-width: 0; display: flex; flex-direction: column; gap: var(--sp-4); }
.saa-sc-sec { padding: var(--sp-3) var(--sp-5) var(--sp-4); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card); box-shadow: var(--saa-shadow); }
.saa-sc-sec > h2 { margin: 4px 0 2px; font-size: var(--fs-5); font-weight: var(--fw-strong); }
.saa-sc-note { margin: 0 0 6px; line-height: 1.5; }
.saa-sc-own { min-width: 0; }
.saa-set-none { margin: 0; padding: var(--sp-4); }
/* an item: its words on the left, its control on the right; a line between items */
.saa-si { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 6px var(--sp-4); padding: 12px 0; border-top: 1px solid var(--border); scroll-margin: 80px; }
.saa-si:first-of-type { border-top: 0; }
/* a wide control (the table of the notifications): under the words, the whole width */
.saa-si.wide { grid-template-columns: minmax(0, 1fr) auto; }
.saa-si.wide > .saa-si-control { grid-column: 1 / -1; grid-row: 2; justify-content: flex-start; }
.saa-si[hidden] { display: none; }
.saa-si-text { min-width: 0; }
.saa-si-text > .hint { margin: 2px 0 0; line-height: 1.5; }
.saa-si-label { display: flex; align-items: center; gap: var(--sp-2); font-weight: var(--fw-regular); color: var(--text); }
.saa-si-why { margin: 3px 0 0; color: var(--warn); font-size: var(--fs-2); }
.saa-si.off .saa-si-label { color: var(--text-2); }
.saa-si-control { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: var(--sp-2); min-width: 0; }
.saa-si-control input[type="text"] { width: min(320px, 100%); }
.saa-si-control select { max-width: 320px; }
.saa-si.flash { animation: saa-flash-row 1.2s var(--ease); }
@keyframes saa-flash-row { 0%, 50% { background: var(--accent-wash-2); } }
.saa-set-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.saa-set-reset { min-height: 24px; min-width: 24px; }
/* a switch: the checkbox behind it does the work (keyboard, screen readers) */
.saa-switch { position: relative; display: inline-flex; width: 40px; height: 22px; flex: none; cursor: pointer; }
.saa-switch > input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: inherit; }
.saa-switch > span { position: absolute; inset: 0; border-radius: var(--r-pill); background: var(--surface-2); border: 1px solid var(--rule); transition: background var(--dur-fast) var(--ease); pointer-events: none; }
.saa-switch > span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: var(--text-2); transition: transform var(--dur-fast) var(--ease); }
.saa-switch > input:checked + span { background: var(--accent); border-color: var(--accent); }
.saa-switch > input:checked + span::after { transform: translateX(18px); background: var(--accent-ink); }
.saa-switch > input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.saa-switch > input:disabled + span { opacity: .45; }
/* the program's own rows in a section: an instrument with its controls, a block with a title */
.saa-set-inst { padding: 12px 0 6px; border-top: 1px solid var(--border); }
.saa-set-inst-head { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.saa-set-inst-head > b { font-size: var(--fs-3); }
.saa-set-row { display: grid; grid-template-columns: 190px minmax(0, 1fr); align-items: center; gap: var(--sp-1) var(--sp-3); padding: 5px 0 5px 34px; }
.saa-set-row > .hint { grid-column: 2; }
.saa-set-row-label { color: var(--text-2); }
.saa-set-row-control { display: flex; align-items: center; gap: var(--sp-2); min-width: 0; }
.saa-set-row-control input[type="text"] { flex: 1 1 auto; max-width: 360px; }
.saa-set-block { padding: 12px 0 4px; border-top: 1px solid var(--border); }
.saa-set-block > h3 { margin: 0 0 6px; font-size: var(--fs-3); font-weight: var(--fw-strong); }
.saa-set-block > p { margin: 4px 0; line-height: 1.5; }
.saa-set-block.saa-note { margin-top: 8px; border-top: 0; }
.saa-times-row input[type="time"] { width: auto; }
.saa-svc[data-svc="running"] { color: color-mix(in srgb, var(--ok) 62%, var(--text)); }
.saa-svc[data-svc="stopped"], .saa-svc[data-svc="none"] { color: var(--warn); }
.saa-ok { color: color-mix(in srgb, var(--ok) 62%, var(--text)); }
/* the notifications: a row per kind of event, a tick each for the window, Windows and the sound */
.saa-ntable { display: grid; grid-template-columns: minmax(0, 1fr) repeat(3, 92px); border: 1px solid var(--border); border-radius: var(--r-card); overflow: hidden; }
.saa-ntable-row { display: contents; }
.saa-ntable-row > span { display: flex; align-items: center; justify-content: center; min-height: 40px; padding: 6px 10px; border-top: 1px solid var(--border); }
.saa-ntable-row > span:first-child { flex-direction: column; align-items: flex-start; justify-content: center; gap: 1px; }
.saa-ntable-row > span:first-child em { font-style: normal; }
.saa-ntable-head > span { min-height: 32px; border-top: 0; background: var(--surface-2); color: var(--text-3); font-size: var(--fs-2); font-weight: var(--fw-strong); text-align: center; }
.saa-ntable-row input[type="checkbox"] { width: 16px; height: 16px; margin: 0; }
.saa-ntable-row:not(.saa-ntable-head):hover > span { background: var(--surface-2); }
.saa-ntable-row[hidden] { display: none; }
/* moving the experiments: what the check of the new place said, the progress */
.saa-move-check { margin-top: 8px; }
.saa-move-check p { margin: 2px 0; }
.saa-move-progress { margin-top: 10px; }
.saa-move-progress .saa-bar { height: 8px; }
.saa-move-progress p { margin: 6px 0 0; }
@media (max-width: 860px) {
  .saa-sc { grid-template-columns: minmax(0, 1fr); }
  .saa-sc-side { position: static; }
  .saa-sc-nav { flex-direction: row; flex-wrap: wrap; }
  .saa-sc-tab { width: auto; }
  .saa-si { grid-template-columns: minmax(0, 1fr); }
  .saa-si-control { justify-content: flex-start; }
  .saa-set-row { grid-template-columns: minmax(0, 1fr); padding-left: 0; }
  .saa-ntable { grid-template-columns: minmax(0, 1fr) repeat(3, 64px); }
}
.saa-card { min-width: 0; padding: 14px 18px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card); box-shadow: var(--saa-shadow); }
.saa-card > h2 { margin: 0 0 8px; font-size: var(--fs-4); font-weight: var(--fw-strong); }
.saa-card > p { margin: 6px 0; line-height: 1.55; color: var(--text-2); }
.saa-card-actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-top: 12px; }
.saa-field { display: grid; grid-template-columns: 140px minmax(0, 1fr); align-items: center; gap: 10px; margin: 8px 0; }
.saa-field > span:first-child { color: var(--text-2); font-size: var(--fs-3); }
.saa-field input[type="text"], .saa-field select { width: 100%; min-width: 0; }
.saa-field-row { display: flex; gap: var(--sp-2); min-width: 0; }
.saa-field-row > input[type="text"] { flex: 1 1 auto; }
.saa-field-row > select { flex: 0 1 200px; width: auto; }
.saa-dialog .saa-field { grid-template-columns: 120px minmax(0, 1fr); }
.saa-wide-input { width: 100%; }
/* the automatic backup: the days field, the list of the backup's experiments */
.saa-num { width: 90px; }
/* About: what changed, by version */
.saa-history { max-height: 360px; overflow: auto; }
.saa-history h3 { margin: 10px 0 4px; font-size: var(--fs-3); font-weight: var(--fw-strong); }
.saa-history h3:first-child { margin-top: 0; }
.saa-history ul { margin: 0; }
.saa-backup-list { display: flex; flex-direction: column; gap: var(--sp-1); max-height: min(60vh, 520px); overflow: auto; margin-top: 8px; }
.saa-backup-row { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); padding: 6px 8px; border: 1px solid var(--border); border-radius: var(--r-card); }
.saa-backup-name { display: flex; flex-direction: column; min-width: 0; gap: 2px; }
.saa-backup-name > b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* the restore: a list of ticks, the experiments that are here greyed (never replaced) */
.saa-backup-list > h4 { margin: var(--sp-2) 0 2px; color: var(--text-3); font-size: var(--fs-2); font-weight: var(--fw-strong); }
label.saa-backup-row { justify-content: flex-start; cursor: pointer; }
label.saa-backup-row > .saa-backup-name { flex: 1 1 auto; }
.saa-backup-row.here { cursor: default; }
.saa-backup-row.here b { color: var(--text-2); }
.saa-backup-act { display: inline-flex; align-items: center; gap: var(--sp-2); flex: 0 0 auto; }
.saa-check { display: flex; align-items: flex-start; gap: var(--sp-2); margin: 4px 0; white-space: normal; line-height: 1.45; }
.saa-check input { margin-top: 3px; }
.saa-set-inst-head > .hint { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.saa-kv { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 7px 12px; align-items: baseline; font-size: var(--fs-3); }
.saa-kv > span:nth-child(odd) { color: var(--text-3); }
.saa-kv .saa-path { padding: 4px 8px; }
.saa-checklist { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; font-size: var(--fs-3); }
.saa-checklist li { display: flex; align-items: flex-start; gap: var(--sp-2); line-height: 1.45; }
.saa-checklist svg { flex: none; width: 15px; height: 15px; margin-top: 2px; color: var(--saa-ok); }
.saa-checklist li[data-ok="0"] { color: var(--warn); }
.saa-checklist li[data-ok="0"] svg { color: var(--warn); }
.saa-notice { margin-top: 12px !important; padding: 10px 14px; border-left: 3px solid var(--accent); border-radius: var(--r-ctl); background: var(--accent-wash); color: var(--text) !important; }
.saa-plain { margin: 4px 0 0; padding-left: 18px; color: var(--text-2); font-size: var(--fs-3); line-height: 1.55; }
.saa-plain li { margin: 3px 0; }
.saa-about a { color: var(--accent); }

/* ===================== the states of the shell's own controls (G 7.3-2): pressed, focus, disabled ===================== */
:is(.saa-nav-item, .saa-mini, .saa-bell, .saa-sc-tab, .saa-banner-x, .saa-event-x, .saa-toast-x, .saa-older, .saa-reader-main, .saa-inbox-item):active { background: var(--accent-wash-2); }
:is(.saa-nav-item, .saa-mini, .saa-bell, .saa-sc-tab, .saa-banner-x, .saa-event-x, .saa-toast-x, .saa-older, .saa-reader-main, .saa-chart-hit):focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
:is(.saa-nav-item, .saa-mini, .saa-bell, .saa-sc-tab, .saa-older):disabled { opacity: .45; cursor: default; background: transparent; }

/* ===================== small windows ===================== */
@media (max-width: 1180px) {
  .saa-shell .topbar { height: auto; flex-wrap: wrap; padding: 8px 18px; }
  .saa-shell .top-actions { flex: 1 1 auto; flex-wrap: wrap; }
  .saa-title { flex: 1 1 220px; }
}
@media (max-width: 1000px) {
  .saa-shell { grid-template-columns: minmax(0, 1fr); }
  .saa-side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 8px 12px; border-right: 0; border-bottom: 1px solid var(--border); }
  .saa-side .brand { padding: 0 6px 0 0; }
  .saa-side .brand-sub, .saa-sec { display: none; }
  .saa-nav, .saa-readers, .saa-side-foot { flex-direction: row; }
  .saa-nav { flex-wrap: wrap; }
  .saa-nav-item { width: auto; white-space: nowrap; }
  .saa-reader-text span, .saa-reader .saa-bar { display: none; }
  /* (a small window, or the text at 200 %: the list of datasets keeps to a few rows and scrolls, so that the view stays in sight) */
  .saa-side .ds-tabs { flex: 1 1 100%; flex-direction: row; flex-wrap: wrap; max-height: min(30vh, 168px); overflow-y: auto; scrollbar-width: thin; }
  .saa-side-foot { margin: 0; padding: 0; border-top: 0; flex-wrap: wrap; }
  .saa-side-note { flex: 1 1 100%; margin: 0; }
}
/* phones: the page's own spacing for small screens (its rules are weaker than the ones above) */
@media (max-width: 720px) {
  .saa-shell .topbar { padding: 8px 10px; }
  .saa-shell .workspace { padding: 10px; gap: 10px; }
  .saa-shell .col { gap: 10px; }
  .saa-shell .notice { margin: 10px 10px 0; }
  .saa-exp { margin: 10px 10px 0; }
  .saa-list { padding: 10px; }
  .saa-banner { padding: 8px 10px 8px 12px; }
  .saa-field { grid-template-columns: minmax(0, 1fr); gap: var(--sp-1); }
  .saa-kv { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .saa-kv > span:nth-child(odd) { margin-top: 6px; }
}
@media (max-width: 560px) {
  .saa-shell #settingsCard .settings { grid-template-columns: minmax(0, 1fr); }
  .saa-list-head { padding: 8px 12px; }
  .saa-search { flex: 1 1 100%; }
  .saa-list .saa-runs, .saa-compat, .saa-list-foot, .saa-filters { padding-left: 12px; padding-right: 12px; }
  .saa-list .saa-runrow { flex-wrap: wrap; gap: var(--sp-2); }
  .saa-list .saa-runrow > .saa-file { flex: 1 1 100%; }
  .saa-field-row { flex-wrap: wrap; }
}

/* a narrow tile (three instruments side by side in a small window): smaller figures, the plate above the groups.
   Last in the file: these rules have to come after the ones they change. */
@container (max-width: 330px) {
  .saa-detail { grid-template-columns: minmax(0, 1fr); }
  .saa-stats { gap: 6px; }
  .saa-stat { padding: 8px 9px 7px; }
  .saa-stat > b { font-size: var(--fs-5); }
  .saa-proto { flex-wrap: wrap; }
}
