/* BEAM web GUI - base style. THE FORMATTING RULE (GUI_DESIGN.md §1a) - every screen uses only these tokens:
   type    5 sizes: xs 12 (chips, captions, column heads, legends) · sm 13 (dense UI: tables, toolbars, navigator,
           compact controls) · md 14 (body text, forms) · lg 16 (section titles h2/h3) · xl 20 (page title h1);
           2 weights: 400 and 600. Sentence case (first letter capitalised) for titles, labels and buttons.
   space   4-px grid: 4 · 8 · 12 · 16 · 24. Cards 16/20, sections 12, between controls 8.
   control one height: 32 px (compact 26 px in tables, toolbars, side panels). Inputs, selects and buttons match.
   buttons primary (filled - at most ONE per area: the step that moves the work forward) · secondary (neutral
           outline - everything else) · toggle (secondary + aria-pressed) · danger (red outline) · icon (square).
           Links navigate, buttons act.
   chips   one shape (20 px, pill): ok / warn / bad / info / muted - status only, never an action.
   colour  accent = interactive; ok / warn / bad / info = status only. No other colours in the UI chrome. */
:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #f8f9fb;        /* hover rows, quiet panels */
  --text: #1f2328;
  --muted: #5b6570;
  --faint: #9aa0a6;
  --border: #d8dce1;
  --accent: #1d5fa8;
  --accent-text: #ffffff;
  --accent-bg: #e8f0fa;        /* selection, current item */
  --ok: #1e8e3e;   --ok-bg: #e6f4ea;     --ok-text: #1e5b30;     --ok-line: #b7dfc2;
  --warn: #b06000; --notice-bg: #fff6e0; --notice-text: #6b4a00; --warn-line: #f0d58c;
  --bad: #c00000;  --error-bg: #fdecea;  --error-text: #8a1c14;  --bad-line: #f1b8b3;
  --info: #1a56db;
  --info-line: #b8d3ef;
  --on-bad: #ffffff;
  --input-bg: #ffffff;
  --code-bg: #eef0f3;
  --section-bg: #eef2f7;       /* results: section rows */
  --group-bg: #dde5ef;         /* results: group rows */
  --stage-bg: #eef0f3;         /* behind the photo / drawing */
  --plot-bg: #fbfbfc;          /* diagram panels */
  --plot-ink: #202124; --plot-muted: #80868b; --plot-mast: #333333; --plot-ground: #8a6d3b; --plot-halo: #ffffff;
  --shadow: 0 4px 16px rgba(0, 0, 0, .15);
  --radius-card: 10px;
  /* drawn ON a picture (markers, wires, results): dark mode inverts the picture, these follow */
  --pic-filter: none; --pic-blend: normal; --pic-toggle: none; --pic-ink: #000000; --pic-ink-2: #1a1a1a; --pic-halo: #ffffff;
  --pic-plot: #202124; --pic-muted: #80868b; --pic-blue: #1a56db; --pic-red: #d93025; --pic-fill: #ffffff;
  --missing-bg: #ffffb7;       /* Excel: required and empty */
  --na-bg: #e9ecef;            /* Excel: not used by this case */

  --fs-xs: 12px; --fs-sm: 13px; --fs-md: 14px; --fs-lg: 16px; --fs-xl: 20px;
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 24px;
  --ctl-h: 32px; --ctl-h-sm: 26px;
  --radius: 6px;

  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: var(--fs-md);
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
}


/* ---- dark scheme (the theme switch in the top bar; "auto" follows the operating system) ------------- */
:root[data-theme="dark"] {
  --bg: #15171b; --surface: #1d2025; --surface-2: #252930; --text: #e6e8eb; --muted: #a0a8b2; --faint: #6f7782;
  --border: #343a42; --accent: #3d84dc; --accent-text: #ffffff; --accent-bg: #1c2f49; --info-line: #2c4d78;
  --ok: #3fb950; --ok-bg: #173323; --ok-text: #86e0a4; --ok-line: #2a5a3b;
  --warn: #d29922; --notice-bg: #372b10; --notice-text: #f0cd6a; --warn-line: #6a5316;
  --bad: #d9443b; --error-bg: #3a1d1d; --error-text: #ffa39b; --bad-line: #6e2b2b; --on-bad: #ffffff;
  --info: #6ea8fe; --missing-bg: #4a4418; --na-bg: #2a2e34;
  --input-bg: #15171b; --code-bg: #2a2e34; --section-bg: #232a33; --group-bg: #2b3645; --stage-bg: #101215;
  --plot-bg: #181b1f; --plot-ink: #e3e5e8; --plot-muted: #8b939c; --plot-mast: #c9ccd1; --plot-ground: #b8945a;
  --plot-halo: #181b1f; --shadow: 0 6px 20px rgba(0, 0, 0, .5);
  --pic-filter: invert(1) hue-rotate(180deg); --pic-blend: lighten; --pic-toggle: inline-block; --pic-ink: #f2f2f2;
  --pic-ink-2: #f0f0f0; --pic-halo: #101215; --pic-plot: #e8eaed; --pic-muted: #9aa0a6; --pic-blue: #6ea8fe; --pic-red: #ff6b5e;
  --pic-fill: #101215;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] {
  --bg: #15171b; --surface: #1d2025; --surface-2: #252930; --text: #e6e8eb; --muted: #a0a8b2; --faint: #6f7782;
  --border: #343a42; --accent: #3d84dc; --accent-text: #ffffff; --accent-bg: #1c2f49; --info-line: #2c4d78;
  --ok: #3fb950; --ok-bg: #173323; --ok-text: #86e0a4; --ok-line: #2a5a3b;
  --warn: #d29922; --notice-bg: #372b10; --notice-text: #f0cd6a; --warn-line: #6a5316;
  --bad: #d9443b; --error-bg: #3a1d1d; --error-text: #ffa39b; --bad-line: #6e2b2b; --on-bad: #ffffff;
  --info: #6ea8fe; --missing-bg: #4a4418; --na-bg: #2a2e34;
  --input-bg: #15171b; --code-bg: #2a2e34; --section-bg: #232a33; --group-bg: #2b3645; --stage-bg: #101215;
  --plot-bg: #181b1f; --plot-ink: #e3e5e8; --plot-muted: #8b939c; --plot-mast: #c9ccd1; --plot-ground: #b8945a;
  --plot-halo: #181b1f; --shadow: 0 6px 20px rgba(0, 0, 0, .5);
  --pic-filter: invert(1) hue-rotate(180deg); --pic-blend: lighten; --pic-toggle: inline-block; --pic-ink: #f2f2f2;
  --pic-ink-2: #f0f0f0; --pic-halo: #101215; --pic-plot: #e8eaed; --pic-muted: #9aa0a6; --pic-blue: #6ea8fe; --pic-red: #ff6b5e;
  --pic-fill: #101215;
  color-scheme: dark;
}
}
:root[data-theme="light"] { color-scheme: light; }
.theme-switch button.icon { width: var(--ctl-h-sm); height: var(--ctl-h-sm); padding: 0; line-height: 1; }
.theme-switch svg { width: 15px; height: 15px; vertical-align: middle; fill: none; stroke: currentColor; stroke-width: 1.5;
  stroke-linecap: round; stroke-linejoin: round; }
.theme-switch svg .fill { fill: currentColor; }
.inline-label { display: inline; margin: 0; font-weight: 400; }
/* the photo and the drawings stay as they are: their markers are drawn for a light picture */

* { box-sizing: border-box; }
/* hidden means hidden - also for elements whose class sets a display (chips, buttons, grids) */
[hidden] { display: none !important; }
body { margin: 0; }

/* no automatic capitals (owner 2026-09-27): every text shows exactly as written in the text editor */
h1 { font-size: var(--fs-xl); font-weight: 600; margin: 0 0 var(--sp-4); line-height: 1.3; }
h2 { font-size: var(--fs-lg); font-weight: 600; margin: 0 0 var(--sp-3); }
h3 { font-size: var(--fs-md); font-weight: 600; margin: 0 0 var(--sp-2); }
h1 .muted { font-weight: 400; }
p.muted, .muted { color: var(--muted); }
.sub { color: var(--muted); font-size: var(--fs-xs); }
b, strong, th { font-weight: 600; }

.topbar {
  display: flex; align-items: center; gap: var(--sp-4); flex-wrap: wrap; min-height: 48px;
  padding: var(--sp-2) var(--sp-5); background: var(--surface); border-bottom: 1px solid var(--border);
}
.topbar .brand { font-weight: 600; font-size: var(--fs-lg); color: var(--accent); text-decoration: none; letter-spacing: .02em; }
.topbar .spacer { flex: 1; }
.topbar .who { color: var(--muted); font-size: var(--fs-sm); }
.topbar form { margin: 0; display: flex; align-items: center; gap: var(--sp-2); }
.topbar label { font-size: var(--fs-sm); }
.topbar select { width: auto; }

/* chips: one shape for every status */
.chip, .badge, .ws-lock, .pw-changes, .pw-outdated, .ws-res {
  display: inline-block; vertical-align: middle; text-align: center; height: 20px; line-height: 18px; padding: 0 var(--sp-2);
  border-radius: 10px; font-size: var(--fs-xs); font-weight: 600; white-space: nowrap;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--muted); font-variant-numeric: tabular-nums;
}
.chip.ok, .ws-lock.ok, .ws-res.ok { background: var(--ok-bg); color: var(--ok-text); border-color: var(--ok-line); }
.chip.warn, .badge, .ws-lock.busy, .pw-changes, .pw-outdated { background: var(--notice-bg); color: var(--notice-text); border-color: var(--warn-line); }
.chip.bad, .ws-res.over { background: var(--bad); color: var(--on-bad); border-color: var(--bad); }
.chip.info, .badge.mine { background: var(--accent-bg); color: var(--accent); border-color: var(--info-line); }
.chip.muted, .ws-lock.free { background: var(--surface); color: var(--muted); }

main { max-width: 960px; margin: var(--sp-5) auto; padding: 0 var(--sp-4); }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card);
  padding: var(--sp-4) var(--sp-5);
}
.card.narrow { max-width: 440px; margin: 0 auto; }

/* forms */
label { display: block; margin: var(--sp-3) 0 var(--sp-1); font-weight: 600; font-size: var(--fs-sm); }
input[type=text], input[type=email], input[type=password], input[type=number], select {
  width: 100%; height: var(--ctl-h); padding: 0 var(--sp-2); border: 1px solid var(--border); border-radius: var(--radius);
  font: inherit; font-size: var(--fs-md); background: var(--input-bg); color: var(--text);
}
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }

/* buttons: primary / secondary (= .tool) / toggle / danger / icon; .small = compact height */
button, .button {
  display: inline-block; vertical-align: middle; text-align: center;
  height: var(--ctl-h); line-height: calc(var(--ctl-h) - 2px); padding: 0 var(--sp-4); border-radius: var(--radius); cursor: pointer;
  border: 1px solid var(--accent); background: var(--accent); color: var(--accent-text);
  font: inherit; font-size: var(--fs-md); font-weight: 600; text-decoration: none; white-space: nowrap;
}
button:hover:not(:disabled), .button:hover { filter: brightness(1.08); }
button.secondary, button.tool, .button.secondary {
  background: var(--surface); color: var(--text); border-color: var(--border); font-weight: 400; filter: none;
}
button.secondary:hover:not(:disabled), button.tool:hover:not(:disabled), .button.secondary:hover {
  border-color: var(--accent); color: var(--accent); filter: none; }
button[aria-pressed="true"], button.active { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
button.danger { color: var(--error-text); border-color: var(--bad-line); background: var(--surface); font-weight: 400; }
button.danger:hover:not(:disabled) { border-color: var(--bad); color: var(--bad); }
button.small, button.tool, .small.button { height: var(--ctl-h-sm); line-height: calc(var(--ctl-h-sm) - 2px); padding: 0 var(--sp-3); font-size: var(--fs-sm); }
button.icon { width: var(--ctl-h-sm); padding: 0; font-size: var(--fs-lg); font-weight: 400; }
button:disabled, button[disabled] { opacity: .45; cursor: not-allowed; filter: none; }
button:focus-visible, .button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.actions { margin-top: var(--sp-4); display: flex; gap: var(--sp-2); align-items: center; flex-wrap: wrap; }
a { color: var(--accent); }

.error {
  background: var(--error-bg); color: var(--error-text); border-radius: var(--radius);
  padding: 10px 12px; margin-bottom: 12px;
}
.notice {
  background: var(--notice-bg); color: var(--notice-text); border-radius: var(--radius);
  padding: 10px 12px; margin: 12px 0;
}
p.ok, div.ok {
  background: var(--ok-bg); color: var(--ok-text); border-radius: var(--radius);
  padding: 10px 12px; margin: 12px 0;
}
.field-missing input { border-color: var(--error-text); }
ul.plain { padding-left: 18px; }
code { background: var(--code-bg); padding: 1px 5px; border-radius: 4px; }

/* --- phase 8b: project screens --- */
.card + .card { margin-top: 16px; }
.card.wide { max-width: 640px; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 4px 0 16px; }
.filters select, .filters input { width: auto; min-width: 160px; }
form.inline { margin-bottom: 8px; }
table.list { width: 100%; border-collapse: collapse; font-size: var(--fs-md); }
table.list th, table.list td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
table.list th { color: var(--muted); font-weight: 600; font-size: var(--fs-sm); }
table.list tr:hover td { background: var(--surface-2); }
dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 20px; margin: 8px 0 16px; }
dl.facts dt { color: var(--muted); }
dl.facts dd { margin: 0; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 0 20px; }
.readonly { padding: 8px 0; }
fieldset { border: 0; padding: 0; margin: 0; }
fieldset[disabled] input, fieldset[disabled] select { background: var(--na-bg); color: var(--muted); }
/* wide tables scroll inside their card instead of widening the whole page */
.card { overflow-x: auto; }

/* parts screen (module 7c) - Excel's colours: yellow = required and empty, red = invalid */
main.wide { max-width: none; }
.card.parts-card { overflow: visible; }
/* a fieldset is at least as wide as its content by default (min-width: min-content) - without this
   the whole page scrolls sideways instead of the table */
.parts-card fieldset { min-width: 0; }
/* the table scrolls inside its own box: header row and height column stay in view, and the
   buttons around the table never scroll away */
.table-scroll { overflow: auto; max-height: 65vh; border: 1px solid var(--border); border-radius: var(--radius); }
table.parts { border-collapse: separate; border-spacing: 0; }
table.parts td { padding: 4px 6px; white-space: nowrap; }
table.parts thead th { position: sticky; top: 0; z-index: 2; background: var(--surface); }
table.parts td:first-child, table.parts th:first-child { position: sticky; left: 0; z-index: 1; background: var(--surface); }
table.parts thead th:first-child { z-index: 3; }
table.parts input[type=text] { width: 5em; padding: 4px 6px; }
table.parts select { padding: 4px 6px; }
table.parts tr.group-start td { border-top: 2px solid var(--border); }
table.parts td.missing input, table.parts td.missing select, .anchor-gap input.missing { background: var(--missing-bg); }
table.parts td.invalid input, table.parts td.invalid select { border-color: var(--error-text); background: var(--error-bg); }
/* inputs the row's case doesn't use: locked, shown greyed out like a disabled field (Excel marks
   them with a pattern in UI_parts); a leftover value stays visible, in red as in Excel */
table.parts td.na input, table.parts td.na select {
  background: var(--na-bg); border-color: var(--na-bg); color: var(--bad); cursor: not-allowed; box-shadow: none; }
table.parts td.na select { pointer-events: none; appearance: none; -webkit-appearance: none; }
ul.messages { margin: 0 0 12px; }
ul.messages .msg-error { color: var(--error-text); }
ul.messages .msg-info { color: var(--muted); }
.anchor-gap { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; }
.anchor-gap input { width: 8em; }
.add-row { margin: 0 0 12px; }
.add-row input { min-width: 0; width: 7em; }

/* calculation + results (module 7d) */
.profile-list { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 6px 0 4px; }
.profile-list label.check { font-weight: normal; display: flex; gap: 6px; align-items: center; margin: 0; }
.results-scroll { max-height: none; }
table.results { table-layout: auto; width: 100%; }
table.results td { white-space: normal; }
/* label and unit as narrow as their text allows; the variant columns share the rest (colgroup) */
table.results col.c-label, table.results col.c-unit { width: 1%; }
table.results td.res-label { white-space: normal; min-width: 20em; }   /* long labels wrap to a 2nd line */
table.results td.res-unit { white-space: nowrap; padding-right: 12px; }
table.results td:nth-child(n+3) { text-align: right; overflow-wrap: anywhere; }
table.results thead th:nth-child(n+3) { text-align: right; }
table.results tr.res-section td { background: var(--section-bg); font-weight: 600; }
table.results tr.res-group td { background: var(--group-bg); font-weight: 600; letter-spacing: .02em; padding-top: 10px; }
table.results tr.res-sub td { color: var(--muted); font-style: italic; }
table.results td.util-ok { background: var(--ok-bg); }
table.results td.util-bad { background: var(--error-bg); color: var(--error-text); font-weight: 600; }
/* collapsible topics (closed by default, like Excel's "alles verbergen") */
tbody.topic:not(.open) tr:not(.res-topic) { display: none; }
.topic-toggle { all: unset; cursor: pointer; display: flex; align-items: center; gap: 8px; width: 100%; font-weight: 600; }
.topic-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.topic-toggle .caret { width: 0; height: 0; border-left: 6px solid currentColor; border-top: 5px solid transparent;
  border-bottom: 5px solid transparent; transition: transform .15s; }
tbody.topic.open .topic-toggle .caret { transform: rotate(90deg); }
.res-toggle-all { display: flex; gap: 8px; }

/* photo tool (module 7e) */
.photo-work { display: grid; grid-template-columns: minmax(0, 1fr) 24rem; grid-template-rows: auto 1fr; gap: 6px 16px; align-items: start; }
.photo-zoom { grid-column: 1; display: flex; gap: 10px; align-items: center; }
.photo-side { grid-column: 2; grid-row: 1 / span 2; }

.photo-stage { grid-column: 1; overflow: auto; max-height: 85vh; border: 1px solid var(--border); border-radius: var(--radius); background: var(--stage-bg); }
.photo-canvas { position: relative; margin: 0 auto; }      /* width = picture pixels x zoom (photo.js) */
.photo-canvas img { position: absolute; inset: 0; width: 100%; height: 100%; user-select: none; -webkit-user-drag: none; }
.photo-canvas svg { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }
.photo-canvas svg.crosshair { cursor: crosshair; }
.mk { cursor: grab; }
.mk .mk-hit { fill: transparent; }
.mk .mk-ring { fill: rgba(255,255,255,.35); stroke-width: 3; vector-effect: non-scaling-stroke; }
.mk .mk-cross { stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.mk.ok .mk-ring, .mk.ok .mk-cross { stroke: var(--ok); }
.mk.todo .mk-ring, .mk.todo .mk-cross { stroke: var(--pic-red); }
.mk.anchor .mk-ring, .mk.anchor .mk-cross { stroke: var(--pic-ink); }
.mk.hum .mk-ring { stroke: var(--pic-ink); fill: var(--pic-fill); } .mk.hum .mk-cross { stroke: var(--pic-ink); } .mk.hum { cursor: default; }
.mk.cal .mk-ring, .mk.cal .mk-cross { stroke: var(--pic-blue); } .mk.cal .mk-ring { fill: rgba(26,86,219,.25); }
.mk.changed .mk-ring { stroke-dasharray: 4 2; }
.mk.sel .mk-ring { stroke-width: 5; }
.photo-side { display: flex; flex-direction: column; gap: 8px; }
.photo-info { margin: 0; padding: 8px 10px; border-radius: var(--radius); background: var(--bg); }
.photo-info.active { background: var(--accent-bg); } .photo-info.warn { background: var(--notice-bg); color: var(--notice-text); }
table.photo-rows td, table.photo-rows th { padding: 3px 6px; font-size: var(--fs-sm); }
table.photo-rows tr { cursor: pointer; } table.photo-rows tr.sel td { background: var(--accent-bg); } table.photo-rows tr.changed td { font-weight: 600; }
.photo-upload { border: 1px dashed var(--border); border-radius: var(--radius); padding: 12px 16px; margin-bottom: 12px; }
.pdf-view { position: relative; display: inline-block; max-width: 100%; margin-top: 8px; }
.pdf-view canvas { max-width: 100%; height: auto; border: 1px solid var(--border); cursor: crosshair; touch-action: none; }
.pdf-rect { position: absolute; border: 2px solid #1a56db; background: rgba(26,86,219,.12); pointer-events: none; }
.part-panel { border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 10px; }
.part-panel h3 { margin: 0 0 6px; font-size: var(--fs-md); }
.part-grid { display: grid; grid-template-columns: auto 1fr; gap: 4px 8px; align-items: center; font-size: var(--fs-sm); }
.part-grid label { color: var(--muted); }
.part-grid input, .part-grid select { width: 100%; padding: 3px 6px; box-sizing: border-box; }
.part-grid .pf.missing input, .part-grid .pf.missing select { background: var(--missing-bg); }
.part-grid .pf.invalid input, .part-grid .pf.invalid select { border-color: var(--error-text); background: var(--error-bg); }
.part-grid .pf.na input, .part-grid .pf.na select { background: var(--na-bg); border-color: var(--na-bg); color: var(--bad); }
.part-panel .err { color: var(--error-text); }
@media (max-width: 900px) { .photo-work { grid-template-columns: 1fr; } .photo-zoom, .photo-stage, .photo-side { grid-column: 1; grid-row: auto; } }
.photo-canvas .ref-line { stroke: var(--pic-blue); stroke-width: 2; stroke-dasharray: 6 4; vector-effect: non-scaling-stroke; }
.photo-canvas .wire-line { fill: none; stroke-width: 2.5; vector-effect: non-scaling-stroke; }
.photo-canvas .wire-line.ok { stroke: var(--ok); } .photo-canvas .wire-line.todo { stroke: var(--pic-red); }
.photo-canvas .wire-line.sel { stroke-width: 4; }
.photo-canvas .wire-label { fill: var(--pic-ink-2); font-weight: 700; paint-order: stroke; stroke: var(--pic-halo); stroke-width: 3px; }
/* load combination breakdown on the results page (Excel frmLCInfo) */
table.results .lc { border-bottom: 1px dotted currentColor; cursor: help; }
table.results .lc:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.lc-pop { position: absolute; z-index: 20; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 8px 10px; font-size: var(--fs-sm); }
.lc-pop .lc-title { font-weight: 600; margin-bottom: 4px; }
.lc-pop table { border-collapse: collapse; } .lc-pop td { padding: 1px 6px; white-space: nowrap; } .lc-pop td.num { text-align: right; font-variant-numeric: tabular-nums; }
.lc-pop td:first-child { color: var(--muted); }

/* Diagrams of a load combination (opened from its breakdown box on the results page) */
.lc-pop .lc-diag { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--border); }
dialog.diag { width: min(96vw, 1400px); height: min(92vh, 820px); min-width: 360px; min-height: 340px;
  max-width: 100vw; max-height: 100vh; resize: both; overflow: hidden;
  border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 16px; }
dialog.diag[open] { display: flex; flex-direction: column; }
dialog.diag.max { width: 100vw; height: 100vh; margin: 0; border-radius: 0; resize: none; }
dialog.diag > :not(.diag-body) { flex: none; }        /* header, texts: their own height */
dialog.diag::backdrop { background: rgba(0, 0, 0, .35); }
.diag-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.diag-head { user-select: none; }
.diag-head #diag-max { margin-left: auto; min-width: 2.2em; font-size: var(--fs-md); line-height: 1; }
.diag-tabs { display: flex; gap: 4px; }
dialog.diag > .diag-body { flex: 1 1 0; min-height: 0; overflow: auto; display: flex; flex-wrap: wrap;
  align-content: flex-start; gap: 6px; cursor: crosshair; }
.diag-panel { border: 1px solid var(--border); border-radius: var(--radius); background: var(--plot-bg); }
.diag-panel .d-title { font-size: 12px; font-weight: 600; }
.diag-panel .d-mast { stroke: var(--plot-mast); stroke-width: 3; }
.diag-panel .d-ground { stroke: var(--plot-ground); stroke-width: 2; stroke-dasharray: 4 3; }
/* value colour scale as in FE programs: fill colours are set per strip by results.js */
.diag-panel .d-fill { opacity: .85; }
.diag-panel .d-line { fill: none; stroke: var(--plot-ink); stroke-width: 1.4; }
.diag-panel .d-legend { stroke: var(--plot-muted); stroke-width: .5; }
.diag-panel .d-env { fill: var(--plot-muted); opacity: .22; stroke: var(--plot-muted); stroke-width: 1; stroke-dasharray: 3 2; }
.diag-panel .d-limit { stroke: var(--bad); stroke-dasharray: 3 3; }
.diag-panel .d-dot { fill: var(--plot-ink); }
.diag-panel .d-max { font-size: 11px; font-weight: 600; }
.diag-panel .d-z { font-size: 10px; fill: var(--muted); }
.diag-panel .d-probe { stroke: var(--plot-ink); stroke-width: 1; stroke-dasharray: 2 2; pointer-events: none; }
.diag-panel .d-probe-dot { fill: var(--plot-ink); pointer-events: none; }
.diag-panel .d-probe-v { font-size: 11px; font-weight: 700; paint-order: stroke; stroke: var(--plot-halo); stroke-width: 3px; pointer-events: none; }
/* two lines, fixed: a changing probe text must not change the panels' height (they follow it) */
.diag-probe { height: 2.9em; overflow: hidden; margin: 0 0 6px; font-size: var(--fs-sm); line-height: 1.45;
  font-variant-numeric: tabular-nums; }

/* ---- the iteration workspace (workspace.py, _ws_bar.html, _ws_nav.html) ---------------------------- */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ws-bar { background: var(--surface); border-bottom: 1px solid var(--border); padding: 8px 24px 0; }
.ws-crumbs { display: flex; align-items: center; gap: 8px; font-size: var(--fs-md); flex-wrap: wrap; }
.ws-crumbs nav { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ws-crumbs a { color: var(--muted); text-decoration: none; }
.ws-crumbs a:hover { color: var(--accent); text-decoration: underline; }
.ws-crumbs .ws-here { font-weight: 600; color: var(--text); }
.ws-crumbs .spacer { flex: 1; }
.ws-sep { color: var(--border); }
.ws-steps { list-style: none; display: flex; gap: 2px; margin: 8px 0 0; padding: 0; flex-wrap: wrap; align-items: flex-end; }
.ws-steps li > a, .ws-steps li > span { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px;
  font-size: var(--fs-md); color: var(--muted); text-decoration: none; border-bottom: 3px solid transparent; }
.ws-steps li > a:hover { color: var(--text); background: var(--bg); }
.ws-steps b { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; font-size: var(--fs-xs);
  background: var(--bg); color: var(--muted); border: 1px solid var(--border); font-weight: 600; }
.ws-steps li.active > a { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.ws-steps li.active b { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.ws-steps li.disabled > span { opacity: .45; cursor: not-allowed; }
.ws-steps .ws-views { margin-left: auto; align-self: center; display: inline-flex; border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden; margin-bottom: 6px; }
.ws-body { display: grid; grid-template-columns: 210px minmax(0, 1fr); align-items: start; }
body.has-ws { min-height: 100vh; display: flex; flex-direction: column; }
body.has-ws > .ws-body { flex: 1; align-items: stretch; }     /* the navigator reaches the bottom of the window */
.ws-nav { background: var(--surface); border-right: 1px solid var(--border); padding: 16px 10px; font-size: var(--fs-md); }
.ws-nav-head { font-size: var(--fs-xs); letter-spacing: .04em; color: var(--muted); padding: 0 8px 8px; }
.ws-nav ul { list-style: none; margin: 0; padding: 0; }
.ws-nav li a { display: grid; grid-template-columns: 20px 1fr auto; column-gap: 8px; padding: 7px 8px; border-radius: var(--radius);
  color: var(--text); text-decoration: none; }
.ws-nav li a:hover { background: var(--bg); }
.ws-nav li a.current { background: var(--accent-bg); box-shadow: inset 3px 0 0 var(--accent); }
.ws-nav .ws-state { grid-row: span 2; align-self: center; }
.ws-mast-name { font-weight: 600; }
.ws-mast-sub { font-size: var(--fs-xs); color: var(--muted); }
.ws-state svg { width: 16px; height: 16px; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; }
.ws-state.ready svg { stroke: var(--ok); }
.ws-state.incomplete svg { stroke: var(--warn); }
.ws-state.empty svg { stroke: var(--faint); }
.ws-add { display: block; margin: 10px 8px 0; font-size: var(--fs-sm); color: var(--accent); text-decoration: none; }
.ws-add:hover { text-decoration: underline; }
.ws-empty { color: var(--muted); padding: 6px 8px; }
.ws-legend { margin: 18px 8px 0; padding-top: 10px; border-top: 1px solid var(--border); display: grid; gap: 4px;
  font-size: var(--fs-xs); color: var(--muted); }
.ws-legend > span { display: flex; align-items: center; gap: 6px; }
main.in-ws { max-width: none; margin: 20px 24px; padding: 0; }
@media (max-width: 800px) {
  .ws-body { grid-template-columns: 1fr; }
  .ws-nav { position: static; min-height: 0; border-right: 0; border-bottom: 1px solid var(--border); }
  .ws-nav ul { display: flex; flex-wrap: wrap; gap: 4px; }
  .ws-legend { display: none; }
}

/* ---- GUI stage 2: the photo workspace (photo.html) ------------------------------------------------------- */
main.pw-main-wrap.in-ws { margin: 12px 16px; }
.pw-notice { margin-bottom: 8px; padding: 6px 12px; }
.pw { display: flex; flex-direction: column; gap: 10px; }
.pw-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 6px 10px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.pw-title { font-size: var(--fs-md); margin-right: 4px; white-space: nowrap; }
.pw-group { display: inline-flex; align-items: center; gap: 4px; }
.pw-group + .pw-group { padding-left: 14px; border-left: 1px solid var(--border); }
.pw-zoom-level { min-width: 48px; text-align: center; font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }
.pw-ref label { margin: 0; font-size: var(--fs-sm); font-weight: 400; color: var(--muted); white-space: nowrap; }
.pw-ref input { width: 5.5em; padding: 4px 6px; font-size: var(--fs-sm); }
.pw-spacer { flex: 1; }
.pw-save { display: inline-flex; align-items: center; gap: 6px; margin: 0; }
.pw-work { display: grid; grid-template-columns: minmax(0, 1fr) clamp(280px, 28vw, 380px); gap: 12px; height: calc(100vh - 215px); min-height: 300px; }
.pw-center { display: flex; flex-direction: column; gap: 6px; min-height: 0; }
.pw-work .photo-stage { flex: 1; min-height: 0; max-height: none; grid-column: auto; background: var(--stage-bg); }
.pw-center .photo-info { font-size: var(--fs-sm); }
.pw-inspector { display: flex; flex-direction: column; gap: 10px; min-height: 0; overflow: auto; }
.pw-section { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; }
.pw-section h3 { margin: 0 0 6px; font-size: var(--fs-md); }
.pw-inspector .part-panel { border: 0; padding: 0; }
.pw-inspector .part-panel h3 { font-size: var(--fs-md); margin-bottom: 8px; }
.pw-empty p { margin: 0 0 6px; }
.pw-keys { line-height: 1.6; }
.pw-list { flex: 1; min-height: 160px; }
.pw-list table.photo-rows { width: 100%; }
.pw-list table.photo-rows tr:hover td { background: var(--bg); }
.pw-legend { margin: 8px 0 0; font-size: var(--fs-xs); }
.pw-dot { display: inline-block; box-sizing: border-box; width: 10px; height: 10px; min-width: 10px; padding: 0;
  border-radius: 50%; border: 2px solid var(--faint); vertical-align: middle; }
.pw-list table.photo-rows td:first-child, .pw-list table.photo-rows th:first-child { width: 14px; padding-right: 0; }
.pw-dot.ok { border-color: var(--ok); } .pw-dot.todo { border-color: var(--bad); } .pw-dot.anchor { border-color: var(--text); }
.mk.hover .mk-ring { stroke-width: 6; fill: rgba(255, 213, 79, .55); }
@media (max-width: 860px) {
  .pw-work { grid-template-columns: 1fr; height: auto; }
  .pw-work .photo-stage { height: 65vh; flex: none; }
}

/* ---- GUI stage 3: results on the photo ---------------------------------------------------------------------- */
.pw-calc select { width: auto; padding: 4px 6px; font-size: var(--fs-sm); }
.photo-canvas .res { pointer-events: none; }
.photo-canvas .res-fill { opacity: .5; }            /* the drawing stays readable underneath */
.photo-canvas .res-line { fill: none; stroke: var(--pic-plot); }
.photo-canvas .res-axis { stroke: var(--pic-plot); stroke-dasharray: 4 3; }
.photo-canvas .res-env { fill: var(--pic-muted); opacity: .28; }
.photo-canvas .res-max { font-weight: 700; fill: var(--pic-plot); paint-order: stroke; stroke: var(--pic-halo); stroke-width: 3px; }
.photo-canvas .res-probe { stroke: var(--pic-plot); stroke-dasharray: 3 3; }
.pw-results { border-color: var(--accent); }
.pw-res-head { display: flex; align-items: center; gap: 8px; }
.pw-res-head h3 { margin: 0; flex: 1; }
.pw-summary { width: 100%; border-collapse: collapse; margin: 8px 0; font-size: var(--fs-sm); }
.pw-summary td { padding: 3px 4px; border-bottom: 1px solid var(--border); }
.pw-summary td:last-child { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pw-summary tr.total td { font-weight: 600; }
.pw-summary td.util-ok { color: var(--ok-text); } .pw-summary td.util-bad { color: var(--on-bad); background: var(--bad); font-weight: 600; }
.pw-res-controls { display: grid; grid-template-columns: auto 1fr; gap: 6px 8px; align-items: center; font-size: var(--fs-sm); }
.pw-res-controls label { margin: 0; font-weight: 400; color: var(--muted); }
.pw-res-controls select { padding: 3px 6px; font-size: var(--fs-sm); }
.pw-res-controls .check { grid-column: 1 / -1; color: var(--text); }
.pw-kinds { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 4px; }
.pw-probe { margin: 8px 0 0; padding: 6px 8px; background: var(--bg); border-radius: var(--radius); font-variant-numeric: tabular-nums; min-height: 2.6em; }
.pw-probe div.cur { font-weight: 600; color: var(--text); }
.pw-results .err { color: var(--error-text); margin: 6px 0 0; font-size: var(--fs-sm); }

/* stored results in the navigator (results_store.py) */
.ws-nav .ws-res { grid-column: 3; grid-row: 1 / span 2; align-self: center; }
.ws-mast-sub { grid-column: 2; }


/* ---- the formatting rule applied to screens that had their own sizes ------------------------------------ */
.ws-res { min-width: 40px; }
.ws-res.stale { background: var(--surface-2); color: var(--faint); border-color: var(--border); text-decoration: line-through; }
.ws-steps .ws-views a { display: inline-flex; align-items: center; height: var(--ctl-h-sm); padding: 0 var(--sp-3);
  font-size: var(--fs-sm); color: var(--text); text-decoration: none; }
.ws-steps .ws-views a + a { border-left: 1px solid var(--border); }
.ws-steps .ws-views a.active { background: var(--accent); color: var(--accent-text); }
table.list th, table.parts th, table.results th, .pw-summary th { font-size: var(--fs-xs); color: var(--muted); font-weight: 600; }
table.list td, table.list th { padding: var(--sp-2) var(--sp-3); }
table.list { font-size: var(--fs-sm); }
table.parts input[type=text], table.parts select, .part-grid input, .part-grid select, .pw-ref input, .pw-calc select,
.pw-res-controls select, .add-row input, .filters input, .filters select {
  height: var(--ctl-h-sm); font-size: var(--fs-sm); padding: 0 var(--sp-2); }
.pw-toolbar { min-height: 42px; }
.pw-group { gap: var(--sp-1); }
.pw-res-head button.icon { width: var(--ctl-h-sm); height: var(--ctl-h-sm); }
.part-panel button.danger { margin-top: var(--sp-2); }
.diag-head #diag-max { min-width: var(--ctl-h-sm); }
.lc-pop .lc-diag button { height: 24px; }
.topbar button { height: var(--ctl-h-sm); line-height: calc(var(--ctl-h-sm) - 2px); font-size: var(--fs-sm); }
.topbar .nav { color: var(--text); text-decoration: none; font-weight: 600; }
.topbar .nav:hover { color: var(--accent); }
.topbar select { height: var(--ctl-h-sm); font-size: var(--fs-sm); padding: 0 var(--sp-1); }
.pw-section h3, .part-panel h3, .pw-inspector .part-panel h3 { font-size: var(--fs-md); }
.pw-toolbar button, .pw-toolbar select, .pw-toolbar input[type=text] { height: var(--ctl-h-sm); line-height: calc(var(--ctl-h-sm) - 2px);
  font-size: var(--fs-sm); }
.pw-toolbar select { line-height: normal; width: auto; }
.pw-title, .ws-crumbs a, .ws-crumbs .ws-here { display: inline-block; }
.diag-panel text { fill: var(--plot-ink); }

/* ---- the project hub (hub.html) ---------------------------------------------------------------------------- */
main.hub-main { max-width: none; margin: 0; padding: 0; }
.hub { display: grid; grid-template-columns: 260px minmax(0, 1fr); min-height: calc(100vh - 49px); }
.hub-rail { background: var(--surface); border-right: 1px solid var(--border); padding: var(--sp-4) var(--sp-3);
  display: flex; flex-direction: column; gap: var(--sp-2); }
.hub-new { width: 100%; }
.hub-search { display: grid; grid-template-columns: 1fr; gap: var(--sp-2); margin: 0; }
.hub-search input, .hub-search select { height: var(--ctl-h-sm); font-size: var(--fs-sm); }
.hub-rail-head { font-size: var(--fs-xs); letter-spacing: .04em; color: var(--muted);
  padding: var(--sp-2) var(--sp-2) 0; display: flex; justify-content: space-between; }
.hub-count { font-size: var(--fs-xs); color: var(--muted); font-weight: 400; }
.hub-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; overflow: auto; }
.hub-list a { display: grid; grid-template-columns: 1fr auto; column-gap: var(--sp-2); padding: 6px var(--sp-2);
  border-radius: var(--radius); color: var(--text); text-decoration: none; }
.hub-list a:hover { background: var(--surface-2); }
.hub-list a.current { background: var(--accent-bg); box-shadow: inset 3px 0 0 var(--accent); }
.hub-item-title { font-weight: 600; font-size: var(--fs-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hub-item-sub { grid-column: 1; font-size: var(--fs-xs); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hub-item-lock { grid-column: 2; grid-row: 1 / span 2; align-self: center; }
.hub-item-lock svg { width: 14px; height: 14px; fill: none; stroke-width: 1.5; }
.hub-item-lock.other svg { stroke: var(--warn); } .hub-item-lock.mine svg { stroke: var(--ok); }
.hub-empty-list { padding: 0 var(--sp-2); }
.hub-panel { padding: var(--sp-5); display: flex; flex-direction: column; gap: var(--sp-4); max-width: 1100px; min-width: 0; }
.hub-panel > .notice, .hub-panel > .error { margin: 0; }
.hub-head { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.hub-head-text { flex: 1; min-width: 240px; }
.hub-head h1 { margin: 0 0 2px; }
.hub-head form { margin: 0; }
.hub-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); padding: var(--sp-3) var(--sp-4); min-width: 0; }
.hub-card-head { display: flex; align-items: center; gap: var(--sp-2); margin-bottom: var(--sp-2); }
.hub-card-head h2 { flex: 1; margin: 0; }
.hub-card-head form { margin: 0; }
.hub-it { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto auto; gap: var(--sp-3); align-items: center;
  padding: var(--sp-2) var(--sp-2); border-top: 1px solid var(--border); }
.hub-it.latest { background: var(--surface-2); border-radius: var(--radius); border-top-color: transparent; }
.hub-it form { margin: 0; }
.hub-it-index { color: var(--muted); font-variant-numeric: tabular-nums; text-align: center; }
.hub-it-title { font-weight: 600; }
.hub-it-masts { display: flex; flex-wrap: wrap; gap: var(--sp-1); justify-content: flex-end; max-width: 360px; }
.chip.stale { background: var(--surface-2); color: var(--faint); border-color: var(--border); text-decoration: line-through; }
.hub-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: var(--sp-4); align-items: start; }
.hub-card > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: var(--sp-2); }
.hub-card > summary::-webkit-details-marker { display: none; }
.hub-card > summary h2 { margin: 0; }
.hub-card > summary::before { content: ""; border-left: 6px solid var(--muted); border-top: 5px solid transparent;
  border-bottom: 5px solid transparent; transition: transform .15s; }
.hub-card[open] > summary::before { transform: rotate(90deg); }
.hub-card[open] > summary { margin-bottom: var(--sp-2); }
.hub-card dl.facts { margin: 0; font-size: var(--fs-sm); }
.hub-welcome { margin: 10vh auto 0; text-align: center; max-width: 440px; }
.ws-checkout { display: inline-flex; align-items: center; gap: var(--sp-2); margin: 0; }
@media (max-width: 800px) {
  .hub { grid-template-columns: 1fr; }
  .hub-rail { border-right: 0; border-bottom: 1px solid var(--border); }
  .hub-list { max-height: 40vh; }
  .hub-it { grid-template-columns: 24px minmax(0, 1fr) auto; }
  .hub-it-masts { grid-column: 2 / -1; justify-content: flex-start; }
}
.plus { width: 12px; height: 12px; vertical-align: -1px; margin-right: 4px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }

/* ---- "something is running" (busy.js): a stripe along the top of the window, a spinner in the clicked button */
html.is-busy, html.is-busy * { cursor: progress !important; }
html.is-busy body::before { content: ""; position: fixed; left: 0; top: 0; z-index: 1000; height: 3px; width: 100%;
  background: linear-gradient(90deg, transparent 0, var(--accent) 30%, var(--accent) 60%, transparent 100%);
  background-size: 50% 100%; background-repeat: no-repeat; animation: busy-stripe 1.1s ease-in-out infinite; }
@keyframes busy-stripe { from { background-position: -50% 0; } to { background-position: 150% 0; } }
button.is-busy-btn { position: relative; color: transparent !important; pointer-events: none; }
button.is-busy-btn:disabled { opacity: .8; }
button.is-busy-btn::after { content: ""; position: absolute; left: 50%; top: 50%; width: 14px; height: 14px; margin: -7px 0 0 -7px;
  border-radius: 50%; border: 2px solid var(--accent-text); border-right-color: transparent; animation: busy-spin .7s linear infinite; }
button.secondary.is-busy-btn::after, button.tool.is-busy-btn::after, button.danger.is-busy-btn::after { border-color: var(--accent); border-right-color: transparent; }
@keyframes busy-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  html.is-busy body::before { animation: none; background: var(--accent); opacity: .6; }
  button.is-busy-btn::after { animation-duration: 2s; }
}
/* the hub's site plan preview (_hub_site.html) */
.hub-site { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: var(--sp-3); }
.hub-site-form { margin: 0; display: grid; gap: var(--sp-1); }
button.hub-site-thumb { position: relative; display: block; width: 100%; height: auto; max-height: 260px; padding: 0; line-height: 0;
  background: var(--stage-bg); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
button.hub-site-thumb:hover:not(:disabled) { border-color: var(--accent); filter: none; box-shadow: 0 0 0 2px var(--accent-bg); }
.hub-site-thumb img, .hub-site-thumb svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.hub-site-thumb img { object-fit: fill; }
.hub-site-wire { fill: none; stroke: var(--pic-red); stroke-width: 2.5; vector-effect: non-scaling-stroke; }
.hub-site-mast { fill: var(--pic-blue); stroke: var(--pic-halo); stroke-width: 2; vector-effect: non-scaling-stroke; }
.hub-site-label { fill: var(--pic-ink-2); font-weight: 700; paint-order: stroke; stroke: var(--pic-halo); stroke-width: 3px; vector-effect: non-scaling-stroke;
  font-family: system-ui, sans-serif; }
.hub-site-none { margin: 0; }

/* pictures in the dark scheme: inverted with their hues kept and blended into the background, so the
   white paper of a drawing disappears; "original colours" (photo toolbar, per browser) turns it off -
   for real photographs */
.photo-canvas img, .hub-site-thumb img { filter: var(--pic-filter); mix-blend-mode: var(--pic-blend); }
.pic-toggle { display: var(--pic-toggle); }
:root[data-pic="original"] { --pic-filter: none; --pic-blend: normal; --pic-toggle: none; --pic-ink: #000000; --pic-ink-2: #1a1a1a; --pic-halo: #ffffff;
  --pic-plot: #202124; --pic-muted: #80868b; --pic-blue: #1a56db; --pic-red: #d93025; --pic-fill: #ffffff; --pic-toggle: inline-block; }
:root[data-theme="light"] { --pic-toggle: none; }
/* a pressed toggle keeps its colours under the mouse (the secondary hover rule is more specific) */
button[aria-pressed="true"]:hover:not(:disabled), button.active:hover:not(:disabled) {
  background: var(--accent); color: var(--accent-text); border-color: var(--accent); filter: brightness(1.08); }
/* the hub's mast images: tall pictures side by side, all the same height */
.hub-masts { grid-template-columns: repeat(auto-fill, minmax(96px, max-content)); align-items: start; }
.hub-mast-form button.hub-site-thumb { height: 240px; width: auto; max-width: 100%; max-height: none; }
.hub-mast-axis { stroke: var(--pic-blue); stroke-width: 2; stroke-dasharray: 6 4; vector-effect: non-scaling-stroke; }
/* the public report verification page (verify.html) */
.verify-row { display: flex; gap: var(--sp-2); }
.verify-row input { font-family: ui-monospace, Consolas, monospace; letter-spacing: .08em; text-transform: uppercase; }
.verify-result { margin: var(--sp-4) 0; padding: var(--sp-3) var(--sp-4); border-radius: var(--radius); border: 1px solid; }
.verify-result.ok { background: var(--ok-bg); color: var(--ok-text); border-color: var(--ok-line); }
.verify-result.bad { background: var(--error-bg); color: var(--error-text); border-color: var(--bad-line); }
.verify-result .sub { color: inherit; opacity: .85; margin-top: 2px; }
.verify dl.facts { font-size: var(--fs-sm); }
/* the demo banner's licence request; the admin area */
.demo-banner { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; }
.demo-banner > span:first-child { flex: 1; }
.demo-banner form { margin: 0; }
.admin-decide { display: inline-flex; gap: var(--sp-1); align-items: center; margin: 0 var(--sp-1) 0 0; }
.admin-decide select { width: auto; height: var(--ctl-h-sm); font-size: var(--fs-sm); }
.admin-decide input[type=text] { width: 4.5em; height: var(--ctl-h-sm); font-size: var(--fs-sm); }
table.list td.num, table.list th.num { text-align: right; font-variant-numeric: tabular-nums; }
.admin-usage-wrap { max-height: none; border: 0; }
.topbar .nav .chip { margin-left: 2px; }

/* ---- the photo page's ribbon (photo.html): named groups Edit / View / Picture / Results / Save ------------ */
.pw-toolbar.ribbon { display: flex; flex-wrap: wrap; align-items: stretch; gap: 0; padding: 0; min-height: 0; }
.ribbon .rb-head { display: flex; flex-direction: column; justify-content: center; padding: var(--sp-2) var(--sp-3);
  border-right: 1px solid var(--border); min-width: 0; }
.ribbon .rb-head .pw-title { margin: 0; }
.ribbon .rb-head .muted { font-size: var(--fs-sm); }
.ribbon .rb-group { display: flex; flex-direction: column; justify-content: space-between; gap: var(--sp-1);
  padding: var(--sp-2) var(--sp-3) 3px; border-right: 1px solid var(--border); margin: 0; }
.ribbon .rb-row { display: flex; align-items: center; gap: var(--sp-1); }
.ribbon .rb-cap { font-size: 11px; line-height: 1.2; color: var(--faint); text-align: center; letter-spacing: .03em; white-space: nowrap; }
.ribbon .rb-results { background: var(--surface-2); }
.ribbon .rb-save { margin-left: auto; border-right: 0; border-left: 1px solid var(--border); }
/* the three modes: one segmented control, exactly one pressed */
.ribbon .rb-seg { gap: 0; }
.ribbon .rb-seg button { border-radius: 0; margin-left: -1px; }
.ribbon .rb-seg button:first-child { border-radius: var(--radius) 0 0 var(--radius); margin-left: 0; }
.ribbon .rb-seg button:last-child { border-radius: 0 var(--radius) var(--radius) 0; }
.ribbon .rb-seg button[aria-pressed="true"] { position: relative; z-index: 1; }
/* icons */
.ribbon .rb-ico { width: 14px; height: 14px; vertical-align: -2px; margin-right: 5px; fill: none; stroke: currentColor;
  stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.ribbon .rb-ico .rb-fill { fill: currentColor; stroke: none; }
.ribbon button.icon .rb-ico { margin: 0; }
.ribbon .pw-ref label { font-size: var(--fs-sm); color: var(--muted); font-weight: 400; margin: 0; }
.ribbon .pw-ref input { width: 4.5em; }
/* save: the arrow opens "save as new iteration" (works without JavaScript) */
.ribbon .rb-more { position: relative; }
.ribbon .rb-more > summary { list-style: none; display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
  width: var(--ctl-h-sm); height: var(--ctl-h-sm); border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); color: var(--text); }
.ribbon .rb-more > summary::-webkit-details-marker { display: none; }
.ribbon .rb-more > summary:hover { border-color: var(--accent); color: var(--accent); }
.ribbon .rb-more[open] > summary { background: var(--accent-bg); }
.ribbon .rb-more .rb-menu { position: absolute; right: 0; top: calc(100% + 4px); z-index: 20; padding: var(--sp-1);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.ribbon .rb-more .rb-menu button { white-space: nowrap; }
/* narrow windows: captions go, groups wrap as whole blocks */
@media (max-width: 1180px) {
  .ribbon .rb-cap { display: none; }
  .ribbon .rb-group { padding-bottom: var(--sp-2); }
  .ribbon .rb-head { display: none; }
}
/* the title repeats the breadcrumb and the step tabs - only on very wide screens */
.ribbon .rb-group { padding-left: 10px; padding-right: 10px; }
@media (max-width: 1700px) { .ribbon .rb-head { display: none; } }
/* hub: the panel uses the full width like the other pages; wide tables scroll inside their card */
.hub-panel { max-width: none; }
.hub-grid { grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); }
.hub-card { overflow-x: auto; }
.hub-card table.list { min-width: 100%; }
.hub-card table.list td form { margin: 0; }
/* admins: "texts of this page" and the text editor (admin_texts.html) */
.admin-texts-link { position: fixed; right: var(--sp-4); bottom: var(--sp-4); z-index: 50; font-size: var(--fs-xs);
  padding: 4px 10px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); color: var(--muted);
  text-decoration: none; box-shadow: var(--shadow); opacity: .75; }
.admin-texts-link:hover { opacity: 1; color: var(--accent); border-color: var(--accent); }
@media print { .admin-texts-link { display: none; } }
table.texts-edit td { vertical-align: top; }
table.texts-edit td.texts-key { max-width: 16em; word-break: break-all; }
table.texts-edit textarea { width: 100%; min-width: 12em; font: inherit; font-size: var(--fs-sm); padding: 4px 6px;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--input-bg); color: var(--text); resize: vertical; }
table.texts-edit textarea.empty { background: var(--missing-bg); }
table.texts-edit tr.missing td { background: var(--notice-bg); }
table.texts-edit tr.just-saved td { background: var(--ok-bg); }
table.texts-edit td form { margin: 0; }
.filters input[type=checkbox] { min-width: 0; width: auto; height: auto; }
.filters label.check { display: inline-flex; align-items: center; gap: var(--sp-1); font-size: var(--fs-sm); margin: 0; }
.topbar a.who { color: var(--muted); text-decoration: none; }
.topbar a.who:hover { color: var(--accent); }
.login-forgot { display: block; width: 100%; }
.temp-password { font-family: ui-monospace, Consolas, monospace; font-size: var(--fs-lg); letter-spacing: .1em; }
/* footer: imprint + privacy on every page (not in the workspace: the photo area fills the window there) */
.site-footer { display: flex; gap: var(--sp-4); justify-content: center; flex-wrap: wrap; padding: var(--sp-4);
  font-size: var(--fs-xs); color: var(--faint); }
.site-footer a { color: var(--muted); text-decoration: none; }
.site-footer a:hover { color: var(--accent); text-decoration: underline; }
body.has-ws .site-footer { display: none; }
.register-privacy { margin-top: var(--sp-3); }
/* the legal pages */
.card.legal { max-width: 820px; margin: 0 auto; line-height: 1.6; }
.card.legal h2 { margin-top: var(--sp-5); }
.card.legal ul { padding-left: 1.2em; }
