/* RotoCon QM — app-specific layer on top of cockpit.css (tokens/shell) and Bootstrap 5.3
   (grid/forms). Loaded last. Spec: docs/superpowers/specs/2026-09-22-qm-cockpit-ui-design.md */

/* --- QM's status palette (spec §4.2, decision D3: saturated over warm) ---
   These are QM's own domain states — intake/in-progress/released/shipped/
   delivered/alarm/idle for a machine in Freigabe — not shared cockpit
   tokens, so they live in QM's own layer rather than in cockpit-tokens.css.
   A CRM has leads, not machines in Freigabe: this palette does not travel
   to another app without a separate decision (spec §9; docs/design_rotocon_2.md §13).

   Contrast of solid against ink, WCAG 2.1: 5.7 / 9.5 / 8.9 / 5.3 / 5.2 / 4.8.
   All pass AA for normal text. Monday's own hues were NOT taken as-is:
   #A25DDC gives 4.09:1 and #E2445C gives 4.02:1 against white — both fail. */
:root {
  --s-intake:            #0063CC;
  --s-intake-ink:        #FFFFFF;
  --s-intake-soft:       rgba(0, 99, 204, 0.16);

  --s-in-progress:       #FDAB3D;
  --s-in-progress-ink:   #10100F;
  --s-in-progress-soft:  rgba(253, 171, 61, 0.18);

  --s-released:          #00C875;
  --s-released-ink:      #0A0A0B;
  --s-released-soft:     rgba(0, 200, 117, 0.16);

  /* Versand — the stage between the amber of acceptance work and the green of
     a machine ready to leave. Measured, like the five above it: 8.29:1 against
     --s-in-progress-ink, and 32° of hue from --s-released, 24° from
     --s-intake, so it is not read as either at a glance across the hall. */
  --s-packing:           #00BCD4;
  --s-packing-ink:       #10100F;
  --s-packing-soft:      rgba(0, 188, 212, 0.18);

  --s-shipped:           #8E4BC8;
  --s-shipped-ink:       #FFFFFF;
  --s-shipped-soft:      rgba(142, 75, 200, 0.18);

  --s-delivered:         #6B6B73;
  --s-delivered-ink:     #FFFFFF;
  --s-delivered-soft:    rgba(107, 107, 115, 0.20);

  /* The only red that means a state. Brand red never does. */
  --s-alarm:             #CE3A50;
  --s-alarm-ink:         #FFFFFF;
  --s-alarm-soft:        rgba(206, 58, 80, 0.18);
  /* --s-alarm as a `color:` on a dark surface (WCAG 2.1, measured): 3.81:1 on
     --ink-800 (#141416, the .card/.auth__card surface) and 4.10:1 on --ink
     (#0A0A0B, the .gantt row surface) — both below AA's 4.5:1 for normal
     text. A filled pill/chip/dot is unaffected (that's --c against its own
     22% tint, not this) and stays on --s-alarm. Same hue (351°) and
     saturation (60%) as --s-alarm, lightness raised until both surfaces
     clear 4.5:1 with headroom: 4.92:1 on --ink-800, 5.29:1 on --ink. For the
     handful of places that set alarm-red *text* on a dark surface, not a
     fill — never a new state colour.
     https://www.w3.org/TR/WCAG21/#contrast-minimum */
  --s-alarm-text:        #D65C6E;
  /* --s-alarm-text is measured against a *plain* dark surface. Put it on top
     of --s-alarm-soft and the 18% red tint lifts the surface under it, so the
     ratio drops below AA: 4.22:1 on the .btable surface (--ink-800) and
     3.97:1 on a hovered row (--ink-700) — the case .ship-chip--overdue hits,
     at 12px/700, where no large-text exemption applies. Same hue (351°) and
     saturation (60%) again, lightness raised until the tinted surfaces clear
     AA with the headroom the amber .ship-chip--due already has (6.78/6.31):
     5.49:1 over the tint on --ink-800, 5.16:1 on --ink-700, 6.00:1 on --ink.
     Alarm-red text *on --s-alarm-soft* — not a new state colour, and not a
     fill. Guarded by machines/tests/test_red_discipline.py, which resolves
     the tokens and recomputes both ratios. */
  --s-alarm-soft-text:   #DE7B89;

  /* A started-but-barely bar should not borrow the "in progress" amber. */
  --s-idle:              #5A7A99;
}

/* --- Bootstrap dark theme aligned to cockpit tokens --- */
[data-bs-theme="dark"] {
  --bs-body-bg: var(--ink);
  --bs-body-color: var(--bone);
  --bs-secondary-color: var(--mute);
  --bs-tertiary-bg: var(--ink-700);
  --bs-border-color: var(--line-strong);
  --bs-link-color: var(--bone);
  --bs-link-hover-color: #fff;
}
/* --- Buttons and fields: the look (sizes, fills, the brand-ink primary, the
   selected .is-active state, .form-hint, .visually-hidden) is cockpit.css's.
   QM only says what Bootstrap 5 would otherwise put back over it. --- */
.btn { --bs-btn-hover-color: var(--bone); --bs-btn-hover-border-color: var(--line-strong); --bs-btn-active-color: var(--bone); --bs-btn-active-bg: var(--ink-600); --bs-btn-active-border-color: var(--line-strong); }
.btn--primary { --bs-btn-hover-color: #fff; --bs-btn-hover-border-color: var(--brand-ink); --bs-btn-active-color: #fff; --bs-btn-active-bg: var(--brand-hover); --bs-btn-active-border-color: var(--brand-hover); }
.btn--ghost { --bs-btn-hover-border-color: var(--line); --bs-btn-active-bg: var(--ink-700); --bs-btn-active-border-color: var(--line); }
/* Bootstrap's :focus repaints a field --bs-body-bg (--ink here, darker than the
   field itself); cockpit.css's focus rule does not say otherwise. */
.form-control:focus, .form-select:focus { background: var(--ink-700); color: var(--bone); }
/* Alarm-red text on a dark surface: the text-safe variant, never --rot-bright. */
.field-error { color: var(--s-alarm-text); }
.progress { --bs-progress-bg: rgba(255, 255, 255, 0.08); --bs-progress-bar-bg: var(--s-idle); height: 8px; border-radius: 999px; }
.progress-bar--low  { background: var(--s-idle) !important; }
.progress-bar--mid  { background: var(--s-in-progress) !important; }
.progress-bar--full { background: var(--s-released) !important; }

/* --- Sidebar: the shell grammar (brand row, rail toggle, search, groups,
   entries, account row, the 64px icon rail from 861px, the phone off-canvas
   panel) is cockpit.css's — the CRM absorbed QM's on 2026-09-28. QM keeps only
   what is QM's: the Wareneingang count on an entry and the role colour the
   pill and the avatar share. --- */
.sidebar__row { display: flex; align-items: center; }
.sidebar__row .sidebar__link { flex: 1 1 auto; }
.sidebar__help {
  flex: 0 0 auto; display: grid; place-items: center;
  width: 28px; height: 28px; margin-right: 0.3rem;
  background: none; border: 0; border-radius: 50%;
  color: var(--mute); cursor: pointer;
}
.sidebar__help:hover, .sidebar__help:focus-visible {
  color: var(--bone); background: rgba(255, 255, 255, 0.05);
}
.sidebar__helpicon { width: 15px; height: 15px; }
@media print { .sidebar__help { display: none !important; } }
.sidebar__link .warehouse-badge { margin-left: auto; }
@media (min-width: 861px) {
  /* The rail hides even the entry's own label; a second control per row
     cannot fit in 48px, and help is not an emergency button. It returns
     when the sidebar is expanded. */
  body.nav-rail .sidebar__help { display: none; }
  /* In the rail the count moves to the icon's corner. */
  body.nav-rail .sidebar__link .warehouse-badge {
    position: absolute; top: 3px; right: 4px; margin: 0;
    min-width: 1rem; height: 1rem; padding: 0 0.2rem; font-size: 0.6rem;
  }
}

/* Role colour, shared by the pill and the avatar: cockpit.css's .status-pill
   and .sidebar__avatar both read --c, so the two always agree. */
.status-pill--developer, .sidebar__account--developer { --c: var(--s-released); }
.status-pill--master,   .sidebar__account--master   { --c: var(--s-shipped); }
.status-pill--admin,    .sidebar__account--admin    { --c: var(--s-in-progress); }
.status-pill--internal, .sidebar__account--internal { --c: var(--s-intake); }
.status-pill--client,   .sidebar__account--client   { --c: var(--s-delivered); }

/* --- Planned shipping (WP5) --- */
.ship--overdue { color: var(--s-alarm); font-weight: 600; }
.ship--due { color: var(--s-in-progress); }
.ship__flag { font-size: 0.72rem; opacity: 0.85; margin-left: 0.25rem; }
/* --- KPI strip: the tile grammar (dense padding, --fs-xl at weight 500,
   .kpi__foot, the lead tile that is larger, not heavier — Lagebild spec D4)
   is cockpit.css's. The lead tile shows standing days, the meeting's metric;
   the euro figure it stands for never appears on this page (D11). QM's own
   figures: --- */
/* A date in a tile is not a count: smaller. Same specificity as cockpit.css's
   .kpi__n; it wins because qm.css loads after it. */
.kpi__n--date { font-size: 1.35rem; }

/* The one red on the strip: the Überfällig figure, and only when it is
   not zero (the template adds the class conditionally). --s-alarm-text,
   not --s-alarm: the text-safe variant that clears 4.5:1 on --ink-800. */
.kpi__n--alarm { color: var(--s-alarm-text); }

/* --- Inventory tile: a distribution bar + legend replaces three bare
   numbers (task 19). Segments are sized with flex-grow set to the raw
   per-status count — the browser turns five counts straight into five
   proportional widths, the same trick `.group__dist` already uses. --- */
.kpi--inventory .kpi__n { font-size: 1.35rem; }
.dist-bar {
  display: flex; width: 100%; height: 8px; margin-top: 0.6rem;
  border-radius: 999px; overflow: hidden;
  background: rgba(255, 255, 255, 0.08);
}
.dist-bar__seg { flex-shrink: 0; flex-basis: 0; }
.dist-bar__seg--intake      { background: var(--s-intake); }
.dist-bar__seg--in_progress { background: var(--s-in-progress); }
.dist-bar__seg--released    { background: var(--s-released); }
.dist-bar__seg--shipped     { background: var(--s-shipped); }
.dist-bar__seg--delivered   { background: var(--s-delivered); }
.dist-legend {
  list-style: none; margin: 0.55rem 0 0; padding: 0;
  display: flex; flex-wrap: wrap; gap: 0.3rem 0.75rem;
  color: var(--mute); font-size: 0.72rem;
}
.dist-legend__dot {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  margin-right: 0.3rem;
}
.dist-legend__dot--intake      { background: var(--s-intake); }
.dist-legend__dot--in_progress { background: var(--s-in-progress); }
.dist-legend__dot--released    { background: var(--s-released); }
.dist-legend__dot--shipped     { background: var(--s-shipped); }
.dist-legend__dot--delivered   { background: var(--s-delivered); }

/* --- Machine status pills (spec §6.4) ---
   Soft by default. `--solid` is the board column: full fill, checked ink. */
.status-pill--intake      { --c: var(--s-intake);      --soft: var(--s-intake-soft);      --ink: var(--s-intake-ink); }
.status-pill--in_progress { --c: var(--s-in-progress); --soft: var(--s-in-progress-soft); --ink: var(--s-in-progress-ink); }
.status-pill--packing     { --c: var(--s-packing);     --soft: var(--s-packing-soft);     --ink: var(--s-packing-ink); }
.status-pill--released    { --c: var(--s-released);    --soft: var(--s-released-soft);    --ink: var(--s-released-ink); }
.status-pill--shipped     { --c: var(--s-shipped);     --soft: var(--s-shipped-soft);     --ink: var(--s-shipped-ink); }
.status-pill--delivered   { --c: var(--s-delivered);   --soft: var(--s-delivered-soft);   --ink: var(--s-delivered-ink); }

.status-pill { background: var(--soft, color-mix(in srgb, var(--c) 22%, transparent)); }

.status-pill--solid {
  background: var(--c);
  color: var(--ink);
  font-size: 13px;
  padding: 5px 12px;
}
.status-pill--solid::before { display: none; }   /* the fill already carries the colour */

/* --- Topbar: the title scale, the ellipsis and the phone layout (menu
   toggle, off-canvas sidebar, backdrop) are cockpit.css's. QM adds the EN/DE
   toggle. --- */
.lang-toggle { display: inline-flex; gap: 0.25rem; margin-left: 0.5rem; }
@media (max-width: 860px) {
  .lang-toggle { margin-left: 0.25rem; gap: 0.2rem; }
}

/* --- Progress cell (tables) --- */
.qm-progress { display: flex; align-items: center; gap: 0.5rem; min-width: 140px; }
.qm-progress .progress { flex: 1; }
.qm-progress__val { font-size: 0.78rem; min-width: 2.6rem; text-align: right; }

/* --- Timeline (recent activity) --- */
.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.timeline__item {
  display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: baseline;
  padding: 0.5rem 0; border-bottom: 1px solid var(--line); font-size: 0.85rem;
}
.timeline__item:last-child { border-bottom: 0; }
.timeline__time { font-size: 0.78rem; }

/* --- Machine detail rendered as the source QM document
   (Checkliste_Druckmaschine_Eingang_bis_Auslieferung, Rotocon Europe GmbH) --- */
.doc { display: flex; flex-direction: column; gap: 1rem; }
.doc__head {
  display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-start;
  justify-content: space-between;
  border-bottom: 2px solid var(--line-strong); padding-bottom: 0.75rem;
}
.doc__title { font-size: 1.25rem; margin: 0; text-transform: none; }
.doc__meta { color: var(--mute); font-size: 0.8rem; margin: 0.25rem 0 0; }
.doc__subtitle { font-size: 1rem; margin: 0 0 0.75rem; }

.doc__kopf {
  display: grid; grid-template-columns: 2fr 1fr; gap: 1rem;
  background: var(--ink-800); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1rem 1.25rem;
}
.doc__fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 0.75rem 1.5rem; margin: 0; }
.doc__counters { display: grid; grid-template-columns: repeat(3, auto); gap: 0.75rem 1.25rem; margin: 0; align-content: start; }
.doc__kopf dt { color: var(--mute); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.05em; }
.doc__kopf dd { margin: 0.15rem 0 0; font-size: 0.9rem; }
.doc__counters dd { font-family: var(--font-display); font-size: 1.25rem; line-height: 1.1; }
.doc__counters-bar { grid-column: 1 / -1; }

/* --- The checklist table: the document's seven columns --- */
.doc__table { font-size: 0.82rem; table-layout: fixed; }
.doc__table .col-nr { width: 3rem; }
.doc__table .col-done { width: 5.5rem; }
.doc__table .col-date { width: 7rem; }
.doc__table .col-remark { width: 22%; }
.doc__table th, .doc__table td { vertical-align: top; }

/* --- The sheet: nine phase bands that open one at a time (owner, 20.10.2026).
   The mockup in Documents/RotoconWebsite.pptx replaced the 52-row table with
   full-width bands. Nesting is read from the surface getting lighter, not from
   indentation — a hall tablet loses indentation long before it loses contrast,
   and the drawing puts the phase and its steps at the same left edge. The
   printed sheet keeps the document's table; see checklist_print.html. --- */
.phases { display: flex; flex-direction: column; gap: 2px; }
.phase {
  background: var(--ink-700);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.phase:nth-of-type(even) { background: var(--ink-600); }
.phase__head {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.75rem;
  min-height: 48px;                /* picked with a gloved finger, not a mouse */
  color: var(--bone); font-size: 0.86rem; letter-spacing: 0.02em;
  cursor: pointer; list-style: none;
}
.phase__head::-webkit-details-marker { display: none; }
.phase__head::before {
  content: "\25B8";               /* ▸ — turns 90° when the band opens */
  flex: 0 0 auto; color: var(--bone); font-size: 0.95rem; opacity: 0.6;
  transition: transform 120ms ease;
}
.phase[open] > .phase__head::before { transform: rotate(90deg); }
.phase__name { flex: 1 1 auto; }
/* Three amber bands on a released machine read as forgotten work unless the
   head says what they are. Quiet on purpose: a label, not a second status.
   var(--line-200) and var(--ink-500) are not defined anywhere in this repo
   (checked static/css/cockpit-tokens.css and qm.css) — substituted with the
   nearest tokens that ARE defined and already carry this exact job: --line
   is the subtle hairline border used for quiet badges/pills elsewhere in
   this file, and --mute is the secondary/muted text colour .cell-muted
   itself resolves to. Both live in cockpit.css, loaded just before
   cockpit-tokens.css in base.html — cockpit-tokens.css defines no colour
   tokens at all, only spacing/type/radius. */
.phase__after {
  font-size: .75rem;
  font-weight: 400;
  letter-spacing: .02em;
  padding: .1rem .4rem;
  margin-left: .4rem;
  border-radius: .5rem;
  border: 1px solid var(--line);
  color: var(--mute);
  white-space: nowrap;
}
.phase__status {
  flex: 0 0 auto; min-width: 11rem;   /* the statuses line up down the sheet */
  font-size: 0.82rem;
}
/* Slide 2 colours the whole band, not a pill in the corner. The drawing puts
   white on both fills; white is 1.8:1 on the amber and 2.0:1 on the green, so
   the ink is dark here instead — see test_phase_status. */
.phase[data-state="erledigt"] { background: var(--ok); color: var(--ink-900); }
.phase[data-state="in-bearbeitung"] { background: var(--warn); color: var(--ink-900); }
.phase[data-state] > .phase__head { color: var(--ink-900); }
.phase[data-state] > .phase__head::before { color: var(--ink-900); opacity: 0.75; }
/* `.group__count` brings its own dark pill from the board; on a coloured band
   that is a dark blob with dark ink on it. The pill goes light here instead. */
.phase[data-state] .group__count { color: var(--ink-900); background: rgba(255, 255, 255, 0.45); }
/* `.phase__after`'s --mute/--line pair (above) is right for the plain grey
   band (5.06:1) and wrong the moment the band colours: --mute on the amber
   is 1.88:1, on the green 1.51:1 — the same failure this file's own comment
   above cites for white at 1.8:1. Phase 7 goes amber the instant one step of
   it is ticked, which is the normal case while this badge is visible, so the
   dark-ink switch below is not an edge case. Code review, fix round 1. */
.phase[data-state] .phase__after { color: var(--ink-900); border-color: rgba(0, 0, 0, 0.25); }
/* The steps inside keep the dark surface: only the band reports the status.
   The ink has to come back with it. The band sets `color: var(--ink-900)` on
   the whole <details>, which is right for the coloured head and inherited all
   the way down into the steps, where the surface is dark again: every piece of
   text without a colour of its own — an unticked `.step__text`, the journal's
   sentences, a read-only remark — rendered near-black on the step card at
   1.2:1. Reported from the hall on 04.11.2026 with a photograph of step 31,
   "Abnahmeprotokoll vollständig ausgefüllt", invisible under a green circle.
   Measured by test_a_steps_text_stays_readable_inside_a_coloured_band. */
.phase[data-state] > .phase__steps { background: var(--ink-800); color: var(--bone); }
.phase__steps {
  display: flex; flex-direction: column; gap: 0.4rem;
  padding: 0 0.5rem 0.5rem;
}
/* Scoped to the accordion: the annex screen still renders .step-row as a real
   table row, where a card's padding and border would not apply cleanly. */
/* A tint, not a token: the card then sits one notch above whichever band it is
   in, so the ladder holds on the odd and the even phase alike. */
.phase__steps .step-row {
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.75rem 3rem 0.75rem 0.75rem;
  position: relative;
}
/* The number moved inline to free the top-right corner for the "⋮" the mockup
   draws there (slide 5). It reads better in front of the text anyway. */
.phase__steps .step-row .cell-num {
  margin-right: 0.45rem; font-size: 0.72rem; opacity: 0.7;
  font-variant-numeric: tabular-nums;
}

/* --- The step's actions menu (slides 5 and 6) --- */
.step__menu { position: absolute; top: 0.45rem; right: 0.5rem; z-index: 2; }
.step__menu-trigger {
  display: flex; align-items: center; justify-content: center;
  width: 2rem; height: 2rem; border-radius: var(--radius-sm);
  color: var(--bone); opacity: 0.6; cursor: pointer; list-style: none;
  font-size: 1.1rem; line-height: 1;
}
.step__menu-trigger::-webkit-details-marker { display: none; }
.step__menu-trigger:hover,
.step__menu[open] > .step__menu-trigger { opacity: 1; background: rgba(255, 255, 255, 0.08); }
.step__menu-items {
  position: absolute; top: 2.2rem; right: 0; z-index: 3;
  display: flex; flex-direction: column; min-width: 13rem;
  background: var(--ink-900); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 0.25rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}
.step__menu-item {
  appearance: none; background: none; border: 0; cursor: pointer;
  text-align: left; color: var(--bone); font: inherit; font-size: 0.82rem;
  padding: 0.55rem 0.6rem; border-radius: var(--radius-sm);
  min-height: 44px;                  /* a gloved finger, not a mouse */
}
.step__menu-item:hover, .step__menu-item:focus-visible {
  background: rgba(255, 255, 255, 0.08);
}

/* The "⋮" owns Foto hinzufügen and Nachprüfung anfordern, so their panels stop
   advertising themselves a second time on the row. The flag is set by the
   script: opening a panel needs JavaScript, so without it these summaries must
   stay usable. Abweichung is not in the menu and keeps its own. */
.has-step-menu .phase__steps .step__recheck > summary,
.has-step-menu .phase__steps .step__photo-add > summary { display: none; }
.phase__steps .cell-step { display: block; padding-bottom: 0.6rem; min-width: 0; }
.phase__steps .sublabel-row {
  margin: 0.4rem 0 0; padding: 0.35rem 0.75rem;
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-sm);
  color: var(--mute); font-weight: 600; font-size: 0.78rem;
}
.step__readonly {
  display: flex; flex-wrap: wrap; gap: 0.75rem;
  align-items: baseline; font-size: 0.82rem;
}

/* --- The step's own disclosure (slides 4 and 5) --- */
.step__more { margin-top: 0.5rem; border-top: 1px solid var(--line); }
.step__more-head {
  display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap;
  padding: 0.45rem 0 0.1rem;
  min-height: 40px; cursor: pointer; list-style: none;
}
.step__more-head::-webkit-details-marker { display: none; }
.step__more-head::before {
  content: "\25B8"; color: var(--bone); opacity: 0.5; font-size: 0.85rem;
  transition: transform 120ms ease;
}
.step__more[open] > .step__more-head::before { transform: rotate(90deg); }
.step__chip {
  display: inline-flex; align-items: center; gap: 0.35rem;
  color: var(--mute); font-size: 0.76rem; letter-spacing: 0.02em;
}
/* "gelb wenn was eingetragen ist" — the owner's note on slide 5. It says the
   row holds something, which is not the same as the band's amber status, so
   it is a dot of its own and carries a title for anyone who cannot see it. */
.step__chip[data-filled="1"] { color: var(--bone); }
.step__chip[data-filled="1"]::after {
  content: ""; width: 0.5rem; height: 0.5rem; border-radius: 50%;
  background: var(--warn); flex: 0 0 auto;
}
.step__detail {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0.75rem; padding: 0.6rem 0 0.2rem;
}
/* Slide 5 puts the journal on the right half of the opened row. */
.step__history {
  background: var(--ink-900);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.6rem;
  font-size: 0.78rem; max-height: 14rem; overflow-y: auto;
}
.step__evidence { display: flex; flex-direction: column; gap: 0.5rem; min-width: 0; }
/* Date and kind on the first line with the author pushed right, the sentence
   itself on the next — the author used to wrap mid-entry and the panel read
   as one run-on paragraph. */
.step__history-line {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.35rem;
  margin: 0 0 0.4rem; padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--line);
}
.step__history-line:last-child { margin-bottom: 0; padding-bottom: 0; border-bottom: 0; }
.step__history-date { color: var(--mute); flex: 0 0 auto; font-variant-numeric: tabular-nums; }
.step__history-kind { color: var(--bone); font-weight: 600; flex: 0 0 auto; }
.step__history-who { color: var(--mute); font-size: 0.72rem; margin-left: auto; flex: 0 0 auto; }
.step__history-text { flex: 1 1 100%; min-width: 0; }

@media (max-width: 900px) {
  .step__detail { grid-template-columns: minmax(0, 1fr); }
}
.step-row.is-done .step__text { color: var(--mute); }
.step__text { display: block; }
.step__note {
  display: block; margin-top: 0.2rem;
  color: var(--warn); font-size: 0.72rem; line-height: 1.35;
}
.step__note::before { content: "▸ "; }
.step__by { display: block; margin-top: 0.25rem; color: var(--mute); font-size: 0.72rem; }
.status-pill--recheck { --c: var(--warn); }
.step__challenge {
  display: flex; flex-direction: column; gap: 0.3rem;
  margin-top: 0.45rem; padding: 0.5rem 0.6rem;
  border-left: 3px solid var(--warn);
  background: rgba(255, 176, 32, 0.08);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 0.78rem;
}
.step__challenge-note { color: var(--bone); }
.step__challenge-actions { display: flex; gap: 0.35rem; flex-wrap: wrap; margin-top: 0.15rem; }
.step__recheck { margin-top: 0.35rem; font-size: 0.75rem; }
.step__recheck summary { color: var(--mute); cursor: pointer; }
.step__recheck summary:hover { color: var(--bone); }
.step__recheck[open] summary { margin-bottom: 0.35rem; }
.recheck-form { display: flex; gap: 0.35rem; align-items: center; }
.recheck-form .form-control { font-size: 0.78rem; }

/* --- Doc 182's protocol screen: the section index and the accordion.
   New class names only — nothing above is redefined, so no other page can
   shift. The colours are the cockpit's own tokens (--line, --mute, --ok) and
   QM's one state red (--s-alarm); the chip is a border, never a fill, so the
   red-discipline rule about alarm text on a tinted surface does not apply. --- */
.fat__index { display: flex; flex-wrap: wrap; gap: 0.35rem; margin: 0 0 1rem; }
.fat__chip { display: inline-flex; align-items: baseline; gap: 0.35rem;
             padding: 0.2rem 0.55rem; border: 1px solid var(--line);
             border-radius: 999px; font-size: 0.82rem; text-decoration: none;
             color: inherit; }
.fat__chip[data-state="passed"]         { border-color: var(--ok); }
.fat__chip[data-state="failed"]         { border-color: var(--s-alarm); }
.fat__chip[data-state="not_applicable"] { opacity: 0.55; }
.fat__chipnr   { font-variant-numeric: tabular-nums; color: var(--mute); }
/* The section pill in each accordion head carries the SectionResult's own value
   as its modifier, so these are the chips' three tones again — the pill said
   `--released` for any signature, and "Nicht bestanden" read green two inches
   under a red chip. Soft, like every other status pill: `--c` at 22%, not a
   fill, so the alarm tone here is not one of design_rotocon_2.md §2.3's reds. */
.status-pill--passed         { --c: var(--ok); }
.status-pill--failed         { --c: var(--s-alarm); }
.status-pill--not_applicable { --c: var(--mute); }
.fat__section  { margin: 0 0 0.75rem; }
.fat__sectionhead { display: flex; align-items: center; justify-content: space-between;
                    gap: 0.75rem; cursor: pointer; }
/* The heading carries .doc__subtitle's bottom margin, which inside a one-line
   summary pushes the pill off the baseline. */
.fat__sectionhead .doc__subtitle { margin: 0; }
.fat__signoff  { border-top: 1px solid var(--line); margin-top: 0.75rem;
                 padding-top: 0.75rem; }
.fat__criteria { color: var(--mute); font-size: 0.85rem; margin: 0 0 0.5rem; }
.fat__signed   { display: grid; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
                 gap: 0.5rem 1rem; margin: 0 0 0.5rem; }
.fat__signed dt { color: var(--mute); font-size: 0.8rem; }
.fat__signed dd { margin: 0; }
.fat__wide     { grid-column: 1 / -1; }
/* Wie/Aktion and Offene Maßnahmen are sentences, not words: the same share of
   the row .field-inline--remark takes, without redefining that modifier. */
.fat__field--wide { flex: 1 1 18rem; }
/* Every section is collapsed, so the gate's blockers are followed by
   static/js/fat_sections.js, which opens the drawer and calls scrollIntoView.
   Without this the target lands at viewport top, under the sticky topbar —
   the same reason .kiosk__step carries one. */
.fat__section, .fat .step-row { scroll-margin-top: calc(var(--topbar-h) + 0.75rem); }

/* Doc 182's closing clause. The task list is a numbered <ol> because the
   paper numbers them and the print sheet prints that number. */
.fat__agreement { margin: 0.5rem 0 0; }
.fat__subhead   { font-size: 0.9rem; margin: 0.75rem 0 0.35rem; }
.fat__tasks     { margin: 0; padding-left: 1.5rem; display: flex;
                  flex-direction: column; gap: 0.35rem; }
.fat__task      { display: flex; flex-wrap: wrap; align-items: baseline;
                  gap: 0.5rem 0.75rem; }
.fat__task.is-closed .fat__tasktext { color: var(--mute); text-decoration: line-through; }
.fat__tasktext  { flex: 1 1 18rem; min-width: 0; }
/* The twelve blank rows are a block of their own inside the row-form, or the
   flex row would lay them out beside Name/Titel/Datum. */
.fat__taskfields { flex: 1 1 100%; border: 0; margin: 0.25rem 0 0; padding: 0; min-width: 0; }
.fat__taskfields legend { float: none; width: auto; padding: 0; margin-bottom: 0.35rem; }
@media (max-width: 40rem) { .fat__chipname { display: none; } }

/* --- The employee's row: two pick-lists, one text field, nothing else to type.
   Sized for a tablet in the hall (44px touch targets). --- */
.cell-inputs { padding: 0.5rem 0.75rem; }
.row-form { display: flex; flex-wrap: wrap; gap: 0.5rem 0.75rem; align-items: flex-end; }
.field-inline { display: flex; flex-direction: column; gap: 0.2rem; min-width: 0; }
.field-inline__label {
  color: var(--mute); font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.06em;
}
.field-inline--remark { flex: 1 1 18rem; }
/* The remark is a button on the row and a window on top of it. The button
   has to read like the field it replaced — one line, the text cut off where
   the column ends — because 52 rows of wrapped sentences would bury the
   checklist the sheet exists for. The whole text is one tap away. */
.remark-btn {
  display: block; width: 100%; text-align: left; cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.remark-btn.is-empty { color: var(--mute); }
.remark-dialog {
  /* cockpit.css's reset (`* { margin: 0 }`) also hits <dialog>, and a modal
     dialog centres itself through `margin: auto` — without this the window
     opens pinned to the top left corner, over the topbar. */
  margin: auto;
  width: min(64rem, 92vw); max-width: 92vw; border: 1px solid var(--line);
  border-radius: var(--radius); background: var(--ink-800); color: var(--bone);
  padding: 1rem; box-shadow: 0 1.5rem 3rem rgba(0, 0, 0, 0.45);
  /* Seven tappable presets make a tall window. Measured at 1280x620 before
     this: the browser capped the dialog itself and put Abbrechen/Speichern
     behind its own scrollbar, so the way to save left the screen. The window
     is a column that never scrolls; the list inside it does (below), which
     keeps the step, the field and the two buttons where they were. */
  max-height: calc(100vh - 2.5rem);
  display: flex; flex-direction: column; overflow: hidden;
}
.remark-dialog::backdrop { background: rgba(0, 0, 0, 0.55); }
/* A browser too old for showModal() gets the same panel inline; both of them
   need the closed dialog to stay out of the way. */
.remark-dialog:not([open]) { display: none; }
.remark-dialog__step { margin: 0 0 0.6rem; color: var(--mute); font-size: 0.9rem; }
.remark-dialog__nr { color: var(--bone); font-weight: 600; margin-right: 0.4rem; }
.remark-dialog .js-remark {
  width: 100%; min-height: 9rem; resize: vertical; font-size: 1rem; line-height: 1.45;
}
/* The recurring remarks are tapped, not chosen from a dropdown — the
   Kurzanleitung says so to the hall and slide 7 of the wireframe draws it.
   A single column in the order presets.py declares them: the list is read top
   to bottom, and columns would reshuffle it on a narrower tablet. */
.remark-dialog .remark-presets {
  display: flex; flex-direction: column; gap: 0.35rem; margin-top: 0.7rem;
  /* The one part of the window allowed to scroll. `min-height: 0` is what
     makes that possible: a flex item will not shrink below its content
     height without it, and the clamp above would do nothing. */
  flex: 1 1 auto; min-height: 0; overflow-y: auto;
}
.remark-preset {
  min-height: 44px;                /* the same gloved-finger target as the row */
  width: 100%; text-align: left; padding: 0.5rem 0.75rem; cursor: pointer;
  background: var(--ink-700); color: var(--bone);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  font: inherit; font-size: 0.95rem;
}
.remark-preset:hover, .remark-preset:active { background: var(--ink-600); }
.remark-preset:focus-visible { outline: 2px solid var(--bone); outline-offset: 2px; }
.remark-dialog__actions {
  display: flex; justify-content: flex-end; gap: 0.5rem; margin-top: 0.8rem;
}
.remark-dialog__actions .btn { min-height: 44px; }
/* The microphone keeps to the left of Abbrechen/Speichern, thumb-sized: in
   the window it is an action like the other two, not a decoration hanging
   off the corner of the field. */
.remark-dialog__voice { margin-right: auto; display: flex; align-items: center; min-width: 0; }
.remark-dialog__voice .voice-btn {
  margin-left: 0; min-height: 44px; padding: .45rem .8rem; font-size: 1.15rem;
}
.remark-dialog__voice .voice-msg { margin-left: .5rem; }
.field-inline--date { justify-content: flex-end; padding-bottom: 0.55rem; }
.row-form .form-select,
.row-form .form-control { min-height: 40px; font-size: 0.85rem; }
.row-form .form-select { min-width: 6.5rem; }
/* A Doc-181 count is three digits at most — `quantity` is a smallint — so the
   control must not take the whole row the way `.form-control`'s own width:100%
   does inside this wrapping flex. Scoped like `.doc-upload .form-control` and
   `.board-filters .form-control`; only a row that HAS a number input is
   affected, so the electrical annex keeps the layout it has today. */
.row-form input[type="number"] { max-width: 7rem; }
.row-save { min-height: 40px; }
.step-row.is-done .row-form .form-select[name="done"] { border-color: var(--ok); color: var(--ok); }

@media (max-width: 1280px) {
  .row-form .form-select, .row-form .form-control, .row-save { min-height: 44px; }
  /* Fixed column widths are for the printed sheet; on a tablet let the step text
     take the room it needs and the inputs wrap under it. */
  .doc__table { font-size: 0.86rem; table-layout: auto; }
  .doc__table .col-nr { width: 2.5rem; }
  .cell-step { min-width: 15rem; }
  .field-inline--remark { flex: 1 1 60%; }   /* keeps Save on the same line */
}
.doc__freigabe { margin-top: 0.5rem; }
.freigabe-note { margin: 0; }

/* The way back at the foot of a document screen. The topbar carries the same
   link, but `.topbar__back` is hidden under 700px and on a tablet it has
   scrolled away by the last row — so a long list ends with it too. Thumb-sized
   from the tablet down, like the row controls above. */
.doc__foot { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1.25rem; }
@media (max-width: 1280px) { .doc__foot .btn { min-height: 44px; } }
/* Never on paper. The sheet printed from this page is punched and filed at the
   machine, and a navigation button in the archive is noise — the print block
   further down hides `.row-save` and the presets for the same reason. */
@media print { .doc__foot { display: none !important; } }

/* --- Accessories: deliveries that arrive with a ROT number, or without one --- */
.acc-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.acc-list__item {
  display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: baseline;
  padding: 0.4rem 0; border-bottom: 1px solid var(--line); font-size: 0.85rem;
}
.acc-list__item:last-child { border-bottom: 0; }
.doc__accessories { margin-bottom: 0.25rem; }
.assign-form { display: flex; gap: 0.35rem; align-items: center; flex-wrap: wrap; }
.assign-form .form-select { min-width: 10rem; }

/* A step waiting on a delivery: open, visibly parked, and it holds the gate. */
.step-row.pending-delivery { background: rgba(255, 176, 32, 0.06); }
.step__pending {
  display: block; margin-top: 0.3rem;
  color: var(--warn); font-size: 0.72rem; font-weight: 600;
}
.step__pending::before { content: "⏳ "; }

/* A plan that runs backwards — this section starts before an earlier one ends
   (owner, 2026-10-15: ROT224E-D ships 08.05 and arrives 12.10). Same shape as
   .step__pending above on purpose: --warn, small, a glyph, under the name it
   belongs to. Not red — red is the Projektplan's word for an actual delay, and
   this is a plan nobody has run into yet. */
.schedule__warn {
  display: block; margin-top: 0.25rem;
  color: var(--warn); font-size: 0.72rem; font-weight: 600;
}
/* The literal glyph, like .step__pending above: in `content: "\26A0 "` the
   space terminates the hex escape instead of being printed, so the text ran
   straight into the sign. */
.schedule__warn::before { content: "⚠ "; }

/* --- Annexes and what still blocks the gate --- */
.annex-list, .blocker-list { list-style: none; margin: 0; padding: 0; }
.annex-list__item {
  display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center;
  padding: 0.4rem 0; border-bottom: 1px solid var(--line); font-size: 0.85rem;
}
.annex-list__item:last-child { border-bottom: 0; }
.annex-list__item .qm-progress { margin-left: auto; min-width: 12rem; }
.annex-hint { font-size: 0.76rem; margin: 0.6rem 0 0; }
.doc__blockers { border-left: 3px solid var(--warn); }
.blocker-list li {
  font-size: 0.85rem; padding: 0.25rem 0 0.25rem 1.1rem; position: relative;
}
.blocker-list li::before { content: "•"; position: absolute; left: 0; color: var(--warn); }
/* Each line is the way to the work it names. `a { color: inherit }` leaves a
   link indistinguishable from the sentence around it, so the affordance is
   the rule underneath, in the same warn colour as the bullet. */
.blocker-list a { color: inherit; border-bottom: 1px solid var(--warn); }
.blocker-list a:hover, .blocker-list a:focus-visible {
  color: var(--bone, #F4F2EF); border-bottom-color: currentColor;
}

/* --- Maschinenmappe --- */
.mappe__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0.75rem 1.5rem; margin: 0 0 0.75rem; }
.mappe__grid dt { color: var(--mute); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.05em; }
.mappe__grid dd { margin: 0.15rem 0 0; font-size: 0.9rem; }
.mappe__wide { grid-column: 1 / -1; }
.doc-list { list-style: none; margin: 0 0 0.75rem; padding: 0; }
.doc-list__item { display: flex; flex-wrap: wrap; gap: 0.75rem; padding: 0.3rem 0; border-bottom: 1px solid var(--line); font-size: 0.85rem; }
.doc-list__item:last-child { border-bottom: 0; }
.doc-upload { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; }
.doc-upload .form-control, .doc-upload .form-select { font-size: 0.82rem; max-width: 16rem; }

/* --- Photographic evidence on a step --- */
.step__photos { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-top: 0.35rem; }
.step__photo {
  width: 54px; height: 54px; object-fit: cover;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm); display: block;
}
/* The remove button sits on the thumbnail's own corner rather than beside it:
   a row of 54px pictures with a button next to each one wraps after two. */
.step__photo-item { position: relative; display: block; line-height: 0; }
.step__photo-del { position: absolute; top: -5px; right: -5px; line-height: 0; }
.step__photo-delbtn {
  width: 18px; height: 18px; padding: 0; border-radius: 50%;
  border: 1px solid var(--line-strong); background: var(--ink-700);
  color: var(--s-alarm-text); font-size: 0.8rem; line-height: 1; cursor: pointer;
}
.step__photo-delbtn:hover { background: var(--s-alarm); color: var(--s-alarm-ink); }

/* The "Fotos" menu (owner's mockup, 22.10.2026). Chips, not a tab strip: a tab
   strip promises one of them is always current, and here nothing is open until
   somebody asks for it. The count rides on the chip, so "is there any transport
   damage on this machine" is answered without opening anything. */
.photo-bar { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.photo-bar__item {
  display: inline-flex; align-items: center; gap: 0.5rem; cursor: pointer;
  min-height: 44px; padding: 0.45rem 0.9rem;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--ink-700); color: var(--bone); font-size: 0.9rem;
}
.photo-bar__item:hover { background: var(--ink-600); }
.photo-bar__count {
  min-width: 1.6rem; padding: 0 0.35rem; text-align: center; border-radius: 999px;
  background: var(--ink-800); color: var(--mute);
  font-size: 0.8rem; font-variant-numeric: tabular-nums;
}
.photo-dialog {
  /* Same reason as .remark-dialog: cockpit.css's `* { margin: 0 }` also hits
     <dialog>, and a modal centres itself through `margin: auto`. */
  margin: auto;
  width: min(72rem, 92vw); max-width: 92vw; border: 1px solid var(--line);
  border-radius: var(--radius); background: var(--ink-800); color: var(--bone);
  padding: 1rem; box-shadow: 0 1.5rem 3rem rgba(0, 0, 0, 0.45);
}
.photo-dialog::backdrop { background: rgba(0, 0, 0, 0.55); }
.photo-dialog:not([open]) { display: none; }
.photo-dialog__head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; margin-bottom: 0.8rem;
}
.photo-dialog__title { margin: 0; font-size: 1.05rem; }
.photo-dialog__empty { margin: 0; }
.photo-grid {
  list-style: none; margin: 0; padding: 0; display: grid; gap: 0.9rem;
  grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr));
  max-height: 70vh; overflow-y: auto;
}
.photo-card { display: flex; flex-direction: column; gap: 0.25rem; min-width: 0; }
.photo-card__img {
  width: 100%; height: 9rem; object-fit: cover; display: block;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
}
.photo-card__caption { font-size: 0.9rem; }
/* The step the picture was taken at, clamped to two lines — a checklist
   sentence is long, and the picture is what the card is for. */
.photo-card__step {
  font-size: 0.8rem; color: var(--mute); line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.photo-card__who { font-size: 0.75rem; }
.step__photo-locked {
  position: absolute; bottom: -2px; right: -2px;
  font-size: 0.65rem; line-height: 1; opacity: 0.75;
}
.step__photo-add summary { color: var(--mute); }
.status-pill--open { --c: var(--warn); }
.status-pill--sent { --c: var(--info); }
.status-pill--accepted { --c: var(--ok); }
.status-pill--rejected { --c: var(--s-alarm); }
.status-pill--closed { --c: var(--mute); }

/* --- Generic form card --- */
.form-card { max-width: 640px; }
.form-actions { display: flex; gap: 0.5rem; margin-top: 1.25rem; }

/* --- Auth: the plain shell (the card, the background film and its dimming,
   the fields, the password hints) is cockpit.css's. QM adds the EN/DE toggle
   above the card — lifted above the film's dimming layer like the logo and
   the card (z-index 2) — and its own alarm colour for errors. --- */
.auth .lang-toggle { position: relative; z-index: 2; margin: 0 0 1.5rem; }
/* Alarm-red text on --ink-800: the text-safe variant, never --rot-bright. */
.auth__errors { color: var(--s-alarm-text); }

/* --- Phone: the sheet stops being a table and becomes one card per step.
   A technician in the hall scrolls and picks; nothing scrolls sideways. --- */
@media (max-width: 700px) {
  /* The sidebar already covers navigation; the topbar keeps only what is acted on. */
  .topbar__back { display: none; }
  .doc__kopf { grid-template-columns: 1fr; }
  .doc__counters { grid-template-columns: repeat(3, 1fr); }
  .table-wrap { overflow-x: visible; }
  .doc__table, .doc__table tbody, .doc__table tr, .doc__table td, .doc__table th { display: block; width: auto; }
  .doc__table thead { display: none; }
  .doc__table { border: 0; background: none; }
  /* The annex still renders .step-row as a table row and needs the card here;
     the accordion on the machine page is already carded at every width. */
  .step-row {
    background: var(--ink-800);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    margin-bottom: 0.5rem;
    padding: 0.75rem;
    position: relative;
  }
  .step-row .cell-num {
    position: absolute; top: 0.75rem; right: 0.75rem;
    font-size: 0.72rem; opacity: 0.7;
  }
  .cell-step { padding: 0 3rem 0.6rem 0; min-width: 0; }
  .row-form { gap: 0.6rem; }
  .field-inline, .field-inline--remark { flex: 1 1 100%; }
  .remark-presets { max-width: none; }
  /* A phone gets the window edge to edge — there is nothing to see behind it,
     and the writing field takes every row that is left over rather than
     leaving half the screen empty under the buttons. */
  .remark-dialog { width: 100vw; max-width: 100vw; height: 100dvh; border-radius: 0; }
  .remark-dialog[open] { display: flex; flex-direction: column; }
  .remark-dialog .js-remark { flex: 1 1 auto; min-height: 40dvh; }
  .photo-dialog { width: 100vw; max-width: 100vw; height: 100dvh; border-radius: 0; }
  .photo-dialog[open] { display: flex; flex-direction: column; }
  .photo-grid { max-height: none; flex: 1 1 auto; }
  .photo-bar__item { flex: 1 1 10rem; justify-content: space-between; }
  .row-save { width: 100%; justify-content: center; }
  .phase__steps { padding-left: 0.35rem; padding-right: 0.35rem; }
  .step-row.is-done { opacity: 0.85; }
}

@media print {
  @page { size: A4 landscape; margin: 12mm; }
  :root { color-scheme: light; }
  .app__sidebar, .app__topbar, .sidebar-backdrop, .remark-save, .js-print { display: none !important; }
  .app { display: block; height: auto; overflow: visible; }
  .app__main { overflow: visible; padding: 0; }
  body, .app__main { background: #fff !important; color: #000 !important; }
  .doc__kopf, .card, .btable { background: #fff !important; border-color: #999 !important; }
  .doc__head { border-bottom: 2px solid #000; }
  .doc__title, .doc__subtitle, .doc__kopf dd, .step__text { color: #000 !important; }
  .doc__meta, .doc__kopf dt, .cell-muted, .cell-phase { color: #444 !important; }
  .step__note { color: #7a5200 !important; }
  .doc__table { font-size: 9pt; }
  .doc__table thead { display: table-header-group; }   /* repeat the header on every page */
  .doc__table th, .doc__table td { border-bottom: 1px solid #bbb !important; }
  .phase-row th { background: #e8ecf5 !important; color: #000 !important; border-left: 3px solid #000; }
  .sublabel-row td { background: #f4f4f4 !important; color: #000 !important; }
  .step-row { break-inside: avoid; }
  .status-pill { border: 1px solid #666; color: #000 !important; background: none !important; }
  .status-pill::before { display: none; }
  .remark-btn {
    white-space: pre-wrap !important; overflow: visible !important;
    text-overflow: clip !important; width: auto !important;
  }
  .row-save, .field-inline__label, .remark-presets, .step__recheck,
  .step__challenge-actions, .step__photos, .doc-upload { display: none !important; }
  .step__challenge { border-left: 3px solid #b4791a; background: #fff7e6 !important; }
  .step__challenge-note, .step__by { color: #000 !important; }
  .row-form { display: table-row; }
  .row-form .form-select, .row-form .form-control {
    border: 0 !important; background: none !important; color: #000 !important;
    padding: 0 !important; min-height: 0 !important; -webkit-appearance: none; appearance: none;
  }
  .doc__table .cell-phase, .doc__table thead th:nth-child(2) { display: table-cell !important; }
  .progress { border: 1px solid #666; }
  .progress-bar { background: #666 !important; }
  /* Board classes added after this print block existed: each paints a
     screen-only fill (coloured shipping chip, coloured group-bar accent)
     that would otherwise print as a solid block. */
  .ship-chip, .ship-chip--overdue, .ship-chip--due {
    background: none !important; color: #000 !important; border: 1px solid #666;
  }
  .group__bar { border-left-color: #666 !important; }
  .group__dist { background: none !important; border: 1px solid #666; }
  .group__dist-seg { background: none !important; }
}

/* Wareneingang — the goods-receipt list */
.card__title { margin-bottom: .9rem; font-size: 1.05rem; }
.plain-list { list-style: none; margin: 0; padding: 0; }
.plain-list li { padding: .35rem 0; border-bottom: 1px solid var(--line); }
.plain-list li:last-child { border-bottom: 0; }

/* Wareneingang — the review screen */
.doc-preview { width: 100%; height: 420px; border: 1px solid var(--line); border-radius: 8px; object-fit: contain; }
.position { padding: .75rem 0; border-bottom: 1px solid var(--line); }
.position--uncertain { border-left: 3px solid var(--warn); padding-left: .75rem; }
/* Below the translation, not above it: the paper is one glance away without
   the eye leaving the field being corrected. */
.position__source { margin: .35rem 0 0; font-size: .85rem; opacity: .7; }
/* Wareneingang — accepting a position into stock */
.position__tick { display: inline-flex; gap: .4rem; align-items: center; margin-top: .4rem; font-size: .9rem; }
.position__booked { margin: .4rem 0 0; font-size: .85rem; }
.form-inline-end { display: flex; gap: .5rem; margin-top: 1rem; }

/* The review screen on a phone or a tablet held in one hand. Bootstrap's .col-*
   classes are not breakpoint-scoped, so the four position fields stay on one
   row at 390px and the quantity truncates to a character or two — unreadable,
   and it is the field the keeper most often has to correct. Below Bootstrap's
   sm breakpoint each field takes the full width instead; the desktop layout
   above 576px is untouched. */
@media (max-width: 575.98px) {
  .position__fields > [class^="col-"],
  .position__fields > [class*=" col-"] { flex: 0 0 auto; width: 100%; }
  /* `.doc__fields` too: the supplier select lives in that list beside the
     scan, not among the position fields, and was left at Bootstrap's small
     size — under a thumb on the hall tablet. */
  .position__fields .form-control,
  .position__fields .form-select,
  .doc__fields .form-control,
  .doc__fields .form-select { min-height: 44px; font-size: 1rem; }
  .doc-preview { height: 320px; }
}

/* Lager — wide tables stay reachable on a phone.
   `.table-wrap` already exists (cockpit.css) and already scrolls — but the
   phone media query above (`.table-wrap { overflow-x: visible; }`) turns
   that off on purpose for `.doc__table`, which restacks into one card per
   row at that width and has nothing left to scroll. Every other screen that
   reuses plain `.table-wrap` (home, machine list, claims, accessory list)
   shares that same rule. A second, bare `.table-wrap { overflow-x: auto }`
   here would only re-open the same fight the existing rule already settled
   for those screens — so this is scoped to a modifier class the stock and
   article templates opt into, `.table-wrap--scroll`, which nothing else
   uses. */
.table-wrap--scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-wrap--scroll > .table { min-width: 34rem; }
/* --- Gantt (WP6, redesigned per docs/superpowers/sdd/2026-09-25-qm-board-design):
   days are grid columns, a bar sets grid-column directly — no charting
   library, so the page stays inside the CSP and prints for the wall.
   `.gantt` itself now carries the exact same grid-template-columns as
   `.gantt__head` and `.gantt__row` (name column + one column per day): that
   lets a handful of full-height overlay items — the today line, the weekend
   tint — sit in the outer grid, placed with the identical `grid-column`
   numbers the day header uses. Never a second, hand-tuned position for
   either. `.gantt__head` and `.gantt__row` each also still establish their
   OWN nested grid for their bars, so there is no per-row drift to chase.

   The today line (.gantt__today, further down) does NOT get its height from
   `grid-row: 1 / -1` — that was tried and ships zero height in production.
   `.gantt` never declares `grid-template-rows`, so its explicit row grid has
   no tracks; line -1 then coincides with line 1 (both are "the last line of
   the explicit grid", which is also its only line), collapsing the span to
   nothing. Rows only exist as *implicit* tracks, added by `.gantt__head`/
   `.gantt__row` themselves, and implicit tracks never move where -1 points.
   So the line is instead pinned by position: absolute (top: 0; bottom: 0),
   anchored to `.gantt`, which this rule now makes the containing block via
   position: relative — that stretches it to the chart's actual rendered
   height regardless of row count. Its grid-column placement is untouched,
   so the horizontal position still comes from the same grid the day cells
   use; only the vertical mechanism changed. --- */
.gantt {
  --gantt-name-w: 220px;
  min-width: 56rem;
  display: grid;
  position: relative;
}
.gantt,
.gantt__head,
.gantt__row {
  grid-template-columns: var(--gantt-name-w) repeat(var(--days), 1fr);
}
.gantt__head,
.gantt__row {
  display: grid;
  grid-column: 1 / -1;
  align-items: center;
  min-height: 38px;
}
.gantt__head {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--ink-900);
  border-bottom: 1px solid var(--line-strong);
  padding-bottom: 0.4rem;
}
/* The month band adds a second internal header row — but `.gantt__head` is
   shared with the staff and Europe Gantts, neither of which renders one, so
   the two-row split is scoped to this modifier (set only in
   templates/machines/schedule.html) rather than the bare element. Without
   this scoping those other headers would gain a blank first row for nothing
   to sit in. */
.gantt__head--banded { grid-template-rows: auto auto; }
.gantt__head--banded .gantt__name { grid-row: 1 / 3; align-self: center; }
.gantt__head--banded .gantt__day { grid-row: 2; }
/* No border-bottom here any more: on a short row it read as a label sitting
   above an underlined form field, not a Gantt row. Row rhythm now comes from
   the shrunk, consistent 38px height alone (print keeps a rule — see
   @media print — because a paper poster still benefits from one). */
.gantt__row { padding: 0.15rem 0; }
/* Empty window (templates/europe/gantt.html): the message and the two
   "nearest bars" links sit on one line under the day header instead of
   wrapping inside the name column. */
.gantt__empty {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  padding: 0.75rem 0.25rem;
}
.gantt__empty p { margin: 0; }
.gantt__name {
  grid-column: 1;
  grid-row: 1;
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
  padding-right: 0.75rem;
  font-size: 0.85rem;
  line-height: 1.2;
  min-width: 0;
}
.gantt__name .cell-muted {
  font-size: 0.7rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* Standzeit, beside the ROT number. Kept when it exists, but it is no longer
   the loudest thing in the cell — the alarm colour moved to the standing-time
   bar itself (.gantt__gap, below), which now spells out *why* the row looks
   empty. This note stays a quiet cross-reference to that bar. */
.gantt__idle {
  font-size: 0.66rem;
  color: var(--mute);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.gantt__idle.is-standing { color: var(--warn); }
.gantt__idle.is-standing strong { color: var(--mute); font-weight: 600; }
/* Month band (WP-redesign): grouped from the exact `days` list the day cells
   below are drawn from (machines/schedule_services.py: month_bands) — never
   a second date range — so a label cannot drift off its own days the way the
   reviewed mockup's did. */
.gantt__month {
  grid-row: 1;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-align: center;
  color: var(--mute);
  padding-bottom: 0.15rem;
  border-bottom: 1px solid var(--line);
}
.gantt__day {
  grid-row: 1;
  font-size: 0.68rem;
  text-align: center;
  color: var(--mute);
  font-variant-numeric: tabular-nums;
}
.gantt__day.is-today { color: var(--bone); font-weight: 600; }
/* Weekends (WP-redesign): a Saturday/Sunday column reads as a faint tint the
   whole height of the chart, computed from the same `weekend_columns(days)`
   the header's own `.is-weekend` day cells come from. */
.gantt__day.is-weekend { color: var(--mute); opacity: 0.72; }
/* The one-time "Today" tag: attached to the header's own `.is-today` day
   cell via `::after` (content supplied by the template's `data-today-label`
   attribute, present on that single cell only), never to the per-row line —
   the reviewed mockup printed "TODAY" on every row because its label rode
   along with a line that *was* drawn once per row. Here the vertical accent
   (.gantt__today, further down) carries no text of its own, so there is
   structurally only one place this string can ever render. */
.gantt__head .gantt__day.is-today { position: relative; }
.gantt__head .gantt__day.is-today::after {
  content: attr(data-today-label);
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-top: 2px;
  font-size: 0.58rem;
  font-weight: 600;
  color: var(--s-alarm-text);
  white-space: nowrap;
}
.gantt__bar {
  grid-row: 1;
  height: 26px;
  line-height: 26px;
  border-radius: var(--radius-sm);
  padding: 0 0.4rem;
  font-size: 0.72rem;
  overflow: hidden;
  white-space: nowrap;
  color: var(--c);
  background: color-mix(in srgb, var(--c) 22%, transparent);
}
/* Reuse the machine status pills' colour tokens (spec §6): open ≈ intake,
   in progress, done ≈ released — the same three-state meaning. */
.gantt__bar--offen          { --c: var(--info); }
.gantt__bar--in_bearbeitung { --c: var(--warn); }
.gantt__bar--erledigt       { --c: var(--ok); }
.gantt__bar.is-derived { border: 1px dashed var(--c); background: transparent; }
/* Standing time (WP-redesign): a dashed outline in the alarm colour that
   explains itself — "standing 253 d — nothing planned" — instead of a
   diagonal hatch with a bare number nobody could read without hovering.
   Text is --s-alarm-text (the AA-safe variant): plain --s-alarm fails
   contrast as *text* on this dark surface (see that token's own comment,
   above, in this file). The fill is the same translucent tint the status
   pills use, at --s-alarm's hue. Every gap kind (leading/between/trailing/
   whole) shares this look — all four are the same fact, nothing scheduled
   here — and every gap always shares its bar's own start/end columns
   (machines/schedule_services.py: _standing_span butts up against the
   bars it sits beside), so the two never draw with a different span. */
.gantt__gap {
  grid-row: 1;
  height: 26px;
  line-height: 26px;
  text-align: center;
  font-size: 0.68rem;
  color: var(--s-alarm-text);
  overflow: hidden;
  white-space: nowrap;
  border-radius: var(--radius-sm);
  border: 1px dashed var(--s-alarm-text);
  background: var(--s-alarm-soft);
}
.gantt__nav { display: flex; gap: 0.4rem; }
/* The today line and the weekend tint: both are outer-grid items (see the
   comment at the top of this section) placed once, spanning every row.
   The line's height comes from position: absolute + top/bottom (see the
   comment at the top of this section for why grid-row: 1 / -1 alone does
   not work here) — grid-column stays as the only source of its horizontal
   position, unchanged, still driven by the same day-column numbers the
   header uses. */
.gantt__today {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  justify-self: center;
  background: var(--s-alarm-text);
  pointer-events: none;
}
.gantt__weekend {
  grid-row: 1 / -1;
  background: rgba(255, 255, 255, 0.035);
  pointer-events: none;
}
/* The folded group of machines with nothing to show in this window (§3):
   the same .group/.group__bar/<details> shell the Machines board uses
   (spec: templates/machines/list.html), so the two pages fold alike. */
.gantt__fold { margin-top: var(--sp-3); }
.gantt__fold-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.15rem; }
.gantt__fold-row {
  display: flex; align-items: baseline; flex-wrap: wrap; gap: 0.5rem;
  padding: 0.3rem 0.25rem;
  border-bottom: 1px solid var(--line, rgba(255, 255, 255, .07));
  font-size: 0.85rem;
}
.gantt__fold-row:last-child { border-bottom: 0; }
.gantt__fold-row .cell-muted { font-size: 0.72rem; }
.gantt__fold-row .gantt__idle { margin-left: auto; }
/* Staff view (WP7): absence bands share the bar's box model but a hatched
   fill at the opposite angle from .gantt__gap, so "off the floor because
   nobody scheduled them here yet" (a gap) never reads the same as "off the
   floor because they are unavailable" (an absence). */
.gantt__absence {
  grid-row: 1;
  height: 26px;
  line-height: 26px;
  text-align: center;
  font-size: 0.68rem;
  color: var(--mute);
  overflow: hidden;
  white-space: nowrap;
  border-radius: var(--radius-sm);
  background: repeating-linear-gradient(-45deg, transparent, transparent 3px,
              var(--line-strong) 3px, var(--line-strong) 6px);
}
/* Two tracks, absences above assignments. Both used to sit on grid-row 1, and
   the template emits absences first — so an assigned bar painted straight over
   the holiday band underneath it. "Assigned while on Urlaub" is precisely what
   the meeting asked this view to reveal, and it was the one case it could not
   draw. The machine Gantt keeps a single track: its bars, gaps and standing
   spans never share a column, so a second row would only make the poster
   taller. Each element names its own row inline, next to its grid-column. */
.gantt__row--staff {
  grid-template-rows: 18px 26px;
  row-gap: 2px;
  align-items: stretch;
}
.gantt__row--staff .gantt__absence { height: 18px; line-height: 18px; }
.gantt__row--staff .gantt__name { justify-content: center; }

@media print {
  .table-wrap { overflow-x: visible; }
  .gantt { min-width: 0; }
  .gantt__head { position: static; background: #fff !important; border-color: #999 !important; }
  .gantt__day, .gantt__name .cell-muted { color: #444 !important; }
  .gantt__month { color: #000 !important; border-bottom-color: #999 !important; }
  /* Row rule removed on screen (see .gantt__row, above) but restored here:
     a printed poster reads 42 day columns across, and a horizontal rule is
     what keeps a row legible edge to edge on paper. */
  .gantt__row { border-bottom: 1px solid #ccc !important; }
  .gantt__gap {
    color: #000 !important;
    background: transparent !important;
    border: 1px dashed #000 !important;
  }
  /* The standing days are the reason the poster goes on the wall. */
  .gantt__idle, .gantt__idle.is-standing, .gantt__idle.is-standing strong {
    color: #000 !important;
  }
  .gantt__absence {
    color: #000 !important;
    background: repeating-linear-gradient(-45deg, transparent, transparent 3px,
                #bbb 3px, #bbb 6px) !important;
  }
  /* The two staff tracks have to survive the wall poster: on paper the
     hatching is the only thing separating a booked bar from the absence it
     collides with, so the rows must stay apart rather than collapse. */
  .gantt__row--staff { grid-template-rows: 18px 26px !important; row-gap: 2px !important; }
  .gantt__nav { display: none !important; }
  /* The today line and weekend tint are wall-poster information too (the
     poster answers "where are we now" as much as the screen does) — just
     redrawn print-safe: solid black over white, no translucent dark-theme
     colours that would vanish or fill the page grey. */
  .gantt__today { background: #000 !important; }
  .gantt__head .gantt__day.is-today::after { color: #000 !important; }
  .gantt__weekend { background: rgba(0, 0, 0, 0.06) !important; }
  /* The fold stays exactly as rendered (closed unless a machine opened it
     on screen first) — the same collapsed-by-default state the Machines
     board's own <details> groups print in, no extra rule needed for that.
     What *is* forced here: the machine's own alarm accents inside the fold
     print legibly too, same as the open list above. */
  .gantt__fold-row { border-bottom-color: #ccc !important; }
}

/* Abweichung — the finding is meant to be seen from across the hall. */
.deviation { display: block; margin: .4rem 0; padding: .45rem .6rem;
  border-left: 3px solid var(--mute); border-radius: 4px;
  background: rgba(255, 255, 255, .03); }
.deviation--minor    { border-left-color: #d6a21a; }
.deviation--major    { border-left-color: #e2701a; }
.deviation--critical { border-left-color: #d33a2c; }
.deviation__head { display: flex; gap: .5rem; align-items: baseline; flex-wrap: wrap; }
.deviation__sev { font-weight: 600; text-transform: uppercase; font-size: .72rem;
  letter-spacing: .04em; }
.deviation__who { font-size: .75rem; opacity: .7; }
.deviation__text { display: block; margin-top: .2rem; }
.step__evidence-actions { display: flex; gap: .75rem; flex-wrap: wrap; margin-top: .3rem; }

/* Dictation button — sits right after any [data-voice] field. Absent entirely
   on a browser without MediaRecorder, so no rule here is load-bearing for the
   field it decorates to keep working. */
.voice-btn { margin-left: .35rem; padding: .3rem .5rem; line-height: 1;
  border: 1px solid var(--line); border-radius: 6px;
  background: transparent; color: inherit; cursor: pointer; }
.voice-btn:disabled { opacity: .5; cursor: default; }
.voice-btn.is-recording { border-color: #d33a2c; background: rgba(211, 58, 44, .15); }
.kiosk .voice-btn { padding: .55rem .8rem; font-size: 1.15rem; }
/* What went wrong, as text. The button's title is a hover tooltip and a tablet
   never shows one, so this span is the only channel the hall actually has. */
.voice-msg { margin-left: .35rem; font-size: .75rem; color: var(--warn); }
.voice-msg:empty { display: none; }
.sev-choice { display: flex; gap: .75rem; margin-bottom: .35rem; flex-wrap: wrap; }
/* The receipt job list on the home page: pick a machine, start its Wareneingang.
   task 18: the action repeats on every row (a work queue, not a call to
   action) so the row itself is the link and the button is a convenience —
   see .joblist__link/.joblist__cta below — and the whole list was tightened
   from ~69px/row to a dense strip. */
.joblist { list-style: none; margin: 0; padding: 0; display: grid; gap: .25rem; }
.joblist__item { border-bottom: 1px solid var(--line, rgba(255,255,255,.07)); }
.joblist__item:last-child { border-bottom: 0; }
.joblist__link {
  display: flex; flex-wrap: wrap; align-items: center; gap: .75rem;
  padding: .45rem .25rem; color: inherit; text-decoration: none;
}
.joblist__link:hover, .joblist__link:focus-visible { background: rgba(255, 255, 255, 0.04); }
.joblist__id { font-weight: 600; }
.joblist__what { color: var(--mute); }
/* task 19: ~600px of dead space between the customer name and the step
   count used to sit here empty. "Waiting N days" now fills it and carries
   the auto-margin that used to push the count to the right, so the layout
   (wait, then progress, then the button) stays packed to the far edge. */
.joblist__wait {
  margin-left: auto;
  color: var(--mute);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.joblist__wait--alarm { color: var(--s-alarm-text); font-weight: 600; }

/* task 19: a small conic-gradient ring beside the step count, replacing the
   bare "0 / 7". `--ring-pct` (0-100, set inline per row) drives the done
   share in --s-released; the rest of the circle is --ink-600. The centre
   disc is punched out in the row's own surface colour (the .card it sits
   in) so the shape reads as a ring, not a filled dot. */
.joblist__progress { display: flex; align-items: center; gap: .5rem; }
.ring {
  --ring-size: 1.7rem;
  width: var(--ring-size); height: var(--ring-size);
  flex: none;
  border-radius: 50%;
  background: conic-gradient(var(--s-released) calc(var(--ring-pct, 0) * 1%), var(--ink-600) 0);
  display: inline-flex; align-items: center; justify-content: center;
}
.ring__hole {
  display: block;
  width: calc(var(--ring-size) - 8px); height: calc(var(--ring-size) - 8px);
  border-radius: 50%;
  background: var(--ink-800);
}
.joblist__steps { font-weight: 600; white-space: nowrap; }
.joblist__cta { pointer-events: none; }

/* --- Help assistant: a button in the bottom right corner, and the panel it
   opens. Sits above the mobile sidebar's z-index 40, and gets out of the way
   entirely while that sidebar is open — two overlays at once on a phone is one
   too many. --- */
.helpbot { position: fixed; right: 1rem; bottom: 1rem; z-index: 50;
  display: flex; flex-direction: column; align-items: flex-end; gap: .6rem; }
body.is-open .helpbot { display: none; }

/* Present mode (Lagebild spec §6, D9): a boardroom screen has no corner
   for a pulsing help button. `present` is put on <body> by the view. */
body.present .helpbot { display: none; }

/* Neon cyan rather than the brand red: red in this interface means act, or
   something is wrong. Help is neither, and on near-black it glows without
   competing with the Save and Accept buttons. One token changes it. */
.helpbot { --neon: #00F0FF; }

/* A round button with the mark and nothing else, the size a thumb expects of
   one in a corner — 56px, the same as every other floating action button the
   people using this have already met on a phone. */
.helpbot__toggle { position: relative; display: inline-flex;
  align-items: center; justify-content: center;
  width: 3.5rem; height: 3.5rem; padding: 0;
  border: 1px solid var(--neon); border-radius: 50%;
  background: var(--ink-700, #1A1A1D); color: var(--bone, #F4F2EF);
  font: inherit; cursor: pointer;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .45);
  animation: helpbot-breathe 2.4s ease-in-out infinite; }
.helpbot__toggle:hover { border-color: #fff; animation-play-state: paused; }

/* The ring that travels outward and fades — the part you see from across the
   hall. It is a pseudo-element rather than more box-shadow so it can scale:
   transform and opacity are the two properties a browser animates on the
   compositor, which matters on the tablets, where anything else means the
   layout is recalculated sixty times a second for decoration. */
.helpbot__toggle::after { content: ""; position: absolute; inset: -1px;
  border-radius: 50%; border: 2px solid var(--neon); pointer-events: none;
  animation: helpbot-ping 2.4s ease-out infinite; }
@keyframes helpbot-ping {
  0%       { transform: scale(1);    opacity: .7; }
  70%, 100% { transform: scale(1.5); opacity: 0; }
}
/* The Bildmarke keeps its own white and red — that is the whole point of a
   logo — so it sits straight on the dark pill rather than inside a coloured
   disc. The neon lives in the glow around it and in the halo below. */
.helpbot__icon { width: auto; height: 1.85rem; flex: none; display: block;
  animation: helpbot-mark-glow 2.4s ease-in-out infinite; }

/* The mark pulses with the pill, a beat of its own on top of the ring. A
   drop-shadow follows the artwork's alpha, so the glow traces the logo's
   shape instead of boxing it. */
@keyframes helpbot-mark-glow {
  0%, 100% { filter: drop-shadow(0 0 2px rgba(0, 240, 255, .45)); }
  50%      { filter: drop-shadow(0 0 7px rgba(0, 240, 255, .95)); }
}

/* A glow that swells and fades, not an on/off blink. WCAG 2.3.1 counts a flash
   as a large enough change in relative luminance, and three a second can
   trigger a seizure; this never goes dark and turns over once every 2.4s. It
   also has to be bearable — the people who see it most are looking at this
   screen all day. */
@keyframes helpbot-breathe {
  0%, 100% { box-shadow: 0 6px 20px rgba(0, 0, 0, .45),
                         0 0 6px rgba(0, 240, 255, .35),
                         0 0 0 0 rgba(0, 240, 255, .45); }
  50%      { box-shadow: 0 6px 20px rgba(0, 0, 0, .45),
                         0 0 20px rgba(0, 240, 255, .75),
                         0 0 0 7px rgba(0, 240, 255, 0); }
}

/* Open, it has been found — no reason to keep asking for attention. */
.helpbot.is-open .helpbot__toggle { border-color: #fff; animation: none;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .45), 0 0 14px rgba(0, 240, 255, .5); }
.helpbot.is-open .helpbot__icon { animation: none;
  filter: drop-shadow(0 0 4px rgba(0, 240, 255, .7)); }
.helpbot.is-open .helpbot__toggle::after { animation: none; opacity: 0; }

/* Somebody who has asked the operating system for less movement gets the neon
   and none of the motion. The button still reads as the lit one on the page. */
@media (prefers-reduced-motion: reduce) {
  .helpbot__toggle { animation: none;
    box-shadow: 0 6px 20px rgba(0, 0, 0, .45), 0 0 14px rgba(0, 240, 255, .5); }
  .helpbot__icon { animation: none; filter: drop-shadow(0 0 4px rgba(0, 240, 255, .7)); }
  .helpbot__toggle::after { animation: none; opacity: .35; }
}

.helpbot__panel { display: flex; flex-direction: column; width: 360px; max-width: calc(100vw - 2rem);
  height: 60vh; max-height: 520px; overflow: hidden;
  border: 1px solid var(--line-strong, rgba(255,255,255,.16)); border-radius: var(--radius, 8px);
  background: var(--ink-800, #141416); box-shadow: 0 18px 48px rgba(0, 0, 0, .6); }
.helpbot__panel[hidden] { display: none; }

.helpbot__head { display: flex; align-items: center; gap: .6rem; flex: none;
  padding: .6rem .75rem; border-bottom: 1px solid var(--line, rgba(255,255,255,.08)); }
.helpbot__title { font-size: .9rem; }
.helpbot__link { margin-left: auto; padding: .1rem .35rem; border: 0; border-radius: 4px;
  background: transparent; color: var(--mute, #8A8A90); font: inherit; font-size: .78rem; cursor: pointer; }
.helpbot__link + .helpbot__link { margin-left: 0; font-size: 1.1rem; line-height: 1; }
.helpbot__link:hover { color: var(--bone, #F4F2EF); }

.helpbot__log { flex: 1 1 auto; min-height: 0; overflow-y: auto;
  padding: .75rem; display: flex; flex-direction: column; gap: .5rem; }
.helpbot__greeting { display: flex; flex-direction: column; gap: .3rem; }
.helpbot__hello { margin: 0; font-family: var(--font-display, inherit);
  font-size: 1.05rem; color: var(--bone, #F4F2EF); }
.helpbot__hint { margin: 0; color: var(--mute, #8A8A90); font-size: .78rem; }

/* pre-wrap, because the answer arrives as plain text with its own line breaks
   and is written with textContent — never as markup. */
.helpbot__msg { margin: 0; padding: .5rem .65rem; border-radius: var(--radius-sm, 5px);
  font-size: .85rem; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.helpbot__msg--you { align-self: flex-end; max-width: 85%;
  background: var(--ink-600, #232327); }
.helpbot__msg--bot { background: rgba(58, 160, 255, .08);
  border-left: 2px solid var(--info, #3AA0FF); }
.helpbot__msg--wait { color: var(--mute, #8A8A90); font-style: italic; }
.helpbot__msg--error { background: rgba(255, 176, 32, .1);
  border-left: 2px solid var(--warn, #FFB020); }
.helpbot__msg--hint { color: var(--mute, #8A8A90); font-size: .78rem; padding: 0; }

.helpbot__form { flex: none; display: flex; gap: .5rem; align-items: flex-end;
  padding: .6rem .75rem; border-top: 1px solid var(--line, rgba(255,255,255,.08)); }
.helpbot__input { flex: 1 1 auto; resize: none; padding: .45rem .55rem;
  border: 1px solid var(--line-strong, rgba(255,255,255,.16)); border-radius: var(--radius-sm, 5px);
  background: var(--ink-900, #0E0E10); color: inherit; font: inherit; font-size: .85rem; }
.helpbot__send { flex: none; }
.helpbot__send:disabled { opacity: .5; cursor: default; }

/* On a phone the panel takes the width it needs and the button loses its word:
   the circle alone is understood, and the thumb reaches the corner. */
@media (max-width: 600px) {
  .helpbot { right: .75rem; bottom: .75rem; }
  .helpbot__panel { width: calc(100vw - 1.5rem); height: 65vh; }
}

/* ---- Europe Machine Overview: the Kanban board -------------------------- */
/* Columns scroll sideways inside .table-wrap--scroll; one per phase, kept
   even when empty, because a gap in the flow is itself worth seeing. */
.kanban { display: flex; gap: 0.75rem; align-items: flex-start; min-width: max-content; }
.kanban__col {
  flex: 0 0 15rem; background: var(--ink-800); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 0.6rem;
}
.kanban__head {
  font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em;
  padding-bottom: 0.4rem; margin-bottom: 0.6rem;
  border-bottom: 2px solid var(--line-strong);
}
.kanban__card {
  background: var(--ink-700); border: 1px solid var(--line);
  border-left: 3px solid var(--line-strong); border-radius: var(--radius-sm);
  padding: 0.5rem; margin-bottom: 0.5rem; font-size: 0.85rem;
}
.kanban__card p { margin: 0.25rem 0; }

@media (max-width: 40rem) {
  /* On a phone the sideways scroll is unusable; stack instead. */
  .kanban { flex-direction: column; min-width: 0; }
  .kanban__col { flex: 1 1 auto; width: 100%; }
}

/* A monday phase label in QM's own colour (settings.EUROPE_PHASE_COLOURS —
   owner ruling 2026-09-27: monday's structure, never monday's hexes). Solid
   fill with the ink readable_on() computes, because several values are dark
   enough that coloured-on-dark text would be unreadable across a workshop. */
.phase-pill {
  display: inline-block; padding: 0.1rem 0.5rem; border-radius: 999px;
  background: var(--phase, var(--ink-600)); color: var(--phase-ink, #fff);
  font-size: 0.75rem; font-weight: 600; white-space: nowrap;
}

/* The microphone voice.js hangs off the question field lands between it and
   Ask. Its status line gets a row of its own rather than squeezing the two:
   in a 360px panel there is no width to give away. */
.helpbot__form { flex-wrap: wrap; }
.helpbot__form .voice-btn { margin-left: 0; }
.helpbot__form .voice-msg { flex: 1 0 100%; margin-left: 0; margin-top: .35rem; }
/* Wareneingang badge. Red because the keeper asked for red: here it means
   "this one is yours", not "something broke". The count sits inside the dot,
   so the message survives a colour-blind eye and a washed-out hall screen —
   the glow is decoration, the number is the content. */
.warehouse-badge { margin-left: .5rem; display: inline-flex; align-items: center;
                   justify-content: center; min-width: 1.3rem; height: 1.3rem;
                   padding: 0 .35rem; border-radius: 999px;
                   background: var(--s-alarm); color: #fff;
                   font-size: .72rem; font-weight: 600; line-height: 1;
                   box-shadow: 0 0 .35rem color-mix(in srgb, var(--s-alarm) 85%, transparent), 0 0 1rem color-mix(in srgb, var(--s-alarm) 45%, transparent); }
@media (prefers-reduced-motion: no-preference) {
  .warehouse-badge { animation: warehouse-pulse 2.4s var(--ease-cinema) 3; }
}
@keyframes warehouse-pulse {
  0%, 100% { box-shadow: 0 0 .35rem color-mix(in srgb, var(--s-alarm) 85%, transparent), 0 0 1rem color-mix(in srgb, var(--s-alarm) 45%, transparent); }
  50%      { box-shadow: 0 0 .5rem color-mix(in srgb, var(--s-alarm) 100%, transparent), 0 0 1.6rem color-mix(in srgb, var(--s-alarm) 75%, transparent); }
}

/* --- Board filter bar (spec §6.2) --- */
.board-filters { display: flex; gap: var(--sp-2); flex-wrap: wrap; margin-bottom: var(--sp-4); }
.board-filters .form-control { width: 260px; }
.board-filters .form-select { width: auto; }
@media (max-width: 40rem) {
  .board-filters { flex-direction: column; }
  .board-filters .form-control, .board-filters .form-select { width: 100%; }
}

/* --- Board groups (spec §6.1). The `.group__bar` shape already exists in
   cockpit.css for the CRM; here it hangs off a <details> so the fold needs
   no JavaScript. --- */
.group { margin-bottom: var(--sp-5); }
.group > summary { list-style: none; cursor: pointer; }
.group > summary::-webkit-details-marker { display: none; }
.group__bar {
  display: flex; align-items: center; gap: var(--sp-2);
  padding: var(--sp-1) 0 var(--sp-1) var(--sp-3);
  margin-bottom: var(--sp-2);
  border-left: 3px solid var(--g, var(--mute));
}
/* cockpit.css asks for 700 here; the app loads 400/500/600 (D10), so 700 would
   be synthetic bold. Same weight as every other emphasised label in qm.css. */
.group__bar { font-weight: 600; }
.group__bar::before { content: "▸"; color: var(--g, var(--mute)); font-size: 10px; }
.group[open] > summary .group__bar::before { content: "▾"; }
.group__name { font-size: var(--fs-body); font-weight: 600; color: var(--g, var(--bone)); }
.group__count {
  font-size: var(--fs-label); color: var(--mute);
  background: var(--ink-700); border-radius: 999px; padding: 1px 8px;
}
.group__overdue { margin-left: auto; font-size: var(--fs-label); color: var(--s-alarm-text); font-weight: 600; }

/* --- Group distribution strip (spec §6.1, task 12) ---
   Three proportions of the group, by lateness: overdue / due / everything
   else. Segments are sized with flex-grow set to the raw count from
   `_grouped_by` — the browser turns three counts straight into three
   proportional widths, so no percentage math is needed anywhere. */
.group__dist {
  display: flex; width: 120px; height: 4px; border-radius: 999px;
  overflow: hidden; background: rgba(255, 255, 255, 0.10);
}
.group__dist-seg { flex-shrink: 0; flex-basis: 0; }
.group__dist-seg--overdue { background: var(--s-alarm); }
.group__dist-seg--due     { background: var(--s-in-progress); }
.group__dist-seg--rest    { background: rgba(255, 255, 255, 0.10); }

.group--intake      { --g: var(--s-intake); }
.group--in_progress { --g: var(--s-in-progress); }
.group--packing     { --g: var(--s-packing); }
.group--released    { --g: var(--s-released); }
.group--shipped     { --g: var(--s-shipped); }
.group--delivered   { --g: var(--s-delivered); }
.group--unknown     { --g: var(--s-alarm); }

/* --- Group colours when grouping by priority instead of status (spec §6.2,
   task 12) — same `.group--<slug>` pattern, keyed off the lowercase label. */
.group--high    { --g: var(--s-alarm); }
.group--normal  { --g: var(--s-intake); }
.group--low     { --g: var(--s-delivered); }

/* --- Reusable sticky table treatment (spec §6.3), extracted from the
   Machines board so any table (e.g. Europe's) can opt in —
   position: sticky on both the head and first column. --- */
.btable--sticky thead th {
  /* Measured: .app__main has padding-top: 1.25rem (cockpit.css — shared by
     every page, do not touch), and position: sticky resolves `top` against
     the scrollport's PADDING box, not its content box. So top: 0 pinned the
     header 1.25rem too low (below the topbar plus that padding) instead of
     flush under the topbar, leaving a gap rows kept scrolling through.
     top: -1.25rem cancels exactly that padding so the header sticks flush.
     Expressed in rem, not px, on purpose: at the default root font size
     1.25rem is 20px, but a viewer can raise their browser's font size (this
     runs on a hall display), and .app__main's padding scales with it too —
     px here would silently drift out of sync the moment it does. If
     .app__main's padding-top ever changes to a different value, this offset
     must change with it — do not "clean up" this negative value without
     re-measuring both. */
  position: sticky; top: -1.25rem; z-index: 2;
  background: var(--ink-800);
}
/* Spec §6.3: "hairline la dreapta" — a right-hand edge on the frozen first
   column, so a row sliding under it during horizontal scroll still reads as
   leaving a column, not sliding under an invisible seam. box-shadow, not
   border-right: on a table-layout: fixed board a border would be included
   in the fixed <col> width and shift every column after it by 1px;
   box-shadow paints outside the box and leaves layout untouched either way.
   It sits on the x-axis only (1px 0 0), so it never doubles up with the
   table's own border-bottom on these cells (cockpit.css `.btable thead th`
   / `.btable tbody td`). Targeted structurally (:first-child) rather than
   through a column class, so it works on any table, fixed-layout or not. */
.btable--sticky thead th:first-child { left: 0; z-index: 3; box-shadow: 1px 0 0 var(--line-strong); }   /* the corner overlaps both */
.btable--sticky tbody td:first-child {
  position: sticky; left: 0; z-index: 1;
  background: var(--ink-800);
  box-shadow: 1px 0 0 var(--line-strong);
}
.btable--sticky tbody tr:hover td:first-child { background: var(--ink-700); }
/* ?qm=1 tints its four cells (`td.lb-qm`, in the Lagebild block below), and a
   cell paints over the hovered row — without this they stay the darker shade. */
.btable--sticky tbody tr:hover td.lb-qm { background: color-mix(in srgb, var(--s-idle) 7%, var(--ink-700)); }
/* cockpit.css clips .btable with overflow: hidden to round its corners, and
   that ancestor kills position: sticky outright. .table-wrap is worse: it
   sets overflow-x: auto with no overflow-y, so per CSS Overflow the other
   axis computes to auto and it becomes a scrollport whose height is
   content-determined and never scrolls — `top: 0` would resolve against a
   box that never moves. A sticky table opts out of both and lets
   .app__main, the real scroll container, own each axis. */
.table-wrap--sticky { overflow: visible; }
.btable--sticky { overflow: visible; border-radius: 0; }

/* --- The Machines board table (spec §6.3) — board-specific density layered
   on top of .btable--sticky: fixed column widths, the taller/denser row
   look, and the hover fill. --- */
.btable--board { table-layout: fixed; font-size: var(--fs-body); }
.btable--board thead th {
  color: var(--bone);
  font-size: var(--fs-label);
  font-weight: 600;
  height: 34px;
  padding: 0 var(--sp-3);
  border-bottom: 1px solid var(--line-strong);
}
.btable--board tbody td {
  height: var(--row-default);
  padding: 0 var(--sp-3);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.btable--board tbody td:first-child {
  font-weight: 600; font-variant-numeric: tabular-nums;
}
.btable--board tbody tr:hover td { background: var(--ink-700); }

/* --- Board row detail (spec §6.6) --- */
.ship-chip {
  display: inline-block; padding: 2px 8px; border-radius: var(--radius-sm);
  font-size: var(--fs-label); font-weight: 600; font-variant-numeric: tabular-nums;
}
.ship-chip--overdue { background: var(--s-alarm-soft); color: var(--s-alarm-soft-text); }
.ship-chip--due     { background: var(--s-in-progress-soft); color: var(--s-in-progress); }

/* Lagebild */
/* --- /management/ (docs/superpowers/specs/2026-09-27-qm-lagebild-design.md §5–§6).
   One tile grammar (D4): flat --ink-800, hairline --line, --radius, no accent
   bar, no icon square, no lit face; figures weight 500 with tabular numerals.
   Red is --s-alarm-text on the overdue figures and --s-alarm on the 6 px
   decision dots — nothing else in this block is red. No euro anywhere on the
   page (D11). Closed by the /Lagebild marker so
   boardroom/tests/test_red_discipline_lagebild.py can cut the block out. --- */
.lb { max-width: 1560px; margin: 0 auto; display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--sp-4); }
.lb > * { grid-column: 1 / -1; min-width: 0; }
.lb-num { font-variant-numeric: tabular-nums; }

/* Row 0 */
.lb-datenbasis { margin: 0; color: var(--mute); font-size: var(--fs-label); font-variant-numeric: tabular-nums; }
.lb-sentences p { max-width: 72ch; margin: 0 0 var(--sp-2); color: var(--bone); font-size: 16px; line-height: 1.45; font-variant-numeric: tabular-nums; }
.lb-sentences p:last-child { margin-bottom: 0; }
.lb-since { display: inline-flex; gap: var(--sp-1); }

/* Tiles */
.lb-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-4); }
.lb-tile {
  background: var(--ink-800);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--sp-4);
  display: flex; flex-direction: column; gap: var(--sp-3);
  min-width: 0;
}
.lb-tile__kicker { margin: 0; color: var(--mute); font-family: var(--font-display); font-size: var(--fs-label); font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; }
.lb-tile__sub { margin: 0; color: var(--mute); font-size: var(--fs-label); font-weight: 500; letter-spacing: 0.05em; text-transform: uppercase; }
.lb-tile__row { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: var(--sp-3); }
.lb-tile__note, .lb-tile__foot { margin: 0; color: var(--mute); font-size: var(--fs-micro); line-height: 1.4; }

/* Figures: value / "—" + reason / "0" + reason */
.lb-figure { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.lb-figure__label { color: var(--mute); font-size: var(--fs-label); letter-spacing: 0.05em; text-transform: uppercase; }
.lb-figure__value {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: var(--fs-xl);
  line-height: 1.05;
  color: var(--bone);
  font-variant-numeric: tabular-nums;
}
.lb-figure--hero .lb-figure__value { font-size: calc(var(--fs-xl) * 1.6); }
.lb-figure--big .lb-figure__value { font-size: var(--fs-xl); }
.lb-figure--small .lb-figure__value { font-size: var(--fs-lg); }
.lb-figure__unit { font-family: var(--font-sans); font-size: var(--fs-body); font-weight: 400; color: var(--mute); }
.lb-figure__reason { color: var(--mute); font-size: var(--fs-micro); line-height: 1.35; }
.lb-figure--alarm .lb-figure__value { color: var(--s-alarm-text); }
.lb-delta--worse .lb-figure__value { color: var(--s-alarm-text); }
.lb-delta--better .lb-figure__value, .lb-delta--same .lb-figure__value { color: var(--bone); }

/* Standzeit-Klassen (spec §4/§6): four bands, one hue (--s-idle) at 20/35/55/85 % — age reads as density, never as red */
.lb-bands { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.lb-band { display: grid; grid-template-columns: minmax(96px, max-content) minmax(0, 1fr) 3ch; align-items: center; gap: var(--sp-2); min-height: 20px; font-size: var(--fs-label); }
.lb-band__label { color: var(--mute); white-space: nowrap; }
.lb-band__track { display: block; height: 10px; border-radius: 2px; background: color-mix(in srgb, var(--line) 60%, transparent); overflow: hidden; }
.lb-band__fill { display: block; height: 100%; background: var(--s-idle); }
.lb-band--1 .lb-band__fill { opacity: 20%; }
.lb-band--2 .lb-band__fill { opacity: 35%; }
.lb-band--3 .lb-band__fill { opacity: 55%; }
.lb-band--4 .lb-band__fill { opacity: 85%; }
.lb-band__count { color: var(--bone); font-weight: 500; text-align: right; }

/* Lists inside tiles */
.lb-toplist { list-style: none; margin: 0; padding: 0; }
.lb-toplist li { display: flex; gap: var(--sp-3); align-items: baseline; padding: var(--sp-1) 0; border-bottom: 1px solid var(--line); font-size: var(--fs-body); }
.lb-toplist li:last-child { border-bottom: 0; }
.lb-toplist__days { margin-left: auto; font-weight: 500; }
.lb-list { list-style: none; margin: 0; padding: 0; font-size: var(--fs-label); }
.lb-list li { display: flex; justify-content: space-between; gap: var(--sp-2); padding: 2px 0; }
.lb-trend { margin: 0; }          /* <figure> carries the browser's 1em/40px margins; the tile's gap does the spacing */
.lb-trend svg { display: block; width: 100%; height: auto; }   /* the 320×64 viewBox scales with the tile's width, end label included — a fixed 48 px letterboxed it */

/* Pipeline: 15 blocks, 6 px cap in the phase colour from settings (D6, Task 15) */
.lb-phases { display: grid; grid-template-columns: repeat(15, minmax(0, 1fr)); gap: var(--sp-2); }
.lb-phase {
  display: flex; flex-direction: column; gap: 2px; min-width: 0;
  background: var(--ink-700);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0 var(--sp-2) var(--sp-2);
  color: var(--bone); text-decoration: none; overflow: hidden;
}
.lb-phase:hover { border-color: var(--line-strong); color: var(--bone); }
.lb-phase__cap { display: block; height: 6px; margin: 0 calc(-1 * var(--sp-2)) var(--sp-2); background: var(--phase, var(--mute)); }
.lb-phase__count { font-family: var(--font-display); font-size: 20px; font-weight: 500; line-height: 1.1; font-variant-numeric: tabular-nums; }
.lb-phase__label {
  color: var(--bone); font-size: var(--fs-micro); line-height: 1.15;
  letter-spacing: 0.04em; text-transform: uppercase;
  /* ~70px per block at 1440px truncated the names ("BACKL…", "TRANS…");
     a board has to read them, so the label wraps and every block keeps
     the same height by reserving three lines. */
  white-space: normal; overflow: visible; overflow-wrap: anywhere;
  min-height: calc(3 * 1.15em);
}
.lb-phase__flags { display: flex; flex-wrap: wrap; gap: 2px var(--sp-2); min-height: 1em; color: var(--mute); font-size: var(--fs-micro); }
.lb-flag--alarm { color: var(--s-alarm-text); }
.lb-bracket {
  grid-column: 7 / 11;
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-3);
  border: 1px solid var(--line); border-top: 0;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  padding: var(--sp-2) var(--sp-3);
  font-size: var(--fs-label);
}
.lb-bracket__title { width: 100%; color: var(--mute); font-size: var(--fs-micro); letter-spacing: 0.05em; text-transform: uppercase; }
.lb-bracket__cell { display: inline-flex; align-items: center; gap: var(--sp-2); }
.lb-bracket__cell--idle { background: color-mix(in srgb, var(--s-idle) 22%, transparent); color: var(--bone); border-radius: var(--radius-sm); padding: 2px var(--sp-2); }
.lb-groups { margin: 0; display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.lb-chip { display: inline-flex; gap: var(--sp-1); align-items: baseline; padding: 2px var(--sp-2); border: 1px solid var(--line); border-radius: 999px; color: var(--bone); font-size: var(--fs-label); white-space: nowrap; }
.lb-chip .lb-num { color: var(--mute); }
/* --s-alarm-soft-text, not --s-alarm-text: the ink goes on top of the 18% red
   tint, not on a plain dark surface, and the pairing qm.css:50-59 forbids is
   exactly this one (3.95:1 in the tinted QM column). Same correction
   .ship-chip--overdue already carries. */
.lb-chip--alarm { background: var(--s-alarm-soft); color: var(--s-alarm-soft-text); border-color: transparent; font-variant-numeric: tabular-nums; }
.lb-chip--due   { background: var(--s-in-progress-soft); color: var(--s-in-progress); border-color: transparent; font-variant-numeric: tabular-nums; }
.lb-chip--idle  { background: color-mix(in srgb, var(--s-idle) 22%, transparent); color: var(--bone); border-color: transparent; }
.lb-pipeline__foot { margin: 0; font-size: var(--fs-label); }
.lb-phase-tag { display: inline-flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-label); white-space: nowrap; }
.lb-phase-tag__cap { display: inline-block; width: 6px; height: 14px; border-radius: 1px; background: var(--phase, var(--mute)); }

/* Decisions + quality register */
.lb-row3 { display: grid; grid-template-columns: 2fr 1fr; gap: var(--sp-4); }
.lb-decisions { background: var(--ink-800); border: 1px solid var(--line); border-radius: var(--radius); padding: 0 var(--sp-4) var(--sp-3); }
.lb-decisions .section-head { margin: var(--sp-3) 0 var(--sp-2); }
.lb-decision {
  display: grid; grid-template-columns: 14px minmax(0, 1fr) auto auto; align-items: center; gap: var(--sp-3);
  min-height: var(--row-default);
  border-top: 1px solid var(--line);
}
.lb-decision__dot { width: 6px; height: 6px; border-radius: 50%; background: var(--s-alarm); justify-self: center; }
.lb-decision--china .lb-decision__dot { background: var(--mute); }
/* The one decision that is good news: a machine waiting for its signature
   (rule (e), ROT-22). QM's own release green, the colour the machine will
   wear once it is signed — a dot, never a fill, and never the alarm. */
.lb-decision--releasable .lb-decision__dot { background: var(--s-released); }
.lb-decision__what { display: flex; flex-direction: column; min-width: 0; }
.lb-decision__title { font-weight: 500; }
.lb-decision__why { color: var(--mute); font-size: var(--fs-label); font-variant-numeric: tabular-nums; }
.lb-decision__owner { color: var(--mute); font-size: var(--fs-label); border: 1px solid var(--line); border-radius: 999px; padding: 2px var(--sp-2); white-space: nowrap; }
.lb-decision__link { font-size: var(--fs-label); white-space: nowrap; }
.lb-decisions__empty { margin: 0; padding: var(--sp-3) 0; }
.lb-quality .lb-figure + .lb-figure, .lb-quality .lb-tile__note + .lb-figure { border-top: 1px solid var(--line); padding-top: var(--sp-2); }

/* Cost-driver table: sticky first column from .btable--sticky, QM columns tinted */
.lb-drivers-section .section-head { margin-top: 0; }
.btable--lagebild { font-size: var(--fs-body); }
.btable--lagebild thead th { color: var(--mute); font-size: var(--fs-label); font-weight: 500; white-space: nowrap; }
.btable--lagebild tbody td { height: var(--row-default); white-space: nowrap; }
.btable--lagebild tbody td:first-child { font-weight: 500; }
.btable--lagebild tbody td:first-child .cell-muted { font-weight: 400; margin-left: var(--sp-2); }
.btable--lagebild tbody tr:hover td { background: var(--ink-700); }
th.lb-qm { color: var(--bone); background: color-mix(in srgb, var(--s-idle) 14%, var(--ink-800)); }
td.lb-qm { background: color-mix(in srgb, var(--s-idle) 7%, var(--ink-800)); }
/* The QM band keeps its 7% share on hover instead of doubling to 14%: the
   overdue Ship-date chip in this column is red text read through its own 18%
   tint, and a second tint under it lifted the surface until the ink landed at
   4.50:1 — fractionally short of AA. The hover still reads, because the base
   moves from --ink-800 to --ink-700 like every other cell. Measured by
   boardroom/tests/test_red_discipline_lagebild.py, which resolves both rules. */
.btable--lagebild tbody tr:hover td.lb-qm { background: color-mix(in srgb, var(--s-idle) 7%, var(--ink-700)); }

/* Definitions */
.lb-definitions dl { margin: 0; display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 2px var(--sp-3); color: var(--mute); font-size: var(--fs-micro); line-height: 1.4; }
.lb-definitions dt { font-weight: 500; color: var(--bone); }
.lb-definitions dd { margin: 0; }
/* Present mode hides the topbar and with it the Presentation toggle, so the way back rides in the page */
.lb-exit-present { display: none; }
body.present .lb-exit-present { display: block; margin: 0; }

/* Present mode (D9, CSS only): chrome hidden, --p-* type floor */
body.present { --p-hero: clamp(72px, 7vw, 112px); --p-big: 48px; --p-body: 22px; --p-label: 18px; --p-micro: 16px; }
body.present .app__sidebar, body.present .app__topbar, body.present .helpbot, body.present .sidebar-backdrop { display: none !important; }
body.present .app { grid-template-columns: 1fr; grid-template-rows: 1fr; grid-template-areas: "main"; }
body.present .lb-figure--hero .lb-figure__value { font-size: var(--p-hero); }
body.present .lb-figure--big .lb-figure__value { font-size: var(--p-big); }
body.present .lb-sentences p { font-size: var(--p-body); max-width: none; }
body.present .lb-figure__label, body.present .lb-tile__kicker, body.present .lb-tile__sub, body.present .lb-datenbasis, body.present .lb-bracket, body.present .lb-chip, body.present .lb-band, body.present .lb-decision__title { font-size: var(--p-label); }
body.present .lb-band__track { height: 14px; }
body.present .lb-figure__reason, body.present .lb-tile__note, body.present .lb-tile__foot, body.present .lb-definitions dl, body.present .lb-phase__label, body.present .lb-phase__flags, body.present .lb-decision__why, body.present .lb-decision__owner, body.present .btable--lagebild { font-size: var(--p-micro); }

/* Print (extends the two @media print blocks earlier in this file): brand black on white, Datenbasis on every A4 page */
@media print {
  .lb { display: block; color: #403E3D; }
  .lb-tile, .lb-decisions, .lb-phase, .lb-bracket, .btable--lagebild { background: #fff !important; border-color: #999 !important; color: #403E3D !important; break-inside: avoid; }
  .lb-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6mm; margin-bottom: 6mm; }
  .lb-row3 { display: block; }
  .lb-tile__kicker, .lb-tile__sub, .lb-figure__label, .lb-figure__reason, .lb-tile__note, .lb-tile__foot, .lb-datenbasis, .lb-definitions dl, .lb-decision__why, .lb-decision__owner, .lb-pipeline__foot, .lb-band__label { color: #555 !important; }
  .lb-figure__value, .lb-sentences p, .lb-phase__count, .lb-phase__label, .lb-decision__title, .lb-definitions dt, .lb-chip, .lb-band__count { color: #403E3D !important; }
  .lb-figure--alarm .lb-figure__value, .lb-delta--worse .lb-figure__value, .lb-flag--alarm { color: #403E3D !important; }
  .lb-phase__cap, .lb-phase-tag__cap, .lb-decision__dot, .lb-band__track, .lb-band__fill, .lb-trend svg { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .lb-datenbasis { position: fixed; bottom: 0; left: 0; right: 0; padding-top: 2mm; border-top: 1px solid #999; background: #fff; font-size: 8pt; }
  .lb-since, .lb-exit-present, .lb-decision__link, .lb-phase:hover { display: none !important; }
  th.lb-qm, td.lb-qm { background: #f2f2f2 !important; }
  .lb-chip--alarm, .lb-chip--due, .lb-chip--idle, .lb-bracket__cell--idle { background: none !important; color: #403E3D !important; border: 1px solid #666; }
}

/* --- Present mode, second half (spec §6 "Present-mode", D9): CSS only.
   The body.present rules above set the tokens, hide the chrome, collapse the
   shell grid and scale the figures. This finishes the scale: the small step,
   the centring, and a floor under everything the rules above do not name —
   16px is the smallest thing still readable from the far end of a boardroom
   table. Nothing here touches cockpit.css. --- */
body.present { --p-small: 32px; }
body.present .app__main { padding: 2rem 2.5rem 3rem; }
body.present .lb { max-width: 1560px; margin-inline: auto; font-size: var(--p-body); }

/* Small figures and the 15 phase counts: one step under --p-big. */
body.present .lb-figure--small .lb-figure__value,
body.present .lb-phase__count { font-size: var(--p-small); }

/* The floor. Every element that carries its own desk size below 16px —
   the cockpit pill (0.78rem), the table header (0.76rem), the progress
   value, the lists, the units, the pipeline footer — is re-based here;
   everything else inherits --p-body from .lb. */
body.present .lb-toplist li { font-size: var(--p-body); }
body.present .lb-list,
body.present .lb-decision__link,
body.present .section-head h2 { font-size: var(--p-label); }
body.present .lb-figure__unit,
body.present .lb-bracket__title,
body.present .lb-pipeline__foot,
body.present .lb-phase-tag,
body.present .lb .status-pill,
body.present .lb .qm-progress__val,
body.present .btable--lagebild thead th,
body.present .btable--lagebild tbody td { font-size: var(--p-micro); }

/* Rows: 44px on a desk, 56px on a wall. */
body.present .lb-decision { min-height: 56px; }
body.present .lb-drivers td,
body.present .lb-drivers th { height: 56px; }

@media (min-width: 1600px) {
  body.present .app__main { padding-inline: 3.5rem; }
  body.present .lb { gap: var(--sp-5); }
  body.present .lb-tiles { gap: calc(var(--sp-4) * 2); }
}

/* --- Print, second half (spec §6 "Print", D2). The @media print block above
   fixes the Datenbasis as the footer of every
   A4 page and paints brand black on white. Two things it left out: ink on the
   phase block itself — print-color-adjust is inherited, so the 6px cap under
   .lb-phase keeps its monday hex in every engine that prints this app — and
   the help button, which arrived after the Maschinenmappe print block and
   would print as a floating circle on every page. --- */
@media print {
  .helpbot { display: none !important; }
  .lb-phase, .lb-phase__cap, .lb svg {
    print-color-adjust: exact; -webkit-print-color-adjust: exact;
  }
}

/* /Lagebild */

/* ---- Inventur ----------------------------------------------------------- */
/* One counting row per article, so a thumb on a tablet hits one field and not
   its neighbour's. */
.count-row {
  padding: var(--sp-2) 0;
  border-bottom: 1px solid var(--line);
}
.count-row:last-of-type { border-bottom: 0; }

/* A shortfall is a warning, not an alarm: red is reserved (see
   machines/tests/test_red_discipline.py) and a missing part is normal in a
   first stocktake. A surplus needs no colour at all.

   `.table td` and not the bare class: Bootstrap paints every cell through
   `.table > :not(caption) > * > *`, which outweighs a single class, and the
   shortfall rendered plain white. The same workaround already stands at
   `.btable--lagebild tbody td:first-child .cell-muted`. */
.count-diff { font-weight: 600; }
.table td.count-diff--short { color: var(--warn); }

.status-pill--count-new { --c: var(--warn); }
.status-pill--count-closed { --c: var(--ok); }
.status-pill--count-cancelled { --c: var(--mute); }
.count-head {
  color: var(--mute); font-size: 0.76rem; letter-spacing: 0.04em;
  text-transform: uppercase; padding-bottom: var(--sp-1);
}

/* Bootstrap gives .row negative side margins to pay for its gutter, and inside
   the cockpit's .card padding that pushes the row past the card: at 390px the
   page scrolled sideways by 83px. The existing stock screen escapes it because
   its one row sits alone; these screens stack four. Zeroed here rather than on
   `.card > .row`, which would move layouts this work never touched. */
.count-grid { margin-left: 0; margin-right: 0; }

/* --- Shell, not Inventur: the topbar is a grid item, and a grid item's
   automatic minimum size is its max-content. The topbar lays out toggle,
   title, spacer and actions in a row that never wraps, so a long page title
   widened the whole `.app` track and the page scrolled sideways on a phone —
   409px of content in a 390px viewport on an Inventur named "Inventur Oktober
   2026". `min-width: 0` lets the topbar shrink back to its track and its flex
   children truncate as they already know how to. It can only ever make the
   topbar narrower, never wider, so no existing layout moves. Found while
   checking the Inventur screens, which are the first to carry a page title a
   person typed. --- */
.app__topbar { min-width: 0; }

/* --- The message a view left for the page the user lands on (base_app.html).
   cockpit.css carries .alert with --bad and --warn only, because the screen it
   was written for (the scanner) has just those two outcomes. A confirmation is
   the third, and it belongs in this layer, not in the verbatim copy: the same
   color-mix formula on --ok, the token already in the cockpit's :root. Without
   it a success message renders in the neutral box and reads the same as a
   refusal, which is the distinction the whole thing exists to make. --- */
.alert--ok { background: color-mix(in srgb, var(--ok) 16%, transparent); border: 1px solid color-mix(in srgb, var(--ok) 35%, transparent); color: var(--ok); }
/* And the neutral one, in the --info blue: `messages.info` states a fact ("back
   in the queue", "set aside, nothing was deleted") which is neither a success
   nor a warning. It is the `{% else %}` branch in base_app.html rather than a
   named level, so a level nobody has used yet — debug — still arrives inside a
   box instead of as a bare line of text. */
.alert--info { background: color-mix(in srgb, var(--info) 16%, transparent); border: 1px solid color-mix(in srgb, var(--info) 35%, transparent); color: var(--info); }

/* --- The context-help side panel (base_app.html #help-panel, help.js). The
   brief that specified this named --surface/--muted, tokens this file never
   defines; the real ones are --ink-800/--bone/--mute, the same trio
   .remark-dialog above already uses for a dark overlay on this shell. Fixed
   to the viewport edge rather than a <dialog> because it opens from a sidebar
   button that can sit anywhere down a long menu — centring it like
   .remark-dialog would cover the row that opened it. --- */
.helppanel {
  position: fixed; top: 0; right: 0; bottom: 0; width: 380px; max-width: 100%;
  /* Above .helpbot's 50: the bubble sits bottom-right, inside this panel's
     own footprint at any width, and used to cover its "Ask the assistant"
     button at the bottom — worst at 100% width (max-width: 700px), where
     that button spans the corner the bubble occupies. */
  z-index: 55; overflow-y: auto; padding: 1rem 1.1rem;
  background: var(--ink-800); color: var(--bone);
  border-left: 1px solid var(--line);
  box-shadow: 0 1.5rem 3rem rgba(0, 0, 0, 0.45);
}
.helppanel__head { display: flex; align-items: start; gap: .5rem; margin-bottom: .6rem; }
.helppanel__title { font-size: 1rem; margin: 0; flex: 1 1 auto; }
.helppanel__close { background: none; border: 0; color: var(--mute); font-size: 1.4rem; cursor: pointer; }
.helppanel__close:hover, .helppanel__close:focus-visible { color: var(--bone); }
.helppanel__body table { width: 100%; border-collapse: collapse; }
.helppanel__body th, .helppanel__body td { border-bottom: 1px solid var(--line); padding: .3rem .4rem; text-align: left; }
/* The goods-receipt state diagram is a fenced ASCII block wider than 380px;
   scroll it sideways instead of letting it blow out the panel. */
.helppanel__body pre { overflow-x: auto; }
.helppanel__foot { margin-top: 1rem; }
/* Fix round 1: a fetch that 404s or never reaches the server (help.js) gets
   this line instead of the panel just refusing to open. Same shape as
   .helpbot__msg--error two screens over — amber hairline, not the red that
   means a machine's state. */
.helppanel__error { background: rgba(255, 176, 32, .1); border-left: 2px solid var(--warn, #FFB020);
  padding: .5rem .6rem; margin: 0; font-size: .9rem; }
@media (max-width: 700px) { .helppanel { width: 100%; } }
@media print { .helppanel { display: none !important; } }
