@media screen {
  header:has(.theme-toggle) { flex-wrap: wrap; gap: 6px 14px; }
  header .theme-toggle {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 36px;
    margin-inline-start: auto;
    padding: 5px 10px;
    border-radius: 6px;
    font: 650 13px/1.25 var(--font-sans);
    white-space: nowrap;
  }
  header .theme-toggle::before {
    content: "";
    width: 9px;
    height: 9px;
    border: 1px solid currentColor;
    border-radius: 50%;
  }
  header .theme-toggle[aria-pressed="true"]::before { background: currentColor; }
  header .theme-toggle[hidden] { display: none; }
  .field-label, .vehicle-picker .form-label, .form-label {
    min-width: 0;
    font: 650 .875rem/1.4 var(--font-sans);
    letter-spacing: .025em;
    text-transform: none;
    overflow-wrap: anywhere;
  }
  :is(.fleet-controls, .fleet-dashboard-filters, .handover-panel, .handover-wizard, .remote-sign) :is(input:is([type="search"], [type="text"], [type="password"], [type="number"], [type="url"]), select, textarea) {
    background: var(--color-surface-2);
    color: var(--text);
    font: 500 1.0625rem/1.45 var(--font-sans);
  }
  :is(.fleet-controls, .fleet-dashboard-filters, .handover-panel, .handover-wizard, .remote-sign) :is(input, textarea)::placeholder {
    color: var(--muted);
    opacity: 1;
  }
  :is(.fleet-controls, .fleet-dashboard-filters, .handover-panel, .handover-wizard, .remote-sign) label > .field-label {
    color: var(--text);
    font: 650 .9375rem/1.4 var(--font-sans);
    letter-spacing: normal;
  }
  :where(form, fieldset, .table-filters, .damage-sheet) > label { min-width: 0; align-content: start; }
  label:has(> .field-label) > :is(input, textarea, select) { min-width: 0; }
  label:has(> input:is([type="checkbox"], [type="radio"])) { align-items: center; }
  label > input:is([type="checkbox"], [type="radio"]) { flex: 0 0 auto; }
  :is(input, textarea, select, .form-control) { line-height: 1.35; }
  .damage-sheet-title :is(h3, p), .notice-title, .repair-slot { overflow-wrap: anywhere; }

  :root[data-theme="light"] {
    color-scheme: light;
    --color-bg: #eaf0f3;
    --color-surface: #fff;
    --color-surface-2: #f3f7f9;
    --color-surface-3: #e3edf1;
    --color-line: #c9d6de;
    --color-line-strong: #7c919e;
    --color-text: #142631;
    --color-muted: #435966;
    --color-accent: #8b510b;
    --color-neon: #00636d;
    --color-heat: #a2295c;
    --color-ok: #216644;
    --color-warn: #835018;
    --color-bad: #a42934;
    --st-new: #355a9d;
    --st-progress: #176180;
    --st-waiting: #835018;
    --st-ready: #216644;
    --st-late: #a42934;
    --primary: #00727a;
    --primary-ink: #08262a;
    --light-control: #748b99;
    --light-selected: #d3eef0;
    --light-hover: #e4f0f3;
    --light-shadow: 0 8px 22px #1e405014;
  }

  [data-theme="light"] body {
    background: radial-gradient(ellipse at top right, #f7f5ef, transparent 54%), var(--color-bg);
  }
  [data-theme="light"] body::after { opacity: .018; }
  [data-theme="light"] header { background: var(--panel); box-shadow: var(--light-shadow); }
  [data-theme="light"] header strong { color: var(--text); text-shadow: none; }
  [data-theme="light"] a { color: var(--color-neon); }
  [data-theme="light"] :is(main section, .panel) {
    border-color: var(--line);
    background: var(--panel);
    box-shadow: var(--light-shadow);
  }
  [data-theme="light"] :is(section section, .movement-grid form, .case-board form, .claim-sidebar section, .vehicle-picker,
    .clock-tile, .repair-day, .damage-ledger, .damage-choice, .damage-sheet, .vehicle-brand, .attention-car,
    .alert-item, .monitor-switch, .report-card) {
    background: var(--color-surface-2);
    border-color: var(--line);
    color: var(--text);
  }
  [data-theme="light"] :is(.page-hero.has-photo, .page-hero.has-photo h1) { color: #f4f7fb; }
  [data-theme="light"] .page-hero.has-photo {
    background-color: #14232d;
    background-image: linear-gradient(90deg, #101b25 0%, #101b25eb 34%, #101b2555 70%), var(--hero-photo);
  }
  [data-theme="light"] .page-hero.has-photo::before { opacity: .48; }
  [data-theme="light"] .page-hero.has-photo .hero-sub { color: #e2ebef; }
  [data-theme="light"] :is(.page-hero:not(.has-photo), .claim-heading, .workspace-heading) { color: var(--text); }
  [data-theme="light"] :is(.claim-section-nav, .claim-shortcuts) {
    background: var(--color-surface-2);
    border-color: var(--color-line-strong);
    box-shadow: var(--light-shadow);
  }
  [data-theme="light"] .claim-shortcuts a[aria-current="location"] {
    background: var(--light-selected);
    color: var(--color-neon);
  }

  [data-theme="light"] :is(input, textarea, select, .form-control) {
    background: var(--panel);
    color: var(--text);
    border-color: var(--light-control);
    accent-color: var(--primary);
  }
  [data-theme="light"] :is(input, textarea, .form-control)::placeholder { color: #546a77; }
  [data-theme="light"] :is(.fleet-controls, .fleet-dashboard-filters, .handover-panel, .handover-wizard, .remote-sign) :is(input, textarea)::placeholder {
    color: var(--muted);
  }
  [data-theme="light"] :is(input, select, textarea)[readonly] { background: var(--color-surface-2); }
  [data-theme="light"] :is(input, select, textarea):disabled { background: var(--color-surface-3); }
  [data-theme="light"] :is(input, select, textarea, button, a):focus-visible { outline-color: var(--color-neon); }
  [data-theme="light"] :is(.field-label, .form-label, .level-name, dt, label, .claim-date) { color: var(--muted); }
  [data-theme="light"] .plate-ocr > summary { color: var(--color-neon); }
  [data-theme="light"] :is(.brand-listbox, .drawer, .staff-popover, .chart-tip) {
    background: var(--panel);
    color: var(--text);
    border-color: var(--color-line-strong);
    box-shadow: 0 16px 36px #19384731;
  }
  [data-theme="light"] :is(.brand-option:hover, .brand-option[aria-selected="true"], .segmented button[aria-checked="true"]) {
    background: var(--light-selected);
    color: var(--text);
  }
  [data-theme="light"] :is(button, .btn):where(:not(.case-open, .nc-button, .is-primary, [type="submit"])) {
    background: var(--color-surface-2);
    border-color: var(--light-control);
    color: var(--text);
  }
  [data-theme="light"] :is(button, .btn):where(:hover:not(:disabled, .case-open, .nc-button, .is-primary, [type="submit"])) {
    background: var(--light-hover);
    border-color: var(--color-neon);
  }
  [data-theme="light"] :is(button[aria-pressed="true"], button[aria-checked="true"], button[aria-selected="true"], .pager-btn.is-current) {
    background: var(--light-selected);
    border-color: var(--color-neon);
    color: var(--color-neon);
    box-shadow: inset 0 -2px var(--color-neon);
  }
  /* Swatches and radar dots carry their own colour; the generic light button rules above would paint
     every paint swatch grey. */
  [data-theme="light"] button.paint-swatch, [data-theme="light"] button.paint-swatch:hover, [data-theme="light"] button.paint-swatch[aria-checked="true"] {
    background: radial-gradient(circle at 32% 28%, #ffffff66, transparent 42%), var(--paint);
    border-color: #00000033;
    box-shadow: inset 0 -3px 6px #0004;
  }
  [data-theme="light"] button.paint-swatch[aria-checked="true"] { outline: 2px solid var(--color-neon); outline-offset: 2px; }
  [data-theme="light"] button.radar-blip, [data-theme="light"] button.radar-blip:hover { background: #0b191e; border-color: currentColor; }
  [data-theme="light"] :is(button.is-primary, form > button[type="submit"]) {
    background: linear-gradient(180deg, #b7edef, #73cdd1);
    border-color: #458d95;
    color: #08262a;
    box-shadow: 0 3px 10px #214a531e;
  }
  [data-theme="light"] :is(button.is-primary, form > button[type="submit"]):hover { background: #a7e8eb; }
  [data-theme="light"] :is(.cell-actions .case-details, .case-meta .case-details, .gus-button, .card-link, .print-btn) {
    background: var(--light-hover);
    border-color: #658e96;
    color: var(--color-neon);
  }
  [data-theme="light"] :is(.register .view-chip[aria-pressed="true"], .damage-mode[aria-pressed="true"]) {
    background: var(--light-selected);
    border-color: var(--primary);
    color: #084956;
  }
  [data-theme="light"] .view-chip.is-empty:not([aria-pressed="true"]) {
    background: var(--color-surface-2);
    color: var(--muted);
    border-color: var(--color-line-strong);
  }

  [data-theme="light"] body.has-shell .side-shell {
    background: linear-gradient(165deg, #f3f8fa, #e9f1f4 68%, #e3edf1);
    border-color: var(--line);
  }
  [data-theme="light"] .side-shell :is(.shell-brand, .shell-user-card, .shell-group, .shell-card) {
    background: var(--panel);
    color: var(--text);
    border-color: var(--line);
    box-shadow: none;
  }
  [data-theme="light"] .side-shell :is(.shell-group-toggle, .shell-foot-row button, .shell-item) {
    background: transparent;
    color: var(--text);
  }
  [data-theme="light"] .side-shell .shell-group-toggle { border-color: transparent; }
  [data-theme="light"] .side-shell :is(.shell-group-toggle, .shell-item, .shell-foot-row button):hover { background: var(--light-hover); }
  [data-theme="light"] .side-shell .shell-group .shell-item[aria-current="page"] {
    background: var(--light-selected);
    color: #083a45;
    box-shadow: inset 3px 0 var(--primary);
  }
  [data-theme="light"] .side-shell .shell-group[data-group="claims"] .shell-item:not(.is-cta)[aria-current="page"] {
    background: var(--light-selected);
    box-shadow: inset 3px 0 var(--primary);
  }
  [data-theme="light"] .side-shell .shell-group .shell-item.is-cta { background: #c1eaed; color: #083a45; }
  [data-theme="light"] .side-shell :is(.shell-card-sub, .shell-sub, .shell-motto, .shell-tagline, .shell-user small, .shell-badge) { color: var(--muted); }
  [data-theme="light"] .product-brand img { content: url('/brand/flotopis-horizontal-light.svg'); }
  [data-theme="light"] .shell-logo { content: url('/brand/flotopis-horizontal-light.svg'); }
  [data-theme="light"] .shell-mark { content: url('/brand/flotopis-app-light.svg'); }
  [data-theme="light"] .side-shell .shell-avatar { background: var(--light-selected); color: var(--text); }
  [data-theme="light"] header .staff-tool .notice-count { background: var(--light-selected); border-color: var(--color-neon); color: var(--color-neon); }
  [data-theme="light"] header .staff-tool .notice-count.is-zero { background: transparent; color: var(--muted); border-color: var(--light-control); }
  [data-theme="light"] header .staff-tool .notice-count.is-alert { background: #f9e8ea; border-color: var(--color-bad); color: var(--color-bad); }
  [data-theme="light"] header .staff-tool .notice-count.is-amber { background: #fff2dc; border-color: var(--color-warn); color: var(--color-warn); }
  [data-theme="light"] .notice-item.is-alert { border-color: var(--color-bad); }
  [data-theme="light"] .notice-item.is-alert .ic { color: var(--color-bad); }
  [data-theme="light"] .notice-item:is(.is-amber, .is-gold) .ic { color: var(--color-warn); }
  [data-theme="light"] .notice-item.is-teal .ic { color: var(--color-neon); }
  [data-theme="light"] :is(.crumbs a, .crumbs button, .crumbs span, .crumbs strong, .edge-rail button .ic) { color: var(--color-neon); }

  [data-theme="light"] .data-table th { background: var(--color-surface-3); color: var(--muted); }
  [data-theme="light"] .data-table tr:hover td { background: var(--light-hover); }
  [data-theme="light"] .register-table .case-open { color: var(--color-neon); background: transparent; }
  [data-theme="light"] .next-chip { background: var(--color-surface-3); color: var(--text); }
  [data-theme="light"] .next-chip.is-ours, [data-theme="light"] .pickup { background: #fff3dc; color: #73430f; border-color: #ba803d; }
  [data-theme="light"] .pill {
    color: var(--mark, var(--text));
    background: color-mix(in srgb, var(--mark, var(--muted)) 10%, white);
    border-color: color-mix(in srgb, var(--mark, var(--muted)) 65%, white);
  }
  [data-theme="light"] .blip {
    background: color-mix(in srgb, var(--mark, var(--color-neon)) 9%, white);
    border-color: color-mix(in srgb, var(--mark, var(--color-neon)) 50%, white);
  }
  [data-theme="light"] :is(.shell-badge, .type-tag, .kpi-icon) {
    background: var(--color-surface-3);
    color: var(--muted);
    border-color: var(--color-line-strong);
  }
  [data-theme="light"] .type-tag[data-kind="oc_cesja"] { background: #e0eefb; color: #294f76; border-color: #6c8fae; }
  [data-theme="light"] .type-tag[data-kind="ac"] { background: #eee8f8; color: #513b76; border-color: #8b77ad; }
  [data-theme="light"] .type-tag[data-kind="private"] { background: #eaf2de; color: #405725; border-color: #7c905e; }
  [data-theme="light"] .type-tag[data-kind="import"] { background: #f6e9db; color: #754627; border-color: #ac805d; }
  [data-theme="light"] .type-tag[data-kind="vancar_claim"] { background: #f9e7ee; color: #793752; border-color: #aa748a; }
  [data-theme="light"] .type-tag[data-kind="cargo"] { background: #dff1ed; color: #285c53; border-color: #66978d; }
  [data-theme="light"] .kpi-tile { background: var(--panel); border-color: var(--line); }
  [data-theme="light"] :is(.kpi-tile .kpi-value, .fleet-metrics dd, .overview-widget-list strong) { color: var(--text); text-shadow: none; }
  [data-theme="light"] :is(.register-wrap .kpi-icon, .kpi-row.is-six .kpi-icon) { color: var(--color-neon); background: #d9eff1; border-color: #739da5; }
  [data-theme="light"] :is(.kpi-row .kpi-icon, .fleet-vehicle-name .vehicle-brand, .client-marker .ic, .vehicle-fleet) { color: var(--color-neon); }
  [data-theme="light"] :is(.kpi-row [data-view="overdue"] .kpi-icon, .card-count, .attention-panel .card-title .ic) { color: var(--color-bad); background: #f9e8ea; }
  [data-theme="light"] :is(.kpi-row [data-view="missing_documents"] .kpi-icon, .task-when.is-today) { color: var(--color-warn); background: #fff2dc; }
  [data-theme="light"] :is(.task-when, .shell-item.is-empty, .card-count.is-zero) { color: var(--muted); }
  [data-theme="light"] :is(.task-open, .attention-open) { border-bottom-color: var(--line); }
  [data-theme="light"] .chart-panel > h2 { color: var(--text); }
  [data-theme="light"] .chart-panel > h2::after { color: var(--color-neon); }
  [data-theme="light"] .chart-axis { fill: var(--muted); }
  [data-theme="light"] .chart-grid { stroke: var(--line); }
  [data-theme="light"] .chart-line { stroke: var(--color-neon); }
  [data-theme="light"] .chart-area { fill: #00636d20; }
  [data-theme="light"] .chart-dot { fill: var(--color-neon); stroke: var(--panel); }
  [data-theme="light"] :is(.radar-legend, .radar-note, .radar-readout, .monitor-stamp, .gauge-caption) { color: var(--muted); }
  [data-theme="light"] :is(.monitor-panel[data-level="green"] .monitor-overall, .account-state.is-active) { color: var(--color-ok); }
  [data-theme="light"] .monitor-panel[data-level="amber"] .monitor-overall { color: var(--color-warn); }
  [data-theme="light"] .monitor-panel[data-level="red"] .monitor-overall { color: var(--color-bad); }
  [data-theme="light"] :is(.live-badge, .gauge[data-level="green"] .gauge-state) { color: var(--color-ok); }
  [data-theme="light"] :is(.live-badge.is-stale, .gauge[data-level="amber"] .gauge-state) { color: var(--color-warn); }
  [data-theme="light"] .gauge[data-level="red"] .gauge-state { color: var(--color-bad); }
  [data-theme="light"] :is(#message:not(:empty), #message[data-tone="reminder"]:not(:empty)) {
    background: #e0f1f3;
    border-color: #528c94;
    color: #164751;
    box-shadow: var(--light-shadow);
  }
  [data-theme="light"] #message[data-tone="ok"]:not(:empty) { background: #e2f1e7; border-color: #6a987a; color: #23573a; }
  [data-theme="light"] #message[data-tone="error"]:not(:empty) { background: #fbe8e7; border-color: #b26569; color: #7d2730; }

  [data-theme="light"] .damage-map {
    --viewer-bg: #e1ebf1;
    --viewer-surface: #f8fbfc;
    --viewer-border: #8ba5b3;
    --viewer-cyan: #006775;
    --viewer-active: #98510f;
    --viewer-text: #132732;
    --viewer-muted: #455d6c;
    --viewer-danger: #a42934;
    --viewer-ok: #216644;
  }
  [data-theme="light"] :is(.car3d-stage, .insp-scene .car3d-stage) {
    background: radial-gradient(ellipse at 50% 43%, #fbfdfe 0%, #dbe8ee 85%);
    box-shadow: inset 0 0 0 1px #91a8b4;
  }
  [data-theme="light"] :is(.insp-label, .insp-notice) { background: var(--viewer-surface); box-shadow: 0 3px 8px #253f4d2b; }
  [data-theme="light"] .insp-label.is-active { background: #fdf0dd; border-color: var(--viewer-active); }
  [data-theme="light"] .damage-board .zone-strip button[aria-pressed="true"] {
    background: var(--light-selected);
    border-color: var(--viewer-cyan);
    color: var(--viewer-text);
    box-shadow: inset 0 -2px var(--viewer-cyan);
  }
  [data-theme="light"] :is(.part-glyph, .zone-btn .ic, .insp-views .view-glyph) { color: var(--viewer-cyan); }
  [data-theme="light"] .part-card.is-active .part-glyph { color: var(--viewer-active); }
  [data-theme="light"] :is(.damage-diagram .damage-diagram-mark, .damage-diagram-label, .damage-save, .damage-layer-toggle) {
    background: var(--color-surface-2);
    color: var(--text);
  }
  [data-theme="light"] :is(.part-group > p, .damage-hint, .damage-ledger-note, .car3d-help, .car3d-credit) { color: var(--muted); }
  [data-theme="light"] :is(.car3d-credit a, .damage-ledger-link) { color: var(--color-neon); }
  [data-theme="light"] :is(.car3d-legend span, .zone-badge) { background: var(--color-surface-3); color: var(--text); }
}

@media screen and (max-width: 700px) {
  header:has(.theme-toggle) { padding-inline: 14px; }
  header:has(.theme-toggle) strong { font-size: clamp(19px, 5vw, 27px); white-space: normal; }
  header:has(.theme-toggle) > span { letter-spacing: .06em; }
  header .theme-toggle { min-height: 40px; font-size: 12px; }
  .field-label, .form-label { line-height: 1.4; }
  .vd-admin .vd-grid { grid-template-columns: minmax(0, 1fr); }
}

@media screen and (max-width: 620px) {
  body.has-shell header { gap: 6px; padding-inline: 10px; }
  body.has-shell header :is(.shell-toggle, .theme-toggle) { gap: 5px; padding-inline: 7px; }
  body.has-shell header .shell-toggle { margin-inline-end: 0; }
  body.has-shell header > span { gap: 4px; margin-inline-start: 0; font-size: 10px; }
}

@media screen and (max-width: 360px) {
  body.has-shell header { column-gap: 4px; padding-inline: 8px; }
  body.has-shell header :is(.shell-toggle, .theme-toggle, .staff-tool) { padding-inline: 4px; }
  body.has-shell header .staff-tools { gap: 4px; }
}

@media screen and (pointer: coarse) {
  header :is(.theme-toggle, .staff-tool, .staff-tool:last-child),
  body.has-shell header .shell-toggle {
    min-width: 44px;
    min-height: 44px;
  }
}

@media print {
  .theme-toggle { display: none !important; }
}
