/*
 * glass.css — Glass design-language surface vocabulary (shared)
 * ============================================================
 * Load AFTER global.css in index.html and worker/index.html.
 *
 * These are the prototype's glass surfaces (glass-dashboard/styles.css),
 * extracted and rewritten to consume THIS app's existing three-tier tokens
 * (design-tokens.css + variables.css) — NOT a parallel r-x / sp-x / fg token set
 * (Design Reference §8.3). Purple/gold tints derive from the Tier 2 brand
 * tokens via color-mix, so a white-label rebrand recolours the glass too.
 *
 * ROLLOUT STATUS (Slice 1 phase 2b-A): these classes are ADDITIVE and, apart
 * from `.icon`, currently UNCONSUMED — pages/components adopt them in the later
 * per-surface adoption slices. This file deliberately does NOT redefine the
 * existing shared `.btn`/`.btn-primary`/`.card` (global.css owns those); it only
 * adds NEW glass variants (`.glass-card`, `.btn-secondary`, `.btn-small`, …) so
 * loading it changes no existing element.
 */

/* Background glow — a fixed layer behind the app. Ready but not injected yet:
   it only shows through TRANSLUCENT surfaces, which arrive as the shell/pages
   adopt the glass surfaces (later slices). Inject one bg-glow div at the top of
   the app shell then. */
.bg-glow {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(650px circle at 10% 8%,  var(--glow-blob-1), transparent 60%),
    radial-gradient(550px circle at 92% 18%, var(--glow-blob-2), transparent 60%),
    radial-gradient(750px circle at 40% 100%, var(--glow-blob-3), transparent 60%);
  filter: blur(50px);
  transition: background var(--motion-theme) ease;
}

/* ── Icon (SVG sprite symbols; see src/components/Icon.js) ───────────────────
   Line icons, stroke:currentColor so they inherit text colour. The only glass
   class consumed in this slice — via App.icon(name).                          */
.icon {
  width: 18px; height: 18px;
  stroke: currentColor; stroke-width: 1.75; fill: none;
  stroke-linecap: round; stroke-linejoin: round;
  flex-shrink: 0;
}

/* ── Glass card (the universal panel surface) ───────────────────────────────*/
.glass-card {
  background: var(--glass-bg);
  backdrop-filter: var(--blur-strong);
  -webkit-backdrop-filter: var(--blur-strong);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  transition: border-color var(--motion-base) ease, transform var(--motion-base) ease;
}
.glass-card:hover { border-color: var(--glass-border-strong); }

.card-header {
  padding: var(--spacing-6);
  border-bottom: 1px solid var(--glass-border);
  display: flex; justify-content: space-between; align-items: center;
}
.card-title { font-family: var(--font-display); font-size: 17px; font-weight: 600; color: var(--text-main); margin: 0; }
.card-body { padding: var(--spacing-6); }

.link-subtle { font-size: 13px; color: var(--text-muted); text-decoration: none; transition: color var(--motion-fast) ease; }
.link-subtle:hover { color: var(--color-accent-2); }

/* ── KPI cards ──────────────────────────────────────────────────────────────*/
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: var(--spacing-4); margin-bottom: var(--spacing-8); }

.kpi-card {
  background: var(--glass-bg);
  backdrop-filter: var(--blur-strong); -webkit-backdrop-filter: var(--blur-strong);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  padding: var(--spacing-6);
  transition: all var(--motion-base) ease;
}
.kpi-card:hover {
  border-color: color-mix(in srgb, var(--brand-accent) 50%, transparent);
  transform: translateY(-2px);
}
.kpi-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: var(--spacing-4); }
.kpi-icon {
  width: 36px; height: 36px; border-radius: var(--radius-md);
  background: linear-gradient(135deg,
    color-mix(in srgb, var(--color-primary-bright) 25%, transparent),
    color-mix(in srgb, var(--brand-accent) 20%, transparent));
  display: flex; align-items: center; justify-content: center;
}
.kpi-icon .icon { stroke: var(--color-accent-2); width: 18px; height: 18px; }
.kpi-label { font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--text-muted); margin-bottom: var(--spacing-2); }
.kpi-value {
  font-family: var(--font-mono); font-size: 26px; font-weight: 700; margin-bottom: 6px;
  background: linear-gradient(90deg, var(--brand-accent), var(--color-accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
/* Semantic value tones — override ONLY background-image so the clip/transparent
   mechanics stay owned by the base rule above (a `background` shorthand here
   would reset background-clip and paint a solid box over invisible text). */
.kpi-value.tone-success { background-image: linear-gradient(90deg, var(--color-success), var(--color-success)); }
.kpi-value.tone-danger  { background-image: linear-gradient(90deg, var(--color-danger),  var(--color-danger)); }
.kpi-note { font-size: 12px; color: var(--text-muted); }
.kpi-note.positive { color: var(--color-success); }
.kpi-note.negative { color: var(--color-danger); }
/* Per-tile severity accents (rollout Slice 3) — preserves the legacy
   dashboard's border-top colour coding in the glass language. */
.kpi-card.tone-info    { border-top: 3px solid var(--color-primary-bright); }
.kpi-card.tone-brand   { border-top: 3px solid var(--color-primary); }
.kpi-card.tone-success { border-top: 3px solid var(--color-success); }
.kpi-card.tone-warning { border-top: 3px solid var(--color-warning); }
.kpi-card.tone-danger  { border-top: 3px solid var(--color-danger); }
.kpi-card.tone-neutral { border-top: 3px solid var(--color-neutral); }

/* Dashboard density (KI#255) — Lenny (D1) wants the KPI cards in a SINGLE ROW,
   optimised for iPad. The admin shell is a fixed 250px sidebar + 24px page
   padding (global.css), so the content area is ~470px on an iPad in portrait and
   ~730–900px in landscape. Force exactly six equal columns — minmax(0,1fr) lets
   them shrink to fit without x-overflow — and compact each card (smaller icon,
   value, label, tighter padding/gap) so all six sit on one row on a tablet.
   Scoped to .dashboard-kpi-grid so the shared .kpi-card on Payroll (Payroll.js)
   is unaffected. */
.dashboard-kpi-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: var(--spacing-2); margin-bottom: var(--spacing-4); }
.dashboard-kpi-grid .kpi-card { padding: var(--spacing-3); min-width: 0; }
.dashboard-kpi-grid .kpi-top { margin-bottom: var(--spacing-2); }
.dashboard-kpi-grid .kpi-icon { width: 28px; height: 28px; }
.dashboard-kpi-grid .kpi-icon .icon { width: 15px; height: 15px; }
.dashboard-kpi-grid .kpi-label { font-size: 10px; letter-spacing: .4px; }
.dashboard-kpi-grid .kpi-value { font-size: 20px; }

/* ── Layout grid ────────────────────────────────────────────────────────────*/
.grid-2col { display: grid; grid-template-columns: 1.3fr 1fr; gap: var(--spacing-6); margin-bottom: var(--spacing-6); }
@media (max-width: 1100px) { .grid-2col { grid-template-columns: 1fr; } }

/* ── Data table (inside a glass-card) ───────────────────────────────────────*/
.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.data-table thead { background: var(--glass-bg-strong); }
.data-table th {
  padding: var(--spacing-3) var(--spacing-4); text-align: left;
  color: var(--text-muted); font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .5px;
}
.data-table th.amt, .data-table td.amt { text-align: right; font-variant-numeric: tabular-nums; font-family: var(--font-mono); }
.data-table td { padding: var(--spacing-3) var(--spacing-4); border-bottom: 1px solid var(--glass-border); color: var(--text-muted); }
.data-table td strong { color: var(--text-main); font-weight: 600; }
.data-table tbody tr { transition: background var(--motion-fast) ease; }
.data-table tbody tr:hover td { background: color-mix(in srgb, var(--color-primary-bright) 6%, transparent); }
.data-table tbody tr.row-warning td { background: color-mix(in srgb, var(--color-warning) 8%, transparent); }
.data-table tbody tr.row-alert td { background: color-mix(in srgb, var(--color-danger) 8%, transparent); }
.data-table tbody tr:last-child td { border-bottom: none; }

/* ── Glass tab bar (shared: admin hub pages — Plant & Workshop, Workforce) ───
   The one shared tab vocabulary rollout Slice 5A adds. Applied ADDITIVELY,
   layered alongside each page's existing structural hook classes
   (.workshop-tabs / .workforce-tabs + .workshop-tab-btn / .workforce-tab-btn
   + data-tab + #…-tab-content), which the smokes select on: this section
   STYLES, those classes only LOCATE. `.active` (unchanged from the pages' JS
   toggle) is the selected state.                                             */
.glass-tabs {
  display: flex; flex-wrap: wrap; gap: var(--spacing-1);
  border-bottom: 1px solid var(--glass-border);
  margin-bottom: var(--spacing-4);
}
.glass-tab {
  display: inline-flex; align-items: center; gap: var(--spacing-2);
  padding: var(--spacing-2) var(--spacing-4); margin-bottom: -1px;
  background: none; border: none; border-bottom: 2px solid transparent;
  color: var(--text-muted); font-size: var(--font-size-sm); font-weight: 600;
  cursor: pointer; white-space: nowrap;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  transition: color var(--motion-fast) ease, border-color var(--motion-fast) ease, background var(--motion-fast) ease;
}
.glass-tab .icon { width: 16px; height: 16px; }
.glass-tab:hover { color: var(--text-main); background: var(--glass-bg); }
.glass-tab.active { color: var(--text-main); border-bottom-color: var(--color-primary-bright); }

/* ── Slide-in detail panel (rollout Slice 5B — Leave + Payroll review panels) ─
   The pages' flex-row layouts position it (absolute inside their relative
   container); `.active` (toggled by the pages' JS, unchanged) slides it in.
   Deliberately MORE opaque than a glass-card — same readability-over-
   translucency recipe as the modal panel, because it overlays the list it
   details. The pages keep their `.leave-sidebar-panel`/`.payroll-sidebar-panel`
   classes as structural hooks; this class does the styling. */
.detail-panel {
  width: 400px;
  background: color-mix(in srgb, var(--bg-card) 88%, transparent);
  backdrop-filter: var(--blur-strong); -webkit-backdrop-filter: var(--blur-strong);
  border: 1px solid var(--glass-border-strong);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  position: absolute; top: 0; right: -420px; bottom: 0; z-index: 10;
  transition: right 0.3s ease;
  display: flex; flex-direction: column;
}
.detail-panel.active { right: 0; }

/* Clickable data-table rows + the selected state the detail panels highlight. */
.data-table tr.row-click { cursor: pointer; }
.data-table tr.row-click td:first-child { border-left: 4px solid transparent; }
.data-table tr.row-click.active-row td { background: color-mix(in srgb, var(--color-primary-bright) 8%, transparent); }
.data-table tr.row-click.active-row td:first-child { border-left-color: var(--color-primary-bright); }

/* ── Pills / status (unifies .badge + worker .status-badge, later) ──────────*/
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: var(--radius-pill);
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .3px;
  white-space: nowrap;
}
.pill-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.pill.tone-success { background: color-mix(in srgb, var(--color-success) 14%, transparent); color: var(--color-success); }
.pill.tone-warning { background: color-mix(in srgb, var(--color-warning) 14%, transparent); color: var(--color-warning); }
.pill.tone-danger  { background: color-mix(in srgb, var(--color-danger)  14%, transparent); color: var(--color-danger); }
.pill.tone-info    { background: color-mix(in srgb, var(--color-info)    14%, transparent); color: var(--color-info); }
.pill.tone-neutral { background: color-mix(in srgb, var(--color-neutral) 14%, transparent); color: var(--text-muted); }

/* Status-toned TEXT on glass surfaces (rollout Slice 5G). The raw status
   tokens are pill/badge tints and fail WCAG-AA as small body text on a light
   glass card (measured: danger 3.4:1, success 2.1:1, warning 2.0:1). Mixing
   half toward --text-main darkens the tone on light and lightens it on dark,
   clearing 4.5:1 in BOTH themes while keeping the hue readable as status. */
.tone-text-danger  { color: color-mix(in srgb, var(--color-danger) 50%, var(--text-main)); }
.tone-text-success { color: color-mix(in srgb, var(--color-success) 50%, var(--text-main)); }
.tone-text-warning { color: color-mix(in srgb, var(--color-warning) 50%, var(--text-main)); }
/* Brand-toned headings on glass (rollout Slice 5I — onboarding step headers).
   Same 50% mix-toward-text recipe: brand purple that stays AA in both themes. */
.tone-text-brand   { color: color-mix(in srgb, var(--color-primary-bright) 50%, var(--text-main)); }

/* ── Buttons — glass variants ONLY (global.css owns .btn / .btn-primary) ────*/
/* KI#264 raised chip: opaque, so no backdrop-filter — blur over a solid
   surface is a paint cost with nothing to show for it. */
.btn-secondary {
  display: inline-flex; align-items: center; gap: var(--spacing-2);
  padding: 9px 16px; border-radius: var(--radius-md);
  font-size: 13px; font-weight: 600; font-family: var(--font-text);
  transition: all var(--motion-fast) ease; white-space: nowrap;
  background: var(--control-solid-bg); color: var(--text-main);
  border: 1px solid var(--control-border);
  box-shadow: var(--btn-secondary-shadow);
}
.btn-secondary:hover { transform: translateY(-1px); border-color: var(--control-border-hover); box-shadow: var(--btn-secondary-shadow-hover); }
.btn-secondary:active { transform: translateY(0); }

.btn-small {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 10px; font-size: 12px; font-weight: 600;
  border: none; border-radius: var(--radius-sm);
  font-family: var(--font-text); transition: all var(--motion-fast) ease;
}
.btn-small.btn-primary { background: var(--btn-primary-bg); color: var(--btn-primary-fg); box-shadow: none; }
.btn-small.btn-primary:hover { background: var(--btn-primary-bg-hover); }
.btn-small.btn-secondary { background: var(--control-solid-bg); color: var(--text-main); border: 1px solid var(--control-border); box-shadow: var(--btn-secondary-shadow); }
.btn-small.btn-secondary:hover { border-color: var(--control-border-hover); }

/* ── Glass inputs ───────────────────────────────────────────────────────────*/
/* KI#264: page controls go solid like the .form-* vocabulary below — one
   field treatment everywhere, and no per-control blur cost. */
.search-input, .date-input {
  padding: 9px 14px;
  background: var(--control-solid-bg);
  border: 1px solid var(--control-border);
  border-radius: var(--radius-md);
  color: var(--text-main); font-size: 14px; font-family: var(--font-text);
  transition: all var(--motion-fast) ease;
}
/* ONE focus-ring/placeholder recipe for every glass input (page controls +
   the .form-* vocabulary) — a ring change edits exactly one rule. */
.search-input::placeholder, .date-input::placeholder,
.form-input::placeholder, .form-textarea::placeholder { color: var(--text-subtle); }
.search-input:focus, .date-input:focus,
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--input-focus-border);
  box-shadow: 0 0 0 3px var(--input-focus-ring);
}

/* ── Availability list (people + status rows) ───────────────────────────────*/
.availability-list { display: flex; flex-direction: column; gap: var(--spacing-3); }
.availability-item {
  display: flex; align-items: center; gap: var(--spacing-4);
  padding: var(--spacing-3) var(--spacing-4);
  background: var(--glass-bg-strong); border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  transition: border-color var(--motion-fast) ease;
}
.availability-item:hover { border-color: var(--glass-border-strong); }
.availability-status { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.availability-status.available { background: var(--color-success); box-shadow: 0 0 8px color-mix(in srgb, var(--color-success) 50%, transparent); }
.availability-status.on-leave  { background: var(--color-warning); box-shadow: 0 0 8px color-mix(in srgb, var(--color-warning) 50%, transparent); }
.availability-content { flex: 1; min-width: 0; }
.availability-name { font-size: 13.5px; font-weight: 600; color: var(--text-main); }
.availability-role { font-size: 12px; color: var(--text-muted); margin-top: 1px; }
.availability-time { font-size: 12px; color: var(--text-muted); text-align: right; flex-shrink: 0; }

/* ── Admin shell nav (rollout Slice 3 — Sidebar.js re-skin) ─────────────────
   Every rule is scoped under the admin-only #sidebar element, so this whole
   section is inert in the worker app (no #sidebar there; worker keeps its
   BottomNav). Replaces Sidebar.js's former inline styles + injected
   `sidebar-styles` block. Active tint derives from the brand tokens via
   color-mix (never hardcode purple/gold — white-label must recolour it).   */
#sidebar .sidebar-brand {
  padding: var(--spacing-6);
  border-bottom: 1px solid var(--glass-border);
  margin-bottom: var(--spacing-4);
}
#sidebar .brand-mark {
  width: 40px; height: 40px; border-radius: var(--radius-md);
  background: var(--logo-bg);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; margin-bottom: 10px;
}
#sidebar .brand-name {
  font-family: var(--font-display); font-size: var(--font-size-md); font-weight: 700;
  color: var(--text-main); margin: 0 0 2px; letter-spacing: -0.3px; line-height: 1.2;
}
#sidebar .brand-subtext {
  color: var(--color-primary-bright); font-size: var(--font-size-xs); font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.06em;
}
#sidebar nav {
  display: flex; flex-direction: column;
  padding: 0 var(--spacing-4); gap: var(--spacing-1);
}
#sidebar .sidebar-link {
  display: flex; align-items: center; gap: var(--spacing-3);
  padding: 10px var(--spacing-3);
  background: none; border: none; border-radius: var(--radius-md);
  color: var(--text-muted); font-size: var(--font-size-md); font-weight: 500;
  text-align: left; cursor: pointer;
  transition: all var(--motion-fast) ease;
}
#sidebar .sidebar-link:hover { color: var(--text-main); background: var(--glass-bg); }
#sidebar .sidebar-link.active {
  color: var(--text-main);
  background: linear-gradient(90deg,
    color-mix(in srgb, var(--brand-primary-alt) 18%, transparent),
    color-mix(in srgb, var(--brand-accent) 10%, transparent));
  box-shadow: inset 0 0 0 1px var(--glass-border-strong);
}
#sidebar .sidebar-link.active .icon { stroke: var(--color-accent-2); }

/* ── Progress bar ───────────────────────────────────────────────────────────*/
.bar-track { width: 100px; height: 6px; border-radius: var(--radius-pill); background: var(--glass-border); overflow: hidden; }
.bar-fill { height: 100%; border-radius: var(--radius-pill); background: linear-gradient(90deg, var(--color-primary-bright), var(--color-accent-2)); }

/* ── Shared state blocks — Loading / Error / Empty (Slice 1 phase 2b-B) ──────
   Consumed by App.Loading / App.ErrorState / App.Empty. The structural home for
   KI#217 (spinner) / KI#218 (error+retry) / KI#219 (empty); pages adopt them in
   later slices.                                                                */
@keyframes state-spin { to { transform: rotate(360deg); } }

.state-block {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: var(--spacing-4); text-align: center;
  padding: var(--spacing-8) var(--spacing-6);
  color: var(--text-muted); font-family: var(--font-text);
}
.state-spinner {
  width: 34px; height: 34px; border-radius: 50%;
  border: 3px solid var(--glass-border);
  border-top-color: var(--color-primary-bright);
  animation: state-spin .8s linear infinite;
}
.state-title { font-family: var(--font-display); font-size: 16px; font-weight: 600; color: var(--text-main); }
.state-msg { font-size: 13.5px; color: var(--text-muted); max-width: 340px; line-height: 1.5; }
.state-icon { width: 40px; height: 40px; stroke: var(--text-subtle); }
.state-error .state-title { color: var(--color-danger); }
.state-retry { margin-top: var(--spacing-2); cursor: pointer; }

/* ── First-run theme prompt — "Choose your appearance" (Slice 1 phase 2b-B) ──
   Rendered inside the shared Modal by App.ThemePrompt.                          */
.theme-prompt-lead { margin: 0 0 var(--spacing-5); color: var(--text-muted); font-size: 14px; line-height: 1.5; }
.theme-choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--spacing-4); }
.theme-choice {
  display: flex; flex-direction: column; align-items: center; gap: var(--spacing-3);
  padding: var(--spacing-6) var(--spacing-4); cursor: pointer;
  background: var(--glass-bg); color: var(--text-main);
  border: 1px solid var(--glass-border); border-radius: var(--radius-lg);
  font-family: var(--font-text); font-size: 14px; font-weight: 600;
  transition: transform var(--motion-fast) ease, border-color var(--motion-fast) ease;
}
.theme-choice:hover { transform: translateY(-2px); border-color: var(--glass-border-strong); }
.theme-choice:focus-visible { outline: none; border-color: var(--input-focus-border); box-shadow: 0 0 0 3px var(--input-focus-ring); }
.theme-choice-icon { width: 30px; height: 30px; }

/* Compact row variant for the persistent ThemeToggle control (shared
   ThemeToggle.js — admin Settings + worker Profile). Same .theme-choice
   recipe, settings-row scale; aria-pressed marks the active choice. */
.theme-toggle-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--spacing-3); max-width: 320px; }
.theme-toggle-grid .theme-choice { flex-direction: row; justify-content: center; gap: var(--spacing-2); padding: var(--spacing-3) var(--spacing-4); }
.theme-toggle-grid .theme-choice-icon { width: 20px; height: 20px; }
.theme-choice[aria-pressed="true"] { border-color: var(--input-focus-border); background: var(--hover-bg); }

/* ── Form language (rollout Slice 4) ─────────────────────────────────────────
   SINGLE OWNER of the .form-* vocabulary, shared by both apps. Moved here from
   worker.css — worker.css loads after this file, so a copy left there would
   silently win the cascade. Worker surfaces already carrying these classes
   (onboarding, Profile certificates, docket labels) re-skin immediately;
   admin's `.form-control` is a dead class today and STAYS unstyled — each
   admin page swaps it for this vocabulary in its own Slice 5 adoption, so no
   page changes appearance before its slice.
   The 16px control font is deliberate: below 16px, iOS Safari zooms the page
   on focus. */
.form-group { margin-bottom: 16px; }
/* .form-row — a side-by-side field pair that STACKS rather than overflowing.
   A bare `1fr 1fr` grid cannot do this: grid items default to min-width:auto,
   and input[type=date] has a ~170px intrinsic minimum (its dd/mm/yyyy fields +
   picker icon), so on a 360px phone each 1fr track blew past its share and the
   second field ran off the card — the leave From/To overlap Adam hit.
   The floor is that intrinsic width, so two-up survives only where two genuinely
   fit; min(100%, …) keeps the floor itself from overflowing a narrow parent, and
   min-width:0 on the children stops any other wide control blowing a track out.
   Spacing matches the .form-group rhythm so a row and a field sit evenly. */
.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr));
  gap: var(--spacing-3);
  margin-bottom: 16px;
}
.form-row > * { min-width: 0; }
.form-row .form-group { margin-bottom: 0; }
/* is-compact — for rows of genuinely SHORT values (PPE sizes, quantities). The
   170px floor is sized for a date picker and would stack these needlessly. */
.form-row.is-compact {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 104px), 1fr));
}
.form-label {
  display: block;
  font-size: 14px; font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-main);
  font-family: var(--font-text);
}
.form-required { color: var(--color-danger); }
/* NO backdrop-filter on controls, deliberately: onboarding renders dozens at
   once on low-end phones, and per-element blur is among the costliest paint
   properties. Blur stays reserved for large surfaces (cards, panel, shell).
   KI#264: controls are SOLID (raised-chip vocabulary) — a translucent field
   over a glass card was exactly the blend-into-the-background complaint. */
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 12px;
  box-sizing: border-box;
  font-size: 16px;
  font-family: inherit;
  color: var(--text-main);
  background: var(--control-solid-bg);
  border: 1px solid var(--control-border);
  border-radius: var(--radius-md);
  transition: border-color var(--motion-fast) ease, box-shadow var(--motion-fast) ease;
}
.form-input:disabled, .form-select:disabled, .form-textarea:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.form-textarea { resize: vertical; min-height: 100px; }
.form-hint  { margin: 4px 0 0; font-size: 12px; color: var(--text-muted); }
.form-error { margin: 4px 0 0; font-size: 12px; color: var(--color-danger); }
/* Native checks/radios keep their size + wiring; only the tint is themed. */
.form-group input[type="checkbox"], .form-group input[type="radio"],
.form-check input[type="checkbox"], .form-check input[type="radio"] {
  accent-color: var(--brand-primary-alt);
}
.form-check { display: flex; align-items: flex-start; gap: 10px; }

/* ── Signature pad (SignaturePad.js markup) ──────────────────────────────────
   The canvas surface stays WHITE in BOTH themes on purpose: the ink is
   near-black (#111827) and the exported PNG has a transparent background, so a
   dark pad would hide the stroke while signing. touch-action:none is REQUIRED —
   without it a finger-drag scrolls the page instead of drawing. */
.sig-wrap { margin-bottom: 12px; }
.sig-row { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.sig-label { font-size: 13px; font-weight: 600; color: var(--text-main); }
.sig-clear {
  padding: 3px 10px; font-size: 12px; font-weight: 600; cursor: pointer;
  background: transparent; color: var(--text-muted);
  border: 1px solid var(--border-color); border-radius: var(--radius-sm);
}
.sig-canvas {
  width: 100%; height: 160px; display: block;
  touch-action: none;
  cursor: crosshair;
  background: #FFFFFF;
  border: 1.5px dashed var(--border-color);
  border-radius: var(--radius-md);
}
.sig-hint { margin: 4px 0 0; font-size: 11px; color: var(--text-muted); }

/* ── Modal chrome (Modal.js re-skin — rollout Slice 4) ───────────────────────
   Chrome only. The PRESERVED contract: ids, open/close/backdrop/✕ semantics,
   display toggling from JS, NO Escape handler, NO focus trap (ThemePrompt.js
   scopes its own Escape). Bodies are page-owned HTML strings; they adopt the
   form vocabulary in their page slices.
   The panel is deliberately MORE opaque than a glass-card (color-mix off the
   theme's solid card colour): body copy and form controls sit on it over an
   unpredictable dimmed page, so readability wins over translucency — the
   backdrop supplies the glass depth.
   NOTE: the panel's backdrop-filter makes it the containing block for
   position:fixed descendants — fixed overlays launched from a modal body must
   append to document.body (all current ones do) or they will be trapped and
   scroll-clipped inside the panel. */
.modal-overlay { position: fixed; inset: 0; z-index: 1000; align-items: center; justify-content: center; }
.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px);
}
.modal-panel {
  position: relative; z-index: 1001;
  width: 90%; max-width: 600px; max-height: 90vh; overflow-y: auto;
  padding: 0;
  background: color-mix(in srgb, var(--bg-card) 88%, transparent);
  backdrop-filter: var(--blur-strong); -webkit-backdrop-filter: var(--blur-strong);
  border: 1px solid var(--glass-border-strong);
  border-radius: var(--radius-xl);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.28);
}
/* Sticky chrome: ONE shared recipe (top/bottom + borders differ). No blur
   here — at 94% opacity inside an already-blurred panel it is imperceptible,
   and sticky elements in a scroll container would re-sample it every frame. */
.modal-header, .modal-footer {
  padding: var(--spacing-4) var(--spacing-6);
  display: flex; align-items: center;
  position: sticky; z-index: 10;
  background: color-mix(in srgb, var(--bg-card) 94%, transparent);
}
.modal-header { top: 0; justify-content: space-between; border-bottom: 1px solid var(--glass-border); }
.modal-footer { bottom: 0; justify-content: flex-end; gap: var(--spacing-3); border-top: 1px solid var(--glass-border); }
.modal-title { margin: 0; font-family: var(--font-display); font-size: var(--font-size-xl); }
.modal-body { padding: var(--spacing-6); }
/* .btn.modal-close (0,2,0): worker.css loads after this file and its
   .btn-outline (0,1,0) would out-cascade a bare .modal-close, giving the ✕ a
   border in the worker app only — same trap the .form-* move note documents. */
.btn.modal-close { padding: 4px 10px; border: none; }
