/* BakeWise chassis stylesheet (PRD §7.6, ADR-035; design brief).
   Composition only: every colour, size, radius and duration is a token
   from tokens.css (tier 2 roles and tier 3 component knobs). No hex, px
   or ms lives here outside an @media condition; check_frontend_tokens
   fails CI otherwise. Calm by default: neutral surfaces, hairline borders
   instead of shadows, one accent for "where you are" and interaction,
   semantic colour only for status - always with an icon and a word. */

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html {
  font-family: var(--font-sans); font-size: 100%; color: var(--text); background: var(--bg);
  -webkit-text-size-adjust: 100%; text-size-adjust: 100%; font-feature-settings: "cv11";
  scroll-padding-top: calc(var(--topbar-h) + var(--sp-4));
}
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }
body {
  margin: 0; min-height: 100vh; font-size: var(--fs-body); line-height: var(--lh-body);
  background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
h1, h2, h3, h4 { margin: 0; font-family: var(--font-display); font-weight: var(--fw-semibold); letter-spacing: var(--tracking-tight); }
p, ul, ol, dl, dd, figure, blockquote { margin: 0; }
a { color: inherit; }
img { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: var(--focus-w) solid var(--focus); outline-offset: var(--focus-offset); }
[tabindex="-1"]:focus { outline: none; }
::selection { background: var(--accent-subtle); color: var(--text); }
html[aria-busy="true"] { cursor: progress; }
/* Slow swaps only: a hairline progress bar after a second (brief §8). */
html[aria-busy="true"] body::before {
  content: ""; position: fixed; inset: 0 0 auto; height: var(--border-w-strong); z-index: var(--z-skip);
  background: var(--accent); transform-origin: left;
  animation: z-busy calc(var(--dur-slow) * 6) var(--ease-standard) var(--feedback-delay) both;
}
@keyframes z-busy { from { transform: scaleX(0); } to { transform: scaleX(0.85); } }

.z-skip-link {
  position: fixed; top: var(--sp-2); left: var(--sp-2); z-index: var(--z-skip); transform: translateY(calc(-100% - var(--sp-6)));
  padding: var(--sp-2) var(--sp-4); background: var(--surface-raised); color: var(--text); font-weight: var(--fw-medium);
  border: var(--border-w) solid var(--border); border-radius: var(--radius-control);
}
.z-skip-link:focus { transform: none; box-shadow: var(--shadow-2); }
.z-visually-hidden {
  position: absolute !important; width: var(--border-w); height: var(--border-w); padding: 0; margin: calc(var(--border-w) * -1);
  overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}

/* ---------- Type ---------- */
.z-t-display { font-size: var(--fs-display); line-height: var(--lh-display); font-weight: var(--fw-semibold); }
.z-t-headline { font-size: var(--fs-headline); line-height: var(--lh-headline); font-weight: var(--fw-semibold); }
.z-t-title { font-size: var(--fs-title); line-height: var(--lh-title); font-weight: var(--fw-semibold); }
.z-t-title-sm { font-size: var(--fs-title-sm); line-height: var(--lh-title-sm); font-weight: var(--fw-semibold); }
.z-t-body-lg { font-size: var(--fs-body-lg); line-height: var(--lh-body-lg); }
.z-t-body { font-size: var(--fs-body); line-height: var(--lh-body); }
.z-t-small { font-size: var(--fs-small); line-height: var(--lh-small); }
.z-t-caption { font-size: var(--fs-caption); line-height: var(--lh-caption); }
.z-heading--1 { font-size: var(--fs-headline); line-height: var(--lh-headline); }
.z-heading--2 { font-size: var(--fs-title); line-height: var(--lh-title); }
.z-heading--3 { font-size: var(--fs-title-sm); line-height: var(--lh-title-sm); }
.z-heading--4 { font-size: var(--fs-body-lg); line-height: var(--lh-body-lg); }
.z-text { max-width: var(--measure); }
.z-text + .z-text { margin-top: var(--sp-2); }
.z-text--muted { color: var(--text-2); }
.z-num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.z-code { font-family: var(--font-mono); font-size: 0.9em; font-variant-numeric: slashed-zero; overflow-wrap: anywhere; }
.z-file { white-space: pre-wrap; max-height: 20rem; overflow: auto; }
.z-eyebrow {
  font-size: var(--fs-caption); line-height: var(--lh-caption); font-weight: var(--fw-medium); color: var(--text-2);
  text-transform: uppercase; letter-spacing: var(--tracking-caps); margin-bottom: var(--sp-1);
}
.z-list { padding-left: var(--sp-5); }
.z-list li + li { margin-top: var(--sp-1); }

/* ---------- Atoms ---------- */
.z-icon {
  display: inline-block; flex: none; width: var(--icon-sm); height: var(--icon-sm); vertical-align: middle;
  fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round;
}
.z-icon--lg { width: var(--icon-lg); height: var(--icon-lg); }

.z-btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  min-height: var(--btn-h); padding: 0 var(--btn-px); border: var(--border-w) solid transparent; border-radius: var(--radius-control);
  font-size: var(--fs-body); line-height: var(--lh-body); font-weight: var(--fw-medium); text-decoration: none; white-space: nowrap;
  cursor: pointer; transition: background-color var(--dur-fast) var(--ease-standard), border-color var(--dur-fast) var(--ease-standard), color var(--dur-fast) var(--ease-standard);
}
/* 44 px hit area around a calmer visual height (WCAG 2.5.5 target). */
.z-btn::after, .z-icon-btn::after { content: ""; position: absolute; inset: calc((var(--btn-h) - var(--target-min)) / 2) 0; }
.z-btn:active, .z-icon-btn:active { transform: scale(0.98); }
.z-btn--primary { background: var(--accent); color: var(--text-on-accent); }
.z-btn--primary:hover { background: var(--accent-hover); }
.z-btn--secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.z-btn--secondary:hover { background: var(--surface-hover); border-color: var(--border-strong); }
.z-btn--quiet { background: transparent; color: var(--text-2); }
.z-btn--quiet:hover { background: var(--surface-hover); color: var(--text); }
.z-btn--danger { background: var(--danger); color: var(--text-on-danger); }
.z-btn--danger:hover { background: var(--danger-hover); }
.z-btn--lg { min-height: var(--target-min); max-width: 100%; padding: 0 var(--sp-5); font-size: var(--fs-body-lg); white-space: normal; text-align: center; } /* a long call to action wraps at 320 px (SC 1.4.10) */
.z-btn--block { width: 100%; }
.z-btn:disabled, .z-btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; pointer-events: none; }
.z-btn .z-icon { margin-inline: calc(var(--sp-1) * -0.5); }

.z-icon-btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: var(--btn-h); height: var(--btn-h); padding: 0; border: var(--border-w) solid transparent; border-radius: var(--radius-control);
  background: transparent; color: var(--text-2); cursor: pointer; transition: background-color var(--dur-fast) var(--ease-standard);
}
.z-icon-btn::after { inset: calc((var(--btn-h) - var(--target-min)) / 2); }
.z-icon-btn:hover { background: var(--surface-hover); color: var(--text); }
.z-icon-btn--outline { border-color: var(--border); background: var(--surface); }
.z-icon-btn .z-icon { width: var(--icon-md); height: var(--icon-md); }

.z-link { color: var(--accent); text-decoration: underline; text-decoration-thickness: var(--border-w); text-underline-offset: 0.2em; }
.z-link:hover { color: var(--accent-hover); text-decoration-thickness: var(--border-w-strong); }
/* A standalone link - the only action on its own line - takes the full
   44 px hit target (WCAG 2.5.8 / 2.5.5): inline-flex centres the label
   inside a min-height box while keeping the accent text, no button chrome. */
.z-link--target { display: inline-flex; align-items: center; min-height: var(--target-min); }

.z-badge {
  display: inline-flex; align-items: center; gap: var(--sp-1); padding: var(--sp-05) var(--sp-2); vertical-align: middle;
  font-size: var(--fs-caption); line-height: var(--lh-caption); font-weight: var(--fw-medium); letter-spacing: normal; white-space: nowrap;
  border: var(--border-w) solid color-mix(in srgb, currentColor 24%, transparent); border-radius: var(--radius-pill);
  background: var(--surface-sunken); color: var(--text-2);
}
.z-badge .z-icon { width: var(--fs-caption); height: var(--fs-caption); stroke-width: 2.25; }
.z-badge--success { background: var(--success-subtle); color: var(--success); }
.z-badge--warning { background: var(--warning-subtle); color: var(--warning-text); }
.z-badge--danger { background: var(--danger-subtle); color: var(--danger); }
.z-badge--info { background: var(--info-subtle); color: var(--info); }
/* gold: a small highlight (the demo-template marker), navy text on gold —
   never text on white, never a status. */
.z-badge--gold { background: var(--gold-100); color: var(--navy-600); border-color: transparent; }
/* seal: immutability, not a result — neutral tone, strong border, muted
   icon (a sealed exception stays sealed, never green). */
.z-badge--seal { background: var(--surface-sunken); color: var(--text-2); border-color: var(--border-strong); }
.z-badge--seal .z-icon { color: var(--text-3); }

.z-status { display: inline-flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-small); color: var(--text-2); }
.z-status-dot { width: var(--dot-size); height: var(--dot-size); border-radius: var(--radius-pill); background: var(--text-3); }
.z-status--success .z-status-dot { background: var(--success); }
.z-status--warning .z-status-dot { background: var(--warning); }
.z-status--danger .z-status-dot { background: var(--danger); }
.z-status--danger { color: var(--danger); }

.z-chip {
  display: inline-flex; align-items: center; gap: var(--sp-1); min-height: var(--control-h); padding: 0 var(--sp-3);
  border: var(--border-w) solid var(--border); border-radius: var(--radius-pill); background: var(--surface); color: var(--text);
  font-size: var(--fs-small); font-weight: var(--fw-medium); text-decoration: none; cursor: pointer;
}
.z-chip:hover { background: var(--surface-hover); border-color: var(--border-strong); }
.z-chip[aria-pressed="true"] { background: var(--surface-selected); border-color: var(--accent); color: var(--accent); }
.z-chip-count {
  display: inline-block; min-width: var(--icon-md); padding: 0 var(--sp-1); margin-left: var(--sp-1); border-radius: var(--radius-pill);
  background: var(--surface-sunken); color: var(--text-2); font-size: var(--fs-caption); line-height: var(--icon-md); text-align: center; font-variant-numeric: tabular-nums;
}
.z-tag {
  display: inline-block; padding: 0 var(--sp-2); border-radius: var(--radius-control); background: var(--surface-sunken); color: var(--text-2);
  font-size: var(--fs-caption); line-height: var(--icon-md); font-weight: var(--fw-medium); letter-spacing: var(--tracking-caps); text-transform: uppercase;
}
.z-avatar {
  display: inline-flex; align-items: center; justify-content: center; flex: none; width: var(--avatar-size); height: var(--avatar-size);
  border-radius: var(--radius-pill); background: var(--accent-subtle); color: var(--accent); font-size: var(--fs-caption); font-weight: var(--fw-semibold);
}
.z-logo { display: inline-flex; align-items: center; gap: var(--sp-2); color: var(--text); font-size: var(--fs-title-sm); font-weight: var(--fw-semibold); letter-spacing: var(--tracking-tight); }
.z-logo-mark { width: var(--icon-lg); height: var(--icon-lg); border-radius: var(--radius-control); }
.z-spinner {
  display: inline-block; width: var(--icon-md); height: var(--icon-md); border-radius: var(--radius-pill);
  border: var(--border-w-strong) solid var(--border); border-top-color: var(--accent); animation: z-spin calc(var(--dur-slow) * 3) linear infinite;
}
@keyframes z-spin { to { transform: rotate(360deg); } }
/* Inside a filled button the spinner draws in the button's text colour. */
.z-btn .z-spinner { border-color: currentColor; border-top-color: transparent; }
.z-progress-wrap { display: flex; align-items: center; gap: var(--sp-3); }
.z-progress { width: 100%; max-width: calc(var(--menu-w) * 1.25); height: var(--sp-2); accent-color: var(--accent); }
.z-progress-label { font-size: var(--fs-small); color: var(--text-2); font-variant-numeric: tabular-nums; }
.z-meter { width: 100%; max-width: calc(var(--menu-w) * 1.25); height: var(--sp-3); }

.z-input {
  display: block; width: 100%; min-height: var(--input-h); padding: var(--sp-2) var(--sp-3);
  font-size: var(--fs-body-lg); line-height: var(--lh-body-lg); background: var(--surface); color: var(--text);
  border: var(--border-w) solid var(--input-border); border-radius: var(--radius-control);
  transition: border-color var(--dur-fast) var(--ease-standard), box-shadow var(--dur-fast) var(--ease-standard);
}
.z-input::placeholder { color: var(--text-3); opacity: 1; }
.z-input:hover { border-color: var(--text-2); }
.z-input:focus-visible { outline: var(--focus-w) solid var(--focus); outline-offset: 0; border-color: var(--focus); }
.z-input[aria-invalid="true"] { border-color: var(--danger); box-shadow: inset 0 0 0 var(--border-w) var(--danger); }
.z-input:disabled { background: var(--surface-sunken); color: var(--text-2); cursor: not-allowed; }
.z-input--short { max-width: 20ch; }
/* A quantity between − and + (no script: each posts its form), 44 px each. */
.z-stepper { display: flex; gap: var(--sp-2); }
.z-stepper .z-btn { min-width: var(--target-min); min-height: var(--target-min); padding: 0; font-size: var(--fs-body-lg); }
.z-stepper .z-input { width: 8ch; text-align: center; }
.z-textarea { min-height: calc(var(--input-h) * 2.5); resize: vertical; }
.z-select {
  appearance: none; padding-right: var(--sp-10); cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-2) 50%), linear-gradient(135deg, var(--text-2) 50%, transparent 50%);
  background-position: right var(--sp-5) center, right var(--sp-4) center; background-size: var(--sp-1) var(--sp-1); background-repeat: no-repeat;
}
.z-check { display: flex; align-items: flex-start; gap: var(--sp-3); min-height: var(--target-min); padding: var(--sp-2) 0; cursor: pointer; }
.z-check input { flex: none; width: var(--check-size); height: var(--check-size); margin: 0; accent-color: var(--accent); cursor: pointer; }
.z-check input:disabled + span { color: var(--text-2); }
.z-switch { position: relative; display: inline-flex; align-items: center; gap: var(--sp-3); min-height: var(--target-min); cursor: pointer; }
.z-switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.z-switch-track {
  position: relative; flex: none; width: calc(var(--sp-8) + var(--sp-1)); height: var(--sp-5); border-radius: var(--radius-pill);
  background: var(--border-strong); transition: background-color var(--dur-fast) var(--ease-standard);
}
.z-switch-track::after {
  content: ""; position: absolute; top: var(--sp-05); left: var(--sp-05); width: var(--sp-4); height: var(--sp-4);
  border-radius: var(--radius-pill); background: var(--surface); transition: transform var(--dur-fast) var(--ease-standard);
}
.z-switch input:checked + .z-switch-track { background: var(--accent); }
.z-switch input:checked + .z-switch-track::after { background: var(--text-on-accent); transform: translateX(var(--sp-4)); }
.z-switch input:focus-visible + .z-switch-track { outline: var(--focus-w) solid var(--focus); outline-offset: var(--focus-offset); }
.z-label { display: block; margin-bottom: var(--sp-1); font-size: var(--fs-body); line-height: var(--lh-body); font-weight: var(--fw-medium); color: var(--text); }
.z-label-opt { font-weight: var(--fw-regular); color: var(--text-2); }
/* The required marker is CSS-generated (::after), never a <span> inside the
   label: it shows after the label text without polluting its accessible
   name (getByLabel exact still matches "SKU", not "SKU *"). */
.z-label--required::after { content: "*"; margin-left: var(--sp-05); color: var(--danger); font-weight: var(--fw-medium); }
.z-legend { padding: 0; margin-bottom: var(--sp-3); font-size: var(--fs-title-sm); line-height: var(--lh-title-sm); font-weight: var(--fw-semibold); }
.z-help { font-size: var(--fs-small); line-height: var(--lh-small); color: var(--text-2); }
.z-help--danger { display: flex; align-items: flex-start; gap: var(--sp-1); color: var(--danger); font-weight: var(--fw-medium); }
.z-help--danger::before {
  content: ""; flex: none; width: var(--icon-sm); height: var(--icon-sm); margin-top: calc((var(--lh-small) - var(--icon-sm)) / 2);
  background: currentColor; -webkit-mask: var(--mask-alert) center / contain no-repeat; mask: var(--mask-alert) center / contain no-repeat;
}
.z-divider { border: 0; border-top: var(--border-w) solid var(--border-subtle); margin: var(--sp-4) 0; }
.z-kbd {
  display: inline-block; padding: 0 var(--sp-1); font-family: var(--font-mono); font-size: var(--fs-caption); line-height: var(--icon-md);
  border: var(--border-w) solid var(--border); border-bottom-width: var(--border-w-strong); border-radius: var(--radius-control); background: var(--surface);
}
.z-skeleton {
  display: block; width: 60%; height: var(--sp-3); border-radius: var(--radius-pill); background: var(--border-subtle);
  animation: z-pulse calc(var(--dur-slow) * 4) ease-in-out infinite alternate;
}
.z-skeleton--wide { width: 100%; height: var(--sp-8); border-radius: var(--radius-control); }
@keyframes z-pulse { to { opacity: 0.45; } }
.z-tooltip { position: relative; border-bottom: var(--border-w) dashed var(--text-2); cursor: help; }
.z-tooltip-tip {
  position: absolute; left: 50%; bottom: calc(100% + var(--sp-2)); transform: translateX(-50%); width: max-content; max-width: var(--menu-w);
  padding: var(--sp-2) var(--sp-3); background: var(--surface-raised); color: var(--text); font-size: var(--fs-small); line-height: var(--lh-small);
  border: var(--border-w) solid var(--border); border-radius: var(--radius-control); box-shadow: var(--shadow-2);
  opacity: 0; pointer-events: none; transition: opacity var(--dur-fast) var(--ease-standard); z-index: var(--z-menu);
}
.z-tooltip:hover .z-tooltip-tip, .z-tooltip:focus-visible .z-tooltip-tip { opacity: 1; }
.z-crumb { color: var(--text-2); text-decoration: none; }
a.z-crumb:hover { color: var(--accent); text-decoration: underline; }
.z-crumb--current { color: var(--text); font-weight: var(--fw-medium); }

/* ---------- Molecules ---------- */
.z-field { max-width: var(--form-max); margin-bottom: var(--sp-5); }
.z-field > .z-help:not(.z-help--danger) { margin-bottom: var(--sp-2); }
.z-field > .z-help--danger { margin-top: var(--sp-2); }
.z-field--error { padding-left: var(--sp-4); border-left: var(--sp-1) solid var(--danger); }
.z-fieldset { min-width: 0; padding: 0; margin: 0 0 var(--sp-5); border: 0; }
.z-fieldset--boxed { padding: var(--sp-4) var(--sp-4) 0; border: var(--border-w) solid var(--border); border-radius: var(--radius-card); }
.z-fieldset--boxed > legend { padding: 0 var(--sp-1); }
.z-fieldset + .z-fieldset { margin-top: var(--sp-6); }
.z-choices { display: grid; }
.z-choices--grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 11rem), 1fr)); gap: var(--sp-1) var(--sp-4); }
.z-search { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.z-search-box { position: relative; flex: 1 1 16rem; min-width: 0; }
.z-search-box > .z-icon { position: absolute; left: var(--sp-3); top: 50%; transform: translateY(-50%); color: var(--text-2); pointer-events: none; }
.z-search-input { padding-left: calc(var(--sp-3) + var(--icon-sm) + var(--sp-2)); }
.z-search .z-btn, .z-lookup-row .z-btn { min-height: var(--input-h); }
.z-stepper { display: inline-flex; align-items: center; gap: var(--sp-2); }
.z-stepper .z-icon-btn { width: var(--input-h); height: var(--input-h); }
.z-stepper-value { width: calc(var(--sp-16) + var(--sp-4)); text-align: center; font-variant-numeric: tabular-nums; appearance: textfield; }
.z-taginput {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); min-height: var(--input-h); padding: var(--sp-1) var(--sp-2);
  border: var(--border-w) solid var(--input-border); border-radius: var(--radius-control); background: var(--surface);
}
.z-taginput-entry { flex: 1; min-width: 8ch; padding: var(--sp-1); border: 0; background: transparent; font-size: var(--fs-body-lg); }
.z-taginput-entry:focus-visible { outline: none; }
.z-taginput:focus-within { outline: var(--focus-w) solid var(--focus); }

.z-card, .z-panel { background: var(--surface); border: var(--border-w) solid var(--border); border-radius: var(--radius-card); }
.z-card { display: flex; flex-direction: column; gap: var(--sp-2); padding: var(--sp-5); min-width: 0; }
.z-card-title { font-size: var(--fs-title-sm); line-height: var(--lh-title-sm); }
.z-card-link { margin-top: auto; padding-top: var(--sp-2); font-weight: var(--fw-medium); }
.z-price { font-family: var(--font-mono); font-size: var(--fs-title); line-height: var(--lh-title); font-weight: var(--fw-semibold); font-variant-numeric: tabular-nums; }
.z-plan .z-btn { margin-top: auto; align-self: flex-start; }
.z-card--link:hover { border-color: var(--border-strong); }
.z-panel { padding: var(--sp-6); margin-bottom: var(--sp-6); }
.z-panel-foot { margin-top: var(--sp-4); padding-top: var(--sp-4); border-top: var(--border-w) solid var(--border-subtle); }
.z-section-title { margin-bottom: var(--sp-4); font-size: var(--fs-title-sm); line-height: var(--lh-title-sm); }
.z-section-block { margin-top: var(--sp-8); }
.z-region, .z-lookup-result { margin-bottom: var(--sp-8); }
.z-panel > .z-section-title + .z-text { margin-top: calc(var(--sp-2) * -1); margin-bottom: var(--sp-4); }

.z-alert {
  display: flex; align-items: flex-start; gap: var(--sp-3); margin-bottom: var(--sp-6); padding: var(--sp-4);
  color: var(--text); background: var(--info-subtle); border: var(--border-w) solid color-mix(in srgb, var(--info) 35%, transparent); border-radius: var(--radius-card);
}
.z-alert > .z-icon { width: var(--icon-md); height: var(--icon-md); color: var(--info); }
.z-alert-body { min-width: 0; }
.z-alert-title { font-size: var(--fs-body); line-height: var(--lh-body); font-weight: var(--fw-semibold); }
.z-alert-text { margin-top: var(--sp-1); max-width: var(--measure); }
.z-alert--success { background: var(--success-subtle); border-color: color-mix(in srgb, var(--success) 35%, transparent); }
.z-alert--success > .z-icon { color: var(--success); }
.z-alert--warning { background: var(--warning-subtle); border-color: color-mix(in srgb, var(--warning) 45%, transparent); }
.z-alert--warning > .z-icon { color: var(--warning-text); }
.z-alert--danger { background: var(--danger-subtle); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.z-alert--danger > .z-icon { color: var(--danger); }
.z-error-summary { border: var(--border-w-strong) solid var(--danger); }
.z-error-summary:focus { outline: var(--focus-w) solid var(--focus); outline-offset: var(--focus-offset); }
.z-error-summary .z-alert-title { font-size: var(--fs-title-sm); line-height: var(--lh-title-sm); }
.z-alert-list { margin-top: var(--sp-2); padding-left: var(--sp-5); }
.z-alert-list li + li { margin-top: var(--sp-1); }
.z-alert-list .z-link { color: var(--danger); font-weight: var(--fw-medium); }

.z-toaster {
  position: fixed; right: var(--gutter); bottom: var(--gutter); z-index: var(--z-toast); display: grid; gap: var(--sp-2);
  width: min(calc(100% - 2 * var(--gutter)), var(--toast-w)); pointer-events: none;
}
.z-toast {
  display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-3) var(--sp-4); pointer-events: auto;
  background: var(--surface-raised); color: var(--text); border: var(--border-w) solid var(--border); border-radius: var(--radius-card); box-shadow: var(--shadow-2);
  animation: z-toast-in var(--dur-base) var(--ease-enter), z-toast-out var(--dur-base) var(--ease-exit) var(--toast-dwell) forwards;
}
.z-toast > .z-icon { width: var(--icon-md); height: var(--icon-md); color: var(--info); }
.z-toast--success > .z-icon { color: var(--success); }
.z-toast-title { font-weight: var(--fw-medium); }
@keyframes z-toast-in { from { opacity: 0; transform: translateY(var(--sp-2)); } }
@keyframes z-toast-out { to { opacity: 0; transform: translateY(var(--sp-2)); visibility: hidden; } }

.z-kpis { display: grid; gap: var(--sp-4); grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr)); margin-bottom: var(--sp-8); }
.z-stat {
  display: flex; flex-direction: column; gap: var(--sp-1); min-width: 0; padding: var(--sp-5);
  background: var(--surface); border: var(--border-w) solid var(--border); border-radius: var(--radius-card); color: var(--text); text-decoration: none;
}
.z-stat--link { transition: border-color var(--dur-fast) var(--ease-standard); }
.z-stat--link:hover { border-color: var(--border-strong); }
.z-stat--link:hover .z-stat-label { color: var(--accent); }
.z-stat-label { font-size: var(--fs-small); line-height: var(--lh-small); font-weight: var(--fw-medium); color: var(--text-2); }
.z-stat-row { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--sp-3); }
.z-stat-value {
  font-size: var(--kpi-value-fs); line-height: var(--kpi-value-lh); font-weight: var(--fw-semibold);
  letter-spacing: var(--tracking-tight); font-variant-numeric: tabular-nums; overflow-wrap: anywhere;
}
.z-spark { flex: none; width: var(--spark-w); height: var(--spark-h); fill: none; stroke: var(--accent); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.z-spark polyline { vector-effect: non-scaling-stroke; }
.z-stat-delta { display: inline-flex; flex-wrap: wrap; align-items: center; gap: var(--sp-1); font-size: var(--fs-small); line-height: var(--lh-small); font-weight: var(--fw-medium); font-variant-numeric: tabular-nums; color: var(--text-2); }
.z-stat-delta--success { color: var(--success); }
.z-stat-delta--danger { color: var(--danger); }
.z-stat-compare { color: var(--text-2); font-weight: var(--fw-regular); }

.z-dialog {
  width: min(calc(100% - 2 * var(--gutter)), var(--dialog-w)); padding: 0; margin: auto; color: var(--text);
  background: var(--surface-raised); border: var(--border-w) solid var(--border); border-radius: var(--radius-sheet); box-shadow: var(--shadow-2);
}
.z-dialog--sm { width: min(calc(100% - 2 * var(--gutter)), var(--dialog-w-sm)); }
.z-dialog:not(:modal) { position: static; margin: var(--sp-4) 0 0; box-shadow: none; }
.z-dialog[open] { animation: z-fade var(--dur-base) var(--ease-enter); }
.z-dialog::backdrop { background: var(--backdrop); }
.z-dialog-header { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-3); padding: var(--sp-5) var(--sp-6) var(--sp-1); }
.z-dialog-title { margin: 0; font-family: var(--font-display); font-size: var(--fs-title); line-height: var(--lh-title); font-weight: var(--fw-semibold); letter-spacing: var(--tracking-tight); overflow-wrap: anywhere; }
.z-dialog-close { flex: none; }
.z-dialog-body { padding: var(--sp-3) var(--sp-6); }
.z-dialog-body .z-form { max-width: none; }
.z-dialog-body .z-alert { margin-bottom: var(--sp-3); }
.z-dialog-body > :first-child { margin-top: 0; }
.z-dialog-body > :last-child { margin-bottom: 0; }
.z-dialog-footer { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--sp-2); padding: var(--sp-3) var(--sp-6) var(--sp-5); border-top: var(--border-w) solid var(--border-subtle); }
@media (max-width: 640px) {
  .z-dialog-header, .z-dialog-body, .z-dialog-footer { padding-left: var(--sp-5); padding-right: var(--sp-5); }
  .z-dialog-footer > * { flex: 1 1 100%; }
}
@keyframes z-fade { from { opacity: 0; transform: scale(0.98); } }

/* Wizard (wizard.go, D220): a wider dialog over the page, blurred where
   the browser can (the tint alone where it cannot, or where the reader
   asks for less transparency); the body scrolls under a fixed header and
   footer, and at phone width it takes the whole screen. In the page flow
   (no JS) the page header names it instead of the dialog's. */
.z-wizard { width: min(calc(100% - 2 * var(--gutter)), var(--dialog-w-lg)); max-height: calc(100dvh - 2 * var(--gutter)); }
.z-wizard:modal { display: flex; flex-direction: column; overflow: hidden; }
.z-wizard:modal > form { display: flex; flex-direction: column; min-height: 0; flex: 1 1 auto; }
.z-wizard:modal .z-dialog-body { overflow-y: auto; flex: 1 1 auto; }
.z-wizard::backdrop { -webkit-backdrop-filter: blur(var(--backdrop-blur)); backdrop-filter: blur(var(--backdrop-blur)); }
.z-wizard:not(:modal) { width: auto; max-width: var(--dialog-w-lg); max-height: none; }
.z-wizard:not(:modal) > .z-dialog-header { display: none; }
.z-wizard-heading { margin: 0 0 var(--sp-4); font-size: var(--fs-title-sm); line-height: var(--lh-title-sm); font-weight: var(--fw-semibold); }
.z-wizard-review { margin-bottom: var(--sp-4); }
.z-wizard .z-wiz { margin-bottom: var(--sp-4); }
.z-wizard .z-dialog-footer .z-wizard-back { margin-right: auto; }
@media (max-width: 640px) {
  .z-wizard:modal { width: 100%; max-width: none; height: 100dvh; max-height: none; margin: 0; border-radius: 0; border: 0; }
  .z-wizard .z-dialog-footer > * { flex: 1 1 auto; }
}

.z-menu, .z-drawer { position: relative; display: inline-block; }
.z-menu > summary, .z-drawer > summary, .z-accordion-item > summary { list-style: none; cursor: pointer; }
.z-menu > summary::-webkit-details-marker, .z-drawer > summary::-webkit-details-marker,
.z-accordion-item > summary::-webkit-details-marker { display: none; }
.z-menu-panel, .z-drawer-panel {
  position: absolute; top: calc(100% + var(--sp-1)); left: 0; z-index: var(--z-menu); min-width: var(--menu-w); max-width: calc(100vw - 2 * var(--gutter));
  padding: var(--sp-1); background: var(--surface-raised); border: var(--border-w) solid var(--border); border-radius: var(--radius-card); box-shadow: var(--shadow-2);
}
.z-menu-panel--end { left: auto; right: 0; }
.z-drawer-panel { padding: var(--sp-4); }
.z-menu[open] > .z-menu-panel, .z-drawer[open] > .z-drawer-panel { animation: z-fade var(--dur-base) var(--ease-enter); }
.z-menu-item {
  display: flex; align-items: center; gap: var(--sp-2); width: 100%; min-height: var(--control-h); padding: var(--sp-2) var(--sp-3);
  border: 0; border-radius: var(--radius-control); background: none; color: var(--text); text-align: left; text-decoration: none; cursor: pointer;
}
.z-menu-item:hover { background: var(--surface-hover); }
.z-menu-item > .z-icon { color: var(--text-2); }
.z-menu-item--danger, .z-menu-item--danger > .z-icon { color: var(--danger); }
.z-menu-section { padding: var(--sp-2) 0 var(--sp-1); border-top: var(--border-w) solid var(--border-subtle); }
.z-menu-label { padding: 0 var(--sp-3) var(--sp-2); font-size: var(--fs-caption); line-height: var(--lh-caption); font-weight: var(--fw-medium); color: var(--text-2); }
.z-segmented { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-05); margin: 0 var(--sp-2) var(--sp-1); padding: var(--sp-05); background: var(--surface-sunken); border-radius: var(--radius-control); }
.z-btn--segment { flex-direction: column; gap: var(--sp-05); min-height: var(--control-h); padding: var(--sp-1); font-size: var(--fs-caption); line-height: var(--lh-caption); color: var(--text-2); background: transparent; }
.z-btn--segment:hover { color: var(--text); }
.z-btn--segment[aria-pressed="true"] { background: var(--surface-raised); color: var(--text); border-color: var(--border); box-shadow: var(--shadow-1); }

.z-breadcrumbs-list { display: flex; flex-wrap: wrap; gap: var(--sp-1) var(--sp-2); padding: 0; list-style: none; font-size: var(--fs-small); line-height: var(--lh-small); color: var(--text-2); }
.z-breadcrumbs-list li + li::before { content: "/"; margin-right: var(--sp-2); color: var(--text-3); }
.z-pagination { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-3); margin-top: var(--sp-4); }
.z-pagination-status { font-size: var(--fs-small); color: var(--text-2); font-variant-numeric: tabular-nums; }

.z-page-header { margin-bottom: var(--sp-6); }
.z-page-header .z-breadcrumbs { margin-bottom: var(--sp-3); }
.z-page-header-row { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--sp-4); }
.z-page-header-text { flex: 1 1 20rem; min-width: 0; }
.z-page-title { font-size: var(--fs-headline); line-height: var(--lh-headline); overflow-wrap: anywhere; }
.z-page-title .z-badge { margin-left: var(--sp-2); }
.z-page-subtitle { margin-top: var(--sp-1); max-width: var(--measure); color: var(--text-2); }
.z-page-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); }
.z-soon { display: inline-flex; align-items: center; gap: var(--sp-1); margin: 0; font-size: var(--fs-caption); line-height: var(--lh-caption); color: var(--text-3); }
.z-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-2) var(--sp-3); margin-bottom: var(--sp-4); }
.z-toolbar > .z-search, .z-toolbar > .z-search-box { flex: 1 1 24rem; max-width: 40rem; }
.z-day-pick { justify-content: flex-start; align-items: flex-end; }
.z-day-pick > .z-field { margin-bottom: 0; }
/* day navigator: a date-scoped list's primary control (D154) — prev/next
   as links, the day and its weekday, and a date input (zero-JS: the links
   carry ?date=, the input submits on Enter). */
.z-daynav-group { display: inline-flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.z-daynav { display: inline-flex; flex-wrap: wrap; align-items: center; gap: var(--sp-1); max-width: 100%; border: var(--border-w) solid var(--border-strong);
  border-radius: var(--radius-control); background: var(--surface); padding: var(--sp-05); }
.z-daynav-btn { display: inline-flex; align-items: center; justify-content: center; width: var(--sp-10); height: var(--sp-10); flex: none;
  border: none; background: transparent; color: var(--text-2); border-radius: var(--radius-control); text-decoration: none; }
.z-daynav-btn:hover { background: var(--surface-hover); color: var(--text); }
.z-daynav-label { display: flex; flex-direction: column; align-items: center; padding: 0 var(--sp-3); line-height: 1.1; }
.z-daynav-day { font-weight: var(--fw-semibold); font-size: var(--fs-body); }
.z-daynav-week { font-size: var(--fs-caption); color: var(--text-3); }
.z-daynav-form { display: flex; } /* wraps under the day at 320 px (SC 1.4.10) */
.z-daynav-input { width: 9rem; height: var(--sp-10); border: none; background: transparent; font: inherit; color: var(--text);
  padding: 0 var(--sp-2); border-left: var(--border-w) solid var(--border-subtle); }
.z-daynav-input:focus-visible { outline: var(--focus-w) solid var(--focus); outline-offset: calc(-1 * var(--focus-w)); }
/* Today's "needs attention": one exception per row, its verb at the end. */
.z-needs { display: grid; gap: var(--sp-2); margin: 0; padding: 0; list-style: none; }
.z-need { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-3); padding: var(--sp-3) var(--sp-4); background: var(--surface); border: var(--border-w) solid var(--border); border-left: var(--sp-1) solid var(--warning); border-radius: var(--radius-card); }
.z-need > span { flex: 1 1 14rem; }
.z-need > .z-icon { color: var(--warning-text); }

/* Tables: the four jobs are find, compare, view one row, act on many. */
.z-table-wrap {
  max-height: var(--table-max-h); overflow: auto; overscroll-behavior-x: contain;
  background: var(--surface); border: var(--border-w) solid var(--border); border-radius: var(--radius-card);
}
.z-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--fs-body); line-height: var(--lh-body); }
.z-table th, .z-table td { height: var(--row-h); padding: 0 var(--cell-px); text-align: left; vertical-align: middle; white-space: nowrap; border-bottom: var(--border-w) solid var(--border-subtle); }
.z-table thead th {
  position: sticky; top: 0; z-index: var(--z-sticky); background: var(--surface-sunken); color: var(--text-2);
  font-size: var(--fs-small); font-weight: var(--fw-medium); white-space: nowrap; border-bottom-color: var(--border);
}
.z-table tbody > tr:last-child > * { border-bottom: 0; }
.z-table tbody > tr:hover > td { background: var(--surface-hover); }
.z-table .z-col--number, .z-table .z-col--money { text-align: right; font-variant-numeric: tabular-nums; }
.z-table .z-col--date { font-variant-numeric: tabular-nums; }
.z-table tfoot th, .z-table tfoot td { position: sticky; bottom: 0; background: var(--surface); font-weight: var(--fw-semibold); border-top: var(--border-w) solid var(--border); border-bottom: 0; }
.z-table tfoot th { text-align: left; }
[data-density="compact"] .z-table tbody > tr:nth-child(even) > td { background: var(--bg); }
[data-density="compact"] .z-table tbody > tr:hover > td { background: var(--surface-hover); }
.z-row-link { color: var(--accent); font-weight: var(--fw-medium); text-decoration: none; }
.z-row-link:hover { text-decoration: underline; }
.z-table-row--state > td { height: auto; }
.z-table-row--state:hover > td { background: none; }
.z-table-state { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: var(--sp-2); padding: var(--sp-10) var(--sp-4); color: var(--text-2); text-align: center; }
.z-table-state > .z-icon { width: var(--icon-md); height: var(--icon-md); }
.z-table-row--error .z-table-state { color: var(--danger); }
.z-table-row--loading .z-col--number .z-skeleton, .z-table-row--loading .z-col--money .z-skeleton { margin-left: auto; width: 40%; }

.z-kv { display: grid; }
.z-kv-row { display: grid; grid-template-columns: minmax(8rem, 1fr) 2fr; gap: var(--sp-4); padding: var(--sp-3) 0; border-bottom: var(--border-w) solid var(--border-subtle); }
.z-kv-row:first-child { padding-top: 0; }
.z-kv-row:last-child { padding-bottom: 0; border-bottom: 0; }
.z-kv dt { color: var(--text-2); }
.z-kv dd { overflow-wrap: anywhere; }
.z-avatar-group { display: flex; }
.z-avatar-group .z-avatar + .z-avatar { margin-left: calc(var(--sp-1) * -1); box-shadow: 0 0 0 var(--border-w-strong) var(--surface); }
.z-tabs-list { display: flex; gap: var(--sp-1); padding: 0; margin: 0 0 var(--sp-4); list-style: none; overflow-x: auto; border-bottom: var(--border-w) solid var(--border); }
.z-tab {
  display: inline-flex; align-items: center; gap: var(--sp-1); min-height: var(--target-min); padding: 0 var(--sp-3); margin-bottom: calc(var(--border-w) * -1);
  color: var(--text-2); font-weight: var(--fw-medium); text-decoration: none; white-space: nowrap; border-bottom: var(--border-w-strong) solid transparent;
}
.z-tab:hover { color: var(--text); }
.z-tab--active { color: var(--text); border-bottom-color: var(--accent); }
/* On a phone the area's tabs wrap instead of scrolling, so the last tab
   ("Mi acceso") is never clipped off-screen. */
@media (max-width: 640px) { .z-tabs-list { flex-wrap: wrap; overflow-x: visible; } }
.z-accordion { display: grid; gap: var(--sp-2); }
.z-accordion-item { background: var(--surface); border: var(--border-w) solid var(--border); border-radius: var(--radius-card); }
.z-accordion-item > summary { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); min-height: var(--target-min); padding: 0 var(--sp-4); font-weight: var(--fw-medium); }
.z-accordion-item > summary .z-icon { color: var(--text-2); transition: transform var(--dur-fast) var(--ease-standard); }
.z-accordion-item[open] > summary .z-icon { transform: rotate(180deg); }
.z-accordion-body { padding: 0 var(--sp-4) var(--sp-4); }
.z-notif-list { display: grid; gap: var(--sp-2); }
.z-notif { padding: var(--sp-3) var(--sp-4); background: var(--surface); border: var(--border-w) solid var(--border); border-radius: var(--radius-card); }
.z-notif-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); }
.z-notif-subject { font-weight: var(--fw-medium); }
.z-notif-meta { margin-top: var(--sp-1); font-size: var(--fs-small); color: var(--text-2); }
.z-empty {
  display: flex; flex-direction: column; align-items: center; gap: var(--sp-2); padding: var(--sp-12) var(--sp-6); text-align: center;
  background: var(--surface); border: var(--border-w) dashed var(--border); border-radius: var(--radius-card);
}
.z-empty > .z-icon { margin-bottom: var(--sp-2); color: var(--text-2); }
.z-empty-title { font-size: var(--fs-title-sm); line-height: var(--lh-title-sm); }
h1.z-empty-title { font-size: var(--fs-title); line-height: var(--lh-title); }
.z-empty .z-text { max-width: 48ch; }
.z-empty .z-btn { margin-top: var(--sp-3); }
.z-empty--danger > .z-icon { color: var(--danger); }

/* ---------- Organisms ---------- */
.z-app { display: grid; grid-template-columns: var(--nav-w) minmax(0, 1fr); min-height: 100vh; }
.z-appnav {
  position: sticky; top: 0; display: flex; flex-direction: column; height: 100vh; overflow-y: auto;
  background: var(--side-bg); color: var(--side-text); border-right: var(--border-w) solid var(--side-rule); scrollbar-width: thin;
}
.z-appnav-head { display: flex; flex: none; align-items: center; justify-content: space-between; height: var(--topbar-h); padding: 0 var(--sp-5); }
/* The brand is white inside the navy sidebar shell, but the light profile
   topbar (shell_profile) reuses the same .z-appnav-brand class over a
   var(--surface) background: there it must read as ink (var(--text)), never
   white-on-white. Scope the white to the navy shell and keep the light
   topbar on the ink colour. */
.z-appnav-brand { text-decoration: none; }
.z-appnav .z-appnav-brand { color: var(--side-text-max); }
.z-appnav .z-appnav-brand .z-logo { color: var(--side-text-max); }
.z-profile-topbar .z-appnav-brand { color: var(--text); }
.z-appnav-head .z-icon-btn--quiet { color: var(--side-text); }
.z-appnav-head .z-icon-btn--quiet:hover { background: var(--side-hover); color: var(--side-text-max); }
.z-appnav-close, .z-appnav-scrim, .z-navbtn { display: none; }
.z-app-body { display: flex; flex-direction: column; min-width: 0; }

/* The sidebar is the app's left nav (D141): flat links (Hoy, a
   single-page group) and collapsible domain groups, with the pinned
   platform region (Empresa · Consola) fixed to the bottom. */
.z-sidebar { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; gap: var(--sp-05); padding: var(--sp-2) var(--sp-3) var(--sp-8); }
.z-sidebar-list { display: flex; flex-direction: column; flex: 1 1 auto; gap: var(--sp-05); margin: 0; padding: 0; list-style: none; }
.z-side-link {
  position: relative; display: flex; align-items: center; gap: var(--sp-3); min-height: var(--control-h); padding: 0 var(--sp-3);
  border-radius: var(--radius-control); color: var(--side-text); font-weight: var(--fw-medium); text-decoration: none;
}
/* 44 px hit area around a 36 px visual row (WCAG 2.2 SC 2.5.5 target):
   the ::after extends the clickable box above and below the row so the rail
   stays dense but every nav target is an easy tap/click. */
.z-side-link::after { content: ""; position: absolute; inset: calc((var(--control-h) - var(--target-min)) / 2) 0; }
.z-side-link:hover { background: var(--side-hover); color: var(--side-text-max); }
.z-side-link:focus-visible { outline: var(--focus-w) solid var(--focus); outline-offset: var(--focus-offset); }
.z-side-link[aria-current="page"], .z-side-link[aria-current="page"]:hover { background: var(--accent); color: var(--text-on-accent); }
.z-side-link > .z-icon { opacity: 0.85; }
.z-side-link[aria-current="page"] > .z-icon { opacity: 1; }
.z-side-link > span { min-width: 0; }

/* A collapsible group: a native <details> whose summary (a full-height
   target) is the one disclosure control per section (zero JS). */
.z-side-group {}
.z-side-summary {
  display: flex; align-items: center; gap: var(--sp-2); min-height: var(--target-min); padding: 0 var(--sp-2);
  margin: 0; list-style: none; cursor: pointer; border-radius: var(--radius-control); color: var(--side-text-hi);
  font-weight: var(--fw-medium); font-size: var(--fs-small);
}
.z-side-summary::-webkit-details-marker { display: none; }
.z-side-summary:hover { background: var(--side-hover); color: var(--side-text-max); }
.z-side-summary:focus-visible { outline: var(--focus-w) solid var(--focus); outline-offset: var(--focus-offset); }
.z-side-caret {
  display: inline-flex; flex: none; width: var(--icon-sm); height: var(--icon-sm); color: var(--side-text);
  transform: rotate(-90deg); transition: transform var(--dur-fast) var(--ease-standard);
}
.z-side-caret .z-icon { width: var(--icon-sm); height: var(--icon-sm); }
.z-side-group[open] > .z-side-summary .z-side-caret { transform: rotate(0deg); }
/* The ember dot marks the group holding the current page; it survives a
   collapsed group, so "where you are" stays visible. */
.z-side-loc { width: var(--sp-1); height: var(--sp-1); border-radius: var(--radius-pill); background: var(--ember-600); flex: none; opacity: 0; }
.z-side-group--current > .z-side-summary .z-side-loc { opacity: 1; }
.z-side-group--current > .z-side-summary { color: var(--side-text-max); font-weight: var(--fw-semibold); }

/* The indented item list of an open group. */
.z-side-items { display: flex; flex-direction: column; gap: var(--sp-05); margin: var(--sp-05) 0 var(--sp-2) 0; padding: 0 0 0 var(--sp-4); list-style: none; }
.z-side-items .z-side-link { min-height: var(--control-h); padding: 0 var(--sp-2); font-weight: var(--fw-regular); }

/* The provenance pill of an "Empresa" entry (the minimum role that sees
   it): honesty of lineage, mono and muted (D134). */
.z-side-role {
  margin-left: auto; flex: none; font-size: var(--fs-caption); line-height: var(--lh-caption); padding: 0 var(--sp-1);
  border: var(--border-w) solid var(--side-rule); border-radius: var(--radius-pill); color: var(--side-text);
  font-family: var(--font-mono); white-space: nowrap;
}
.z-side-link[aria-current="page"] .z-side-role { color: var(--text-on-accent); border-color: color-mix(in srgb, var(--text-on-accent) 45%, transparent); }

/* The pinned platform region: a subtle rule, fixed to the bottom. */
.z-side-pinned { flex: none; display: grid; gap: var(--sp-05); margin-top: auto; padding-top: var(--sp-3); position: relative; }
.z-side-pinned::before { content: ""; position: absolute; top: 0; left: var(--sp-3); right: var(--sp-3); height: var(--border-w); background: var(--side-rule); }
.z-side-pinned:empty { display: none; }
.z-topbar {
  position: sticky; top: 0; z-index: var(--z-nav); display: flex; align-items: center; gap: var(--sp-3); height: var(--topbar-h);
  padding: 0 var(--gutter); background: var(--surface); border-bottom: var(--border-w) solid var(--border-subtle);
}
.z-scope { display: flex; flex: 0 1 auto; align-items: center; gap: var(--sp-2); min-width: 0; overflow: hidden; color: var(--text-2); }
.z-scope-site > span { overflow: hidden; text-overflow: ellipsis; }
.z-scope-part { display: inline-flex; align-items: center; gap: var(--sp-2); min-width: 0; white-space: nowrap; }
.z-scope-part > .z-icon { color: var(--text-2); }
.z-scope-company { overflow: hidden; text-overflow: ellipsis; color: var(--text); font-weight: var(--fw-semibold); }
.z-scope-sep { color: var(--text-3); }
.z-topbar-actions { display: flex; align-items: center; gap: var(--sp-2); margin-left: auto; }
.z-usermenu-summary { display: flex; align-items: center; gap: var(--sp-2); min-height: var(--target-min); padding: 0 var(--sp-2); border-radius: var(--radius-control); color: var(--text); }
.z-usermenu-summary:hover { background: var(--surface-hover); }
.z-usermenu-summary > .z-icon { color: var(--text-2); }
.z-usermenu-name { max-width: 18ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: var(--fw-medium); }
.z-usermenu-head { display: grid; gap: var(--sp-05); padding: var(--sp-2) var(--sp-3) var(--sp-3); }
.z-usermenu-email { font-size: var(--fs-small); color: var(--text-2); overflow-wrap: anywhere; }
.z-usermenu-head .z-tag { justify-self: start; margin-top: var(--sp-1); }
.z-app-main { width: 100%; max-width: var(--content-max); padding: var(--sp-6) var(--gutter) var(--sp-16); }

/* Workspace preferences (session, POST /prefs) and the site switcher. */
.z-appnav-fold { display: flex; }
.z-segmented--2 { grid-template-columns: repeat(2, 1fr); }
.z-site-switch { gap: var(--sp-2); }
.z-site-switch .z-btn[hidden] { display: none; }
.z-site-select { width: auto; min-width: 0; max-width: 24ch; }
.z-app[data-nav="collapsed"] { grid-template-columns: var(--nav-w-collapsed) minmax(0, 1fr); }
.z-app[data-nav="collapsed"] .z-appnav-head { justify-content: center; padding: 0; }
.z-app[data-nav="collapsed"] .z-appnav-brand, .z-app[data-nav="collapsed"] .z-side-items, .z-app[data-nav="collapsed"] .z-side-pinned { display: none; }
.z-app[data-nav="collapsed"] .z-sidebar { padding-inline: var(--sp-2); }
.z-app[data-nav="collapsed"] .z-side-link { justify-content: center; padding: 0; }
.z-app[data-nav="collapsed"] .z-side-link > span,
.z-app[data-nav="collapsed"] .z-side-summary > span:last-child {
  position: absolute; width: var(--border-w); height: var(--border-w); margin: calc(var(--border-w) * -1);
  overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}
.z-app[data-nav="collapsed"] .z-side-summary { justify-content: center; padding: 0; }

.z-filter-panel { display: grid; gap: var(--sp-4); padding: var(--sp-4); background: var(--surface); border: var(--border-w) solid var(--border); border-radius: var(--radius-card); }
.z-filter-panel .z-fieldset { margin: 0; }
main [id]:target { outline: var(--focus-w) solid var(--focus); outline-offset: var(--focus-offset); scroll-margin-top: var(--sp-16); } /* the demo tour's highlight (D76) */
.z-steps { display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-6); padding: 0; margin: 0; list-style: none; }
.z-step { display: flex; align-items: center; gap: var(--sp-2); color: var(--text-2); }
.z-step-mark {
  display: inline-flex; align-items: center; justify-content: center; width: var(--icon-md); height: var(--icon-md);
  border: var(--border-w-strong) solid var(--border-strong); border-radius: var(--radius-pill);
}
.z-step-mark .z-icon { width: var(--fs-caption); height: var(--fs-caption); stroke-width: 2.5; }
.z-step--active { color: var(--text); font-weight: var(--fw-medium); }
.z-step--active .z-step-mark { border-color: var(--accent); background: var(--accent-subtle); }
.z-step--done .z-step-mark { border-color: var(--success); background: var(--success); color: var(--surface); }

/* Public site */
.z-public-header { position: sticky; top: 0; z-index: var(--z-nav); background: var(--surface); border-bottom: var(--border-w) solid var(--border-subtle); }
.z-public-header-inner {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-6);
  max-width: var(--content-max); margin: 0 auto; padding: var(--sp-2) var(--gutter);
}
.z-public-brand { color: var(--text); text-decoration: none; }
.z-public-nav { display: flex; flex: 1 1 auto; gap: var(--sp-1); min-width: 0; overflow-x: auto; }
.z-public-link {
  display: inline-flex; align-items: center; min-height: var(--target-min); padding: 0 var(--sp-3); border-radius: var(--radius-control);
  color: var(--text-2); font-weight: var(--fw-medium); text-decoration: none; white-space: nowrap;
}
.z-public-link:hover { background: var(--surface-hover); color: var(--text); }
.z-public-actions { display: flex; gap: var(--sp-2); margin-left: auto; }
.z-public-main { min-height: 60vh; }
.z-hero { max-width: var(--content-max); margin: 0 auto; padding: var(--sp-16) var(--gutter) var(--sp-10); }
.z-hero--page { padding-bottom: var(--sp-4); }
.z-hero-title { max-width: 24ch; font-size: clamp(var(--fs-headline), 5vw, var(--hero-fs)); line-height: 1.12; letter-spacing: -0.022em; }
.z-hero-line { max-width: 60ch; margin-top: var(--sp-4); font-size: var(--fs-title-sm); line-height: var(--lh-title-sm); color: var(--text-2); }
.z-hero-actions { display: flex; flex-wrap: wrap; gap: var(--sp-3); margin-top: var(--sp-8); }
.z-section { max-width: var(--content-max); margin: 0 auto; padding: var(--sp-10) var(--gutter); }
.z-section-heading { margin-bottom: var(--sp-6); font-size: var(--fs-headline); line-height: var(--lh-headline); }
.z-section-heading:has(+ .z-section-lead) { margin-bottom: var(--sp-2); }
.z-section-lead { max-width: var(--measure); margin-bottom: var(--sp-6); font-size: var(--fs-body-lg); line-height: var(--lh-body-lg); color: var(--text-2); }
.z-section-foot { margin-top: var(--sp-4); }
.z-prose { max-width: var(--measure); }
.z-prose .z-heading { margin-bottom: var(--sp-3); }
.z-prose .z-text { font-size: var(--fs-body-lg); line-height: var(--lh-body-lg); }
.z-grid { display: grid; gap: var(--sp-4); padding: 0; list-style: none; grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr)); }
.z-grid--2 { grid-template-columns: repeat(auto-fill, minmax(min(100%, 24rem), 1fr)); }
.z-grid--4 { grid-template-columns: repeat(auto-fill, minmax(min(100%, 14rem), 1fr)); }
.z-quote { padding: var(--sp-5); background: var(--surface); border: var(--border-w) solid var(--border); border-radius: var(--radius-card); }
.z-quote blockquote { font-size: var(--fs-title-sm); line-height: var(--lh-title-sm); }
.z-quote figcaption { margin-top: var(--sp-3); }
.z-logo-row { display: flex; flex-wrap: wrap; gap: var(--sp-2); padding: 0; margin: var(--sp-6) 0 0; list-style: none; }
.z-logo-item { padding: var(--sp-1) var(--sp-3); border: var(--border-w) solid var(--border); border-radius: var(--radius-pill); color: var(--text-2); font-size: var(--fs-small); font-weight: var(--fw-medium); }
.z-cta {
  display: flex; flex-direction: column; align-items: center; gap: var(--sp-3); max-width: var(--content-max); margin: var(--sp-10) auto 0;
  padding: var(--sp-16) var(--gutter); text-align: center; border-top: var(--border-w) solid var(--border-subtle);
}
.z-cta-title { font-size: var(--fs-headline); line-height: var(--lh-headline); }
.z-cta .z-btn { margin-top: var(--sp-3); }
.z-footer { margin-top: var(--sp-10); background: var(--surface-sunken); border-top: var(--border-w) solid var(--border-subtle); }
.z-footer-inner {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-4) var(--sp-8);
  max-width: var(--content-max); margin: 0 auto; padding: var(--sp-8) var(--gutter);
}
.z-footer-brand { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-3); font-size: var(--fs-small); }
.z-footer-nav, .z-footer-langs { display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-5); font-size: var(--fs-small); }
.z-footer-langs { flex-basis: 100%; padding-top: var(--sp-4); border-top: var(--border-w) solid var(--border-subtle); }
.z-footer-langs .z-link { color: var(--text-2); }
.z-footer-langs .z-link[aria-current] { color: var(--text); font-weight: var(--fw-semibold); text-decoration: none; }

/* ---------- Pages ---------- */
.z-form { max-width: var(--form-max); }
.z-form--wide { max-width: none; } /* a form around a wide table (the purchase plan) spans the page; others keep the field width */
/* Form section (organism_form_section): a native <fieldset> + <legend>
   grouping. The legend names the group accessibly, and the <h2> inside it
   keeps the document heading outline; the gold dot before the title is the
   brand's "small dot" signature, decorative - the heading text is the only
   meaning carrier. Sections separate with whitespace, never a nested card. */
.z-form-section { min-width: 0; border: 0; padding: 0; margin: 0; }
.z-form-section + .z-form-section { margin-top: var(--sp-10); }
.z-form-section > legend { display: block; width: 100%; max-width: 100%; padding: 0; margin: 0; }
.z-form-section-title { display: block; width: 100%; padding: 0; margin: 0 0 var(--sp-1); font-family: var(--font-display); font-size: var(--fs-title-sm); line-height: var(--lh-title-sm); font-weight: var(--fw-semibold); letter-spacing: var(--tracking-tight); color: var(--text); }
.z-form-section-title::before { content: ""; display: inline-block; width: var(--sp-1); height: var(--sp-1); border-radius: 50%; background: var(--gold-500); margin-right: var(--sp-2); vertical-align: var(--sp-05); }
.z-form-section-desc { margin: 0 0 var(--sp-5); max-width: var(--measure); color: var(--text-2); }
.z-fields { display: block; }
/* The product create/edit form carries a full-width variant table: the
   form itself is not width-capped (the mock shows full-width panels), the
   individual .z-field controls keep their --form-max measure. */
.z-form[data-variant-form] { max-width: none; }
.z-form-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--sp-3); margin-top: var(--sp-8); padding-top: var(--sp-6); border-top: var(--border-w) solid var(--border-subtle); }
.z-lookup { max-width: var(--form-max); margin-bottom: var(--sp-6); }
.z-lookup-row { display: flex; gap: var(--sp-2); }
.z-lookup-row .z-input { flex: 1; min-width: 0; }
.z-lookup-result > * + * { margin-top: var(--sp-4); }
.z-lookup-result .z-alert { margin-bottom: 0; }
.z-actions { display: flex; flex-wrap: wrap; align-items: flex-start; gap: var(--sp-3); }
.z-linkgrid { display: grid; gap: var(--sp-2); padding: 0; margin: 0; list-style: none; grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr)); }
.z-linkcard {
  display: flex; align-items: center; gap: var(--sp-3); min-height: var(--target-min); padding: var(--sp-3) var(--sp-4);
  background: var(--surface); border: var(--border-w) solid var(--border); border-radius: var(--radius-card); color: var(--text); font-weight: var(--fw-medium); text-decoration: none;
}
.z-linkcard:hover { border-color: var(--border-strong); }
.z-linkcard > .z-icon { color: var(--text-2); }
.z-linkcard > .z-icon:last-child { margin-left: auto; }
.z-auth-main { display: flex; flex-direction: column; align-items: center; gap: var(--sp-6); min-height: 100vh; padding: var(--sp-12) var(--gutter); }
.z-auth-content { display: flex; flex-direction: column; align-items: center; gap: var(--sp-6); width: 100%; }
.z-auth-brand { color: var(--text); text-decoration: none; }
.z-auth-card { width: min(100%, var(--auth-w)); padding: var(--sp-8); background: var(--surface); border: var(--border-w) solid var(--border); border-radius: var(--radius-card); }
.z-auth-content > .z-error-summary { width: min(100%, var(--auth-w)); margin: 0; }
.z-auth-title { margin-bottom: var(--sp-6); font-size: var(--fs-headline); line-height: var(--lh-headline); }
.z-auth-lead { margin-bottom: var(--sp-4); color: var(--text-2); }
.z-auth-card .z-form-actions, .z-auth-card .z-btn--block { margin-top: var(--sp-2); }
.z-auth-alt { display: grid; gap: var(--sp-2); padding: var(--sp-5) 0 0; margin: var(--sp-6) 0 0; list-style: none; color: var(--text-2); border-top: var(--border-w) solid var(--border-subtle); }
.z-auth-back { font-size: var(--fs-small); }
.z-secret { display: block; padding: var(--sp-3); font-family: var(--font-mono); font-size: var(--fs-body); word-break: break-all; background: var(--surface-sunken); border-radius: var(--radius-control); }
.z-print-main { max-width: calc(var(--form-max) * 1.5); margin: 0 auto; padding: var(--sp-8) var(--gutter) var(--sp-16); }
.z-print-actions { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--sp-3); margin-bottom: var(--sp-6); }
.z-invoice { padding: var(--sp-10); background: var(--surface); border: var(--border-w) solid var(--border); border-radius: var(--radius-card); }
.z-invoice-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: var(--sp-6); padding-bottom: var(--sp-6); border-bottom: var(--border-w) solid var(--border); }
.z-invoice-id { text-align: right; }
.z-invoice-issuer { display: grid; gap: var(--sp-1); }
.z-invoice-issuer-name, .z-invoice-party-name { font-size: var(--fs-title-sm); font-weight: var(--fw-semibold); }
.z-invoice-facts { display: grid; gap: var(--sp-1); margin-top: var(--sp-2); }
.z-invoice-facts > div { display: flex; justify-content: flex-end; gap: var(--sp-3); }
.z-invoice-facts dt { color: var(--text-2); }
.z-invoice-parties { display: flex; flex-wrap: wrap; gap: var(--sp-6); margin: var(--sp-6) 0; }
.z-invoice-party { flex: 1 1 16rem; display: grid; gap: var(--sp-1); align-content: start; }
.z-invoice-party-h { font-size: var(--fs-small); font-weight: var(--fw-semibold); color: var(--text-2); text-transform: uppercase; letter-spacing: .04em; }
.z-invoice-taxes { margin-top: var(--sp-6); }
.z-invoice-taxes .z-table-wrap { max-height: none; }
.z-invoice-title { font-size: var(--fs-headline); line-height: var(--lh-headline); }
.z-invoice-number { font-size: var(--fs-body-lg); color: var(--text-2); }
.z-invoice-meta { margin: var(--sp-6) 0; }
.z-invoice-lines .z-table-wrap { max-height: none; }
.z-invoice-totals { display: grid; width: min(100%, 20rem); margin: var(--sp-6) 0 0 auto; }
.z-invoice-totals > div { display: flex; justify-content: space-between; gap: var(--sp-4); padding: var(--sp-2) 0; border-bottom: var(--border-w) solid var(--border-subtle); }
.z-invoice-totals dt { color: var(--text-2); }
.z-invoice-grand { font-size: var(--fs-title-sm); font-weight: var(--fw-semibold); border-top: var(--border-w-strong) solid var(--text); }
.z-invoice-grand dt { color: var(--text); }
.z-invoice-note { margin-top: var(--sp-8); font-size: var(--fs-small); color: var(--text-2); }

/* ---------- Gallery: the visual contract ---------- */
.z-gallery-toc { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-top: var(--sp-6); }
.z-gallery-sub { margin: var(--sp-8) 0 var(--sp-3); font-size: var(--fs-title-sm); line-height: var(--lh-title-sm); }
.z-swatches { display: grid; gap: var(--sp-3); padding: 0; list-style: none; grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); }
.z-swatch { display: flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-small); }
.z-swatch-chip { flex: none; width: var(--sp-8); height: var(--sp-8); border: var(--border-w) solid var(--border); border-radius: var(--radius-control); }
.z-sw-bg { background: var(--bg); }
.z-sw-surface { background: var(--surface); }
.z-sw-surface-sunken { background: var(--surface-sunken); }
.z-sw-surface-selected { background: var(--surface-selected); }
.z-sw-text { background: var(--text); }
.z-sw-text-2 { background: var(--text-2); }
.z-sw-text-3 { background: var(--text-3); }
.z-sw-border-subtle { background: var(--border-subtle); }
.z-sw-border { background: var(--border); }
.z-sw-border-strong { background: var(--border-strong); }
.z-sw-accent { background: var(--accent); }
.z-sw-accent-subtle { background: var(--accent-subtle); }
.z-sw-success { background: var(--success); }
.z-sw-success-subtle { background: var(--success-subtle); }
.z-sw-warning { background: var(--warning); }
.z-sw-warning-subtle { background: var(--warning-subtle); }
.z-sw-danger { background: var(--danger); }
.z-sw-danger-subtle { background: var(--danger-subtle); }
.z-sw-chart-muted { background: var(--chart-muted); }
.z-typescale > p { display: flex; align-items: baseline; gap: var(--sp-4); padding: var(--sp-2) 0; border-bottom: var(--border-w) solid var(--border-subtle); }
.z-typescale code { flex: none; width: 6rem; font-size: var(--fs-caption); font-weight: var(--fw-regular); color: var(--text-2); }
.z-icon-grid { display: grid; gap: var(--sp-2); padding: 0; list-style: none; grid-template-columns: repeat(auto-fill, minmax(8rem, 1fr)); }
.z-icon-grid li { display: flex; align-items: center; gap: var(--sp-2); padding: var(--sp-2); font-size: var(--fs-caption); color: var(--text-2); border: var(--border-w) solid var(--border-subtle); border-radius: var(--radius-control); }
.z-icon-grid .z-icon { width: var(--icon-md); height: var(--icon-md); color: var(--text); }
.z-gallery-pair { display: grid; align-items: start; gap: var(--sp-4); grid-template-columns: repeat(auto-fit, minmax(min(100%, 28rem), 1fr)); }
.z-gallery-list { display: grid; gap: var(--sp-4); }
.z-gallery-list--grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 22rem), 1fr)); }
.z-gallery-item { min-width: 0; padding: var(--sp-5); background: var(--surface); border: var(--border-w) solid var(--border); border-radius: var(--radius-card); }
.z-gallery-head { margin-bottom: var(--sp-4); }
.z-gallery-name { margin-bottom: var(--sp-1); font-size: var(--fs-body); line-height: var(--lh-body); }
.z-gallery-states { display: flex; flex-wrap: wrap; align-items: flex-start; gap: var(--sp-4) var(--sp-6); }
.z-gallery-list:not(.z-gallery-list--grid) .z-gallery-states { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr)); }
.z-gallery-state { min-width: 0; max-width: 100%; }
.z-gallery-label { margin-bottom: var(--sp-2); font-size: var(--fs-caption); line-height: var(--lh-caption); font-weight: var(--fw-medium); color: var(--text-2); text-transform: uppercase; letter-spacing: var(--tracking-caps); }
.z-gallery-demo { min-width: 0; }
.z-gallery-demo .z-toaster, .z-gallery-demo .z-topbar, .z-gallery-demo .z-public-header { position: static; width: auto; }
.z-gallery-demo .z-topbar { border: var(--border-w) solid var(--border-subtle); border-radius: var(--radius-card); }
.z-gallery-demo .z-menu-panel { position: static; margin-top: var(--sp-2); box-shadow: var(--shadow-1); }
.z-gallery-demo .z-sidebar { max-width: var(--nav-w); background: var(--side-bg); border-radius: var(--radius-card); padding-top: var(--sp-3); }
.z-gallery-demo .z-hero, .z-gallery-demo .z-cta { padding: var(--sp-6) 0; margin: 0; }
.z-gallery-demo .z-footer { margin-top: 0; }
.z-gallery-demo > .z-alert { margin-bottom: 0; }

/* ---------- Fiscal QR (Veri*factu invoice block) ---------- */
.z-fiscal-qr { display: inline-flex; flex-direction: column; align-items: center; gap: var(--sp-1); padding: var(--sp-2); background: var(--stone-0); color: var(--stone-900); border-radius: var(--radius-control); }
.z-fiscal-qr-text { font-size: var(--fs-body); line-height: var(--lh-body); font-weight: var(--fw-semibold); text-align: center; }
.z-fiscal-qr-legend { letter-spacing: var(--tracking-caps); }
.z-qr { display: block; flex: none; }
.z-qr path { fill: var(--stone-900); }
.z-invoice-detail { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: var(--sp-6); }
.z-invoice-detail > .z-kv { flex: 1 1 24rem; }

/* ---------- Public site: product shots, devices, trust ---------- */
.z-section--shot { padding-top: 0; }
.z-section--strip { padding-block: var(--sp-8); }
.z-strip-heading { margin-bottom: var(--sp-4); font-size: var(--fs-small); line-height: var(--lh-small); font-weight: var(--fw-medium); color: var(--text-2); text-transform: uppercase; letter-spacing: var(--tracking-caps); }
.z-shot { margin: 0; }
.z-shot-stage { position: relative; }
.z-shot-caption { margin-top: var(--sp-5); text-align: center; color: var(--text-2); font-size: var(--fs-body-lg); line-height: var(--lh-body-lg); }
.z-shot .z-btn { cursor: default; pointer-events: none; }
.z-shot--duo .z-shot-stage, .z-shot--shop .z-shot-stage { display: flex; align-items: flex-end; justify-content: center; }
.z-shot--duo .z-laptop, .z-shot--shop .z-tablet { flex: 1 1 auto; min-width: 0; }
.z-shot--duo .z-phone { flex: none; margin-left: calc(var(--sp-16) * -1.5); margin-bottom: calc(var(--sp-6) * -1); z-index: 1; }
.z-shot--shop .z-shot-stage { gap: var(--sp-10); }
.z-shot--shop .z-phone { margin: 0; }

/* Laptop: lid with a bezel and browser chrome, a wider base. */
.z-laptop { max-width: var(--laptop-w); margin: 0 auto; }
.z-laptop-lid { margin: 0 4%; padding: var(--bezel-w); background: var(--device-bezel); border-radius: var(--radius-sheet) var(--radius-sheet) 0 0; box-shadow: 0 0 0 var(--border-w) var(--device-edge), var(--shadow-2); }
.z-laptop-chrome { display: flex; gap: var(--sp-1); padding: 0 0 var(--sp-2) var(--sp-1); }
.z-laptop-chrome span { width: var(--sp-2); height: var(--sp-2); border-radius: var(--radius-pill); background: var(--device-side); }
.z-laptop-base { height: var(--sp-4); background: linear-gradient(var(--device-edge), var(--device-side)); border-radius: 0 0 var(--radius-sheet) var(--radius-sheet); }
.z-laptop-base::before { content: ""; display: block; width: 16%; height: var(--sp-1); margin: 0 auto; background: var(--device-bezel); border-radius: 0 0 var(--radius-control) var(--radius-control); }

/* Tablet in a counter dock, with the Bluetooth card reader beside it. */
.z-tablet { position: relative; max-width: calc(var(--laptop-w) * 0.8); padding-right: calc(var(--reader-w) + var(--sp-2)); }
.z-tablet-body { padding: calc(var(--bezel-w) * 1.6); background: var(--device-bezel); border-radius: calc(var(--radius-sheet) * 2); box-shadow: 0 0 0 var(--border-w) var(--device-edge), var(--shadow-2); }
.z-tablet-dock { width: 28%; height: var(--sp-10); margin: 0 auto; background: linear-gradient(var(--device-side), var(--device-bezel)); clip-path: polygon(12% 0, 88% 0, 100% 100%, 0 100%); }
.z-reader { position: absolute; right: 0; bottom: 0; display: flex; justify-content: center; width: var(--reader-w); aspect-ratio: 3 / 5; padding-top: var(--sp-3); background: var(--device-bezel); border-radius: var(--radius-sheet); box-shadow: 0 0 0 var(--border-w) var(--device-edge); }
.z-reader-screen { display: flex; align-items: center; justify-content: center; width: 70%; height: 32%; border-radius: var(--radius-control); background: var(--accent-subtle); color: var(--accent); }

/* Phone: pure CSS 3D - perspective, tilt, a layered side edge, notch. */
.z-phone { perspective: var(--phone-perspective); }
.z-phone-body {
  position: relative; width: var(--phone-w); aspect-ratio: 9 / 19; padding: var(--sp-2); background: var(--device-bezel); border-radius: var(--phone-radius);
  transform: rotateY(var(--phone-tilt-y)) rotateX(var(--phone-tilt-x)); transform-style: preserve-3d;
  box-shadow: inset 0 0 0 var(--border-w-strong) var(--device-edge), var(--sp-1) 0 0 var(--device-side), var(--sp-2) var(--sp-05) 0 var(--device-side), var(--shadow-2);
}
.z-phone-body::before { content: ""; position: absolute; top: var(--sp-3); left: 50%; z-index: 1; width: 26%; height: var(--sp-5); transform: translateX(-50%); background: var(--device-bezel); border-radius: var(--radius-pill); }
.z-phone-screen { height: 100%; overflow: hidden; background: var(--bg); border-radius: calc(var(--phone-radius) - var(--sp-2)); }
/* The status bar keeps its middle third clear for the notch (26% of the
   body) and scales its type with the phone: the clock and the signal sit
   centred in the two "ears", clear of the notch at every width. */
.z-phone-status { display: grid; grid-template-columns: 1fr 34% 1fr; align-items: center; padding: var(--sp-3) var(--sp-2) var(--sp-2); font-size: min(var(--fs-caption), calc(var(--phone-w) / 20)); font-weight: var(--fw-semibold); }
.z-phone-status > .z-num { grid-column: 1; justify-self: center; }
.z-phone-status > .z-phone-signal { grid-column: 3; justify-self: center; }
.z-phone-signal { width: var(--sp-5); height: var(--sp-2); border: var(--border-w) solid currentColor; border-radius: var(--radius-control); }
@media (prefers-reduced-motion: no-preference) {
  .z-phone-body { transition: transform var(--dur-slow) var(--ease-standard); }
  .z-phone:hover .z-phone-body { transform: rotateY(calc(var(--phone-tilt-y) / 3)) rotateX(0deg); }
}

/* Screen: the app at a reduced zoom (the real components, scaled). */
.z-screen { zoom: var(--shot-zoom); overflow: hidden; background: var(--bg); color: var(--text); border-radius: var(--radius-control); }
.z-screen--mobile { zoom: var(--phone-zoom); border-radius: 0; }
.z-screen-bar { display: flex; align-items: center; gap: var(--sp-3); min-height: var(--topbar-h); padding: 0 var(--sp-4); background: var(--surface); border-bottom: var(--border-w) solid var(--border-subtle); }
.z-screen-app { font-weight: var(--fw-semibold); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.z-screen-site { display: inline-flex; align-items: center; gap: var(--sp-1); color: var(--text-2); white-space: nowrap; }
.z-screen-bar .z-status { margin-left: auto; white-space: nowrap; }
.z-screen--mobile .z-screen-site, .z-screen--mobile .z-status { display: none; }
.z-screen-grid { display: grid; gap: var(--sp-4); padding: var(--sp-5); grid-template-columns: repeat(auto-fit, minmax(min(100%, 24rem), 1fr)); }
.z-screen--mobile .z-screen-grid { padding: var(--sp-3); }
.z-shot-panel { min-width: 0; padding: var(--sp-4); background: var(--surface); border: var(--border-w) solid var(--border); border-radius: var(--radius-card); }
.z-shot-panel--wide { grid-column: 1 / -1; }
.z-shot-panel--kpis, .z-shot-panel--alert, .z-shot-panel--pos { padding: 0; background: none; border: 0; }
.z-shot-panel .z-alert { margin: 0; }
.z-shot-title { margin-bottom: var(--sp-3); font-weight: var(--fw-semibold); }
.z-shot-meta { color: var(--text-2); font-size: var(--fs-small); }
.z-shot-kpis { display: grid; gap: var(--sp-3); grid-template-columns: repeat(auto-fit, minmax(min(100%, 11rem), 1fr)); }
.z-shot .z-stat { padding: var(--sp-4); }
.z-shot .z-stat-value { font-size: var(--fs-headline); line-height: var(--lh-headline); white-space: nowrap; overflow-wrap: normal; }
.z-shot-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.z-shot-table th, .z-shot-table td { padding: var(--sp-2); text-align: left; white-space: nowrap; border-bottom: var(--border-w) solid var(--border-subtle); }
.z-shot-table th { color: var(--text-2); font-size: var(--fs-small); font-weight: var(--fw-medium); }
.z-shot-table tr:last-child td { border-bottom: 0; }
.z-shot-table .z-k-num { text-align: right; }
.z-shot-table .z-k-mark { padding-inline: var(--sp-1); text-align: center; }
.z-shot-table .z-k-band, .z-shot-table .z-k-bar { width: 45%; }
.z-shot-legend { margin-top: var(--sp-2); color: var(--text-2); font-size: var(--fs-small); }
.z-mark--danger { color: var(--danger); }
.z-mark--warning { color: var(--warning-text); }
.z-shot-meter { display: flex; align-items: center; gap: var(--sp-2); }
.z-shot-track { flex: 1 1 auto; min-width: var(--sp-16); height: var(--sp-3); }
.z-t-bg { fill: var(--surface-sunken); }
.z-t-band { fill: var(--accent-subtle); stroke: var(--accent); stroke-width: 0.6; vector-effect: non-scaling-stroke; }
.z-t-mark, .z-t-fill { fill: var(--accent); }
.z-t-fill--warning { fill: var(--warning); }
.z-shot-tree, .z-shot-bars, .z-shot-list, .z-shot-rows { display: grid; gap: var(--sp-1); padding: 0; list-style: none; }
.z-shot-tree li { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); padding: var(--sp-2) var(--sp-3); border-left: var(--border-w-strong) solid var(--border); }
.z-shot-d0 { border-left-color: var(--accent); }
.z-shot-d1 { margin-left: var(--sp-6); }
.z-shot-d2 { margin-left: var(--sp-12); }
.z-shot-d3 { margin-left: calc(var(--sp-12) + var(--sp-6)); }
.z-shot-bars li { display: grid; grid-template-columns: minmax(8rem, 1fr) 2fr; align-items: center; gap: var(--sp-3); padding: var(--sp-1) 0; }
.z-shot-rows li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-2); padding: var(--sp-2) 0; border-bottom: var(--border-w) solid var(--border-subtle); }
.z-shot-panel--recall .z-btn { margin-top: var(--sp-3); }
.z-shot-list li { display: flex; align-items: center; gap: var(--sp-3); min-height: var(--target-min); padding: 0 var(--sp-2); border-bottom: var(--border-w) solid var(--border-subtle); }
.z-shot-time { flex: none; color: var(--text-2); }
.z-shot-check { display: inline-flex; flex: none; align-items: center; justify-content: center; width: var(--check-size); height: var(--check-size); border: var(--border-w-strong) solid var(--border-strong); border-radius: var(--radius-control); }
.z-shot-done .z-shot-check { background: var(--success); border-color: var(--success); color: var(--surface); }
.z-shot-done .z-shot-item { color: var(--text-2); text-decoration: line-through; }
.z-shot-now { background: var(--surface-selected); border-radius: var(--radius-control); }
.z-shot-qty { margin-left: auto; font-weight: var(--fw-semibold); }
.z-shot-total { display: flex; justify-content: space-between; align-items: baseline; padding-top: var(--sp-2); font-weight: var(--fw-semibold); }
.z-shot-total strong { font-size: var(--fs-title); }
.z-shot-invoice-head { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--sp-4); margin-bottom: var(--sp-3); }
.z-shot .z-qr { width: var(--qr-shot); height: var(--qr-shot); }
.z-pos { display: grid; grid-template-columns: 2fr minmax(13rem, 1fr); gap: var(--sp-4); }
.z-pos-tabs { display: flex; gap: var(--sp-2); margin-bottom: var(--sp-3); }
.z-chip--on { background: var(--surface-selected); border-color: var(--accent); color: var(--accent); }
.z-pos-tiles { display: grid; gap: var(--sp-2); grid-template-columns: repeat(auto-fill, minmax(min(100%, 8.5rem), 1fr)); }
.z-pos-tile { display: flex; flex-direction: column; justify-content: space-between; gap: var(--sp-3); min-height: calc(var(--sp-16) + var(--sp-8)); padding: var(--sp-3); background: var(--surface); border: var(--border-w) solid var(--border); border-radius: var(--radius-card); }
.z-pos-tile-foot { display: flex; justify-content: space-between; }
.z-pos-cart { display: flex; flex-direction: column; gap: var(--sp-2); padding: var(--sp-4); background: var(--surface); border: var(--border-w) solid var(--border); border-radius: var(--radius-card); }
.z-pos-reader { align-self: flex-start; }
.z-pos-line { display: flex; justify-content: space-between; gap: var(--sp-2); }
.z-pos-charge { margin-top: auto; min-height: var(--sp-12); }

/* Trust: logos on light plates (both modes), wordmarks, badges. */
.z-plates { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-4) var(--sp-8); padding: 0; list-style: none; }
.z-plate { display: flex; align-items: center; justify-content: center; min-height: var(--plate-h); padding: var(--sp-4) var(--sp-6); background: var(--stone-0); border: var(--border-w) solid var(--stone-200); border-radius: var(--radius-card); }
.z-plate img { display: block; width: auto; max-width: 100%; height: var(--logo-h); }
.z-plate--tall img { height: var(--logo-h-tall); }
.z-plate--clear { flex: none; padding: var(--badge-clear); }
.z-plate--clear img { height: var(--badge-clear); }
.z-integrations { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-6) var(--sp-10); }
.z-wordmarks { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--sp-4) var(--sp-8); padding: 0; list-style: none; }
.z-wordmark { font-size: var(--fs-title); line-height: var(--lh-title); font-weight: var(--fw-semibold); letter-spacing: var(--tracking-tight); color: var(--text); }
.z-wordmark sup { font-size: 0.5em; font-weight: var(--fw-regular); }
.z-wordmark-note { margin-left: var(--sp-2); font-size: var(--fs-caption); font-weight: var(--fw-medium); color: var(--text-2); letter-spacing: var(--tracking-caps); }
.z-fineprint { max-width: var(--measure); margin-top: var(--sp-5); font-size: var(--fs-caption); line-height: var(--lh-caption); color: var(--text-2); }
.z-cbadges { display: grid; gap: var(--sp-3); padding: 0; list-style: none; grid-template-columns: repeat(auto-fill, minmax(min(100%, 18rem), 1fr)); }
.z-cbadge { display: grid; grid-template-columns: auto 1fr; align-content: start; gap: var(--sp-1) var(--sp-3); padding: var(--sp-4); background: var(--surface); border: var(--border-w) solid var(--border); border-radius: var(--radius-card); }
.z-cbadge > .z-icon { grid-row: span 3; width: var(--icon-lg); height: var(--icon-lg); color: var(--accent); }
.z-cbadge-line, .z-cbadge-link { font-size: var(--fs-small); line-height: var(--lh-small); }
.z-cbadge-line { color: var(--text-2); }

/* ---------- Charts (charts.go): token colours, so dark mode is free ---------- */
.z-chart { margin: 0; }
.z-chart-svg { display: block; width: 100%; height: auto; overflow: visible; font-family: var(--font-sans); }
.z-chart-svg text { font-size: var(--fs-caption); fill: var(--text-2); font-variant-numeric: tabular-nums; }
.z-chart-grid line { stroke: var(--chart-grid); stroke-width: var(--border-w); }
.z-chart-line { fill: none; stroke: var(--accent); stroke-width: var(--border-w-strong); stroke-linejoin: round; stroke-linecap: round; }
.z-chart-line--muted { stroke: var(--chart-muted); }
.z-chart-dot { fill: var(--surface); }
.z-chart-svg .z-chart-name { fill: var(--text); font-weight: var(--fw-medium); }
.z-chart-svg .z-chart-name--band { fill: var(--text-2); font-weight: var(--fw-regular); }
.z-chart-band { fill: var(--accent-subtle); stroke: var(--accent); stroke-width: var(--border-w); stroke-dasharray: 4 3; stroke-opacity: 0.5; }
.z-chart-bar { fill: var(--accent); }
.z-chart-table { margin-top: var(--sp-3); }
.z-chart-table > summary { cursor: pointer; color: var(--accent); font-size: var(--fs-small); min-height: var(--target-min); display: inline-flex; align-items: center; }
.z-chart-empty { padding: var(--sp-6); color: var(--text-2); background: var(--surface-sunken); border-radius: var(--radius-card); text-align: center; }
/* The plan's timeline per machine (charts.go Gantt): bars toned by status
(a word in each bar's title and the table, never colour alone). */
.z-gantt-bar rect { fill: var(--accent); }
.z-gantt-bar--late rect { fill: var(--warning); }
.z-gantt-bar--blocked rect { fill: var(--danger); }
.z-chart-svg .z-gantt-bar text { fill: var(--text-on-accent); }
.z-chart-svg .z-gantt-bar text.z-gantt-out { fill: var(--text); }
.z-chart-svg .z-gantt-note { fill: var(--text-2); }
.z-gantt-now { stroke: var(--danger); stroke-width: var(--border-w-strong); stroke-dasharray: 4 3; }
/* The plant floor (run, synoptic): one step per row, its forms side by side
where they fit; run orders as short lists with move buttons. */
.z-steps, .z-order { display: grid; gap: var(--sp-3); margin: 0; padding: 0; list-style: none; }
.z-step-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); margin-bottom: var(--sp-3); }
.z-step-forms { display: flex; flex-wrap: wrap; gap: var(--sp-3); }
.z-step-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--sp-2); flex: 1 1 16rem; }
.z-step-form > .z-label { flex-basis: 100%; }
.z-step-form > .z-input { flex: 1 1 8rem; min-width: 0; }
.z-orders { display: grid; gap: var(--sp-4); grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr)); }
.z-order { gap: var(--sp-2); margin-top: var(--sp-3); }
.z-order-item { display: flex; align-items: center; gap: var(--sp-2); }
.z-order-ref { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.z-order-item form { display: inline; }

/* ---------- Field pages: big targets for busy hands ---------- */
.z-btn--floor { min-height: var(--target-floor); padding: 0 var(--sp-6); font-size: var(--fs-body-lg); }
.z-clock-actions { display: grid; gap: var(--sp-3); grid-template-columns: repeat(auto-fit, minmax(min(100%, 10rem), 1fr)); }
.z-field-form { max-width: var(--form-max); }

/* ---------- Sync indicator, live counters, outbox ---------- */
.z-sync { display: inline-flex; align-items: center; gap: var(--sp-2); min-height: var(--target-min); padding: 0 var(--sp-2); border-radius: var(--radius-control); color: var(--text-2); font-size: var(--fs-small); text-decoration: none; }
.z-sync:hover { background: var(--surface-hover); color: var(--text); }
.z-sync[data-state="offline"], .z-sync[data-state="pending"] { color: var(--warning-text); }
.z-sync[data-state="error"] { color: var(--danger); }
.z-sync[data-state="syncing"] > .z-icon { animation: z-spin var(--dur-slow) linear infinite; }
.z-count { margin-left: auto; min-width: var(--sp-5); padding: 0 var(--sp-1); border-radius: var(--radius-pill); background: var(--accent); color: var(--text-on-accent); font-size: var(--fs-caption); font-weight: var(--fw-semibold); text-align: center; font-variant-numeric: tabular-nums; }
.z-count:empty { display: none; }
.z-outbox { display: grid; gap: var(--sp-3); padding: 0; margin: 0; list-style: none; }
.z-outbox-item { padding: var(--sp-4); background: var(--surface); border: var(--border-w) solid var(--border); border-radius: var(--radius-card); }
.z-outbox-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-2); }
.z-outbox-meta { margin: var(--sp-1) 0 0; color: var(--text-2); font-size: var(--fs-small); }
.z-outbox-actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-top: var(--sp-3); }
.z-push-status:empty { display: none; }

/* ---------- Command palette ---------- */
.z-palette-open .z-kbd { margin-left: var(--sp-1); }
.z-palette {
  width: min(calc(100% - 2 * var(--gutter)), var(--palette-w)); margin-top: 12vh; padding: var(--sp-4); color: var(--text);
  background: var(--surface-raised); border: var(--border-w) solid var(--border); border-radius: var(--radius-sheet); box-shadow: var(--shadow-2);
}
.z-palette::backdrop { background: var(--backdrop); }
.z-palette .z-search-box { display: flex; }
.z-palette-input { width: 100%; }
.z-palette-list { max-height: var(--palette-list-h); overflow-y: auto; margin: var(--sp-3) 0 0; padding: 0; list-style: none; }
.z-palette-option { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); min-height: var(--target-min); padding: var(--sp-2) var(--sp-3); border-radius: var(--radius-control); cursor: pointer; }
.z-palette-option[hidden] { display: none; }
.z-palette-option:hover, .z-palette-option[aria-selected="true"] { background: var(--surface-selected); }
.z-palette-option[aria-selected="true"] { box-shadow: inset var(--border-w-strong) 0 0 var(--accent); }
.z-palette-group { color: var(--text-2); font-size: var(--fs-small); }
.z-palette-empty, .z-palette-hint { margin: var(--sp-3) 0 0; color: var(--text-2); font-size: var(--fs-small); }

/* ---------- Narrow screens (px only in @media conditions) ---------- */
@media (max-width: 1023px) {
  .z-app { grid-template-columns: minmax(0, 1fr); }
  .z-appnav {
    position: fixed; inset: 0 auto 0 0; z-index: calc(var(--z-nav) + 2); width: min(var(--mobile-nav-w), calc(100% - var(--sp-12))); height: 100%;
    box-shadow: var(--shadow-2); transform: translateX(-100%); visibility: hidden;
    transition: transform var(--dur-slow) var(--ease-exit), visibility 0s linear var(--dur-slow);
  }
  .z-appnav:target { transform: none; visibility: visible; transition: transform var(--dur-slow) var(--ease-enter); }
  .z-appnav:target + .z-appnav-scrim { display: block; position: fixed; inset: 0; z-index: calc(var(--z-nav) + 1); background: var(--backdrop); }
  .z-appnav-close, .z-navbtn { display: inline-flex; }
  .z-appnav-fold { display: none; }
  .z-app[data-nav="collapsed"] { grid-template-columns: minmax(0, 1fr); }
  .z-app[data-nav="collapsed"] .z-appnav-head { justify-content: space-between; padding: 0 var(--sp-5); }
  .z-app[data-nav="collapsed"] .z-appnav-brand { display: inline-flex; }
  .z-app[data-nav="collapsed"] .z-side-items { display: flex; }
  .z-app[data-nav="collapsed"] .z-side-pinned { display: grid; }
  .z-app[data-nav="collapsed"] .z-side-link { justify-content: flex-start; padding: 0 var(--sp-3); }
  .z-app[data-nav="collapsed"] .z-side-link > span,
  .z-app[data-nav="collapsed"] .z-side-summary > span:last-child { position: static; width: auto; height: auto; margin: 0; overflow: visible; clip-path: none; }
  .z-app[data-nav="collapsed"] .z-side-summary { justify-content: flex-start; padding: 0 var(--sp-2); }
  .z-navbtn { margin-left: calc(var(--sp-2) * -1); }
}
@media (max-width: 640px) {
  .z-palette-open .z-kbd { display: none; }
  .z-palette-open-label, #sync-label {
    position: absolute; width: var(--border-w); height: var(--border-w); padding: 0; margin: calc(var(--border-w) * -1);
    overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
  }
  .z-scope-sep, .z-scope-site, .z-usermenu-name { display: none; }
  .z-app-main { padding-top: var(--sp-4); }
  .z-panel, .z-invoice { padding: var(--sp-4); }
  .z-auth-main { padding-top: var(--sp-8); }
  .z-auth-card { padding: var(--sp-5); }
  .z-hero { padding-top: var(--sp-10); }
  .z-public-nav { order: 3; flex-basis: 100%; margin: 0 calc(var(--sp-3) * -1); }
  .z-public-actions .z-btn--quiet { padding: 0 var(--sp-2); }
  .z-kv-row { grid-template-columns: 1fr; gap: var(--sp-05); }
  .z-page-actions, .z-form-actions { width: 100%; }
  .z-form-actions .z-btn, .z-page-actions .z-btn { flex: 1 1 auto; }
  .z-invoice-id { text-align: left; }
  .z-invoice-facts > div { justify-content: flex-start; }
  /* Tables reflow to cards: no horizontal page scroll at 320 px. */
  .z-table-wrap { max-height: none; overflow: visible; background: none; border: 0; border-radius: 0; }
  .z-table, .z-table tbody, .z-table tfoot, .z-table tr, .z-table td, .z-table tfoot th { display: block; width: 100%; }
  .z-table thead { position: absolute; width: var(--border-w); height: var(--border-w); overflow: hidden; clip-path: inset(50%); }
  .z-table tbody > tr, .z-table tfoot > tr {
    margin-bottom: var(--sp-2); padding: var(--sp-3) var(--sp-4); background: var(--surface);
    border: var(--border-w) solid var(--border); border-radius: var(--radius-card);
  }
  .z-table td, .z-table tfoot th { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--sp-4); height: auto; padding: var(--sp-1) 0; border: 0; text-align: right; white-space: normal; overflow-wrap: anywhere; } /* a long id, URL or e-mail breaks inside its card */
  .z-table td::before { content: attr(data-label); flex: none; max-width: 50%; color: var(--text-2); font-size: var(--fs-small); text-align: left; }
  /* A multi-child cell (a switch + its consequence note) stacks its note
     full-width so it stays readable instead of collapsing to a sliver. */
  .z-table td .z-mode-note { flex-basis: 100%; margin: var(--sp-1) 0 0; }
  .z-table td:first-child { font-size: var(--fs-body-lg); font-weight: var(--fw-semibold); text-align: left; }
  .z-table td:first-child::before, .z-table-row--state td::before { content: none; }
  .z-table tbody > tr:hover > td, [data-density="compact"] .z-table tbody > tr:nth-child(even) > td { background: none; }
  .z-table-row--state > td { justify-content: center; }
  .z-table tfoot th, .z-table tfoot td { position: static; border: 0; }
}
@media (pointer: coarse) {
  .z-side-link, .z-menu-item { min-height: var(--target-min); }
  .z-footer-langs .z-link, .z-public-brand { display: inline-flex; align-items: center; min-height: var(--target-min); }
}
/* Product shots scale down (zoom) and shed optional columns; nothing overflows at 320 px. */
@media (max-width: 1023px) {
  :root { --shot-zoom: var(--shot-zoom-md); }
}
@media (max-width: 640px) {
  :root { --shot-zoom: var(--shot-zoom-sm); --phone-w: var(--phone-w-sm); --phone-zoom: var(--shot-zoom-sm); --bezel-w: var(--sp-1); --reader-w: var(--reader-w-sm); }
  .z-shot-opt { display: none; }
  .z-shot--duo:not(.z-shot--shop) .z-phone { margin-left: calc(var(--sp-12) * -1); }
  .z-shot--shop .z-shot-stage { flex-direction: column; align-items: center; gap: var(--sp-6); }
  .z-shot--shop .z-tablet { width: 100%; }
  .z-plate { padding-inline: var(--sp-4); }
}

/* ---------- Print: invoices and any page, light, chrome-free ---------- */
@media print {
  @page { margin: 16mm 14mm; }
  :root:not(.z-print-light) {
    color-scheme: light; --bg: var(--stone-0); --surface: var(--stone-0); --surface-sunken: var(--stone-0); --surface-hover: var(--stone-0);
    --text: var(--stone-900); --text-2: var(--stone-600); --text-3: var(--stone-550); --border: var(--stone-300);
    --border-subtle: var(--stone-200); --border-strong: var(--stone-500); --accent: var(--ember-700);
  }
  body { background: var(--stone-0); font-size: var(--fs-body); }
  .z-skip-link, .z-appnav, .z-appnav-scrim, .z-topbar, .z-toaster, .z-print-actions, .z-public-header, .z-footer,
  .z-pagination, .z-search, .z-toolbar, .z-lookup, form, dialog, .z-btn, p:has(> a[download]) { display: none !important; }
  .z-app { display: block; }
  .z-app-main, .z-print-main { max-width: none; padding: 0; }
  .z-invoice, .z-panel { padding: 0; border: 0; }
  .z-table-wrap { max-height: none; overflow: visible; border-radius: 0; }
  .z-table thead { display: table-header-group; }
  .z-table thead th, .z-table tfoot td, .z-table tfoot th { position: static; }
  .z-table tr, .z-kv-row, .z-invoice-totals { break-inside: avoid; }
  .z-chart-table::details-content { content-visibility: visible; display: block; } /* the table alternative prints, open or not */
  .z-chart-table > summary { display: none; }
  a { color: inherit; text-decoration: none; }
}
/* Commercial and distribution (D67, D68): a long form's table of contents,
a proof of delivery's signature drawn from its strokes and its photo. */
.z-toc ul { display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-4); margin: 0 0 var(--sp-4); padding: 0; list-style: none; }
.z-signature { display: block; width: 100%; max-width: 22rem; height: auto; background: var(--surface); border: var(--border-w) solid var(--border); border-radius: var(--radius-card); }
.z-signature polyline { fill: none; stroke: var(--text); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.z-photo { display: block; max-width: 100%; height: auto; border-radius: var(--radius-card); }

/* ==========================================================================
   Catalog: product variants, recipe versions / escandallo / BOM, R&D trials.
   All colours are existing token roles; no new hues (PRD §7.6 closed set).
   ========================================================================== */
.z-btn--sm { min-height: var(--target-min); padding: 0 var(--sp-3); font-size: var(--fs-small); }
.z-btn--danger-quiet { background: transparent; color: var(--danger); }
.z-btn--danger-quiet:hover { background: var(--danger-subtle); }

/* Provenance chip (honest cost lineage): auto / manual / partial / nil / current. */
.z-prov { display: inline-flex; align-items: center; gap: var(--sp-1); padding: var(--sp-05) var(--sp-2); border-radius: var(--radius-pill); font-size: var(--fs-caption); line-height: var(--lh-caption); font-weight: var(--fw-medium); white-space: nowrap; }
.z-prov .z-icon { width: var(--fs-caption); height: var(--fs-caption); stroke-width: 2.25; }
.z-prov--auto { background: var(--info-subtle); color: var(--info); }
.z-prov--manual { background: var(--surface-sunken); color: var(--text-2); }
.z-prov--partial { background: var(--warning-subtle); color: var(--warning-text); }
.z-prov--nil { background: transparent; color: var(--text-3); border: var(--border-w) dashed var(--border-strong); }
.z-prov--current { background: var(--success-subtle); color: var(--success); }
.z-prov--owner { background: var(--info-subtle); color: var(--info); }
.z-prov--breaker { background: var(--warning-subtle); color: var(--warning-text); }

/* Editable variant table (organism_variant_table). */
.z-variants .z-table-wrap { overflow-x: auto; }
.z-variants .z-table th, .z-variants .z-table td { padding-top: var(--sp-2); padding-bottom: var(--sp-2); vertical-align: top; height: auto; }
.z-variants .z-table td .z-input { margin: 0; min-height: var(--input-h); }
.z-variants .z-col--state { width: 9rem; }
.z-variants .z-col--sku { min-width: 9rem; }
.z-variants .z-col--barcode { min-width: 10rem; }
.z-variants .z-col--net, .z-variants .z-col--conv { min-width: 8rem; }
.z-variants .z-col--axis { min-width: 7rem; }
.z-variants .z-col--del { width: var(--target-min); text-align: right; }
.z-variants .z-table tbody > tr:hover > td { background: var(--surface); }
.z-variants tr.z-variant-row--error td { background: var(--danger-subtle); }
.z-variants tr.z-variant-row--warn td { background: var(--warning-subtle); }
.z-variants tfoot td { padding: var(--sp-2); }
.z-variants .z-table td[data-label] { white-space: normal; }
.z-variants .z-field { max-width: none; margin: 0; }

/* Escandallo cost hero (molecule_escandallo). */
.z-cost { background: var(--surface); border: var(--border-w) solid var(--border-subtle); border-radius: var(--radius-sheet); padding: var(--sp-5) var(--sp-6); margin-bottom: var(--sp-6); }
.z-cost-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-4); }
.z-cost-basis { color: var(--text-3); font-size: var(--fs-small); margin: var(--sp-1) 0 0; }
.z-cost-main { display: grid; grid-template-columns: auto 1fr; gap: var(--sp-2) var(--sp-8); align-items: end; margin-top: var(--sp-4); }
.z-cost-value { font-family: var(--font-mono); font-size: var(--fs-headline); line-height: var(--lh-headline); font-weight: var(--fw-medium); font-variant-numeric: tabular-nums; margin: 0; white-space: nowrap; }
.z-cost-unit { font-size: var(--fs-body-lg); color: var(--text-2); }
.z-cost-break { display: flex; flex-direction: column; gap: var(--sp-2); min-width: 0; }
.z-cost-bar { display: block; height: var(--sp-2); border-radius: var(--radius-pill); overflow: hidden; background: var(--surface-sunken); }
.z-cost-bar svg { display: block; width: 100%; height: 100%; }
.z-cost-seg--ing { fill: var(--navy-600); }
.z-cost-seg--sub { fill: var(--ember-600); }
.z-cost-legend { display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-6); margin: 0; }
.z-cost-legend > div { display: flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-small); }
.z-cost-legend dt { margin: 0; color: var(--text-2); }
.z-cost-legend dd { margin: 0; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.z-cost-legend .swatch { width: var(--sp-2); height: var(--sp-2); border-radius: var(--sp-05); flex: none; }
.z-cost-legend .swatch--ing { background: var(--navy-600); }
.z-cost-legend .swatch--sub { background: var(--ember-600); }
.z-cost-legend .swatch--nil { background: repeating-linear-gradient(45deg, var(--surface) 0 var(--sp-05), var(--border-strong) var(--sp-05) var(--sp-1)); }
.z-cost-note { margin: var(--sp-4) 0 0; font-size: var(--fs-small); color: var(--warning-text); background: var(--warning-subtle); border-radius: var(--radius-control); padding: var(--sp-2) var(--sp-3); }
.z-cost-note a { color: var(--warning-text); font-weight: var(--fw-medium); }
.z-cost-est { margin: var(--sp-4) 0 0; padding-top: var(--sp-3); border-top: var(--border-w) solid var(--border-subtle); }
@media (max-width: 640px) { .z-cost-main { grid-template-columns: 1fr; gap: var(--sp-4); } }

/* Two-column detail (recipe versions + BOM). */
.z-columns { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: var(--sp-8); align-items: start; }
.z-columns .z-panel { border-top: var(--border-w) solid var(--border); padding-top: var(--sp-5); margin-bottom: var(--sp-6); }
@media (max-width: 900px) { .z-columns { grid-template-columns: 1fr; } }

/* Version table (molecule_version_table). */
.z-row--current { background: var(--accent-subtle); }
.z-row--current td:first-child { box-shadow: inset var(--sp-05) 0 0 var(--ember-600); }
.z-vcell { display: flex; align-items: center; gap: var(--sp-2); }
.z-ver-tag { font-family: var(--font-mono); font-weight: var(--fw-medium); }
.z-col--hide-sm { display: table-cell; }
.z-table--versions th, .z-table--versions td { white-space: normal; }
/* The version table lives in the narrow 5fr detail column: let its long
   column heads ("Montaje en tienda") wrap instead of forcing the table
   wider than the column and clipping the last (cost) column. The cost
   figure itself stays on one line so "0,42 €" never breaks. */
.z-table--versions thead th { white-space: normal; }
.z-table--versions .z-col--number { white-space: nowrap; }
@media (max-width: 560px) { .z-col--hide-sm { display: none; } }

/* Nested BOM tree (organism_bom_tree). A nested <ul>/<li> list, not
   role=tree: it carries no treeitem/group children, so a plain list keeps
   the semantics honest. */
.z-bom { list-style: none; margin: 0; padding: 0; border: var(--border-w) solid var(--border-subtle); border-radius: var(--radius-card); background: var(--surface); }
.z-bom-children { list-style: none; margin: 0; padding: 0; }
.z-bom-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: var(--sp-4); align-items: baseline; padding: var(--sp-3) var(--sp-4); border-bottom: var(--border-w) solid var(--border-subtle); }
.z-bom-row:last-child { border-bottom: 0; }
.z-bom-name { display: flex; align-items: center; flex-wrap: wrap; gap: var(--sp-2); min-width: 0; }
.z-bom-name .name { font-weight: var(--fw-medium); }
.z-bom-kind { font-size: var(--fs-caption); line-height: var(--lh-caption); padding: 0 var(--sp-2); border-radius: var(--radius-pill); background: var(--info-subtle); color: var(--info); font-weight: var(--fw-medium); flex: none; }
.z-bom-kind--sub { background: var(--accent-subtle); color: var(--accent); }
.z-bom-ver { font-family: var(--font-mono); font-size: var(--fs-caption); color: var(--text-3); }
.z-bom-qty { text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; color: var(--text-2); white-space: nowrap; }
.z-bom-cost { text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.z-bom-cost .partial { display: block; font-family: var(--font-sans); font-size: var(--fs-caption); color: var(--warning-text); }
.z-bom-cost--nil { color: var(--text-3); }
.z-bom-root { background: var(--surface-sunken); }
.z-bom-root > .z-bom-row { font-weight: var(--fw-semibold); }
.z-bom-node > .z-bom-row { border-bottom: var(--border-w) dashed var(--border-subtle); }
.z-bom-node .z-bom-children { padding-left: var(--sp-6); background: var(--surface); }
.z-bom-node .z-bom-children .z-bom-name { padding-left: var(--sp-3); border-left: var(--border-w) solid var(--border); }
@media (max-width: 560px) {
  .z-bom-row { grid-template-columns: minmax(0, 1fr) auto; gap: var(--sp-2) var(--sp-3); }
  .z-bom-qty { grid-column: 1; text-align: left; }
  .z-bom-cost { grid-column: 2; grid-row: 1 / span 2; align-self: center; }
  .z-bom-node .z-bom-children { padding-left: var(--sp-3); }
}

/* Sub-recipe picker (molecule_subrecipe_picker). */
.z-picker { border: var(--border-w) dashed var(--border-strong); border-radius: var(--radius-card); padding: var(--sp-4); margin-top: var(--sp-4); background: var(--surface); }
.z-picker-title { font-weight: var(--fw-semibold); font-size: var(--fs-body); margin: 0 0 var(--sp-1); }
.z-picker-hint { color: var(--text-3); font-size: var(--fs-small); margin: 0 0 var(--sp-3); }
.z-picker-row { display: grid; grid-template-columns: minmax(0, 1.6fr) 6rem 7rem auto; gap: var(--sp-3); align-items: start; }
.z-picker > .z-picker-field { margin: 0 0 var(--sp-3); }
.z-picker-row .z-picker-field { margin: 0; }
@media (max-width: 640px) { .z-picker-row { grid-template-columns: 1fr 1fr; } .z-picker-row .z-btn { grid-column: 1 / -1; } }

/* Loose tables (evidence / history): wrapping cells, top-aligned. */
.z-table--loose th, .z-table--loose td { white-space: normal; vertical-align: top; height: auto; }
.z-muted { color: var(--text-3); }
.z-empty-cell { color: var(--text-3); }
.z-col-num { text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
th.z-col-num { text-align: right; }
.z-col-nowrap { white-space: nowrap; }

/* Stage-gate board (organism_trial_board / organism_trial_stage). */
.z-board { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: var(--sp-3); align-items: start; }
.z-stage { display: flex; flex-direction: column; gap: var(--sp-3); min-width: 0; }
.z-stage-head { display: flex; flex-direction: column; gap: var(--sp-2); padding: var(--sp-3); background: var(--surface); border: var(--border-w) solid var(--border-subtle); border-top: var(--border-w-strong) solid var(--border); border-radius: var(--radius-card); }
.z-stage-head .row { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); }
.z-stage-name { font-family: var(--font-display); font-weight: var(--fw-semibold); font-size: var(--fs-title-sm); line-height: var(--lh-title-sm); }
.z-stage-count { font-family: var(--font-mono); font-size: var(--fs-caption); color: var(--text-3); }
.z-gate { display: flex; align-items: flex-start; gap: var(--sp-2); font-size: var(--fs-caption); line-height: var(--lh-caption); color: var(--info); background: var(--info-subtle); border-radius: var(--radius-control); padding: var(--sp-2) var(--sp-3); }
.z-gate .z-icon { width: var(--icon-sm); height: var(--icon-sm); flex: none; margin-top: var(--sp-05); }
.z-gate--entry { color: var(--text-2); background: var(--surface-sunken); }
.z-gate--terminal { color: var(--danger); background: var(--danger-subtle); }
.z-stage--testing { border-top-color: var(--text-3); }
.z-stage--pilot { border-top-color: var(--info); }
.z-stage--scaleup { border-top-color: var(--warning); }
.z-stage--approved { border-top-color: var(--success); }
.z-stage--killed { border-top-color: var(--danger); }
.z-cards { display: flex; flex-direction: column; gap: var(--sp-3); }

/* Trial card (molecule_trial_card). */
.z-tcard { display: flex; flex-direction: column; gap: var(--sp-3); padding: var(--sp-4); background: var(--surface); border: var(--border-w) solid var(--border-subtle); border-radius: var(--radius-card); box-shadow: var(--shadow-1); }
.z-tcard:hover { border-color: var(--border); }
.z-tcard--selected { border-color: var(--accent); border-width: var(--border-w-strong); background: var(--surface-selected); }
.z-tcard--killed { background: var(--surface-sunken); }
.z-tcard-title { font-family: var(--font-display); font-weight: var(--fw-semibold); font-size: var(--fs-body-lg); line-height: var(--lh-body-lg); color: var(--text); }
/* The card heading opens the trial's focused detail (?id=): it keeps the
   title's ink so the board reads like the mock, and underlines on hover
   so the affordance is not colour alone. */
.z-tcard-link { color: inherit; text-decoration: none; }
.z-tcard-link:hover { color: var(--accent); text-decoration: underline; }
.z-tcard-recipe { display: flex; align-items: center; gap: var(--sp-2); margin: var(--sp-05) 0 0; font-size: var(--fs-small); color: var(--text-2); }
.z-ver { font-family: var(--font-mono); font-size: var(--fs-caption); color: var(--text-3); border: var(--border-w) solid var(--border-subtle); border-radius: var(--radius-pill); padding: 0 var(--sp-2); line-height: var(--lh-small); }
.z-evidence { display: flex; gap: var(--sp-2); margin-top: var(--sp-05); }
.z-ev { display: inline-flex; align-items: center; gap: var(--sp-1); font-size: var(--fs-caption); color: var(--text-3); }
.z-ev .z-icon { width: var(--icon-sm); height: var(--icon-sm); }
.z-ev b { font-family: var(--font-mono); font-weight: var(--fw-medium); color: var(--text-2); }
.z-ev--none { opacity: .45; }
.z-tcard-act { margin-top: auto; }

/* Trial detail: next-step action, evidence blocks, history ledger. */
.z-next { margin: var(--sp-5) 0; padding: var(--sp-4); background: var(--surface-sunken); border: var(--border-w) solid var(--border-subtle); border-radius: var(--radius-card); }
.z-next-label { font-size: var(--fs-caption); font-weight: var(--fw-semibold); color: var(--text-3); margin: 0 0 var(--sp-2); }
.z-next-actions { display: flex; gap: var(--sp-3); flex-wrap: wrap; }
.z-evidence-grid { display: grid; grid-template-columns: 1fr; gap: var(--sp-5); margin-top: var(--sp-6); }
.z-evidence-block h3 { font-family: var(--font-display); font-weight: var(--fw-semibold); font-size: var(--fs-title-sm); line-height: var(--lh-title-sm); display: flex; align-items: center; gap: var(--sp-2); margin-bottom: var(--sp-3); }
.z-evidence-block h3 .z-icon { width: var(--icon-md); height: var(--icon-md); color: var(--info); }
.z-ledger-row { display: flex; gap: var(--sp-3); align-items: baseline; flex-wrap: wrap; }
.z-ledger-trans { display: inline-flex; align-items: center; gap: var(--sp-1); flex-wrap: wrap; }
.z-ledger-arrow { color: var(--text-3); font-family: var(--font-mono); }
.z-ledger-who { font-weight: var(--fw-medium); }
.z-ledger-note { color: var(--text-2); }

/* Board responsive: 5 → 3 → 2 → 1 columns, no horizontal scroll. */
@media (max-width: 1180px) { .z-board { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 860px) { .z-board { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .z-board { grid-template-columns: 1fr; } .z-next-actions .z-btn { flex: 1; } }

/* Section subtitle (a provenance or hint line under a section title). */
.z-section-sub { margin: calc(var(--sp-3) * -1) 0 var(--sp-4); font-size: var(--fs-small); color: var(--text-2); }
/* Planning-mode consequence line (the bakery's honest translation of the enum). */
.z-mode-note { display: flex; align-items: flex-start; gap: var(--sp-2); margin: var(--sp-2) 0 var(--sp-4); padding: var(--sp-2) var(--sp-3); font-size: var(--fs-small); line-height: var(--lh-small); color: var(--info); background: var(--info-subtle); border-radius: var(--radius-control); max-width: var(--form-max); }
.z-mode-note .z-icon { width: var(--icon-sm); height: var(--icon-sm); margin-top: var(--sp-05); color: var(--info); }
/* Trial detail header and the new-trial form legend. */
.z-detail-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-4); flex-wrap: wrap; }
.z-detail-sub { display: flex; align-items: center; gap: var(--sp-2); margin-top: var(--sp-1); color: var(--text-2); font-size: var(--fs-body); }
.z-form-legend { font-size: var(--fs-caption); color: var(--text-3); margin: 0 0 var(--sp-2); }

/* RUL readout (production maintenance, D121): the ISA-101 horizon bar.
   Gray = normal, colour only at a deviation. */
.z-rul { background: var(--surface); border: var(--border-w) solid var(--border-subtle); border-radius: var(--radius-card); padding: var(--sp-5) var(--sp-5) var(--sp-4); box-shadow: var(--shadow-1); margin-bottom: var(--sp-6); }
.z-rul-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); margin-bottom: var(--sp-4); }
.z-rul-figure { display: flex; align-items: baseline; gap: var(--sp-2); }
.z-rul-num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: var(--fs-display); line-height: var(--lh-display); font-weight: var(--fw-medium); }
.z-rul-unit { color: var(--text-2); font-size: var(--fs-body-lg); }
.z-rul-track { display: block; width: 100%; height: var(--sp-2); appearance: none; -webkit-appearance: none; border: 0; border-radius: var(--radius-pill); background: var(--surface-sunken); overflow: hidden; margin: var(--sp-3) 0 var(--sp-2); }
.z-rul-track::-webkit-progress-bar { background: var(--surface-sunken); border-radius: var(--radius-pill); }
.z-rul-track::-webkit-progress-value { background: var(--stone-400); border-radius: var(--radius-pill); }
.z-rul-track::-moz-progress-bar { background: var(--stone-400); border-radius: var(--radius-pill); }
.z-rul--warn .z-rul-track::-webkit-progress-value { background: var(--warning); }
.z-rul--warn .z-rul-track::-moz-progress-bar { background: var(--warning); }
.z-rul--alarm .z-rul-track::-webkit-progress-value, .z-rul--overdue .z-rul-track::-webkit-progress-value { background: var(--danger); }
.z-rul--alarm .z-rul-track::-moz-progress-bar, .z-rul--overdue .z-rul-track::-moz-progress-bar { background: var(--danger); }
.z-rul-src { font-size: var(--fs-small); color: var(--text-3); }

/* RUL column in a list/log: mono, right-aligned, tabular figures. */
.z-table .z-col--rul, .z-table .z-col--ruldays { text-align: right; font-variant-numeric: tabular-nums; font-family: var(--font-mono); }
.z-rul-list-value { display: inline-flex; align-items: center; gap: var(--sp-2); justify-content: flex-end; }
.z-rul-list-value--plain { color: var(--text-2); }

/* Segmented radio (the maintenance kind picker, zero-JS): the radios are
   hidden and the labels draw the z-segmented pill buttons; :checked and
   :focus-visible mirror aria-pressed. */
.z-segmented--radio { margin: 0; }
.z-seg-opt { position: relative; }
.z-seg-opt input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.z-seg-opt span { display: flex; align-items: center; justify-content: center; min-height: var(--control-h); padding: var(--sp-1); border-radius: var(--radius-control); color: var(--text-2); font-size: var(--fs-caption); line-height: var(--lh-caption); font-weight: var(--fw-medium); cursor: pointer; }
.z-seg-opt input:checked + span { background: var(--surface-raised); color: var(--text); box-shadow: var(--shadow-1); font-weight: var(--fw-semibold); }
.z-seg-opt input:focus-visible + span { outline: var(--focus-w) solid var(--focus); outline-offset: var(--focus-offset); }

/* =====================================================================
   Warehouse bins (inventory): the temperature regime chip, the segmented
   location path (the signature), the zone-type radio grid and the bin
   picker. Every value composes a design token; the temperature semantics
   live in the --temp-* group (tokens.css).
   ===================================================================== */

/* ---- Temperature regime chip (molecule_zone_chip) ---- */
.z-zone-chip {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  padding: var(--sp-05) var(--sp-3) var(--sp-05) var(--sp-2);
  border: var(--border-w) solid color-mix(in srgb, currentColor 40%, transparent);
  border-radius: var(--radius-pill);
  font-size: var(--fs-small); line-height: var(--lh-small); font-weight: var(--fw-medium); white-space: nowrap;
}
.z-zone-chip-code { font-size: var(--fs-caption); line-height: var(--lh-caption); font-weight: var(--fw-regular); }
.z-zone-chip--frozen { background: var(--temp-frozen-subtle); color: var(--temp-frozen); }
.z-zone-chip--refrigerated { background: var(--temp-refrigerated-subtle); color: var(--temp-refrigerated); }
.z-zone-chip--ambient { background: var(--temp-ambient-subtle); color: var(--temp-ambient); }
.z-zone-chip--dry { background: var(--temp-dry-subtle); color: var(--temp-dry); }
.z-zone-chip--neutral { background: var(--surface-sunken); color: var(--text-2); }

/* ---- Segmented location path (molecule_location_path) ---- */
.z-path { display: inline-flex; align-items: center; flex-wrap: wrap; gap: var(--sp-05) var(--sp-2); }
.z-path-seg { display: inline-flex; align-items: center; gap: var(--sp-2); white-space: nowrap; }
.z-path-seg--zone { font-weight: var(--fw-medium); }
.z-path--frozen { color: var(--temp-frozen); }
.z-path--refrigerated { color: var(--temp-refrigerated); }
.z-path--ambient { color: var(--temp-ambient); }
.z-path--dry { color: var(--temp-dry); }
.z-path--neutral { color: var(--text); }
.z-path-sep { color: var(--stone-400); }
.z-path-seg--bin { font-weight: var(--fw-semibold); background: var(--surface-sunken); border: var(--border-w) solid var(--border); padding: var(--sp-05) var(--sp-2); border-radius: var(--radius-control); }

/* ---- Zone-type radio grid (the temperature regime choice) ---- */
.z-zone-radio-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 11rem), 1fr)); gap: var(--sp-2); }
.z-radio-opt { position: relative; }
.z-radio-opt input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.z-radio-opt-box { display: flex; align-items: center; gap: var(--sp-2); padding: var(--sp-2) var(--sp-3); min-height: var(--target-min); border: var(--border-w-strong) solid var(--border-strong); border-radius: var(--radius-control); background: var(--surface); font-weight: var(--fw-medium); cursor: pointer; }
.z-radio-opt-box .z-icon { color: var(--text-2); }
.z-radio-opt-sub { display: block; font-weight: var(--fw-regular); font-size: var(--fs-caption); line-height: var(--lh-caption); color: var(--text-3); }
.z-radio-opt input:checked + .z-radio-opt-box { border-color: var(--accent); background: var(--accent-subtle); }
.z-radio-opt input:focus-visible + .z-radio-opt-box { outline: var(--focus-w) solid var(--focus); outline-offset: var(--focus-offset); }
.z-radio-opt--frozen input:checked + .z-radio-opt-box .z-icon { color: var(--temp-frozen); }
.z-radio-opt--refrigerated input:checked + .z-radio-opt-box .z-icon { color: var(--temp-refrigerated); }
.z-radio-opt--ambient input:checked + .z-radio-opt-box .z-icon { color: var(--temp-ambient); }
.z-radio-opt--dry input:checked + .z-radio-opt-box .z-icon { color: var(--temp-dry); }

/* ---- Bins list: scope line + temperature-first groups ---- */
.z-scope-line { display: flex; align-items: center; gap: var(--sp-2); margin: var(--sp-4) 0 var(--sp-5); font-size: var(--fs-small); color: var(--text-2); }
.z-scope-line .z-icon { color: var(--text-3); }
.z-scope-line-site { font-weight: var(--fw-medium); }
.z-bin-group { margin-bottom: var(--sp-8); }
.z-bin-group-head { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-2) 0; border-bottom: var(--border-w-strong) solid var(--border); }
.z-bin-group-title { margin: 0; font-family: var(--font-display); font-size: var(--fs-title-sm); line-height: var(--lh-title-sm); font-weight: var(--fw-semibold); }
.z-bin-group-count { margin-left: auto; font-family: var(--font-mono); font-size: var(--fs-small); color: var(--text-3); font-variant-numeric: tabular-nums; }
.z-bin-action { text-align: right; width: 1%; white-space: nowrap; }
.z-form-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 16rem), 1fr)); gap: var(--sp-4); }

/* =====================================================================
   Prerrequisitos (PPR) + bloqueo por proveedor sin homologar
   (quality_ppr.go). The five-check strip is the page's signature: five
   discrete tokens, one verdict. State = colour + icon + word, never
   colour alone.
   ===================================================================== */
.z-ppr-strip { display: inline-flex; gap: var(--sp-1); align-items: center; }
.z-ppr-tok { display: inline-flex; align-items: center; justify-content: center; width: var(--sp-6); height: var(--sp-6); border-radius: var(--radius-control); color: var(--text-2); }
.z-ppr-tok .z-icon { width: var(--sp-3); height: var(--sp-3); }
.z-ppr-tok--ok { background: var(--success-subtle); color: var(--success); }
.z-ppr-tok--fail { background: var(--danger-subtle); color: var(--danger); }
.z-ppr-tok--nil { background: var(--surface-sunken); color: var(--text-3); }
.z-exc-note { margin-top: var(--sp-1); padding: var(--sp-1) var(--sp-2); font-size: var(--fs-small); line-height: var(--lh-small); color: var(--danger); background: var(--danger-subtle); border-radius: var(--radius-control); }

.z-checklist { max-width: var(--measure); }
.z-checkrow { display: grid; grid-template-columns: minmax(9rem, 14rem) minmax(0, 1fr); gap: var(--sp-2) var(--sp-5); padding: var(--sp-3) 0; border-bottom: var(--border-w) solid var(--border-subtle); }
.z-checkrow:first-of-type { padding-top: 0; }
.z-checkrow:last-of-type { border-bottom: 0; }
.z-checkrow--meta { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--sp-4); max-width: var(--form-max); }
.z-checklabel { font-weight: var(--fw-medium); }
.z-checknote { margin-top: var(--sp-2); max-width: var(--form-max); }
.z-checknote .z-label { font-size: var(--fs-small); font-weight: var(--fw-medium); }

.z-switch-word { font-size: var(--fs-body); font-weight: var(--fw-medium); }
.z-block-config { margin-top: var(--sp-6); max-width: var(--form-max); }
.z-config-title { margin: 0 0 var(--sp-3); font-family: var(--font-display); font-size: var(--fs-title-sm); line-height: var(--lh-title-sm); font-weight: var(--fw-semibold); }

/* =====================================================================
   Producción · Líneas y OEE (production_lines.go, ISA-101 / HP-HMI).
   Gray = normal, colour only at deviation. The OEE factor strip is three
   independent bars joined by ×, never a gauge or a stacked whole.
   ===================================================================== */
.z-summary { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--sp-2) var(--sp-4); padding: var(--sp-4) 0 var(--sp-5); border-bottom: var(--border-w) solid var(--border-subtle); margin-bottom: var(--sp-5); font-size: var(--fs-body); }
.z-summary b { font-weight: var(--fw-semibold); }
.z-summary-sep { color: var(--text-3); }
.z-summary-alarm { display: inline-flex; align-items: center; gap: var(--sp-1); color: var(--danger); font-weight: var(--fw-semibold); }
.z-summary-alarm .z-icon { width: var(--icon-sm); height: var(--icon-sm); }

.z-line-name { display: flex; flex-direction: column; gap: var(--sp-1); }
.z-line-name b { font-weight: var(--fw-semibold); }
.z-line-tags { display: flex; flex-wrap: wrap; gap: var(--sp-1); }
.z-line-id { color: var(--text-3); font-family: var(--font-mono); font-size: var(--fs-caption); }
.z-factor-mini { display: inline-flex; align-items: baseline; gap: var(--sp-05); white-space: nowrap; }
.z-factor-mini .drag { color: var(--danger); font-weight: var(--fw-semibold); }
.z-factor-mini .drag--warn { color: var(--warning); }
.z-oee-total-cell { font-weight: var(--fw-semibold); }
.z-oee-total-cell.is-warn { color: var(--warning); }
.z-oee-total-cell.is-alarm { color: var(--danger); }

.z-oee { background: var(--surface); border: var(--border-w) solid var(--border-subtle); border-radius: var(--radius-card); padding: var(--sp-5); box-shadow: var(--shadow-1); margin-bottom: var(--sp-6); }
.z-oee-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); margin-bottom: var(--sp-4); flex-wrap: wrap; }
.z-oee-window { font-size: var(--fs-small); color: var(--text-3); }
.z-oee-factors { display: flex; align-items: stretch; gap: var(--sp-3); flex-wrap: wrap; }
.z-oee-factor { flex: 1 1 9rem; min-width: 9rem; display: flex; flex-direction: column; gap: var(--sp-2); padding: var(--sp-3); border: var(--border-w) solid var(--border-subtle); border-radius: var(--radius-card); background: var(--surface); }
.z-oee-factor--drag { border-color: var(--warning); }
.z-oee-factor--alarm { border-color: var(--danger); }
.z-oee-factor-label { font-size: var(--fs-small); color: var(--text-2); display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); }
.z-oee-factor-value { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: var(--fs-title-sm); line-height: var(--lh-title-sm); font-weight: var(--fw-medium); }
.z-oee-track { display: block; width: 100%; height: var(--sp-2); appearance: none; -webkit-appearance: none; border: 0; border-radius: var(--radius-pill); background: var(--surface-sunken); overflow: hidden; }
.z-oee-track::-webkit-progress-bar { background: var(--surface-sunken); border-radius: var(--radius-pill); }
.z-oee-track::-webkit-progress-value { background: var(--stone-400); border-radius: var(--radius-pill); }
.z-oee-track::-moz-progress-bar { background: var(--stone-400); border-radius: var(--radius-pill); }
.z-oee-factor--drag .z-oee-track::-webkit-progress-value { background: var(--warning); }
.z-oee-factor--drag .z-oee-track::-moz-progress-bar { background: var(--warning); }
.z-oee-factor--alarm .z-oee-track::-webkit-progress-value { background: var(--danger); }
.z-oee-factor--alarm .z-oee-track::-moz-progress-bar { background: var(--danger); }
.z-oee-eq { display: flex; align-items: center; justify-content: center; color: var(--text-3); font-family: var(--font-mono); font-size: var(--fs-title); }
.z-oee-total { flex: 1 1 9rem; min-width: 9rem; display: flex; flex-direction: column; justify-content: center; gap: var(--sp-1); padding: var(--sp-3) var(--sp-4); border-radius: var(--radius-card); background: var(--surface-sunken); }
.z-oee-total-label { font-size: var(--fs-small); color: var(--text-2); }
.z-oee-total-value { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: var(--fs-display); line-height: var(--lh-display); font-weight: var(--fw-medium); }
.z-oee-total.is-warn .z-oee-total-value { color: var(--warning); }
.z-oee-total.is-alarm .z-oee-total-value { color: var(--danger); }
.z-oee-math { font-size: var(--fs-caption); color: var(--text-3); }
.z-oee-math .z-num { color: var(--text-2); }
.z-oee-note { margin-top: var(--sp-3); }

/* ---- Equipment readout (proofer humidity / oven state / mixer temp) ---- */
.z-readout { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: var(--sp-3); margin-bottom: var(--sp-6); }
.z-readout-item { border-top: var(--border-w) solid var(--border-subtle); padding-top: var(--sp-2); }
.z-readout-item dt { font-size: var(--fs-caption); color: var(--text-3); }
.z-readout-item dd { margin: var(--sp-1) 0 0; display: flex; align-items: baseline; gap: var(--sp-2); flex-wrap: wrap; }
.z-readout-value { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: var(--fs-title-sm); font-weight: var(--fw-medium); }
.z-readout-band { font-family: var(--font-mono); font-size: var(--fs-caption); color: var(--text-3); }

.z-bottleneck { display: flex; gap: var(--sp-3); align-items: flex-start; padding: var(--sp-4) var(--sp-5); border-radius: var(--radius-card); border: var(--border-w) solid var(--warning); background: var(--warning-subtle); margin-bottom: var(--sp-6); }
.z-bottleneck .z-icon { width: var(--icon-md); height: var(--icon-md); flex: none; color: var(--warning); }
.z-bottleneck--green { border-color: var(--border); background: var(--surface-sunken); }
.z-bottleneck--green .z-icon { color: var(--success); }
.z-bottleneck--red { border-color: var(--danger); background: var(--danger-subtle); }
.z-bottleneck--red .z-icon { color: var(--danger); }
.z-bottleneck-body { flex: 1; }
.z-bottleneck-title { font-family: var(--font-display); font-weight: var(--fw-semibold); font-size: var(--fs-body); margin-bottom: var(--sp-1); }
.z-bottleneck-title .z-num { font-family: var(--font-mono); }
.z-bottleneck-text { font-size: var(--fs-small); color: var(--text-2); }
.z-bottleneck-fam { display: inline-flex; flex-wrap: wrap; gap: var(--sp-1); margin-top: var(--sp-1); }

.z-sheet-split { display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-4); margin: var(--sp-2) 0 var(--sp-3); font-size: var(--fs-small); color: var(--text-2); }
.z-sheet-split b { color: var(--text); font-weight: var(--fw-semibold); }
.z-sheet-total { display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-4); justify-content: space-between; margin-top: var(--sp-2); padding-top: var(--sp-3); border-top: var(--border-w) solid var(--border-subtle); font-size: var(--fs-small); }

@media (max-width: 640px) {
  .z-checkrow { grid-template-columns: 1fr; gap: var(--sp-2); }
  .z-checkrow--meta { grid-template-columns: 1fr; }
  .z-oee-factor, .z-oee-total { flex: 1 1 100%; min-width: 0; }
  .z-oee-eq { display: none; }
  .z-readout { grid-template-columns: 1fr 1fr; }
}

/* =====================================================================
   Forecasting model registry (ai_registry.go) + the PO lifecycle and
   three-way match (procurement_lifecycle.go). Every value composes a
   design token; the fan chart reuses the navy ramp through the --fan-*
   aliases in tokens.css (no new colour).
   ===================================================================== */

/* ---- Fan chart (charts.go FanChart) ---- */
.z-fan-now { stroke: var(--fan-now); stroke-width: var(--border-w); stroke-dasharray: 4 3; }
.z-fan-band { stroke: none; }
.z-fan-band--0 { fill: var(--fan-50); }
.z-fan-band--1 { fill: var(--fan-80); }
.z-fan-band--2 { fill: var(--fan-95); }
.z-fan-median { stroke: var(--fan-median); stroke-width: var(--border-w-strong); }
.z-fan-bake { fill: var(--gold-500); stroke: var(--navy-600); stroke-width: var(--border-w-strong); }
.z-fan-bake-label { fill: var(--navy-600); font-family: var(--font-mono); font-size: var(--fs-caption); font-weight: var(--fw-medium); }
.z-fan-x { fill: var(--text-3); }
.z-fan-legend { display: flex; align-items: center; gap: var(--sp-4); flex-wrap: wrap; font-size: var(--fs-small); color: var(--text-2); margin-top: var(--sp-2); }
.z-fan-sw { display: inline-flex; align-items: center; gap: var(--sp-2); }
.z-fan-sw-box { width: var(--sp-3); height: var(--sp-3); border-radius: var(--radius-control); flex: none; }
.z-fan-sw--median { background: var(--fan-median); }
.z-fan-sw--band { background: var(--fan-80); }
.z-fan-sw--bake { background: var(--gold-500); }
.z-fan-prov { margin-left: auto; color: var(--text-3); }

/* ---- Lifecycle ladder (the model's four-step lineage) ---- */
.z-ladder { display: flex; align-items: center; }
.z-ladder-step { display: flex; flex-direction: column; align-items: center; gap: var(--sp-1); flex: 1; min-width: 0; }
.z-ladder-node { width: var(--sp-3); height: var(--sp-3); border-radius: var(--radius-pill); background: var(--border); border: var(--border-w-strong) solid var(--border); }
.z-ladder-step--done .z-ladder-node { background: var(--info); border-color: var(--info); }
.z-ladder-step--now .z-ladder-node { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 0 var(--focus-offset) var(--accent-subtle); }
.z-ladder-step--now--prod .z-ladder-node { background: var(--success); border-color: var(--success); box-shadow: 0 0 0 var(--focus-offset) var(--success-subtle); }
.z-ladder-step--retired .z-ladder-node { background: var(--stone-400); border-color: var(--stone-400); }
.z-ladder-cap { font-size: var(--fs-caption); line-height: var(--lh-caption); color: var(--text-3); white-space: nowrap; }
.z-ladder-step--now .z-ladder-cap { color: var(--text); font-weight: var(--fw-medium); }
.z-ladder-link { flex: 1; height: var(--border-w-strong); background: var(--border-subtle); min-width: var(--sp-2); margin-bottom: var(--sp-5); }
.z-ladder-link--done { background: var(--info); }

/* ---- Model card (a trained version + its one legal action) ---- */
.z-mcards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-4); }
.z-mcard { border: var(--border-w) solid var(--border); border-radius: var(--radius-card); background: var(--surface); padding: var(--sp-4); display: flex; flex-direction: column; gap: var(--sp-3); }
.z-mcard--production { border-color: var(--success); box-shadow: var(--shadow-1); }
.z-mcard--retired { background: var(--surface-sunken); }
.z-mcard-top { display: flex; align-items: flex-start; gap: var(--sp-3); }
.z-mcard-id { flex: 1; min-width: 0; }
.z-mcard-family { font-family: var(--font-display); font-weight: var(--fw-semibold); font-size: var(--fs-title-sm); line-height: var(--lh-title-sm); margin: 0; }
.z-mcard-fam { color: var(--text-2); font-family: var(--font-sans); font-weight: var(--fw-regular); font-size: var(--fs-small); }
.z-mcard-version { font-family: var(--font-mono); font-size: var(--fs-small); color: var(--text-3); margin-top: var(--sp-05); }
.z-mcard-facts { display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-4); font-size: var(--fs-small); color: var(--text-2); border-top: var(--border-w) solid var(--border-subtle); padding-top: var(--sp-3); }
.z-mcard-fact { display: flex; gap: var(--sp-1); align-items: baseline; }
.z-mcard-fact .k { color: var(--text-3); }
.z-mcard-fact .v { font-family: var(--font-mono); font-size: var(--fs-small); font-variant-numeric: tabular-nums; }
.z-mcard-foot { display: flex; align-items: center; gap: var(--sp-2); margin-top: auto; padding-top: var(--sp-3); }
.z-mcard-prov { margin-right: auto; }
.z-mcard--retired .z-mcard-note { color: var(--text-3); font-size: var(--fs-small); margin-right: auto; }
/* A phone has room for one card; the foot's actions and provenance wrap
   instead of squeezing the ladder labels off the card. */
@media (max-width: 640px) {
  .z-mcards { grid-template-columns: 1fr; }
  .z-mcard-foot { flex-wrap: wrap; }
}

/* ---- Governance summary strip (counts + import + autonomy lines) ---- */
.z-gov { display: flex; align-items: baseline; flex-wrap: wrap; gap: var(--sp-2) 0; padding: var(--sp-3) var(--sp-4); border: var(--border-w) solid var(--border-subtle); border-radius: var(--radius-card); background: var(--surface); margin: var(--sp-5) 0 var(--sp-6); }
.z-gov-stat { display: inline-flex; align-items: baseline; gap: var(--sp-2); padding: 0 var(--sp-3); border-right: var(--border-w) solid var(--border-subtle); }
.z-gov-stat:first-child { padding-left: 0; }
.z-gov-stat:last-child { border-right: none; }
.z-gov-num { font-family: var(--font-mono); font-size: var(--fs-title-sm); line-height: 1; font-variant-numeric: tabular-nums; font-weight: var(--fw-medium); }
.z-gov-num--success { color: var(--success); }
.z-gov-num--neutral { color: var(--text-2); }
.z-gov-lbl { font-size: var(--fs-small); color: var(--text-3); }
.z-gov-line { width: 100%; margin-top: var(--sp-2); padding-top: var(--sp-2); border-top: var(--border-w) solid var(--border-subtle); font-size: var(--fs-small); color: var(--text-2); display: flex; gap: var(--sp-2); align-items: flex-start; }
.z-gov-line .z-icon { width: var(--icon-sm); height: var(--icon-sm); margin-top: var(--sp-05); color: var(--text-3); flex: none; }
.z-gov-line b { color: var(--text); font-weight: var(--fw-medium); }

/* ---- Two-sided cost (Cu vs Co, the critical ratio bar) ---- */
.z-cost2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: var(--sp-4); }
.z-cside { border: var(--border-w) solid var(--border); border-radius: var(--radius-card); background: var(--surface); padding: var(--sp-4); }
.z-cside h3 { font-family: var(--font-display); font-weight: var(--fw-semibold); font-size: var(--fs-body-lg); line-height: var(--lh-body-lg); margin: 0 0 var(--sp-05); display: flex; align-items: center; gap: var(--sp-2); }
.z-cside .dot { width: var(--sp-3); height: var(--sp-3); border-radius: var(--radius-pill); flex: none; }
.z-cside .code { color: var(--text-3); font-weight: var(--fw-regular); }
.z-cside-val { font-family: var(--font-mono); font-size: var(--fs-title); line-height: var(--lh-title); font-variant-numeric: tabular-nums; font-weight: var(--fw-medium); }
.z-cside-what { color: var(--text-2); font-size: var(--fs-small); }
.z-cside--short .dot { background: var(--ember-700); }
.z-cside--short .z-cside-val { color: var(--ember-700); }
.z-cside--waste .dot { background: var(--gold-600); }
.z-cside--waste .z-cside-val { color: var(--gold-700); }
.z-cbar { margin-top: var(--sp-4); border: var(--border-w) solid var(--border); border-radius: var(--radius-card); background: var(--surface); padding: var(--sp-4); }
.z-cbar h3 { font-family: var(--font-display); font-weight: var(--fw-semibold); font-size: var(--fs-body-lg); line-height: var(--lh-body-lg); margin: 0 0 var(--sp-3); }
.z-cbar-track { position: relative; height: var(--sp-5); border-radius: var(--radius-control); display: flex; overflow: visible; }
.z-cbar-track svg { display: block; width: 100%; height: 100%; overflow: visible; }
.z-cbar-short { fill: var(--ember-700); }
.z-cbar-waste { fill: var(--gold-600); }
.z-cbar-needle { stroke: var(--navy-600); stroke-width: var(--border-w-strong); }
.z-cbar-labels { display: flex; justify-content: space-between; font-size: var(--fs-small); color: var(--text-2); margin-top: var(--sp-2); }
.z-cbar-label { display: inline-flex; align-items: baseline; gap: var(--sp-2); }
.z-cbar-label b { color: var(--text); font-weight: var(--fw-medium); }
.z-cbar-caption { margin-top: var(--sp-3); font-size: var(--fs-small); color: var(--text-2); }
.z-cbar-caption b { color: var(--text); }
.z-bake-line { display: flex; align-items: center; gap: var(--sp-2); padding: var(--sp-3) var(--sp-4); margin-top: var(--sp-4); border: var(--border-w) solid var(--success); border-left-width: var(--sp-1); background: var(--success-subtle); border-radius: var(--radius-card); }
.z-bake-line .z-icon { color: var(--success); }
.z-bake-line .z-num { font-family: var(--font-mono); font-size: var(--fs-title); font-variant-numeric: tabular-nums; font-weight: var(--fw-medium); }

/* ---- Audit chain (tamper-evident, fail-closed) ---- */
.z-audit { border: var(--border-w) solid var(--border); border-radius: var(--radius-card); background: var(--surface); overflow: hidden; }
.z-audit-row { display: grid; grid-template-columns: 2rem 8rem minmax(0, 1fr) auto; gap: var(--sp-3); align-items: center; padding: var(--sp-2) var(--sp-4); border-bottom: var(--border-w) solid var(--border-subtle); }
.z-audit-row:last-child { border-bottom: none; }
.z-audit-seq { font-family: var(--font-mono); font-size: var(--fs-small); color: var(--text-3); text-align: right; }
.z-audit-act { display: inline-flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-small); font-weight: var(--fw-medium); }
.z-audit-hash { font-family: var(--font-mono); font-size: var(--fs-caption); color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.z-audit-link { display: inline-flex; align-items: center; gap: var(--sp-1); font-size: var(--fs-caption); color: var(--text-3); }
.z-audit-link .z-icon { width: var(--fs-caption); height: var(--fs-caption); }

/* ---- PO lifecycle track (organism_lifecycle_track) ---- */
.z-ltrack { display: flex; align-items: stretch; margin: var(--sp-4) 0 var(--sp-5); padding: var(--sp-2); border: var(--border-w) solid var(--border); border-radius: var(--radius-card); background: var(--surface); overflow-x: auto; }
.z-ltrack-step { position: relative; display: flex; flex-direction: column; align-items: center; gap: var(--sp-2); flex: 1; min-width: var(--sp-12); padding: var(--sp-2); text-align: center; }
.z-ltrack-node { width: var(--sp-8); height: var(--sp-8); border-radius: var(--radius-pill); display: grid; place-items: center; border: var(--border-w-strong) solid var(--border); background: var(--surface-sunken); color: var(--text-3); }
.z-ltrack-node .z-icon { width: var(--icon-sm); height: var(--icon-sm); }
.z-ltrack-label { font-size: var(--fs-caption); font-weight: var(--fw-medium); color: var(--text-3); line-height: var(--lh-caption); }
.z-ltrack-sub { font-size: var(--fs-caption); color: var(--text-3); }
.z-ltrack-link { position: absolute; top: var(--sp-6); left: calc(50% + var(--sp-5)); width: calc(100% - var(--sp-10)); height: var(--border-w-strong); background: var(--border); }
.z-ltrack-step--done .z-ltrack-node { background: var(--success-subtle); border-color: var(--success); color: var(--success); }
.z-ltrack-step--done .z-ltrack-label { color: var(--text-2); }
.z-ltrack-step--current .z-ltrack-node { background: var(--accent); border-color: var(--accent); color: var(--text-on-accent); box-shadow: 0 0 0 var(--sp-1) var(--accent-subtle); }
.z-ltrack-step--current .z-ltrack-label { color: var(--text); font-weight: var(--fw-semibold); }
.z-ltrack-step--future .z-ltrack-node { opacity: .6; }
.z-ltrack-step--seam .z-ltrack-node { width: auto; min-width: var(--sp-8); padding: 0 var(--sp-2); display: flex; gap: var(--sp-2); border-style: dashed; }
.z-ltrack-half { display: inline-flex; align-items: center; gap: var(--sp-1); }
.z-ltrack-half .z-icon { width: var(--fs-caption); height: var(--fs-caption); }
.z-ltrack-divider { width: var(--border-w); background: currentColor; opacity: .5; }
.z-ltrack-step:last-child .z-ltrack-link { display: none; }
@media (max-width: 640px) { .z-ltrack { flex-direction: column; } .z-ltrack-link { display: none; } }

/* ---- Three-way match ledger (organism_match_ledger) ---- */
.z-match { border: var(--border-w) solid var(--border); border-radius: var(--radius-card); background: var(--surface); overflow: hidden; max-width: var(--form-max); }
.z-match-cols { display: grid; grid-template-columns: minmax(0, 1fr) var(--sp-10) minmax(0, 1fr) var(--sp-10) minmax(0, 1fr); align-items: stretch; }
.z-match-col { padding: var(--sp-4); min-width: 0; }
.z-match-col .k { font-size: var(--fs-caption); font-weight: var(--fw-medium); color: var(--text-3); margin-bottom: var(--sp-1); }
.z-match-col .v { font-family: var(--font-mono); font-size: var(--fs-title); line-height: var(--lh-title); font-variant-numeric: tabular-nums; font-weight: var(--fw-semibold); }
.z-match-col .v small { font-size: var(--fs-small); font-weight: var(--fw-regular); color: var(--text-3); }
.z-match-flow { display: grid; place-items: center; color: var(--stone-400); }
.z-match-flow .z-icon { width: var(--icon-md); height: var(--icon-md); }
.z-match-src { margin-top: var(--sp-3); }
.z-match-row { border-top: var(--border-w) solid var(--border-subtle); }
.z-match--variance .z-match-cols .z-match-col:last-child .v { color: var(--danger); }
@media (max-width: 640px) { .z-match-cols { grid-template-columns: 1fr; } .z-match-flow { transform: rotate(90deg); padding: var(--sp-1) 0; } }

/* ---- Supplier-score breakdown (weighted criteria bar) ---- */
.z-scbr { display: flex; align-items: center; gap: var(--sp-2); }
.z-scbr-total { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-weight: var(--fw-semibold); }
.z-scbr-bar { display: flex; height: var(--sp-2); width: var(--sp-12); border-radius: var(--radius-pill); overflow: hidden; background: var(--surface-sunken); }
.z-scbr-bar span { display: block; height: 100%; }
.z-scbr-bar svg { display: block; width: 100%; height: 100%; }
.z-scbr-seg--0 { fill: var(--chart-1); }
.z-scbr-seg--1 { fill: var(--chart-2); }
.z-scbr-seg--2 { fill: var(--chart-3); }
.z-scbr-seg--3 { fill: var(--chart-4); }
.z-scbr-cri { display: flex; gap: var(--sp-3); flex-wrap: wrap; font-size: var(--fs-caption); color: var(--text-3); }
.z-scbr-cri b { color: var(--text-2); font-weight: var(--fw-medium); }
.z-scbr-cri .w { font-family: var(--font-mono); color: var(--text-3); }

/* ---- Overdue list (most overdue first) ---- */
.z-overdue { display: flex; flex-direction: column; max-width: var(--content-max); border: var(--border-w) solid var(--border); border-radius: var(--radius-card); background: var(--surface); }
.z-overdue-item { display: flex; align-items: center; gap: var(--sp-4); padding: var(--sp-3) var(--sp-3); border-bottom: var(--border-w) solid var(--border-subtle); }
.z-overdue-item:last-child { border-bottom: none; }
.z-overdue-days { font-family: var(--font-mono); font-size: var(--fs-headline); line-height: var(--lh-headline); font-variant-numeric: tabular-nums; font-weight: var(--fw-bold); min-width: var(--sp-12); text-align: right; }
.z-overdue-days small { display: block; font-family: var(--font-sans); font-size: var(--fs-caption); font-weight: var(--fw-regular); color: var(--text-3); }
.z-overdue-main { flex: 1; min-width: 0; }
.z-overdue-main .id { font-family: var(--font-mono); font-size: var(--fs-small); }
.z-overdue-main .sub { font-size: var(--fs-small); color: var(--text-2); }
.z-overdue-total { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.z-overdue-days--critical, .z-overdue-days--high { color: var(--danger); }
.z-overdue-days--medium { color: var(--warning); }
.z-overdue-days--low { color: var(--info); }
@media (max-width: 640px) { .z-overdue-item { flex-wrap: wrap; } .z-overdue-days { text-align: left; min-width: 0; } }

/* ---- Identity access: scope chip, role ladder, reveal-once secret ---- */
.z-scope-chip {
  display: inline-flex; align-items: center; gap: var(--sp-1); max-width: 100%;
  padding: var(--sp-05) var(--sp-2); border: var(--border-w) solid var(--border-subtle);
  border-radius: var(--radius-pill); background: var(--surface-sunken); color: var(--text-2);
  font-size: var(--fs-small); line-height: var(--lh-small); white-space: nowrap;
}
.z-scope-chip-code { font-family: var(--font-mono); font-size: var(--fs-caption); color: var(--text-3); }
.z-scope-chip .z-icon { width: var(--icon-sm); height: var(--icon-sm); color: var(--text-3); }

.z-role-ladder { list-style: none; margin: 0; padding: 0; border: var(--border-w) solid var(--border-subtle); border-radius: var(--radius-card); overflow: hidden; }
.z-role-ladder-item { display: flex; align-items: center; gap: var(--sp-2); padding: var(--sp-2) var(--sp-3); border-bottom: var(--border-w) solid var(--border-subtle); }
.z-role-ladder-item:last-child { border-bottom: 0; }
.z-role-ladder-name { font-weight: var(--fw-medium); }
.z-role-ladder-code { font-family: var(--font-mono); font-size: var(--fs-caption); color: var(--text-3); }
.z-role-ladder-note { margin-left: auto; font-size: var(--fs-small); color: var(--text-3); display: inline-flex; align-items: center; gap: var(--sp-1); }
.z-role-ladder-item--current { background: var(--accent-subtle); box-shadow: inset var(--border-w-strong) 0 0 var(--accent); }
.z-role-ladder-item--current .z-role-ladder-name { color: var(--accent); }
.z-role-ladder-item--locked { background: var(--surface-sunken); color: var(--text-3); }
.z-role-ladder-item--locked .z-role-ladder-name, .z-role-ladder-item--locked .z-role-ladder-code { color: var(--text-3); }
.z-role-ladder-item--locked .z-icon { color: var(--text-3); }

.z-reveal { max-width: var(--form-max); border: var(--border-w) solid var(--border); border-left: var(--border-w-strong) solid var(--brand); border-radius: var(--radius-card); background: var(--surface); overflow: hidden; box-shadow: var(--shadow-1); }
.z-reveal-band { display: flex; align-items: center; gap: var(--sp-2); padding: var(--sp-3) var(--sp-4); color: var(--warning-text); background: var(--warning-subtle); border-bottom: var(--border-w) solid var(--border-subtle); font-weight: var(--fw-semibold); }
.z-reveal-band .z-icon { flex: none; }
.z-reveal-once { display: inline-flex; align-items: center; gap: var(--sp-1); margin-left: auto; padding: var(--sp-05) var(--sp-2); border-radius: var(--radius-pill); background: var(--navy-600); color: var(--gold-500); font-weight: var(--fw-semibold); font-size: var(--fs-caption); }
.z-reveal-once-dot { width: var(--dot-size); height: var(--dot-size); border-radius: var(--radius-pill); background: var(--gold-500); }
.z-reveal-body { padding: var(--sp-4); }
.z-reveal-value { display: block; font-family: var(--font-mono); font-size: var(--fs-body-lg); line-height: var(--lh-body-lg); padding: var(--sp-3); background: var(--surface-sunken); border: var(--border-w) solid var(--border); border-radius: var(--radius-control); color: var(--text); word-break: break-all; user-select: all; margin: 0 0 var(--sp-3); }
.z-reveal-meta { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; color: var(--text-2); font-size: var(--fs-small); }
.z-reveal-help { min-width: 0; }
.z-reveal-scopes { display: inline-flex; gap: var(--sp-1); margin-left: auto; flex-wrap: wrap; }
.z-reveal-actions { display: flex; gap: var(--sp-2); margin-top: var(--sp-4); }
.z-reveal-note { margin: var(--sp-3) 0 0; color: var(--text-2); font-size: var(--fs-small); }

/* ---- Deliverect link table ---- */
.z-link-table-cell { min-width: 12rem; }
.z-link-table-input { font-family: var(--font-mono); font-size: var(--fs-body); }
.z-link-table-row--error td { background: var(--danger-subtle); }
.z-link-table-row--error .z-badge { background: var(--surface); }

/* ---- Identity access + Deliverect table helpers ---- */
.z-req { color: var(--danger); }
.z-chip-row { display: inline-flex; flex-wrap: wrap; gap: var(--sp-1); }
.z-user-cell { display: inline-flex; align-items: center; gap: var(--sp-2); white-space: normal; }
.z-user-cell-meta { display: inline-flex; flex-direction: column; gap: var(--sp-05); min-width: 0; }
.z-user-cell-name { font-weight: var(--fw-medium); }
.z-user-cell-email { font-size: var(--fs-small); color: var(--text-3); }
.z-inline-form { display: inline; }
.z-table td.z-col--action { text-align: right; white-space: nowrap; width: 1%; }
.z-table td.z-cell-wrap { white-space: normal; }
.z-dialog--danger { border-top: var(--border-w-strong) solid var(--danger); }
.z-dialog .z-form { max-width: none; }

/* ---- Deliverect connection panel ---- */
.z-conn { display: flex; align-items: flex-start; gap: var(--sp-4); flex-wrap: wrap; margin-bottom: var(--sp-5); }
.z-conn .z-text { flex: 1; min-width: 16rem; }
.z-check-label { display: block; font-weight: var(--fw-medium); }
.z-check .z-help { display: block; }

/* =====================================================================
   Personal profile (D134): the standalone light shell, the settings
   sub-sidebar, the preference rows and the unit-conversion signature.
   Personal scope: no navy sidebar, no scope topbar - a canvas of its own.
   ===================================================================== */

/* ---- Nav role pill (provenance, never colour; the sidebar variant is
   .z-side-role, styled against navy) ---- */

/* ---- Profile shell (light topbar + settings layout) ---- */
.z-profile { min-height: 100vh; display: flex; flex-direction: column; }
.z-profile-topbar {
  position: sticky; top: 0; z-index: var(--z-nav); display: flex; align-items: center; gap: var(--sp-3);
  height: var(--topbar-h); padding: 0 var(--gutter); background: var(--surface); border-bottom: var(--border-w) solid var(--border-subtle);
}
.z-profile-topbar-user { margin-left: auto; }
.z-settings-layout {
  display: grid; grid-template-columns: var(--settings-w) minmax(0, 1fr); gap: var(--sp-8);
  align-items: start; width: 100%; max-width: var(--content-max); margin: 0 auto; padding: var(--sp-8) var(--gutter) var(--sp-16);
}
.z-settings-side { position: sticky; top: calc(var(--topbar-h) + var(--sp-4)); }
.z-settings-scope {
  display: flex; align-items: center; gap: var(--sp-2); margin: 0 0 var(--sp-1) var(--sp-3);
  font-size: var(--fs-caption); color: var(--text-3); font-weight: var(--fw-medium);
}
.z-settings-dot { width: var(--dot-size); height: var(--dot-size); border-radius: var(--radius-pill); background: var(--brand); }
.z-settings-nav-list { display: grid; gap: var(--sp-05); margin: 0; padding: 0; list-style: none; }
.z-settings-link {
  display: flex; align-items: center; gap: var(--sp-3); min-height: var(--control-h); padding: 0 var(--sp-3);
  border-radius: var(--radius-control); color: var(--text-2); font-weight: var(--fw-medium); text-decoration: none;
}
.z-settings-link:hover { background: var(--surface-hover); color: var(--text); }
.z-settings-link > .z-icon { color: var(--text-3); }
.z-settings-link--active, .z-settings-link--active:hover { background: var(--accent-subtle); color: var(--accent); }
.z-settings-link--active > .z-icon { color: var(--accent); }
.z-settings-back { margin-top: var(--sp-6); padding-top: var(--sp-4); border-top: var(--border-w) solid var(--border-subtle); }
.z-settings-back .z-link { display: inline-flex; align-items: center; gap: var(--sp-2); min-height: var(--target-min); padding: 0 var(--sp-3); }
.z-settings-main { min-width: 0; }

/* ---- Account: the avatar row ---- */
.z-avatar--lg { width: var(--target-floor); height: var(--target-floor); font-size: var(--fs-title); }
.z-account-avatar { display: flex; align-items: center; gap: var(--sp-4); margin-bottom: var(--sp-5); }
.z-mfa-row { display: flex; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-2); }

/* ---- Preference rows: label/help left, control right ---- */
.z-pref-row {
  display: grid; grid-template-columns: 1fr minmax(min(100%, 17.5rem), 1fr); gap: var(--sp-4);
  padding: var(--sp-4) 0; border-bottom: var(--border-w) solid var(--border-subtle); align-items: center;
}
.z-pref-row .z-segmented { margin: 0; }
.z-pref-row .z-field { margin: 0; }
.z-pref-label { margin: 0 0 var(--sp-05); font-weight: var(--fw-medium); }
.z-pref-help { margin: 0; font-size: var(--fs-small); line-height: var(--lh-small); color: var(--text-3); }

/* ---- Unit preview: the signature ---- */
.z-preview { margin-top: var(--sp-8); background: var(--surface); border: var(--border-w) solid var(--border-subtle); border-radius: var(--radius-card); overflow: hidden; }
.z-preview-band {
  display: flex; align-items: center; gap: var(--sp-2); padding: var(--sp-3) var(--sp-4); color: var(--info);
  background: var(--info-subtle); border-bottom: var(--border-w) solid var(--border-subtle); font-weight: var(--fw-medium); font-size: var(--fs-small);
}
.z-preview-band .z-icon { color: var(--info); }
.z-preview-body { padding: var(--sp-4); display: grid; gap: var(--sp-3); }
.z-preview-row { display: flex; align-items: baseline; gap: var(--sp-3); }
.z-preview-what { font-size: var(--fs-small); color: var(--text-2); min-width: 11rem; }
.z-preview-val { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: var(--fs-title); font-weight: var(--fw-medium); }
.z-preview-alt { font-family: var(--font-mono); font-size: var(--fs-small); color: var(--text-3); }

/* ---- Passkey list ---- */
.z-plist { list-style: none; margin: 0 0 var(--sp-4); padding: 0; border: var(--border-w) solid var(--border-subtle); border-radius: var(--radius-card); overflow: hidden; }
.z-plist li { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-3) var(--sp-4); border-bottom: var(--border-w) solid var(--border-subtle); }
.z-plist li:last-child { border-bottom: none; }
.z-plist-device { display: block; font-weight: var(--fw-medium); }
.z-plist-meta { display: block; font-size: var(--fs-caption); color: var(--text-3); }
.z-plist .z-icon { color: var(--text-3); }

@media (max-width: 900px) {
  .z-settings-layout { grid-template-columns: 1fr; gap: var(--sp-4); padding: var(--sp-5) var(--gutter) var(--sp-16); }
  .z-settings-side { position: static; }
}
@media (max-width: 640px) {
  .z-pref-row { grid-template-columns: 1fr; gap: var(--sp-2); }
  .z-preview-row { flex-direction: column; gap: var(--sp-05); }
  .z-preview-what { min-width: 0; }
}

/* ==========================================================================
   Wallboard 24/7 (D145): an ISA-101 Level-1 mission control for the big
   screen. Gray = normal, colour ONLY at deviation. Composition only: every
   value is a token (the --wb-* knobs in tokens.css, the --side-* chrome
   roles and the dark status ramps). No hex/px/ms outside an @media.
   ========================================================================== */

/* The hue-free near-black surface (not the app's warm charcoal): a video
   wall reads colour as pure deviation only on hue-free black. */
body[data-page="wallboard"] {
  --bg: var(--neutral-950);
  background: var(--neutral-950);
  color: var(--char-50);
  overflow-x: hidden;
}

/* ---------- Kiosk chrome ---------- */
.z-wb-chrome {
  position: sticky; top: 0; z-index: var(--z-nav);
  display: flex; align-items: center; gap: var(--wb-gutter);
  min-height: var(--wb-chrome-h); padding: 0 var(--wb-gutter);
  background: var(--side-bg); border-bottom: var(--border-w) solid var(--side-rule);
}
.z-wb-wordmark { font-family: var(--font-display); font-weight: var(--fw-bold); font-size: var(--wb-label);
  letter-spacing: var(--tracking-tight); color: var(--side-text-max); white-space: nowrap; }
.z-wb-scope { display: flex; align-items: center; gap: var(--sp-2); color: var(--side-text-hi); font-size: var(--wb-label); white-space: nowrap; }
.z-wb-scope .sep { color: var(--side-text); opacity: 0.6; }
.z-wb-scope .site { color: var(--side-text-max); font-weight: var(--fw-semibold); }
.z-wb-clock { margin-left: auto; font-family: var(--font-figure); font-variant-numeric: tabular-nums;
  font-size: var(--wb-clock); color: var(--side-text-max); white-space: nowrap; }
.z-wb-updated { display: flex; align-items: center; gap: var(--sp-2); color: var(--side-text); font-size: var(--wb-label); white-space: nowrap; }
.z-wb-live { width: var(--dot-size); height: var(--dot-size); border-radius: var(--radius-pill); background: var(--brand); flex: none; }
.z-wb-updated .t { color: var(--side-text-max); font-family: var(--font-figure); font-variant-numeric: tabular-nums; }
.z-wb-chrome--stale .z-wb-live { background: var(--warning); }
.z-wb-chrome--stale .z-wb-updated { color: var(--warning); }
.z-wb-chrome--stale .z-wb-updated .t { color: var(--warning); }

/* Dashboard auto-refresh (dashboard.js): a poll that cannot reach the
   server keeps the region's last known values and reveals its "datos
   antiguos" hint. The swap itself never animates, so prefers-reduced-
   motion is honoured by default. */
.z-live-stale {
  display: inline-flex; align-items: center; gap: var(--sp-1);
  margin: 0 0 var(--sp-2);
  color: var(--warning-text); font-size: var(--fs-caption); font-weight: var(--fw-semibold);
}
.z-live-stale[hidden] { display: none; }
.z-live-stale .z-icon { width: var(--fs-caption); height: var(--fs-caption); stroke-width: 2.25; }

/* Rotation indicator: 4 dots + dwell + state word; pauses on an alarm. */
.z-wb-rotate { display: flex; align-items: center; gap: var(--wb-rot-gap); }
.z-wb-rotate-dots { display: flex; gap: var(--wb-rot-dot-gap); }
.z-wb-rotate-dots i { width: var(--wb-rot-dot); height: var(--wb-rot-dot); border-radius: var(--radius-pill); background: var(--char-700); display: block; }
.z-wb-rotate-dots i.on { background: var(--side-text-max); }
.z-wb-rotate-dots i.paused { background: var(--danger); }
.z-wb-rotate-label { font-size: var(--wb-label); color: var(--side-text); white-space: nowrap; }
.z-wb-rotate-label .pause { color: var(--danger); font-weight: var(--fw-semibold); }

/* ---------- Panel stage ---------- */
.z-wb-stage { padding: var(--wb-gutter) var(--wb-gutter) var(--wb-stage-pad-b); }
.z-wb-panel {
  position: relative; min-height: var(--wb-panel-min-h); display: flex; flex-direction: column;
  padding: var(--wb-panel-pad); margin: 0 0 var(--wb-gutter);
  background: var(--surface); border: var(--border-w) solid var(--border-subtle);
  border-radius: var(--wb-radius);
  transition: opacity var(--dur-base) var(--ease-standard);
}
.z-wb-panel.is-leaving { opacity: 0; }
.z-wb-panel-head { display: flex; align-items: baseline; gap: var(--sp-4); margin-bottom: var(--wb-head-mb); flex-wrap: wrap; }
.z-wb-panel-title { font-family: var(--font-display); font-weight: var(--fw-bold); font-size: var(--wb-title);
  letter-spacing: var(--tracking-tight); color: var(--text); }
.z-wb-panel-pos { font-family: var(--font-figure); font-size: var(--wb-label); color: var(--text-3); }
.z-wb-panel-window { font-size: var(--wb-label); color: var(--text-3); margin-left: auto; font-family: var(--font-figure); font-variant-numeric: tabular-nums; }

/* ---------- Business panel ---------- */
.z-wb-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--wb-kpi-gap); flex: 1; }
.z-wb-kpi { display: flex; flex-direction: column; gap: var(--sp-3); padding-top: var(--sp-4); border-top: var(--border-w) solid var(--border-subtle); }
.z-wb-kpi-label { font-size: var(--wb-label); color: var(--text-2); }
.z-wb-kpi-value { font-family: var(--font-figure); font-variant-numeric: tabular-nums;
  font-size: var(--wb-stat); line-height: 1.1; color: var(--text); }
.z-wb-kpi-value .unit { font-size: 0.55em; color: var(--text-3); font-weight: var(--fw-regular); margin-left: var(--sp-05); }
.z-wb-kpi-delta { display: flex; align-items: center; gap: var(--sp-2); font-family: var(--font-figure);
  font-variant-numeric: tabular-nums; font-size: var(--wb-label); color: var(--text-3); }
.z-wb-kpi-delta .arrow { font-size: var(--fs-body); line-height: 1; }
.z-wb-kpi-delta .win { color: var(--text-3); }
.z-wb-spark { width: 100%; height: var(--wb-spark-h); display: block; }
.z-wb-spark polyline { fill: none; stroke: var(--char-500); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.z-wb-spark polyline.fill { fill: var(--char-800); stroke: none; stroke-width: 0; }
.z-wb-kpi.is-warn { border-top-color: var(--warning); }
.z-wb-kpi.is-warn .z-wb-kpi-value { color: var(--warning); font-weight: var(--fw-semibold); }
.z-wb-kpi.is-warn .z-wb-kpi-delta { color: var(--warning); }
.z-wb-kpi.is-warn .z-wb-spark polyline { stroke: var(--warning); }

/* ---------- Production panel ---------- */
.z-wb-oee { display: grid; grid-template-columns: 5fr 7fr; gap: var(--wb-oee-gap); flex: 1; }
.z-wb-oee-hero { display: flex; flex-direction: column; justify-content: center; gap: var(--sp-2);
  border-top: var(--border-w) solid var(--border-subtle); padding-top: var(--sp-5); }
.z-wb-oee-hero-label { font-size: var(--wb-label); color: var(--text-2); }
.z-wb-oee-hero-value { font-family: var(--font-figure); font-variant-numeric: tabular-nums;
  font-size: var(--wb-hero); line-height: 0.95; font-weight: var(--fw-medium); color: var(--text); }
.z-wb-oee-hero-value.is-warn { color: var(--warning); }
.z-wb-oee-hero-value.is-alarm { color: var(--danger); }
.z-wb-oee-hero-math { font-family: var(--font-figure); font-variant-numeric: tabular-nums; font-size: var(--wb-label); color: var(--text-3); }
.z-wb-oee-factors { display: flex; flex-direction: column; gap: var(--sp-4); justify-content: center; }
.z-wb-factor { display: grid; grid-template-columns: 1.4fr 0.8fr 3fr; align-items: center; gap: var(--sp-4); }
.z-wb-factor-label { font-size: var(--wb-label); color: var(--text-2); }
.z-wb-factor-value { font-family: var(--font-figure); font-variant-numeric: tabular-nums; font-size: var(--wb-stat); color: var(--text); text-align: right; }
.z-wb-factor-value.is-warn { color: var(--warning); font-weight: var(--fw-semibold); }
.z-wb-factor-value.is-alarm { color: var(--danger); font-weight: var(--fw-semibold); }
.z-wb-factor-track { display: block; width: 100%; height: var(--wb-track-h); appearance: none; -webkit-appearance: none;
  border: 0; border-radius: var(--radius-pill); background: var(--char-800); overflow: hidden; }
.z-wb-factor-track::-webkit-progress-bar { background: var(--char-800); border-radius: var(--radius-pill); }
.z-wb-factor-track::-webkit-progress-value { background: var(--char-500); border-radius: var(--radius-pill); }
.z-wb-factor-track::-moz-progress-bar { background: var(--char-500); border-radius: var(--radius-pill); }
.z-wb-factor-track.is-warn::-webkit-progress-value { background: var(--warning); }
.z-wb-factor-track.is-warn::-moz-progress-bar { background: var(--warning); }
.z-wb-factor-track.is-alarm::-webkit-progress-value { background: var(--danger); }
.z-wb-factor-track.is-alarm::-moz-progress-bar { background: var(--danger); }
.z-wb-oee-note { margin-top: var(--sp-4); font-size: var(--wb-label); color: var(--text-2); }
.z-wb-oee-note b { color: var(--warning); font-weight: var(--fw-semibold); }

.z-wb-facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--wb-kpi-gap); margin-top: auto; padding-top: var(--wb-facts-pad); }
.z-wb-fact { border-top: var(--border-w) solid var(--border-subtle); padding-top: var(--sp-4); }
.z-wb-fact-label { font-size: var(--wb-label); color: var(--text-2); margin-bottom: var(--wb-fact-label-mb); }
.z-wb-fact-value { font-family: var(--font-figure); font-variant-numeric: tabular-nums; font-size: var(--wb-stat); color: var(--text); }
.z-wb-of { font-size: 0.55em; color: var(--text-3); }
.z-wb-fact-sub { font-size: var(--wb-label); color: var(--text-3); margin-top: var(--sp-1); }
.z-wb-bn { border-top-color: var(--warning); }
.z-wb-bn .z-wb-fact-value { color: var(--warning); }
.z-wb-problems { list-style: none; margin: 0; padding: 0; }
.z-wb-problems li { display: flex; align-items: baseline; gap: var(--wb-rot-gap); font-size: var(--wb-label); color: var(--text-2); padding: var(--sp-1) 0; }
.z-wb-problems li::before { content: ""; width: var(--wb-problem-dot); height: var(--wb-problem-dot); border-radius: var(--radius-pill); background: var(--char-500); flex: none; align-self: center; }
.z-wb-problems li.warn::before { background: var(--warning); }
.z-wb-problems li.alarm::before { background: var(--danger); }
.z-wb-problems li .z-num { color: var(--text); }

/* ---------- Lines panel: the state ribbon ---------- */
.z-wb-legend { display: flex; flex-wrap: wrap; gap: var(--sp-4) var(--sp-6); font-size: var(--wb-label); color: var(--text-3); margin-bottom: var(--sp-5); }
.z-wb-legend span { display: inline-flex; align-items: center; gap: var(--sp-2); }
.z-wb-legend i { width: var(--sp-3); height: var(--sp-1); border-radius: var(--radius-pill); display: inline-block; }
.z-wb-legend .z-wb-legend--running { background: var(--char-500); }
.z-wb-legend .z-wb-legend--idle { background: var(--char-500); }
.z-wb-legend .z-wb-legend--maint { background: var(--navy-200); }
.z-wb-legend .z-wb-legend--warn { background: var(--amber-300); }
.z-wb-legend .z-wb-legend--alarm { background: var(--red-300); }
.z-wb-lines { display: flex; flex-direction: column; gap: var(--sp-2); flex: 1; }
.z-wb-line {
  display: grid; grid-template-columns: 2fr 1fr 1.6fr 1fr;
  align-items: center; gap: var(--wb-line-gap); min-height: var(--wb-line-min-h);
  padding: var(--wb-rot-gap) var(--sp-4) var(--wb-rot-gap) 0; border-radius: var(--radius-control);
  border-left: var(--sp-1) solid var(--wb-state-running-ribbon);
  background: var(--wb-state-running-bg); color: var(--wb-state-running-fg);
}
.z-wb-line--idle { border-left-color: var(--wb-state-idle-ribbon); background: var(--wb-state-idle-bg); color: var(--wb-state-idle-fg); }
.z-wb-line--warning { border-left-color: var(--wb-state-warning-ribbon); background: var(--wb-state-warning-bg); color: var(--wb-state-warning-fg); }
.z-wb-line--alarm { border-left-color: var(--wb-state-alarm-ribbon); background: var(--wb-state-alarm-bg); color: var(--wb-state-alarm-fg); }
.z-wb-line--maint { border-left-color: var(--wb-state-maint-ribbon); background: var(--wb-state-maint-bg); color: var(--wb-state-maint-fg); }
.z-wb-line-name { font-weight: var(--fw-semibold); font-size: var(--wb-line-name); color: inherit; }
.z-wb-line-fam { font-size: var(--wb-label); color: inherit; }
.z-wb-line-state { font-size: var(--wb-line-state); font-weight: var(--fw-semibold); color: inherit; }
.z-wb-line-state .dot { width: var(--dot-size); height: var(--dot-size); border-radius: var(--radius-pill); display: inline-block; margin-right: var(--sp-2); background: currentColor; vertical-align: middle; }
.z-wb-line--running .z-wb-line-state .dot, .z-wb-line--idle .z-wb-line-state .dot { background: var(--char-500); }
.z-wb-line-kg { font-family: var(--font-figure); font-variant-numeric: tabular-nums; font-size: var(--wb-line-kg); text-align: right; color: inherit; }
.z-wb-line-oee { font-family: var(--font-figure); font-variant-numeric: tabular-nums; font-size: var(--wb-line-kg); text-align: right; color: inherit; }
.z-wb-line-oee.is-warn { color: var(--warning); font-weight: var(--fw-semibold); }
.z-wb-line-oee.is-alarm { color: var(--danger); font-weight: var(--fw-semibold); }

/* ---------- Alarms panel ---------- */
.z-wb-alarmcounts { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--wb-kpi-gap); }
.z-wb-alarmcount { border-top: var(--border-w) solid var(--border-subtle); padding-top: var(--sp-4); }
.z-wb-alarmcount-label { font-size: var(--wb-label); color: var(--text-2); }
.z-wb-alarmcount-value { font-family: var(--font-figure); font-variant-numeric: tabular-nums; font-size: var(--wb-stat); color: var(--text); }
.z-wb-alarmcount-value.is-critical { color: var(--danger); font-weight: var(--fw-semibold); }
.z-wb-alarmcount-value.is-high { color: var(--warning); font-weight: var(--fw-semibold); }
.z-wb-alarmcount-value.is-unack { color: var(--accent); font-weight: var(--fw-semibold); }
.z-wb-alarmlist { margin-top: var(--wb-facts-pad); flex: 1; }
.z-wb-alarmlist h3 { font-size: var(--wb-label); color: var(--text-2); font-weight: var(--fw-semibold); margin: 0 0 var(--wb-rot-gap); }
.z-wb-alarm { display: grid; grid-template-columns: 1.4fr 1fr 0.8fr;
  gap: var(--wb-line-gap); align-items: center; min-height: var(--wb-alarm-min-h); padding: var(--sp-2) 0;
  border-bottom: var(--border-w) solid var(--border-subtle); }
.z-wb-alarm:last-child { border-bottom: 0; }
.z-wb-alarm-word { font-weight: var(--fw-semibold); font-size: var(--wb-alarm-word); color: var(--text); }
.z-wb-alarm-word.critical { color: var(--danger); }
.z-wb-alarm-word.high { color: var(--warning); }
.z-wb-alarm-eq { font-size: var(--wb-label); color: var(--text-2); }
.z-wb-alarm-val { font-family: var(--font-figure); font-variant-numeric: tabular-nums; text-align: right; color: var(--text); }

/* ---------- Alarm summary bar: always visible ---------- */
.z-wb-alarmbar {
  position: sticky; bottom: 0; z-index: var(--z-nav);
  display: flex; align-items: center; gap: var(--wb-oee-gap); flex-wrap: wrap;
  min-height: var(--wb-alarmbar-h); padding: var(--wb-rot-gap) var(--wb-gutter);
  background: var(--side-bg); border-top: var(--border-w) solid var(--side-rule);
}
.z-wb-alarmbar-title { font-family: var(--font-display); font-weight: var(--fw-bold); font-size: var(--wb-label); color: var(--side-text-max); white-space: nowrap; }
.z-wb-alarmbar-count { display: flex; align-items: baseline; gap: var(--sp-2); white-space: nowrap; }
.z-wb-alarmbar-count .label { font-size: var(--wb-label); color: var(--side-text); }
.z-wb-alarmbar-count .value { font-family: var(--font-figure); font-variant-numeric: tabular-nums; font-size: var(--wb-stat); color: var(--side-text-max); }
.z-wb-alarmbar-count .value.is-critical { color: var(--danger); font-weight: var(--fw-semibold); }
.z-wb-alarmbar-count .value.is-high { color: var(--warning); font-weight: var(--fw-semibold); }
.z-wb-alarmbar-count .value.is-unack { color: var(--ember-600); font-weight: var(--fw-semibold); }
.z-wb-alarmbar-now { margin-left: auto; font-size: var(--wb-label); color: var(--danger); white-space: nowrap;
  display: flex; align-items: center; gap: var(--sp-2); }
.z-wb-alarmbar-now::before { content: ""; width: var(--dot-size); height: var(--dot-size); border-radius: var(--radius-pill); background: var(--danger); flex: none; }

/* ---------- Empty panel ---------- */
.z-wb-empty { display: flex; flex-direction: column; align-items: flex-start; gap: var(--sp-3); padding: var(--sp-6) 0; }
.z-wb-empty-title { font-family: var(--font-display); font-weight: var(--fw-semibold); font-size: var(--wb-empty-title); }
.z-wb-empty-body { color: var(--text-2); font-size: var(--wb-empty-body); }

/* ---------- Responsive: the 360 px floor reads stacked, no h-scroll ---------- */
@media (max-width: 720px) {
  .z-wb-chrome { flex-wrap: wrap; gap: var(--sp-2) var(--sp-4); padding: var(--sp-2) var(--sp-4); }
  .z-wb-clock { margin-left: 0; }
  .z-wb-stage { padding: var(--sp-4) var(--sp-4) var(--wb-stage-pad-b-sm); }
  .z-wb-panel { min-height: 0; padding: var(--sp-5) var(--sp-4); }
  .z-wb-kpis { grid-template-columns: 1fr; }
  .z-wb-oee { grid-template-columns: 1fr; }
  .z-wb-factor { grid-template-columns: 1fr auto; grid-template-rows: auto auto; }
  .z-wb-factor-track { grid-column: 1 / -1; }
  .z-wb-facts { grid-template-columns: 1fr; }
  .z-wb-line { grid-template-columns: 1fr auto; gap: var(--sp-1) var(--sp-3); padding-left: var(--wb-rot-gap); }
  .z-wb-line-kg, .z-wb-line-oee { text-align: left; }
  .z-wb-line-fam { grid-column: 1 / -1; }
  .z-wb-alarmcounts { grid-template-columns: 1fr 1fr; }
  .z-wb-alarm { grid-template-columns: 1fr auto; gap: var(--sp-1) var(--sp-3); }
  .z-wb-alarm-eq { grid-column: 1 / -1; }
  .z-wb-alarmbar { gap: var(--sp-3) var(--sp-5); }
  .z-wb-alarmbar-now { margin-left: 0; }
}

/* ---------- Operaciones y fiscal (D153): the integrity seal ---------- */
/* The fiscal status band: one box, three cells divided by rules — the
   chain verdict, the per-service chips and the outbox figures. No KPI
   card grid: state first, numbers after. All values via tokens. */
.z-fiscal-status { background: var(--surface); border: var(--border-w) solid var(--border); border-radius: var(--radius-sheet); box-shadow: var(--shadow-1); overflow: hidden; }
.z-fiscal-rail { display: flex; flex-wrap: wrap; align-items: stretch; }
.z-fiscal-cell { padding: var(--sp-4) var(--sp-5); min-width: 0; }
.z-fiscal-cell + .z-fiscal-cell { border-left: var(--border-w) solid var(--border-subtle); }
.z-fiscal-cell--chain { flex: 1 1 calc(var(--form-max) * 0.55); }
.z-fiscal-cell--svc { flex: 1 1 calc(var(--form-max) * 0.6); }
.z-fiscal-cell--outbox { flex: 1 1 calc(var(--form-max) * 0.38); }
.z-fiscal-kicker { margin: 0 0 var(--sp-2); font-size: var(--fs-caption); line-height: var(--lh-caption); font-weight: var(--fw-medium); color: var(--text-3); }

/* The chain verdict: a seal mark + title + sub. */
.z-verdict { display: flex; align-items: center; gap: var(--sp-3); }
.z-verdict-mark { width: calc(var(--icon-lg) + var(--sp-4)); height: calc(var(--icon-lg) + var(--sp-4)); border-radius: var(--radius-card); display: grid; place-items: center; flex: none; }
.z-verdict-mark .z-icon { width: var(--icon-md); height: var(--icon-md); }
.z-verdict--ok .z-verdict-mark { background: var(--success-subtle); color: var(--success); }
.z-verdict--bad .z-verdict-mark { background: var(--danger-subtle); color: var(--danger); }
.z-verdict-title { font-weight: var(--fw-semibold); font-size: var(--fs-body); }
.z-verdict-sub { font-size: var(--fs-small); color: var(--text-2); }
.z-verdict-actions { margin-top: var(--sp-3); }

/* The per-service rows: a mono name and a status chip. */
.z-svc { display: flex; flex-direction: column; gap: var(--sp-2); }
.z-svc-row { display: flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-small); }
.z-svc-name { color: var(--text-2); min-width: calc(var(--sp-4) * 6); }

/* The outbox figures: tabular mono number over a caption. */
.z-figs { display: flex; gap: var(--sp-5); }
.z-fig-num { font-family: var(--font-mono); font-size: var(--fs-title); line-height: var(--lh-title); font-weight: var(--fw-medium); font-variant-numeric: tabular-nums; letter-spacing: var(--tracking-tight); }
.z-fig-lbl { font-size: var(--fs-caption); color: var(--text-3); }
.z-fig--bad .z-fig-num { color: var(--danger); }
.z-fiscal-note { margin-top: var(--sp-2); font-size: var(--fs-caption); color: var(--text-3); }

/* The provenance line under the page header. */
.z-fiscal-provenance { display: flex; flex-wrap: wrap; gap: var(--sp-1) var(--sp-3); color: var(--text-2); }

/* Two-line table cells (mono primary + muted sub). */
.z-cell-main { display: flex; flex-direction: column; }
.z-cell-main .z-cell-sub { font-size: var(--fs-caption); color: var(--text-3); }

/* The four-eyes strip: who proposed a release. */
.z-eyes { display: inline-flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-small); color: var(--text-2); }
.z-eyes .z-icon { width: var(--icon-sm); height: var(--icon-sm); color: var(--warning); }

/* A mono format pill (the export's XML). */
.z-fmt { display: inline-block; padding: var(--sp-05) var(--sp-2); font-family: var(--font-mono); font-size: var(--fs-caption); color: var(--text-2); background: var(--surface-sunken); border-radius: var(--radius-pill); }

/* The scoped export panel: one row per export. */
.z-export-panel { background: var(--surface); border: var(--border-w) solid var(--border); border-radius: var(--radius-card); }
.z-export-row { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-3) var(--sp-4); flex-wrap: wrap; }
.z-export-row + .z-export-row { border-top: var(--border-w) solid var(--border-subtle); }
.z-export-who { flex: 1; min-width: calc(var(--measure) * 0.4); }
.z-export-title { font-weight: var(--fw-medium); }
.z-export-sub { font-size: var(--fs-caption); color: var(--text-3); }
.z-date-input { min-height: var(--control-h); padding: var(--sp-1) var(--sp-2); font: inherit; font-size: var(--fs-small); color: var(--text); background: var(--surface); border: var(--border-w) solid var(--border-strong); border-radius: var(--radius-control); font-family: var(--font-mono); }
.z-fieldpair { display: flex; align-items: center; gap: var(--sp-2); }
.z-fieldpair label { font-size: var(--fs-caption); color: var(--text-3); }
.z-export-off { margin: 0; padding: 0 var(--sp-4) var(--sp-3); font-size: var(--fs-caption); color: var(--text-3); }

/* The danger zone: guarded actions apart from the daily work. */
.z-danger-zone { background: var(--surface); border: var(--border-w) solid color-mix(in srgb, var(--danger) 45%, transparent); border-radius: var(--radius-card); margin-top: var(--sp-8); }
.z-danger-zone-head { display: flex; align-items: center; gap: var(--sp-2); padding: var(--sp-3) var(--sp-4); border-bottom: var(--border-w) solid var(--border-subtle); color: var(--danger); font-weight: var(--fw-semibold); }
.z-danger-zone-row { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-3) var(--sp-4); flex-wrap: wrap; }
.z-danger-zone-row + .z-danger-zone-row { border-top: var(--border-w) solid var(--border-subtle); }
.z-danger-who { flex: 1; min-width: calc(var(--measure) * 0.4); }
.z-danger-title { font-weight: var(--fw-medium); }
.z-danger-sub { font-size: var(--fs-caption); color: var(--text-3); }

@media (max-width: 720px) {
  .z-fiscal-rail { flex-direction: column; }
  .z-fiscal-cell + .z-fiscal-cell { border-left: 0; border-top: var(--border-w) solid var(--border-subtle); }
  .z-figs { gap: var(--sp-8); }
  .z-export-row, .z-danger-zone-row { flex-direction: column; align-items: stretch; }
  .z-fieldpair { flex-wrap: wrap; }
}

/* Operations console (D75): the saga DAG (the signature) and the adapter
   directory. Status is colour + icon + word (never colour alone); edge
   type is stroke (solid / dashed navy / dashed red) + a legend, never the
   colour by itself. The DAG is static (no animated edges). */
.z-dag { border: var(--border-w) solid var(--border-subtle); border-radius: var(--radius-card); background: var(--surface); padding: var(--sp-6) var(--sp-5); overflow-x: auto; }
.z-dag-head { display: flex; align-items: center; gap: var(--sp-2) var(--sp-3); flex-wrap: wrap; margin-bottom: var(--sp-5); }
.z-dag-legend { display: flex; gap: var(--sp-3) var(--sp-4); flex-wrap: wrap; margin-left: auto; font-size: var(--fs-caption); color: var(--text-3); }
.z-dag-legend > span { display: inline-flex; align-items: center; gap: var(--sp-1); }
.z-dag-flow { display: flex; align-items: stretch; gap: 0; min-width: max-content; }
.z-dag-comps { display: flex; align-items: stretch; gap: 0; min-width: max-content; margin-top: var(--sp-5); padding-top: var(--sp-4); border-top: var(--border-w) dashed var(--border); }
.z-dag-label { align-self: center; font-size: var(--fs-caption); color: var(--text-3); writing-mode: vertical-rl; transform: rotate(180deg); margin-right: var(--sp-2); letter-spacing: 0.04em; }
.z-dag-edge { display: inline-flex; align-items: center; justify-content: center; width: var(--dag-edge-w); flex: none; color: var(--stone-400); }
.z-dag-edge--comp { color: var(--info); }
.z-dag-edge--poison { color: var(--danger); }
.z-dag-edge-svg { width: var(--dag-edge-w); height: var(--dag-edge-h); }
.z-dag-edge-svg svg { width: var(--dag-edge-w); height: var(--dag-edge-h); }
.z-dag-edge-svg--sm, .z-dag-edge-svg--sm svg { width: var(--dag-edge-sm-w); }
.z-dag-edge-svg line, .z-dag-edge-svg path { fill: none; stroke: currentColor; stroke-width: var(--border-w-strong); stroke-linecap: round; stroke-linejoin: round; }
.z-dag-edge--comp .z-dag-edge-svg line { stroke-dasharray: 4 3; }
.z-dag-edge--poison .z-dag-edge-svg line { stroke-dasharray: 2 3; }
.z-dag-node { display: flex; flex-direction: column; gap: var(--sp-05); width: var(--dag-node-w); padding: var(--sp-3); border: var(--border-w) solid var(--border); border-radius: var(--radius-card); background: var(--surface); }
.z-dag-node--failed { border-color: var(--danger); }
.z-dag-node--poisoned { border: var(--border-w) dashed var(--danger); }
.z-dag-node--pending { opacity: 0.72; }
.z-dag-node--comp { border-style: dashed; border-color: var(--info); }
.z-dag-node--comp .z-dag-node__label { color: var(--info); }
.z-dag-node__kind { font-family: var(--font-mono); font-size: var(--fs-caption); color: var(--text-3); }
.z-dag-node__label { font-weight: var(--fw-semibold); font-size: var(--fs-small); line-height: var(--lh-small); }
.z-dag-node__code { font-family: var(--font-mono); font-size: var(--fs-caption); color: var(--text-3); }
.z-dag-node__status { margin-top: var(--sp-2); }
.z-dag-node__meta { font-size: var(--fs-caption); color: var(--text-3); }
.z-dag-term { width: var(--dag-term-w); align-self: center; display: grid; place-items: center; }
.z-dag-term__circle { width: var(--dag-term-circle); height: var(--dag-term-circle); border-radius: var(--radius-pill); border: var(--border-w-strong) solid var(--border-strong); display: grid; place-items: center; color: var(--text-3); background: var(--surface); }
.z-dag-term__circle--done { border-color: var(--success); color: var(--success); }

.z-adapter-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(var(--adapter-col-min), 1fr)); gap: var(--sp-4); }
.z-adapter-family__head { display: flex; align-items: baseline; gap: var(--sp-2); margin-bottom: var(--sp-1); }
.z-adapter-family__name { font-weight: var(--fw-semibold); font-size: var(--fs-small); }
.z-adapter-family__code { font-family: var(--font-mono); font-size: var(--fs-caption); color: var(--text-3); }
.z-adapter-row { display: flex; align-items: center; gap: var(--sp-2) var(--sp-3); min-height: var(--target-min); padding: 0 var(--sp-2); border-radius: var(--radius-control); }
.z-adapter-row:hover { background: var(--surface-hover); }
.z-adapter-row__name { font-family: var(--font-mono); font-size: var(--fs-small); color: var(--text); }
.z-adapter-row__spacer { flex: 1; }

/* ---------- Empresa settings (D155): Gobernanza · Ubicaciones · Hijas ---------- */
/* The aligned entity list (sites, children): a table read as a list. */
.z-elist { list-style: none; margin: 0 0 var(--sp-6); padding: 0; border: var(--border-w) solid var(--border-subtle); border-radius: var(--radius-card); overflow: hidden; }
.z-elist li { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-3) var(--sp-4); border-bottom: var(--border-w) solid var(--border-subtle); }
.z-elist li:last-child { border-bottom: 0; }
.z-elist li.z-elist-row--current { background: var(--surface-selected); }
.z-elist-main { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; min-width: 0; }
.z-elist-name { font-weight: var(--fw-semibold); }
.z-elist-chip { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: var(--fs-caption); line-height: var(--lh-caption); color: var(--text-2); background: var(--surface-sunken); border: var(--border-w) solid var(--border-subtle); border-radius: var(--radius-pill); padding: 0 var(--sp-2); white-space: nowrap; }
.z-elist-meta { color: var(--text-3); font-size: var(--fs-small); }
.z-elist-side { margin-left: auto; display: flex; align-items: center; gap: var(--sp-3); flex: none; }
.z-elist-series { font-family: var(--font-mono); font-variant-numeric: tabular-nums; color: var(--text-2); font-size: var(--fs-small); }
.z-elist-code { font-family: var(--font-mono); font-size: var(--fs-caption); }
.z-elist-date { font-family: var(--font-mono); font-variant-numeric: tabular-nums; color: var(--text-3); font-size: var(--fs-caption); }

/* The per-day opening-hours editor (the signature): a readable bakery week. */
.z-hours { max-width: var(--form-max); }
.z-hours-head { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-2); padding: 0 var(--sp-2) var(--sp-2); font-size: var(--fs-caption); color: var(--text-3); font-weight: var(--fw-medium); }
.z-hours-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-2); align-items: center; padding: var(--sp-2); border-bottom: var(--border-w) solid var(--border-subtle); }
.z-hours-row:last-child { border-bottom: 0; }
.z-hours-day { font-weight: var(--fw-medium); font-size: var(--fs-small); }
.z-hours-time { min-height: var(--control-h); padding: var(--sp-1) var(--sp-2); font-size: var(--fs-small); }
.z-hours-closed { color: var(--text-3); font-size: var(--fs-small); grid-column: 2 / 4; }

/* The boolean settings row: label + help left, a bare switch right. */
.z-switch-row { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-4); padding: var(--sp-3) 0; border-bottom: var(--border-w) solid var(--border-subtle); }
.z-switch-row:last-child { border-bottom: 0; }
.z-switch-row-text { min-width: 0; }
.z-switch-row-label { font-weight: var(--fw-medium); }
.z-switch-row .z-switch { flex: none; }
.z-switch-row .z-help { margin-top: var(--sp-05); color: var(--text-3); }

/* The radio segmented control (network modes): zero-JS, one per option. */
.z-seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-05); padding: var(--sp-05); background: var(--surface-sunken); border-radius: var(--radius-control); }
.z-seg-opt { position: relative; display: block; }
.z-seg-opt input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.z-seg-box { display: flex; align-items: center; justify-content: center; min-height: var(--control-h); padding: 0 var(--sp-2); border-radius: var(--radius-control); font-size: var(--fs-small); font-weight: var(--fw-medium); color: var(--text-2); white-space: nowrap; transition: background-color var(--dur-fast) var(--ease-standard), color var(--dur-fast) var(--ease-standard); }
.z-seg-opt:hover .z-seg-box { color: var(--text); }
.z-seg-opt input:checked + .z-seg-box { background: var(--surface); color: var(--text); box-shadow: var(--shadow-1); }
.z-seg-opt input:focus-visible + .z-seg-box { outline: var(--focus-w) solid var(--focus); outline-offset: var(--focus-offset); }
.z-seg-opt input:disabled + .z-seg-box { opacity: 0.45; cursor: not-allowed; }

/* The H1–H6 rules panel: a fold of the network invariants. */
.z-rules { max-width: var(--form-max); margin-top: var(--sp-8); }
.z-rules summary { display: flex; align-items: center; gap: var(--sp-2); min-height: var(--target-min); padding: 0 var(--sp-2); list-style: none; cursor: pointer; color: var(--info); font-weight: var(--fw-medium); }
.z-rules summary::-webkit-details-marker { display: none; }
.z-rules summary .z-icon { transition: transform var(--dur-fast) var(--ease-standard); }
.z-rules[open] summary .z-icon { transform: rotate(90deg); }
.z-rules-body { padding: var(--sp-2) 0 0 var(--sp-2); }
.z-rule { display: grid; grid-template-columns: var(--sp-8) 1fr; gap: var(--sp-2); padding: var(--sp-2) 0; border-bottom: var(--border-w) solid var(--border-subtle); }
.z-rule:last-child { border-bottom: 0; }
.z-rule-code { font-family: var(--font-mono); font-size: var(--fs-caption); color: var(--info); font-weight: var(--fw-medium); }
.z-rule-text { color: var(--text-2); font-size: var(--fs-small); }
.z-rule-text code { font-family: var(--font-mono); font-size: 0.92em; color: var(--text); }

/* Provenance chips of a site's non-editable facts (type, key, …). */
.z-provchips { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-bottom: var(--sp-3); }

@media (max-width: 560px) {
  .z-elist li { flex-wrap: wrap; }
  .z-elist-side { margin-left: 0; width: 100%; justify-content: space-between; }
  .z-seg-box { padding: 0 var(--sp-1); }
}

/* Scope note (D155): the "Solo la propietaria" line under a page header. */
.z-scope-note { display: inline-flex; align-items: center; gap: var(--sp-2); margin: var(--sp-3) 0 0; font-size: var(--fs-small); color: var(--text-3); font-weight: var(--fw-medium); }
.z-scope-note-dot { width: var(--dot-size); height: var(--dot-size); border-radius: var(--radius-pill); background: var(--brand); flex: none; }

/* ==========================================================================
   Sistemas (D167): the systems-admin surface — connector directory, wizard
   stepper, connection verdict, device registry, ISA-101 telemetry health,
   the P1..P6 power ladder and the cost reflection. No new colour tokens:
   reuses the semantic roles + --navy-600 / --ember-600; the stale/deviation
   amber stays on --warning / --warning-text (theme-aware, AA in both modes).
   ========================================================================== */

/* connector directory: grouped list, a row per adapter (name mono +
   vendor + honest status + a quiet Configure). The name and vendor
   truncate (never collide) so the badge and Configure stay reachable at
   every column width. */
.z-cdir { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr)); gap: var(--sp-4); }
.z-cfam { margin-bottom: var(--sp-2); }
.z-cfam-head { display: flex; align-items: center; gap: var(--sp-2); margin-bottom: var(--sp-1); }
.z-cfam-name { font-weight: var(--fw-semibold); font-size: var(--fs-small); }
.z-cfam-code { font-family: var(--font-mono); font-size: var(--fs-caption); color: var(--text-3); }
.z-crow { display: flex; align-items: center; gap: var(--sp-3); min-height: var(--target-min); padding: 0 var(--sp-2); border-bottom: var(--border-w) solid var(--border-subtle); min-width: 0; }
.z-crow:hover { background: var(--surface-hover); }
.z-crow-name { font-family: var(--font-mono); font-size: var(--fs-small); color: var(--text); white-space: nowrap; flex: none; }
.z-crow-vendor { font-size: var(--fs-small); color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.z-crow-spacer { flex: 1; }
@media (max-width: 560px) { .z-crow { flex-wrap: wrap; } .z-crow-spacer { display: none; } }

/* wizard stepper: numbered 1·2·3 steps, active ember / done green. */
.z-wiz { display: flex; align-items: center; flex-wrap: wrap; gap: var(--sp-2); margin-bottom: var(--sp-5); }
.z-wiz-step { display: inline-flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-small); font-weight: var(--fw-medium); color: var(--text-3); }
.z-wiz-num { width: var(--icon-lg); height: var(--icon-lg); border-radius: var(--radius-pill); display: grid; place-items: center; font-family: var(--font-mono); font-size: var(--fs-caption); border: var(--border-w) solid var(--border-strong); background: var(--surface); }
.z-wiz-num .z-icon { width: var(--icon-sm); height: var(--icon-sm); }
.z-wiz-step--active { color: var(--accent); }
.z-wiz-step--active .z-wiz-num { background: var(--accent); color: var(--text-on-accent); border-color: var(--accent); }
.z-wiz-step--done { color: var(--success); }
.z-wiz-step--done .z-wiz-num { background: var(--success); color: var(--stone-0); border-color: var(--success); }
.z-wiz-sep { width: var(--sp-5); height: var(--border-w); background: var(--border); flex: none; }
.z-wiz-actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-top: var(--sp-3); }
.z-wiz-testing { padding: var(--sp-4) 0; }

/* connection verdict: icon + title + cause + code (never a generic error).
   Namespaced z-conn-* so it never overrides the fiscal-ops .z-verdict. */
.z-conn-verdict { display: flex; gap: var(--sp-3); padding: var(--sp-4); border-radius: var(--radius-card); border: var(--border-w) solid; border-left-width: var(--sp-1); margin-top: var(--sp-4); }
.z-conn-verdict > .z-icon { flex: none; width: var(--icon-md); height: var(--icon-md); margin-top: var(--border-w); }
.z-conn-verdict-title { font-weight: var(--fw-semibold); margin: 0 0 var(--sp-05); }
.z-conn-verdict-text { margin: 0; color: var(--text-2); }
.z-conn-verdict-code { font-family: var(--font-mono); font-size: var(--fs-caption); color: var(--text-3); margin-top: var(--sp-1); }
.z-conn-verdict--success { border-color: var(--success); background: var(--success-subtle); color: var(--success); }
.z-conn-verdict--danger { border-color: var(--danger); background: var(--danger-subtle); color: var(--danger); }
.z-conn-verdict--warning { border-color: var(--warning); background: var(--warning-subtle); color: var(--warning-text); }

/* device registry: aligned list, name + type + association + chip + id +
   health badge. */
.z-devreg { list-style: none; margin: 0; padding: 0; border: var(--border-w) solid var(--border-subtle); border-radius: var(--radius-card); overflow: hidden; }
.z-devreg-row { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-3) var(--sp-4); border-bottom: var(--border-w) solid var(--border-subtle); }
.z-devreg-row:last-child { border-bottom: none; }
.z-devreg-main { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; min-width: 0; }
.z-devreg-name { font-weight: var(--fw-semibold); }
.z-devreg-meta { color: var(--text-3); font-size: var(--fs-small); }
.z-devreg-side { margin-left: auto; display: flex; align-items: center; gap: var(--sp-3); flex: none; }
.z-devreg-id { font-family: var(--font-mono); font-variant-numeric: tabular-nums; color: var(--text-3); font-size: var(--fs-caption); }
@media (max-width: 560px) { .z-devreg-row { flex-wrap: wrap; } .z-devreg-side { margin-left: 0; width: 100%; justify-content: space-between; } }

/* telemetry health (ISA-101): grey = normal; a deviation gains a 4 px
   ribbon (amber = stale/anomaly, red = offline) plus its word. The stale
   amber goes through the semantic --warning / --warning-text roles (amber
   in light, amber-300 in dark) so it keeps >= 4.5:1 on both surfaces. */
.z-health { border: var(--border-w) solid var(--border-subtle); border-radius: var(--radius-card); overflow: hidden; }
.z-health-head, .z-hrow { display: grid; grid-template-columns: minmax(10rem, 1.4fr) 1fr 5rem 11rem 8rem; gap: var(--sp-3); align-items: center; padding: var(--sp-2) var(--sp-4); }
.z-health-head { background: var(--surface-sunken); border-bottom: var(--border-w) solid var(--border-subtle); font-size: var(--fs-caption); color: var(--text-3); font-weight: var(--fw-medium); }
.z-health-right { text-align: right; }
.z-hrow { min-height: var(--target-min); border-bottom: var(--border-w) solid var(--border-subtle); }
.z-hrow:last-child { border-bottom: none; }
.z-hrow--stale { border-left: var(--sp-1) solid var(--warning); }
.z-hrow--off { border-left: var(--sp-1) solid var(--danger); }
.z-hrow-name { display: flex; align-items: center; gap: var(--sp-2); font-weight: var(--fw-medium); min-width: 0; }
.z-hrow-name .z-icon { color: var(--text-3); flex: none; }
.z-hrow-topic { font-family: var(--font-mono); font-size: var(--fs-caption); color: var(--text-3); overflow: hidden; text-overflow: ellipsis; }
.z-hrow-rate { text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.z-hrow-seen { text-align: right; font-size: var(--fs-small); color: var(--text-2); }
.z-hrow-seen.is-stale { color: var(--warning-text); font-weight: var(--fw-medium); }
.z-hrow-seen.is-off { color: var(--danger); font-weight: var(--fw-medium); }
.z-hrow-anom { text-align: right; }
@media (max-width: 560px) {
  .z-health-head { display: none; }
  .z-hrow { grid-template-columns: 1fr 1fr; gap: var(--sp-1) var(--sp-2); }
  .z-hrow-topic { grid-column: 1 / -1; }
  .z-hrow-rate, .z-hrow-seen, .z-hrow-anom { text-align: left; }
}

/* power ladder: the regulated P1 >= … >= P6 drawn as descending bars from
   a zero baseline; the peak P1 in ember, the rest navy. */
.z-pladder { max-width: 47rem; }
.z-pladder-row { display: flex; align-items: flex-end; gap: var(--sp-3); height: 8.25rem; padding: var(--sp-2) 0 var(--sp-4); }
.z-pladder-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: var(--sp-1); min-width: 0; }
.z-pladder-bar { width: 100%; border-radius: var(--radius-control) var(--radius-control) 0 0; background: var(--navy-600); }
.z-pladder-bar--peak { background: var(--ember-600); }
/* The bar height is a class, never an inline style (the CSP style-src
   'self' blocks style=, leaving the bars with no height). Each step is
   the nearest 10 % of the peak, so the ladder stays proportional to the
   contracted power on a zero baseline. */
.z-pladder-bar--h10  { height: 0.4rem; }
.z-pladder-bar--h20  { height: 0.8rem; }
.z-pladder-bar--h30  { height: 1.2rem; }
.z-pladder-bar--h40  { height: 1.6rem; }
.z-pladder-bar--h50  { height: 2.0rem; }
.z-pladder-bar--h60  { height: 2.4rem; }
.z-pladder-bar--h70  { height: 2.8rem; }
.z-pladder-bar--h80  { height: 3.2rem; }
.z-pladder-bar--h90  { height: 3.6rem; }
.z-pladder-bar--h100 { height: 4.0rem; }
.z-pladder-val { font-family: var(--font-mono); font-size: var(--fs-caption); font-variant-numeric: tabular-nums; color: var(--text-2); }
.z-pladder-p { font-family: var(--font-mono); font-size: var(--fs-caption); color: var(--text-3); white-space: nowrap; }
.z-pladder-axis { border-top: var(--border-w) solid var(--border); padding-top: var(--sp-1); }
@media (max-width: 560px) { .z-pladder-row { height: 96px; } .z-pladder-p { font-size: 11px; } }

/* tariff tables: the period label mono, numbers right in tabular figures. */
.z-tariff .z-plabel { font-family: var(--font-mono); font-weight: var(--fw-semibold); }
.z-tariff .z-pname { color: var(--text-3); font-size: var(--fs-small); }
.z-input--num { max-width: 7rem; text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.z-section-subhead { margin-top: var(--sp-8); }
.z-site-pick { max-width: 22rem; margin-top: var(--sp-4); }
.z-site-pick-row { display: flex; gap: var(--sp-2); align-items: center; }

/* cost reflection: two formula-visible lines + the absorbed unit total. */
.z-costrefl { max-width: 47rem; }
.z-costrefl-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-4); margin-bottom: var(--sp-4); }
.z-costrefl-line { border: var(--border-w) solid var(--border-subtle); border-radius: var(--radius-card); padding: var(--sp-4); }
.z-costrefl-label { font-size: var(--fs-small); color: var(--text-3); font-weight: var(--fw-medium); margin-bottom: var(--sp-05); }
.z-costrefl-value { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: var(--fs-title-sm); font-weight: var(--fw-medium); }
.z-costrefl-formula { font-size: var(--fs-small); color: var(--text-2); margin-top: var(--sp-2); }
.z-costrefl-total { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-4); border: var(--border-w) solid var(--border); border-left-width: var(--sp-1); border-left-color: var(--info); border-radius: var(--radius-card); background: var(--info-subtle); }
.z-costrefl-total-label { font-weight: var(--fw-semibold); }
.z-costrefl-total-value { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: var(--fs-title-sm); font-weight: var(--fw-semibold); margin-left: auto; }
.z-costrefl-note { font-size: var(--fs-caption); color: var(--text-3); margin-top: var(--sp-2); }
@media (max-width: 560px) { .z-costrefl-grid { grid-template-columns: 1fr; } }
/* Labelling (D260): the recipe's «Etiquetado» section and the printed
food label (shared/labelling renders .z-foodlabel). */
.z-labelling-band { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-6); padding: var(--sp-4); margin-bottom: var(--sp-4); border: var(--border-w) solid var(--border); border-radius: var(--radius-card); background: var(--surface-sunken); }
.z-labelling-band p { margin: 0; }
.z-labelling-block { margin-top: var(--sp-6); }
.z-labelling-block h3 { font-size: var(--fs-title-sm); line-height: var(--lh-title-sm); margin-bottom: var(--sp-3); }
.z-labelling-name { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); margin-bottom: var(--sp-3); }
.z-labelling-reasons, .z-labelling-flags { width: 100%; margin: var(--sp-2) 0; padding-left: var(--sp-5); }
.z-labelling-flags li { margin-bottom: var(--sp-2); }
.z-labelling-cite { font-size: var(--fs-caption); color: var(--text-3); }
.z-labelling-pres { margin-bottom: var(--sp-4); }
.z-labelling-preview { max-width: var(--form-max); margin-bottom: var(--sp-4); }
.z-foodlabel { padding: var(--sp-4); border: var(--border-w) solid var(--border-strong); border-radius: var(--radius-card); background: var(--surface); color: var(--text); font-size: var(--fs-small); }
.z-foodlabel-name { font-size: var(--fs-title-sm); margin-bottom: var(--sp-2); }
.z-foodlabel p { margin: 0 0 var(--sp-2); }
.z-foodlabel-cap { font-weight: var(--fw-semibold); }
.z-foodlabel-facts { display: grid; grid-template-columns: auto 1fr; gap: var(--sp-1) var(--sp-3); margin: 0; }
.z-foodlabel-facts dt { font-weight: var(--fw-semibold); }
.z-foodlabel-facts dd { margin: 0; }
@media print { .z-print-hide { display: none !important; } .z-foodlabel { break-inside: avoid; border-color: var(--stone-900); } }

/* Workflow block editor (D394): day lanes of stage blocks joined by
   connectors, the fork diamond, the palette, the properties panel and
   the problems list. A stage's kind is a stripe plus an icon and a word;
   on a phone the lanes stack as an accordion and the blocks as a column. */
.z-flow-editor { display: grid; gap: var(--sp-6); align-items: start; }
.z-flow-editor--edit { grid-template-columns: minmax(0, 20rem) minmax(0, 1fr); }
.z-flow-side { display: grid; gap: var(--sp-6); align-content: start; position: sticky; top: calc(var(--topbar-h) + var(--sp-4)); max-height: calc(100vh - var(--topbar-h) - var(--sp-8)); overflow-y: auto; }
.z-flow-main { min-width: 0; }
.z-flow { display: grid; gap: var(--sp-4); }
.z-lane { border: var(--border-w) solid var(--border-subtle); border-radius: var(--radius-card); background: var(--surface-sunken); }
.z-lane-head { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-3) var(--sp-4); cursor: pointer; list-style: none; min-height: var(--target-min); }
.z-lane-head::-webkit-details-marker { display: none; }
.z-lane-day { display: inline-flex; align-items: center; gap: var(--sp-2); font-weight: var(--fw-semibold); }
.z-lane-meta { color: var(--text-2); font-size: var(--fs-small); margin-right: auto; }
.z-lane[open] > .z-lane-head > .z-icon:last-child { transform: rotate(180deg); }
.z-flow-track { display: flex; flex-wrap: wrap; align-items: stretch; gap: var(--sp-2); margin: 0; padding: 0 var(--sp-4) var(--sp-4); list-style: none; }
.z-block {
  display: flex; flex-direction: column; gap: var(--sp-2); flex: 0 1 15rem; min-width: 11rem; padding: var(--sp-3);
  background: var(--surface); border: var(--border-w) solid var(--border); border-left: var(--border-w-strong) solid var(--accent);
  border-radius: var(--radius-control); box-shadow: var(--shadow-1);
}
.z-block--rest { border-left-color: var(--info); }
.z-block--storage { border-left-color: var(--temp-frozen); border-left-style: double; }
.z-block--selected { outline: var(--focus-w) solid var(--focus); outline-offset: var(--focus-offset); background: var(--surface-selected); }
.z-block--error { border-color: var(--danger); }
.z-block.is-dragging { opacity: 0.5; }
.z-flow--edit .z-block { cursor: grab; }
.z-block-head { display: flex; align-items: center; gap: var(--sp-2); }
.z-block-n { margin-left: auto; color: var(--text-3); font-size: var(--fs-caption); font-variant-numeric: tabular-nums; }
.z-block-flag { display: inline-flex; color: var(--warning-text); }
.z-block-flag--danger { color: var(--danger); }
.z-block-title { margin: 0; font-size: var(--fs-body); font-weight: var(--fw-semibold); line-height: var(--lh-body); }
.z-block-link { color: inherit; text-decoration: none; }
.z-block-link:hover, .z-block-link:focus-visible { text-decoration: underline; }
.z-block-params { display: flex; flex-wrap: wrap; gap: var(--sp-1); }
.z-block-route { margin: 0; color: var(--text-2); font-size: var(--fs-caption); display: inline-flex; align-items: center; gap: var(--sp-1); }
.z-block-tools { display: flex; gap: var(--sp-1); margin-top: auto; padding-top: var(--sp-1); border-top: var(--border-w) solid var(--border-subtle); }
.z-block-tools form { margin: 0; }
.z-block-tools .z-icon-btn { width: var(--target-min); height: var(--target-min); }
.z-kind { display: inline-flex; align-items: center; gap: var(--sp-1); padding: 0 var(--sp-2); border-radius: var(--radius-pill); font-size: var(--fs-caption); font-weight: var(--fw-medium); background: var(--accent-subtle); color: var(--text); }
.z-kind .z-icon { width: var(--icon-sm); height: var(--icon-sm); }
.z-kind--rest { background: var(--info-subtle); }
.z-kind--storage { background: var(--temp-frozen-subtle); }
.z-pill { display: inline-flex; align-items: center; gap: var(--sp-1); padding: 0 var(--sp-2); border: var(--border-w) solid var(--border-subtle); border-radius: var(--radius-pill); font-size: var(--fs-caption); color: var(--text-2); font-variant-numeric: tabular-nums; }
.z-pill .z-icon { width: var(--icon-sm); height: var(--icon-sm); }
.z-pill--bio { border-color: var(--success); color: var(--text); }
.z-flow-link { align-self: center; flex: none; width: var(--sp-6); height: 0; border-top: var(--border-w-strong) solid var(--border-strong); position: relative; }
.z-flow-link::after { content: ""; position: absolute; right: 0; top: calc(var(--border-w-strong) * -2.5); border: var(--sp-1) solid transparent; border-left-color: var(--border-strong); border-right-width: 0; }
.z-flow-link--drop { align-self: stretch; height: auto; min-height: var(--target-min); border-top: 0; border-radius: var(--radius-control); }
.z-flow-link--drop::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; border-top: var(--border-w-strong) solid var(--border-strong); }
.z-flow-link--drop::after { top: calc(50% - var(--sp-1) + var(--border-w-strong) / 2); }
.z-flow--edit.is-dragging .z-flow-link--drop { background: var(--accent-subtle); outline: var(--border-w) dashed var(--accent); }
.z-flow-link--drop.is-over { background: var(--accent); }
.z-icon--flip { transform: rotate(180deg); }
.z-flow-fork { display: flex; align-items: center; gap: var(--sp-3); flex: 1 1 100%; padding: var(--sp-2) var(--sp-3); border: var(--border-w) dashed var(--warning); border-radius: var(--radius-control); background: var(--warning-subtle); }
.z-flow-diamond { display: inline-flex; align-items: center; justify-content: center; width: var(--btn-h); height: var(--btn-h); transform: rotate(45deg); border: var(--border-w-strong) solid var(--warning); background: var(--surface); }
.z-flow-diamond .z-icon { transform: rotate(-45deg); }
.z-flow-fork-text { display: flex; flex-wrap: wrap; gap: var(--sp-1) var(--sp-3); align-items: baseline; }
.z-flow-track--compact { padding: var(--sp-2) 0; }
.z-routes { display: grid; gap: var(--sp-4); margin: 0; padding: 0; list-style: none; }
.z-route-card { padding: var(--sp-4); border: var(--border-w) solid var(--border); border-radius: var(--radius-card); background: var(--surface); }
.z-route-name { display: flex; align-items: center; gap: var(--sp-2); margin: 0 0 var(--sp-1); font-size: var(--fs-title-sm); }
.z-problems { margin-bottom: var(--sp-4); border: var(--border-w) solid var(--border); border-radius: var(--radius-card); background: var(--surface); }
.z-problems--error { border-color: var(--danger); }
.z-problems-head { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-3) var(--sp-4); cursor: pointer; list-style: none; min-height: var(--target-min); }
.z-problems-head::-webkit-details-marker { display: none; }
.z-problems-head .z-section-title { margin: 0; }
.z-problems-head .z-text--muted { margin-right: auto; }
.z-problem-list { display: grid; gap: var(--sp-2); margin: 0; padding: 0 var(--sp-4) var(--sp-4); list-style: none; }
.z-problem { display: flex; align-items: baseline; gap: var(--sp-2); }
.z-problem .z-icon { flex: none; align-self: center; }
.z-problem--danger .z-icon { color: var(--danger); }
.z-problem--warning .z-icon { color: var(--warning-text); }
.z-problem--info .z-icon { color: var(--info); }
.z-problem-sev { font-weight: var(--fw-semibold); flex: none; }
.z-stagepal-group { margin: 0 0 var(--sp-4); padding: 0; border: 0; }
.z-stagepal-group legend { margin-bottom: var(--sp-2); }
.z-stagepal-list { display: grid; gap: var(--sp-1); margin: 0; padding: 0; list-style: none; }
.z-stagepal-item {
  display: flex; align-items: center; gap: var(--sp-2); width: 100%; min-height: var(--target-min); padding: var(--sp-1) var(--sp-2);
  border: var(--border-w) solid var(--border-subtle); border-radius: var(--radius-control); background: var(--surface); color: var(--text);
  font: inherit; text-align: left; cursor: grab;
}
.z-stagepal-item:hover { background: var(--surface-hover); }
.z-stagepal-item:focus-visible { outline: var(--focus-w) solid var(--focus); outline-offset: var(--focus-offset); }
.z-stagepal-name { flex: 1; }
.z-stagepal-range { color: var(--text-3); font-size: var(--fs-caption); font-variant-numeric: tabular-nums; }
.z-props-group { margin: 0 0 var(--sp-4); padding: 0; border: 0; display: grid; gap: var(--sp-2); }
.z-props-group legend { font-weight: var(--fw-semibold); margin-bottom: var(--sp-2); }
@media (max-width: 1023px) {
  .z-flow-editor--edit { grid-template-columns: minmax(0, 1fr); }
  .z-flow-side { position: static; max-height: none; }
  .z-flow-track { flex-direction: column; flex-wrap: nowrap; }
  .z-block { flex: none; min-width: 0; }
  .z-flow-link { align-self: center; width: 0; height: var(--sp-4); border-top: 0; border-left: var(--border-w-strong) solid var(--border-strong); }
  .z-flow-link::after { display: none; }
  .z-flow-link--drop { align-self: stretch; width: auto; min-height: var(--sp-4); height: auto; border-left: 0; }
  .z-flow-link--drop::before { left: 50%; right: auto; top: 0; bottom: 0; border-top: 0; border-left: var(--border-w-strong) solid var(--border-strong); }
}
