/* Lyon Nijkamp · Servicewerkplaats. Local assets only; no runtime CSS dependencies. */
:root {
  color-scheme: light;
  --font: "Segoe UI", "Frutiger", "DejaVu Sans", sans-serif;
  --font-mono: "Cascadia Code", "Consolas", "DejaVu Sans Mono", monospace;
  --canvas: #f3f5f3;
  --surface: #ffffff;
  --surface-subtle: #f8faf8;
  --surface-hover: #edf2ef;
  --ink: #202e34;
  --muted: #586a70;
  --faint: #607176;
  --line: #dce3df;
  --line-strong: #82948b;
  --accent: #12665f;
  --accent-hover: #0b534e;
  --accent-soft: #e2f0eb;
  --accent-ink: #105b50;
  --link: #245aaf;
  --link-hover: #164480;
  --focus: #2868d1;
  --focus-halo: #d6e5ff;
  --danger: #a53131;
  --danger-soft: #fff0ef;
  --success: #196745;
  --success-soft: #e8f4eb;
  --warning: #81540c;
  --warning-soft: #fff4de;
  --info: #245a92;
  --info-soft: #eaf1fb;
  --sidebar-width: 248px;
  --radius: 8px;
  --radius-sm: 5px;
  --shadow-popover: 0 8px 28px #20312a1a, 0 2px 5px #20312a0d;
  --overlay: #12221db3;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --canvas: #131b1f;
  --surface: #1b262b;
  --surface-subtle: #172126;
  --surface-hover: #25343a;
  --ink: #e8eeeb;
  --muted: #afbebc;
  --faint: #9caeac;
  --line: #344448;
  --line-strong: #657e7d;
  --accent: #82cbb8;
  --accent-hover: #a4ddce;
  --accent-soft: #233f38;
  --accent-ink: #a4ddce;
  --link: #9bbfff;
  --link-hover: #c2d7ff;
  --focus: #a2c4ff;
  --focus-halo: #344f70;
  --danger: #ffa9a5;
  --danger-soft: #422a2d;
  --success: #a0dbb6;
  --success-soft: #233d32;
  --warning: #f1cc87;
  --warning-soft: #40382a;
  --info: #abcfff;
  --info-soft: #26394e;
  --shadow-popover: 0 10px 30px #0005;
  --overlay: #070e13c9;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]) {
    color-scheme: dark;
    --canvas: #131b1f; --surface: #1b262b; --surface-subtle: #172126;
    --surface-hover: #25343a; --ink: #e8eeeb; --muted: #afbebc; --faint: #9caeac;
    --line: #344448; --line-strong: #657e7d; --accent: #82cbb8; --accent-hover: #a4ddce;
    --accent-soft: #233f38; --accent-ink: #a4ddce; --link: #9bbfff; --link-hover: #c2d7ff;
    --focus: #a2c4ff; --focus-halo: #344f70; --danger: #ffa9a5; --danger-soft: #422a2d;
    --success: #a0dbb6; --success-soft: #233d32; --warning: #f1cc87; --warning-soft: #40382a;
    --info: #abcfff; --info-soft: #26394e; --shadow-popover: 0 10px 30px #0005; --overlay: #070e13c9;
  }
}
*, *::before, *::after { box-sizing: border-box; }
html { min-height: 100%; scroll-padding-top: 24px; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--canvas); color: var(--ink); font-family: var(--font); font-size: 14px; line-height: 1.55; -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--link-hover); }
button, input, select, textarea { font: inherit; }
button, select, input[type="checkbox"], input[type="radio"], summary { cursor: pointer; }
button { color: inherit; }
button:disabled, input:disabled, select:disabled, textarea:disabled { cursor: not-allowed; opacity: .6; }
img { display: block; max-width: 100%; height: auto; }
svg { vertical-align: middle; }
.icon { flex: 0 0 auto; width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; }
h1, h2, h3, h4, p, ul, ol, dl, figure { margin: 0; }
h1 { font-size: clamp(25px, 2.2vw, 31px); font-weight: 650; line-height: 1.2; letter-spacing: -.035em; overflow-wrap: anywhere; }
h2 { font-size: 17px; font-weight: 650; line-height: 1.35; letter-spacing: -.015em; }
h3 { font-size: 15px; font-weight: 650; line-height: 1.4; }
p + p { margin-top: 12px; }
strong { font-weight: 650; }
small, .small { font-size: 12px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; z-index: 100; left: 16px; top: 12px; padding: 12px 18px; border-radius: var(--radius-sm); color: var(--ink); background: var(--surface); transform: translateY(-180%); }
.skip-link:focus { transform: none; }
.muted, .text-muted { color: var(--muted); }
.mono, code { font-family: var(--font-mono); font-size: .9em; font-variant-numeric: tabular-nums; }
.numeric, .amount, .stat-value, .tab-count, time { font-variant-numeric: lining-nums tabular-nums; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.nowrap { white-space: nowrap; }
.text-break { overflow-wrap: anywhere; }
.pre-wrap { white-space: pre-wrap; overflow-wrap: anywhere; }
.stack { display: flex; flex-direction: column; gap: 20px; }
.stack-sm { display: flex; flex-direction: column; gap: 10px; }
.inline, .inline-actions, .actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.divider { border: 0; border-top: 1px solid var(--line); margin: 24px 0; }
/* Application chrome */
.app-shell { display: grid; grid-template-columns: var(--sidebar-width) minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: fixed; z-index: 40; inset: 0 auto 0 0; display: flex; flex-direction: column; width: var(--sidebar-width); background: var(--surface-subtle); border-right: 1px solid var(--line); overflow-y: auto; overscroll-behavior: contain; }
.sidebar-brand-row { display: flex; align-items: center; justify-content: space-between; padding: 27px 20px 23px; }
.brand { display: flex; align-items: center; gap: 11px; color: var(--ink); text-decoration: none; min-height: 44px; min-width: 0; }
.brand:hover { color: var(--ink); }
.brand-mark { display: flex; align-items: center; justify-content: center; flex: 0 0 auto; width: 38px; height: 39px; border: 1px solid var(--accent); border-radius: 6px; background: var(--accent); color: var(--surface); font-size: 17px; font-weight: 750; letter-spacing: -1.4px; }
.brand-mark > span { color: var(--surface); }
.brand-copy { display: grid; gap: 1px; min-width: 0; }
.brand-copy strong { font-size: 14px; letter-spacing: -.02em; overflow-wrap: anywhere; }
.brand-copy > span { color: var(--muted); font-size: 11px; letter-spacing: .015em; }
.workspace-label { display: flex; align-items: center; gap: 8px; min-height: 36px; margin: 0 19px 15px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: .015em; }
.workspace-indicator, .context-mark { display: inline-block; width: 6px; height: 6px; border-radius: 2px; background: var(--accent); flex: 0 0 auto; }
.sidebar-nav { padding: 0 12px 20px; }
.nav-section-label { margin: 21px 12px 6px; color: var(--faint); font-size: 10px; font-weight: 700; line-height: 1.5; text-transform: uppercase; letter-spacing: .09em; }
.nav-section-label:first-child { margin-top: 5px; }
.nav-link { display: flex; align-items: center; gap: 11px; min-height: 44px; padding: 10px 12px; color: var(--muted); border-radius: 5px; text-decoration: none; font-size: 12px; font-weight: 550; }
.nav-link .icon { width: 17px; height: 17px; opacity: .85; }
.nav-link:hover { background: var(--surface-hover); color: var(--ink); }
.nav-link.is-active { background: var(--accent-soft); color: var(--accent-ink); font-weight: 650; }
.nav-link.is-active .icon { opacity: 1; }
.sidebar-bottom { margin-top: auto; padding: 12px 18px 16px; border-top: 1px solid var(--line); }
.sidebar-service-link { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 8px 3px; color: var(--accent-ink); font-size: 12px; font-weight: 600; text-decoration: none; }
.user-panel { display: flex; align-items: center; gap: 9px; padding-top: 11px; margin-top: 8px; border-top: 1px solid var(--line); }
.user-avatar { display: grid; flex: 0 0 auto; width: 32px; height: 32px; place-items: center; background: var(--surface-hover); border: 1px solid var(--line); border-radius: 50%; color: var(--muted); font-size: 12px; font-weight: 650; }
.user-copy { display: grid; flex: 1 1 auto; min-width: 0; min-height: 44px; align-content: center; color: var(--ink); text-decoration: none; }
.user-copy:hover { color: var(--link); }
.user-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.user-copy > span { color: var(--muted); font-size: 10px; }
.logout-form { flex: 0 0 auto; }
.sidebar-caption { color: var(--muted); font-size: 11px; line-height: 1.7; padding: 3px; }
.main-shell { grid-column: 2; min-width: 0; }
.staging-banner { display: flex; justify-content: center; align-items: baseline; flex-wrap: wrap; gap: 5px 12px; padding: 9px 24px; border-bottom: 1px solid var(--line); background: var(--warning-soft); color: var(--warning); font-size: 11px; line-height: 1.5; }
.staging-banner strong { white-space: nowrap; font-size: 10px; text-transform: uppercase; letter-spacing: .065em; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; min-height: 68px; padding: 8px 36px; border-bottom: 1px solid var(--line); background: var(--surface); }
.topbar-context, .topbar-actions { display: flex; align-items: center; gap: 11px; }
.topbar-context { color: var(--muted); font-size: 11px; }
.topbar-context strong { color: var(--ink); font-weight: 550; }
.topbar-divider { color: var(--line-strong); }
.topbar-link { display: inline-flex; align-items: center; gap: 5px; min-height: 44px; font-size: 12px; font-weight: 600; text-decoration: none; }
.topbar-link .icon { width: 15px; height: 15px; }
.main-content { width: 100%; max-width: 1680px; min-height: calc(100vh - 110px); padding: 31px 36px 0; margin: 0 auto; }
.main-content:focus { outline: none; }
.page-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 27px; }
.page-heading { min-width: 0; }
.eyebrow { margin-bottom: 9px; color: var(--accent-ink); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; }
.page-subtitle { margin-top: 9px; max-width: 78ch; color: var(--muted); font-size: 13px; }
.page-subtitle:empty { display: none; }
.header-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px; flex: 0 0 auto; }
.header-actions:empty { display: none; }
.page-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 40px; padding: 18px 0 23px; border-top: 1px solid var(--line); color: var(--faint); font-size: 10px; }
.page-footer > span > span { margin: 0 6px; color: var(--line-strong); }
.page-footer a { display: inline-flex; align-items: center; gap: 5px; min-height: 44px; color: var(--muted); text-decoration: none; }
.page-footer .icon { width: 13px; height: 13px; }
.mobile-bar, .sidebar .sidebar-close, .navigation-backdrop { display: none; }
/* Controls. Every interactive target is at least 44px. */
.button, :where(button[type="submit"]:not(.icon-button):not(.nav-link)) { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; gap: 8px; min-height: 44px; padding: 10px 16px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); font-size: 12px; font-weight: 650; line-height: 1.45; text-decoration: none; transition: background-color 120ms, border-color 120ms; }
.button:hover, button[type="submit"]:not(.icon-button):hover { border-color: var(--muted); background: var(--surface-hover); color: var(--ink); }
.button-primary, button[type="submit"].button-primary { border-color: var(--accent); background: var(--accent); color: var(--surface); }
.button-primary:hover, button[type="submit"].button-primary:hover { border-color: var(--accent-hover); background: var(--accent-hover); color: var(--surface); }
.button-secondary { background: var(--surface); }
.button-danger, button[type="submit"].button-danger { color: var(--danger); border-color: var(--danger); background: var(--surface); }
.button-danger:hover, button[type="submit"].button-danger:hover { color: var(--danger); border-color: var(--danger); background: var(--danger-soft); }
.button-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.button-ghost:hover { border-color: var(--line); }
.button-small, .button-sm { padding-inline: 11px; font-size: 11px; }
.button-block { width: 100%; }
.button .icon { width: 16px; height: 16px; }
.icon-button { display: inline-flex; justify-content: center; align-items: center; width: 44px; height: 44px; flex: 0 0 auto; padding: 10px; border: 1px solid transparent; border-radius: var(--radius-sm); background: transparent; color: var(--muted); }
.icon-button:hover { background: var(--surface-hover); color: var(--ink); }
.link-button { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 8px 2px; border: 0; background: transparent; color: var(--link); font-size: 12px; font-weight: 600; text-decoration: none; }
.link-button:hover { color: var(--link-hover); text-decoration: underline; }
.theme-menu { position: relative; }
.theme-trigger { display: flex; align-items: center; gap: 7px; min-height: 44px; padding: 8px 10px; border: 1px solid transparent; border-radius: var(--radius-sm); color: var(--muted); font-size: 11px; list-style: none; }
.theme-trigger::-webkit-details-marker { display: none; }
.theme-trigger:hover, .theme-menu[open] .theme-trigger { background: var(--surface-hover); }
.theme-trigger .icon { width: 15px; height: 15px; }
.theme-options { position: absolute; z-index: 50; inset: calc(100% + 6px) 0 auto auto; width: 172px; margin: 0; padding: 6px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); box-shadow: var(--shadow-popover); }
.theme-options label { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 9px 10px; border-radius: 4px; color: var(--ink); font-size: 12px; cursor: pointer; }
.theme-options label:hover { background: var(--surface-hover); }
.theme-options input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }
/* Compact primary queue filters; advanced controls stay native and JS-free. */
.queue-filter-primary { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr) auto; align-items: end; gap: 14px; }
.queue-filter-buttons { display: flex; flex-wrap: wrap; align-items: end; gap: 8px; }
.queue-filter-advanced { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 8px; }
.queue-filter-advanced > summary { min-height: 44px; padding: 10px 0; color: var(--link); font-weight: 600; }
.queue-filter-advanced .form-grid { padding-top: 12px; }
@media (max-width: 1100px) { .queue-filter-primary { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .queue-filter-primary { grid-template-columns: minmax(0, 1fr); } }

/* Layout and data containers */
.grid, .form-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; }
.grid-2, .form-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid > *, .form-grid > * { min-width: 0; }
.span-2 { grid-column: span 2; }
.card { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.card + .card, .grid + .card, .stats-grid + .card, .card + .grid, .grid + .grid, .alert + .card { margin-top: 20px; }
.grid > .card + .card { margin-top: 0; }
.card-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px 16px; padding: 19px 22px; border-bottom: 1px solid var(--line); }
.card-header h2, .card-header h3 { font-size: 14px; letter-spacing: -.01em; }
.card-header p { margin-top: 3px; color: var(--muted); font-size: 12px; }
.card-header .link-button { margin-block: -8px; }
.card-body { padding: 22px; }
.card-body > * + h2, .card-body > * + h3 { margin-top: 24px; }
.card-body > h2 + p, .card-body > h3 + p { margin-top: 7px; }
.card-footer { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; padding: 14px 22px; border-top: 1px solid var(--line); background: var(--surface-subtle); font-size: 12px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin: 27px 0 13px; }
.section-heading h2 { font-size: 15px; }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(155px, 1fr)); gap: 0; margin-bottom: 24px; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.stat-card { padding: 20px 22px; border-right: 1px solid var(--line); }
.stat-card:last-child { border-right: 0; }
.stat-label { color: var(--muted); font-size: 11px; font-weight: 550; }
.stat-value { display: block; margin: 5px 0 3px; font-size: 28px; font-weight: 600; letter-spacing: -.045em; line-height: 1.25; overflow-wrap: anywhere; }
.stat-detail { color: var(--muted); font-size: 10px; }
.stat-card a { color: inherit; text-decoration: none; }
.stat-card a:hover { color: var(--link); }
/* Tabular work queues */
.table-wrap { width: 100%; max-width: 100%; overflow-x: auto; overscroll-behavior-inline: contain; scrollbar-width: thin; }
.table-wrap:focus-visible { outline-offset: -3px; }
.data-table, .table-wrap > table { width: 100%; border-collapse: collapse; text-align: left; font-size: 12px; }
.data-table caption { padding: 12px 22px; text-align: left; color: var(--muted); font-size: 11px; }
.data-table th, .table-wrap > table th { padding: 12px 20px; border-bottom: 1px solid var(--line); background: var(--surface-subtle); color: var(--muted); font-size: 10px; font-weight: 600; white-space: nowrap; }
.data-table td, .table-wrap > table td { padding: 13px 20px; border-bottom: 1px solid var(--line); color: var(--ink); vertical-align: middle; }
.data-table tr:last-child td, .table-wrap > table tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: var(--surface-subtle); }
.data-table td .cell-primary { display: block; color: var(--ink); font-weight: 600; }
.data-table td .cell-secondary { display: block; margin-top: 2px; color: var(--muted); font-size: 10px; }
.data-table td > a:not(.button):not(.badge) { display: inline-flex; align-items: center; min-height: 44px; margin-block: -8px; font-weight: 600; text-decoration: none; }
.data-table td > a:not(.button):not(.badge):hover { text-decoration: underline; }
.data-table .amount, .data-table .numeric { white-space: nowrap; text-align: right; }
.data-table .row-actions { text-align: right; white-space: nowrap; }
.table-hint { padding: 9px 20px; color: var(--muted); font-size: 11px; border-bottom: 1px solid var(--line); }
.toolbar { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 18px; }
.card > .toolbar { margin: 0; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.toolbar form, form.toolbar, .filter-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; }
.toolbar label { margin-bottom: 4px; font-size: 11px; }
.toolbar input, .toolbar select { width: auto; min-width: 150px; }
.search-field { position: relative; flex: 1 1 260px; min-width: 0; max-width: 440px; }
.search-field input { width: 100%; }
.search-field > .icon { position: absolute; inset: 13px auto auto 12px; color: var(--muted); pointer-events: none; }
.search-field:has(> .icon) input { padding-left: 38px; }
.tabs { display: flex; align-items: stretch; flex-wrap: wrap; gap: 2px 18px; margin-bottom: 20px; border-bottom: 1px solid var(--line); }
.tabs a, .tabs button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 11px 2px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--muted); font-size: 12px; font-weight: 550; text-decoration: none; }
.tabs a:hover, .tabs button:hover { color: var(--ink); }
.tabs a[aria-current="page"], .tabs .active, .tabs .is-active, .tabs [aria-selected="true"] { border-bottom-color: var(--accent); color: var(--accent-ink); font-weight: 650; }
.tab-count { padding: 1px 6px; border: 1px solid var(--line); border-radius: 4px; font-size: 10px; }
.pagination { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; padding: 14px 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.pagination a { display: inline-flex; align-items: center; min-height: 44px; padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); color: var(--ink); text-decoration: none; }
/* Semantic status. Visible labels remain required; color never carries state alone. */
.badge { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 4px 8px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface-subtle); color: var(--muted); font-size: 10px; font-weight: 600; line-height: 1.45; white-space: normal; }
.badge::before { content: ""; display: block; flex: 0 0 auto; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
a.badge { min-height: 44px; text-decoration: none; }
.badge.status-submitted, .badge.status-received, .badge.status-draft, .badge.status-queued, .badge-neutral { color: var(--muted); background: var(--surface-subtle); border-color: var(--line); }
.badge.status-in_repair, .badge.status-repairing, .badge.status-diagnosis, .badge.status-diagnosing, .badge.status-testing, .badge.status-quality_control, .badge.status-in_progress, .badge-info { color: var(--info); background: var(--info-soft); border-color: transparent; }
.badge.status-awaiting_approval, .badge.status-quote_sent, .badge.status-quoted, .badge.status-awaiting_quote, .badge.status-awaiting_parts, .badge.status-parts_ordered, .badge.status-waiting_for_parts, .badge.status-pending, .badge.status-issued, .badge.status-sent, .badge.status-partial, .badge-warning { color: var(--warning); background: var(--warning-soft); border-color: transparent; }
.badge.status-approved, .badge.status-accepted, .badge.status-ready, .badge.status-ready_for_pickup, .badge.status-ready_for_collection, .badge.status-completed, .badge.status-delivered, .badge.status-shipped, .badge.status-paid, .badge.status-active, .badge.status-captured, .badge.status-closed, .badge-success { color: var(--success); background: var(--success-soft); border-color: transparent; }
.badge.status-cancelled, .badge.status-rejected, .badge.status-unrepairable, .badge.status-expired, .badge.status-overdue, .badge.status-failed, .badge.status-void, .badge-danger { color: var(--danger); background: var(--danger-soft); border-color: transparent; }
/* Django forms, including uncustomized form.as_p output. */
form { margin: 0; }
form p { margin: 0 0 19px; }
form p:last-child { margin-bottom: 0; }
form p:has(> input[type="hidden"]:only-child) { display: none; }
form label, .form-field > label, .field-label { display: block; margin-bottom: 6px; color: var(--ink); font-size: 12px; font-weight: 600; }
form input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="submit"]):not([type="button"]), form select, form textarea, .search-field input, .form-control {
  display: block; width: 100%; max-width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); font-family: var(--font); font-size: 13px; line-height: 1.5; box-shadow: none;
}
form input::placeholder, form textarea::placeholder { color: var(--faint); opacity: 1; }
form select { padding-right: 30px; }
form select[multiple] { min-height: 128px; padding: 6px; }
form select[multiple] option { padding: 7px; }
form textarea { min-height: 120px; resize: vertical; }
form input:focus-visible, form select:focus-visible, form textarea:focus-visible, .form-control:focus-visible { border-color: var(--focus); outline: 2px solid var(--focus); outline-offset: 2px; }
form input[type="checkbox"], form input[type="radio"] { width: 18px; height: 18px; margin: 0 7px 0 0; vertical-align: middle; accent-color: var(--accent); }
form label:has(input[type="checkbox"]), form label:has(input[type="radio"]), form p:has(> input[type="checkbox"]) > label, .checkbox-field { display: flex; align-items: center; min-height: 44px; margin: 0; font-weight: 500; }
form p:has(> input[type="checkbox"]) { display: flex; align-items: center; flex-wrap: wrap; column-gap: 8px; }
form p:has(> input[type="checkbox"]) .helptext { flex-basis: 100%; }
form [role="group"] label, form div[id] > div > label:has(input[type="checkbox"]), form div[id] > div > label:has(input[type="radio"]) { padding-block: 8px; }
form input[type="file"] { padding: 6px; overflow: hidden; font-size: 12px; }
form input[type="file"]::file-selector-button { min-height: 32px; margin-right: 10px; padding: 6px 10px; border: 0; border-radius: 3px; background: var(--surface-hover); color: var(--ink); font: inherit; cursor: pointer; }
form input[readonly], form textarea[readonly] { background: var(--surface-subtle); color: var(--muted); }
.helptext, .help-text, .field-help { display: block; margin-top: 6px; color: var(--muted); font-size: 11px; line-height: 1.65; }
.helptext ul { padding-left: 18px; margin-top: 5px; }
.errorlist, .field-errors { margin: 0 0 7px; padding: 0; color: var(--danger); font-size: 12px; list-style: none; }
.errorlist li + li { margin-top: 4px; }
.errorlist.nonfield { padding: 12px 14px; margin-bottom: 20px; border: 1px solid var(--danger); border-radius: var(--radius-sm); background: var(--danger-soft); }
form [aria-invalid="true"], .form-field.has-error input, .form-field.has-error select, .form-field.has-error textarea { border-color: var(--danger) !important; }
.form-field { min-width: 0; }
.form-grid > p { margin-bottom: 0; }
.form-grid .full-width { grid-column: 1 / -1; }
.form-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; padding-top: 20px; margin-top: 24px; border-top: 1px solid var(--line); }
.form-actions .muted { margin-left: auto; font-size: 11px; }
fieldset { min-width: 0; margin: 0 0 22px; padding: 18px; border: 1px solid var(--line); border-radius: var(--radius-sm); }
legend { padding: 0 7px; font-size: 12px; font-weight: 650; }
.form-intro { padding-bottom: 20px; margin-bottom: 22px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.form-layout { display: grid; grid-template-columns: minmax(0, 1fr) 260px; align-items: start; gap: 24px; max-width: 1120px; }
.form-card { width: 100%; max-width: 780px; }
.form-aside { padding: 6px 0; color: var(--muted); font-size: 12px; line-height: 1.8; }
.form-aside h2 { margin-bottom: 8px; color: var(--ink); font-size: 13px; }
.required-note { margin-bottom: 20px; color: var(--muted); font-size: 11px; }
/* Empty states, feedback, details, history, attachments. */
.messages { display: grid; gap: 10px; margin-bottom: 24px; }
.alert { display: flex; align-items: flex-start; gap: 10px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); font-size: 12px; line-height: 1.7; overflow-wrap: anywhere; }
.alert > div { min-width: 0; }
.alert-info, .alert-debug { background: var(--info-soft); color: var(--info); border-color: transparent; }
.alert-success { background: var(--success-soft); color: var(--success); border-color: transparent; }
.alert-warning { background: var(--warning-soft); color: var(--warning); border-color: transparent; }
.alert-error, .alert-danger { background: var(--danger-soft); color: var(--danger); border-color: var(--danger); }
.alert a { color: inherit; font-weight: 650; }
.alert + .alert { margin-top: 10px; }
.form-error-summary { margin-bottom: 20px; }
.form-error-summary p { margin: 6px 0 0; }
.form-error-summary ul { padding-left: 17px; margin-top: 7px; }
.form-error-summary li > a { display: inline-flex; align-items: center; min-height: 44px; }
.empty-state { display: grid; justify-items: start; gap: 9px; padding: 38px 24px; max-width: 620px; margin-inline: auto; }
.empty-state .icon { color: var(--faint); width: 25px; height: 25px; margin-bottom: 6px; }
.empty-state h2, .empty-state h3 { font-size: 15px; }
.empty-state p { max-width: 58ch; color: var(--muted); font-size: 12px; }
.empty-state .button, .empty-state .link-button { margin-top: 6px; }
.data-table td.empty-state, .table-wrap > table td.empty-state { display: table-cell; max-width: none; padding: 30px 20px; color: var(--muted); text-align: center; }
.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 19px 28px; }
.detail-grid > div { min-width: 0; }
.detail-grid dt { margin-bottom: 4px; color: var(--muted); font-size: 11px; }
.detail-grid dd { margin: 0; color: var(--ink); font-size: 13px; overflow-wrap: anywhere; }
.detail-grid > dt { color: var(--muted); font-size: 12px; }
.detail-grid > dd { margin: 0; font-size: 13px; overflow-wrap: anywhere; }
.timeline { padding: 0; margin: 0; list-style: none; }
.timeline-item { position: relative; padding: 0 0 25px 25px; min-width: 0; }
.timeline-item::before { position: absolute; content: ""; inset: 7px auto -3px 4px; width: 1px; background: var(--line); }
.timeline-item::after { position: absolute; content: ""; left: 0; top: 5px; width: 9px; height: 9px; border: 2px solid var(--surface); border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 1px var(--line-strong); }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-item:last-child::before { display: none; }
.timeline-item time, .timeline-meta { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; }
.timeline-item p { margin-top: 6px; font-size: 12px; overflow-wrap: anywhere; }
.timeline-title { font-size: 12px; font-weight: 650; }
.message-thread { display: grid; gap: 15px; }
.message-item { padding: 16px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-subtle); }
.message-item.internal { background: var(--warning-soft); }
.message-meta { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; color: var(--muted); font-size: 11px; }
.message-body { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13px; }
.upload-zone, .upload-field { padding: 20px; border: 1px dashed var(--line-strong); border-radius: var(--radius-sm); background: var(--surface-subtle); }
.upload-zone p { margin: 0 0 12px; color: var(--muted); font-size: 12px; }
.upload-zone input[type="file"] { background: var(--surface); }
.photo-grid, .attachment-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.photo-card, .attachment { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
.photo-card img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.photo-card figcaption, .attachment-body { padding: 10px 12px; font-size: 11px; overflow-wrap: anywhere; }
.photo-card a, .attachment a { display: flex; align-items: center; min-height: 44px; gap: 8px; text-decoration: none; }
progress, .progress { width: 100%; height: 7px; overflow: hidden; border: 0; border-radius: 4px; background: var(--line); accent-color: var(--accent); }
progress::-webkit-progress-bar { background: var(--line); }
progress::-webkit-progress-value { background: var(--accent); }
progress::-moz-progress-bar { background: var(--accent); }
.progress > span, .progress-bar { display: block; height: 100%; background: var(--accent); }
.status-counts { display: grid; grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); gap: 8px; }
.status-count { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); color: var(--ink); text-decoration: none; font-size: 12px; }
.status-count:hover { background: var(--surface-subtle); }
.status-count strong { font-variant-numeric: tabular-nums; }
.status-count .badge { border: 0; padding: 0; background: transparent; }
/* Authentication remains part of the same actual application, not a marketing page. */
.auth-layout { display: grid; grid-template-columns: minmax(280px, 480px) minmax(200px, 300px); align-items: start; gap: 42px; max-width: 900px; }
.auth-card .card-body { padding: 28px; }
.auth-card .form-actions { margin-top: 22px; }
.auth-card .form-actions .button-primary { width: 100%; }
.auth-card .auth-links { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 5px 20px; margin-top: 16px; padding-top: 15px; border-top: 1px solid var(--line); font-size: 11px; }
.auth-links a { display: inline-flex; align-items: center; min-height: 44px; }
.auth-aside { margin-top: 18px; padding: 0; color: var(--muted); font-size: 12px; line-height: 1.8; }
.auth-aside .eyebrow { margin-bottom: 12px; }
.auth-aside h2 { margin-bottom: 10px; color: var(--ink); font-size: 16px; }
.auth-aside ul { padding: 17px 0 0; margin-top: 17px; border-top: 1px solid var(--line); list-style: none; }
.auth-aside li { display: flex; gap: 9px; margin-bottom: 12px; }
.auth-aside li .icon { width: 15px; height: 15px; margin-top: 4px; color: var(--accent-ink); }
.message-card { max-width: 700px; }
.message-card .card-body { padding: 28px; }
.message-card .message-heading { margin-bottom: 12px; font-size: 17px; }
.message-card .form-actions { margin-top: 24px; }
/* Deliberate stacking: no viewport-wide horizontal scrolling. */
@media (min-width: 1680px) { .main-content { padding-inline: 48px; } .topbar { padding-inline: 48px; } }
@media (max-width: 1180px) {
  .main-content { padding: 26px 24px 0; }
  .topbar { padding-inline: 24px; }
  .form-layout { grid-template-columns: minmax(0, 1fr); }
  .form-aside { max-width: 70ch; }
  .auth-layout { gap: 26px; }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .data-table th, .data-table td { padding-inline: 16px; }
}
@media (max-width: 900px) {
  .page-header { align-items: flex-start; flex-direction: column; gap: 16px; }
  .header-actions { justify-content: flex-start; }
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .auth-layout { grid-template-columns: minmax(0, 1fr); max-width: 560px; }
  .auth-aside { margin-top: 0; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-card { border-bottom: 1px solid var(--line); }
  .stat-card:nth-child(even) { border-right: 0; }
  .stat-card:nth-last-child(-n+2) { border-bottom: 0; }
}
@media (max-width: 760px) {
  .app-shell { display: block; }
  .sidebar { position: relative; inset: auto; width: 100%; max-height: none; border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar-brand-row { padding: 16px 20px; }
  .sidebar-nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px; padding-bottom: 16px; }
  .nav-section-label { grid-column: 1 / -1; margin-top: 14px; }
  .sidebar-bottom { margin-top: 0; }
  .main-shell { width: 100%; }
  .main-content { padding: 22px 20px 0; }
  .topbar { min-height: 56px; padding: 5px 20px; gap: 6px; }
  .topbar-context { gap: 7px; font-size: 10px; }
  .staging-banner { justify-content: flex-start; padding: 9px 20px; font-size: 10px; }
  .mobile-bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 8px 16px 8px 20px; border-bottom: 1px solid var(--line); background: var(--surface); }
  .mobile-brand { display: grid; padding-block: 4px; min-height: 44px; color: var(--ink); font-weight: 650; font-size: 13px; line-height: 1.4; text-decoration: none; }
  .mobile-brand span { color: var(--muted); font-size: 10px; font-weight: 400; }
  :root[data-enhanced] .sidebar { position: fixed; z-index: 70; width: min(310px, calc(100vw - 40px)); height: 100dvh; max-height: 100dvh; inset: 0 auto 0 0; border-right: 1px solid var(--line); border-bottom: 0; visibility: hidden; transform: translateX(-100%); transition: transform 160ms ease; }
  :root[data-enhanced] .sidebar-nav { display: block; }
  :root[data-enhanced] .sidebar-bottom { margin-top: auto; }
  :root[data-navigation="open"] { overflow: hidden; }
  :root[data-navigation="open"] .sidebar { visibility: visible; transform: translateX(0); }
  :root[data-navigation="open"] .navigation-backdrop { display: block; position: fixed; z-index: 60; inset: 0; padding: 0; border: 0; border-radius: 0; background: var(--overlay); }
  :root[data-enhanced] .sidebar-close { display: inline-flex; }
  .page-header { margin-bottom: 22px; }
  .page-subtitle { font-size: 12px; }
  .eyebrow { font-size: 9px; }
  .card-header { padding: 16px 18px; }
  .card-body { padding: 18px; }
  .card-footer { padding-inline: 18px; }
  .stat-card { padding: 17px 18px; }
  .stat-value { font-size: 27px; }
  .data-table { min-width: 590px; }
  .data-table.compact-table { min-width: 440px; }
  .data-table .hide-mobile { display: none; }
  .table-wrap { -webkit-overflow-scrolling: touch; }
  .form-grid-2 { grid-template-columns: minmax(0, 1fr); }
  .form-grid .span-2 { grid-column: auto; }
  .toolbar { align-items: stretch; }
  .toolbar form, form.toolbar, .filter-form { width: 100%; }
  .toolbar .form-field, .toolbar .search-field { flex: 1 1 100%; max-width: none; }
  .toolbar input, .toolbar select { width: 100%; min-width: 0; }
  .toolbar .button { flex: 1 1 auto; }
  .auth-card .card-body { padding: 22px; }
  .auth-layout { max-width: none; }
  .detail-grid { gap: 16px; }
  .page-footer { align-items: flex-start; flex-direction: column; gap: 0; margin-top: 30px; }
  .form-actions .muted { margin-left: 0; flex-basis: 100%; }
  form input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]), form select, form textarea { font-size: 16px; }
}
@media (max-width: 420px) {
  .main-content { padding-inline: 14px; }
  .topbar { padding-inline: 14px; }
  .topbar-context > span:not(.context-mark), .topbar-context .topbar-divider { display: none; }
  .staging-banner { padding-inline: 14px; }
  .header-actions { width: 100%; }
  .header-actions .button { flex: 1 1 auto; }
  .detail-grid { grid-template-columns: minmax(0, 1fr); }
  .form-actions .button { flex: 1 1 auto; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-card { padding: 16px 14px; }
  .card-body { padding: 16px; }
  .status-counts { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
@media (forced-colors: active) {
  .badge { border: 1px solid CanvasText; }
  .nav-link.is-active { outline: 1px solid Highlight; }
  .button-primary { border: 2px solid ButtonText; }
}
@media print {
  :root { color-scheme: light; --canvas: white; --surface: white; --ink: #111; --muted: #444; --line: #bbb; }
  body { background: white; color: #111; font-size: 11pt; }
  .sidebar, .topbar, .mobile-bar, .header-actions, .page-footer, .navigation-backdrop, .skip-link, .theme-menu { display: none !important; }
  .app-shell, .main-shell { display: block; }
  .main-content { max-width: none; padding: 0; }
  .card { break-inside: avoid; }
  .table-wrap { overflow: visible; }
  .data-table { min-width: 0; }
}
