/* Skafies Garage Dashboard — app.css
   Warm-minimalist theme: cream canvas, light beige sidebar, white cards,
   colorful icon status pills. Accent (--accent) comes from settings. */

/* Self-hosted display font for big headers (brand name + all h2). The wide
   font-weight range lets the browser use the real glyphs at any weight instead
   of synthesising faux-bold; font-display:swap shows fallback until it loads. */
@font-face {
    font-family: 'Heading';
    src: url('heading.woff2') format('woff2');
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}
/* Self-hosted font for licence-plate text (digits + letters), used on the
   .plate-badge everywhere. Wide weight range avoids faux-bold synthesis. */
@font-face {
    font-family: 'Plate';
    src: url('plate.woff2') format('woff2');
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}
/* Self-hosted numeric/display font for KPI figures (tabular numerals). */
@font-face {
    font-family: 'Numeric';
    src: url('numeric.woff2') format('woff2');
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}
/* Self-hosted monospace font for eyebrow labels, section headers, nav-group
   captions and form field labels (the Sleutl-style "machined" caption look). */
@font-face {
    font-family: 'Mono';
    src: url('mono.woff') format('woff');
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

:root {
    --accent: #C9A227; /* deeper gold for light mode; dark mode overrides to #ffce1f */
    --cta: #ffd700; /* primary call-to-action button fill (brighter than --accent) */
    --ink: #1d1b16;
    --ink-soft: #57534a;
    --muted: #6f6a5d; /* darkened from #8d8779 → 4.6:1 on white, passes WCAG AA (audit P2-2) */
    --bg: #f6f4ef;
    --card: #ffffff;
    --line: #e8e4da;
    --sidebar-bg: #eeeae1;
    --sidebar-ink: #44403a;
    --danger: #d9342b;
    --ok: #16a34a;
    --radius: 14px;
    --font-display: 'Heading', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --font-body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --font-num: 'Numeric', ui-monospace, "Segoe UI", system-ui, sans-serif;
    --font-label: 'Mono', ui-monospace, "Cascadia Code", "Consolas", monospace;
    --shadow-card: 0 1px 2px rgba(70, 60, 35, .06), 0 4px 14px rgba(70, 60, 35, .045);
    --shadow-hover: 0 6px 22px rgba(70, 60, 35, .12);
    --shadow-modal: 0 24px 60px rgba(45, 38, 22, .28);

    /* interactive surfaces & fills — semantic tokens that flip per theme so the
       dark palette is a pure variable swap (see [data-theme="dark"] at the end) */
    --surface-2: #faf8f3;            /* subtle hover / zebra-row fill */
    --input-bg: #ffffff;             /* form input background */
    --btn-bg: #ffffff;               /* default button surface */
    --hover-line: #ddd6c6;           /* border colour on hover */
    --nav-active: #e0dbcf;           /* active nav pill + avatar */
    --nav-hover: rgba(0, 0, 0, .05); /* nav-link / sidebar-toggle hover */
    --toggle-track: rgba(0, 0, 0, .06); /* language + theme switch track */
    --thumb-bg: #ffffff;             /* segmented-toggle thumb */
    --thumb-ink: #1d1b16;            /* text on the thumb (stays dark both themes) */
    --today-bg: #fbf6e6;             /* calendar "today" tint */

    /* status pill palette (pastel bg + saturated text) */
    --pill-orange-bg: #fdeee0; --pill-orange: #e07410;
    --pill-blue-bg:   #e3f1fd; --pill-blue:   #0d8de8;
    --pill-purple-bg: #efe9fd; --pill-purple: #7c3aed;
    --pill-amber-bg:  #fbf3d8; --pill-amber:  #c08c0a;
    --pill-green-bg:  #e2f7e9; --pill-green:  #16a34a;
    --pill-red-bg:    #fde9e7; --pill-red:    #e0372e;
    --pill-gray-bg:   #eeece7; --pill-gray:   #797366;

    /* pill icons (masked with currentColor) */
    --i-send: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M22 2 11 13'/%3E%3Cpath d='M22 2 15 22 11 13 2 9z'/%3E%3C/svg%3E");
    --i-clock: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9.5'/%3E%3Cpath d='M12 7v5l3.2 2'/%3E%3C/svg%3E");
    --i-spin: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='9' stroke-dasharray='4.2 4.2'/%3E%3C/svg%3E");
    --i-check: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9.5'/%3E%3Cpath d='M8 12.5l2.6 2.6L16.2 9.6'/%3E%3C/svg%3E");
    --i-x: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.6' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='9.5'/%3E%3Cpath d='M9 9l6 6M15 9l-6 6'/%3E%3C/svg%3E");
    --i-warn: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3.5 22 20.5H2z'/%3E%3Cpath d='M12 10v4.2'/%3E%3Cpath d='M12 17.4v.2'/%3E%3C/svg%3E");
    --i-pencil: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M16.7 3.8a2.4 2.4 0 0 1 3.5 3.4L7.5 19.9 3 21l1.1-4.4z'/%3E%3C/svg%3E");
    --i-lock: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4.5' y='10.5' width='15' height='10' rx='2.5'/%3E%3Cpath d='M8 10.5V7a4 4 0 0 1 8 0v3.5'/%3E%3C/svg%3E");
    --i-trash: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 7h16M9 7V4.5h6V7M6 7l1 13h10l1-13'/%3E%3Cpath d='M10 11v6M14 11v6'/%3E%3C/svg%3E");
    --i-sun: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.3' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='4.1'/%3E%3Cpath d='M12 2.2v2.3M12 19.5v2.3M4.3 4.3l1.7 1.7M18 18l1.7 1.7M2.2 12h2.3M19.5 12h2.3M4.3 19.7l1.7-1.7M18 6l1.7-1.7'/%3E%3C/svg%3E");
    --i-moon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M21 12.9A9 9 0 1 1 11.1 3a7 7 0 0 0 9.9 9.9z'/%3E%3C/svg%3E");

    /* sidebar nav icons (masked with currentColor, stroke-width 2) */
    --n-panel: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='16' rx='2.5'/%3E%3Cpath d='M9.5 4v16'/%3E%3C/svg%3E");
    --n-dashboard: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linejoin='round'%3E%3Cpath d='M3 3h7v7H3zM14 3h7v7h-7zM3 14h7v7H3zM14 14h7v7h-7z'/%3E%3C/svg%3E");
    --n-wo: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4' y='4.5' width='16' height='17' rx='2'/%3E%3Crect x='8' y='2' width='8' height='4.5' rx='1'/%3E%3Cpath d='M8 12h8M8 16h6'/%3E%3C/svg%3E");
    --n-planning: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='5' width='18' height='16' rx='2'/%3E%3Cpath d='M3 10h18M8 3v4M16 3v4'/%3E%3C/svg%3E");
    --n-invoices: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 3h14v18l-2.3-1.6-2.35 1.6L12 19.4 9.65 21 7.3 19.4 5 21z'/%3E%3Cpath d='M9 8.5h6M9 12.5h6'/%3E%3C/svg%3E");
    --n-tools: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z'/%3E%3C/svg%3E");
    --n-customers: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2'/%3E%3Ccircle cx='9' cy='7' r='4'/%3E%3Cpath d='M23 21v-2a4 4 0 0 0-3-3.87M16 3.13a4 4 0 0 1 0 7.75'/%3E%3C/svg%3E");
    --n-vehicles: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4.5 12.5l1.8-4.9A2 2 0 0 1 8.2 6.3h7.6a2 2 0 0 1 1.9 1.3l1.8 4.9'/%3E%3Crect x='3' y='12.5' width='18' height='5' rx='1.5'/%3E%3Cpath d='M6.5 20.5v-3M17.5 20.5v-3'/%3E%3C/svg%3E");
    --n-apk: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 2.5l8 3v6.2c0 4.6-3.4 7.6-8 9.3-4.6-1.7-8-4.7-8-9.3V5.5z'/%3E%3Cpath d='M8.7 12l2.3 2.3 4.3-4.3'/%3E%3C/svg%3E");
    --n-quotes: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 2.5h8l6 6v13H6z'/%3E%3Cpath d='M14 2.5v6h6'/%3E%3Cpath d='M9.5 13.5h5M9.5 17h5'/%3E%3C/svg%3E");
    --n-credit_notes: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 2.5h8l6 6v13H6z'/%3E%3Cpath d='M14 2.5v6h6'/%3E%3Cpath d='M9.5 15.5h5'/%3E%3C/svg%3E");
    --n-catalog: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 7.5l-9-5-9 5v9l9 5 9-5z'/%3E%3Cpath d='M3 7.5l9 5 9-5M12 12.5v9'/%3E%3C/svg%3E");
    --n-staff: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='7.5' r='4'/%3E%3Cpath d='M4.5 21a7.5 7.5 0 0 1 15 0'/%3E%3C/svg%3E");
    --n-showroom: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 10.5l1.6-4.4A2 2 0 0 1 6.5 4.8h11a2 2 0 0 1 1.9 1.3L21 10.5'/%3E%3Cpath d='M3 10.5h18v6.5a1 1 0 0 1-1 1h-1.5a1 1 0 0 1-1-1v-1H6.5v1a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1z'/%3E%3Cpath d='M6.5 14h.01M17.5 14h.01'/%3E%3C/svg%3E");
    --n-schedule: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9.5'/%3E%3Cpath d='M12 7v5l3.2 2'/%3E%3C/svg%3E");
    --n-settings: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M4 21v-7M4 10V3M12 21v-9M12 8V3M20 21v-5M20 12V3'/%3E%3Cpath d='M1.5 14h5M9.5 8h5M17.5 16h5'/%3E%3C/svg%3E");
    --n-help: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9.5'/%3E%3Cpath d='M9.2 9.2a2.8 2.8 0 0 1 5.4 1c0 1.9-2.6 2.4-2.6 4'/%3E%3Cpath d='M12 17.3v.2'/%3E%3C/svg%3E");
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--ink);
}
a { color: inherit; }
/* the hidden attribute must always win, even over author display rules
   like `label { display: block }` (otherwise toggled <label>s won't hide) */
[hidden] { display: none !important; }
/* big headers use the self-hosted display font */
h2 {
    font-family: var(--font-display);
    font-size: 24px; font-weight: 800; font-stretch: 112%;
    text-transform: uppercase; letter-spacing: -.015em;
    margin: 0; line-height: 1.05;
}
/* section headers (h3) + nav-group captions use the machined monospace label font */
h3 { font-family: var(--font-label); }

/* ---------- shell: beige canvas, white rounded content sheet ---------- */
.shell { display: flex; min-height: 100vh; background: var(--sidebar-bg); }
.main {
    flex: 1; display: flex; flex-direction: column; min-width: 0;
    margin-top: 10px; background: var(--card);
    border: 1px solid var(--line); border-right: none; border-bottom: none;
    border-top-left-radius: 18px;
}
.content { padding: 1.5rem 2rem; max-width: 1200px; width: 100%; }

/* ---------- sidebar (light, warm) ---------- */
.sidebar {
    width: 240px; flex-shrink: 0;
    background: var(--sidebar-bg); color: var(--sidebar-ink);
    display: flex; flex-direction: column;
    position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
body.sb-closed .sidebar { display: none; }
.brand {
    display: flex; align-items: center; gap: .65rem;
    padding: 1rem 1rem .8rem;
}
.sb-toggle {
    margin-left: auto; width: 30px; height: 30px; flex-shrink: 0;
    border: none; border-radius: 8px; background: none; cursor: pointer;
    color: var(--muted); padding: 0;
}
.sb-toggle::before {
    content: ""; display: block; width: 18px; height: 18px; margin: auto;
    background: currentColor;
    -webkit-mask: var(--n-panel) center / contain no-repeat;
    mask: var(--n-panel) center / contain no-repeat;
}
.sb-toggle:hover { background: var(--nav-hover); color: var(--ink); }
.sb-open { display: none; margin-left: 0; margin-right: .25rem; }
body.sb-closed .sb-open { display: block; }
.brand-badge {
    width: 34px; height: 34px; border-radius: 10px; flex-shrink: 0;
    background: var(--accent); color: #1d1b16;
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 1.05rem;
}
.brand-badge-lg { width: 52px; height: 52px; font-size: 1.5rem; border-radius: 14px; }
.brand-logo { max-width: 34px; max-height: 34px; border-radius: 8px; }
.brand-name { font-family: var(--font-display); font-weight: 800; color: var(--ink); letter-spacing: .01em; text-transform: uppercase; }

.nav { flex: 1; padding: .3rem .55rem; }
.nav-group {
    padding: .8rem .6rem .3rem;
    font-family: var(--font-label);
    font-size: .67rem; font-weight: 700; letter-spacing: .09em;
    text-transform: uppercase; color: var(--muted);
}
.nav-link {
    display: flex; align-items: center; gap: .6rem;
    padding: .34rem .6rem; margin-bottom: 1px;
    color: #5f594d; text-decoration: none;
    border-radius: 9px; font-weight: 500;
    transition: background .14s ease, color .14s ease;
}
.nav-link::before {
    content: ""; width: 17px; height: 17px; flex-shrink: 0;
    background: currentColor; opacity: .75;
    -webkit-mask: var(--nico, none) center / contain no-repeat;
    mask: var(--nico, none) center / contain no-repeat;
}
.nav-link:hover { background: var(--nav-hover); color: var(--ink); }
.nav-link.active {
    background: var(--nav-active); color: var(--ink); font-weight: 650;
}
/* active link: icon always brand gold; text turns white in dark mode */
.nav-link.active::before { opacity: 1; background: var(--accent); }
[data-theme="dark"] .nav-link.active { color: #fff; }

/* ---------------------------------------------------------------------------
   The sidebar ALWAYS uses the dark palette, in both light and dark mode —
   only the content/body switches. Done by scoping the dark colour tokens to
   the sidebar so every child resolves to dark values regardless of the page
   theme. (The .shell frame + .main content still follow [data-theme].)
   --------------------------------------------------------------------------- */
.sidebar {
    --ink: #e9eef4;
    --ink-soft: #b8c1cd;
    --muted: #8b94a2;
    --line: #28303b;
    --sidebar-bg: #0c0f14;
    --sidebar-ink: #b8c1cd;
    --accent: #ffce1f;               /* dark theme's brighter gold */
    --nav-active: #232c38;
    --nav-hover: rgba(255, 255, 255, .05);
    --toggle-track: rgba(255, 255, 255, .08);
    --thumb-bg: #dde3ea;
}
.sidebar .nav-link { color: #99a2b0; }
.sidebar .nav-link.active { color: #fff; }
.sidebar .brand-badge {              /* dark crest, same as dark mode */
    background: url('brand-dark.png') center / contain no-repeat;
    color: transparent;
}
.sidebar .sidebar-foot { border-top-color: var(--line); }
.nl-dashboard    { --nico: var(--n-dashboard); }
.nl-work_orders  { --nico: var(--n-wo); }
.nl-planning     { --nico: var(--n-planning); }
.nl-invoices     { --nico: var(--n-invoices); }
.nl-tools        { --nico: var(--n-tools); }
.nl-customers    { --nico: var(--n-customers); }
.nl-vehicles     { --nico: var(--n-vehicles); }
.nl-apk          { --nico: var(--n-apk); }
.nl-quotes       { --nico: var(--n-quotes); }
.nl-credit_notes { --nico: var(--n-credit_notes); }
.nl-catalog      { --nico: var(--n-catalog); }
.nl-staff        { --nico: var(--n-staff); }
.nl-schedule     { --nico: var(--n-schedule); }
.nl-settings     { --nico: var(--n-settings); }
.nl-help         { --nico: var(--n-help); }
.nl-showroom     { --nico: var(--n-showroom); }

.sidebar-foot { padding: .9rem 1rem; border-top: 1px solid rgba(0,0,0,.06); }
.user-card { display: flex; align-items: center; gap: .6rem; margin-bottom: .6rem; }
.avatar {
    width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
    background: var(--nav-active); color: var(--ink);
    display: inline-flex; align-items: center; justify-content: center; font-weight: 700;
}
.user-meta { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.user-meta strong { color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-meta small { color: var(--muted); }
.btn-logout { width: 100%; text-align: left; }

/* ---------- topbar ---------- */
.topbar {
    display: flex; align-items: center; gap: 1rem;
    background: var(--card); border-bottom: 1px solid var(--line);
    padding: .8rem 2rem; position: sticky; top: 0; z-index: 10;
    border-top-left-radius: 18px;
}
.page-title { font-size: 1.05rem; margin: 0; flex-shrink: 0; }
.global-search { flex: 1; max-width: 420px; }
.global-search input {
    width: 100%; padding: .5rem .8rem;
    border: 1px solid var(--line); border-radius: 10px; background: var(--bg);
}
.topbar .btn-primary { margin-left: auto; white-space: nowrap; }

/* ---------- cards / grid ---------- */
.card {
    background: var(--card); border: 1px solid var(--line);
    border-radius: var(--radius); padding: 1.25rem 1.5rem; margin-bottom: 1.25rem;
    box-shadow: var(--shadow-card);
}
.card h3 { margin: 0 0 .9rem; font-size: 1rem; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: .75rem; }
/* Section-header "eyebrow" label (UI upgrade #2): small-caps, letter-spaced,
   muted, with a leading accent motif. Applies to every panel/card header. */
.section-label,
.card-head h3,
.card > h3 {
    display: inline-flex; align-items: center; gap: .5rem;
    font-size: .72rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: .08em; color: var(--muted);
}
.section-label::before,
.card-head h3::before,
.card > h3::before {
    content: ''; flex: none; width: 14px; height: 2px;
    border-radius: 2px; background: var(--accent);
}
.card-head h3 { margin: 0; }
.card > h3 { margin: 0 0 .75rem; }
.card-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 1rem; margin-bottom: 1.25rem;
}
/* ---------- KPI cards (Sleutl-inspired) — used app-wide ----------
   colored status dot + uppercase monospace eyebrow label on top, a big
   tabular-numeral figure below, optional muted sub-line. Consistent across
   the dashboard, the APK worklist and the calculator outputs. */
.kpi {
    --kpi-accent: var(--accent);
    display: flex; flex-direction: column; gap: .15rem; margin-bottom: 0;
}
.kpi-num {
    font-family: var(--font-num);
    font-size: 27px; font-weight: 800; font-stretch: 110%;
    letter-spacing: -.02em; margin-top: 7px; line-height: 1.1;
    font-feature-settings: "tnum"; font-variant-numeric: tabular-nums;
}
/* eyebrow (label-on-top) and legacy label (label-below) share one look */
.kpi-eyebrow, .kpi-label {
    display: inline-flex; align-items: center; gap: .5rem;
    font-family: var(--font-label);
    font-size: .72rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: .04em; color: var(--muted);
}
.kpi-dot {
    flex: none; width: 9px; height: 9px; border-radius: 50%;
    background: var(--kpi-accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--kpi-accent) 22%, transparent);
}
/* per-metric accent (reuses the status-pill palette) */
.kpi--amber  { --kpi-accent: var(--pill-amber); }
.kpi--orange { --kpi-accent: var(--pill-orange); }
.kpi--green  { --kpi-accent: var(--pill-green); }
.kpi--gold   { --kpi-accent: var(--accent); }
/* clickable KPI cards drill into their list (audit P1-2) */
.kpi-link {
    padding: 1.3rem 1.5rem;
    text-decoration: none; color: inherit;
    transition: box-shadow .16s ease, transform .12s ease, border-color .16s ease;
}
.kpi-link .muted { font-size: .82rem; }
.kpi-link:hover { box-shadow: var(--shadow-hover); transform: translateY(-2px); border-color: var(--hover-line); }
.kpi-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.page-head { margin-bottom: 1.25rem; }
.page-head h2 { margin: 0 0 .15rem; }

/* ---------- forms ---------- */
label { display: block; font-family: var(--font-label); font-weight: 600; margin-bottom: .9rem; color: var(--ink-soft); }
label input, label select, label textarea {
    display: block; width: 100%; margin-top: .3rem;
    padding: .55rem .7rem; font: inherit; font-family: var(--font-body); font-weight: 400; color: var(--ink);
    border: 1px solid var(--line); border-radius: 10px; background: var(--input-bg);
}
input:focus, select:focus, textarea:focus, button:focus-visible {
    outline: 2px solid var(--accent); outline-offset: 1px;
}
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1.5rem; }
.form-grid .field-full { grid-column: 1 / -1; margin-bottom: .9rem; }
.label-text { display: block; font-family: var(--font-label); font-weight: 600; color: var(--ink-soft); margin-bottom: .4rem; }
@media (max-width: 720px) { .form-grid { grid-template-columns: 1fr; } }

.swatch-row { display: flex; align-items: center; gap: .55rem; flex-wrap: wrap; }
.swatch {
    width: 30px; height: 30px; border-radius: 50%; margin: 0;
    border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line);
    cursor: pointer; position: relative; display: inline-block;
}
.swatch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.swatch:has(input:checked) { box-shadow: 0 0 0 2px var(--ink); }
.swatch-row input[type="color"] {
    width: 38px; height: 32px; padding: 2px; border: 1px solid var(--line);
    border-radius: 10px; background: #fff; cursor: pointer;
}

/* ---------- buttons ---------- */
.btn {
    display: inline-block; padding: .5rem 1rem; font: inherit; font-weight: 600;
    border: 1px solid var(--line); border-radius: 10px;
    background: var(--btn-bg); color: var(--ink); cursor: pointer; text-decoration: none;
    transition: background .15s ease, border-color .15s ease, box-shadow .15s ease, transform .06s ease, filter .15s ease;
}
.btn:hover { border-color: var(--hover-line); background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn-primary {
    background: var(--cta); border-color: var(--cta); color: #1d1b16;
    box-shadow: 0 6px 16px #ffd70047;
}
.btn-primary:hover { filter: brightness(1.04); background: var(--cta); box-shadow: 0 8px 24px #ffd70080; }
.btn-danger { color: var(--danger); border-color: #eed3cd; }
.btn-danger:hover { background: #fdf3f1; border-color: var(--danger); }
.btn-sm { padding: .25rem .6rem; font-size: .82rem; }
.btn-block { width: 100%; }
/* WhatsApp click-to-chat button (appointment confirmation) */
.btn-wa { color: #128c7e; border-color: #b7e4c7; }
.btn-wa:hover { background: #eafaf1; border-color: #128c7e; }
/* Sub-heading inside a settings card form (e.g. the Twilio block) */
.settings-subhead { margin: 1.4rem 0 .2rem; font-size: .95rem; border-top: 1px solid var(--line); padding-top: 1.1rem; }
.btn-ghost {
    background: none; border: none; color: var(--muted); cursor: pointer;
    font: inherit; padding: .3rem 0;
}
.btn-ghost:hover { color: var(--ink); }

/* ---------- tables ---------- */
.table { width: 100%; border-collapse: collapse; }
.table th {
    text-align: left; font-size: .74rem; text-transform: uppercase; letter-spacing: .06em;
    color: var(--muted); padding: .5rem .6rem; border-bottom: 1px solid var(--line);
}
.table td { padding: .6rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.th-actions, .td-actions { text-align: right; white-space: nowrap; }
.inline-form { display: inline; }

/* ---------- status pills (icon + pastel bg + saturated text) ---------- */
.badge {
    display: inline-flex; align-items: center; gap: .34em;
    padding: .2rem .65rem; border-radius: 999px;
    font-size: .76rem; font-weight: 700; line-height: 1.45;
    vertical-align: middle; white-space: nowrap;
}
.badge::before {
    content: ""; width: .95em; height: .95em; flex-shrink: 0;
    background: currentColor;
    -webkit-mask: var(--icon, none) center / contain no-repeat;
    mask: var(--icon, none) center / contain no-repeat;
    display: var(--icon-d, none);
}
.badge-accent { background: var(--accent); color: #1d1b16; margin-left: .4rem; }
.badge-ok    { background: var(--pill-green-bg); color: var(--pill-green); --icon: var(--i-check); --icon-d: inline-block; }
.badge-muted { background: var(--pill-gray-bg);  color: var(--pill-gray); }
.badge-warn  { background: var(--pill-orange-bg); color: var(--pill-orange); --icon: var(--i-warn); --icon-d: inline-block; }
.page-sub { margin: -0.75rem 0 1.25rem; }
.card-head small { display: block; margin-top: .1rem; }

.flash {
    padding: .65rem 1rem; border-radius: 10px; margin-bottom: 1rem;
    border: 1px solid transparent;
}
.flash-ok { background: var(--pill-green-bg); color: #127c3c; border-color: #c4ebd1; }
.flash-error { background: var(--pill-red-bg); color: var(--danger); border-color: #f6cbc5; }
.flash-warn { background: var(--pill-amber-bg); color: var(--pill-amber); border-color: #ecd9a3; }
/* muted unit suffix after a catalog price, e.g. "€ 50,00 /st" */
.unit-suffix { color: var(--muted); font-size: .82em; font-weight: 400; }

.empty-state { text-align: center; padding: 2.75rem 1rem; }
.empty-state h3 { margin-bottom: .4rem; }
.empty-state p { margin: 0 auto .9rem; max-width: 36ch; }
.empty-ico {
    width: 48px; height: 48px; margin: 0 auto 1rem; border-radius: 14px;
    background: var(--bg); display: grid; place-items: center; color: var(--muted);
}
.empty-ico::before {
    content: ""; width: 23px; height: 23px; background: currentColor;
    -webkit-mask: var(--eico, var(--n-wo)) center / contain no-repeat;
    mask: var(--eico, var(--n-wo)) center / contain no-repeat;
}
.muted { color: var(--muted); }

/* page header: title + count on the left, primary action on the right (audit P1-6) */
.page-head-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.page-head-row > div { min-width: 0; }
.page-head-row h2 { margin: 0 0 .15rem; }
.page-head-row .page-sub { margin: 0; }

/* compact icon action buttons for table rows (audit P2-1) */
.btn-icon { width: 32px; height: 32px; padding: 0; display: inline-grid; place-items: center; vertical-align: middle; }
.btn-icon .ico { width: 16px; height: 16px; background: currentColor;
    -webkit-mask: var(--m, none) center / contain no-repeat; mask: var(--m, none) center / contain no-repeat; }
.ico-edit  { --m: var(--i-pencil); }
.ico-trash { --m: var(--i-trash); }
.td-actions .btn-icon + .btn-icon, .td-actions .inline-form { margin-left: .25rem; }

/* ---------- modal (premium sheet) ---------- */
.modal-overlay {
    position: fixed; inset: 0; z-index: 100;
    background: rgba(35, 30, 20, .45);
    display: flex; align-items: flex-start; justify-content: center;
    padding: 6vh 1rem 1rem;
    animation: modalFade .15s ease;
}
.modal-card {
    background: var(--card); border-radius: 22px;
    padding: 1.6rem 1.75rem 1.5rem; width: 100%; max-width: 460px;
    box-shadow: var(--shadow-modal);
    max-height: 86vh; overflow-y: auto;
    animation: modalPop .22s cubic-bezier(.16, 1, .3, 1);
}
@keyframes modalFade { from { opacity: 0; } }
@keyframes modalPop { from { opacity: 0; transform: translateY(8px) scale(.985); } }
@media (prefers-reduced-motion: reduce) {
    .modal-overlay, .modal-card { animation: none; }
}
.modal-card h3 { margin: 0 0 1.1rem; }

/* header: icon badge + uppercase title + close */
.modal-head { display: flex; align-items: center; gap: .85rem; margin-bottom: 1.2rem; }
.modal-head h3 {
    margin: 0; flex: 1; font-size: 1.15rem; font-weight: 800;
    text-transform: uppercase; letter-spacing: .045em;
}
.modal-ico {
    width: 40px; height: 40px; flex-shrink: 0; border-radius: 13px;
    background: var(--ink); position: relative;
}
.modal-ico::before {
    content: ""; position: absolute; inset: 10px;
    background: var(--accent);
    -webkit-mask: var(--mico, var(--n-wo)) center / contain no-repeat;
    mask: var(--mico, var(--n-wo)) center / contain no-repeat;
}
.modal-x {
    width: 34px; height: 34px; flex-shrink: 0; border: none; border-radius: 10px;
    background: none; color: var(--muted); cursor: pointer;
    font-size: 1.5rem; line-height: 1; padding: 0;
}
.modal-x:hover { background: var(--bg); color: var(--ink); }

/* loading + busy states (audit P0-3) */
@keyframes spin { to { transform: rotate(360deg); } }
.spinner {
    display: inline-block; width: 1em; height: 1em; vertical-align: -.15em;
    border: 2px solid currentColor; border-right-color: transparent;
    border-radius: 50%; animation: spin .6s linear infinite;
}
.btn .spinner { margin-right: .45em; }
.is-busy { cursor: progress; opacity: .9; }
.modal-loading { display: flex; align-items: center; justify-content: center; min-height: 150px; font-size: 1.7rem; color: var(--muted); }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 1.4s; } }

/* uppercase micro-labels + soft filled inputs, all modals */
.modal-card label, .modal-card .label-text {
    font-size: .72rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: .08em; color: var(--ink-soft);
}
.modal-card label input, .modal-card label select, .modal-card label textarea {
    font-size: .95rem; font-weight: 400; text-transform: none; letter-spacing: normal;
    background: #faf8f2; border-color: #f0ece1; border-radius: 12px;
    padding: .68rem .85rem; margin-top: .4rem;
}
.modal-card label input:focus, .modal-card label select:focus, .modal-card label textarea:focus {
    background: #fff;
}
.modal-card .check-label { display: flex; align-items: center; gap: .55rem; }
.modal-card .flash { border-radius: 12px; }

/* label row with a quick-add trigger on the right */
.field-head {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 0;
}
.field-head .label-text { margin: 0; }
.field-head .btn-ghost-link { margin: 0; font-size: .85rem; font-weight: 700; color: var(--ink); }
.field-head .btn-ghost-link:hover { color: var(--accent); }
.field-bare { margin-top: 0; }
/* quick-add trigger: the leading "+" rotates 45° into an "×" when its panel is
   open, signalling the button now closes the inline form (toggled in app.js). */
.qa-plus {
    display: inline-block; font-weight: 700; line-height: 1;
    transition: transform .22s cubic-bezier(.16, 1, .3, 1), color .15s ease;
}
.qa-toggle.is-open .qa-plus { transform: rotate(45deg); }

/* nested quick-add card */
.modal-card .quick-add {
    background: #fff; border: 1px solid var(--line); border-radius: 14px;
    box-shadow: 0 8px 24px rgba(60, 50, 30, .08);
    padding: .9rem 1rem .1rem; margin: .2rem 0 1rem;
}
.qa-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 .8rem; }
@media (max-width: 560px) { .qa-grid { grid-template-columns: 1fr; } }

/* footer: divider, text cancel, pill primary */
.modal-actions {
    display: flex; justify-content: flex-end; align-items: center; gap: .9rem;
    margin: 1.4rem -1.75rem 0; padding: 1.1rem 1.75rem 0;
    border-top: 1px solid var(--line);
}
.modal-actions .btn { border: none; background: none; font-weight: 700; }
.modal-actions .btn:hover { color: var(--ink-soft); background: none; }
.modal-actions .btn-primary {
    background: var(--cta); color: #1d1b16;
    border-radius: 999px; padding: .55rem 1.5rem;
}
.modal-actions .btn-primary:hover { color: #1d1b16; background: var(--cta); filter: brightness(1.04); }
.modal-actions .btn-danger { color: var(--danger); margin-right: auto; }
.modal-actions .btn-danger:hover { color: var(--danger); background: #fdf3f1; border-radius: 999px; }

/* ---------- vehicles / customers ---------- */
.plate-badge {
    display: inline-flex; align-items: center; position: relative; overflow: hidden;
    padding: .15rem .6rem .15rem 1.55em;
    background: #f6c700; color: #1d1b16;
    border: 1px solid #d4ab00; border-radius: 6px;
    font-weight: 800; font-family: 'Plate', ui-monospace, Consolas, monospace;
    letter-spacing: .05em; white-space: nowrap;
}
/* the blue NL country strip of a Dutch plate (audit P2-4) */
.plate-badge::before {
    content: "NL"; position: absolute; left: 0; top: 0; bottom: 0; width: 1.15em;
    background: #003399; color: #fff; letter-spacing: 0;
    font: 700 .52em/1 system-ui, sans-serif;
    display: flex; align-items: center; justify-content: center;
}
.apk-expired { color: var(--danger); font-weight: 700; }

/* ---------- vehicle detail page (§9.2) ---------- */
.plate-link { text-decoration: none; display: inline-block; }
.wo-head h2 .plate-badge { vertical-align: middle; margin-right: .5rem; font-size: 1.4rem; }
.spec-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.1rem 1rem; margin: .25rem 0 1.25rem; }
.spec { display: flex; flex-direction: column; gap: .15rem; min-width: 0; }
.spec-k { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.spec-v { font-weight: 600; }
.rdw-refresh-form { margin: 0; }
.vd-history { list-style: none; margin: 0; padding: 0; }
.vd-history li { border-bottom: 1px solid var(--line); }
.vd-history li:last-child { border-bottom: none; }
.vd-history a { display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    padding: .7rem .2rem; text-decoration: none; transition: background .13s ease; }
.vd-history a:hover { background: var(--surface-2); }
.vd-history-main { display: flex; flex-direction: column; gap: .1rem; min-width: 0; }
.vd-history-main strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 560px) { .spec-grid { grid-template-columns: 1fr 1fr; } }
.modal-card-wide { max-width: 560px; }
.form-grid-modal { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
@media (max-width: 560px) { .form-grid-modal { grid-template-columns: 1fr; } }
.plate-row { display: flex; align-items: flex-end; gap: .6rem; }
.plate-row .plate-field { flex: 1; margin-bottom: .9rem; }
.plate-row .btn { margin-bottom: .9rem; white-space: nowrap; }
.rdw-note { margin: -.4rem 0 .8rem; font-size: .85rem; }
/* RDW trigger sitting inside the plate field (WO quick-add vehicle) */
.plate-rdw { position: relative; display: block; margin-top: .4rem; }
.plate-rdw input { margin-top: 0 !important; width: 100%; padding-right: 3.6rem !important; }
.plate-rdw-btn {
    position: absolute; top: 0; right: 0; height: 100%;
    border: none; background: transparent; cursor: pointer;
    padding: 0 .85rem; font: inherit; font-weight: 700; font-size: .78rem;
    letter-spacing: .03em; color: var(--accent); border-radius: 0 12px 12px 0;
}
.plate-rdw-btn:hover { background: var(--surface-2); }
.plate-rdw-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.check-label { display: flex; align-items: center; gap: .5rem; font-weight: 400; color: var(--ink); }
.check-label input { width: auto; margin: 0; }

/* ---------- work order status pills ---------- */
.badge-st-requested   { background: var(--pill-purple-bg); color: var(--pill-purple); --icon: var(--i-send);  --icon-d: inline-block; }
.badge-st-planned     { background: var(--pill-blue-bg);   color: var(--pill-blue);   --icon: var(--i-clock); --icon-d: inline-block; }
.badge-st-in_progress { background: var(--pill-orange-bg); color: var(--pill-orange); --icon: var(--i-spin);  --icon-d: inline-block; }
.badge-st-ready       { background: var(--pill-green-bg);  color: var(--pill-green);  --icon: var(--i-check); --icon-d: inline-block; }
.badge-st-invoiced    { background: var(--pill-gray-bg);   color: var(--pill-gray);   --icon: var(--i-lock);  --icon-d: inline-block; }

tr.row-link { cursor: pointer; }
tr.row-link td { transition: background .13s ease; }
tr.row-link:hover td { background: var(--surface-2); }
tr.row-link:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
tr.row-link:focus-visible td { background: var(--surface-2); }
.wo-number { font-weight: 700; white-space: nowrap; }
.plate-badge-sm { font-size: .78rem; padding: .05rem .45rem .05rem 1.55em; margin-right: .4rem; }
.search-banner a { margin-left: .6rem; font-weight: 600; }

.wo-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.wo-head h2 { margin: 0 0 .2rem; }
.wo-head .badge { vertical-align: middle; margin-left: .5rem; }
.wo-head p { margin: 0; }
.wo-actions { display: flex; gap: .6rem; flex-shrink: 0; }

/* WO status stepper (UI upgrade #1): horizontal numbered lifecycle tracker. */
.wo-stepper { display: flex; list-style: none; margin: 0 0 1.5rem; padding: 0; }
.wo-step {
    flex: 1; min-width: 64px; position: relative;
    display: flex; flex-direction: column; align-items: center; gap: .45rem; text-align: center;
}
.wo-step::before { /* connector line from the previous step's centre */
    content: ''; position: absolute; top: 15px; left: -50%; width: 100%; height: 2px;
    background: var(--line); z-index: 0;
}
.wo-step:first-child::before { display: none; }
.wo-step-dot {
    position: relative; z-index: 1; width: 32px; height: 32px; border-radius: 50%;
    display: grid; place-items: center; font-size: .85rem; font-weight: 700;
    background: var(--card); border: 2px solid var(--line); color: var(--muted);
}
.wo-step-label { font-size: .72rem; font-weight: 600; color: var(--muted); }
.wo-step.is-done .wo-step-dot { background: var(--pill-green-bg); border-color: var(--pill-green); color: var(--pill-green); }
.wo-step.is-done::before,
.wo-step.is-current::before { background: var(--pill-green); } /* path travelled = green */
.wo-step.is-current .wo-step-dot {
    background: var(--accent); border-color: var(--accent); color: #1d1b16;
    box-shadow: 0 0 0 4px rgba(201, 162, 39, .18);
}
.wo-step.is-current .wo-step-label { color: var(--ink); font-weight: 700; }
@media (max-width: 600px) {
    .wo-stepper { overflow-x: auto; gap: .25rem; padding-bottom: .4rem; }
    .wo-step { min-width: 72px; }
}

/* "Volgende stap" action card (UI upgrade #3): stacked full-width buttons. */
.next-step-card .inline-form { display: block; }
.next-step-card .inline-form .btn,
.next-step-card > .btn { margin-top: .5rem; }

.wo-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 1.25rem; align-items: start; }
@media (max-width: 980px) { .wo-grid { grid-template-columns: 1fr; } }

.totals-card { padding: 1rem 1.5rem; }
.totals-table { width: 100%; max-width: 320px; margin-left: auto; border-collapse: collapse; }
.totals-table td { padding: .3rem 0; }
.totals-table td:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.totals-grand td { border-top: 2px solid var(--accent); font-weight: 800; font-size: 1.05rem; padding-top: .5rem; }

.meta-list { display: grid; grid-template-columns: auto 1fr; gap: .15rem .9rem; margin: .6rem 0 0; font-size: .9rem; }
.meta-list dt { color: var(--muted); }
.meta-list dd { margin: 0; }
.customer-row { display: flex; align-items: center; gap: .7rem; }
.avatar-light { background: var(--bg); color: var(--ink); }
.quick-actions { display: flex; gap: .5rem; margin-top: .7rem; }

.attach-list { list-style: none; margin: 0 0 .8rem; padding: 0; }
.attach-list li { display: flex; align-items: center; gap: .5rem; padding: .3rem 0; border-bottom: 1px solid var(--line); }
.attach-list li a { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* styled attachment drop-zone (audit P2-5) */
.attach-form { display: block; }
.dropzone {
    display: flex; flex-direction: column; align-items: center; gap: .45rem;
    border: 1.5px dashed var(--line); border-radius: 12px; padding: 1.2rem 1rem;
    text-align: center; cursor: pointer; color: var(--muted); margin-bottom: .6rem;
    transition: border-color .15s ease, background .15s ease, color .15s ease;
}
.dropzone:hover { border-color: var(--accent); background: var(--bg); color: var(--ink-soft); }
.dropzone input[type="file"] { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.dropzone-ico {
    width: 26px; height: 26px; background: currentColor;
    -webkit-mask: var(--n-quotes) center / contain no-repeat; mask: var(--n-quotes) center / contain no-repeat;
}
.dropzone-text { font-size: .85rem; line-height: 1.35; }
.dropzone.has-file { border-color: var(--accent); color: var(--ink); }

.picker-filter { margin-bottom: .35rem; }
.picker-list { width: 100%; font-weight: 400; }
.btn-ghost-link { background: none; border: none; color: var(--ink-soft); font: inherit; font-weight: 600; cursor: pointer; padding: 0; margin: -.4rem 0 .9rem; }
.btn-ghost-link:hover { color: var(--accent); }
.quick-add { background: var(--bg); border-radius: 10px; padding: .8rem .9rem .1rem; margin-bottom: .9rem; }

/* ---------- invoice / quote / credit-note pills ---------- */
.badge-iv-draft { background: var(--pill-gray-bg);  color: var(--pill-gray);  --icon: var(--i-pencil); --icon-d: inline-block; }
.badge-iv-sent  { background: var(--pill-blue-bg);  color: var(--pill-blue);  --icon: var(--i-send);   --icon-d: inline-block; }
.badge-iv-paid  { background: var(--pill-green-bg); color: var(--pill-green); --icon: var(--i-check);  --icon-d: inline-block; }
.badge-qt-draft    { background: var(--pill-gray-bg);  color: var(--pill-gray);  --icon: var(--i-pencil); --icon-d: inline-block; }
.badge-qt-sent     { background: var(--pill-blue-bg);  color: var(--pill-blue);  --icon: var(--i-send);   --icon-d: inline-block; }
.badge-qt-accepted { background: var(--pill-green-bg); color: var(--pill-green); --icon: var(--i-check);  --icon-d: inline-block; }
.badge-qt-rejected { background: var(--pill-red-bg);   color: var(--pill-red);   --icon: var(--i-x);      --icon-d: inline-block; }
.cn-negative { color: var(--danger); font-weight: 700; }

.invoice-doc { max-width: 820px; }
.inv-head { display: flex; justify-content: space-between; gap: 1rem; border-bottom: 3px solid var(--accent); padding-bottom: 1rem; margin-bottom: 1rem; }
.inv-head h3 { margin: 0 0 .15rem; }
.inv-co { text-align: right; font-size: .85rem; }
.inv-logo { max-height: 50px; max-width: 160px; display: block; margin-bottom: .4rem; }
.inv-customer { margin-bottom: 1rem; }
.inv-customer h4 { font-size: .75rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin: 0 0 .25rem; }
.inv-foot { margin: 1.5rem 0 0; padding-top: .8rem; border-top: 1px solid var(--line); font-size: .8rem; }

@media print {
    .no-print, .sidebar, .topbar, .flash { display: none !important; }
    .shell, .main { display: block; }
    .content { padding: 0; max-width: none; }
    .card.invoice-doc { border: none; box-shadow: none; padding: 0; }
    body { background: #fff; }
}

/* ---------- planning calendar ---------- */
.cal-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: .6rem; }
.cal-nav { display: flex; align-items: center; gap: .4rem; }
.cal-title { margin-left: .5rem; }
.cal-legend { display: flex; gap: 1rem; align-items: center; font-size: .82rem; margin-bottom: .8rem; flex-wrap: wrap; }
.cal-legend .leg { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-right: .35rem; vertical-align: -1px; }
.leg-planned { background: #4f96ee; }
.leg-in_progress { background: #efa23b; }
.leg-ready { background: #35a96f; }
.leg-requested { background: #fff; border: 2px dashed #9a7bd4; }

.cal-card { padding: 0; overflow: hidden; }
.cal-week-head { display: grid; grid-template-columns: 56px repeat(7, 1fr); border-bottom: 1px solid var(--line); }
.cal-day-head { padding: .5rem .4rem; text-align: center; font-size: .78rem; font-weight: 700; color: var(--ink-soft); border-left: 1px solid var(--line); }
.cal-week { display: grid; grid-template-columns: 56px repeat(7, 1fr); height: 780px; }
.cal-hours { display: flex; flex-direction: column; }
.cal-hour { flex: 1; font-size: .68rem; color: var(--muted); text-align: right; padding-right: .4rem; border-top: 1px solid var(--line); }
.cal-day { position: relative; border-left: 1px solid var(--line);
    background: repeating-linear-gradient(to bottom, transparent 0, transparent calc(100%/15 - 1px), var(--line) calc(100%/15 - 1px), var(--line) calc(100%/15)); }
.cal-day.cal-today, .cal-day-head.cal-today { background-color: var(--today-bg); }
.cal-block {
    position: absolute; left: 3px; right: 3px; z-index: 2;
    border-radius: 7px; padding: .2rem .4rem; overflow: hidden;
    font-size: .72rem; line-height: 1.25; text-decoration: none; color: #fff;
    display: block; border: 1px solid rgba(0,0,0,.1);
}
.cal-block-time { font-weight: 800; margin-right: .25rem; }
.cal-block-plate { display: block; font-family: ui-monospace, Consolas, monospace; font-size: .68rem; opacity: .9; }
.apt-planned     { background: #4f96ee; }
.apt-in_progress { background: #efa23b; }
.apt-ready       { background: #35a96f; }
.apt-invoiced    { background: #a39d90; }
.apt-requested   { background: #fff; color: var(--ink); border: 2px dashed #9a7bd4; }

.cal-month { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal-month-head { padding: .5rem .4rem; text-align: center; font-size: .75rem; font-weight: 700; color: var(--ink-soft); border-bottom: 1px solid var(--line); }
.cal-cell { min-height: 92px; border-bottom: 1px solid var(--line); border-left: 1px solid var(--line); padding: .25rem; font-size: .75rem; }
.cal-cell:nth-child(7n+1) { border-left: none; }
.cal-cell.cal-other { background: var(--surface-2); color: var(--muted); }
.cal-cell.cal-today { background: var(--today-bg); }
.cal-cell-num { font-weight: 700; display: block; margin-bottom: .15rem; }
.cal-chip { display: block; border-radius: 5px; padding: .08rem .3rem; margin-bottom: .15rem;
    font-size: .68rem; color: #fff; text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-chip.apt-requested { color: var(--ink); }

/* ---------- roster ---------- */
.today-list { list-style: none; margin: 0; padding: 0; display: flex; gap: 1.5rem; flex-wrap: wrap; }
.roster-table th.cal-today { color: var(--accent); }
.roster-cell { padding: .3rem; }
.roster-slot {
    display: block; width: 100%; padding: .35rem .4rem; text-align: center;
    border: 1px dashed var(--line); border-radius: 8px; background: none;
    font: inherit; font-size: .8rem; color: var(--muted); cursor: pointer;
}
.roster-slot:hover { border-color: var(--accent); color: var(--ink); }
.roster-slot.roster-on { background: var(--pill-green-bg); border: 1px solid #c4ebd1; color: var(--pill-green); font-weight: 700; }
.roster-readonly { cursor: default; }
.roster-readonly:hover { border-color: var(--line); color: inherit; }

/* ---------- tabbed sections (settings, audit P2-7) ---------- */
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--line); margin-bottom: 1.25rem; flex-wrap: wrap; }
.tab {
    background: none; border: none; border-bottom: 2px solid transparent;
    padding: .6rem .9rem; margin-bottom: -1px; font: inherit; font-weight: 600;
    color: var(--muted); cursor: pointer; transition: color .15s ease, border-color .15s ease;
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--ink); border-bottom-color: var(--accent); }

/* ---------- settings logo ---------- */
.logo-row { display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap; }
.logo-preview {
    width: 110px; height: 110px; object-fit: contain;
    border: 1px solid var(--line); border-radius: var(--radius); background: #fff;
}
.logo-empty {
    display: flex; align-items: center; justify-content: center;
    color: var(--muted); font-size: .8rem; text-align: center;
}

/* ---------- auth screens ---------- */
.auth-body {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: var(--bg); padding: 1rem;
}
/* login: oversized brand crest watermark — full height, anchored left, its left
   edge clipped off-screen, recoloured to #212831 via an alpha mask */
.auth-hero { position: relative; overflow: hidden; }
.auth-hero::before {
    content: ""; position: absolute; z-index: 0; pointer-events: none;
    top: 50%; left: 0; height: 108vh; aspect-ratio: 1677 / 1443;
    transform: translate(-34%, -50%);
    background-color: #212831;
    -webkit-mask: url("login-crest.png") center / contain no-repeat;
            mask: url("login-crest.png") center / contain no-repeat;
}
.auth-hero .auth-card,
.auth-hero .boek-card { position: relative; z-index: 1; }
.auth-card {
    background: var(--card); border: 1px solid var(--line); border-radius: 18px;
    padding: 2.2rem 2rem; width: 100%; max-width: 380px;
    box-shadow: 0 14px 40px rgba(60, 50, 25, .1);
}
.auth-brand { text-align: center; margin-bottom: 1.4rem; }
.auth-brand h1 { font-size: 1.25rem; margin: .7rem 0 .1rem; }
.auth-brand p { margin: 0; }
/* Secondary "keep current password" action under the primary Save button. */
.auth-keep { margin-top: .55rem; }

/* ---------- sidebar foot toggles: language pill + theme switch ---------- */
.foot-toggles {
    display: flex; align-items: center; justify-content: space-between;
    gap: .6rem; margin-bottom: .7rem;
}
.lang-toggle {
    display: inline-flex; gap: 2px; padding: 3px;
    background: var(--toggle-track); border-radius: 999px;
}
.lang-toggle button {
    padding: .22rem .85rem; font: inherit; font-size: .72rem; font-weight: 600;
    letter-spacing: .05em; color: var(--muted);
    background: none; border: none; border-radius: 999px; cursor: pointer;
    transition: color .15s ease;
}
.lang-toggle button:hover { color: var(--ink); }
.lang-toggle button.active {
    background: var(--thumb-bg); color: var(--thumb-ink);
    box-shadow: 0 1px 3px rgba(60, 50, 30, .16);
}

/* theme switch — sliding sun/moon thumb (light ⇄ dark), persisted in JS */
.theme-toggle {
    position: relative; flex-shrink: 0; width: 52px; height: 26px; padding: 0;
    border: none; border-radius: 999px; background: var(--toggle-track); cursor: pointer;
    transition: background .15s ease;
}
.theme-toggle:hover { filter: brightness(1.07); }
.tt-thumb {
    position: absolute; top: 3px; left: 3px; width: 20px; height: 20px;
    border-radius: 50%; background: var(--thumb-bg);
    box-shadow: 0 1px 3px rgba(40, 30, 15, .3);
    display: grid; place-items: center;
    transition: transform .24s cubic-bezier(.16, 1, .3, 1);
}
[data-theme="dark"] .tt-thumb { transform: translateX(26px); }
.tt-ico {
    grid-area: 1 / 1; width: 12px; height: 12px; background: var(--accent);
    -webkit-mask: var(--m) center / contain no-repeat;
    mask: var(--m) center / contain no-repeat;
}
.tt-sun  { --m: var(--i-sun); }
.tt-moon { --m: var(--i-moon); }
[data-theme="light"] .tt-moon { display: none; }
[data-theme="dark"]  .tt-sun  { display: none; }
@media (prefers-reduced-motion: reduce) { .tt-thumb { transition: none; } }

/* ---------- dashboard home (§2) ---------- */
.dash-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.dash-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1rem; align-items: start;
}
.dash-grid .card { margin-bottom: 0; }
.dash-list { list-style: none; margin: 0; padding: 0; }
.dash-list li {
    display: flex; align-items: baseline; gap: .5rem; flex-wrap: wrap;
    padding: .45rem 0; border-bottom: 1px solid var(--line);
}
.dash-list li:last-child { border-bottom: none; }
.dash-time { color: var(--muted); font-size: .85rem; white-space: nowrap; }
.dash-amount { margin-left: auto; white-space: nowrap; }
.sms-widget { grid-template-columns: 1fr 1fr; margin-bottom: .75rem; }

/* ---------- public booking /boek (§16) ---------- */
.boek-body {
    min-height: 100vh; display: flex; align-items: flex-start; justify-content: center;
    background: var(--bg); padding: 2rem 1rem;
}
.boek-card {
    background: var(--card); border: 1px solid var(--line); border-radius: 18px;
    padding: 2.2rem 1.1rem; width: 100%; max-width: 440px;
    box-shadow: 0 14px 40px rgba(60, 50, 25, .1);
}
/* public booking page header (logo · language · WhatsApp CTA) — MOBILE ONLY.
   Hidden on desktop (the centred card keeps its in-card brand badge); on phones
   it becomes a sticky frosted-glass bar over the crest watermark. */
.boek-header { display: none; }
.boek-logo { display: inline-flex; flex-shrink: 0; }
.boek-logo img { height: 34px; width: auto; display: block; }
.boek-actions { display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; }
.boek-call {
    display: inline-flex; align-items: center; gap: .5rem;
    white-space: nowrap;
}
.boek-call-ico { flex: none; }

@media (max-width: 768px) {
    /* stack so the glass bar spans full width and the card sits centred below.
       overflow:visible (overriding .auth-hero's hidden) lets the document scroll
       so the sticky header can actually pin to the viewport top. */
    .boek-page { flex-direction: column; align-items: stretch; justify-content: flex-start; padding: 0; overflow: visible; }
    /* crest becomes viewport-fixed: it's clipped by the viewport (so no horizontal
       bleed / scrollbar) without needing an overflow:hidden scroll container. */
    .boek-page::before { position: fixed; }
    .boek-header {
        display: flex; align-items: center; justify-content: space-between;
        flex-wrap: wrap; gap: .7rem 1rem; padding: .75rem 1.1rem;
        position: sticky; top: 0; z-index: 5;
        background: color-mix(in srgb, var(--card) 60%, transparent);
        -webkit-backdrop-filter: blur(16px) saturate(1.5);
        backdrop-filter: blur(16px) saturate(1.5);
        border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
        box-shadow: 0 4px 20px rgba(0, 0, 0, .12);
    }
    .boek-page .boek-card { align-self: stretch; margin: 1rem 1rem 2rem; width: auto; }
    .boek-logo img { height: 30px; }
}
/* browsers without backdrop-filter: fall back to a solid (opaque) bar */
@supports not ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
    @media (max-width: 768px) { .boek-header { background: var(--card); } }
}
/* APK page keeps its header on DESKTOP too (logo · language · WhatsApp) as a
   fixed top bar, so desktop visitors still get the NL/EN toggle + call button. */
@media (min-width: 769px) {
    .apk-public .boek-header {
        display: flex; align-items: center; justify-content: space-between;
        gap: 1rem; padding: 1rem clamp(1.1rem, 5vw, 3rem);
        position: fixed; top: 0; left: 0; right: 0; z-index: 20;
        background: color-mix(in srgb, var(--card) 78%, transparent);
        -webkit-backdrop-filter: blur(16px) saturate(1.5);
        backdrop-filter: blur(16px) saturate(1.5);
        border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
    }
    .apk-public .boek-logo img { height: 34px; }
    .apk-public.boek-body { padding-top: 6rem; } /* clear the fixed bar */
}
@supports not ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
    @media (min-width: 769px) { .apk-public .boek-header { background: var(--card); } }
}
/* APK page on mobile: centred card pinned to the top (not stretched edge-to-edge). */
@media (max-width: 768px) {
    .apk-public .boek-card {
        align-self: center; width: calc(100% - 2rem); max-width: 440px;
        margin: 1.25rem auto 2rem;
    }
}
.boek-card label { display: block; margin-bottom: .9rem; }
.boek-foot { text-align: center; margin: 1.2rem 0 0; font-size: .9rem; }
.boek-thanks { text-align: center; }
.boek-thanks-ico { display: block; width: auto; height: 56px; margin: 0 auto .4rem; }
.boek-check {
    width: 54px; height: 54px; margin: .5rem auto 1rem; border-radius: 50%;
    background: var(--pill-green-bg); color: var(--pill-green); font-size: 1.6rem; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
}
.brand-logo-lg { max-width: 64px; max-height: 64px; border-radius: 10px; }
/* honeypot: invisible to people, present for bots */
.hp-field { position: absolute; left: -9999px; top: -9999px; height: 1px; overflow: hidden; }

/* ---------- first-run onboarding tour (tour.js) ----------
   full-screen click-blocker (transparent) + a spotlight box whose huge box-shadow
   dims everything except the highlighted element + a coach-mark popover. */
.tour-overlay { position: fixed; inset: 0; z-index: 1000; }
.tour-spot {
    position: fixed; z-index: 1001; border-radius: 12px; pointer-events: none;
    box-shadow: 0 0 0 100vmax rgba(8, 10, 14, .60);
    outline: 2px solid var(--accent); outline-offset: 3px;
    transition: left .26s cubic-bezier(.16, 1, .3, 1), top .26s cubic-bezier(.16, 1, .3, 1),
                width .26s cubic-bezier(.16, 1, .3, 1), height .26s cubic-bezier(.16, 1, .3, 1);
}
.tour-pop {
    position: fixed; z-index: 1002; width: min(402px, calc(100vw - 28px));
    min-height: 174.28px; display: flex; flex-direction: column;
    background: var(--card); color: var(--ink);
    border: 1px solid var(--line); border-radius: 16px;
    box-shadow: var(--shadow-modal); padding: 1.25rem 1.35rem 1.1rem;
    animation: tourPop .2s cubic-bezier(.16, 1, .3, 1);
}
/* Dutch labels are longer (Overslaan / Vorige / Volgende) so the footer actions
   overflow the 402px card — give the Dutch card more width. English keeps 402px. */
html[lang="nl"] .tour-pop { width: min(440px, calc(100vw - 28px)); }
@keyframes tourPop { from { opacity: 0; transform: translateY(6px); } }
.tour-pop-step {
    font-family: var(--font-label); font-size: .68rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .08em; color: var(--muted);
}
.tour-pop h4 {
    margin: .35rem 0 .4rem; font-family: var(--font-display);
    font-size: 1.2rem; font-weight: 800; letter-spacing: -.01em; line-height: 1.1;
    text-transform: uppercase;
}
.tour-pop p { margin: 0 0 1rem; color: var(--ink-soft); font-size: .92rem; line-height: 1.5; }
.tour-pop-foot { display: flex; align-items: center; justify-content: space-between; gap: .6rem; margin-top: auto; }
.tour-dots { display: inline-flex; gap: 6px; }
.tour-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--line); transition: background .2s ease, transform .2s ease; }
.tour-dots i.on { background: var(--accent); transform: scale(1.25); }
.tour-actions { display: inline-flex; gap: .5rem; }
.tour-skip { background: none; border: none; color: var(--muted); font: inherit; font-size: .85rem; font-weight: 600; cursor: pointer; padding: .35rem .15rem; }
.tour-skip:hover { color: var(--ink); }
@media (prefers-reduced-motion: reduce) {
    .tour-spot { transition: none; }
    .tour-pop { animation: none; }
}

/* online-request contact block in the appointment modal */
.booking-contact {
    background: var(--bg); border: 1px solid var(--line); border-radius: 12px;
    padding: .7rem .9rem; margin-bottom: 1rem;
}
.booking-contact ul { margin: .4rem 0 0; padding-left: 1.1rem; }
.btn-row { display: flex; gap: .5rem; margin: .6rem 0; }

/* ---------- tools (§12) ---------- */
.tools-switch {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: .75rem; margin-bottom: 1rem;
}
.tool-tab {
    display: flex; flex-direction: column; align-items: flex-start; gap: .2rem; text-align: left;
    background: var(--card); border: 1px solid var(--line); border-radius: 14px;
    padding: .85rem .9rem; cursor: pointer; font: inherit;
    color: var(--ink); box-shadow: var(--shadow-card);
    transition: border-color .15s ease, box-shadow .15s ease, transform .1s ease;
}
.tool-tab:hover { border-color: var(--hover-line); box-shadow: var(--shadow-hover); }
.tool-tab.active { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent) inset; }
.tool-tab-ico {
    width: 20px; height: 20px; background: var(--accent); margin-bottom: .15rem;
    -webkit-mask: var(--m) center / contain no-repeat; mask: var(--m) center / contain no-repeat;
}
.tool-tab-name { font-weight: 700; }
.tool-tab-sub { font-size: .78rem; color: var(--muted); font-weight: 500; }
.tool-result {
    display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
    margin-top: 1.25rem; padding: 1rem 1.1rem; border-radius: 14px;
    border: 1px solid var(--line); border-left: 6px solid var(--line);
    background: var(--bg);
}
.tool-result.is-pass { border-left-color: var(--pill-green); background: var(--pill-green-bg); }
.tool-result.is-fail { border-left-color: var(--danger);     background: var(--pill-red-bg); }
.tool-result-meta { display: flex; flex-direction: column; gap: .15rem; }
.tool-big { font-size: 2.4rem; font-weight: 800; line-height: 1; }
.tool-result.is-pass .tool-big { color: var(--pill-green); }
.tool-result.is-fail .tool-big { color: var(--danger); }
.tool-ok  { color: var(--pill-green); }
.tool-bad { color: var(--danger); }
.psi-row { display: flex; align-items: flex-end; gap: .8rem; max-width: 420px; }
.psi-row label { flex: 1; margin-bottom: 0; }
.psi-arrow { font-size: 1.3rem; color: var(--muted); padding-bottom: .7rem; }
.chip-row { display: flex; gap: .5rem; margin-top: 1.1rem; flex-wrap: wrap; }
.chip {
    border: 1px solid var(--line); background: var(--btn-bg); color: var(--ink);
    border-radius: 999px; padding: .4rem 1rem; cursor: pointer; font: inherit;
    font-size: .9rem; font-weight: 600; box-shadow: var(--shadow-card);
    transition: border-color .15s ease, color .15s ease, box-shadow .15s ease, transform .1s ease;
}
.chip:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-1px); box-shadow: var(--shadow-hover); }
.chip:active { transform: translateY(0); }
/* tire-size code: label-on-top inputs that share one baseline, with the
   /, R and " separators sitting on the input row (margin-bottom:0 keeps the
   inputs aligned; the unit symbols no longer live inside a label so nothing
   wraps below an input and knocks a box out of line). */
.tire-code { display: flex; align-items: flex-end; gap: .55rem; max-width: 480px; flex-wrap: wrap; }
.tire-code label { flex: 1 1 0; min-width: 66px; margin-bottom: 0; }
.tire-sep { padding-bottom: .7rem; font-weight: 700; color: var(--muted); font-size: 1.05rem; line-height: 1; }
.tire-sep-unit { padding-bottom: .75rem; }
.tire-out { margin-top: 1.25rem; }
.obd-search { display: block; max-width: 420px; margin-bottom: .75rem; }
.obd-row { cursor: pointer; }
.sev-hoog   { background: var(--pill-red-bg);    color: var(--pill-red);    --icon: var(--i-warn);  --icon-d: inline-block; }
.sev-midden { background: var(--pill-amber-bg);  color: var(--pill-amber);  --icon: var(--i-warn);  --icon-d: inline-block; }
.sev-laag   { background: var(--pill-green-bg);  color: var(--pill-green);  --icon: var(--i-check); --icon-d: inline-block; }

/* ---------- help page ---------- */
.help-highlights { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 1.1rem; }
.help-hi { display: flex; gap: .75rem; align-items: flex-start; }
.help-hi-ico { width: 36px; height: 36px; flex: none; border-radius: 10px; background: var(--bg); display: grid; place-items: center; color: var(--accent); }
.help-hi-ico::before { content: ""; width: 19px; height: 19px; background: currentColor;
    -webkit-mask: var(--m) center / contain no-repeat; mask: var(--m) center / contain no-repeat; }
.help-hi h4 { margin: 0 0 .15rem; font-size: .95rem; }
.help-hi p { margin: 0; font-size: .86rem; line-height: 1.45; }
.help-toc { display: flex; flex-wrap: wrap; gap: .5rem; }
.help-toc a { text-decoration: none; border: 1px solid var(--line); border-radius: 999px;
    padding: .3rem .85rem; font-size: .85rem; font-weight: 600; color: var(--ink-soft);
    transition: border-color .15s ease, color .15s ease; }
.help-toc a:hover { border-color: var(--accent); color: var(--ink); }
.help-section { scroll-margin-top: 80px; }
.help-body p { margin: .1rem 0 .6rem; }
.help-body ul { margin: .2rem 0; padding-left: 1.15rem; }
.help-body li { margin: .3rem 0; }

@media (max-width: 860px) {
    .sidebar { width: 200px; }
    .content { padding: 1rem; }
    .topbar { padding: .7rem 1rem; }
    .dash-head { flex-direction: column; }
}

/* mobile: off-canvas sidebar drawer + horizontally scrollable tables (audit P1-4) */
.nav-backdrop { display: none; }
@media (max-width: 768px) {
    .sidebar {
        position: fixed; top: 0; left: 0; height: 100vh; width: 264px; z-index: 200;
        transform: translateX(-100%); transition: transform .22s ease;
        box-shadow: 0 0 44px rgba(20, 16, 8, .22);
    }
    body.sb-closed .sidebar { display: flex; } /* drawer ignores the desktop collapse pref */
    body.nav-open .sidebar { transform: none; }
    .sb-open { display: block; }               /* hamburger always available on mobile */
    .nav-backdrop { position: fixed; inset: 0; z-index: 150; background: rgba(20, 16, 8, .42); }
    body.nav-open .nav-backdrop { display: block; }
    .main { margin-top: 0; border-top-left-radius: 0; }
    .topbar { border-top-left-radius: 0; padding: .7rem 1rem; }
    .content { padding: 1rem; }
    .card { overflow-x: auto; }
    .table { min-width: 540px; }
    .page-title { font-size: 1rem; }
    .global-search { max-width: none; }
    .page-head-row { align-items: stretch; }
}
@media (prefers-reduced-motion: reduce) { .sidebar { transition: none; } }

/* ===========================================================================
   DARK THEME — premium cool-slate palette (the default).
   Activated by [data-theme="dark"] on <html>, set by an inline <head> script
   before first paint. Only colour tokens flip; all layout/spacing is shared
   with the light theme. The gold accent is two-tone: deeper #C9A227 on light,
   brighter #ffce1f on dark (pops against the cold base).
   =========================================================================== */
/* Two-tone gold: brighter on dark. `html[data-theme="dark"]` (0,1,1) outranks
   the per-page inline `:root{--accent:…}` settings override (0,1,0), so dark
   always gets #ffce1f regardless of the stored accent_color. */
html[data-theme="dark"] { --accent: #ffce1f; }
[data-theme="dark"] {
    --ink: #e9eef4;
    --ink-soft: #b8c1cd;
    --muted: #8b94a2;                /* ~5.8:1 on the card surface — WCAG AA */
    --bg: #11151b;                   /* recessed: inputs, search, chips, panels */
    --card: #181d25;                 /* raised sheet + cards */
    --line: #28303b;
    --sidebar-bg: #0c0f14;           /* frame: shell + sidebar (darkest) */
    --sidebar-ink: #b8c1cd;
    --danger: #f1736b;
    --ok: #4fc78a;

    --surface-2: #222a34;            /* hover / zebra fill */
    --input-bg: #0f1319;
    --btn-bg: #1e252f;
    --hover-line: #3a4452;
    --nav-active: #232c38;
    --nav-hover: rgba(255, 255, 255, .05);
    --toggle-track: rgba(255, 255, 255, .08);
    --thumb-bg: #dde3ea;             /* cool-light thumb on the dark track */
    --today-bg: #16243a;

    --shadow-card: 0 1px 2px rgba(0, 0, 0, .5), 0 6px 18px rgba(0, 0, 0, .42);
    --shadow-hover: 0 10px 30px rgba(0, 0, 0, .58);
    --shadow-modal: 0 30px 70px rgba(0, 0, 0, .68);

    /* status pills: deep tinted bg + bright legible text */
    --pill-orange-bg: #3a2613; --pill-orange: #f0a45c;
    --pill-blue-bg:   #13283f; --pill-blue:   #58b6f6;
    --pill-purple-bg: #221c3d; --pill-purple: #ad93f7;
    --pill-amber-bg:  #322910; --pill-amber:  #e6b73c;
    --pill-green-bg:  #133024; --pill-green:  #4fc78a;
    --pill-red-bg:    #361a1d; --pill-red:    #f1736b;
    --pill-gray-bg:   #232a33; --pill-gray:   #9aa5b3;
}

/* selector-level overrides for the few literals that don't map to one token */
[data-theme="dark"] .nav-link { color: #99a2b0; }
/* dark mode: swap the gold "S" initial badge for the brand crest image (sidebar
   only — the login crest keeps its own art). Falls back to the gold badge in
   light mode and whenever a custom logo is uploaded (then .brand-logo renders). */
[data-theme="dark"] .sidebar .brand-badge {
    background: url('brand-dark.png') center / contain no-repeat;
    color: transparent;
}
[data-theme="dark"] .modal-overlay { background: rgba(0, 0, 0, .64); }
[data-theme="dark"] .modal-ico { background: #1f2630; } /* keep the icon badge dark */
[data-theme="dark"] .modal-card label input,
[data-theme="dark"] .modal-card label select,
[data-theme="dark"] .modal-card label textarea { background: var(--input-bg); border-color: var(--line); }
[data-theme="dark"] .modal-card label input:focus,
[data-theme="dark"] .modal-card label select:focus,
[data-theme="dark"] .modal-card label textarea:focus { background: var(--surface-2); }
[data-theme="dark"] .modal-card .quick-add { background: var(--surface-2); border-color: var(--line); box-shadow: 0 8px 24px rgba(0, 0, 0, .4); }
[data-theme="dark"] .sidebar-foot { border-top-color: var(--line); }
[data-theme="dark"] .flash-ok { background: var(--pill-green-bg); color: var(--pill-green); border-color: #1f5234; }
[data-theme="dark"] .flash-error { background: var(--pill-red-bg); color: var(--pill-red); border-color: #5a2723; }
[data-theme="dark"] .flash-warn { background: var(--pill-amber-bg); color: var(--pill-amber); border-color: #4a3c12; }
[data-theme="dark"] .btn-danger { border-color: #5a2723; }
[data-theme="dark"] .btn-danger:hover { background: #2a1b1d; border-color: var(--danger); }
[data-theme="dark"] .swatch { border-color: var(--card); }
[data-theme="dark"] .swatch-row input[type="color"] { background: var(--input-bg); }
[data-theme="dark"] .logo-preview { background: #1f2630; }
/* "requested" calendar items: an outlined ghost block, never a bright white slab */
[data-theme="dark"] .apt-requested,
[data-theme="dark"] .cal-chip.apt-requested { background: var(--surface-2); color: var(--ink); border-color: #6f5bb0; }
[data-theme="dark"] .leg-requested { background: var(--surface-2); border-color: #6f5bb0; }
[data-theme="dark"] .auth-card,
[data-theme="dark"] .boek-card { box-shadow: 0 18px 50px rgba(0, 0, 0, .6); }

/* ---------- modern scrollbars (app-wide) ----------
   replaces the chunky default OS scrollbar with a thin, rounded, theme-aware
   thumb on a transparent track; applies to every scroll container (incl. the
   modal body when an inline quick-add form expands it). */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--hover-line) transparent;
}
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: var(--hover-line); border-radius: 999px;
    border: 2px solid transparent; background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background: var(--muted); background-clip: padding-box; }
::-webkit-scrollbar-corner { background: transparent; }

/* RDW decrypt-fill: fields scramble in the accent colour + mono glyphs (see
   app.js); once settled, .rdw-filled keeps the accent colour so RDW-sourced
   data stays visually distinct from manually typed input (cleared on edit). */
.rdw-scramble {
    color: var(--accent) !important;
    font-family: var(--font-label) !important;
}
.rdw-filled {
    color: var(--accent) !important;
    font-weight: 600;
}

/* ===========================================================================
   SHOWROOM / VOORRAAD — admin grid + full-page car form.
   =========================================================================== */
.sr-hint { margin: -0.5rem 0 1rem; font-size: .85rem; }

.sr-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(264px, 1fr));
    gap: 1.1rem;
}
.sr-card {
    background: var(--card); border: 1px solid var(--line);
    border-radius: 16px; overflow: hidden; display: flex; flex-direction: column;
    box-shadow: var(--shadow-card); transition: box-shadow .2s ease, transform .2s ease;
}
.sr-card:hover { box-shadow: var(--shadow-hover); }
.sr-card.is-hidden { opacity: .62; }
.sr-ghost { opacity: .4; }

.sr-thumb {
    position: relative; aspect-ratio: 16 / 10; background: var(--bg);
    overflow: hidden;
}
.sr-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sr-noimg {
    width: 100%; height: 100%; display: flex; align-items: center;
    justify-content: center; font-size: 2.6rem; opacity: .5;
}
.sr-drag {
    position: absolute; top: 8px; left: 8px; z-index: 3;
    width: 26px; height: 26px; display: flex; align-items: center; justify-content: center;
    border-radius: 7px; background: rgba(0,0,0,.55); color: #fff;
    cursor: grab; font-size: .9rem; line-height: 1; user-select: none;
}
.sr-drag:active { cursor: grabbing; }
.sr-imgcount, .sr-sold {
    position: absolute; bottom: 8px; z-index: 3;
    font-size: .68rem; font-weight: 700; padding: 3px 8px; border-radius: 7px;
    background: rgba(0,0,0,.6); color: #fff; backdrop-filter: blur(4px);
}
.sr-imgcount { right: 8px; }
.sr-sold {
    left: 8px; top: 8px; bottom: auto; background: var(--danger); color: #fff;
    text-transform: uppercase; letter-spacing: .04em;
}
.sr-card .sr-drag + .sr-sold { left: 40px; } /* don't sit under the drag handle */

.sr-body { padding: .85rem .9rem 1rem; display: flex; flex-direction: column; gap: .5rem; }
.sr-top { display: flex; align-items: baseline; justify-content: space-between; gap: .6rem; }
.sr-title { margin: 0; font-size: 1rem; line-height: 1.2; }
.sr-price { font-weight: 800; color: var(--accent); white-space: nowrap; }
.sr-sub { margin: 0; font-size: .82rem; }
.sr-badges { display: flex; flex-wrap: wrap; gap: .35rem; }
.sr-actions {
    display: flex; flex-wrap: wrap; align-items: center; gap: .35rem;
    margin-top: .35rem; padding-top: .6rem; border-top: 1px solid var(--line);
}
.sr-actions .inline-form { display: inline-flex; }

/* full-page form */
/* Full card width, same as every other .card in the app (capped by .content). */
.sr-form .field-block { display: block; margin-bottom: 1rem; }
.sr-form .field-label {
    display: block; margin-bottom: .35rem; font-size: .78rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: .04em; color: var(--muted);
}
.sr-form-grid {
    display: grid; grid-template-columns: 1fr; gap: 0 1.25rem;
}
@media (min-width: 560px) { .sr-form-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 820px) { .sr-form-grid { grid-template-columns: repeat(3, 1fr); } }
.sr-form-grid .field-block { margin-bottom: 1rem; min-width: 0; }
.sr-divider { border: none; border-top: 1px solid var(--line); margin: .5rem 0 1.25rem; }
.sr-current-main { margin-bottom: .5rem; }
.sr-current-main img {
    max-width: 280px; width: 100%; border-radius: 10px; border: 1px solid var(--line);
}
.sr-form-foot {
    display: flex; justify-content: flex-end; align-items: center; gap: .6rem;
    margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid var(--line);
}

.sr-gallery { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: .6rem; }
.sr-gimg {
    position: relative; width: 116px; height: 88px; border-radius: 10px;
    overflow: hidden; border: 1px solid var(--line); background: var(--bg);
}
.sr-gimg img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sr-gimg.is-marked { outline: 2px solid var(--danger); opacity: .5; }
.sr-gdel {
    position: absolute; top: 4px; right: 4px; width: 24px; height: 24px;
    display: flex; align-items: center; justify-content: center; cursor: pointer;
    border-radius: 50%; background: rgba(220,38,38,.92); color: #fff;
    font-size: 1.1rem; line-height: 1;
}
.sr-gdel input { position: absolute; opacity: 0; width: 1px; height: 1px; }

/* RDW quick-fill row on the car form: a Dutch number plate + a fetch button. */
.sr-rdw { max-width: 520px; }
.sr-rdw-row { display: flex; gap: .6rem; align-items: center; margin-bottom: .35rem; }
.plate-input {
    display: inline-flex; align-items: stretch; position: relative; overflow: hidden;
    background: #f6c700; border: 1px solid #d4ab00; border-radius: 7px;
    padding-left: 1.5em; box-shadow: 0 1px 2px rgba(0,0,0,.18);
}
.plate-input::before {
    content: "NL"; position: absolute; left: 0; top: 0; bottom: 0; width: 1.2em;
    background: #003399; color: #fff; letter-spacing: 0;
    font: 700 .62rem/1 system-ui, sans-serif;
    display: flex; align-items: center; justify-content: center;
}
.plate-input input {
    border: none; background: transparent; margin: 0; width: 11ch; min-width: 0;
    padding: .5rem .55rem; color: #1d1b16;
    font-family: 'Plate', ui-monospace, Consolas, monospace; font-weight: 800;
    font-size: 1.05rem; letter-spacing: .12em; text-transform: uppercase;
}
.plate-input input:focus { outline: none; }
.plate-input input::placeholder { color: rgba(29,27,22,.45); font-weight: 600; letter-spacing: .06em; }
.plate-input:focus-within { box-shadow: 0 0 0 2px var(--accent); }
.sr-rdw-btn { flex: 0 0 auto; white-space: nowrap; padding-left: 1.1rem; padding-right: 1.1rem; }
.sr-rdw-note { margin: .15rem 0 .35rem; }

/* ===========================================================================
   PUBLIC APK REMINDER PAGE (skafiescars.nl/apk) — standalone, dark.
   =========================================================================== */
.apk-intro { margin: -.4rem 0 1.1rem; }
.apk-plate-row { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin-top: .3rem; }
.apk-plate-row .plate-input input { width: 12ch; }
#apk-check { margin-left: auto; display: inline-flex; align-items: center; gap: .45rem; }
.apk-check-ico { flex: 0 0 auto; }
.apk-result {
    margin: .2rem 0 1rem; padding: .7rem .9rem; border-radius: 12px; font-weight: 600;
}
.apk-result.is-ok   { background: var(--pill-green-bg); color: var(--pill-green); }
.apk-result.is-warn { background: var(--pill-amber-bg); color: var(--pill-amber); }
.apk-leads { border: 1px solid var(--line); border-radius: 12px; padding: .7rem 1rem; margin: 0 0 1rem; }
.apk-leads legend { padding: 0 .4rem; font-weight: 600; color: var(--ink-soft); font-size: .85rem; }
.boek-card label.apk-lead,
.apk-lead { display: flex; align-items: center; gap: .5rem; font-weight: 500; margin: .35rem 0; cursor: pointer; }
.apk-lead input { width: auto; margin: 0; accent-color: var(--accent); }
