/* ERP stylesheet — Material Design 3 (Material You), hand-rolled.
   Taken from fels_web's "Atelier" stylesheet; the colours are the
   green-primary theme (Option B): a white drawer, a green brand colour and the
   gold of the logo as the mark on the active menu item.

   Original header follows.

   Fels Web — Material Design 3 (Material You) stylesheet.
   Hand-rolled MD3: tonal color roles, elevation, shape & state layers,
   navigation drawer + app bar, filled buttons / FAB, filled text fields,
   cards, chips and data tables. No build step, no component framework.
   Barlow + Material Symbols are self-hosted (see below); everything
   degrades to the system font stack if they fail to load.

   The "Atelier" theme: a slate navigation drawer in both modes, an orange
   brand colour (heavy vehicles, the yard), squared controls and Barlow, a
   slightly condensed sans that keeps long French labels and wide figures
   compact. The components are zone_web's; the look is this app's own.
*/

/* ── Self-hosted fonts ──
   Served from /static/fonts so there are no render-blocking requests to
   Google Fonts on every page (the cause of the earlier sluggish feel).

   Material Symbols is subset to just the icons this app uses (~8 KB). An icon
   whose name is not in the subset renders as nothing at all -- no tofu, no
   fallback -- so ADDING AN ICON MEANS REGENERATING THE FONT:

     https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined
       :opsz,wght,FILL,GRAD@24,400,0,0&icon_names=<comma-separated list>

   fetched with a modern browser UA, then save the woff2 it points at over
   fonts/material-symbols.woff2 and bump the ?v= below. The list must cover
   the icons written in the templates (including the ones chosen by a Jinja
   expression), the ones named in Python (the dashboard checklist in app.py)
   and the ones written as CSS content: below (the alert marks). The modal's
   close button is an inline SVG on purpose, so it never depends on the font.

   The list as of v4 (63 names), fetched from the Google Fonts css2 URL
   above (opsz 24 / wght 400 / FILL 0 / GRAD 0, icon_names= this list) and
   checked with fontTools that each name has its ligature:
     account_balance, add, admin_panel_settings, anchor, archive,
     arrow_back, assured_workload, bar_chart, block, category,
     check, check_circle, chevron_left, chevron_right, close,
     currency_exchange, dark_mode, delete, description,
     directions_boat, done, download, edit, error, group,
     handshake, history, home, info, inventory_2, light_mode,
     local_shipping, lock_reset, logout, menu, notifications,
     payments, pending_actions, person, photo_camera,
     picture_as_pdf, point_of_sale, print, receipt_long, refresh,
     request_quote, save, schedule, sell, settings, signature,
     space_dashboard, store, swap_horiz, task_alt, translate,
     trending_up, unarchive, upload_file, verified, visibility,
     warehouse, warning */

/* The @font-face rules are in templates/_assets_head.html, where each font's
   address can carry its version. */

/* ── Design tokens (light) ── */
:root {
    --sidebar-w: 248px;

    /* Color roles — green brand (#15803D) on slate neutrals */
    --md-primary:                 #15803D;
    --md-on-primary:              #ffffff;
    --md-primary-container:       #DCFCE7;
    --md-on-primary-container:    #14532D;
    --md-secondary:               #475569;
    --md-secondary-container:     #EEF2F6;
    --md-on-secondary-container:  #1E293B;
    --md-tertiary:                #0F766E;
    --md-error:                   #ba1a1a;
    --md-on-error:                #ffffff;
    --md-error-container:         #ffdad6;
    --md-on-error-container:      #410002;
    --md-success:                 #2e6b3e;
    --md-success-container:       #b6f2bf;
    --md-on-success-container:    #00210d;

    --md-background:              #F6F7F9;
    --md-surface:                 #FFFFFF;
    --md-surface-dim:             #E2E8F0;
    --md-surface-container-low:   #FFFFFF;
    --md-surface-container:       #F1F5F9;
    --md-surface-container-high:  #E7ECF2;
    --md-on-surface:              #0F172A;
    --md-on-surface-variant:      #475569;
    --md-outline:                 #94A3B8;
    --md-outline-variant:         #E2E8F0;
    --md-surface-variant:         #E2E8F0;
    --md-inverse-surface:         #1E293B;
    --md-inverse-on-surface:      #F1F5F9;

    /* The navigation drawer is white in the light theme, separated from the
       page by a hairline; the active item is green on pale green with the
       logo's gold as its mark. */
    --nav-bg:            #FFFFFF;
    --nav-fg:            #334155;
    --nav-fg-muted:      #64748B;
    --nav-hover:         rgba(15, 23, 42, 0.05);
    --nav-hover-strong:  rgba(15, 23, 42, 0.08);
    --nav-active-bg:     #E8F5EC;
    --nav-active-fg:     #14532D;
    --nav-active-mark:   #F2B124;
    --nav-card:          #F1F5F9;
    --nav-card-fg:       #0F172A;
    --nav-border:        #E2E8F0;
    --nav-scrim:         rgba(15, 23, 42, 0.35);

    /* Shape scale */
    --shape-xs: 4px;
    --shape-sm: 6px;
    --shape-md: 8px;
    --shape-lg: 10px;
    --shape-xl: 16px;
    /* Buttons, fields, chips and nav items: squared, not pills. True circles
       (count bubbles, the hint dot) use --shape-full or 50%. */
    --shape-control: 8px;
    --shape-full: 999px;

    /* Elevation */
    --elev-1: 0 1px 2px rgba(15,23,42,.08), 0 1px 3px rgba(15,23,42,.06);
    --elev-2: 0 2px 4px rgba(15,23,42,.08), 0 4px 12px rgba(15,23,42,.08);
    --elev-3: 0 8px 24px rgba(15,23,42,.16), 0 2px 6px rgba(15,23,42,.10);

    /* Legacy aliases (kept so older inline references still resolve) */
    --bg: var(--md-background);
    --surface: var(--md-surface);
    --border: var(--md-outline-variant);
    --text: var(--md-on-surface);
    --muted: var(--md-on-surface-variant);
    --primary: var(--md-primary);
    --primary-light: var(--md-primary-container);
    --danger: var(--md-error);
    --warning: #b8860b;

    /* Accent palette — used for category chips, KPI cards and status colour.
       Each accent has a saturated foreground and a soft container background. */
    --c-indigo: #4f46e5; --c-indigo-bg: #e0e7ff;
    --c-blue:   #2563eb; --c-blue-bg:   #dbeafe;
    --c-cyan:   #0891b2; --c-cyan-bg:   #cffafe;
    --c-teal:   #0d9488; --c-teal-bg:   #ccfbf1;
    --c-green:  #16a34a; --c-green-bg:  #dcfce7;
    --c-amber:  #d97706; --c-amber-bg:  #fef3c7;
    --c-orange: #ea580c; --c-orange-bg: #ffedd5;
    --c-red:    #dc2626; --c-red-bg:    #fee2e2;
    --c-purple: #7c3aed; --c-purple-bg: #ede9fe;
    --c-pink:   #db2777; --c-pink-bg:   #fce7f3;
    /* Brand gradient, theme-independent so white text stays legible in
       light and dark mode — primary buttons, the add button, active chips. */
    --accent-gradient: linear-gradient(135deg, #16A34A, #15803D);
}

/* ── Night mode ──
   Driven by data-theme on <html>, not by the operating system alone: the
   attribute is written server-side from the reader's own choice, and when they
   have not chosen, a two-line script in <head> sets it from the system before
   the first paint. One switch, no flash, and nothing duplicated between a media
   query and a selector. */
:root[data-theme="dark"] {
        --c-indigo: #aeb2ff; --c-indigo-bg: #262463;
        --c-blue:   #7eb0ff; --c-blue-bg:   #1e3a5f;
        --c-cyan:   #5fd4e6; --c-cyan-bg:   #164e57;
        --c-teal:   #5fd9c8; --c-teal-bg:   #10453f;
        --c-green:  #7fd99a; --c-green-bg:  #14502a;
        --c-amber:  #f0b94e; --c-amber-bg:  #4d3408;
        --c-orange: #ff9d6b; --c-orange-bg: #4a2410;
        --c-red:    #ff9a8f; --c-red-bg:    #4a1515;
        --c-purple: #c4a6ff; --c-purple-bg: #2e1d52;
        --c-pink:   #ff9ecb; --c-pink-bg:   #4a1733;
}

:root[data-theme="dark"] {
        --md-primary:                 #6EE7A0;
        --md-on-primary:              #052E16;
        --md-primary-container:       #14532D;
        --md-on-primary-container:    #DCFCE7;
        --md-secondary:               #94A3B8;
        --md-secondary-container:     #273449;
        --md-on-secondary-container:  #E2E8F0;
        --md-error:                   #ffb4ab;
        --md-on-error:                #690005;
        --md-error-container:         #93000a;
        --md-on-error-container:      #ffdad6;
        --md-success:                 #9bd5a4;
        --md-success-container:       #14512a;
        --md-on-success-container:    #b6f2bf;

        --md-background:              #0B1120;
        --md-surface:                 #111827;
        --md-surface-dim:             #0B1120;
        --md-surface-container-low:   #111827;
        --md-surface-container:       #1A2335;
        --md-surface-container-high:  #243049;
        --md-on-surface:              #E2E8F0;
        --md-on-surface-variant:      #94A3B8;
        --md-outline:                 #64748B;
        --md-outline-variant:         #1F2A3D;
        --md-surface-variant:         #1F2A3D;
        --md-inverse-surface:         #E2E8F0;
        --md-inverse-on-surface:      #1E293B;

        /* At night the drawer goes dark like the page. */
        --nav-bg:            #0B1120;
        --nav-fg:            #CBD5E1;
        --nav-fg-muted:      #64748B;
        --nav-hover:         rgba(255, 255, 255, 0.06);
        --nav-hover-strong:  rgba(255, 255, 255, 0.10);
        --nav-active-bg:     rgba(34, 197, 94, 0.14);
        --nav-active-fg:     #86EFAC;
        --nav-active-mark:   #F2B124;
        --nav-card:          #131B2B;
        --nav-card-fg:       #E2E8F0;
        --nav-border:        #1F2A3D;
        --nav-scrim:         rgba(2, 6, 23, 0.55);
}

/* Tells the browser to draw its own furniture -- scrollbars, form controls,
   the space beyond the page -- to match. */
:root[data-theme="dark"] { color-scheme: dark; }

/* The list a select opens. On Windows it takes the select's own background,
   and a select drawn transparent (the filter bars) opened white with light
   text in night mode: each option is given its colours outright. */
select option, select optgroup { background-color: var(--md-surface-container); color: var(--md-on-surface); }
select option:checked { background-color: var(--md-primary-container); color: var(--md-on-primary-container); }
select option:disabled { color: var(--md-on-surface-variant); }

/* At night the hairline outline (#1F2A3D) all but vanishes against the
   fields, so selects and inputs get a border that can be seen. */
:root[data-theme="dark"] .field input:not([type=checkbox]):not([type=radio]),
:root[data-theme="dark"] .field textarea,
:root[data-theme="dark"] .field select { border-color: #334155; background-color: var(--md-surface-container); }
:root[data-theme="dark"] .field input:hover, :root[data-theme="dark"] .field select:hover,
:root[data-theme="dark"] .field textarea:hover { border-color: var(--md-outline); }
:root[data-theme="dark"] .field input:focus, :root[data-theme="dark"] .field select:focus,
:root[data-theme="dark"] .field textarea:focus { border-color: var(--md-primary); }
:root[data-theme="dark"] .filter-select,
:root[data-theme="dark"] .filter-search input { border-color: #475569; background-color: var(--md-surface-container); }
:root[data-theme="dark"] .filter-select--on { background-color: var(--md-primary-container); border-color: transparent; }
/* The panels that drop down (filters, languages, the bell): lifted off the
   page instead of melting into it. */
:root[data-theme="dark"] .filter-dd__panel,
:root[data-theme="dark"] .lang-menu__panel,
:root[data-theme="dark"] .bell__panel { background: var(--md-surface-container); border-color: #334155;
                                             box-shadow: 0 10px 24px rgba(0,0,0,.55), 0 2px 6px rgba(0,0,0,.4); }
:root[data-theme="dark"] .filter-dd__opt:hover,
:root[data-theme="dark"] .lang-menu__item:hover,
:root[data-theme="dark"] .bell__item:hover { background: var(--md-surface-container-high); }

/* ── Reset & base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* Never let a stray wide element scroll the whole page sideways on mobile —
   wide tables get their own .table-wrap scroller instead. */
html { overflow-x: hidden; }

/* Every text size on the site is a rem, so this one number sets them all.
   15px instead of the browser's 16 takes about 6% off the lot. Icon sizes are
   in px on purpose and do not follow -- an icon is sized by the button it sits
   in, not by the sentence beside it. The printed reports have their own
   stylesheet and are untouched: paper is read at arm's length. */
html { font-size: 15px; }

body {
    font-family: "Barlow", system-ui, -apple-system, "Segoe UI", sans-serif;
    background: var(--md-background);
    color: var(--md-on-surface);
    display: flex;
    min-height: 100vh;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--md-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--md-on-surface-variant); }
.small { font-size: 0.8rem; }

.material-symbols-outlined {
    font-family: "Material Symbols Outlined";
    font-weight: normal;
    font-style: normal;
    line-height: 1;
    letter-spacing: normal;
    text-transform: none;
    direction: ltr;
    font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 24;
    -webkit-font-feature-settings: "liga";
    user-select: none;
    /* Clip each glyph to a fixed 1em box so the unrendered ligature text
       (e.g. "space_dashboard") can never push or wrap neighbouring labels
       while the icon font is still loading — or if it fails to load at all. */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1em;
    height: 1em;
    overflow: hidden;
    white-space: nowrap;
    flex-shrink: 0;
}

/* ── Navigation drawer (sidebar) ── */
.sidebar {
    width: var(--sidebar-w);
    background: var(--nav-bg);
    color: var(--nav-fg);
    border-right: 1px solid var(--nav-border);
    display: flex;
    flex-direction: column;
    padding: 12px;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    height: 100vh;
}
.sidebar-logo {
    padding: 8px 12px 14px;
    display: flex;
}
.sidebar-logo-link { display: block; }
.sidebar-logo-img {
    display: block;
    width: 118px;
    max-width: 100%;
    /* Reserve the box before the SVG loads so the nav never jumps. */
    aspect-ratio: 637 / 150;
    height: auto;
}

.sidebar-nav {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow-y: auto;
    flex: 1;
}
.sidebar-nav::-webkit-scrollbar { width: 6px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: var(--nav-card); border-radius: 3px; }

.sidebar-nav a {
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    gap: 12px;
    height: 52px;
    padding: 0 16px;
    border-radius: var(--shape-control);
    color: var(--nav-fg);
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
}
.sidebar-nav a .nav-icon,
.sidebar-nav a .material-symbols-outlined { font-size: 22px; flex-shrink: 0; }
.sidebar-nav a::after {
    content: ""; position: absolute; inset: 0;
    background: #fff; opacity: 0; transition: opacity 0.15s;
    pointer-events: none;
}
.sidebar-nav a:hover { text-decoration: none; }
.sidebar-nav a:hover::after { opacity: 0.06; }
/* The active page: a tinted row with an orange mark on its left edge. */
.sidebar-nav a.active {
    background: var(--nav-active-bg);
    color: var(--nav-active-fg);
    font-weight: 600;
    box-shadow: inset 3px 0 0 var(--nav-active-mark);
}
.sidebar-nav a.active .nav-icon,
.sidebar-nav a.active .material-symbols-outlined { color: var(--nav-active-mark); }
.sidebar-nav a.sidebar-sub { height: 48px; }

.sidebar-section {
    padding: 18px 16px 6px;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--nav-fg-muted);
}

/* A search box that narrows a list of tick boxes as you type */
.list-filter {
    width: 100%; max-width: 360px; height: 38px; margin: 6px 0 8px;
    padding: 0 12px 0 36px;
    border: 1px solid var(--md-outline); border-radius: var(--shape-control);
    background: var(--md-surface) no-repeat 12px center / 16px 16px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23777'%3E%3Cpath d='M15.5 14h-.8l-.3-.3A6.5 6.5 0 1 0 9.5 16a6.5 6.5 0 0 0 4.2-1.6l.3.3v.8l5 5 1.5-1.5-5-5zm-6 0a4.5 4.5 0 1 1 0-9 4.5 4.5 0 0 1 0 9z'/%3E%3C/svg%3E");
    color: var(--md-on-surface); font: inherit; font-size: 0.875rem;
}
.list-filter:focus { border-color: var(--md-primary); outline: none; }
[hidden] { display: none !important; }
/* User block at the foot of the drawer */
.sidebar-user {
    margin-top: 8px;
    padding: 12px;
    border-radius: var(--shape-lg);
    background: var(--nav-card);
    color: var(--nav-card-fg);
    display: flex;
    align-items: center;
    gap: 8px;
}
.sidebar-user-info { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.sidebar-user-name { font-weight: 600; font-size: 0.85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { font-size: 0.72rem; color: var(--nav-fg-muted); }
.sidebar-change-pw, .sidebar-lang {
    font-size: 0.72rem;
    color: var(--nav-active-fg);
    margin-top: 4px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.logout-btn {
    width: 40px; height: 40px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: var(--shape-control);
    color: var(--nav-fg);
    font-size: 1.1rem;
    flex-shrink: 0;
    transition: background 0.15s, color 0.15s;
}
.logout-btn:hover { background: var(--md-error-container); color: var(--md-on-error-container); text-decoration: none; }

/* ── App bar (topbar) ── */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 12px;
    height: 64px;
    padding: 0 24px;
    background: var(--md-background);
    color: var(--md-on-surface);
    border-bottom: 1px solid var(--md-outline-variant);
}
.page-title { font-size: 1.375rem; font-weight: 500; flex: 1; color: var(--md-on-surface); }
.menu-toggle, .lang-toggle, .topbar-back {
    background: none; border: none; cursor: pointer;
    color: var(--md-on-surface-variant);
    height: 44px; min-width: 44px; padding: 0 10px;
    border-radius: var(--shape-control);
    font-size: 0.85rem; font-weight: 500;
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    transition: background 0.15s;
}
.menu-toggle { display: none; font-size: 1.5rem; }
.lang-toggle:hover, .menu-toggle:hover, .topbar-back:hover { background: var(--md-surface-container-high); text-decoration: none; }
.topbar-back { font-size: 1.5rem; padding: 0; margin-left: -10px; color: var(--md-on-surface); }
.topbar-back + .page-title { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }


.content {
    flex: 1;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* ── Flash toasts ──
   Laid over the page, top right, not in its flow: a message appearing or
   going never moves what is under it. Each fades out on its own, or on a
   click. On a phone it spans the width, under the top bar. */
.flash-area { position: fixed; top: 16px; right: 16px; z-index: 1200; display: flex; flex-direction: column; gap: 10px;
              width: min(440px, calc(100vw - 32px)); pointer-events: none; }
.flash-area .alert { pointer-events: auto; box-shadow: var(--elev-3); cursor: pointer;
                     animation: toast-in 0.25s ease-out; transition: opacity 0.4s, transform 0.4s; }
.flash-area .alert.is-leaving { opacity: 0; transform: translateY(-8px); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-12px); } to { opacity: 1; transform: none; } }
@media (max-width: 640px) { .flash-area { top: 72px; left: 16px; right: 16px; width: auto; } }
.alert {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    border-radius: var(--shape-md);
    font-size: 0.9rem;
    background: var(--md-surface-container-high);
    color: var(--md-on-surface);
}
.alert::before {
    font-family: "Material Symbols Outlined";
    font-size: 20px;
    content: "info";
}
.alert--error { background: var(--md-error-container); color: var(--md-on-error-container); }
.alert--error::before { content: "error"; }
.alert--success { background: var(--md-success-container); color: var(--md-on-success-container); }
.alert--success::before { content: "check_circle"; }
.alert--warning { background: var(--c-amber-bg); color: var(--c-amber); }
.alert--warning::before { content: "warning"; }

/* ── Cards ── */
.card {
    background: var(--md-surface-container-low);
    padding: 24px;
    border-radius: var(--shape-lg);
    border: 1px solid var(--md-outline-variant);
}
.card--elevated { border: none; box-shadow: var(--elev-1); background: var(--md-surface); }
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}
.card-header h2 { font-size: 1.15rem; font-weight: 600; }
/* When the page title already shows in the top bar, the card header keeps only
   its action/subtitle — align it to the right. */
.card-header--end { justify-content: flex-end; }

/* ── Buttons ── */
.btn {
    position: relative;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 40px;
    padding: 0 24px;
    background: transparent;
    color: var(--md-primary);
    border: none;
    border-radius: var(--shape-control);
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    cursor: pointer;
    text-decoration: none;
    transition: box-shadow 0.15s, background 0.15s;
}
.btn .material-symbols-outlined { font-size: 18px; }
.btn::after {
    content: ""; position: absolute; inset: 0;
    background: currentColor; opacity: 0; transition: opacity 0.15s; pointer-events: none;
}
.btn:hover { text-decoration: none; }
.btn:hover::after { opacity: 0.08; }
.btn:focus-visible { outline: none; }
.btn:focus-visible::after { opacity: 0.12; }

/* Filled (primary) */
.btn--primary { background: var(--accent-gradient); color: #fff; }
.btn--primary:hover { box-shadow: var(--elev-1); }
/* Tonal */
.btn--tonal { background: var(--md-secondary-container); color: var(--md-on-secondary-container); }
/* Outlined */
.btn--outlined { border: 1px solid var(--md-outline); color: var(--md-primary); }
/* Danger (filled error) */
.btn--danger { background: var(--md-error); color: var(--md-on-error); }
.btn--danger:hover { box-shadow: var(--elev-1); }
/* Block */
.btn--block { width: 100%; }
/* Small (table row actions) */
.btn--sm { height: 34px; padding: 0 16px; font-size: 0.8rem; }
/* Icon-only (table row actions): square, no label. The action name lives in
   title/aria-label — never drop it, it is the only thing a screen reader or an
   unsure user has to go on. */
.btn--icon { width: 34px; padding: 0; border-radius: var(--shape-control); }
.btn--icon.btn--sm { width: 34px; }
.btn--icon .material-symbols-outlined { font-size: 19px; }

/* Floating action button */
.fab {
    position: relative;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 56px;
    padding: 0 20px;
    border: none;
    border-radius: var(--shape-lg);
    background: var(--accent-gradient);
    color: #fff;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: var(--elev-2);
    text-decoration: none;
    transition: box-shadow 0.15s;
}
.fab:hover { box-shadow: var(--elev-3); text-decoration: none; }
.fab .material-symbols-outlined { font-size: 22px; }
.fab--tonal { background: var(--md-secondary-container); color: var(--md-on-secondary-container); }
/* ── Filled text fields ── */
/* Outlined fields with the label above the control — cleaner and lighter
   than a filled box with a floating label. The label sits after the input in
   the markup (a holdover from the floating-label era) but `order: -1` floats
   it to the top, so no template changes are needed. */
.entry-form, .auth-form { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label {
    order: -1;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--md-on-surface-variant);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.field input,
.field textarea,
.field select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--md-outline-variant);
    border-radius: var(--shape-sm);
    background: var(--md-surface);
    color: var(--md-on-surface);
    font-family: inherit;
    font-size: 0.92rem;
    outline: none;
    transition: border-color 0.15s;
}
.field textarea { resize: vertical; min-height: 76px; }
.field select { cursor: pointer; }
.field input:focus,
.field textarea:focus,
.field select:focus { border-color: var(--md-primary); }
.field input:disabled { opacity: 0.6; cursor: not-allowed; }
.field input::placeholder, .field textarea::placeholder { color: var(--md-outline); }
.field .field-hint {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--md-on-surface-variant);
    text-transform: none;
    letter-spacing: 0;
}
.form-actions { display: flex; gap: 10px; margin-top: 4px; }

/* ── The "?" beside a hint ──
   The long explanation a field used to carry underneath it, folded away. Shown
   on hover and on focus: focus is what makes it work on a phone, where a tap
   focuses the button and there is no hover to rely on.

   It opens upwards. These forms usually sit in a modal whose body scrolls, and
   a bubble hanging below a field near the bottom would be clipped by it. */
.hint-dot {
    display: inline-flex; align-items: center; justify-content: center;
    width: 15px; height: 15px; padding: 0; margin-left: 2px;
    vertical-align: -2px;
    border: 0; border-radius: 50%;
    background: var(--md-surface-container-high); color: var(--md-on-surface-variant);
    font: inherit; font-size: 0.66rem; font-weight: 700; line-height: 1;
    cursor: help;
}
.hint-dot:hover, .hint-dot:focus-visible {
    background: var(--md-primary); color: var(--md-on-primary);
}
/* The mark is the anchor, so the bubble is placed against it. */
.field-hint { position: relative; }
.hint-dot::after {
    content: attr(data-hint);
    position: absolute; left: 50%; right: auto; bottom: calc(100% + 8px);
    width: max-content; max-width: min(280px, calc(100vw - 32px));
    transform: translateX(-50%);
    z-index: 30;
    padding: 9px 12px;
    border-radius: var(--shape-sm);
    background: var(--md-inverse-surface);
    color: var(--md-inverse-on-surface);
    font-size: 0.74rem; font-weight: 400; line-height: 1.45; text-align: left;
    white-space: normal;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .28);
    opacity: 0; visibility: hidden;
    transition: opacity .12s ease;
}
.hint-dot:hover::after, .hint-dot:focus::after {
    opacity: 1; visibility: visible;
}

/* Two-column form rows (collapse to one column on narrow screens) */
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }

/* A tank reading under zero: the figure itself carries the alarm, since the
   gauge bar cannot draw a negative fill and would just look empty. */
.stock-negative { color: var(--c-red); }
.cash-in { color: var(--c-green); }

/* ── Filters that tick rather than pick one ──
   Each one is a <details>: the summary is the button, the tick boxes live in a
   panel that floats over the page. Native, so it opens with no script, and a
   long list scrolls inside instead of pushing the page down.

   The rows deliberately do NOT reuse .checkbox-item: that one draws a bordered
   card per line, which stacked inside a small panel reads as a pile of boxes
   rather than a list. Here a row is plain text until you point at it. */
/* Menus and dates match .btn--sm exactly -- 30px tall, same type size, same
   pill -- so a filter bar reads as one row of controls rather than three sizes
   of thing that happen to sit together. */
.filter-dd { position: relative; }
.filter-dd > summary {
    list-style: none; cursor: pointer; user-select: none;
    display: inline-flex; align-items: center; gap: 8px;
    height: 30px; padding: 0 13px;
    border: 1px solid var(--md-outline); border-radius: var(--shape-control);
    font-size: 0.78rem; background: var(--md-surface);
    color: var(--md-on-surface); white-space: nowrap;
}
.filter-date {
    display: inline-flex; align-items: center; gap: 8px;
    height: 30px; padding: 0 13px;
    border: 1px solid var(--md-outline); border-radius: var(--shape-control);
    font-size: 0.78rem; background: var(--md-surface); cursor: pointer;
}
.filter-date > span { color: var(--md-on-surface-variant); white-space: nowrap; }
/* Two zones, and the pointer says which is which: the pill opens the calendar,
   the numbers take a date typed at the keyboard. */
.filter-date input {
    border: 0; background: none; padding: 0; min-width: 0; width: 108px;
    font: inherit; color: var(--md-on-surface); cursor: text;
}
.filter-date input:focus { outline: none; }
/* A short list of states reads as one of these pills too, not as a boxed
   dropdown parked between them. */
.filter-date select {
    border: 0; background: none; padding: 0; min-width: 0;
    font: inherit; color: var(--md-on-surface); cursor: pointer;
}
.filter-date select:focus { outline: none; }
.filter-date:focus-within { border-color: var(--md-primary); }
/* A search box shaped like the menus beside it. */
.filter-search { display: inline-flex; align-items: center; }
.filter-search input {
    height: 30px; padding: 0 13px; width: 180px;
    border: 1px solid var(--md-outline); border-radius: var(--shape-control);
    background: var(--md-surface); color: var(--md-on-surface);
    font: inherit; font-size: 0.78rem; outline: none;
}
.filter-search input:focus { border-color: var(--md-primary); }
.filter-bar--search { align-items: center; gap: 8px; margin-bottom: 12px; }
/* Everything in these bars is the same height now, so they close up and centre
   instead of hanging off a baseline that no longer varies. */
.filter-bar--live { align-items: center; gap: 8px; }
.filter-dd > summary:hover { background: var(--md-surface-container); }
.filter-dd > summary::-webkit-details-marker { display: none; }
/* The chevron is drawn, not lettered: the icon font is subset and one more
   name in it would mean regenerating the file. */
.filter-dd > summary::after {
    content: ""; width: 6px; height: 6px; margin-left: 2px; opacity: .7;
    border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
    transform: translateY(-2px) rotate(45deg); transition: transform .15s;
}
.filter-dd[open] > summary::after { transform: translateY(1px) rotate(-135deg); }
/* Open, or narrowing the list: either way the button stops looking neutral. */
.filter-dd[open] > summary,
.filter-dd--on > summary {
    background: var(--md-secondary-container);
    border-color: var(--md-secondary-container);
    color: var(--md-on-secondary-container);
    font-weight: 500;
}
.filter-dd__count {
    background: var(--md-primary); color: var(--md-on-primary);
    border-radius: 999px; font-size: 0.68rem; font-weight: 700;
    padding: 0 6px; min-width: 18px; text-align: center; line-height: 1.6;
}

.filter-dd__panel {
    position: absolute; z-index: 30; top: calc(100% + 8px); left: 0;
    min-width: 250px; max-width: 340px; max-height: 340px; overflow-y: auto;
    padding: 6px; border-radius: 14px;
    background: var(--md-surface-container-low);
    border: 1px solid var(--md-outline-variant);
    box-shadow: 0 6px 16px rgba(0,0,0,.16), 0 2px 5px rgba(0,0,0,.10);
}
.filter-dd__opt {
    display: flex; align-items: center; gap: 12px;
    padding: 9px 12px; border-radius: 9px; cursor: pointer;
    font-size: 0.87rem; line-height: 1.3; color: var(--md-on-surface);
}
.filter-dd__opt:hover { background: var(--md-surface-container-high); }
.filter-dd__opt input {
    accent-color: var(--md-primary); width: 17px; height: 17px;
    flex-shrink: 0; margin: 0; cursor: pointer;
}
.filter-dd__opt:has(input:checked) { font-weight: 600; }

/* The panel would be clipped off-screen on a phone, so it lies flat instead. */
@media (max-width: 720px) {
    .filter-dd { width: 100%; }
    .filter-dd > summary { width: 100%; justify-content: space-between; }
    .filter-dd__panel {
        position: static; min-width: 0; max-width: none; margin-top: 6px;
        box-shadow: none;
    }
}

/* ── Tabs ── Links, not script: the chosen one is in the address, so it
   survives the reload that pressing Filtrer causes. */
.tabs {
    display: flex; gap: 2px; margin: 0 0 10px;
    border-bottom: 1px solid var(--md-outline-variant);
    /* Three tabs and a phone: the bar scrolls sideways rather than losing
       the last one off the edge. */
    overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab { flex: 0 0 auto; }
.tab {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 7px 12px; text-decoration: none;
    font-size: 0.84rem; color: var(--md-on-surface-variant);
    border-bottom: 2px solid transparent; margin-bottom: -1px;
    white-space: nowrap;
}
.tab:hover { color: var(--md-on-surface); background: var(--md-surface-container); text-decoration: none; }
.tab--on {
    color: var(--md-primary); font-weight: 600;
    border-bottom-color: var(--md-primary);
}
/* The count is what tells you the other tab is worth opening. */
.tab__count {
    font-size: 0.7rem; font-weight: 600; line-height: 1.5;
    padding: 0 6px; border-radius: 999px;
    background: var(--md-surface-container-high); color: var(--md-on-surface-variant);
}
.tab--on .tab__count { background: var(--md-secondary-container); color: var(--md-on-secondary-container); }

/* The row under the tabs: what belongs to the open tab and nothing else --
   its filters on the left, its report on the right. */
.tab-bar {
    display: flex; align-items: center; gap: 8px;
    flex-wrap: wrap; margin: 0 0 10px;
}
.tab-bar__filters { margin: 0; flex: 1 1 auto; }
.tab-bar__actions {
    display: flex; align-items: center; gap: 8px;
    flex-wrap: wrap; margin-left: auto;
}

@media (max-width: 720px) {
    .tabs { overflow-x: auto; }
    .tab { padding: 7px 10px; }
    .tab-bar__actions { margin-left: 0; width: 100%; justify-content: flex-end; }
}

/* ── A block that folds away ── <details> again, so it opens with no script.
   The closed line carries the figure worth knowing, so folding it costs the
   reader nothing. */
.fold { margin: 0 0 14px; border-radius: 12px; background: var(--md-surface-container-low); }
.fold > summary {
    list-style: none; cursor: pointer; user-select: none;
    display: flex; align-items: center; gap: 10px;
    padding: 10px 14px; font-size: 0.86rem; font-weight: 500;
    color: var(--md-on-surface);
}
.fold > summary::-webkit-details-marker { display: none; }
.fold > summary::after {
    content: ""; width: 6px; height: 6px; margin-left: 4px; opacity: .7;
    border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
    transform: translateY(-2px) rotate(45deg); transition: transform .15s;
    order: -1;
}
.fold[open] > summary::after { transform: translateY(1px) rotate(-135deg); }
.fold__count {
    background: var(--md-surface-container-high); color: var(--md-on-surface-variant);
    border-radius: 999px; font-size: 0.72rem; font-weight: 600;
    padding: 1px 8px; line-height: 1.5;
}
/* Pushed to the far end: it is the answer, the label is only the question. */
.fold__aside { margin-left: auto; font-weight: 600; }
/* ── Repeatable line block inside a form (parts used on a service) ── */
.form-section {
    border-top: 1px solid var(--md-outline-variant);
    padding-top: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.form-section__title {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--md-on-surface-variant);
}
#parts-lines { display: flex; flex-direction: column; gap: 12px; }
/* Part, quantity, and the button that drops the line — the button keeps its
   own width and sits on the fields' baseline. */
.parts-line { grid-template-columns: 1fr 1fr auto; align-items: center; }
.form-section > [data-parts-add] { align-self: flex-start; }

/* ── Selectable checkbox chips (multi-select) ── */
.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 8px;
    margin-top: 8px;
}
.field-label {
    display: block;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--md-on-surface-variant);
}
.checkbox-item {
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border: 1px solid var(--md-outline);
    border-radius: var(--shape-sm);
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--md-on-surface);
    transition: background 0.15s, border-color 0.15s;
}
.checkbox-item:hover { background: var(--md-surface-container); }
.checkbox-item input { accent-color: var(--md-primary); width: 18px; height: 18px; }
.checkbox-item:has(input:checked) {
    background: var(--md-secondary-container);
    border-color: var(--md-secondary-container);
    color: var(--md-on-secondary-container);
}

/* Facturation total banner */
.invoice-total {
    display: flex; align-items: baseline; justify-content: space-between;
    gap: 16px; flex-wrap: wrap;
    margin: 4px 0 16px; padding: 14px 18px;
    border-radius: var(--shape-md);
    background: var(--md-primary-container); color: var(--md-on-primary-container);
}
.invoice-total__label { font-size: 0.85rem; font-weight: 600; }
.invoice-total__value { font-size: 1.5rem; font-weight: 700; }
.data-table tfoot td { border-top: 2px solid var(--md-outline-variant); padding-top: 10px; }

/* ── Chips ── */
.chip {
    display: inline-flex;
    align-items: center;
    height: 28px;
    padding: 0 12px;
    margin: 2px 4px 2px 0;
    background: var(--md-surface-container-high);
    color: var(--md-on-surface-variant);
    border: 1px solid var(--md-outline-variant);
    border-radius: var(--shape-sm);
    font-size: 0.78rem;
    font-weight: 500;
}
/* ── Expense total summary ── */
.expense-total {
    display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap;
    padding: 12px 16px; margin-bottom: 14px;
    background: var(--md-surface-container); border-radius: var(--shape-md);
    font-size: 0.92rem; color: var(--md-on-surface-variant);
}
.expense-total strong { font-size: 1.15rem; color: var(--md-on-surface); }

/* ── Filter bar (select + date inputs) ── */
.filter-bar { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin-bottom: 16px; }
.filter-bar .btn { margin-bottom: 1px; }
.filter-or { color: var(--md-on-surface-variant); font-size: 0.82rem; padding-bottom: 9px; }

/* Filter fields flex to fit the row, then wrap; collapsible "advanced" block. */
.filter-field { flex: 1 1 150px; min-width: 0; max-width: 220px; }
.filter-advanced {
    flex-basis: 100%;
    display: none;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end;
    margin-top: 4px;
    padding-top: 12px;
    border-top: 1px dashed var(--md-outline-variant);
}
.filter-advanced.is-open { display: flex; }
.filter-actions { display: flex; gap: 8px; align-items: flex-end; }
.filter-dot {
    display: inline-block; width: 7px; height: 7px; border-radius: 50%;
    background: var(--c-blue); vertical-align: middle;
}

/* Horizontal scroll for wide tables instead of breaking the mobile layout. */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* Table-on-desktop / cards-on-mobile (batmex pattern). The list-cards block is
   hidden on desktop; on phones the table hides and the cards show instead. */
.list-cards { display: none; }
.list-card {
    background: var(--md-surface);
    border: 1px solid var(--md-outline-variant);
    border-radius: var(--shape-md);
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.list-card__top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.list-card__amount { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.list-card__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 0.85rem; }
.list-card__actions {
    display: flex;
    gap: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--md-outline-variant);
}
.list-card__actions > a, .list-card__actions > form { flex: 1; }
.list-card__actions .btn { width: 100%; justify-content: center; }

@media (max-width: 768px) {
    .table-desktop { display: none; }
    .list-cards { display: flex; flex-direction: column; gap: 10px; }
}

@media (max-width: 768px) {
    .filter-field { flex-basis: 100%; max-width: none; }
    .filter-bar > .btn { flex: 1 1 auto; }
    .filter-advanced .filter-field { flex-basis: 100%; }
    .filter-actions { flex-basis: 100%; }
    .filter-actions .btn { flex: 1 1 auto; }
    /* Any filter-bar field goes full width on phones (overrides inline
       min-widths used on the insights / invoicing / audit pages). */
    .filter-bar .field { flex: 1 1 100% !important; min-width: 0 !important; max-width: none !important; }
    /* Show only the important table columns on phones. */
    .data-table .col-secondary { display: none; }
}

/* ── Filter chips (clickable) ── */
.filter-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.filter-chip {
    height: 34px;
    padding: 0 16px;
    display: inline-flex;
    align-items: center;
    border-radius: var(--shape-control);
    border: 1px solid var(--md-outline-variant);
    color: var(--md-on-surface-variant);
    font-size: 0.82rem;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.filter-chip:hover { background: var(--md-surface-container); text-decoration: none; }
.filter-chip.active { background: var(--accent-gradient); color: #fff; border-color: transparent; }

/* ── Status badges ── */
.badge {
    display: inline-flex;
    align-items: center;
    height: 24px;
    padding: 0 10px;
    border-radius: var(--shape-control);
    font-size: 0.74rem;
    font-weight: 600;
}
.badge--active { background: var(--c-green-bg); color: var(--c-green); }
.badge--inactive { background: var(--md-surface-container-high); color: var(--md-on-surface-variant); }
.badge--warning { background: var(--c-amber-bg); color: var(--c-amber); }

/* ── Definition grid (detail pages) ── */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 18px;
}
.detail-grid dt {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--md-on-surface-variant);
    font-weight: 600;
    margin-bottom: 4px;
}
.detail-grid dd { font-size: 0.98rem; }

/* ── "Coming soon" placeholder cards ── */
.coming-soon { display: flex; align-items: center; gap: 16px; }
.coming-soon .material-symbols-outlined { font-size: 32px; color: var(--md-outline); }
.coming-soon h3 { font-size: 1rem; font-weight: 600; }

/* ── Data tables ── */
.data-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.data-table th {
    text-align: left;
    padding: 12px 16px;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--md-on-surface-variant);
    border-bottom: 1px solid var(--md-outline-variant);
}
.data-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--md-outline-variant);
    vertical-align: middle;
}
.data-table tbody tr { transition: background 0.12s; }
.data-table tbody tr:hover { background: var(--md-surface-container); }
.data-table tr:last-child td { border-bottom: none; }
.data-table code {
    background: var(--md-primary-container);
    color: var(--md-on-primary-container);
    padding: 2px 8px;
    border-radius: var(--shape-xs);
    font-size: 0.82rem;
}
.row-actions { display: flex; gap: 6px; white-space: nowrap; justify-content: flex-end; }
/* …but not on a <td>: display:flex takes the cell out of the table layout, so
   it stops stretching to the row's height and its border-bottom hugs its own
   content instead. On a row where another cell wraps (a fleet with several
   category chips) the separator under the actions column then sits higher than
   the rest of the line. Keep the cell a table-cell and space the buttons with
   margins, since `gap` needs a flex/grid container. */
td.row-actions { display: table-cell; text-align: right; white-space: nowrap; }
td.row-actions > * { vertical-align: middle; }
td.row-actions > * + * { margin-left: 6px; }

/* ── Empty state ── */
/* Nothing to show is not worth half a screen. */
.empty-state { text-align: center; padding: 30px 16px; color: var(--md-on-surface-variant); }
.empty-state .material-symbols-outlined { font-size: 38px; color: var(--md-outline); }
.empty-state .btn, .empty-state .fab { margin-top: 12px; }

/* ── Auth (login) ── */
.auth-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--md-background);
    padding: 16px;
}
.auth-card {
    background: var(--md-surface-container-low);
    padding: 40px;
    border-radius: var(--shape-xl);
    width: min(420px, 100%);
    box-shadow: var(--elev-2);
}
.auth-card__title { font-size: 1.6rem; font-weight: 700; color: var(--md-primary); }
.auth-card__tagline { color: var(--md-on-surface-variant); margin: 4px 0 28px; font-size: 0.9rem; }
.auth-logo { display: block; width: 210px; max-width: 100%; height: auto; margin: 0 auto 28px; }
.auth-name { display: block; text-align: center; font-size: 1.6rem; font-weight: 700; color: var(--md-primary); margin: 0 0 24px; }
.auth-form { gap: 20px; }
.auth-form .btn { margin-top: 8px; height: 48px; }

/* ── Error page ── */
.error-page { text-align: center; padding: 48px 24px; }
.error-page h1 { font-size: 4rem; margin: 0; color: var(--md-primary); font-weight: 700; }
.error-page p { margin: 12px 0 28px; color: var(--md-on-surface-variant); }

/* ── Dashboard: welcome banner + KPI cards ── */
.welcome-banner {
    padding: 28px 32px;
    border-radius: var(--shape-lg);
    background: var(--accent-gradient);
    color: #fff;
    box-shadow: var(--elev-2);
}
.welcome-banner h2 { font-size: 1.4rem; font-weight: 700; margin-bottom: 4px; }
.welcome-banner p { opacity: 0.92; font-size: 0.92rem; }

/* First-login welcome guide */
/* The dashboard's three blocks are children of .content, which already spaces
   them with its own gap. They each carried a margin-top on top of it, so the
   dashboard sat at 32px between blocks while every other page sat at 12. The
   margin goes; the gaps inside the grids match the rest. */
/* The dashboard's period: month or year, stepped with arrows. */
.period-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin: 0 0 14px; }
.period-bar__kind { display: flex; gap: 6px; }
.period-bar__nav { display: flex; align-items: center; gap: 8px; }
.period-bar__label { min-width: 140px; text-align: center; font-size: 1.05rem; }
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 12px;
}
.stat-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    border-radius: var(--shape-lg);
    background: var(--md-surface-container-low);
    border: 1px solid var(--md-outline-variant);
    transition: box-shadow 0.15s, transform 0.15s;
}
.stat-card:hover { box-shadow: var(--elev-2); transform: translateY(-2px); }
.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--shape-md);
    font-size: 28px;
    flex-shrink: 0;
}
.stat-value { font-size: 1.7rem; font-weight: 700; line-height: 1.1; }
.stat-label { font-size: 0.82rem; color: var(--md-on-surface-variant); margin-top: 2px; }
.stat-icon--indigo { background: var(--c-indigo-bg); color: var(--c-indigo); }
.stat-icon--blue   { background: var(--c-blue-bg);   color: var(--c-blue); }
.stat-icon--teal   { background: var(--c-teal-bg);   color: var(--c-teal); }
.stat-icon--green  { background: var(--c-green-bg);  color: var(--c-green); }
.stat-icon--amber  { background: var(--c-amber-bg);  color: var(--c-amber); }
.stat-icon--red    { background: var(--c-red-bg);    color: var(--c-red); }
a.stat-card { text-decoration: none; color: inherit; }
.stat-unit { font-size: 0.9rem; font-weight: 600; color: var(--md-on-surface-variant); }

/* ── Dashboard panels (alerts + activity) ── */
.dash-panels {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 12px;
}
.dash-panel { margin: 0; }
.link-more { font-size: 0.82rem; font-weight: 600; color: var(--c-blue); text-decoration: none; }
.link-more:hover { text-decoration: underline; }
.empty-state--soft { padding: 18px 14px; }
.empty-state--soft .material-symbols-outlined { color: var(--c-green); }

.activity-list { list-style: none; margin: 0; padding: 0; }
.activity-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 2px;
    border-bottom: 1px solid var(--md-outline-variant);
}
.activity-item:last-child { border-bottom: none; }
.activity-main { flex: 1; font-size: 0.9rem; }

/* ── Dashboard charts ── */
.dash-charts {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 12px;
}
@media (max-width: 860px) {
    .dash-charts { grid-template-columns: 1fr; }
}
.dash-chart { margin: 0; }
.chart-box { position: relative; height: 260px; }

/* Print: only the page content (drop the sidebar, topbar and UI chrome). */
@media print {
    .sidebar, .sidebar-overlay, .topbar, .no-print { display: none !important; }
    .main-content { margin-left: 0 !important; }
    .content { padding: 0 !important; gap: 12px !important; }
    .card { box-shadow: none !important; border: 1px solid #ccc; break-inside: avoid; }
    .help-section, .help-tip { break-inside: avoid; }
    a { color: inherit !important; text-decoration: none !important; }
    body { background: #fff !important; }
    /* Paper is white whatever the screen is, so night mode has to step aside
       here -- printed from a dark screen the page would otherwise come out as
       pale grey text on white. The light values, restored for the print only. */
    :root[data-theme="dark"] {
        --md-background:              #fdfbff;
        --md-surface:                 #fdfbff;
        --md-surface-dim:             #dad9e0;
        --md-surface-container-low:   #f5f3fb;
        --md-surface-container:       #efedf5;
        --md-surface-container-high:  #e9e7ef;
        --md-on-surface:              #1b1b1f;
        --md-on-surface-variant:      #46464f;
        --md-outline:                 #777680;
        --md-outline-variant:         #c7c5d0;
        --md-surface-variant:         #e4e1ec;
        color-scheme: light;
    }
}

.pager {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-top: 16px;
}
.pager-info { font-size: 0.85rem; color: var(--md-on-surface-variant); }
/* ── Settings ── */
.settings-group {
    border: 1px solid var(--md-outline-variant);
    border-radius: var(--shape-md);
    padding: 16px 18px 6px;
    margin: 0 0 20px;
}
.settings-group legend {
    padding: 0 8px;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--md-on-surface-variant);
}
.field--error input, .field--error select { border-color: var(--c-red); }
.field-error { font-size: 0.74rem; color: var(--c-red); margin-top: 4px; }

/* ── Ripple ── */
.ripple {
    position: absolute;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.22;
    transform: scale(0);
    animation: ripple 0.5s ease-out;
    pointer-events: none;
}
@keyframes ripple { to { transform: scale(2.4); opacity: 0; } }

/* ── Modal dialog ── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 6vh 16px;
    z-index: 200;
    opacity: 0;
    transition: opacity 0.2s;
    overflow-y: auto;
}
.modal-overlay.open { opacity: 1; }
.modal {
    background: var(--md-surface-container-low);
    border-radius: var(--shape-lg);
    box-shadow: var(--elev-3);
    width: min(720px, 100%);
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    transform: translateY(-10px) scale(0.98);
    transition: transform 0.2s;
}
.modal-overlay.open .modal { transform: none; }
.modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 22px;
    border-bottom: 1px solid var(--md-outline-variant);
}
.modal__header h2 { font-size: 1.1rem; font-weight: 600; }
.modal__close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--md-on-surface-variant);
    width: 36px;
    height: 36px;
    border-radius: var(--shape-control);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.modal__close:hover { background: var(--md-surface-container-high); }
.modal__body { padding: 22px; overflow-y: auto; }
.modal__loading { padding: 48px; text-align: center; color: var(--md-on-surface-variant); }

/* Styled confirm dialog */
.confirm-overlay { align-items: center; }
.modal--confirm { width: min(420px, 100%); }
.confirm__body { padding: 24px 24px 8px; }
.confirm__title { font-size: 1.15rem; font-weight: 600; margin-bottom: 8px; }
.confirm__msg { color: var(--md-on-surface-variant); font-size: 0.95rem; line-height: 1.5; }
.confirm__actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 24px 22px;
}

/* ── Drawer scrim (mobile) ── */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 99;
}
.sidebar-overlay.open { display: block; }

/* ── Compact density pass ──
   Tightens the default Material metrics for a denser, less bulky
   fleet-management UI. Kept as one block so sizing is easy to tune. */
/* One height for every button on the site. A 42px "add" beside a 36px
   "cancel" beside a 30px row action was three scales doing one job, and the
   tallest of them bought its width from nothing. .btn--sm is kept as an alias
   so the templates that ask for it still read sensibly. */
.btn, .btn--sm { height: 30px; padding: 0 13px; font-size: 0.78rem; }
/* Square at that height. Must come after the rule above, which would otherwise
   re-apply its horizontal padding to icon buttons. */
.btn--icon, .btn--icon.btn--sm { width: 30px; padding: 0; }
.btn .material-symbols-outlined { font-size: 17px; }
.btn--icon .material-symbols-outlined { font-size: 18px; }
/* The add button keeps its accent fill and its softer corner -- still the main
   action of a page, no longer a taller one. */
.fab { height: 30px; padding: 0 14px; border-radius: var(--shape-md); font-size: 0.78rem; box-shadow: var(--elev-1); }
.fab:hover { box-shadow: var(--elev-2); }
.fab .material-symbols-outlined { font-size: 17px; }

/* Plain text -- anything with no size of its own -- was left at the root size
   while tables, fields and headings each came down. Inside a card that made an
   ordinary sentence the largest thing on it, bigger than the card's own title.
   It joins the table text at 0.9rem, which puts the ladder back in order:
   heading 0.98, field 0.92, text and tables 0.9, muted 0.8. */
body { font-size: 0.9rem; }

/* ── Display type ──
   The body text already came down by its root size; these are the headings and
   the big figures, which were set when the rest was larger and now stood out
   of proportion. Cut by roughly a tenth each, so the steps between them keep
   the same ratios. Grouped here with the other density settings rather than
   edited in place, so the scale can be read and retuned in one look. */
.topbar { height: 52px; padding: 0 16px; }
.page-title { font-size: 1.05rem; }
.card-header h2, .modal__header h2, .help-section__head h2 { font-size: 0.98rem; }
.confirm__title { font-size: 1.05rem; }
.auth-card__title { font-size: 1.4rem; }
.welcome-banner h2 { font-size: 1.08rem; }
.welcome-hero h2 { font-size: 1.15rem; }
.stat-value { font-size: 1.28rem; }
/* The figures a page is read for: smaller, still the largest thing on it. */
.caisse-balance strong { font-size: 1.2rem; }
.expense-total strong { font-size: 1.05rem; }
.invoice-total__value, .mv-total__val, .flux-machine__litres b { font-size: 1.32rem; }
.flux-stock { font-size: 1.8rem; }
.error-page h1 { font-size: 3.2rem; }

.sidebar-nav a { height: 46px; font-size: 0.86rem; }
.sidebar-nav a.sidebar-sub { height: 42px; }

.content { padding: 14px; gap: 12px; }
.card { padding: 14px; }
.card-header { margin-bottom: 10px; }

.auth-form .btn { height: 44px; }

.data-table th { padding: 7px 12px; }
.data-table td { padding: 8px 12px; }

.welcome-banner { padding: 16px 20px; }
.stat-card { padding: 13px; gap: 12px; }
.stat-icon { width: 46px; height: 46px; font-size: 24px; }

.chip { height: 24px; padding: 0 10px; }
.filter-chip { height: 30px; padding: 0 14px; }

/* ── Responsive ── */
@media screen and (max-width: 768px) {
    .menu-toggle { display: inline-flex; }
    .sidebar {
        position: fixed;
        top: 0; left: 0;
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        z-index: 100;
        box-shadow: var(--elev-3);
    }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .topbar { padding: 0 12px; }
    .page-title { font-size: 1rem; }
    .topbar .lang-toggle { display: none; }
    /* ...but the bell and reload stay: they are what a phone needs most. */
    .topbar .bell__btn, .topbar #reload-page { display: inline-flex; min-width: 40px; padding: 0 8px; }
    .bell__panel { position: fixed; top: 58px; left: 12px; right: 12px; width: auto; }
    /* Tighter still on a phone, where every pixel of width is the content's.
       Not below 10px: a card would look stuck to the edge of the screen. */
    /* clip, not hidden: hidden would make it a scroll box, and break what
       sticks to the top while scrolling (the checklist's progress). */
    .content { padding: 10px; gap: 10px; overflow-x: clip; }
    .card { padding: 12px; min-width: 0; }
    .form-row { grid-template-columns: 1fr; }
    /* Keep the quantity and its remove button side by side when stacked */
    .parts-line { grid-template-columns: 1fr auto; gap: 12px; }
    .parts-line .field--select { grid-column: 1 / -1; }

    /* Alerts: stack body over full-width actions instead of cramming side by side */
    .alert-card { flex-direction: column; align-items: stretch; gap: 12px; }
    .alert-card__actions { flex-wrap: wrap; }
    .alert-card__actions > form { flex: 1 1 auto; }
    .alert-card__actions .btn { width: 100%; justify-content: center; }
    .alert-card__msg { font-size: 0.9rem; word-break: break-word; }
}

/* The reload button turns while the page comes back. */
#reload-page.is-spinning .material-symbols-outlined { animation: reload-spin 0.8s linear infinite; }
@keyframes reload-spin { to { transform: rotate(360deg); } }

/* ── First-run checklist (dashboard) ── */
.welcome-hero { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 20px; }
.welcome-hero__icon {
    font-size: 34px; flex-shrink: 0;
    color: var(--md-primary);
    background: var(--md-primary-container);
    width: 56px; height: 56px; border-radius: var(--shape-md);
}
.tour-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.tour-step {
    display: flex; align-items: center; gap: 14px;
    padding: 12px 14px;
    border: 1px solid var(--md-outline-variant);
    border-radius: var(--shape-md);
}
.tour-step.is-done { background: var(--md-surface-container-low); border-color: transparent; }
.tour-step__num {
    flex-shrink: 0; width: 28px; height: 28px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 0.85rem;
    background: var(--md-secondary-container); color: var(--md-on-secondary-container);
}
.tour-step.is-done .tour-step__num { background: var(--c-green-bg); color: var(--c-green); }
.tour-step.is-done .tour-step__num .material-symbols-outlined { font-size: 18px; }
.tour-step__icon { font-size: 22px; color: var(--md-on-surface-variant); flex-shrink: 0; }
.tour-step__body { flex: 1; min-width: 0; }
.tour-step__title { font-weight: 600; }
.tour-step__go { flex-shrink: 0; }
.welcome-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 22px; }
@media (max-width: 600px) {
    .tour-step__icon { display: none; }
    .tour-step__desc { display: none; }
}

/* The error journal: one row per error, the trace folded under it. */
.error-event { border-top: 1px solid var(--md-outline-variant); padding: 8px 0; }
.error-event summary { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; cursor: pointer; font-size: 0.9rem; }
.error-event__msg { color: var(--md-error); font-size: 0.85rem; flex-basis: 100%; }
.error-event__trace { font-size: 0.75rem; white-space: pre-wrap; word-break: break-word; background: var(--md-surface); border: 1px solid var(--md-outline-variant); border-radius: var(--shape-sm); padding: 10px; max-height: 420px; overflow: auto; margin: 6px 0 0; }

/* ── Fels additions ── */
/* Logout is a POST (a link could be fired by any page), so the round icon is
   a button inside a form and must lose the browser's button chrome. */
.sidebar-user form { display: contents; }
button.logout-btn { background: none; border: 0; cursor: pointer; font: inherit; padding: 0; }

/* A card header's right-hand group (archived toggle + add) and a detail
   page's left-hand group (back arrow + title + badge). */
.header-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.header-title { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* An amount in its own currency, and beneath it the same amount in the
   other currency, in grey: the second figure is for orientation, the first
   is the one that was agreed. */
.money { white-space: nowrap; font-variant-numeric: tabular-nums; }
.money-alt { display: block; font-size: 0.76rem; color: var(--md-on-surface-variant); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* Today's rate in the top bar; amber until someone sets it. */
/* Red, not amber: amber sits too close to the orange brand to read as a warning. */

/* Model categories, one colour each, the same everywhere a model is shown. */
.chip--cat-tractor { background: var(--c-blue-bg);   color: var(--c-blue);   border-color: transparent; }
.chip--cat-trailer { background: var(--c-teal-bg);   color: var(--c-teal);   border-color: transparent; }
.chip--cat-truck   { background: var(--c-indigo-bg); color: var(--c-indigo); border-color: transparent; }
.chip--cat-pickup  { background: var(--c-amber-bg);  color: var(--c-amber);  border-color: transparent; }

/* The language and theme switches under the login card. */
.auth-card .lang-toggle { display: inline-flex; }

/* Row actions on a phone card: the same small round buttons as on the
   table row, grouped at the right, instead of one stretched pill beside
   one round button. */
.list-card__actions { justify-content: flex-end; }
.list-card__actions > a, .list-card__actions > form { flex: 0 0 auto; }
.list-card__actions .btn.btn--icon { width: 34px; height: 34px; }

/* ── Atelier finishing ── */
/* Cards: white on the grey page, a hairline and a breath of shadow. */
.card, .stat-card { box-shadow: var(--elev-1); }
.stat-card:hover { box-shadow: var(--elev-2); }
/* Titles carry a little more weight in Barlow. */
.page-title { font-weight: 700; letter-spacing: 0.01em; }
.card-header h2 { font-weight: 700; }
.data-table th { color: var(--md-on-surface-variant); }
/* The scrim behind the drawer on a phone. */
.sidebar-overlay { background: var(--nav-scrim); }

/* ── Dropdown filters ──
   A labelled select shaped like the search box beside it: the label says
   what is being narrowed, the select which value. It turns tinted once it
   narrows the list, so a filtered page never passes for the whole list. */
.filter-select {
    display: inline-flex; align-items: center; gap: 6px;
    height: 30px; padding: 0 4px 0 11px;
    border: 1px solid var(--md-outline); border-radius: var(--shape-control);
    background: var(--md-surface); font-size: 0.78rem; cursor: pointer;
}
.filter-select > span { color: var(--md-on-surface-variant); white-space: nowrap; }
.filter-select > span, .filter-select select { line-height: 1; }
.filter-select select {
    height: 28px; border: 0; background: transparent; color: var(--md-on-surface);
    font: inherit; font-weight: 600; padding: 0 2px; max-width: 190px; cursor: pointer;
}
.filter-select select:focus { outline: none; }
.filter-select:focus-within { border-color: var(--md-primary); }
.filter-select--on { background: var(--md-primary-container); border-color: transparent; }
.filter-select--on > span, .filter-select--on select { color: var(--md-on-primary-container); }
@media (max-width: 768px) {
    .filter-select { flex: 1 1 100%; justify-content: space-between; }
    .filter-select select { max-width: none; flex: 1; text-align: right; }
    .filter-search, .filter-search input { flex: 1 1 100%; width: 100%; }
}

/* Figures line up on the right, the grey conversion under them too. */
.data-table th.num, .data-table td.num { text-align: right; white-space: nowrap; }
.data-table td.num .money-alt { text-align: right; }
.data-table td.num .badge + .money-alt { margin-top: 2px; }

/* ── Status badges ── */
.badge--stage-ordered  { background: var(--md-surface-container-high); color: var(--md-on-surface-variant); }
.badge--stage-shipped  { background: var(--c-blue-bg);   color: var(--c-blue); }
.badge--stage-at_port  { background: var(--c-indigo-bg); color: var(--c-indigo); }
.badge--stage-customs  { background: var(--c-amber-bg);  color: var(--c-amber); }
.badge--stage-cleared  { background: var(--c-teal-bg);   color: var(--c-teal); }
.badge--stage-in_stock { background: var(--c-green-bg);  color: var(--c-green); }
.badge--pay-paid      { background: var(--c-green-bg); color: var(--c-green); }
.badge--pay-partial   { background: var(--c-amber-bg); color: var(--c-amber); }
.badge--pay-unpaid    { background: var(--c-red-bg);   color: var(--c-red); }
.badge--pay-cancelled { background: var(--md-surface-container-high); color: var(--md-on-surface-variant); }
.badge--unit-available { background: var(--c-green-bg); color: var(--c-green); }
.badge--unit-reserved  { background: var(--c-amber-bg); color: var(--c-amber); }
.badge--unit-delivered { background: var(--md-surface-container-high); color: var(--md-on-surface-variant); }
.badge { white-space: nowrap; }

/* A voided payment stays in the list, struck through. */
.row-voided td { color: var(--md-on-surface-variant); }
.row-voided td.num .money { text-decoration: line-through; }
.voided-note { color: var(--c-red); }

.empty-state--plain { padding: 14px 8px; }
.form-row--3 { grid-template-columns: 1fr 1fr 1fr; }
@media (max-width: 768px) { .form-row--3 { grid-template-columns: 1fr; } }
a.list-card--link { color: inherit; text-decoration: none; }
a.list-card--link:hover { border-color: var(--md-primary); }

/* ── Pipeline board ── one column per stage, scrolled sideways on a phone. */
.pipeline-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.pipeline-head p { margin: 0; }
.pipeline {
    display: grid; grid-template-columns: repeat(5, minmax(176px, 1fr)); gap: 10px;
    overflow-x: auto; padding-bottom: 6px; align-items: start;
}
.pipeline-col { background: var(--md-surface-container); border-radius: var(--shape-lg); padding: 10px; min-height: 160px; }
.pipeline-col__head {
    display: flex; justify-content: space-between; align-items: center;
    padding: 2px 4px 10px; border-bottom: 3px solid var(--md-outline-variant); margin-bottom: 10px;
}
.pipeline-col--shipped .pipeline-col__head { border-color: var(--c-blue); }
.pipeline-col--at_port .pipeline-col__head { border-color: var(--c-indigo); }
.pipeline-col--customs .pipeline-col__head { border-color: var(--c-amber); }
.pipeline-col--cleared .pipeline-col__head { border-color: var(--c-teal); }
.pipeline-col__title { font-weight: 700; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.04em; }
.pipeline-col__count {
    min-width: 24px; height: 22px; padding: 0 7px; border-radius: var(--shape-full);
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--md-surface); font-size: 0.75rem; font-weight: 700;
}
.pipeline-col__body { display: flex; flex-direction: column; gap: 8px; }
.pipeline-col__empty { text-align: center; color: var(--md-outline); padding: 18px 0; }
.pipe-card {
    background: var(--md-surface); border: 1px solid var(--md-outline-variant); border-radius: var(--shape-md);
    padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; box-shadow: var(--elev-1);
}
.pipe-card__title { font-weight: 700; color: var(--md-on-surface); }
.pipe-card__meta { font-size: 0.78rem; color: var(--md-on-surface-variant); }
.pipe-card__lines { display: flex; flex-wrap: wrap; gap: 2px; }
.pipe-card__lines .chip { height: 22px; font-size: 0.72rem; padding: 0 8px; }
.pipe-card__foot { display: flex; justify-content: space-between; align-items: center; gap: 6px; margin-top: 2px; }
.pipe-card__days { display: inline-flex; align-items: center; gap: 4px; font-size: 0.76rem; color: var(--md-on-surface-variant); }
.pipe-card__days .material-symbols-outlined { font-size: 16px; }
.pipe-card__days--late { color: var(--c-red); font-weight: 700; }

/* ── Stage timeline (purchase page) ── */
.timeline { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(6, 1fr); }
.timeline__step { position: relative; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; padding: 0 4px; }
.timeline__step::before {
    content: ""; position: absolute; top: 15px; left: -50%; width: 100%; height: 3px;
    background: var(--md-outline-variant); z-index: 0;
}
.timeline__step:first-child::before { display: none; }
.timeline__step.is-done::before, .timeline__step.is-current::before { background: var(--md-primary); }
.timeline__dot {
    position: relative; z-index: 1; width: 32px; height: 32px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--md-surface-container-high); color: var(--md-on-surface-variant);
    font-weight: 700; font-size: 0.85rem; border: 3px solid var(--md-surface);
}
.timeline__dot .material-symbols-outlined { font-size: 18px; }
.timeline__step.is-done .timeline__dot { background: var(--md-primary); color: var(--md-on-primary); }
.timeline__step.is-current .timeline__dot { background: var(--md-primary-container); color: var(--md-on-primary-container); box-shadow: 0 0 0 2px var(--md-primary); }
.timeline__label { font-size: 0.8rem; font-weight: 600; }
.timeline__step.is-current .timeline__label { color: var(--md-primary); }
.timeline__date { font-size: 0.74rem; color: var(--md-on-surface-variant); min-height: 1em; }
@media (max-width: 768px) {
    .timeline { grid-template-columns: 1fr; gap: 8px; }
    .timeline__step { flex-direction: row; text-align: left; gap: 10px; }
    .timeline__step::before { display: none; }
    .timeline__date { margin-left: auto; }
}

/* ── Lines editor (purchase form) ── */
.lines-editor { min-width: 720px; }
.lines-editor td { vertical-align: top; padding: 6px 6px; }
.lines-editor .lines-col-qty { width: 90px; }
.lines-editor .lines-col-price { width: 170px; }
.lines-editor .lines-col-total { width: 160px; }
.lines-editor .lines-col-x { width: 46px; }
.lines-editor select, .lines-editor input[type="text"], .lines-editor input[type="number"] {
    width: 100%; height: 36px; padding: 0 10px;
    border: 1px solid var(--md-outline-variant); border-radius: var(--shape-sm);
    background: var(--md-surface); color: var(--md-on-surface); font: inherit; font-size: 0.88rem;
}
.lines-editor input.num { text-align: right; }
.lines-editor .line-desc { margin-top: 4px; height: 30px; font-size: 0.8rem; }
.lines-editor select:focus, .lines-editor input:focus { border-color: var(--md-primary); outline: none; }
.lines-editor .line-total { line-height: 36px; font-weight: 600; }
.lines-editor tfoot td { vertical-align: middle; }

/* ── Sales ── */
.badge--sale-preorder  { background: var(--c-purple-bg); color: var(--c-purple); }
.badge--sale-confirmed { background: var(--c-blue-bg);   color: var(--c-blue); }
.badge--sale-delivered { background: var(--c-green-bg);  color: var(--c-green); }
.badge--sale-cancelled { background: var(--md-surface-container-high); color: var(--md-on-surface-variant); }
.lines-editor .lines-col-unit { width: 34%; }
.deliver-list { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; font-size: 0.9rem; }

/* ── Dashboard ── */
/* Chart series colours, validated for both modes (dataviz checks: lightness
   band, chroma, colour-blind separation, contrast against the surface). */
:root { --chart-in: #0d9488; --chart-out: #2563eb; }
:root[data-theme="dark"] { --chart-in: #26a596; --chart-out: #4f8fe8; }
.stat-parts { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 2px; font-size: 0.76rem; color: var(--md-on-surface-variant); font-variant-numeric: tabular-nums; }
.stat-sub { font-size: 0.74rem; color: var(--md-on-surface-variant); margin-top: 2px; }
.stat-grid--compact .stat-value { font-size: 1.2rem; }
.chart-table { margin-top: 10px; }
.chart-table > summary { cursor: pointer; font-size: 0.8rem; color: var(--md-primary); font-weight: 600; }
.chart-table[open] > summary { margin-bottom: 8px; }
.attention-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.attention-list li { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 0; border-bottom: 1px solid var(--md-outline-variant); }
.attention-list li:last-child { border-bottom: 0; }
.attention-list__aside { margin-left: auto; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.link-more { font-size: 0.8rem; font-weight: 600; }

/* Ledger: money in, money out. */
.badge--dir-in  { background: var(--c-teal-bg); color: var(--c-teal); }
.badge--dir-out { background: var(--c-amber-bg); color: var(--c-amber); }
.filter-select input[type="date"] { border: 0; background: transparent; color: var(--md-on-surface); font: inherit; font-weight: 600; height: 28px; }
.filter-select input[type="date"]:focus { outline: none; }

/* ── Import ── */
.import-steps { margin: 0 0 16px 18px; padding: 0; display: flex; flex-direction: column; gap: 4px; color: var(--md-on-surface-variant); font-size: 0.88rem; }
.import-form { display: flex; flex-direction: column; gap: 12px; }
.import-map td { vertical-align: top; }
.import-map select, .import-map input[type="text"] {
    height: 34px; padding: 0 10px; border: 1px solid var(--md-outline-variant); border-radius: var(--shape-sm);
    background: var(--md-surface); color: var(--md-on-surface); font: inherit; font-size: 0.86rem; max-width: 100%;
}
.import-map .js-new { display: flex; gap: 6px; flex-wrap: wrap; }
.import-map .js-new.is-off { visibility: hidden; }
.import-warn td { padding-top: 0; border-bottom: 1px solid var(--md-outline-variant); }
.import-warn span { display: inline-block; margin: 0 6px 4px 0; padding: 2px 8px; border-radius: var(--shape-sm);
                    background: var(--c-amber-bg); color: var(--c-amber); font-size: 0.76rem; font-weight: 600; }
.card-header .checkbox-item { margin: 0; }

/* ── Ma signature: the form beside a live preview of the stamp ── */
.sig-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; align-items: start; }
.sig-label { display: block; font-size: 0.75rem; font-weight: 600; color: var(--md-on-surface-variant); text-transform: uppercase; letter-spacing: 0.04em; }
.sig-preview__stamp { width: 320px; height: 320px; display: flex; align-items: center; justify-content: center;
                      background: #fff; border: 1px dashed var(--md-outline-variant); border-radius: var(--shape-md); margin: 6px 0 8px; }
.sig-preview__stamp img { width: 320px; height: 320px; }
.sig-upload { margin-top: 4px; }
.sig-picked { margin-left: 8px; }
.sig-inks__row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 6px; }
.sig-ink { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--md-surface); box-shadow: 0 0 0 1px var(--md-outline-variant); cursor: pointer; padding: 0; }
.sig-ink.is-on { box-shadow: 0 0 0 2px var(--md-primary); }
.sig-inks__row input[type="color"] { width: 38px; height: 30px; padding: 0 2px; border: 1px solid var(--md-outline-variant); border-radius: var(--shape-sm); background: var(--md-surface); cursor: pointer; }
.sig-sliders { display: grid; gap: 6px; max-width: 440px; }
.sig-sliders label { display: grid; grid-template-columns: 110px 1fr; align-items: center; gap: 10px; font-size: 0.85rem; color: var(--md-on-surface-variant); }
.sig-sliders input[type="range"] { width: 100%; accent-color: var(--md-primary); }
.sig-sliders button { justify-self: start; margin-top: 4px; }
@media (max-width: 860px) { .sig-layout { grid-template-columns: 1fr; } }

/* ── The bell: a drop-down under its button (a <details>, so it opens with
   no script), the count refreshed in the background. ── */
.bell { position: relative; }
.bell > summary { list-style: none; position: relative; }
.bell > summary::-webkit-details-marker { display: none; }
.bell__count {
    position: absolute; top: 4px; right: 0; min-width: 18px; height: 18px; padding: 0 5px;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--md-primary); color: var(--md-on-primary); border-radius: var(--shape-full);
    font-size: 0.68rem; font-weight: 700; line-height: 1; border: 2px solid var(--md-background);
}
.bell__panel {
    position: absolute; right: 0; top: calc(100% + 6px); z-index: 30;
    width: min(400px, calc(100vw - 32px)); max-height: 72vh; overflow-y: auto;
    background: var(--md-surface); color: var(--md-on-surface);
    border: 1px solid var(--md-outline-variant); border-radius: var(--shape-lg);
    box-shadow: var(--elev-3); padding: 6px 0;
}
.bell__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 14px; border-bottom: 1px solid var(--md-outline-variant); }
.bell__item { display: flex; gap: 10px; align-items: flex-start; padding: 9px 14px; color: inherit; font-size: 0.86rem; line-height: 1.35; }
.bell__item:hover { background: var(--md-surface-container); text-decoration: none; }
.bell__item .material-symbols-outlined { font-size: 20px; flex: none; margin-top: 1px; }
.bell__item--action .material-symbols-outlined { color: var(--md-primary); }
.bell__item--warn .material-symbols-outlined { color: var(--c-amber); }
.bell__item--info .material-symbols-outlined { color: var(--md-on-surface-variant); }
.bell__empty { display: flex; gap: 8px; align-items: center; padding: 14px; margin: 0; color: var(--md-on-surface-variant); font-size: 0.86rem; }
.bell__empty .material-symbols-outlined { color: var(--c-green); }
.bell__all { display: block; text-align: center; padding: 9px 14px 6px; font-size: 0.82rem; font-weight: 600; border-top: 1px solid var(--md-outline-variant); }
@media screen and (max-width: 768px) {
    .topbar .bell__btn { display: inline-flex; min-width: 40px; padding: 0 8px; }
    .bell__panel { position: fixed; top: 58px; left: 12px; right: 12px; width: auto; }
}

/* The alerts page: one card per kind. */
.alert-kind__head { display: flex; gap: 10px; align-items: center; }
.alert-kind__head .material-symbols-outlined { font-size: 22px; }
.alert-kind--action .alert-kind__head .material-symbols-outlined { color: var(--md-primary); }
.alert-kind--warn .alert-kind__head .material-symbols-outlined { color: var(--c-amber); }
.alert-kind--info .alert-kind__head .material-symbols-outlined { color: var(--md-on-surface-variant); }
.alert-kind__count { min-width: 22px; height: 22px; padding: 0 7px; border-radius: var(--shape-full); display: inline-flex; align-items: center; justify-content: center; background: var(--md-surface-container-high); font-size: 0.75rem; font-weight: 700; }

/* The Vehicles page's tabs, first thing in its card. */
.card > .tabs:first-child { margin: -4px 0 12px; }
.tab .material-symbols-outlined { font-size: 18px; }

/* ── Compact navigation ──
   Every entry fits a laptop screen (about 650px of window height) with no
   scrolling; under 620px the rows tighten once more: tighter rows, slimmer section labels, a smaller logo, and the
   user block on two short lines. A shorter window tightens once more. If a
   screen is shorter still, the list scrolls and the user block stays put. */
.sidebar { padding: 8px 10px 10px; }
.sidebar-logo { padding: 4px 10px 8px; margin-bottom: 12px; }   /* air between the logo and the menu */
.sidebar-logo-img { width: 100px; }
.sidebar-nav { gap: 2px; }
.sidebar-nav a, .sidebar-nav a.sidebar-sub { height: 36px; padding: 0 12px; gap: 11px; font-size: 0.84rem; }
.sidebar-nav a .nav-icon, .sidebar-nav a .material-symbols-outlined { font-size: 19px; }
.sidebar-section { padding: 12px 12px 5px; font-size: 0.64rem; line-height: 1.2; letter-spacing: 0.09em; }
.sidebar-nav > li:first-child + .sidebar-section { padding-top: 10px; }

.sidebar-user {
    margin-top: 6px; padding: 8px 8px 8px 12px;
    flex-direction: column; align-items: stretch; gap: 6px;
}
.sidebar-user-info { flex-direction: row; align-items: baseline; gap: 6px; }
.sidebar-user-name { font-size: 0.82rem; }
/* A long role name ("Staff Medical Follow-up Officer") wraps on two lines at
   most, then ends in "…": it never pushes the block out of the drawer. */
.sidebar-user-role { font-size: 0.68rem; line-height: 1.25; max-width: 100%; overflow: hidden; overflow-wrap: anywhere;
    display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; }
.sidebar-user-actions { display: flex; gap: 4px; }
.sidebar-user-actions form { display: contents; }
.sidebar-icon-btn {
    width: 34px; height: 30px; flex: 1 1 0;
    display: inline-flex; align-items: center; justify-content: center;
    border: 0; border-radius: var(--shape-control); background: var(--nav-hover);
    color: var(--nav-fg); cursor: pointer; font: inherit; text-decoration: none;
    transition: background 0.15s, color 0.15s;
}
.sidebar-icon-btn .material-symbols-outlined { font-size: 18px; }
.sidebar-icon-btn--text { font-size: 0.74rem; font-weight: 700; letter-spacing: 0.04em; }
.sidebar-icon-btn:hover { background: var(--nav-hover-strong); color: var(--nav-active-fg); text-decoration: none; }
.sidebar-icon-btn.is-on { background: var(--nav-active-bg); color: var(--nav-active-fg); }
.sidebar-icon-btn--out:hover { background: var(--md-error-container); color: var(--md-on-error-container); }

@media (max-height: 620px) {
    .sidebar-nav a, .sidebar-nav a.sidebar-sub { height: 30px; }
    .sidebar-section { padding: 6px 12px 2px; }
    .sidebar-logo { padding-bottom: 4px; margin-bottom: 8px; }
    .sidebar-logo-img { width: 92px; }
}

/* ── Users and roles ── */
.badge--role-super { background: var(--md-primary-container); color: var(--md-on-primary-container); }
.role-list { display: flex; flex-direction: column; gap: 10px; }
.role-card { border: 1px solid var(--md-outline-variant); border-radius: var(--shape-md); padding: 12px 14px; }
.role-card__head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.role-card__perms { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 10px; }
.perm-pill { font-size: 0.72rem; font-weight: 600; padding: 2px 8px; border-radius: var(--shape-sm); white-space: nowrap; }
.perm-pill--none { background: transparent; color: var(--md-outline); border: 1px dashed var(--md-outline-variant); text-decoration: line-through; }
.perm-pill--view { background: var(--c-blue-bg); color: var(--c-blue); }
.perm-pill--manage, .perm-pill--yes { background: var(--c-green-bg); color: var(--c-green); }
.perm-quick { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.perm-grid { display: flex; flex-direction: column; }
.perm-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--md-outline-variant); flex-wrap: wrap; }
.perm-row:last-child { border-bottom: 0; }
.perm-row__label { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1 1 260px; }
/* A segmented choice: no access | read | manage. */
.seg { display: inline-flex; border: 1px solid var(--md-outline-variant); border-radius: var(--shape-control); overflow: hidden; flex: none; }
.seg__opt { position: relative; cursor: pointer; }
.seg__opt input { position: absolute; opacity: 0; pointer-events: none; }
.seg__opt span { display: inline-block; padding: 6px 12px; font-size: 0.8rem; font-weight: 600; color: var(--md-on-surface-variant); }
.seg__opt + .seg__opt span { border-left: 1px solid var(--md-outline-variant); }
.seg__opt:hover span { background: var(--md-surface-container); }
.seg__opt input:checked + span { background: var(--md-surface-container-high); color: var(--md-on-surface); }
.seg__opt--view input:checked + span { background: var(--c-blue-bg); color: var(--c-blue); }
.seg__opt--manage input:checked + span, .seg__opt--yes input:checked + span { background: var(--c-green-bg); color: var(--c-green); }
.seg__opt input:focus-visible + span { outline: 2px solid var(--md-primary); outline-offset: -2px; }

/* ── A field: its label, the "?" beside it, the control, then any note ──
   A grid rather than a column, so the explanation mark sits on the label's
   own line instead of under the control, and a short note (Facultatif.) or
   an error still follows the control. */
.field { display: grid; grid-template-columns: auto 1fr; column-gap: 6px; row-gap: 6px; align-items: center; }
.field > label { grid-row: 1; grid-column: 1; order: 0; }
.field > .hint-dot { grid-row: 1; grid-column: 2; justify-self: start; margin-left: 0; position: relative; vertical-align: baseline; }
.field > input, .field > select, .field > textarea, .field > .field-hint, .field > .field-error,
.field > div, .field > p { grid-column: 1 / -1; }
.field > input, .field > select, .field > textarea { grid-row: 2; }
.field > .field-hint { margin-top: -2px; }
/* On the label's line the explanation opens downward, aligned to the mark:
   upward it would be cut off at the top of a dialog. */
.field > .hint-dot::after {
    top: calc(100% + 8px); bottom: auto; left: -6px; transform: none;
    max-width: min(280px, calc(100vw - 48px));
}

/* Activity log (Journaux). The action is a badge coloured by its kind: what
   adds is green, what changes blue, what removes or undoes red, the steps of
   a sale or a purchase teal, sign-ins neutral and a refused one amber. */
.audit-table td { vertical-align: top; }
.audit-detail { max-width: 420px; overflow-wrap: anywhere; font-size: 0.86rem; }
.nowrap { white-space: nowrap; }
.audit-action {
    display: inline-block;
    padding: 2px 9px;
    border-radius: var(--shape-control);
    font-size: 0.72rem;
    font-weight: 600;
    white-space: nowrap;
    background: var(--md-surface-container-high);
    color: var(--md-on-surface-variant);
}
.audit-action--create, .audit-action--restore, .audit-action--import { background: var(--c-green-bg); color: var(--c-green); }
.audit-action--update   { background: var(--c-blue-bg);  color: var(--c-blue); }
.audit-action--delete, .audit-action--void, .audit-action--cancel,
.audit-action--archive, .audit-action--undeliver { background: var(--c-red-bg); color: var(--c-red); }
.audit-action--stage, .audit-action--confirm, .audit-action--deliver { background: var(--c-teal-bg); color: var(--c-teal); }
.audit-action--login_failed { background: var(--c-amber-bg); color: var(--c-amber); }


/* ── Brand: the client's logo, or their name when none is uploaded ──
   The logo is an upload (Paramètres), never part of the code. A logo made for
   a white background sits on a white plate at night when no night version was
   uploaded, so a black wordmark never disappears into the dark drawer. */
.brand-logo { display: block; max-width: 100%; height: auto; }
.sidebar-logo-img.brand-logo { width: 170px; }
:root[data-theme="dark"] .brand-logo--plate {
    background: #FFFFFF; border-radius: var(--shape-md); padding: 6px 8px;
}
.brand-name { font-size: 1.15rem; font-weight: 700; color: var(--md-primary); letter-spacing: 0.01em; }

/* ── Module not built yet ── */
.nav-soon {
    margin-left: auto; font-size: 0.62rem; font-weight: 600; letter-spacing: 0.04em;
    text-transform: uppercase; color: var(--nav-fg-muted);
}
.sidebar-nav a.is-soon { color: var(--nav-fg-muted); }
.soon-card { max-width: 640px; }
.soon-card .material-symbols-outlined.soon-icon { font-size: 40px; color: var(--md-primary); }

/* ── Setup checklist on the dashboard ── */
.setup-list { list-style: none; display: grid; gap: 8px; }
.setup-step {
    display: flex; align-items: center; gap: 12px; padding: 10px 12px;
    border: 1px solid var(--md-outline-variant); border-radius: var(--shape-md);
    background: var(--md-surface);
}
.setup-step .material-symbols-outlined { color: var(--md-on-surface-variant); }
.setup-step--done .material-symbols-outlined { color: var(--md-success); }
.setup-step--done .setup-step__label { color: var(--md-on-surface-variant); text-decoration: line-through; }
.setup-step__label { flex: 1; }

/* ── Scope pickers on the user form: sites and fleets as tick boxes ── */
.scope-box { border: 1px solid var(--md-outline-variant); border-radius: var(--shape-md); padding: 12px; }
.scope-box legend { padding: 0 6px; font-weight: 600; font-size: 0.85rem; }
.scope-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 6px; margin-top: 8px; }

/* ── Audit: what changed, field by field ── */
.audit-changes { display: grid; gap: 2px; font-size: 0.8rem; }
.audit-changes code { font-size: 0.78rem; }

/* The day logo, or the night one when the theme is dark. */
.brand-logo--night { display: none; }
:root[data-theme="dark"] .brand-logo--day { display: none; }
:root[data-theme="dark"] .brand-logo--night { display: block; }
.auth-logo.brand-logo { margin: 0 auto 28px; }

/* ── Vehicle technical status ── */
.badge--vs-available      { background: var(--c-green-bg); color: var(--c-green); }
.badge--vs-maintenance    { background: var(--c-amber-bg); color: var(--c-amber); }
.badge--vs-accident       { background: var(--c-red-bg);   color: var(--c-red); }
.badge--vs-out_of_service { background: var(--md-surface-container-high); color: var(--md-on-surface-variant); }

/* ── Papers: in force, about to lapse, lapsed, never entered ── */
.badge--paper-valid   { background: var(--c-green-bg); color: var(--c-green); }
.badge--paper-soon    { background: var(--c-amber-bg); color: var(--c-amber); }
.badge--paper-expired { background: var(--c-red-bg);   color: var(--c-red); }
.badge--paper-missing { background: transparent; color: var(--c-red); box-shadow: inset 0 0 0 1px var(--c-red); }
.badge--paper-none    { background: var(--md-surface-container-high); color: var(--md-on-surface-variant); }

/* ── A record's file: header, then tabs ── */
.file-head { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 12px 24px; }
.file-head__main { flex: 1; min-width: 240px; }
.file-head__title { font-size: 1.5rem; font-weight: 700; line-height: 1.2; }
.file-head__sub { color: var(--md-on-surface-variant); margin-top: 2px; }
.file-head__badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.file-head__actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* ── The morning check: one line per vehicle ── */
.morning-row { display: grid; grid-template-columns: minmax(140px, 1.2fr) minmax(150px, 1fr) minmax(160px, 1.4fr); gap: 10px; align-items: center;
    padding: 8px 0; border-bottom: 1px solid var(--md-outline-variant); }
.morning-row select, .morning-row input { width: 100%; height: 36px; border: 1px solid var(--md-outline-variant);
    border-radius: var(--shape-control); background: var(--md-surface); color: var(--md-on-surface); padding: 0 8px; font: inherit; }
.morning-row--changed { background: var(--c-amber-bg); }
@media (max-width: 640px) { .morning-row { grid-template-columns: 1fr 1fr; } .morning-row__note { grid-column: 1 / -1; } }

/* ── Import preview ── */
.import-row--error td { background: var(--c-red-bg); }
.import-row--duplicate td { color: var(--md-on-surface-variant); }
.import-cols { display: flex; flex-wrap: wrap; gap: 6px; }

/* ── Long forms in sections (vehicle, driver, client) ──
   A section title is a rule and a little air above it; every label line is
   as tall as one carrying a "?" mark, so fields side by side line up. */
.entry-form h2.form-section__title {
    margin: 18px 0 2px; padding-top: 14px; border-top: 1px solid var(--md-outline-variant);
    font-size: 0.82rem; letter-spacing: 0.04em; text-transform: uppercase;
}
.entry-form h2.form-section__title:first-of-type { margin-top: 0; padding-top: 0; border-top: 0; }
.form-row { align-items: start; }
.field > label { min-height: 20px; display: inline-flex; align-items: center; }

/* ── A record's timeline: one line per event, newest first ── */
.events { list-style: none; margin: 0; padding: 0; }
.events__item { display: grid; grid-template-columns: 32px 1fr auto; gap: 12px; align-items: start;
    padding: 10px 0; border-bottom: 1px solid var(--md-outline-variant); }
.events__icon { width: 32px; height: 32px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
    background: var(--md-primary-container); color: var(--md-on-primary-container); font-size: 18px; }
.events__when { text-align: right; white-space: nowrap; }

/* ── Vehicles as cards (after zone_web): the picture first ── */
.view-toggle { display: inline-flex; border: 1px solid var(--md-outline-variant); border-radius: var(--shape-control); overflow: hidden; }
.view-toggle__btn { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 32px;
    color: var(--md-on-surface-variant); text-decoration: none; background: var(--md-surface); }
.view-toggle__btn .material-symbols-outlined { font-size: 20px; }
.view-toggle__btn.active { background: var(--md-primary); color: var(--md-on-primary); }
.view-toggle__btn:not(.active):hover { background: var(--md-surface-container-high); text-decoration: none; }

.vehicle-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(min(200px, 100%), 1fr)); }
.vehicle-grid--mobile { display: none; }
.vehicle-card { display: flex; flex-direction: column; background: var(--md-surface); border: 1px solid var(--md-outline-variant);
    border-radius: var(--shape-md); overflow: hidden; transition: box-shadow .15s, transform .15s; }
.vehicle-card:hover { box-shadow: var(--elev-2); transform: translateY(-1px); }
.vehicle-card--archived { opacity: .72; }
.vehicle-card__media { position: relative; display: flex; align-items: center; justify-content: center;
    height: 92px; background: var(--md-surface-container-high); overflow: hidden; }
.vehicle-card__media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.vehicle-card__media--empty .material-symbols-outlined { font-size: 34px; color: var(--md-outline); }
/* A drawing stands in for a missing photo: shown whole, on a light ground
   in both themes (the drawings are made for white). */
.vehicle-card__media--drawing, .vehicle-hero--drawing { background: #f7f6f2; }
.vehicle-card__media--drawing img, .vehicle-hero--drawing img { object-fit: contain; padding: 4px; box-sizing: border-box; }
.vehicle-card__status { position: absolute; top: 6px; left: 6px; }
.vehicle-card__body { padding: 8px 10px 4px; flex: 1 1 auto; font-size: 0.92rem; }
.vehicle-card__title { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.vehicle-card__title a { text-decoration: none; }
.vehicle-card__meta { margin-top: 3px; line-height: 1.3; }
.vehicle-card__papers { margin-top: 5px; }
.vehicle-card__actions { display: flex; gap: 6px; padding: 4px 10px 8px; }
.vehicle-card__actions > a:first-child { flex: 1; justify-content: center; }

.vehicle-hero { flex: 0 0 220px; width: 220px; aspect-ratio: 16 / 10; border-radius: var(--shape-md); overflow: hidden;
    display: flex; align-items: center; justify-content: center; background: var(--md-surface-container-high); }
.vehicle-hero img { width: 100%; height: 100%; object-fit: cover; display: block; }
.vehicle-hero--empty .material-symbols-outlined { font-size: 48px; color: var(--md-outline); }
@media (max-width: 768px) {
    .vehicle-grid--mobile { display: grid; }
    .vehicle-hero { flex-basis: 100%; width: 100%; }
}

/* ── A person's photo, or their initials ── */
.avatar { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; border-radius: 50%;
    overflow: hidden; background: var(--md-primary-container); color: var(--md-on-primary-container); font-weight: 700; }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar--sm { width: 34px; height: 34px; font-size: 0.78rem; }
.avatar--lg { width: 96px; height: 96px; font-size: 1.6rem; }
.person-cell { display: inline-flex; align-items: center; gap: 10px; }

/* ── The drawer's own name, and Mon profil ── */
.sidebar-me { display: flex; align-items: center; gap: 10px; min-width: 0; color: inherit; text-decoration: none;
    margin: -4px -4px -4px -8px; padding: 4px 4px 4px 8px; border-radius: var(--shape-control); transition: background 0.15s; }
.sidebar-me:hover, .sidebar-me.is-on { background: var(--nav-hover); text-decoration: none; }
.sidebar-me .avatar { width: 32px; height: 32px; font-size: 0.74rem; }
.sidebar-me .sidebar-user-info { flex-direction: column; align-items: stretch; gap: 1px; }
.profile-head { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 24px; }
.profile-head__main { flex: 1; min-width: 200px; }
.profile-head__photo { display: flex; flex-wrap: wrap; gap: 8px; }
.profile-head__photo input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; }
/* A person's account, on their file. */
.access-line { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.access-line__icon { font-size: 1.8rem; color: var(--md-primary); }
.access-line__icon--off { color: var(--md-outline); }
.access-line__main { flex: 1; min-width: 200px; display: flex; flex-direction: column; gap: 4px; }
.access-line__main .chip, .access-line__main .badge { margin-left: 6px; }
/* The person an account belongs to, in the user form. */
.account-person { display: flex; align-items: center; gap: 12px; padding: 10px 12px; margin-bottom: 12px;
    border: 1px solid var(--md-outline-variant); border-radius: var(--shape-control); }
.account-person__main { flex: 1; min-width: 0; }
/* A form's photo, at the top: the picture of now, then the one chosen. */
.photo-pick { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; margin-bottom: 4px; }
.photo-pick__frame { position: relative; display: inline-flex; }
.photo-pick__frame .photo-pick__preview { position: absolute; inset: 0; }
.photo-pick__frame .avatar--initials .material-symbols-outlined { font-size: 2.6rem; }
/* A vehicle's picture is a landscape, not a portrait. */
.photo-pick__frame--wide { width: 176px; height: 116px; }
.photo-pick__now { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%;
    border-radius: var(--shape-control); overflow: hidden; background: var(--md-surface-container); color: var(--md-outline); }
.photo-pick__now img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-pick__now--drawing img { object-fit: contain; padding: 6px; }
.photo-pick__now .material-symbols-outlined { font-size: 2.6rem; }
.photo-pick__actions { flex: 1; min-width: 200px; display: flex; flex-direction: column; gap: 6px; }
.photo-pick__buttons { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.photo-pick__actions p { margin: 0; }
.photo-pick input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; }
.photo-pick:has(input[name=photo_remove]:checked) .photo-pick__frame { opacity: 0.35; }
.profile-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); gap: 16px; align-items: start; }
.pref-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; padding: 10px 0; }
.pref-row + .pref-row { border-top: 1px solid var(--md-outline-variant); }
.link-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; color: inherit; text-decoration: none; }
.link-row + .link-row { border-top: 1px solid var(--md-outline-variant); }
.link-row:hover { text-decoration: none; color: var(--md-primary); }
.link-row > .material-symbols-outlined:first-child { color: var(--md-on-surface-variant); }
.link-row__text { flex: 1; min-width: 0; }

/* ── Signature circuits ── */
.badge--approval-pending   { background: var(--c-amber-bg); color: var(--c-amber); }
.badge--approval-approved  { background: var(--c-green-bg); color: var(--c-green); }
.badge--approval-rejected  { background: var(--c-red-bg);   color: var(--c-red); }
.badge--approval-cancelled { background: var(--md-surface-container-high); color: var(--md-on-surface-variant); }
.badge--step-waiting  { background: var(--md-surface-container-high); color: var(--md-on-surface-variant); }
.badge--step-pending  { background: var(--c-amber-bg); color: var(--c-amber); }
.badge--step-approved { background: var(--c-green-bg); color: var(--c-green); }
.badge--step-rejected { background: var(--c-red-bg);   color: var(--c-red); }
.badge--step-skipped  { background: var(--md-surface-container-high); color: var(--md-on-surface-variant); }

.step-dots { display: inline-flex; gap: 4px; }
.step-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--md-surface-container-high); border: 2px solid var(--md-outline-variant); }
.step-dot--approved { background: var(--c-green); border-color: var(--c-green); }
.step-dot--pending  { background: var(--c-amber-bg); border-color: var(--c-amber); }
.step-dot--rejected { background: var(--c-red); border-color: var(--c-red); }

.circuit { list-style: none; margin: 18px 0 0; padding: 0; display: grid; gap: 10px; }
.circuit__step { display: grid; grid-template-columns: 32px 1fr auto; gap: 12px; align-items: center;
    padding: 10px 12px; border: 1px solid var(--md-outline-variant); border-radius: var(--shape-md); }
.circuit__step--pending { border-color: var(--c-amber); background: var(--c-amber-bg); }
.circuit__num { width: 32px; height: 32px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
    font-weight: 700; background: var(--md-surface-container-high); }
.circuit__step--approved .circuit__num { background: var(--c-green); color: #fff; }
.circuit__step--rejected .circuit__num { background: var(--c-red); color: #fff; }
.circuit__comment { margin-top: 4px; font-style: italic; }
.circuit__stamp { width: 96px; height: 96px; }
.circuit__decide { margin-top: 18px; }

.rule-list { display: grid; gap: 10px; }
.rule-card { border: 1px solid var(--md-outline-variant); border-radius: var(--shape-md); padding: 12px 14px; }
.rule-card__head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.rule-steps { margin: 8px 0 0 18px; display: grid; gap: 2px; }
.rule-editor { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 8px; max-width: 560px; }
.rule-editor__row { display: grid; grid-template-columns: 28px 1fr auto auto auto; gap: 6px; align-items: center; }
.rule-editor__row select { height: 38px; border: 1px solid var(--md-outline-variant); border-radius: var(--shape-control);
    background: var(--md-surface); color: var(--md-on-surface); padding: 0 8px; font: inherit; }
.rule-editor__num { font-weight: 700; color: var(--md-on-surface-variant); }

/* On a printed document: the signers side by side, each over their stamp. */
.doc-signatures { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 18px; page-break-inside: avoid; }
.doc-signature { flex: 1 1 160px; text-align: center; font-size: 0.8rem; }
.doc-signature__role { font-weight: 700; }
.doc-signature__stamp { width: 140px; height: 140px; }

/* ── The signature code ── */
.pin-dialog { border: 0; border-radius: var(--shape-lg); padding: 22px; width: min(380px, calc(100vw - 32px));
    background: var(--md-surface); color: var(--md-on-surface); box-shadow: var(--elev-3); }
.pin-dialog::backdrop { background: rgba(15, 23, 42, 0.45); }
/* A window opened over the page sits in the middle of the screen. The
   reset above (margin: 0 on everything) takes away the browser's own
   centring, so it is given back here, for every modal window. */
dialog:modal, dialog[open].pin-dialog { position: fixed; inset: 0; margin: auto; height: fit-content;
    max-height: calc(100dvh - 32px); overflow: auto; }
.pin-dialog h2 { font-size: 1.1rem; margin-bottom: 4px; }
.pin-input { display: block; width: 100%; margin: 14px 0 4px; height: 56px; text-align: center; font-size: 1.8rem;
    letter-spacing: 0.6em; border: 1px solid var(--md-outline); border-radius: var(--shape-md);
    background: var(--md-surface); color: var(--md-on-surface); font-family: inherit; }
.pin-input:focus { outline: 2px solid var(--md-primary); border-color: var(--md-primary); }
.activation-code { font-family: ui-monospace, monospace; font-size: 2rem; font-weight: 700; letter-spacing: 0.15em;
    text-align: center; padding: 18px; margin: 12px 0; border: 2px dashed var(--md-primary); border-radius: var(--shape-md); }

/* ── Missions ── */
.badge--ms-planned   { background: var(--c-blue-bg);  color: var(--c-blue); }
.badge--ms-on_road   { background: var(--c-amber-bg); color: var(--c-amber); }
.badge--ms-delivered { background: var(--c-green-bg); color: var(--c-green); }
.badge--ms-closed    { background: var(--md-surface-container-high); color: var(--md-on-surface-variant); }
.badge--ms-cancelled { background: transparent; color: var(--md-on-surface-variant); box-shadow: inset 0 0 0 1px var(--md-outline); }
.badge--late         { background: var(--c-red-bg); color: var(--c-red); }

.mission-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
/* The cards that stand in for a table on a phone only (the rule above
   would otherwise show them under the table on a computer too). */
.mission-grid.vehicle-grid--mobile { display: none; }
@media (max-width: 768px) { .mission-grid.vehicle-grid--mobile { display: grid; } }
.mission-card { display: flex; flex-direction: column; gap: 8px; padding: 13px 14px; background: var(--md-surface);
    border: 1px solid var(--md-outline-variant); border-radius: var(--shape-md); transition: box-shadow .15s, transform .15s; }
.mission-card:hover { box-shadow: var(--elev-2); transform: translateY(-1px); }
.mission-card--late { border-color: var(--c-red); }
.mission-card__head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.mission-card__head a { text-decoration: none; font-weight: 700; }
.mission-card__route { font-weight: 600; font-size: 1.02rem; }
.mission-card__meta { line-height: 1.45; }
.mission-card__meta .material-symbols-outlined { font-size: 16px; vertical-align: -3px; margin-right: 3px; color: var(--md-outline); }

/* A mission's stops, top to bottom like the road. */
.stops { list-style: none; margin: 0; padding: 0; }
.stops__item { display: grid; grid-template-columns: 32px 1fr auto; gap: 12px; align-items: start; padding: 10px 0;
    border-bottom: 1px solid var(--md-outline-variant); }
.stops__dot { width: 32px; height: 32px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
    background: var(--md-surface-container-high); color: var(--md-on-surface-variant); font-size: 18px; }
.stops__item--done .stops__dot { background: var(--c-green); color: #fff; }
.stops__photo { display: inline-block; margin-top: 6px; }
.stops__photo img { width: 96px; height: 72px; object-fit: cover; border-radius: var(--shape-sm, 6px); border: 1px solid var(--md-outline-variant); }

.stop-editor { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 8px; }
.stop-editor__row { display: grid; grid-template-columns: 150px 1fr 1fr auto; gap: 6px; align-items: center; }
.stop-editor__row select, .stop-editor__row input { height: 38px; border: 1px solid var(--md-outline-variant); border-radius: var(--shape-control);
    background: var(--md-surface); color: var(--md-on-surface); padding: 0 8px; font: inherit; min-width: 0; }
@media (max-width: 640px) { .stop-editor__row { grid-template-columns: 1fr auto; } .stop-editor__row > :nth-child(2),
    .stop-editor__row > :nth-child(3) { grid-column: 1 / 2; } }
/* No site to offer: the typed place takes the list's room; a site chosen:
   the list takes the typed place's. */
.stop-editor__row > [hidden] { display: none; }
.stop-editor__row--typed [data-stop-name], .stop-editor__row--site [data-stop-place] { grid-column: span 2; }
.stop-editor__hint { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 0 0 10px;
    font-size: 0.85rem; color: var(--md-on-surface-variant); }
.stop-editor__hint[hidden] { display: none; }
.stop-editor__hint > .material-symbols-outlined { font-size: 18px; }
@media (max-width: 640px) { .stop-editor__row--typed [data-stop-name], .stop-editor__row--site [data-stop-place] { grid-column: 1 / 2; } }
.override-box { border: 1px solid var(--c-red); background: var(--c-red-bg); border-radius: var(--shape-md); padding: 12px 14px; margin-top: 12px; }
/* "En mission": worked out from the mission, beside the technical status. */
.badge--on-mission { background: var(--c-indigo-bg); color: var(--c-indigo); text-decoration: none; }
a.badge--on-mission:hover { text-decoration: underline; }
.vehicle-card__status { display: flex; flex-wrap: wrap; gap: 4px; right: 8px; }

/* ── Planning: one line per truck over the week ── */
.plan-nav { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.plan-nav__title { margin-left: 6px; white-space: nowrap; }
.plan-wrap { overflow-x: auto; margin-top: 4px; }
.plan { min-width: 860px; --lane-h: 30px; }
.plan__row { display: grid; grid-template-columns: 150px 1fr; border-bottom: 1px solid var(--md-outline-variant); }
.plan__row--head { border-bottom: 2px solid var(--md-outline-variant); }
.plan__label { padding: 8px 10px 8px 0; min-width: 0; }
.plan__label a { text-decoration: none; }
.plan__days { display: grid; grid-template-columns: repeat(7, 1fr); }
.plan__day { padding: 8px 6px; text-align: center; font-weight: 600; color: var(--md-on-surface); text-decoration: none; border-left: 1px solid var(--md-outline-variant); }
.plan__day span { color: var(--md-on-surface-variant); font-weight: 500; }
.plan__day--today { color: var(--md-primary); background: var(--md-primary-container); border-radius: var(--shape-sm) var(--shape-sm) 0 0; }
.plan__day:hover { text-decoration: underline; }
.plan__track { position: relative; display: grid; grid-template-columns: repeat(7, 1fr);
    min-height: calc(var(--lanes, 1) * var(--lane-h) + 10px); }
.plan__cell { border-left: 1px solid var(--md-outline-variant); display: block; }
.plan__cell--today { background: color-mix(in srgb, var(--md-primary-container) 45%, transparent); }
a.plan__cell:hover { background: var(--md-surface-container-high); cursor: copy; }
.plan__bar { position: absolute; height: calc(var(--lane-h) - 6px); display: flex; align-items: center; gap: 4px; padding: 0 7px;
    border-radius: 6px; font-size: 0.74rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-decoration: none;
    box-sizing: border-box; border: 1px solid transparent; z-index: 1; }
a.plan__bar:hover { filter: brightness(0.95); text-decoration: none; z-index: 2; }
.plan__bar--planned   { background: var(--c-blue-bg);  color: var(--c-blue);  border-color: var(--c-blue); }
.plan__bar--on_road   { background: var(--c-amber-bg); color: var(--c-amber); border-color: var(--c-amber); }
.plan__bar--delivered { background: var(--c-green-bg); color: var(--c-green); border-color: var(--c-green); }
.plan__bar--closed    { background: var(--md-surface-container-high); color: var(--md-on-surface-variant); border-color: var(--md-outline-variant); }
.plan__bar--late      { border: 2px solid var(--c-red); }
.plan__bar--vs-maintenance    { background: repeating-linear-gradient(135deg, var(--c-amber-bg) 0 6px, transparent 6px 12px); color: var(--c-amber); border-color: var(--c-amber); }
.plan__bar--vs-accident       { background: repeating-linear-gradient(135deg, var(--c-red-bg) 0 6px, transparent 6px 12px); color: var(--c-red); border-color: var(--c-red); }
.plan__bar--vs-out_of_service { background: repeating-linear-gradient(135deg, var(--md-surface-container-high) 0 6px, transparent 6px 12px); color: var(--md-on-surface-variant); border-color: var(--md-outline); }
.plan__warn { font-size: 15px; color: var(--c-red); }
.plan__now { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--c-red); z-index: 3; pointer-events: none; }
.plan-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 12px; align-items: center; }
.plan-legend > span { display: inline-flex; align-items: center; gap: 6px; }
.plan-dot { display: inline-block; width: 16px; height: 10px; border-radius: 3px; position: static; border-width: 1px; border-style: solid; }
.plan-dot.plan__bar--late { border-width: 2px; background: transparent; }
.plan-day__mission + .plan-day__mission { margin-top: 8px; }
.plan-drivers { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 18px; }
.plan-drivers h3 { font-size: 0.95rem; margin: 0 0 8px; display: flex; align-items: center; gap: 8px; }
.plan-drivers__item { padding: 6px 0; border-bottom: 1px solid var(--md-outline-variant); }
.plan-drivers__item .person-cell > span { display: flex; flex-direction: column; }
@media (max-width: 768px) { .plan-drivers { grid-template-columns: 1fr; } }

/* ── Papers: a scan's link, a mission's papers as tiles ── */
.scan-link { display: inline-flex; vertical-align: -4px; color: var(--md-primary); text-decoration: none; }
.scan-link .material-symbols-outlined { font-size: 18px; }
.doc-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.doc-tile { position: relative; display: flex; flex-direction: column; border: 1px solid var(--md-outline-variant);
    border-radius: var(--shape-md); overflow: hidden; background: var(--md-surface); }
.doc-tile__media { display: flex; align-items: center; justify-content: center; aspect-ratio: 4 / 3;
    background: var(--md-surface-container-high); color: var(--c-red); text-decoration: none; }
.doc-tile__media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.doc-tile__media .material-symbols-outlined { font-size: 48px; }
.doc-tile__body { padding: 8px 10px 10px; }
.doc-tile__delete { position: absolute; top: 6px; right: 6px; }
.doc-holder { display: inline-flex; align-items: flex-start; gap: 8px; }
.doc-holder > span:last-child { display: flex; flex-direction: column; }
.doc-holder__icon { font-size: 18px; color: var(--md-on-surface-variant); margin-top: 1px; }
.view-toggle__btn--text { width: auto; padding: 0 12px; gap: 6px; font-size: 0.82rem; font-weight: 600; }
.view-toggle__btn--text .material-symbols-outlined { font-size: 18px; }
html:not([data-theme="dark"]) .theme-opt--light, html[data-theme="dark"] .theme-opt--dark { background: var(--md-primary); color: var(--md-on-primary); }

/* ── Trailers: where a tractor or trailer stands, and the coupling form ── */
.coupling-line { display: flex; align-items: center; gap: 4px; margin-top: 4px; color: var(--md-on-surface-variant); }
.coupling-line .material-symbols-outlined { font-size: 16px; color: var(--md-primary); }
.coupling-line--none .material-symbols-outlined { color: var(--md-outline); }
.coupling-choices { display: grid; gap: 6px; max-height: 50vh; overflow-y: auto; }
.coupling-choice { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border: 1px solid var(--md-outline-variant); border-radius: var(--shape-control); cursor: pointer; }
.coupling-choice:has(input:checked) { border-color: var(--md-primary); background: var(--md-primary-container); }
.coupling-choice--off { opacity: 0.55; cursor: not-allowed; }
.coupling-choice input { margin-top: 3px; }
.text-error { color: var(--md-error); }
.checkbox-group { border: 0; padding: 0; margin: 4px 0 8px; display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: center; }
.checkbox-group legend { width: 100%; margin-bottom: 2px; }

/* ── The mission form's truck picker: one card per unit, its drawing, why ── */
.fleet-picker { display: grid; gap: 10px; transition: opacity .15s; }
.fleet-picker.is-loading { opacity: .5; pointer-events: none; }
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(230px, 100%), 1fr)); gap: 10px; }
.pick { position: relative; display: grid; gap: 6px; padding: 10px; border: 2px solid var(--md-outline-variant); border-radius: var(--shape-lg);
    background: var(--md-surface); cursor: pointer; min-width: 0; }
.pick input { position: absolute; opacity: 0; pointer-events: none; }
.pick:has(input:checked) { border-color: var(--md-primary); box-shadow: 0 0 0 3px var(--md-primary-container); }
.pick:has(input:focus-visible) { outline: 3px solid var(--nav-active-mark); outline-offset: 2px; }
.pick--off { opacity: .55; cursor: not-allowed; }
.pick__media { display: flex; align-items: center; justify-content: center; height: 64px; border-radius: var(--shape-md); background: var(--md-surface-container); overflow: hidden; }
.pick__media img { max-height: 60px; max-width: 100%; object-fit: contain; }
.pick__media .material-symbols-outlined { font-size: 30px; color: var(--md-outline); }
.pick__plates { font-variant-numeric: tabular-nums; min-width: 0; }
.pick__why { display: flex; gap: 5px; align-items: flex-start; font-size: 0.8rem; color: var(--md-on-surface-variant); }
.pick__why .material-symbols-outlined { font-size: 16px; flex: none; }
.pick__why--ok .material-symbols-outlined { color: var(--c-green); }
.pick__why--warn .material-symbols-outlined { color: var(--c-amber); }
.pick__why--off .material-symbols-outlined { color: var(--md-error); }
/* The truck's crew: given on the vehicle, shown to the planner. */
.pick__crew { display: flex; gap: 5px; align-items: center; font-size: 0.82rem; min-width: 0; }
.pick__crew .material-symbols-outlined { font-size: 16px; color: var(--md-on-surface-variant); }
.pick__crew--none { color: var(--c-amber); }
.pick__crew--none .material-symbols-outlined { color: var(--c-amber); }
.crew-show { display: grid; gap: 10px; }
.crew-show__row { display: flex; gap: 10px; align-items: flex-start; }
.crew-show__who { display: grid; gap: 2px; min-width: 0; }
.crew-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.crew-list__head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.crew-list__head > .material-symbols-outlined { font-size: 20px; color: var(--md-on-surface-variant); }
.crew-list__change { margin-left: auto; }
.crew-list__rows { list-style: none; margin: 6px 0 0; padding: 0 0 0 12px; border-left: 2px solid var(--md-outline-variant); display: grid; gap: 8px; }
.crew-list__row { display: grid; gap: 2px; }
.crew-list__who { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.coupling-choice .pick__why { margin-top: 2px; }
.pick-off summary { cursor: pointer; padding: 4px 0; }
.pick-off .pick-grid { margin-top: 8px; }
.pick-step { font-size: 0.95rem; margin: 10px 0 0; }

/* ── A mission as a road: its stops, and the truck where it should be ── */
/* A drawing is shown whole (the photo rule above crops); a pair is wide. */
.vehicle-hero.vehicle-hero--drawing img { object-fit: contain; }
.mission-hero { flex-basis: 320px; width: 320px; max-width: 100%; aspect-ratio: 5 / 2; }
.trip { background: var(--md-surface-container); border-radius: var(--shape-lg); padding: 14px 16px; margin-bottom: 14px; }
.trip__track { position: relative; height: 64px; margin: 0 18px; }
.trip__line, .trip__done { position: absolute; left: 0; top: 40px; height: 6px; border-radius: 3px; }
.trip__line { right: 0; background: var(--md-surface-container-high); }
.trip__done { background: var(--c-blue); }
.trip__node { position: absolute; top: 30px; width: 26px; height: 26px; transform: translateX(-50%); border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center; border: 3px solid var(--c-blue); background: var(--md-surface); color: var(--c-blue); z-index: 1; }
.trip__node .material-symbols-outlined { font-size: 15px; }
.trip__node--done { background: var(--c-blue); color: #fff; }
.trip__unit { position: absolute; top: -4px; height: 40px; transform: translateX(-50%); z-index: 2; pointer-events: none; }
.trip__labels { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 6px; }
.trip__labels > div:last-child { text-align: right; }
.trip__note { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 10px 0 0; color: var(--md-on-surface-variant); }
.trip__note .material-symbols-outlined { font-size: 18px; }
.paper-check { display: grid; gap: 6px; }
.paper-check__row { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; padding: 6px 0; border-bottom: 1px solid var(--md-outline-variant); }
.paper-check__row:last-child { border-bottom: 0; }

/* ── Planning: units drawn at the head of their line, trip progress in the
   bar, coupling marks, and today's yard ── */
.plan-rows { margin: 8px 0 4px; }
.plan .plan__row { grid-template-columns: 210px 1fr; }
.plan__label--pic { display: grid; grid-template-columns: 70px 1fr; gap: 8px; align-items: center; }
.plan__pic { display: flex; align-items: center; justify-content: center; height: 34px; border-radius: var(--shape-sm); background: var(--md-surface-container); overflow: hidden; }
.plan__pic img { max-height: 32px; max-width: 100%; object-fit: contain; }
.plan__name { min-width: 0; line-height: 1.2; }
.plan__progress { position: absolute; inset: 0 auto 0 0; background: color-mix(in srgb, currentColor 18%, transparent); pointer-events: none; }
.plan__mark { position: absolute; top: 3px; width: 9px; height: 9px; transform: translateX(-50%) rotate(45deg); background: var(--nav-active-mark);
    border: 1.5px solid var(--md-on-surface); border-radius: 2px; z-index: 2; }
.plan__mark--legend { position: static; transform: rotate(45deg); display: inline-block; }

.yard { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(250px, 100%), 1fr)); gap: 12px; margin-top: 6px; }
.yard-lane { background: var(--md-surface-container); border-radius: var(--shape-lg); padding: 10px; display: grid; gap: 8px; align-content: start; min-width: 0; }
.yard-lane__head { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.yard-lane__head .muted { margin-left: auto; font-weight: 600; }
.yard-lane__empty { margin: 2px 4px; }
.yard-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--md-outline); flex: none; }
.yard-dot--blue { background: var(--c-blue); } .yard-dot--amber { background: var(--nav-active-mark); }
.yard-dot--green { background: var(--c-green); } .yard-dot--red { background: var(--c-red); }
.yard-unit { background: var(--md-surface); border: 1px solid var(--md-outline-variant); border-radius: var(--shape-lg); padding: 10px; display: grid; gap: 6px; min-width: 0; color: inherit; text-decoration: none; }
.yard-unit__pic { display: flex; align-items: center; justify-content: center; height: 70px; border-radius: var(--shape-md); background: var(--md-surface-container); overflow: hidden; }
.yard-unit__pic img { max-height: 66px; max-width: 100%; object-fit: contain; }
.yard-unit__pic .material-symbols-outlined { font-size: 30px; color: var(--md-outline); }
.yard-unit__head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.yard-unit__head a { text-decoration: none; }
.yard-unit--loose { grid-template-columns: 80px 1fr; align-items: center; }
.yard-unit--loose .yard-unit__pic { height: 40px; }
.yard-unit--loose:hover { border-color: var(--md-primary); text-decoration: none; }
.yard-loose { display: grid; gap: 6px; }
.yard-ic { font-size: 16px; color: var(--md-primary); }
.yard-road { position: relative; height: 24px; margin: 2px 8px 0; }
.yard-road__line, .yard-road__done { position: absolute; top: 11px; height: 3px; border-radius: 2px; left: 0; }
.yard-road__line { right: 0; background: var(--md-outline-variant); }
.yard-road__done { background: var(--c-blue); }
.yard-road__stop { position: absolute; top: 6px; width: 13px; height: 13px; border-radius: 50%; border: 3px solid var(--c-blue); background: var(--md-surface); transform: translateX(-50%); }
.yard-road__stop--done { background: var(--c-blue); }
.yard-road__truck { position: absolute; top: -4px; transform: translateX(-50%); color: var(--c-blue); font-size: 22px; }
.yard-road__ends { display: flex; justify-content: space-between; gap: 8px; }

/* ── Vehicles: one list, the tractor-and-trailer card ── */
/* Wide enough for a unit's two halves side by side; a lone vehicle uses the same width. */
.vehicle-grid--units { grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr)); }
/* A unit's drawing is long and low: shown whole in the low frame. */
.unit-card .vehicle-card__media img { object-fit: contain; }
.unit-card__halves { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.unit-card__half { display: grid; gap: 3px; align-content: start; min-width: 0; }
.unit-card__half + .unit-card__half { border-left: 1px dashed var(--md-outline-variant); padding-left: 8px; }
.unit-card__plate { text-decoration: none; }
.unit-card__badges { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.unit-card__badges a { text-decoration: none; }
.unit-card__foot { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--md-outline-variant); }
.unit-card__foot .avatar { width: 22px; height: 22px; font-size: 0.6rem; }
.unit-card__foot .person-cell { gap: 6px; }
tr.row-child td:first-child { padding-left: 28px; }
tr.row-child td:first-child::before { content: "↳ "; color: var(--md-outline); }

/* The morning check: each vehicle's picture beside its plate */
.morning-row { grid-template-columns: minmax(220px, 1.5fr) minmax(150px, 1fr) minmax(160px, 1.3fr); }
.morning-row__who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.morning-row__pic { flex: none; width: 76px; height: 46px; border-radius: var(--shape-sm); background: #f7f6f2; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.morning-row__pic img { max-width: 100%; max-height: 100%; object-fit: contain; }
.morning-row__pic .material-symbols-outlined { color: var(--md-outline); }
.morning-row .coupling-line { margin-top: 2px; }
@media (max-width: 640px) { .morning-row { grid-template-columns: 1fr 1fr; } .morning-row__who { grid-column: 1 / -1; } }

/* ════════════════════════════════════════════════════════════════════════
   The form system (approved 2026-10-30): clear labels, 42 px controls, the
   unit inside the field, a card per section with what it is for, a summary
   ticked as sections are filled in, the save bar stuck to the bottom, the
   error on its field. Later rules than the ones above, so they win.
   ════════════════════════════════════════════════════════════════════════ */
.field > label { font-size: 0.88rem; font-weight: 600; text-transform: none; letter-spacing: 0; color: var(--md-on-surface); }
.field-label { font-size: 0.88rem; text-transform: none; letter-spacing: 0; color: var(--md-on-surface); }
.field { grid-template-columns: auto auto auto 1fr; }
.field > .field-optional { grid-row: 1; grid-column: 2; font-size: 0.8rem; color: var(--md-on-surface-variant); font-weight: 500; }
.field > .field-optional::before { content: "· "; }
.field > .hint-dot { grid-column: 3; }
.field input:not([type=checkbox]):not([type=radio]):not([type=file]), .field select { min-height: 42px; }
.field input, .field textarea, .field select {
    border: 1.5px solid var(--md-outline-variant); border-radius: 9px; font-size: 0.95rem; }
.field input:hover, .field select:hover, .field textarea:hover { border-color: var(--md-outline); }
.field input:focus, .field textarea:focus, .field select:focus {
    border-color: var(--md-primary); box-shadow: 0 0 0 3px var(--md-primary-container); }
.field > .field-hint, .field .field-hint { font-size: 0.8rem; font-weight: 400; color: var(--md-on-surface-variant); }
.form-row { gap: 16px; }

/* A number with its unit inside the field */
.input-unit { display: flex; align-items: stretch; border: 1.5px solid var(--md-outline-variant); border-radius: 9px; background: var(--md-surface); overflow: hidden; }
.input-unit:focus-within { border-color: var(--md-primary); box-shadow: 0 0 0 3px var(--md-primary-container); }
.field .input-unit input { border: 0; box-shadow: none; border-radius: 0; flex: 1; min-width: 0; }
.field .input-unit input:focus { box-shadow: none; }
.input-unit__unit { display: flex; align-items: center; padding: 0 12px; color: var(--md-on-surface-variant); font-size: 0.85rem;
    background: var(--md-surface-container); border-left: 1px solid var(--md-outline-variant); white-space: nowrap; }

/* A few choices as buttons */
.choice { display: inline-flex; flex-wrap: wrap; border: 1.5px solid var(--md-outline-variant); border-radius: 9px; overflow: hidden; max-width: 100%; justify-self: start; }
.choice__opt { position: relative; cursor: pointer; }
.choice__opt input { position: absolute; opacity: 0; pointer-events: none; }
.choice__opt span { display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px; font-weight: 600; font-size: 0.88rem; color: var(--md-on-surface-variant); }
.choice__opt + .choice__opt span { border-left: 1px solid var(--md-outline-variant); }
.choice__opt:hover span { background: var(--md-surface-container); }
.choice__opt input:checked + span { background: var(--md-primary); color: var(--md-on-primary); }
.choice__opt input:focus-visible + span { outline: 3px solid var(--nav-active-mark); outline-offset: -3px; }

/* A long form: the summary at the side, a card per section, the bar below */
.form-page { gap: 0; }
.form-page__layout { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 18px; align-items: start; max-width: 1080px; }
.form-page__sections { display: grid; gap: 14px; min-width: 0; }
.form-toc { position: sticky; top: 76px; display: grid; gap: 2px; font-size: 0.88rem; }
.form-toc a { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 8px; color: var(--md-on-surface-variant); text-decoration: none; }
.form-toc a:hover { background: var(--md-surface-container); text-decoration: none; }
.form-toc a.is-on { background: var(--md-surface); color: var(--md-on-surface); font-weight: 600; box-shadow: inset 3px 0 0 var(--nav-active-mark); }
.form-toc a .material-symbols-outlined { font-size: 18px; }
.form-toc__state { margin-left: auto; font-size: 17px !important; color: var(--md-outline-variant); }
.form-toc a.is-done .form-toc__state { color: var(--c-green); }
.form-toc__note { color: var(--md-on-surface-variant); font-size: 0.78rem; padding: 8px 10px 0; }
.fsec { background: var(--md-surface); border: 1px solid var(--md-outline-variant); border-radius: var(--shape-xl); scroll-margin-top: 80px; min-width: 0; }
.fsec__head { display: flex; align-items: flex-start; gap: 12px; padding: 16px 18px 0; }
details.fsec > summary.fsec__head { list-style: none; cursor: pointer; padding-bottom: 16px; }
details.fsec > summary.fsec__head::-webkit-details-marker { display: none; }
details.fsec[open] > summary.fsec__head { padding-bottom: 0; }
.fsec__icon { width: 36px; height: 36px; flex: none; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center;
    background: var(--md-primary-container); color: var(--md-on-primary-container); font-size: 20px; }
.fsec__text { display: grid; gap: 1px; min-width: 0; }
.fsec__title { font-weight: 700; font-size: 1.02rem; color: var(--md-on-surface); }
.fsec__desc { font-size: 0.85rem; color: var(--md-on-surface-variant); }
.fsec__opt { margin-left: auto; font-size: 0.75rem; color: var(--md-on-surface-variant); background: var(--md-surface-container); border-radius: var(--shape-full); padding: 2px 9px; white-space: nowrap; }
.fsec__chev { color: var(--md-on-surface-variant); transition: transform .15s; }
details.fsec .fsec__opt + .fsec__chev { margin-left: 4px; }
details.fsec:not(:has(.fsec__opt)) .fsec__chev { margin-left: auto; }
details.fsec[open] .fsec__chev { transform: rotate(180deg); }
.fsec__body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 16px; }
.form-bar { position: sticky; bottom: 0; z-index: 5; display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex-wrap: wrap;
    margin: 16px -24px -24px; padding: 12px 24px calc(12px + env(safe-area-inset-bottom, 0px));
    background: color-mix(in srgb, var(--md-surface) 92%, transparent); backdrop-filter: blur(6px);
    border-top: 1px solid var(--md-outline-variant); }
.form-bar__state { margin-right: auto; display: inline-flex; align-items: center; gap: 8px; font-size: 0.85rem; color: var(--md-on-surface-variant); }
.form-bar__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--nav-active-mark); }
.form-bar .btn { min-height: 42px; }
.form-error { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--shape-lg);
    background: var(--c-red-bg); color: var(--c-red); font-size: 0.9rem; }
.form-error a { color: inherit; font-weight: 700; margin-left: 4px; }
/* Under the papers error: each vehicle or driver at fault, a link to its file. */
.paper-holders { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; }
.paper-holders__row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 8px 12px;
    border: 1px solid var(--md-outline-variant); border-radius: var(--shape-lg); background: var(--md-surface); }
.paper-holders__who { display: inline-flex; align-items: center; gap: 6px; color: var(--md-primary); text-decoration: none; }
.paper-holders__who:hover strong { text-decoration: underline; }
.paper-holders__who .material-symbols-outlined { font-size: 18px; }
.paper-holders__open { opacity: .7; }
.paper-holders__bad { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.field--error input, .field--error select, .field--error textarea, .field--error .input-unit, .field--error .choice { border-color: var(--c-red) !important; }
/* A field to fill in, seen at a glance: its label in red, a light red
   ground and a short pulse when it is pointed out. Gone as soon as one
   types in it. */
.field--error > label, .field--error > .field-label { color: var(--c-red); }
.field--error .input-unit, .field--error > input, .field--error > select { background: color-mix(in srgb, var(--c-red-bg) 55%, var(--md-surface)); }
.field--error .input-unit input { background: transparent; }
.field--error .input-unit, .field--error > input, .field--error > select { animation: field-pulse .9s ease-out 1; }
@keyframes field-pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--c-red) 45%, transparent); }
                         100% { box-shadow: 0 0 0 8px transparent; } }
@media (prefers-reduced-motion: reduce) { .field--error .input-unit, .field--error > input, .field--error > select { animation: none; } }
.field > .field-error { grid-column: 1 / -1; display: flex; gap: 4px; align-items: center; font-size: 0.82rem; margin-top: 0; }
@media (max-width: 900px) {
    .form-page__layout { grid-template-columns: 1fr; }
    .form-toc { position: sticky; top: 52px; z-index: 4; display: flex; overflow-x: auto; gap: 4px; padding: 6px 0;
        background: var(--md-background); scrollbar-width: none; }
    .form-toc a { white-space: nowrap; background: var(--md-surface); border: 1px solid var(--md-outline-variant); }
    .form-toc__note { display: none; }
    .form-bar { margin: 16px -16px -16px; padding-left: 16px; padding-right: 16px; }
    .form-bar .btn { flex: 1; justify-content: center; }
    .form-bar__state { flex-basis: 100%; }
}

/* Type cards (the vehicle form): the drawing of each type, picked like a button */
.type-cards { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(150px, 100%), 1fr)); gap: 10px; }
.type-card { position: relative; display: grid; gap: 3px; padding: 8px; border: 2px solid var(--md-outline-variant); border-radius: var(--shape-lg);
    text-align: center; cursor: pointer; background: var(--md-surface); }
.type-card input { position: absolute; opacity: 0; pointer-events: none; }
.type-card:hover { border-color: var(--md-outline); }
.type-card:has(input:checked) { border-color: var(--md-primary); box-shadow: 0 0 0 3px var(--md-primary-container); }
.type-card:has(input:focus-visible) { outline: 3px solid var(--nav-active-mark); outline-offset: 2px; }
.type-card__pic { height: 56px; border-radius: var(--shape-md); background: #f7f6f2; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.type-card__pic img { max-height: 52px; max-width: 100%; object-fit: contain; }
.type-card__pic .material-symbols-outlined { color: var(--md-outline); font-size: 28px; }
.type-card__name { font-weight: 600; font-size: 0.86rem; }
.type-card__kind { font-size: 0.75rem; color: var(--md-on-surface-variant); }

/* Paper rows: one line per paper, its icon, its name, its date */
.paper-rows { display: grid; gap: 8px; }
/* A paper given with a new vehicle: issued on, expiry, and its scan. */
.paper-row { display: grid; grid-template-columns: 34px minmax(120px, 0.6fr) minmax(0, 2fr); gap: 12px; align-items: center;
    padding: 10px 12px; border: 1px solid var(--md-outline-variant); border-radius: var(--shape-lg); }
.paper-row[hidden] { display: none; }
.paper-row__icon { color: var(--md-primary); font-size: 22px; }
.paper-row__name { display: grid; gap: 1px; }
.paper-row__fields { display: grid; grid-template-columns: 1fr 1fr minmax(0, 1.2fr); gap: 8px; align-items: end; }
.paper-row__field { display: grid; gap: 3px; min-width: 0; }
.paper-row__field span { font-size: .75rem; font-weight: 600; color: var(--md-on-surface-variant); }
.paper-row__field input { height: 40px; padding: 0 10px; border: 1px solid var(--md-outline-variant); border-radius: var(--shape-md);
    background: var(--md-surface); font: inherit; color: var(--md-on-surface); min-width: 0; }
.paper-row__field input:focus { outline: 2px solid var(--md-primary); border-color: transparent; }
.file-pick--compact { gap: 8px; padding: 0 10px; height: 40px; border-radius: var(--shape-md); position: relative; }
.file-pick--compact .file-pick__icon { width: 26px; height: 26px; font-size: 16px; }
.file-pick--compact .file-pick__text strong { font-size: .82rem; }
@media (max-width: 700px) {
    .paper-row { grid-template-columns: 34px 1fr; }
    .paper-row__fields { grid-column: 1 / -1; grid-template-columns: 1fr 1fr; }
    .paper-row__file { grid-column: 1 / -1; }
}
/* The old "label in capitals" rule reaches the labels that are buttons. */
.field label.type-card, .field label.choice__opt, .field label.coupling-choice, .field label.checkbox-item, .field label.pick {
    text-transform: none; letter-spacing: 0; font-size: inherit; color: inherit; font-weight: inherit; order: 0; }
.field label.type-card .type-card__name { font-weight: 600; font-size: 0.86rem; }

/* The mission form: steps across the top, the recap beside the sections */
.form-toc--steps { position: sticky; top: 64px; z-index: 4; display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 0 12px;
    background: var(--md-background); counter-reset: step; max-width: 1180px; }
.form-toc--steps a { border: 1px solid var(--md-outline-variant); background: var(--md-surface); border-radius: var(--shape-full); padding: 5px 12px 5px 5px; gap: 8px; }
.form-toc--steps a::before { counter-increment: step; content: counter(step); width: 24px; height: 24px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center; font-size: 0.75rem; font-weight: 700;
    background: var(--md-surface-container); color: var(--md-on-surface-variant); }
.form-toc--steps a > .material-symbols-outlined:first-child { display: none; }
.form-toc--steps .form-toc__state { display: none; }
.form-toc--steps a.is-done::before { content: "✓"; background: var(--c-green); color: #fff; }
.form-toc--steps a.is-on { box-shadow: none; border-color: var(--md-primary); background: var(--md-primary-container); color: var(--md-on-primary-container); }
.form-toc--steps a.is-on::before { background: var(--md-primary); color: var(--md-on-primary); }
.form-toc--steps .form-toc__note { display: none; }
.form-page__layout--recap { grid-template-columns: minmax(0, 1fr) 300px; max-width: 1180px; }
.fleet-picker { display: grid; gap: 14px; }
.recap { position: sticky; top: 120px; background: var(--md-surface); border: 1px solid var(--md-outline-variant); border-radius: var(--shape-xl);
    padding: 16px; display: grid; gap: 12px; }
.recap__title { margin: 0; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--md-on-surface-variant); }
.recap__pic { height: 90px; border-radius: var(--shape-md); background: #f7f6f2; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.recap__pic img { max-height: 86px; max-width: 100%; object-fit: contain; }
.recap__pic .material-symbols-outlined { font-size: 32px; color: var(--md-outline); }
.recap__rows { margin: 0; display: grid; gap: 8px; }
.recap__rows > div { display: grid; grid-template-columns: 90px 1fr; gap: 8px; font-size: 0.86rem; }
.recap__rows dt { color: var(--md-on-surface-variant); }
.recap__rows dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.recap__note { margin: 0; }
@media (max-width: 1000px) {
    .form-page__layout--recap { grid-template-columns: 1fr; }
    .recap { position: static; order: -1; }
    .recap__pic { display: none; }
}
@media (max-width: 900px) {
    .form-toc--steps { top: 52px; flex-wrap: nowrap; overflow-x: auto; }
    .form-toc--steps a { white-space: nowrap; }
}

/* ── Short windows (the modal layer, templates/_form.html) ──
   What the window is about at the top, the fields, the buttons kept in view
   at the bottom. On a phone the window rises from the bottom of the screen,
   full width, its buttons under the thumb. */
.mform { gap: 16px; }
.msub { display: flex; align-items: center; gap: 12px; padding: 10px 12px; margin: -6px 0 0;
    background: var(--md-surface); border: 1px solid var(--md-outline-variant); border-radius: var(--shape-lg); min-width: 0; }
.msub__pic { width: 96px; height: 44px; flex: none; border-radius: 8px; background: #f7f6f2; overflow: hidden;
    display: flex; align-items: center; justify-content: center; }
.msub__pic img { width: 100%; height: 100%; object-fit: contain; }
.msub__pic--icon { width: 44px; background: var(--md-primary-container); color: var(--md-on-primary-container); }
.msub__pic--icon .material-symbols-outlined { font-size: 24px; }
.msub__text { display: grid; gap: 1px; min-width: 0; }
.msub__text strong { font-size: 0.98rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msub__text span { font-size: 0.84rem; color: var(--md-on-surface-variant); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mform__lead { margin: 0; color: var(--md-on-surface-variant); font-size: 0.92rem; }
.modal-bar { position: sticky; bottom: -22px; z-index: 2; display: flex; justify-content: flex-end; gap: 10px;
    margin: 4px -22px -22px; padding: 14px 22px; background: var(--md-surface-container-low);
    border-top: 1px solid var(--md-outline-variant); border-radius: 0 0 var(--shape-lg) var(--shape-lg); }
.modal-bar .btn { min-height: 42px; }
.mform .override-box { margin-top: 0; }

/* The file button: one large target for the camera or the files */
.file-pick { display: flex; align-items: center; gap: 12px; padding: 12px 14px; cursor: pointer;
    border: 1.5px dashed var(--md-outline); border-radius: var(--shape-lg); background: var(--md-surface); }
.file-pick:hover { border-color: var(--md-primary); background: var(--md-primary-container); }
.file-pick:focus-within { outline: 3px solid var(--nav-active-mark); outline-offset: 2px; }
.file-pick input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.file-pick__icon { width: 40px; height: 40px; flex: none; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
    background: var(--md-primary-container); color: var(--md-on-primary-container); font-size: 22px; }
.file-pick__text { display: grid; gap: 1px; min-width: 0; }
.file-pick__text strong { font-size: 0.92rem; color: var(--md-on-surface); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-pick__text span { font-size: 0.8rem; color: var(--md-on-surface-variant); }
.file-pick.is-picked { border-style: solid; border-color: var(--c-green); background: var(--c-green-bg); }
.file-pick.is-picked .file-pick__icon { background: var(--c-green); color: #fff; }
.field--error .file-pick { border-color: var(--c-red); }
.file-current { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; margin-top: -8px; font-size: 0.86rem; }
.file-current a { display: inline-flex; align-items: center; gap: 4px; }
.file-current .material-symbols-outlined { font-size: 18px; }

/* ── The administration forms ── */
/* A short window in two parts (the account: sign-in, then access). */
.mform__group { display: flex; align-items: center; gap: 8px; margin: 4px 0 -4px; padding-top: 12px;
    border-top: 1px solid var(--md-outline-variant); font-size: 0.8rem; font-weight: 700; letter-spacing: .04em;
    text-transform: uppercase; color: var(--md-on-surface-variant); }
.mform__group .material-symbols-outlined { font-size: 18px; }
.mform__note { margin: -8px 0 0; }
/* A yes / no that needs a sentence: the box, its label, and what it does. */
.checkbox-item--card { align-items: flex-start; padding: 12px 14px; border-color: var(--md-outline-variant); border-radius: var(--shape-lg); }
.checkbox-item--card input { margin-top: 2px; flex: none; }
.checkbox-item--card > span { display: grid; gap: 2px; }
.checkbox-item--card:has(input:checked) .muted { color: inherit; opacity: .8; }
/* One choice among a few that each need a sentence (a job title's type of staff). */
.card-choices { display: grid; gap: 8px; }
/* Choices that may be many (sites, fleets): they wrap as separate chips. */
.choice--wrap { border: 0; border-radius: 0; overflow: visible; gap: 6px; }
.choice--wrap .choice__opt span { border: 1.5px solid var(--md-outline-variant); border-radius: 9px; }
.choice--wrap .choice__opt + .choice__opt span { border-left: 1.5px solid var(--md-outline-variant); }
.choice--wrap .choice__opt input:checked + span { border-color: var(--md-primary); }
/* The drawings of a vehicle type, as cards. */
.type-cards--drawings { grid-template-columns: repeat(auto-fill, minmax(min(120px, 100%), 1fr)); }
/* Settings: two by two, a long text across. */
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.settings-grid__wide { grid-column: 1 / -1; }
.form-page__after { margin-top: 18px; }
.form-page__after > div:first-child:empty { min-height: 0; }
/* A logo: what is there now, and the file to send in its place. */
.logo-slot { display: flex; align-items: flex-start; gap: 14px; flex-wrap: wrap; }
.logo-slot + .logo-slot { padding-top: 16px; border-top: 1px solid var(--md-outline-variant); }
.logo-slot__now { width: 160px; height: 64px; flex: none; border-radius: var(--shape-md); background: #f7f6f2;
    display: flex; align-items: center; justify-content: center; overflow: hidden; padding: 6px; }
.logo-slot__now img { max-width: 100%; max-height: 100%; object-fit: contain; }
.logo-slot__now .material-symbols-outlined { color: var(--md-outline); font-size: 28px; }
.logo-slot__now--dark { background: #0B1120; }
.logo-slot__main { flex: 1; min-width: 220px; display: grid; gap: 2px; }
.logo-slot__send { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.file-pick--sm { padding: 6px 12px 6px 6px; gap: 8px; }
.file-pick--sm .file-pick__icon { width: 30px; height: 30px; font-size: 18px; }
/* The day's rate: its card opens with the same head as a form section. */
.rate-entry .fsec__head { padding: 0 0 16px; }
@media (max-width: 768px) {
    .form-page__after > div:first-child { display: none; }
    .settings-grid { grid-template-columns: minmax(0, 1fr); }
}

/* The status tiles: one per status, in its colour */
.status-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(140px, 100%), 1fr)); gap: 8px; }
.status-tile { position: relative; display: grid; justify-items: center; gap: 4px; padding: 12px 8px; cursor: pointer; text-align: center;
    border: 2px solid var(--md-outline-variant); border-radius: var(--shape-lg); background: var(--md-surface); }
.status-tile input { position: absolute; opacity: 0; pointer-events: none; }
.status-tile .material-symbols-outlined { font-size: 26px; }
.status-tile__name { font-weight: 600; font-size: 0.9rem; }
.status-tile__now { font-size: 0.72rem; color: var(--md-on-surface-variant); }
.status-tile:hover { border-color: var(--md-outline); }
.status-tile:has(input:focus-visible) { outline: 3px solid var(--nav-active-mark); outline-offset: 2px; }
.status-tile--available .material-symbols-outlined { color: var(--c-green); }
.status-tile--maintenance .material-symbols-outlined { color: var(--c-amber); }
.status-tile--accident .material-symbols-outlined { color: var(--c-red); }
.status-tile--out_of_service .material-symbols-outlined { color: var(--md-on-surface-variant); }
.status-tile--available:has(input:checked) { border-color: var(--c-green); background: var(--c-green-bg); }
.status-tile--maintenance:has(input:checked) { border-color: var(--c-amber); background: var(--c-amber-bg); }
.status-tile--accident:has(input:checked) { border-color: var(--c-red); background: var(--c-red-bg); }
.status-tile--out_of_service:has(input:checked) { border-color: var(--md-outline); background: var(--md-surface-container-high); }
.field label.status-tile, .field label.file-pick { text-transform: none; letter-spacing: 0; font-size: inherit; color: inherit; font-weight: inherit; }

/* A vehicle to pick, with its drawing */
.coupling-choice { align-items: center; }
.coupling-choice input { margin-top: 0; }
.coupling-choice__pic { width: 84px; height: 36px; flex: none; border-radius: 6px; background: #f7f6f2; overflow: hidden;
    display: flex; align-items: center; justify-content: center; }
.coupling-choice__pic img { width: 100%; height: 100%; object-fit: contain; }
.coupling-choice__pic--none { color: var(--md-on-surface-variant); }

/* Delivered: the stops as they stand */
.stop-checks { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.stop-checks li { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border: 1px solid var(--md-outline-variant); border-radius: var(--shape-control); }
.stop-checks li.is-done .material-symbols-outlined { color: var(--c-green); }
.stop-checks li.is-missing { border-color: var(--c-amber); background: var(--c-amber-bg); }
.stop-checks li.is-missing .material-symbols-outlined { color: var(--c-amber); }

@media (max-width: 640px) {
    .modal-overlay:not(.confirm-overlay) { align-items: flex-end; padding: 0; }
    .modal-overlay:not(.confirm-overlay) .modal { width: 100%; max-height: 92vh; border-radius: var(--shape-xl) var(--shape-xl) 0 0; transform: translateY(24px); }
    .modal-overlay.open:not(.confirm-overlay) .modal { transform: none; }
    .modal__body { padding: 18px 16px; }
    .modal-bar { margin: 4px -16px -18px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px)); bottom: -18px; border-radius: 0; }
    .modal-bar .btn { flex: 1; justify-content: center; }
    .msub__pic:not(.msub__pic--icon) { width: 72px; }
}
/* A radio inside a .field keeps its own size (.field input is full width). */
.field .coupling-choice input[type=radio] { width: auto; flex: none; min-height: 0; }
.stop-checks li > .material-symbols-outlined { font-size: 20px; margin-top: 1px; }

/* ── The menu reduced to its icons (main.js, nav cookie) ──
   A 64px column of icons; with the mouse on it, it opens to its full width
   over the page (the negative margin keeps the page where it is) and closes
   when the mouse leaves. The icons sit at the same place in both widths, and
   a group title turns into a thin line of the same height, so nothing jumps
   as it opens. The keyboard opens it too, but only the keyboard
   (:focus-visible): a button clicked keeps the focus, and :focus-within
   held the menu open over the page after its own button reduced it.
   Desktop only: a phone keeps its drawer. */
.sidebar-logo { align-items: center; min-height: 40px; }
.sidebar-rail-btn { margin-left: auto; width: 32px; height: 32px; flex: none; display: inline-flex; align-items: center; justify-content: center;
    border: 0; border-radius: var(--shape-control); background: transparent; color: var(--nav-fg-muted); cursor: pointer; }
.sidebar-rail-btn:hover { background: var(--nav-hover-strong); color: var(--nav-active-fg); }
.sidebar-rail-btn .material-symbols-outlined { font-size: 20px; }
@media (max-width: 768px) { .sidebar-rail-btn { display: none; } }
@media (min-width: 769px) {
    html.nav-rail .sidebar { width: 64px; padding-left: 8px; padding-right: 8px; z-index: 60; overflow: hidden;
        transition: width .18s ease, margin-right .18s ease, box-shadow .18s ease; }
    html.nav-rail .sidebar.is-peek, html.nav-rail .sidebar:has(:focus-visible) {
        width: var(--sidebar-w); margin-right: calc(64px - var(--sidebar-w)); box-shadow: var(--elev-3); }
    html.nav-rail .sidebar-nav a, html.nav-rail .sidebar-nav a.sidebar-sub { padding: 0 14px; white-space: nowrap; }
    html.nav-rail .sidebar-section { white-space: nowrap; position: relative; }
    html.nav-rail .sidebar:not(.is-peek):not(:has(:focus-visible)) .sidebar-logo-link { display: none; }
    html.nav-rail .sidebar:not(.is-peek):not(:has(:focus-visible)) .sidebar-logo { justify-content: center; padding-left: 0; padding-right: 0; }
    html.nav-rail .sidebar:not(.is-peek):not(:has(:focus-visible)) .sidebar-rail-btn { margin-left: 0; }
    html.nav-rail .sidebar:not(.is-peek):not(:has(:focus-visible)) .nav-soon { display: none; }
    html.nav-rail .sidebar:not(.is-peek):not(:has(:focus-visible)) .sidebar-nav a { font-size: 0; }   /* the icon keeps its own size */
    html.nav-rail .sidebar:not(.is-peek):not(:has(:focus-visible)) .sidebar-section { color: transparent; }
    html.nav-rail .sidebar:not(.is-peek):not(:has(:focus-visible)) .sidebar-section::before {
        content: ""; position: absolute; left: 12px; right: 12px; bottom: 50%; height: 1px; background: var(--nav-border); }
    html.nav-rail .sidebar:not(.is-peek):not(:has(:focus-visible)) .sidebar-user { padding: 6px 0; align-items: center; background: transparent; }
    html.nav-rail .sidebar:not(.is-peek):not(:has(:focus-visible)) .sidebar-user-info,
    html.nav-rail .sidebar:not(.is-peek):not(:has(:focus-visible)) .sidebar-user-actions { display: none; }
    html.nav-rail .sidebar:not(.is-peek):not(:has(:focus-visible)) .sidebar-me { padding: 4px; }
}

/* ── The language menu (templates/_lang_menu.html) ──
   The current code in the bar; the list gives each language by its own
   name, the current one ticked. Same card as the bell's list. */
.lang-menu { position: relative; }
.lang-menu > summary { list-style: none; }
.lang-menu > summary::-webkit-details-marker { display: none; }
.lang-menu__current { font-weight: 700; letter-spacing: 0.04em; }
.lang-menu__chev { font-size: 18px !important; margin-left: -2px; transition: transform .15s; }
.lang-menu[open] .lang-menu__chev { transform: rotate(180deg); }
.lang-menu[open] > summary.lang-toggle { background: var(--md-surface-container-high); }
.lang-menu__panel { position: absolute; z-index: 30; min-width: 210px; padding: 6px;
    background: var(--md-surface); color: var(--md-on-surface);
    border: 1px solid var(--md-outline-variant); border-radius: var(--shape-lg); box-shadow: var(--elev-3); }
.lang-menu--top .lang-menu__panel { right: 0; top: calc(100% + 6px); }
.lang-menu--login .lang-menu__panel { left: 50%; transform: translateX(-50%); top: calc(100% + 6px); }
.lang-menu--side { flex: 1 1 0; display: flex; }
.lang-menu--side > summary { width: 100%; }
.lang-menu--side .lang-menu__panel { left: 0; bottom: calc(100% + 8px); }
.lang-menu__head { padding: 6px 10px 6px; font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em;
    color: var(--md-on-surface-variant); }
.lang-menu__item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--shape-control);
    color: var(--md-on-surface); font-size: 0.9rem; text-decoration: none; }
.lang-menu__item:hover { background: var(--md-surface-container); text-decoration: none; }
.lang-flag { width: 20px; height: 14px; flex: none; object-fit: cover; border-radius: 3px;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.12); }
.lang-menu__code { font-size: 0.72rem; font-weight: 600; letter-spacing: 0.05em; color: var(--md-on-surface-variant); }
.lang-menu__name { flex: 1; }
.lang-menu__item.is-on { background: var(--md-primary-container); color: var(--md-on-primary-container); font-weight: 600; }
.lang-menu__item.is-on .lang-menu__code { color: inherit; }
.sidebar-icon-btn .lang-flag { margin-right: 6px; }
.lang-menu__tick { font-size: 18px; color: var(--md-primary); }

/* ── The dashboard: headline figures and charts (templates/_charts.html) ──
   Colours checked with the colour-blindness validator, light and dark: one
   blue for a single series, blue against red for on time / late, green,
   yellow and red for states -- never green against red alone. Thin marks,
   hairline grid, the figures always in the table under each chart. */
:root {
    --viz-1: #2a78d6; --viz-good: #0ca30c; --viz-warn: #fab219; --viz-crit: #d03b3b; --viz-other: #b5b3ab;
    --viz-grid: #e1e0d9; --viz-axis: #c3c2b7; --viz-up: #006300; --viz-down: #d03b3b;
}
:root[data-theme="dark"] {
    --viz-1: #3987e5; --viz-other: #5a5955; --viz-grid: #2c2c2a; --viz-axis: #383835; --viz-up: #0ca30c; --viz-down: #e66767;
}
.dash-band { margin: 22px 0 10px; font-size: 0.78rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
    color: var(--md-on-surface-variant); }
.dash-band:first-of-type { margin-top: 0; }
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); gap: 12px; }
/* Today's tiles: six fit on one line on a wide screen. */
.dash-band + .stat-grid--compact { grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); }
.dash-band + .stat-grid--compact .stat-card { padding: 12px; gap: 10px; }
.dash-band + .stat-grid--compact .stat-icon { width: 40px; height: 40px; font-size: 22px; }
.kpi { display: grid; align-content: start; gap: 4px; padding: 14px 16px 12px; min-width: 0; color: inherit; text-decoration: none;
    background: var(--md-surface); border: 1px solid var(--md-outline-variant); border-radius: var(--shape-lg); }
a.kpi:hover { box-shadow: var(--elev-2); }
.kpi__label { display: flex; align-items: center; gap: 6px; font-size: 0.82rem; color: var(--md-on-surface-variant); }
.kpi__label .material-symbols-outlined { font-size: 18px; }
.kpi__value { font-size: 1.9rem; font-weight: 700; line-height: 1.15; color: var(--md-on-surface); }
.kpi__unit { font-size: 1rem; font-weight: 600; color: var(--md-on-surface-variant); }
.kpi__delta { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 5px; font-size: 0.8rem; font-weight: 600; color: var(--md-on-surface-variant); }
.kpi__delta .material-symbols-outlined { font-size: 18px; }
.kpi__delta--up { color: var(--viz-up); }
.kpi__delta--down { color: var(--viz-down); }
.kpi__vs { font-weight: 400; color: var(--md-on-surface-variant); }
.kpi__spark { width: 100%; height: 28px; margin-top: 4px; overflow: visible; }
.kpi__spark polyline { stroke: var(--md-outline); stroke-width: 2px; stroke-linejoin: round; stroke-linecap: round; }

.viz-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin: 14px 0; }
.viz-card { display: grid; align-content: start; gap: 12px; min-width: 0; padding: 16px 18px;
    background: var(--md-surface); border: 1px solid var(--md-outline-variant); border-radius: var(--shape-xl); }
.viz-card--wide { grid-column: 1 / -1; }
.viz-card__head h3 { margin: 0; font-size: 1rem; font-weight: 700; }
.viz-card__head p { margin: 2px 0 0; font-size: 0.84rem; color: var(--md-on-surface-variant); }
.viz-card--empty { display: flex; align-items: center; gap: 14px; border-style: dashed; background: transparent; }
.viz-card--empty > .material-symbols-outlined { font-size: 32px; color: var(--md-outline); }
.viz-legend { list-style: none; display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 0; padding: 0; font-size: 0.8rem; color: var(--md-on-surface-variant); }
.viz-legend li { display: flex; align-items: center; gap: 6px; }
.viz-key { width: 10px; height: 10px; border-radius: 3px; flex: none; }

/* Columns: a hairline grid with its scale on the left, the columns growing
   from the baseline, 2px of surface between stacked parts. */
.vchart { display: grid; gap: 6px; }
.vchart__plot { position: relative; height: 180px; margin-left: 40px; }
.vchart__tick { position: absolute; left: 0; right: 0; height: 0; border-top: 1px solid var(--viz-grid); }
.vchart__tick:first-child { border-top-color: var(--viz-axis); }
.vchart__tick span { position: absolute; right: 100%; padding-right: 8px; transform: translateY(-50%); white-space: nowrap;
    font-size: 0.72rem; color: var(--md-on-surface-variant); font-variant-numeric: tabular-nums; }
.vchart__cols, .vchart__x { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); }
.vchart__cols { position: absolute; inset: 0; gap: 2px; }
.vchart__col { height: 100%; display: flex; justify-content: center; border-radius: 4px; outline: none; }
.vchart__col:hover, .vchart__col:focus-visible { background: color-mix(in srgb, var(--md-on-surface) 6%, transparent); }
.vchart__col:focus-visible { box-shadow: inset 0 0 0 2px var(--nav-active-mark); }
.vchart__stack { width: min(24px, 70%); height: 100%; display: flex; flex-direction: column-reverse; gap: 2px; }
.vchart__seg { display: block; flex: none; min-height: 2px; }
.vchart__seg:last-child { border-radius: 4px 4px 0 0; }
.vchart__x { margin-left: 40px; font-size: 0.72rem; color: var(--md-on-surface-variant); text-align: center; }
.vchart__x span { white-space: nowrap; overflow: visible; }

/* Horizontal bars: name, bar, figure. */
.hbars { list-style: none; display: grid; gap: 6px; margin: 0; padding: 0; }
.hbars__row { display: grid; grid-template-columns: minmax(0, 220px) minmax(0, 1fr) auto; gap: 12px; align-items: center;
    padding: 3px 6px; margin: 0 -6px; border-radius: 6px; outline: none; }
.hbars__row:hover, .hbars__row:focus-visible { background: color-mix(in srgb, var(--md-on-surface) 5%, transparent); }
.hbars__name { font-size: 0.86rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbars__track { display: flex; gap: 2px; height: 14px; }
.hbars__bar { display: block; height: 100%; min-width: 3px; background: var(--viz-1); border-radius: 0 4px 4px 0; }
.hbars--stacked .hbars__bar { border-radius: 0; }
.hbars--stacked .hbars__bar:last-child { border-radius: 0 4px 4px 0; }
.hbars__bar--other { background: var(--viz-other); }
.hbars__value { min-width: 56px; text-align: right; font-size: 0.84rem; font-weight: 600; font-variant-numeric: tabular-nums; }

/* The tooltip (main.js): the figure first, then what it is. */
.viz-tip { position: fixed; z-index: 200; display: grid; gap: 3px; max-width: 280px; padding: 8px 10px; pointer-events: none;
    background: var(--md-surface); color: var(--md-on-surface); border: 1px solid var(--md-outline-variant);
    border-radius: 8px; box-shadow: var(--elev-3); font-size: 0.8rem; }
.viz-tip strong { font-weight: 600; font-size: 0.76rem; color: var(--md-on-surface-variant); }
.viz-tip__row { display: flex; align-items: center; gap: 6px; }
.viz-tip__row i { width: 12px; height: 3px; border-radius: 2px; flex: none; }
.viz-tip__row b { font-weight: 700; }
.viz-table summary { cursor: pointer; font-size: 0.8rem; font-weight: 600; color: var(--md-primary); width: max-content; }
.viz-table .table-wrap { margin-top: 8px; max-height: 280px; overflow: auto; }

@media (max-width: 900px) {
    .viz-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
    .hbars__row { grid-template-columns: minmax(0, 1fr) auto; }
    .hbars__track { grid-column: 1 / -1; grid-row: 2; }
    .vchart__plot { height: 150px; }
}

/* ── Dossiers ────────────────────────────────────────────────────────────── */
.badge--ds-to_plan   { background: var(--c-blue-bg);  color: var(--c-blue); }
.badge--ds-planning  { background: var(--c-amber-bg); color: var(--c-amber); }
.badge--ds-planned   { background: var(--c-indigo-bg); color: var(--c-indigo); }
.badge--ds-under_way { background: var(--c-amber-bg); color: var(--c-amber); }
.badge--ds-delivered { background: var(--c-teal-bg);  color: var(--c-teal); }
.badge--ds-done      { background: var(--md-surface-container-high); color: var(--md-on-surface-variant); }
.badge--ds-cancelled { background: transparent; color: var(--md-on-surface-variant); box-shadow: inset 0 0 0 1px var(--md-outline); }

/* The dossier's packages: delivered, on the road, planned, left to plan. */
.pkg { display: grid; gap: 8px; }
.pkg__head { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; justify-content: space-between; }
.pkg-bar { display: flex; height: 14px; border-radius: 999px; overflow: hidden; background: var(--md-surface-container); box-shadow: inset 0 0 0 1px var(--md-outline-variant); }
.pkg-bar i { display: block; height: 100%; }
.pkg-bar__delivered { background: var(--md-primary); }
.pkg-bar__on_road { background: var(--c-amber); }
.pkg-bar__planned { background: repeating-linear-gradient(45deg, var(--md-primary) 0 4px, transparent 4px 8px); opacity: .6; }
.pkg-bar__left { background: var(--md-surface-container); box-shadow: inset 0 0 0 1px var(--md-outline-variant); }
.pkg__legend { display: flex; flex-wrap: wrap; gap: 6px 18px; color: var(--md-on-surface-variant); }
.pkg__legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

/* The dossier a mission belongs to, at the top of its form. */
.dossier-ref { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: var(--shape-md);
               background: var(--md-surface-container); }
.dossier-ref > .material-symbols-outlined { color: var(--md-primary); }

/* Which dossier: one row each, the whole row a link. */
.pick-list { display: grid; gap: 8px; }
.pick-list__row { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 12px 14px;
                  border: 1px solid var(--md-outline-variant); border-radius: var(--shape-md); color: inherit; text-decoration: none; }
.pick-list__row:hover { background: var(--md-surface-container); border-color: var(--md-outline); text-decoration: none; }
.pick-list__row > .material-symbols-outlined { color: var(--md-primary); }
.pick-list__main { display: grid; gap: 2px; min-width: 0; }
@media (max-width: 560px) { .pick-list__row { grid-template-columns: auto 1fr; } .pick-list__row .badge { grid-column: 2; justify-self: start; } }

/* ── Check-lists ─────────────────────────────────────────────────────────── */
.badge--stop    { background: var(--c-red-bg); color: var(--c-red); }
.badge--reserve { background: var(--c-amber-bg); color: var(--c-amber); }
.is-inactive { opacity: .55; }

/* The mission's thread: one row of steps on a wide screen, a column on a
   phone. The step in hand stands out; a blocked one is red. */
.flow { list-style: none; margin: 4px 0 0; padding: 0; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 0; }
.flow__step { position: relative; display: grid; gap: 8px; justify-items: start; align-content: start; padding: 0 10px 0 0; min-width: 0; }
.flow__step::before { content: ""; position: absolute; top: 15px; left: 34px; right: 4px; height: 2px; background: var(--md-outline-variant); }
.flow__step:last-child::before { display: none; }
.flow__step--done::before { background: var(--md-primary); }
.flow__dot { position: relative; z-index: 1; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%;
             font-size: 18px; background: var(--md-surface-container); color: var(--md-on-surface-variant); border: 2px solid var(--md-outline-variant); }
.flow__step--done .flow__dot { background: var(--md-primary); border-color: var(--md-primary); color: var(--md-on-primary); }
.flow__step--current .flow__dot { background: var(--md-primary-container); border-color: var(--md-primary); color: var(--md-on-primary-container);
                                  box-shadow: 0 0 0 4px color-mix(in srgb, var(--md-primary) 18%, transparent); }
.flow__step--blocked .flow__dot { background: var(--c-red-bg); border-color: var(--c-red); color: var(--c-red); }
.flow__body { display: grid; gap: 2px; min-width: 0; }
.flow__title { font-weight: 600; font-size: .92rem; }
.flow__step--todo .flow__title { color: var(--md-on-surface-variant); font-weight: 500; }
.flow__line { font-size: .8rem; color: var(--md-on-surface-variant); overflow-wrap: anywhere; }
.flow__step--current .flow__line { color: var(--md-on-surface); }
.flow__step--blocked .flow__line { color: var(--c-red); }
.flow__link { font-size: .8rem; font-weight: 600; }
.flow--cancelled { opacity: .55; }
.flow__history { margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--md-outline-variant); }
.flow__history a { margin-left: 4px; }
@media (max-width: 900px) {
    .flow { grid-auto-flow: row; gap: 0; }
    .flow__step { grid-template-columns: 32px 1fr; gap: 12px; padding: 0 0 16px; }
    .flow__step::before { top: 34px; bottom: 2px; left: 15px; right: auto; width: 2px; height: auto; }
}
.mission-blocked { align-items: flex-start; margin-top: 14px; }
.mission-blocked .small { margin-top: 4px; }
.alert--info { background: var(--c-blue-bg); color: var(--c-blue); }

/* The signatures at the foot of a sheet, as on the paper one. */
.signers { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin: 4px 0 16px; }
.signers--read { margin: 18px 0 0; }
.signer { display: grid; gap: 4px; align-content: start; padding: 14px; border: 1px solid var(--md-outline-variant);
          border-radius: var(--shape-md); background: var(--md-surface-container-low); min-width: 0; }
.signer--error { border-color: var(--c-red); box-shadow: 0 0 0 1px var(--c-red); }
.signer--done { border-top: 3px solid var(--md-primary); }
.signer--refused { border-top: 3px solid var(--c-red); }
.signer--waiting { border-style: dashed; }
.signer__role { font-size: .75rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--md-on-surface-variant); }
.signer__name { font-weight: 600; font-size: 1.02rem; }
.signer__label { font-size: .85rem; font-weight: 600; margin-top: 8px; }
.signer .pin-input { margin: 4px 0 0; }
.signer .alert { margin: 8px 0 0; }
.signer__pledge { margin: 6px 0 0; font-size: .82rem; color: var(--md-on-surface-variant); font-style: italic; }
.signer__pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.signer__when { display: flex; gap: 6px; align-items: center; font-size: .82rem; color: var(--md-on-surface-variant); margin-top: 4px; }
.signer__when .material-symbols-outlined { font-size: 18px; }
.signer--done .signer__when .material-symbols-outlined { color: var(--md-primary); }
.signer--refused .signer__when { color: var(--c-red); }
.signer__note { font-size: .85rem; font-style: italic; }
.activation-input { height: 48px; text-align: center; font-family: ui-monospace, monospace; font-size: 1.2rem; letter-spacing: .12em; text-transform: uppercase; }
.check-sign__next { text-align: center; margin: 10px 0 0; }
.check-decide .circuit__decide { margin-top: 0; padding-top: 0; border-top: 0; }
.worklist { display: grid; gap: 22px; }
.worklist__block .form-section__title { margin-bottom: 8px; }
.rule-note { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--shape-md); background: var(--md-surface-container); }
.rule-note .material-symbols-outlined { color: var(--md-primary); }

/* ── The sheet, at the truck (inspections/fill.html) ──
   One line per point, the answer at the thumb; the progress sticks under
   the top bar; the signatures as at the foot of the paper sheet. */
.sheet { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; max-width: 760px; width: 100%; margin: 0 auto; }
.sheet-head { display: grid; gap: 4px; padding: 18px 20px; border-radius: var(--shape-lg); background: var(--md-surface);
              box-shadow: var(--elev-1); border-top: 4px solid var(--md-primary); }
.sheet-head__kind { font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--md-primary); }
.sheet-head__unit { font-size: 1.6rem; font-weight: 700; letter-spacing: .02em; line-height: 1.15; }
.sheet-head__route { color: var(--md-on-surface-variant); font-size: .9rem; }
.sheet-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.sheet-chip { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px 4px 8px; border-radius: 999px; font-size: .8rem;
              background: var(--md-surface-container); color: var(--md-on-surface); }
.sheet-chip .material-symbols-outlined { font-size: 16px; color: var(--md-on-surface-variant); }
.sheet-chip--ok { background: var(--c-green-bg); color: var(--c-green); }
.sheet-chip--due { background: var(--c-amber-bg); color: var(--c-amber); }
.sheet-chip--late { background: var(--c-red-bg); color: var(--c-red); }
.sheet-chip--ok .material-symbols-outlined, .sheet-chip--due .material-symbols-outlined,
.sheet-chip--late .material-symbols-outlined { color: inherit; }
.sheet-papers { display: grid; gap: 4px; margin-top: 8px; }
.sheet-papers__row { display: flex; justify-content: space-between; gap: 10px; align-items: center; font-size: .88rem; }

.sheet-progress { position: sticky; top: 52px; z-index: 5; display: grid; gap: 8px; padding: 10px 16px; border-radius: var(--shape-lg);
                  background: color-mix(in srgb, var(--md-surface) 92%, transparent); backdrop-filter: blur(8px); box-shadow: var(--elev-1); }
.sheet-progress__top { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: .88rem; }
.sheet-progress__count { color: var(--md-on-surface-variant); font-variant-numeric: tabular-nums; }
.sheet-progress__count strong { color: var(--md-on-surface); font-size: 1rem; }
.sheet-progress__result { font-weight: 600; font-size: .82rem; padding: 2px 10px; border-radius: 999px; }
.sheet-progress__result:empty { display: none; }
.sheet-progress__bar { height: 6px; border-radius: 999px; background: var(--md-surface-container-high); overflow: hidden; }
.sheet-progress__bar span { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--md-primary); transition: width .25s ease; }
.sheet-progress--ok .sheet-progress__result { background: var(--c-green-bg); color: var(--c-green); }
.sheet-progress--reserves .sheet-progress__result { background: var(--c-amber-bg); color: var(--c-amber); }
.sheet-progress--reserves .sheet-progress__bar span { background: var(--c-amber); }
.sheet-progress--stop .sheet-progress__result { background: var(--c-red-bg); color: var(--c-red); }
.sheet-progress--stop .sheet-progress__bar span { background: var(--c-red); }

.sheet-legend { display: flex; align-items: center; gap: 8px; margin: 0 4px; font-size: .8rem; color: var(--md-on-surface-variant); }
.stop-mark { display: inline-grid; place-items: center; flex: none; width: 15px; height: 15px; margin-right: 7px; border-radius: 50%;
             border: 1.5px solid var(--c-red); color: var(--c-red); font-size: .66rem; font-weight: 800; line-height: 1; vertical-align: 1px; }
.sheet-legend .stop-mark { margin-right: 0; }

.sheet-sec { border-radius: var(--shape-lg); background: var(--md-surface); box-shadow: var(--elev-1); overflow: hidden; }
.sheet-sec__head { display: flex; align-items: center; gap: 10px; padding: 14px 16px 10px; }
.sheet-sec__name { flex: 1; margin: 0; font-size: 1rem; font-weight: 700; }
.sheet-sec__count { font-size: .78rem; font-weight: 600; padding: 2px 9px; border-radius: 999px; font-variant-numeric: tabular-nums;
                    background: var(--md-surface-container); color: var(--md-on-surface-variant); }
.sheet-sec--done .sheet-sec__count { background: var(--md-primary-container); color: var(--md-on-primary-container); }
.sheet-sec__all { border: 0; background: none; padding: 4px 2px; font: inherit; font-size: .82rem; font-weight: 600; color: var(--md-primary); cursor: pointer; }
.sheet-sec__all:hover { text-decoration: underline; }
.sheet-sec--done .sheet-sec__all { visibility: hidden; }
.sheet-list { list-style: none; margin: 0; padding: 0; }
.sheet-pt { border-top: 1px solid var(--md-outline-variant); transition: background .15s ease; }
.sheet-pt__row { display: flex; align-items: center; gap: 12px; padding: 10px 16px; min-height: 56px; }
.sheet-pt__label { flex: 1; min-width: 0; font-size: .94rem; line-height: 1.3; }
.sheet-pt--no { background: color-mix(in srgb, var(--c-red-bg) 55%, transparent); box-shadow: inset 3px 0 0 var(--c-red); }
.sheet-pt--missing { animation: sheet-missing 1.6s ease; }
@keyframes sheet-missing { 0%, 60% { background: var(--c-amber-bg); } 100% { background: transparent; } }
.sheet-pt__no { display: grid; gap: 8px; padding: 0 16px 12px; }
.sheet-note { width: 100%; height: 40px; padding: 0 12px; border: 1px solid var(--md-outline-variant); border-radius: var(--shape-md);
              background: var(--md-surface); font: inherit; font-size: .9rem; color: var(--md-on-surface); }
.sheet-note:focus { outline: 2px solid var(--md-primary); border-color: transparent; }

/* Oui / Non / N/A: a compact segmented pill, colored once chosen. */
.tri { flex: none; display: inline-grid; grid-template-columns: repeat(3, 1fr); padding: 3px; gap: 2px; border-radius: 999px;
       background: var(--md-surface-container); }
.tri__opt { position: relative; display: block; }
.tri__opt input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.tri__opt span { display: block; min-width: 50px; padding: 7px 10px; border-radius: 999px; text-align: center; font-size: .82rem; font-weight: 600;
                 color: var(--md-on-surface-variant); cursor: pointer; transition: background .12s ease, color .12s ease; }
.tri__opt input:hover + span { color: var(--md-on-surface); }
.tri__opt input:focus-visible + span { outline: 2px solid var(--md-primary); outline-offset: 1px; }
.tri__opt--yes input:checked + span { background: var(--c-green); color: #fff; }
.tri__opt--no input:checked + span { background: var(--c-red); color: #fff; }
.tri__opt--na input:checked + span { background: var(--md-on-surface-variant); color: var(--md-surface); }
.sheet-pt--done:not(.sheet-pt--no) .sheet-pt__label { color: var(--md-on-surface-variant); }

.sheet-sides { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.sheet-sides__q { font-size: .82rem; color: var(--md-on-surface-variant); margin-right: 2px; }
.sheet-side { position: relative; }
.sheet-side input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.sheet-side span { display: block; padding: 5px 12px; border-radius: 999px; border: 1px solid var(--md-outline-variant); font-size: .82rem; cursor: pointer; background: var(--md-surface); }
.sheet-side input:checked + span { border-color: var(--c-red); background: var(--c-red); color: #fff; }
.sheet-side input:focus-visible + span { outline: 2px solid var(--md-primary); outline-offset: 1px; }

.sheet-sign { display: grid; gap: 10px; padding: 18px 20px 20px; border-radius: var(--shape-lg); background: var(--md-surface); box-shadow: var(--elev-1); }
.sheet-sign__title { margin: 0; font-size: 1.1rem; }
.sheet-sign__lead { margin: 0 0 4px; font-size: .88rem; color: var(--md-on-surface-variant); }
.sheet-sign__btn { height: 50px; font-size: 1rem; border-radius: 999px; }
.sheet-sign__next { margin: 0; text-align: center; font-size: .8rem; color: var(--md-on-surface-variant); }
.signer__who { display: flex; gap: 12px; align-items: center; }
.signer__avatar { display: grid; place-items: center; flex: none; width: 42px; height: 42px; border-radius: 50%; font-weight: 700; font-size: .9rem;
                  background: var(--md-primary-container); color: var(--md-on-primary-container); }
.signer__avatar--driver { background: var(--c-blue-bg); color: var(--c-blue); }
.signer__avatar--empty { background: var(--md-surface-container); color: var(--md-on-surface-variant); }
.signer__avatar .material-symbols-outlined { font-size: 20px; }
.signer__number { font-size: .78rem; color: var(--md-on-surface-variant); }
.signer__hint { margin: 4px 0 0; font-size: .8rem; color: var(--md-on-surface-variant); }

@media (max-width: 480px) {
    .sheet-head, .sheet-sign { padding: 16px; }
    .sheet-head__unit { font-size: 1.35rem; }
    .sheet-pt__row { padding: 10px 12px; gap: 10px; }
    .sheet-sec__head { padding: 12px 12px 8px; }
    .sheet-pt__no { padding: 0 12px 12px; }
    .tri__opt span { min-width: 42px; padding: 7px 7px; }
}

/* The signed sheet, read back (inspections/detail.html). */
.sheet-head__top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.sheet-head__top > div { display: grid; gap: 4px; min-width: 0; }
.sheet-head__alert { margin-top: 12px; }
.sheet-head__action { margin-top: 12px; }
.sheet-pt__row--read { min-height: 46px; }
.sheet-pt__seen { display: block; margin-top: 2px; font-size: .8rem; color: var(--c-red); }
.val { flex: none; min-width: 50px; padding: 4px 10px; border-radius: 999px; text-align: center; font-size: .8rem; font-weight: 600;
       background: var(--md-surface-container); color: var(--md-on-surface-variant); }
.val--yes { background: none; color: var(--c-green); }
.val--no { background: var(--c-red); color: #fff; }
.sheet-sec--found { box-shadow: var(--elev-1), inset 0 3px 0 var(--c-red); }
.sheet-verdict { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-radius: var(--shape-md); font-weight: 600; font-size: .92rem; }
.sheet-verdict--ok { background: var(--c-green-bg); color: var(--c-green); }
.sheet-verdict--reserves { background: var(--c-amber-bg); color: var(--c-amber); }
.sheet-verdict--stop { background: var(--c-red-bg); color: var(--c-red); }
.sheet-decide .circuit__decide { margin-top: 0; }

/* ── The mission budget (budgets/mission.html) ──
   The same page as the checklist sheet: the figures stick under the top
   bar; one line per cost, the calculation beside the planner's amount. */
.text-danger { color: var(--c-red); }
.text-warning { color: var(--c-amber); }
.budget { max-width: 820px; }
.budget-sum { position: sticky; top: 52px; z-index: 5; display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px;
              border-radius: var(--shape-lg); overflow: hidden; box-shadow: var(--elev-1);
              background: var(--md-outline-variant); }
.budget-sum--flat { position: static; box-shadow: none; border: 1px solid var(--md-outline-variant); }
.budget-sum__cell { display: grid; gap: 2px; padding: 10px 16px; background: color-mix(in srgb, var(--md-surface) 94%, transparent);
                    backdrop-filter: blur(8px); min-width: 0; }
.budget-sum__cell span { font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--md-on-surface-variant); }
.budget-sum__cell strong { font-size: 1.15rem; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.budget-sum__cell em { font-style: normal; font-size: .82rem; font-weight: 600; color: var(--c-green); }
.budget-sum__cell--margin strong { color: var(--c-green); }
.budget-sum--red .budget-sum__cell--margin strong, .budget-sum--red .budget-sum__cell--margin em { color: var(--c-red); }
.budget-sum--red .budget-sum__cell--margin { background: color-mix(in srgb, var(--c-red-bg) 70%, var(--md-surface)); }
.budget-note { margin: 0 4px; font-size: .82rem; color: var(--c-amber); }
/* The planner's figures: what the trip costs, the total first. */
.budget-sum--cost { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
.budget-sum__cell--total strong { font-size: 1.35rem; color: var(--md-primary); }
.budget-sum__cell strong small { font-size: .72rem; font-weight: 500; color: var(--md-on-surface-variant); }

.budget-card { padding-bottom: 4px; }
/* The trip on its own line, its distance and days side by side below it,
   the same width together. */
.budget-trip { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 4px 16px 0; }
.budget-trip .field:first-child { grid-column: 1 / -1; }
.budget-trip .field { margin: 0; }
.budget-hint { margin: 8px 16px 12px; font-size: .8rem; color: var(--md-on-surface-variant); }

.budget-crit { border-top: 1px solid var(--md-outline-variant); padding: 10px 16px; display: grid; gap: 8px; }
.budget-crit__row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.budget-crit__name { flex: 1; min-width: 160px; font-weight: 500; }
.budget-crit__on { display: block; font-size: .75rem; font-weight: 400; color: var(--md-on-surface-variant); }
.lvls { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; border-radius: 999px; background: var(--md-surface-container); }
.lvl { position: relative; }
.lvl input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.lvl span { display: block; padding: 6px 12px; border-radius: 999px; font-size: .82rem; font-weight: 600; color: var(--md-on-surface-variant); cursor: pointer; white-space: nowrap; }
.lvl span em { font-style: normal; font-weight: 500; margin-left: 5px; opacity: .8; }
.lvl input:checked + span { background: var(--md-primary); color: var(--md-on-primary); }
.lvl input:focus-visible + span { outline: 2px solid var(--md-primary); outline-offset: 1px; }
.lvl input:disabled + span { cursor: default; }

.bline { border-top: 1px solid var(--md-outline-variant); }
.bline__row { display: flex; align-items: center; gap: 12px; padding: 10px 16px; min-height: 56px; }
.bline__what { flex: 1; min-width: 0; }
.bline__name { font-weight: 500; }
.bline__how { font-size: .78rem; color: var(--md-on-surface-variant); font-variant-numeric: tabular-nums; }
/* A line's amount on the right, how it is worked out right under it. */
.bline__figure { flex: none; display: grid; justify-items: end; gap: 1px; max-width: 62%; text-align: right; }
.bline__figure .bline__how { text-align: right; }
.bline__amount { flex: none; display: flex; align-items: center; gap: 6px; }
.bline__amount input { width: 150px; height: 38px; padding: 0 10px; text-align: right; border: 1px solid var(--md-outline-variant);
                       border-radius: var(--shape-md); background: var(--md-surface); font: inherit; font-weight: 600;
                       font-variant-numeric: tabular-nums; color: var(--md-on-surface); }
.bline__amount input:focus { outline: 2px solid var(--md-primary); border-color: transparent; }
.bline__amount--read { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bline__cur { font-size: .75rem; font-weight: 500; color: var(--md-on-surface-variant); }
.bline--edited { background: color-mix(in srgb, var(--c-amber-bg) 55%, transparent); box-shadow: inset 3px 0 0 var(--c-amber); }
.bline--edited .bline__amount input { border-color: var(--c-amber); }
.bline__edit { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; padding: 0 16px 12px; }
.bline__calc { font-size: .8rem; color: var(--md-on-surface-variant); white-space: nowrap; }
.bline__reset { border: 0; background: none; padding: 4px 2px; font: inherit; font-size: .8rem; font-weight: 600; color: var(--md-primary); cursor: pointer; }
.bline__reset:hover { text-decoration: underline; }
.bline__reason { font-size: .85rem; font-style: italic; }
.bline--sub .bline__row { min-height: 48px; }
.bline--total .bline__row { min-height: 60px; }
.bline--total .bline__name, .bline--total .bline__amount--read { font-size: 1.1rem; font-weight: 700; }
.budget-foot .sheet-list > .bline:first-child, .budget-foot .sheet-list > .bline[hidden] + .bline { border-top: 0; }
.budget-actions { display: grid; gap: 10px; padding: 4px 16px 16px; }

/* The budget step of the planning form (budgets/_step.html). */
.budget-step { display: grid; gap: 12px; }
.budget-step .budget-trip { padding: 0; }
.budget-step .budget-hint { margin: 0; }
/* The total: its name on the left, the amount on the right like every
   amount above it; the vehicle / escorts split under the amount. */
.budget-step__total { display: grid; grid-template-columns: 1fr auto; align-items: baseline; gap: 2px 12px; padding: 12px 16px; border-radius: var(--shape-md);
                      background: var(--md-primary-container); color: var(--md-on-primary-container); }
.budget-step__total strong { text-align: right; white-space: nowrap; }
.budget-step__total span { font-size: .78rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.budget-step__total strong { font-size: 1.35rem; font-variant-numeric: tabular-nums; }
.budget-step__total strong small { font-size: .75rem; font-weight: 500; }
.budget-step__total em { grid-column: 1 / -1; justify-self: end; font-style: normal; font-size: .82rem; }
.budget-crits { list-style: none; margin: 0; padding: 0; border: 1px solid var(--md-outline-variant); border-radius: var(--shape-md); }
.budget-crits .budget-crit:first-child { border-top: 0; }
.budget-group { border: 1px solid var(--md-outline-variant); border-radius: var(--shape-md); overflow: hidden; }
.budget-group__head { padding: 10px 16px; font-weight: 600; background: var(--md-surface-container); }
.budget-group .bline:first-child { border-top: 0; }
.bline__edit--read { grid-template-columns: auto 1fr; }
.escort-editor { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.escort-editor__row { display: grid; grid-template-columns: 1.2fr 1.2fr 1fr auto; gap: 8px; align-items: center; }
.escort-editor__row select, .escort-editor__row input { height: 42px; padding: 0 10px; border: 1px solid var(--md-outline-variant); border-radius: var(--shape-md);
                                                       background: var(--md-surface); font: inherit; color: var(--md-on-surface); min-width: 0; }
.recap__budget dd { font-weight: 700; color: var(--md-primary); }
@media (max-width: 600px) {
    .escort-editor__row { grid-template-columns: 1fr auto; }
    .escort-editor__row select, .escort-editor__row input { grid-column: 1; }
    .escort-editor__row [data-escort-remove] { grid-column: 2; grid-row: 1; }
}

/* Administration → Budget. */
.budget-rates { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; margin-top: 12px; }
.budget-rates > div { display: grid; gap: 2px; padding: 10px 12px; border-radius: var(--shape-md); background: var(--md-surface-container); }
.budget-rates span { font-size: .78rem; color: var(--md-on-surface-variant); }
.crit-cards { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); margin-top: 6px; }
.crit-card { display: grid; gap: 8px; padding: 12px 14px; border: 1px solid var(--md-outline-variant); border-radius: var(--shape-md); }
.crit-card__head { display: flex; align-items: center; gap: 8px; }
.crit-card__head strong { flex: 1; }
.crit-card__levels { display: flex; flex-wrap: wrap; gap: 6px; }
.crit-lvl { padding: 3px 10px; border-radius: 999px; font-size: .8rem; background: var(--md-surface-container); }
.crit-lvl em { font-style: normal; color: var(--md-on-surface-variant); margin-left: 3px; }
.crit-lvl--default { background: var(--md-primary-container); color: var(--md-on-primary-container); }
.lvl-rows { display: grid; gap: 8px; margin-bottom: 8px; }
.lvl-row { display: grid; grid-template-columns: 1fr 110px auto auto; gap: 8px; align-items: center; }
.lvl-row > input[type=text] { height: 40px; padding: 0 10px; border: 1px solid var(--md-outline-variant); border-radius: var(--shape-md);
                               background: var(--md-surface); font: inherit; color: var(--md-on-surface); }
.lvl-row__pct input { width: 100%; }
.lvl-row__default { display: inline-flex; align-items: center; gap: 4px; font-size: .82rem; white-space: nowrap; }

/* A criterion in % or a formula: the fields of the other kind are hidden. */
.crit-form[data-mode="pct"] .only-amount, .crit-form[data-mode="amount"] .only-pct { display: none !important; }
/* A formula's option: its name and amount, then what it includes below. */
.crit-form[data-mode="amount"] .lvl-row { grid-template-columns: 1fr 150px auto auto; padding: 8px;
    border: 1px solid var(--md-outline-variant); border-radius: var(--shape-md); background: var(--md-surface-container-low); }
.lvl-row__amount input { width: 100%; }
.lvl-row > .lvl-row__includes { grid-column: 1 / -1; height: 36px; font-size: .86rem; }
@media (max-width: 600px) {
    .crit-form[data-mode="amount"] .lvl-row { grid-template-columns: 1fr 120px; }
}

/* How the mark-ups come on top (budgets/_calc.html): the cost without
   them, each addition and its sum, then the total below. */
.budget-calc { display: grid; gap: 0; padding: 8px 16px; border: 1px dashed var(--md-outline-variant); border-radius: var(--shape-md); }
.budget-foot .budget-calc { margin: 12px 16px 4px; }
.calc-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 7px 0; }
.calc-row__what { min-width: 0; font-weight: 500; }
/* On the right: the amount, and under it how it is worked out. */
.calc-row__figure { display: grid; justify-items: end; gap: 1px; text-align: right; }
.calc-row__figure em { font-style: normal; font-size: .78rem; font-weight: 400; color: var(--md-on-surface-variant); font-variant-numeric: tabular-nums; }
.calc-row strong { font-variant-numeric: tabular-nums; white-space: nowrap; }
.calc-row strong small { font-size: .72rem; font-weight: 500; color: var(--md-on-surface-variant); }
.calc-row__add { color: var(--c-amber); }
.calc-row--sum { border-bottom: 1px solid var(--md-outline-variant); }
.calc-head { padding: 10px 0 2px; font-size: .74rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--md-on-surface-variant); }
.calc-note { margin: 0 0 4px; font-size: .78rem; color: var(--c-amber); }

/* Administration → Budget: one column, four blocks of rows -- each opens
   its short form --, the example trip on top, its total pinned below. */
.cfg { max-width: 880px; margin-inline: auto; display: grid; gap: 14px; }
.cfg-intro { margin: 0; color: var(--md-on-surface-variant); }
.cfg-card { display: grid; gap: 10px; margin: 0; }
.cfg-head { display: grid; gap: 2px; }
.cfg-head .card-title { display: flex; align-items: center; gap: 8px; margin: 0; }
.cfg-head p { margin: 0; }
.cfg-step { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; flex: none;
            background: var(--md-primary-container); color: var(--md-on-primary-container); font-size: .82rem; font-weight: 700; }
.cfg-rows { list-style: none; margin: 0; padding: 0; }
.cfg-row { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; align-items: center; padding: 10px 4px;
           border-top: 1px solid var(--md-outline-variant); color: inherit; text-decoration: none; border-radius: var(--shape-sm); }
.cfg-rows > li:first-child .cfg-row { border-top: 0; }
.cfg-row:hover { background: var(--md-surface-container-low); }
.cfg-row__main { display: grid; gap: 2px; min-width: 0; }
.cfg-row__main strong { font-weight: 600; }
.cfg-row__val { display: grid; justify-items: end; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cfg-row__sub { font-size: .82rem; font-weight: 400; color: var(--md-on-surface-variant); white-space: normal; }
.cfg-row__sub--inline { display: inline; }
.cfg-row__tags { display: flex; gap: 6px; flex-wrap: wrap; }
.cfg-lvls { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.cfg-add { justify-self: start; }
.lvl-row--simple { grid-template-columns: 1fr 130px auto; }
.crit-form[data-mode="amount"] .lvl-row--simple { grid-template-columns: 1fr 150px auto; padding: 0; border: 0; background: none; }
.lvl-row--simple input[readonly] { color: var(--md-on-surface-variant); background: var(--md-surface-container-low); }
.lvl-row--simple [data-lvl-remove][hidden] { display: inline-flex; visibility: hidden; }
/* Deleting a fee or a mark-up: under its form, apart from saving. */
.cfg-delete { display: flex; justify-content: flex-start; margin-top: 8px; padding-top: 10px; border-top: 1px solid var(--md-outline-variant); }
.cfg-delete__btn { color: var(--c-red); }
/* A row with its own pencil and bin (the fuels). */
.cfg-li--acts { display: flex; align-items: center; gap: 4px; border-top: 1px solid var(--md-outline-variant); }
.cfg-rows > li.cfg-li--acts:first-child { border-top: 0; }
.cfg-li--acts .cfg-row { flex: 1; min-width: 0; border-top: 0; }
.cfg-acts { display: flex; gap: 2px; flex-shrink: 0; }
.cfg-acts form { margin: 0; }
.cfg-acts__del { color: var(--c-red); }
.lvl-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
@media (max-width: 600px) {
    .crit-form[data-mode="amount"] .lvl-row--simple, .lvl-row--simple { grid-template-columns: 1fr 120px auto; }
}

/* A formula on the Budget page: its options, each with what it includes. */
.crit-opts { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.crit-opt { display: grid; grid-template-columns: auto 1fr; gap: 0 8px; align-items: baseline; font-size: .84rem; }
.crit-opt__name { font-weight: 600; }
.crit-opt__name em { font-style: normal; font-weight: 500; color: var(--md-on-surface-variant); margin-left: 4px; }
.crit-opt--default .crit-opt__name { color: var(--md-primary); }
.crit-opt__what { color: var(--md-on-surface-variant); }
/* In the planning form: what the chosen option includes. */
.budget-crit__includes { font-size: .8rem; color: var(--md-on-surface-variant); }
.budget-crit__includes strong { color: var(--md-on-surface); font-weight: 600; }

/* A mission's escorts, on its file. */
.escort-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.escort-list__row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--md-outline-variant); border-radius: var(--shape-md); }
.escort-list__icon { color: var(--c-blue); }
.escort-list__main { flex: 1; min-width: 0; }

@media (max-width: 600px) {
    .budget-sum__cell { padding: 8px 10px; }
    .budget-sum__cell strong { font-size: 1rem; }
    .bline__row { padding: 10px 12px; }
    .bline__amount input { width: 120px; }
    .bline__edit { grid-template-columns: 1fr; padding: 0 12px 12px; }
    .lvl-row { grid-template-columns: 1fr 90px; }
}

/* Answers, read back. */
.check-h { font-size: .95rem; margin: 14px 0 6px; color: var(--md-on-surface-variant); }
.check-rows { list-style: none; margin: 0; padding: 0; }
.check-rows__row { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 8px 0; border-top: 1px solid var(--md-outline-variant); }
.check-rows__row:first-child { border-top: 0; }
.check-rows__row--no { background: var(--c-red-bg); margin: 0 -8px; padding: 8px; border-radius: 6px; }
.check-val { font-weight: 600; font-size: .85rem; white-space: nowrap; }
.check-val--yes { color: var(--md-primary); }
.check-val--no { color: var(--c-red); }
.check-val--na, .check-val--none { color: var(--md-on-surface-variant); }

/* Filling a part, on a phone in the yard. */
.check-result { padding: 12px 14px; border-radius: var(--shape-md); font-weight: 600; margin-bottom: 12px; }
.check-result--ok { background: var(--c-green-bg); color: var(--c-green); }
.check-result--reserves { background: var(--c-amber-bg); color: var(--c-amber); }
.check-result--stop { background: var(--c-red-bg); color: var(--c-red); }
.check-result--todo { background: var(--md-surface-container); color: var(--md-on-surface-variant); }

/* ── The gérant's approval of a dossier ──────────────────────────────────── */
/* One strip under the dossier's head: what is to be done about it. */
.approval-strip { display: flex; align-items: center; gap: 14px; padding: 14px 18px; margin: 0 0 16px;
                  border-radius: var(--shape-lg); border: 1px solid var(--md-outline-variant); background: var(--md-surface); }
.approval-strip > .material-symbols-outlined { flex: none; display: grid; place-items: center; width: 40px; height: 40px;
                  border-radius: 50%; font-size: 22px; background: var(--md-surface-container-high); color: var(--md-on-surface-variant); }
.approval-strip__body { flex: 1; min-width: 0; }
.approval-strip > div:not(.approval-strip__body) { flex: 1; min-width: 0; }
.approval-strip .small { margin-top: 3px; color: var(--md-on-surface-variant); }
.approval-strip__action { flex: none; margin: 0; }
.approval-strip__warn { color: var(--c-amber) !important; font-weight: 600; }
.approval-strip__fix { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 6px; }
.approval-strip__fix a { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; }
.approval-strip__fix .material-symbols-outlined { font-size: 16px; }
.approval-strip--send { border-color: color-mix(in srgb, var(--md-primary) 45%, transparent);
                        background: color-mix(in srgb, var(--md-primary) 6%, var(--md-surface)); }
.approval-strip--send > .material-symbols-outlined { background: var(--md-primary); color: var(--md-on-primary); }
.approval-strip--pending > .material-symbols-outlined { background: var(--c-amber-bg); color: var(--c-amber); }
.approval-strip--approved > .material-symbols-outlined { background: var(--c-green-bg); color: var(--c-green); }
.approval-strip--refused { border-color: color-mix(in srgb, var(--c-red) 40%, transparent); background: color-mix(in srgb, var(--c-red-bg) 45%, var(--md-surface)); }
.approval-strip--refused > .material-symbols-outlined { background: var(--c-red-bg); color: var(--c-red); }
@media (max-width: 640px) {
    .approval-strip { flex-wrap: wrap; }
    .approval-strip__action, .approval-strip__action .btn { width: 100%; justify-content: center; }
}

/* The gérant's desk: the dossier's figures, its missions, his decision. */
.approval-desk { border: 1px solid color-mix(in srgb, var(--md-primary) 35%, transparent); }
.approval-desk__head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.approval-desk__head > .material-symbols-outlined { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%;
                       background: var(--md-primary); color: var(--md-on-primary); font-size: 22px; }
.approval-desk__decide { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--md-outline-variant); }
/* ── Approbations: the inbox ──
   Three doors at the top (to decide, checklists, history), then what waits
   for me as cards, oldest first, and my own requests as rows. */
.inbox-tiles { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.inbox-tile { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: var(--shape-lg);
              border: 1px solid var(--md-outline-variant); background: var(--md-surface-container-low);
              color: inherit; text-decoration: none; transition: border-color .15s, background .15s; }
.inbox-tile:hover { text-decoration: none; border-color: var(--md-outline); background: var(--md-surface-container); }
.inbox-tile__icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; flex: none; font-size: 22px;
                    background: var(--md-surface-container-high); color: var(--md-on-surface-variant); }
.inbox-tile__text { display: grid; min-width: 0; line-height: 1.25; }
.inbox-tile__text strong { font-size: 1.5rem; font-weight: 700; }
.inbox-tile__text strong.inbox-tile__word { font-size: 1.05rem; padding: 3px 0 2px; }
.inbox-tile__text > span { font-size: 0.8rem; color: var(--md-on-surface-variant); }
.inbox-tile--due .inbox-tile__icon { background: var(--md-primary); color: var(--md-on-primary); }
.inbox-tile--on { border-color: var(--md-primary); background: color-mix(in srgb, var(--md-primary) 7%, var(--md-surface));
                  box-shadow: inset 0 -3px 0 var(--md-primary); }

.inbox-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px 12px; margin-bottom: 14px; }

/* Signature or code missing: said before the list, with the way to fix it. */
.inbox-ready { display: flex; align-items: center; gap: 14px; padding: 12px 16px; border-radius: var(--shape-lg);
               border: 1px solid color-mix(in srgb, var(--c-amber) 45%, transparent);
               background: color-mix(in srgb, var(--c-amber-bg) 60%, var(--md-surface)); }
.inbox-ready > .material-symbols-outlined { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; flex: none;
               background: var(--c-amber-bg); color: var(--c-amber); font-size: 20px; }
.inbox-ready__body { flex: 1; min-width: 0; }
.inbox-ready__body .small { color: var(--md-on-surface-variant); margin-top: 2px; }

/* A document waiting for me: its title and its button open it, the card
   itself stays a card (no underline running across it). */
.inbox-list { display: grid; gap: 10px; }
.inbox-card { display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; padding: 14px 16px;
              border: 1px solid var(--md-outline-variant); border-left: 4px solid var(--md-primary); border-radius: var(--shape-md);
              background: var(--md-surface); color: inherit; transition: border-color .15s, box-shadow .15s; }
.inbox-card:hover { border-color: var(--md-outline); border-left-color: var(--md-primary); box-shadow: var(--elev-1); }
.inbox-card--late, .inbox-card--late:hover { border-left-color: var(--c-red); }
a.inbox-card__title { color: var(--md-on-surface); }
a.inbox-card__title:hover { color: var(--md-primary); text-decoration: none; }
.inbox-card__go:hover { text-decoration: none; }
/* What waits for me in a sector's own page (purchase orders in Achats). */
.inbox-elsewhere { display: flex; align-items: center; gap: 10px; margin-top: 12px; padding: 10px 14px;
                   border: 1px dashed var(--md-outline-variant); border-radius: var(--shape-md); font-size: 0.9rem; }
.inbox-elsewhere > .material-symbols-outlined { color: var(--md-primary); }
.inbox-elsewhere > span:nth-child(2) { flex: 1; }
.inbox-elsewhere .btn:hover { text-decoration: none; }
.inbox-card__icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; font-size: 22px;
                    background: color-mix(in srgb, var(--md-primary) 12%, var(--md-surface)); color: var(--md-primary); }
.inbox-card__main { display: grid; gap: 2px; min-width: 0; }
.inbox-card__kind { font-size: 0.74rem; font-weight: 600; letter-spacing: .02em; text-transform: uppercase; color: var(--md-on-surface-variant); }
.inbox-card__title { font-size: 1rem; font-weight: 700; overflow-wrap: anywhere; }
.inbox-card__meta { font-size: 0.8rem; color: var(--md-on-surface-variant); }
.inbox-card__side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.inbox-card__amount { font-weight: 700; white-space: nowrap; }
.inbox-card__go .material-symbols-outlined { font-size: 18px; }

.inbox-age { display: inline-flex; align-items: center; gap: 4px; font-size: 0.78rem; font-weight: 600; white-space: nowrap;
             padding: 2px 8px; border-radius: 999px; background: var(--md-surface-container-high); color: var(--md-on-surface-variant); }
.inbox-age .material-symbols-outlined { font-size: 15px; }
.inbox-age--late { background: var(--c-red-bg); color: var(--c-red); }

/* Nothing to decide: said plainly, in green. */
.inbox-clear { display: flex; align-items: center; gap: 14px; padding: 18px; border-radius: var(--shape-md);
               background: color-mix(in srgb, var(--c-green-bg) 55%, var(--md-surface)); }
.inbox-clear > .material-symbols-outlined { font-size: 34px; color: var(--c-green); }

/* My requests: where each one is. */
.inbox-rows { display: grid; }
.inbox-row { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 11px 6px;
             border-top: 1px solid var(--md-outline-variant); color: inherit; text-decoration: none; }
.inbox-row:first-child { border-top: none; }
.inbox-row:hover { text-decoration: none; background: var(--md-surface-container); }
.inbox-row__icon { color: var(--md-on-surface-variant); font-size: 22px; }
.inbox-row__icon--approved { color: var(--c-green); }
.inbox-row__icon--rejected { color: var(--c-red); }
.inbox-row__main { display: grid; gap: 1px; min-width: 0; }
.inbox-row__quote { color: var(--c-red); }
.inbox-row__side { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.inbox-steps { display: inline-flex; align-items: center; gap: 8px; font-size: 0.8rem; color: var(--md-on-surface-variant); }

/* Mine / all, as links. */
.seg__btn { display: inline-block; padding: 6px 12px; font-size: 0.8rem; font-weight: 600; color: var(--md-on-surface-variant); text-decoration: none; }
.seg__btn + .seg__btn { border-left: 1px solid var(--md-outline-variant); }
.seg__btn:hover { background: var(--md-surface-container); text-decoration: none; }
.seg__btn--on { background: var(--md-surface-container-high); color: var(--md-on-surface); }

@media (max-width: 640px) {
    .inbox-tiles { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; }
    .inbox-tile { padding: 10px 12px; gap: 10px; }
    .inbox-tile__icon { width: 34px; height: 34px; font-size: 19px; }
    .inbox-card { grid-template-columns: auto 1fr; gap: 10px 12px; padding: 12px; }
    .inbox-card__side { grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between; }
    .inbox-card__go { margin-left: auto; }
    .inbox-row { grid-template-columns: auto 1fr; }
    .inbox-row__side { grid-column: 2; justify-content: flex-start; }
    .inbox-ready { flex-wrap: wrap; }
    .inbox-ready .btn { width: 100%; justify-content: center; }
}

/* Closing a work order: one line per job, ticked when done, a note beside. */
.close-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--md-outline-variant); border-radius: var(--shape-md); }
.close-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(160px, 40%); gap: 12px; align-items: center; padding: 8px 12px; }
.close-row + .close-row { border-top: 1px solid var(--md-outline-variant); }
.close-row__job { display: flex; align-items: center; gap: 10px; min-width: 0; cursor: pointer; }
.close-row__job input { width: 18px; height: 18px; flex: none; margin: 0; accent-color: var(--md-primary); cursor: pointer; }
.close-row__label { font-weight: 600; overflow-wrap: anywhere; }
.close-row__job:has(input:not(:checked)) .close-row__label { color: var(--md-on-surface-variant); font-weight: 500; }
.close-row__job .badge { flex: none; }
.close-row__note { height: 34px; padding: 0 10px; font: inherit; font-size: 0.85rem; width: 100%;
                   border: 1px solid var(--md-outline-variant); border-radius: var(--shape-control);
                   background: var(--md-surface); color: var(--md-on-surface); }
.close-row__note:focus { outline: none; border-color: var(--md-primary); }
:root[data-theme="dark"] .close-row__note { border-color: #334155; background: var(--md-surface-container); }
@media (max-width: 560px) {
    .close-row { grid-template-columns: 1fr; gap: 6px; }
    .close-row__note { margin-left: 28px; width: calc(100% - 28px); }
}

.approval-lines__pick { width: 36px; text-align: center; }
.approval-lines__pick input { width: 18px; height: 18px; accent-color: var(--c-red); cursor: pointer; }
.approval-lines label { cursor: pointer; }
.approval-lines tr:has(input:checked) td { background: color-mix(in srgb, var(--c-red-bg) 55%, transparent); }
.approval-lines__row--red td:last-child { background: color-mix(in srgb, var(--c-red-bg) 40%, transparent); }
.badge-row { display: inline-flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }

/* ── A form in steps (the mission planning) ──────────────────────────────── */
/* As the other long forms: the steps listed at the side -- the one on
   screen marked, those done ticked, those to come locked -- with how far it
   has got on top of the list; one step's cards beside it. */
.wizard { gap: 18px; }
.wizard-toc { gap: 2px; }
.wizard-toc__progress { display: grid; gap: 6px; padding: 2px 10px 12px; }
.wizard__count { font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--md-primary); }
.wizard__bar { height: 6px; border-radius: 99px; background: var(--md-surface-container-high); overflow: hidden; }
.wizard__bar i { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--md-primary); transition: width .35s ease; }
.wizard-toc__steps { display: grid; gap: 2px; }
.wizard-toc a.is-locked { opacity: .5; cursor: default; }
.wizard-toc a.is-locked:hover { background: none; }
.wizard-toc a.is-locked .form-toc__state { font-size: 15px !important; }
.wizard__body { display: grid; gap: 14px; min-width: 0; }
.wstep { display: grid; gap: 14px; min-width: 0; animation: wstep-in .22s ease; }
@keyframes wstep-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.wstep__error { display: flex; gap: 10px; align-items: center; padding: 11px 14px; border-radius: var(--shape-lg);
    background: var(--c-red-bg); color: var(--c-red); font-size: .9rem; font-weight: 500; }
.wstep__error[hidden] { display: none; }
.wizard-form [aria-invalid="true"] { border-color: var(--c-red) !important; box-shadow: 0 0 0 3px color-mix(in srgb, var(--c-red) 15%, transparent); }
.wizard-bar__gap { flex: 1; }
.wizard-bar [hidden] { display: none !important; }
@media (max-width: 900px) {
    .wizard-toc { flex-wrap: nowrap; align-items: center; }
    .wizard-toc__progress { display: none; }
    .wizard-toc__steps { display: flex; gap: 4px; }
}

/* The end: everything read again, each line with its way back. */
.wrecap { background: var(--md-surface); border: 1px solid color-mix(in srgb, var(--md-primary) 35%, transparent); border-radius: var(--shape-xl); overflow: hidden; }
.wrecap__head { display: flex; align-items: center; gap: 16px; padding: 16px 18px; border-bottom: 1px solid var(--md-outline-variant);
    background: color-mix(in srgb, var(--md-primary) 5%, var(--md-surface)); }
.wrecap__pic { flex: none; width: 150px; height: 84px; border-radius: var(--shape-md); background: #f7f6f2; display: grid; place-items: center; overflow: hidden; }
.wrecap__pic img { max-width: 100%; max-height: 80px; object-fit: contain; }
.wrecap__pic .material-symbols-outlined { font-size: 34px; color: var(--md-outline); }
.wrecap__title { margin: 0; font-size: 1.1rem; }
.wrecap__total { margin-left: auto; text-align: right; display: grid; gap: 2px; }
.wrecap__total span { font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--md-on-surface-variant); }
.wrecap__total strong { font-size: 1.35rem; color: var(--md-primary); font-variant-numeric: tabular-nums; white-space: nowrap; }
.wrecap__rows { margin: 0; padding: 4px 18px 8px; }
.wrecap__row { display: grid; grid-template-columns: 170px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--md-outline-variant); }
.wrecap__row:last-child { border-bottom: 0; }
.wrecap__row dt { color: var(--md-on-surface-variant); font-size: .88rem; }
.wrecap__row dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.wrecap__edit { display: inline-flex; align-items: center; gap: 4px; border: 0; background: none; padding: 6px 8px; border-radius: 8px;
    color: var(--md-primary); font: inherit; font-size: .82rem; font-weight: 600; cursor: pointer; }
.wrecap__edit:hover { background: color-mix(in srgb, var(--md-primary) 10%, transparent); }
.wrecap__edit .material-symbols-outlined { font-size: 16px; }
@media (max-width: 640px) {
    .wrecap__head { flex-wrap: wrap; }
    .wrecap__pic { width: 100%; }
    .wrecap__total { margin-left: 0; text-align: left; }
    .wrecap__row { grid-template-columns: minmax(0, 1fr) auto; }
    .wrecap__row dt { grid-column: 1 / -1; margin-bottom: -6px; font-size: .8rem; }
    .wrecap__edit span:last-child { display: none; }
    .wizard-bar .btn { flex: 1; justify-content: center; }
    .wizard-bar__gap, .wizard-bar .form-bar__state { display: none !important; }
}

/* The vehicle step: whole units only -- ready ones, the one the planner
   formed, and the way to form one. */
.pick-group { display: grid; gap: 8px; }
.pick-group .pick-step { margin: 0; }
.pick--formed { border-color: var(--md-primary); background: color-mix(in srgb, var(--md-primary) 5%, var(--md-surface)); }
.pick__swap { justify-self: start; border: 0; background: none; padding: 2px 0; font: inherit; font-size: .8rem; font-weight: 600;
    color: var(--md-primary); cursor: pointer; }
.pick__swap:hover { text-decoration: underline; }
.assemble { display: grid; gap: 12px; padding: 14px 16px; border: 1px dashed var(--md-outline); border-radius: var(--shape-lg);
    background: var(--md-surface-container-low, var(--md-surface)); }
.assemble__head { display: flex; align-items: center; gap: 10px; }
.assemble__head > .material-symbols-outlined { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px;
    background: var(--md-primary-container); color: var(--md-on-primary-container); font-size: 20px; flex: none; }
.assemble__row { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto; gap: 10px; align-items: end; }
.assemble__row .field { margin: 0; }
.assemble__plus { align-self: center; margin-top: 18px; color: var(--md-on-surface-variant); }
.assemble__take { min-height: 42px; }
@media (max-width: 720px) {
    .assemble__row { grid-template-columns: 1fr; }
    .assemble__plus { margin: -4px auto; }
}

/* The dossier's mission drafts: plannings not finished, taken up again. */
.draft-list { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 8px; }
.draft-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px dashed var(--md-outline);
    border-radius: var(--shape-lg); background: var(--md-surface-container-low, var(--md-surface)); }
.draft-row__icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; flex: none;
    background: var(--c-amber-bg); color: var(--c-amber); font-size: 20px; }
.draft-row__main { flex: 1; min-width: 0; }
.draft-row form { margin: 0; }
@media (max-width: 640px) { .draft-row { flex-wrap: wrap; } .draft-row__main { flex-basis: calc(100% - 50px); } }

/* ── Groupage: other dossiers on the truck ─────────────────────────────────── */
.load-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.load-list:empty { display: none; }
.load-row { display: grid; grid-template-columns: 12px minmax(0, 1fr) auto auto; gap: 10px; align-items: center;
    padding: 8px 10px; border: 1px solid var(--md-outline-variant); border-radius: var(--shape-lg); }
.load-row__who { display: grid; min-width: 0; }
.load-row__n { display: flex; align-items: center; gap: 6px; }
.load-row__n input { width: 70px; height: 38px; padding: 0 10px; border: 1px solid var(--md-outline-variant); border-radius: var(--shape-control);
    background: var(--md-surface); color: var(--md-on-surface); font: inherit; text-align: right; }
.join { display: grid; gap: 8px; padding: 12px; border: 1px solid var(--md-outline-variant); border-radius: var(--shape-lg);
    background: var(--md-surface-container-low, var(--md-surface)); }
.join__search { height: 42px; padding: 0 12px; border: 1px solid var(--md-outline-variant); border-radius: var(--shape-control);
    background: var(--md-surface); color: var(--md-on-surface); font: inherit; }
.join__group { margin: 6px 0 0; font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--md-on-surface-variant); }
.join__list { display: grid; gap: 6px; }
.join-cand { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 12px; align-items: center; text-align: left; width: 100%;
    padding: 10px 12px; border: 1px solid var(--md-outline-variant); border-radius: var(--shape-lg); background: var(--md-surface);
    color: var(--md-on-surface); font: inherit; cursor: pointer; }
.join-cand:hover { border-color: var(--md-primary); }
.join-cand:focus-visible { outline: 3px solid var(--nav-active-mark); outline-offset: 2px; }
.join-cand--far { opacity: .7; }
.join-cand__main { display: grid; gap: 3px; min-width: 0; }
.join-cand__side { display: grid; justify-items: end; gap: 1px; text-align: right; white-space: nowrap; }
.join-cand__add { color: var(--md-primary); font-size: 26px; }
.join-cand__chips { display: flex; flex-wrap: wrap; gap: 4px; }
.join-chip { font-size: .72rem; font-weight: 600; padding: 1px 8px; border-radius: 99px; }
.join-chip--ok { background: var(--c-green-bg); color: var(--c-green); }
.join-chip--no { background: var(--md-surface-container-high); color: var(--md-on-surface-variant); }
.stop-editor [data-stop-dossier] { display: none; }
.stop-editor--shared [data-stop-dossier] { display: block; }
.stop-editor--shared .stop-editor__row { grid-template-columns: 140px 1fr 1fr 170px auto; }
@media (max-width: 640px) {
    .load-row { grid-template-columns: 12px minmax(0, 1fr) auto; }
    .load-row__n { grid-column: 2 / 3; }
    .join-cand { grid-template-columns: minmax(0, 1fr) auto; }
    .join-cand__side { justify-items: start; text-align: left; grid-column: 1 / 2; }
    .stop-editor--shared .stop-editor__row { grid-template-columns: 1fr auto; }
    .stop-editor--shared .stop-editor__row > :nth-child(4) { grid-column: 1 / 2; }
}

/* The split of a shared truck's cost: each dossier its colour. */
.sd-0 { background: var(--c-blue, #3730A3); }
.sd-1 { background: var(--c-amber, #B45309); }
.sd-2 { background: #0F766E; }
.sd-3 { background: #7C3AED; }
.split-dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; flex: none; }
.budget-split { display: grid; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--md-outline-variant); }
.budget-split__head { display: grid; gap: 2px; }
.split-bar { display: flex; height: 12px; border-radius: 99px; overflow: hidden; background: var(--md-surface-container-high); }
.split-bar i { display: block; height: 100%; }
.split-rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.split-row { display: grid; grid-template-columns: 12px minmax(0, 1fr) auto 70px auto; gap: 10px; align-items: center; }
.split-row__who { display: grid; min-width: 0; }
.split-row__value { width: 110px; }
.split-row__value input { height: 36px; }
.split-row__pct { text-align: right; font-variant-numeric: tabular-nums; color: var(--md-on-surface-variant); }
.split-row__amount { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.split-row:not(:has(.split-row__value)) { grid-template-columns: 12px minmax(0, 1fr) 70px auto; }
@media (max-width: 640px) {
    .split-row, .split-row:not(:has(.split-row__value)) { grid-template-columns: 12px minmax(0, 1fr) auto; }
    .split-row__value { grid-column: 2 / 3; }
}
.badge--shared { background: var(--c-blue-bg); color: var(--c-blue); }
.budget-split--read { padding: 12px 0 0; margin-top: 12px; }

/* A signature drawn with the finger: a hired truck's driver on the checklist. */
.sign-pad { position: relative; border: 1px dashed var(--md-outline); border-radius: var(--shape-control);
    background: var(--md-surface); height: 150px; touch-action: none; }
.sign-pad canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: crosshair;
    border-radius: inherit; background: #fff; }
.sign-pad__hint { position: absolute; left: 0; right: 0; top: 50%; transform: translateY(-50%); text-align: center;
    color: var(--md-on-surface-variant); font-size: .9rem; pointer-events: none; }
.sign-pad__clear { position: absolute; right: 6px; bottom: 6px; }
.sign-pad--missing { border-color: var(--c-red); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c-red) 20%, transparent); }
.sign-shot { display: block; max-width: 260px; max-height: 110px; background: #fff; border: 1px solid var(--md-outline-variant);
    border-radius: var(--shape-control); margin-top: 6px; }
.badge--hired { background: var(--c-amber-bg); color: var(--c-amber); }

/* The mission's truck: ours, or hired from a transporter. */
.hire-switch { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
@media (max-width: 520px) { .hire-switch { grid-template-columns: minmax(0, 1fr); } }
.hire-switch__opt { display: flex; gap: 10px; align-items: center; padding: 12px 14px; border: 1px solid var(--md-outline-variant);
    border-radius: var(--shape-md); background: var(--md-surface); cursor: pointer; }
.hire-switch__opt input { position: absolute; opacity: 0; pointer-events: none; }
.hire-switch__opt > .material-symbols-outlined { color: var(--md-on-surface-variant); }
.hire-switch__opt strong { display: block; }
.hire-switch__opt small { display: block; color: var(--md-on-surface-variant); font-size: .82rem; }
.hire-switch__opt:has(input:checked) { border-color: var(--md-primary); box-shadow: 0 0 0 2px color-mix(in srgb, var(--md-primary) 25%, transparent);
    background: color-mix(in srgb, var(--md-primary) 5%, var(--md-surface)); }
.hire-switch__opt:has(input:checked) > .material-symbols-outlined { color: var(--md-primary); }
.hire-switch__opt:has(input:focus-visible) { outline: 2px solid var(--md-primary); outline-offset: 2px; }
.hire-new { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 6px; }
.hire-new input { flex: 1 1 140px; min-width: 0; height: 36px; padding: 0 10px; border: 1px solid var(--md-outline-variant);
    border-radius: var(--shape-control); background: var(--md-surface); color: var(--md-on-surface); font: inherit; }
.hire-note { display: flex; gap: 6px; align-items: flex-start; margin: 4px 0 0; font-size: .88rem; color: var(--md-on-surface-variant); }
.hire-note .material-symbols-outlined { font-size: 18px; }

/* ── Purchasing: requests, orders, receipts ─────────────────────────────── */
.badge--po-draft     { background: var(--md-surface-container-high); color: var(--md-on-surface-variant); }
.badge--po-pending   { background: var(--c-amber-bg); color: var(--c-amber); }
.badge--po-refused   { background: var(--c-red-bg);   color: var(--c-red); }
.badge--po-approved  { background: var(--c-blue-bg);  color: var(--c-blue); }
.badge--po-partial   { background: var(--c-indigo-bg); color: var(--c-indigo); }
.badge--po-received  { background: var(--c-green-bg); color: var(--c-green); }
.badge--po-cancelled { background: transparent; color: var(--md-on-surface-variant); box-shadow: inset 0 0 0 1px var(--md-outline); }
.badge--pr-waiting   { background: var(--c-amber-bg); color: var(--c-amber); }
.badge--pr-partial   { background: var(--c-indigo-bg); color: var(--c-indigo); }
.badge--pr-ordered   { background: var(--c-green-bg); color: var(--c-green); }
.badge--pr-closed    { background: var(--md-surface-container-high); color: var(--md-on-surface-variant); }
.badge--pr-rejected  { background: var(--md-surface-container-high); color: var(--md-on-surface-variant); }
.badge--pr-preparing { background: var(--c-blue-bg);  color: var(--c-blue); }
.badge--pr-refused   { background: var(--c-red-bg);   color: var(--c-red); }
.badge--pr-pending   { background: var(--c-amber-bg); color: var(--c-amber); }
.badge--pr-approved  { background: var(--c-green-bg); color: var(--c-green); }

/* Requests for articles and bons de sortie. */
.badge--issue-pending   { background: var(--c-amber-bg); color: var(--c-amber); }
.badge--issue-approved  { background: var(--c-blue-bg);  color: var(--c-blue); }
.badge--issue-refused   { background: var(--c-red-bg);   color: var(--c-red); }
.badge--issue-handed    { background: var(--c-green-bg); color: var(--c-green); }
.badge--issue-cancelled { background: transparent; color: var(--md-on-surface-variant); box-shadow: inset 0 0 0 1px var(--md-outline); }
.badge--urgency-normal   { background: var(--md-surface-container-high); color: var(--md-on-surface-variant); }
.badge--urgency-urgent   { background: var(--c-amber-bg); color: var(--c-amber); }
.badge--urgency-critical { background: var(--c-red-bg);   color: var(--c-red); }
.need-form > .card + .card, .need-form > .card { margin-bottom: 16px; }
.need-for { display: flex; align-items: center; gap: 12px; }
.need-for > .material-symbols-outlined { color: var(--md-primary); }
.need-lines { display: flex; flex-direction: column; gap: 8px; }
.need-line { display: grid; grid-template-columns: minmax(200px, 3fr) 110px minmax(160px, 2fr) 36px; gap: 8px; align-items: center;
    padding: 8px; border: 1px solid var(--md-outline-variant); border-radius: var(--shape-control); background: var(--md-surface); }
.need-line > * { min-width: 0; }
.need-line__what { display: flex; flex-direction: column; gap: 6px; }
.need-line select, .need-line input { width: 100%; height: 40px; padding: 0 10px; border: 1px solid var(--md-outline-variant);
    border-radius: var(--shape-control); background: var(--md-surface); color: var(--md-on-surface); font: inherit; box-sizing: border-box; }
.need-line input[hidden] { display: none; }
.need-line__says { font-size: .84rem; font-weight: 600; padding: 4px 10px; border-radius: 999px; justify-self: start; }
.need-line__says:empty { display: none; }
.need-line__says.is-stock { background: var(--c-green-bg); color: var(--c-green); }
.need-line__says.is-split { background: var(--c-amber-bg); color: var(--c-amber); }
.need-line__says.is-buy { background: var(--c-blue-bg); color: var(--c-blue); }
@media (max-width: 760px) {
    .need-line { grid-template-columns: 1fr 100px 36px; }
    .need-line__what { grid-column: 1 / -1; }
    .need-line__says { grid-column: 1 / -1; grid-row: 3; }
}
.need-outcome { display: flex; flex-direction: column; gap: 10px; }
.need-outcome[hidden] { display: none; }
.need-outcome__row { display: flex; gap: 12px; align-items: flex-start; }
.need-outcome__row[hidden] { display: none; }
.need-outcome__row > .material-symbols-outlined { color: var(--md-primary); }
.need-list { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.need-list li { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; padding: 8px 10px; border-radius: var(--shape-control);
    background: var(--md-surface-container-low); }
.need-docs { display: flex; flex-wrap: wrap; gap: 12px; }
.need-doc { flex: 1 1 240px; display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--md-outline-variant);
    border-radius: var(--shape-md); color: inherit; text-decoration: none; }
.need-doc:hover { border-color: var(--md-primary); }
.need-doc > .material-symbols-outlined { color: var(--md-primary); }
.issue-verdict { min-width: 230px; }
.issue-verdict__why { display: block; width: 100%; margin-top: 6px; height: 36px; padding: 0 10px; border: 1px solid var(--c-red);
    border-radius: var(--shape-control); background: var(--md-surface); color: var(--md-on-surface); font: inherit; box-sizing: border-box; }
.issue-verdict__why[hidden] { display: none; }

/* A request's steps, in the order they happen. */
.pr-note { margin: 4px 0 0; color: var(--md-on-surface-variant); }
.pr-steps { list-style: none; display: flex; flex-wrap: wrap; gap: 4px 0; margin: 14px 0 0; padding: 0; }
.pr-steps__step { display: flex; align-items: center; gap: 8px; color: var(--md-on-surface-variant); font-size: .86rem; }
.pr-steps__step + .pr-steps__step::before { content: ""; width: 28px; height: 2px; margin: 0 8px; background: var(--md-outline-variant); }
.pr-steps__dot { flex: none; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%;
    border: 2px solid var(--md-outline-variant); font-weight: 700; font-size: .8rem; background: var(--md-surface); }
.pr-steps__dot .material-symbols-outlined { font-size: 16px; }
.pr-steps__step.is-done { color: var(--md-on-surface); }
.pr-steps__step.is-done .pr-steps__dot { background: var(--md-primary); border-color: var(--md-primary); color: var(--md-on-primary); }
.pr-steps__step.is-now { color: var(--md-on-surface); font-weight: 600; }
.pr-steps__step.is-now .pr-steps__dot { border-color: var(--md-primary); color: var(--md-primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--md-primary) 18%, transparent); }
@media (max-width: 600px) { .pr-steps__label { display: none; } .pr-steps__step.is-now .pr-steps__label { display: inline; } .pr-steps__step + .pr-steps__step::before { width: 14px; margin: 0 4px; } }

/* The prices table: articles down, sellers across. The article column stays
   in view when the table scrolls sideways on a phone. */
.pgrid-head { align-items: flex-start; gap: 12px; }
.pgrid-wrap { margin: 0 -4px; }
.pgrid { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .9rem; }
.pgrid th, .pgrid td { padding: 10px 12px; border-bottom: 1px solid var(--md-outline-variant); vertical-align: top; text-align: left; }
.pgrid thead th { background: var(--md-surface-container-low); font-weight: 400; }
.pgrid__art { position: sticky; left: 0; z-index: 1; background: var(--md-surface); min-width: 170px; max-width: 240px; font-weight: 400; }
.pgrid thead .pgrid__art { background: var(--md-surface-container-low); font-size: .75rem; font-weight: 600; text-transform: uppercase;
    letter-spacing: .04em; color: var(--md-on-surface-variant); vertical-align: bottom; }
.pgrid__q { min-width: 170px; }
.pgrid__qname { font-weight: 700; }
.pgrid__qname a { color: inherit; }
.pgrid__qtags { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0; }
.pgrid__qtags .chip { height: 20px; font-size: .72rem; padding: 0 8px; }
.chip--market { background: var(--c-amber-bg); color: var(--c-amber); border-color: transparent; }
.pgrid__qmeta { font-size: .78rem; color: var(--md-on-surface-variant); line-height: 1.35; }
.pgrid__qtools { display: flex; gap: 2px; margin: 4px -6px 0; }
.pgrid__cell { min-width: 150px; transition: background .12s; }
.pgrid__cell.is-best { background: color-mix(in srgb, var(--c-green-bg) 55%, transparent); }
.pgrid__cell.is-picked { box-shadow: inset 0 0 0 2px var(--md-primary); background: color-mix(in srgb, var(--md-primary) 7%, var(--md-surface)); }
.pgrid__price { width: 100%; height: 38px; padding: 0 10px; border: 1px solid var(--md-outline-variant); border-radius: var(--shape-control);
    background: var(--md-surface); color: var(--md-on-surface); font: inherit; font-variant-numeric: tabular-nums; text-align: right; box-sizing: border-box; }
.pgrid__price:focus { outline: none; border-color: var(--md-primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--md-primary) 20%, transparent); }
.pgrid__amount { font-weight: 700; font-variant-numeric: tabular-nums; }
.pgrid__unit { font-size: .78rem; }
.pgrid__pick { display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; cursor: pointer; font-size: .8rem; font-weight: 600;
    color: var(--md-on-surface-variant); user-select: none; }
.pgrid__pick input { width: 16px; height: 16px; margin: 0; accent-color: var(--md-primary); }
.pgrid__pick:has(input:checked) { color: var(--md-primary); }
.pgrid__pick:has(input:disabled) { opacity: .4; cursor: default; }
.pgrid__tag { display: inline-flex; align-items: center; gap: 2px; margin: 6px 6px 0 0; padding: 1px 8px; border-radius: 999px; font-size: .72rem; font-weight: 700; }
.pgrid__tag .material-symbols-outlined { font-size: 14px; }
.pgrid__tag--rec { background: var(--md-primary-container); color: var(--md-primary); }
.pgrid__tag--kept { background: var(--md-primary); color: var(--md-on-primary); }
.pgrid__none { color: var(--md-on-surface-variant); font-size: .82rem; font-style: italic; }
.pgrid__n { min-width: 210px; }
.pgrid__count { display: inline-block; padding: 2px 10px; border-radius: 999px; font-weight: 700; font-size: .8rem; font-variant-numeric: tabular-nums; }
.pgrid__count.is-ok { background: var(--c-green-bg); color: var(--c-green); }
.pgrid__count.is-short { background: var(--c-amber-bg); color: var(--c-amber); }
.pgrid__few { display: block; width: 100%; margin-top: 6px; height: 34px; padding: 0 8px; border: 1px solid var(--c-amber); border-radius: var(--shape-control);
    background: var(--md-surface); color: var(--md-on-surface); font: inherit; font-size: .82rem; box-sizing: border-box; }
.pgrid__few[hidden] { display: none; }
.pgrid__why { margin-top: 4px; color: var(--md-on-surface-variant); }
.pgrid__override td { background: color-mix(in srgb, var(--c-amber-bg) 45%, var(--md-surface)); }
.pgrid__override[hidden] { display: none; }
.pgrid__override-field { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: .86rem; font-weight: 600; }
.pgrid__override-field input { flex: 1 1 240px; min-width: 0; height: 36px; padding: 0 10px; border: 1px solid var(--c-amber);
    border-radius: var(--shape-control); background: var(--md-surface); color: var(--md-on-surface); font: inherit; font-weight: 400; }
.pgrid tfoot th, .pgrid tfoot td { border-bottom: 0; border-top: 2px solid var(--md-outline-variant); }
.pgrid__total strong { font-variant-numeric: tabular-nums; }
.pgrid-empty { text-align: center; }
.pgrid-empty__lines { list-style: none; margin: 12px 0 0; padding: 0; font-size: .85rem; color: var(--md-on-surface-variant); }

/* What the choice costs, and the orders it makes. */
.pgrid-sum { margin: 14px 0 0; padding: 12px 14px; border-radius: var(--shape-md); background: var(--md-surface-container-low); }
.pgrid-sum__title { font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--md-on-surface-variant); }
.pgrid-sum__cells { display: flex; flex-wrap: wrap; gap: 8px 28px; margin-top: 6px; align-items: baseline; }
.pgrid-sum__cells > div { display: flex; flex-direction: column; }
.pgrid-sum__cells > div > span { font-size: .8rem; color: var(--md-on-surface-variant); }
.pgrid-sum__cells strong { font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.pgrid-sum__total strong { font-size: 1.35rem; color: var(--md-primary); }
.pgrid-sum__orders { margin-top: 6px; color: var(--md-on-surface-variant); }
.pgrid-why { margin-top: 14px; }
.pgrid-check { margin-top: 12px; padding: 10px 14px; border-radius: var(--shape-md); border: 1px solid var(--c-amber); background: color-mix(in srgb, var(--c-amber-bg) 40%, var(--md-surface)); font-size: .88rem; }
.pgrid-check ul { margin: 6px 0 0; padding-left: 20px; }
.pgrid-check[hidden] { display: none; }
.pgrid-bar { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; align-items: center; margin-top: 14px; }
.pgrid-bar .form-bar__state { margin-right: auto; }
.pgrid-bar .form-bar__state[hidden] { display: none; }
.pgrid-quote { margin: 14px 0 0; padding: 10px 14px; border-left: 3px solid var(--nav-active-mark); background: var(--md-surface-container-low); border-radius: 0 var(--shape-md) var(--shape-md) 0; }
.pgrid-quote p { margin: 4px 0 0; white-space: pre-line; }
.pr-drop summary { cursor: pointer; display: flex; align-items: center; gap: 8px; color: var(--md-on-surface-variant); font-weight: 600; }
.approval-desk--lead { margin-bottom: 0; }

/* The quote window. */
.quote-new { padding: 10px 12px; border-radius: var(--shape-md); background: var(--md-surface-container-low); margin-bottom: 4px; }
.quote-new[hidden] { display: none; }
.quote-next { display: flex; align-items: center; gap: 6px; margin: 4px 0 0; }
.quote-next .material-symbols-outlined { font-size: 18px; }
[data-quote-form] [data-for-terms][hidden], [data-quote-form] [data-for-source][hidden] { display: none; }

.buy-desk__row { display: flex; flex-wrap: wrap; gap: 12px; }
.buy-desk__cell { flex: 1 1 260px; display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px;
    border-radius: var(--shape-control); background: var(--md-surface-container-low); }
.buy-desk__cell > .material-symbols-outlined { color: var(--md-primary); }

.po-lines { display: flex; flex-direction: column; gap: 8px; }
.po-lines__head, .po-line { display: grid; gap: 8px; align-items: start;
    grid-template-columns: minmax(160px, 3fr) 70px minmax(120px, 1.6fr) minmax(90px, 1fr) 32px; }
.po-lines[data-money="1"] .po-lines__head, .po-lines[data-money="1"] .po-line {
    grid-template-columns: minmax(150px, 2.6fr) 64px minmax(110px, 1.3fr) 96px 76px 96px minmax(84px, .9fr) 32px; }
.po-line > *, .po-lines__head > * { min-width: 0; }
.po-lines__head { font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--md-on-surface-variant); padding: 0 2px; }
.po-line { padding: 8px; border: 1px solid var(--md-outline-variant); border-radius: var(--shape-control); background: var(--md-surface); }
.po-line input, .po-line select { width: 100%; min-width: 0; height: 38px; padding: 0 8px; border: 1px solid var(--md-outline-variant);
    border-radius: var(--shape-control); background: var(--md-surface); color: var(--md-on-surface); font: inherit; box-sizing: border-box; }
.po-line__article { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.po-line__unit { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.po-line__factor { display: flex; align-items: center; gap: 4px; font-size: .85rem; color: var(--md-on-surface-variant); }
.po-line__factor[hidden] { display: none; }
.po-line__factor input { width: 70px; height: 32px; }
.po-line__amount { align-self: start; padding-top: 10px; font-weight: 600; text-align: right; }
.po-line__hint { font-size: .8rem; }
.po-lines__foot { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: center; }
.po-lines__total { font-size: 1rem; }
@media (max-width: 900px) {
    .po-lines__head { display: none; }
    .po-line, .po-lines[data-money="1"] .po-line { grid-template-columns: 1fr 1fr; }
    .po-line__article { grid-column: 1 / -1; }
}

.doc-sums-screen { margin: 10px 0 0 auto; width: min(340px, 100%); }
.doc-sums-screen > div { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--md-outline-variant); }
.doc-sums-screen__total { border-bottom: 0 !important; font-size: 1.05rem; }
.receive-input { width: 110px; height: 36px; padding: 0 8px; border: 1px solid var(--md-outline-variant);
    border-radius: var(--shape-control); background: var(--md-surface); color: var(--md-on-surface); font: inherit; text-align: right; }
/* The supplier's delivery note, photographed on receipt. */
.receive-paper { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--md-outline-variant); }
.receive-paper .form-section__title { margin: 0; }
.receipt-paper { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; }
.receipt-paper .material-symbols-outlined { font-size: 18px; }

/* ── RH et paie: the person's file, the month's pay ── */
.hr-secs { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 14px; margin-top: 16px; }
.hr-sec { border: 1px solid var(--md-outline-variant); border-radius: var(--shape-lg); padding: 14px 16px; background: var(--md-surface); }
.hr-sec__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.hr-sec__head h3 { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 0.95rem; }
.hr-sec__head h3 .material-symbols-outlined { font-size: 20px; color: var(--md-primary); }
.hr-sec__list { display: grid; gap: 8px; margin: 0; }
.hr-sec__list > div { display: grid; grid-template-columns: minmax(110px, 40%) 1fr; gap: 10px; align-items: baseline; }
.hr-sec__list dt { font-size: 0.8rem; color: var(--md-on-surface-variant); }
.hr-sec__list dd { margin: 0; font-size: 0.92rem; overflow-wrap: anywhere; }
.hr-block { margin-top: 18px; }
.hr-block + .hr-block { padding-top: 18px; border-top: 1px solid var(--md-outline-variant); }
.hr-block__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.hr-block__head h3 { margin: 0; font-size: 1.05rem; }
.hr-sub { margin: 18px 0 6px; font-size: 0.78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--md-on-surface-variant); }
.hr-contract { border: 1px solid var(--md-outline-variant); border-left: 4px solid var(--md-primary); border-radius: var(--shape-lg); padding: 14px 16px; }
.hr-contract__kind { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.hr-contract__label { font-size: 1.15rem; font-weight: 700; }
.hr-contract__actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.hr-pay { display: grid; grid-template-columns: minmax(200px, 280px) 1fr; gap: 16px; align-items: start; }
.hr-pay__gross { display: grid; gap: 2px; padding: 14px 16px; border-radius: var(--shape-lg); background: var(--c-green-bg); }
.hr-pay__gross > span:first-child { font-size: 0.8rem; color: var(--md-on-surface-variant); }
.hr-pay__gross strong { font-size: 1.5rem; color: var(--md-on-surface); }
.hr-pay__parts { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin: 0; }
.hr-pay__parts > div { padding: 10px 12px; border: 1px solid var(--md-outline-variant); border-radius: var(--shape-lg); }
.hr-pay__parts dt { font-size: 0.78rem; color: var(--md-on-surface-variant); }
.hr-pay__parts dd { margin: 2px 0 0; font-weight: 600; }
@media (max-width: 640px) { .hr-pay { grid-template-columns: 1fr; } }
.tab__dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-left: 4px; vertical-align: 2px; }
.tab__dot--bad { background: var(--c-red); }
.tab__dot--warn { background: var(--c-amber); }
.watch-list { list-style: none; margin: 0; padding: 0; display: grid; }
.watch-row { display: flex; align-items: center; gap: 12px; padding: 10px 2px; border-top: 1px solid var(--md-outline-variant); }
.watch-row:first-child { border-top: 0; }
.watch-row__main { flex: 1; min-width: 0; }
.pay-open { display: flex; gap: 6px; align-items: center; }
.pay-open select { height: 34px; border: 1px solid var(--md-outline-variant); border-radius: var(--shape-control); background: var(--md-surface);
    color: var(--md-on-surface); font: inherit; padding: 0 8px; }
.pay-kpi { font-size: 1.45rem; }
.pay-kpi--net { color: var(--md-primary); }
.pay-send { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; border-left: 4px solid var(--md-primary); }
.pay-table .pay-group td { background: var(--md-surface-container); font-size: 0.75rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: .06em; color: var(--md-on-surface-variant); padding-top: 6px; padding-bottom: 6px; }
.pay-table .pay-adj td { font-size: 0.85rem; padding-top: 2px; padding-bottom: 8px; padding-left: 28px; border-top: 0; color: var(--md-on-surface-variant); }
.pay-table tfoot td { font-weight: 700; border-top: 2px solid var(--md-on-surface); }
.pay-kinds { grid-template-columns: repeat(auto-fill, minmax(min(130px, 100%), 1fr)); }
.pay-kinds .status-tile:has(input:checked) { border-color: var(--md-primary); background: var(--c-green-bg); }
.pay-versions { display: grid; gap: 14px; }
.pay-version { border: 1px solid var(--md-outline-variant); border-radius: var(--shape-lg); padding: 14px 16px; }
.pay-version--current { border-color: var(--md-primary); box-shadow: inset 4px 0 0 var(--md-primary); }
.pay-version header { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.pay-version header .badge { margin-left: 6px; }
.pay-version__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; margin: 12px 0; }
.pay-version__grid dt { font-size: 0.78rem; color: var(--md-on-surface-variant); }
.pay-version__grid dd { margin: 2px 0 0; font-weight: 600; }
.pay-scale td { vertical-align: middle; }
.pay-scale--read { max-width: 480px; }
/* The salary as it is built (new contract, salary line): read like a payslip. */
.pay-block { border: 1px solid var(--md-outline-variant); border-radius: var(--shape-lg); padding: 14px 16px 6px; background: var(--md-surface); }
.pay-block__head { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 12px; }
.pay-block__head > .material-symbols-outlined { flex: none; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%;
    background: var(--c-green-bg); color: var(--md-primary); font-size: 20px; }
.pay-block__head strong { font-size: 0.98rem; }
.pay-block__head p { margin: 2px 0 0; font-size: 0.82rem; color: var(--md-on-surface-variant); }
.pay-block__opt { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 999px; font-size: 0.72rem; font-weight: 600;
    background: var(--md-surface-container); color: var(--md-on-surface-variant); vertical-align: 1px; }
.pay-build { display: grid; border: 1px solid var(--md-outline-variant); border-radius: var(--shape-lg); overflow: hidden; margin-bottom: 10px; }
.pay-build__row { display: grid; grid-template-columns: 1fr minmax(150px, 220px); gap: 12px; align-items: center; padding: 8px 14px;
    border-top: 1px solid var(--md-outline-variant); }
.pay-build__row:first-child { border-top: 0; }
.pay-build__row label { display: grid; gap: 1px; font-size: 0.92rem; color: var(--md-on-surface); font-weight: 500; }
.pay-build__row label span { font-size: 0.74rem; font-weight: 400; color: var(--md-on-surface-variant); }
.pay-build__row--base { background: var(--md-surface-container-low, var(--md-surface)); padding-top: 12px; padding-bottom: 12px; }
.pay-build__input input, .pay-scale .input-unit input { flex: 1; min-width: 0; height: 40px; border: 0; outline: none; background: transparent;
    padding: 0 10px; font: inherit; color: var(--md-on-surface); text-align: right; font-variant-numeric: tabular-nums; }
.pay-build__sub { padding: 8px 14px 4px; font-size: 0.72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
    color: var(--md-on-surface-variant); border-top: 1px solid var(--md-outline-variant); background: var(--md-surface-container); }
.pay-build__sub + .pay-build__row { border-top: 0; }
.pay-build__total { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 12px 14px;
    background: var(--c-green-bg); border-top: 1px solid var(--md-outline-variant); }
.pay-build__total > span { font-size: 0.85rem; font-weight: 600; color: var(--md-on-surface-variant); }
.pay-build__total strong { font-size: 1.25rem; white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--md-on-surface); }
.pay-now { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: var(--shape-lg); background: var(--md-surface-container);
    font-size: 0.88rem; color: var(--md-on-surface-variant); }
.pay-now .material-symbols-outlined { font-size: 20px; }
@media (max-width: 520px) { .pay-build__row { grid-template-columns: 1fr; gap: 6px; } }

/* ── Mission timeline: a truck waiting on site against the free time ──── */
.badge--wait-ok   { background: var(--c-blue-bg);  color: var(--c-blue); }
.badge--wait-soon { background: var(--c-amber-bg); color: var(--c-amber); }
.badge--wait-over { background: var(--c-red-bg);   color: var(--c-red); }
.stops__wait { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin-top: 4px; }
.mission-card__wait { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.wait-strip { display: flex; align-items: center; gap: 8px; padding: 9px 12px; border-radius: 8px; font-size: 0.9rem;
              background: var(--c-blue-bg); color: var(--c-blue); }
.wait-strip--soon { background: var(--c-amber-bg); color: var(--c-amber); }
.wait-strip--over { background: var(--c-red-bg); color: var(--c-red); }
.wait-strip .material-symbols-outlined { font-size: 18px; }
.chrono-table td, .chrono-table th { white-space: nowrap; }
.chrono-table td:first-child { white-space: normal; min-width: 180px; }
.chrono-table__road td { color: var(--md-on-surface-variant); }

/* ── Parts store: slips as cards (bons de sortie, orders to receive) ──
   Phone first: one card per slip, stacked; two side by side on a wide
   screen. The number and state on top, who it is for, what goes out, then
   the date, value and the one action. */
.store-block { margin: 0 0 16px; }
.store-block__title { font-size: 0.95rem; font-weight: 600; margin: 4px 0 8px; }
.slip-list { display: grid; grid-template-columns: 1fr; gap: 8px; }
.slip {
    display: grid; gap: 4px; padding: 12px 14px; min-width: 0;
    border: 1px solid var(--md-outline-variant); border-radius: var(--shape-lg);
    background: var(--md-surface);
}
.slip--approved { border-left: 3px solid var(--c-blue); }
.slip--pending  { border-left: 3px solid var(--c-amber); }
.slip__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.slip__number { font-weight: 700; font-size: 0.95rem; }
.slip__for { font-size: 0.86rem; overflow-wrap: anywhere; }
.slip__lines { font-size: 0.84rem; color: var(--md-on-surface-variant); overflow-wrap: anywhere; }
.slip__foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
@media (min-width: 900px) {
    .slip-list { grid-template-columns: 1fr 1fr; }
}
/* The stock number: read and dictated, so the same width for every digit. */
.part-code { font-variant-numeric: tabular-nums; font-weight: 600; letter-spacing: .02em; }

/* ── Achats's cart ──
   The top bar's cart, its count like the bell's. */
.topbar-cart { position: relative; text-decoration: none; }
.topbar-cart--on { color: var(--md-primary); }
.buy-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin: 4px 0 8px; }
.buy-head .store-block__title { margin: 0; }

/* ── The cart's page ──
   Phone first. A light list of articles; each folds to one line -- the
   arrow on the left, the article, how it stands and what it costs on the
   right. Open, its offers read as a short list of tiles: the one kept is
   tinted, the cheapest says so. Nothing shouts but what is still to do. */
.cart-tools { display: flex; justify-content: flex-end; gap: 4px; flex-wrap: wrap; margin: 0 0 10px; }
.cart-tool { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border: 0; border-radius: var(--shape-full);
    background: transparent; color: var(--md-primary); font: inherit; font-size: 0.85rem; font-weight: 600; cursor: pointer; text-decoration: none; }
.cart-tool:hover { background: color-mix(in srgb, var(--md-primary) 8%, transparent); text-decoration: none; }
.cart-tool .material-symbols-outlined { font-size: 19px; }
.cart-tool--quiet { color: var(--md-on-surface-variant); }
.cart-tool--quiet:hover { color: var(--c-red); background: color-mix(in srgb, var(--c-red) 8%, transparent); }

.cart-list { display: grid; gap: 10px; }

/* One article. */
.ci { background: var(--md-surface); border: 1px solid var(--md-outline-variant); border-radius: 14px;
    transition: box-shadow .15s, border-color .15s; }
.ci:hover { box-shadow: var(--elev-1); }
.ci:not(.is-closed) { border-color: color-mix(in srgb, var(--md-primary) 35%, var(--md-outline-variant)); box-shadow: var(--elev-1); }
.ci__head { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 4px 10px; align-items: start; padding: 14px 14px 14px 10px; }
.ci__chev { width: 32px; height: 32px; display: grid; place-items: center; border: 0; border-radius: 50%; background: transparent;
    color: var(--md-on-surface-variant); cursor: pointer; transition: transform .18s, background .15s; }
.ci__chev:hover { background: var(--md-surface-container); }
.ci:not(.is-closed) .ci__chev { transform: rotate(90deg); color: var(--md-primary); }
.ci__main, .ci__side { cursor: pointer; min-width: 0; }
.ci__title { font-weight: 600; font-size: 0.98rem; line-height: 1.3; padding-top: 5px; overflow-wrap: anywhere; }
.ci__meta { display: flex; flex-wrap: wrap; gap: 4px 6px; margin-top: 6px; }
.ci-tag { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 6px; font-size: 0.74rem;
    background: var(--md-surface-container); color: var(--md-on-surface-variant); white-space: nowrap; }
.ci-tag--code { font-variant-numeric: tabular-nums; font-weight: 600; letter-spacing: .02em; }
.ci-tag--qty { background: transparent; box-shadow: inset 0 0 0 1px var(--md-outline-variant); color: var(--md-on-surface); font-weight: 600; }
.ci-tag--soft { background: transparent; padding: 0 2px; }
.ci-tag--urgent { background: var(--c-amber-bg); color: var(--c-amber); font-weight: 600; }
.ci-tag--critical { background: var(--c-red-bg); color: var(--c-red); font-weight: 600; }
/* How it stands, and what is kept: under the article on a phone, on its
   right on a wider screen. */
.ci__side { grid-column: 2; display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 6px; }
.ci-status { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 9px; border-radius: var(--shape-full);
    font-size: 0.74rem; font-weight: 600; white-space: nowrap; }
.ci-status::before { font-family: 'Material Symbols Outlined'; font-size: 15px; font-weight: normal; line-height: 1; font-feature-settings: 'liga'; -webkit-font-feature-settings: 'liga'; }
.ci-status--ok { background: var(--c-green-bg); color: var(--c-green); }
.ci-status--ok::before { content: "check_circle"; }
.ci-status--todo { background: var(--c-amber-bg); color: var(--c-amber); }
.ci-status--todo::before { content: "schedule"; }
.ci__kept { display: grid; justify-items: end; text-align: right; min-width: 0; }
.ci__kept-name { font-size: 0.78rem; color: var(--md-on-surface-variant); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ci__kept-amount { font-size: 0.98rem; font-variant-numeric: tabular-nums; }

/* Open: the quantity, then the offers. */
.ci__body { display: grid; gap: 10px; padding: 0 14px 14px; }
.ci.is-closed .ci__body { display: none; }
.ci__bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
    padding-top: 12px; border-top: 1px solid var(--md-outline-variant); }
.qty-pill { display: inline-flex; align-items: center; height: 38px; border: 1px solid var(--md-outline-variant); border-radius: 10px;
    background: var(--md-surface); overflow: hidden; }
.qty-pill:focus-within { border-color: var(--md-primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--md-primary) 15%, transparent); }
.qty-pill__label { padding: 0 10px; font-size: 0.78rem; color: var(--md-on-surface-variant); background: var(--md-surface-container); align-self: stretch; display: grid; place-items: center; }
.qty-pill input { width: 70px; height: 100%; border: 0 !important; outline: 0; box-shadow: none !important; text-align: right; font-weight: 600; background: transparent; padding: 0 6px; }
.qty-pill__unit { padding: 0 10px 0 2px; font-size: 0.8rem; color: var(--md-on-surface-variant); }
.ci__remove { display: inline-flex; align-items: center; gap: 4px; border: 0; background: transparent; color: var(--md-on-surface-variant);
    font: inherit; font-size: 0.8rem; cursor: pointer; padding: 6px 8px; border-radius: 8px; }
.ci__remove:hover { color: var(--c-red); background: color-mix(in srgb, var(--c-red) 8%, transparent); }
.ci__remove .material-symbols-outlined { font-size: 18px; }

/* The offers: tiles in a list. */
.offers { display: grid; gap: 6px; }
.of { position: relative; display: grid; grid-template-columns: 28px minmax(0, 1fr) auto 30px; grid-template-areas: "pick sup sup drop" ". price sum sum";
    gap: 6px 8px; align-items: center; padding: 8px 8px 8px 10px; border: 1px solid var(--md-outline-variant); border-radius: 12px;
    background: var(--md-surface); transition: border-color .15s, background .15s; }
.of:focus-within { border-color: color-mix(in srgb, var(--md-primary) 50%, var(--md-outline-variant)); }
.of:has([data-pick]:checked) { border-color: var(--md-primary); background: color-mix(in srgb, var(--md-primary) 6%, var(--md-surface)); }
.of--head { display: none; }
.of__pick { grid-area: pick; position: relative; width: 22px; height: 22px; cursor: pointer; }
.of__pick input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.of__dot { position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--md-outline); background: var(--md-surface); transition: border-color .15s; }
.of__pick input:checked + .of__dot { border-color: var(--md-primary); background: radial-gradient(circle, var(--md-primary) 0 5px, var(--md-surface) 6px); }
.of__pick input:disabled + .of__dot { opacity: .35; }
.of__pick input:focus-visible + .of__dot { box-shadow: 0 0 0 3px color-mix(in srgb, var(--md-primary) 25%, transparent); }
.of__sup { grid-area: sup; min-width: 0; height: 36px; border: 0 !important; border-bottom: 1px solid transparent !important; border-radius: 0 !important;
    background: transparent !important; box-shadow: none !important; padding: 0 2px !important; font-weight: 500; }
.of__sup:focus { border-bottom-color: var(--md-primary) !important; outline: 0; }
.of:has([data-pick]:checked) .of__sup { font-weight: 700; }
.of__price { grid-area: price; display: flex; align-items: center; height: 36px; border: 1px solid var(--md-outline-variant); border-radius: 8px;
    background: var(--md-surface); overflow: hidden; }
.of__price:focus-within { border-color: var(--md-primary); }
.of__price input { flex: 1; min-width: 0; height: 100%; border: 0 !important; box-shadow: none !important; outline: 0; background: transparent;
    text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; padding: 0 6px; }
.of__price span { padding: 0 8px 0 2px; font-size: 0.72rem; color: var(--md-on-surface-variant); }
.of__sum { grid-area: sum; text-align: right; font-size: 0.85rem; color: var(--md-on-surface-variant); font-variant-numeric: tabular-nums; min-width: 84px; }
.of__drop { grid-area: drop; width: 30px; height: 30px; display: grid; place-items: center; border: 0; border-radius: 50%; background: transparent;
    color: var(--md-outline); cursor: pointer; }
.of__drop:hover { color: var(--c-red); background: color-mix(in srgb, var(--c-red) 8%, transparent); }
.of__drop .material-symbols-outlined { font-size: 18px; }
.of__best { display: none; position: absolute; top: -9px; right: 44px; height: 18px; padding: 0 8px; border-radius: var(--shape-full);
    background: var(--c-green); color: #fff; font-size: 0.68rem; font-weight: 700; line-height: 18px; }
.of.is-best .of__best { display: block; }
.of-add { justify-self: start; display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border: 1px dashed var(--md-outline-variant);
    border-radius: 10px; background: transparent; color: var(--md-primary); font: inherit; font-size: 0.84rem; font-weight: 600; cursor: pointer; }
.of-add:hover { border-color: var(--md-primary); background: color-mix(in srgb, var(--md-primary) 6%, transparent); }
.of-add .material-symbols-outlined { font-size: 18px; }

/* What is still asked of an article: a soft note, never a red alarm. */
.ci-note { display: grid; gap: 8px; padding: 10px 12px; border-radius: 12px; }
.ci-note--why { background: var(--c-blue-bg); color: var(--c-blue); }
.ci-note--few { background: var(--c-amber-bg); color: var(--c-amber); }
.ci-note__title { display: flex; align-items: center; gap: 6px; font-size: 0.82rem; font-weight: 600; }
.ci-note__title .material-symbols-outlined { font-size: 18px; }
.ci-note input { height: 36px; background: var(--md-surface); color: var(--md-on-surface);
    border: 1px solid color-mix(in srgb, currentColor 25%, transparent) !important; border-radius: 8px; box-shadow: none !important; }
.ci-note input:focus { border-color: var(--md-primary) !important; outline: 0; }
.why-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.why-chip { border: 1px solid color-mix(in srgb, currentColor 30%, transparent); background: var(--md-surface); color: var(--md-on-surface);
    border-radius: var(--shape-full); padding: 4px 12px; font: inherit; font-size: 0.78rem; cursor: pointer; }
.why-chip:hover { border-color: currentColor; }

/* A free line, at the end of the list. */
.cart-free { padding: 2px 0; }
.free-line > summary { list-style: none; display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%; height: 44px;
    border: 1px dashed var(--md-outline-variant) !important; border-radius: 14px; background: transparent !important; color: var(--md-on-surface-variant) !important;
    font-weight: 600; cursor: pointer; box-shadow: none !important; }
.free-line > summary:hover { border-color: var(--md-primary) !important; color: var(--md-primary) !important; }
.free-line > summary::-webkit-details-marker { display: none; }
.free-line[open] > summary { display: none; }
.free-line[open] { padding: 12px 14px; border: 1px solid var(--md-outline-variant); border-radius: 14px; background: var(--md-surface); }
.free-line__form { display: flex; gap: 8px; flex-wrap: wrap; }
.free-line__form input[name=description] { flex: 1 1 220px; height: 38px; }
.free-line__qty { width: 80px; height: 38px; }

/* The bar to send it: floating at the bottom, the total first. */
.cart-bar { position: sticky; bottom: 10px; z-index: 5; display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
    margin: 16px 0; padding: 12px 14px 12px 18px; border-radius: 16px;
    background: color-mix(in srgb, var(--md-surface) 92%, transparent); backdrop-filter: blur(8px);
    border: 1px solid var(--md-outline-variant); box-shadow: 0 8px 24px rgba(15, 23, 42, .12); }
.cart-bar__sum { display: grid; margin-right: auto; line-height: 1.2; }
.cart-bar__label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--md-on-surface-variant); }
.cart-bar__total strong { font-size: 1.35rem; font-variant-numeric: tabular-nums; }
.cart-bar__total small { color: var(--md-on-surface-variant); }
.cart-bar__orders { font-size: 0.78rem; color: var(--md-on-surface-variant); }
.cart-bar__actions { display: flex; gap: 8px; }
.cart-bar .btn { min-height: 44px; border-radius: 12px; }
@media (max-width: 560px) {
    .cart-bar { bottom: 6px; }
    .cart-bar__actions { width: 100%; }
    .cart-bar__actions .btn { flex: 1; justify-content: center; }
}

/* Wider: the article's state on its right; each offer on one line. */
@media (min-width: 720px) {
    .ci__head { grid-template-columns: 32px minmax(0, 1fr) auto; align-items: center; }
    .ci__side { grid-column: auto; margin-top: 0; justify-content: flex-end; gap: 14px; }
    .ci__kept { min-width: 150px; }
    .ci__body { padding-left: 56px; }
    .of { grid-template-columns: 28px minmax(160px, 1fr) 170px 120px 30px; grid-template-areas: "pick sup price sum drop"; }
    .of--head { display: grid; padding: 0 8px 0 10px; border: 0; background: none; font-size: 0.72rem; text-transform: uppercase;
        letter-spacing: .05em; color: var(--md-on-surface-variant); }
    .of--head > :nth-child(2) { grid-area: sup; }
    .of--head > :nth-child(3) { grid-area: price; }
    .of--head > :nth-child(4) { grid-area: sum; }
    .of--head > :first-child, .of--head > :last-child { display: none; }
}


/* ── Where each requested article stands (stock/_track.html) ──
   One row per article: what and how many, the state in a word and its
   colour, the documents in small, and its steps as a thin line of dots.
   Phone first. */
.trk-list { display: grid; gap: 8px; }
.trk { border: 1px solid var(--md-outline-variant); border-left: 4px solid var(--trk); border-radius: 12px; padding: 10px 12px;
    background: var(--md-surface); --trk: var(--c-blue); --trk-bg: var(--c-blue-bg); }
.trk--slow { --trk: var(--c-amber); --trk-bg: var(--c-amber-bg); }
.trk--ready { --trk: var(--c-green); --trk-bg: var(--c-green-bg); }
.trk--ok { --trk: var(--c-green); --trk-bg: var(--c-green-bg); }
.trk--bad { --trk: var(--c-red); --trk-bg: var(--c-red-bg); }
.trk--off { --trk: var(--md-outline); --trk-bg: var(--md-surface-container); }
.trk--ok, .trk--off { opacity: .85; }
.trk__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.trk__what { min-width: 0; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.trk__qty { font-size: 0.82rem; font-weight: 600; color: var(--md-on-surface-variant); white-space: nowrap; }
.trk__state { display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: var(--shape-full);
    background: var(--trk-bg); color: var(--trk); font-size: 0.78rem; font-weight: 700; white-space: nowrap; }
.trk--ready .trk__state { background: var(--c-green); color: #fff; }
.trk__sub { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 10px; margin-top: 4px; font-size: 0.78rem; color: var(--md-on-surface-variant); }
.trk__path { font-weight: 600; }
.trk__reason { color: var(--c-red); }
.trk__doc { font-variant-numeric: tabular-nums; }
.trk__steps { list-style: none; display: flex; margin: 10px 0 2px; padding: 0; }
.trk__steps li { flex: 1; position: relative; display: grid; justify-items: center; gap: 4px; min-width: 0; }
.trk__steps li::before { content: ""; position: absolute; top: 6px; left: -50%; width: 100%; height: 2px; background: var(--md-outline-variant); z-index: 0; }
.trk__steps li:first-child::before { display: none; }
.trk__steps li.is-done::before, .trk__steps li.is-now::before, .trk__steps li.is-bad::before { background: var(--trk); }
.trk__dot { position: relative; z-index: 1; width: 14px; height: 14px; border-radius: 50%; background: var(--md-surface); border: 2px solid var(--md-outline-variant); }
.trk__steps .is-done .trk__dot { background: var(--trk); border-color: var(--trk); }
.trk__steps .is-now .trk__dot { border-color: var(--trk); box-shadow: 0 0 0 4px var(--trk-bg); }
.trk__steps .is-bad .trk__dot { background: var(--c-red); border-color: var(--c-red); }
.trk__label { font-size: 0.62rem; color: var(--md-on-surface-variant); text-align: center; line-height: 1.15; hyphens: none; word-break: normal; padding: 0 1px; }
.trk__steps .is-now .trk__label, .trk__steps .is-bad .trk__label { color: var(--trk); font-weight: 700; }
@media (min-width: 720px) { .trk__label { font-size: 0.72rem; } }

/* The workshop's requests list: a card per request, its articles under it. */
.needs-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.needs-top .filter-chips { margin: 0; }
.needs { display: grid; gap: 12px; }
.need-card { background: var(--md-surface); border: 1px solid var(--md-outline-variant); border-radius: 14px; transition: box-shadow .15s; }
.need-card:has(> .need-card__fold[open]) { border-color: color-mix(in srgb, var(--md-primary) 35%, var(--md-outline-variant)); box-shadow: var(--elev-1); }
.need-card--urgent { border-top: 3px solid var(--c-amber); }
.need-card--critical { border-top: 3px solid var(--c-red); }
.need-card__head { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 4px 8px; align-items: start;
    padding: 12px 12px 12px 8px; cursor: pointer; list-style: none; border-radius: 14px; }
.need-card__head::-webkit-details-marker { display: none; }
.need-card__head:focus-visible { outline: 2px solid var(--md-primary); outline-offset: -2px; }
.need-card__chev { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; font-size: 22px;
    color: var(--md-on-surface-variant); transition: transform .18s; }
.need-card__head:hover .need-card__chev { background: var(--md-surface-container); }
.need-card__fold[open] .need-card__chev { transform: rotate(90deg); color: var(--md-primary); }
.need-card__main { display: grid; gap: 4px; min-width: 0; padding-top: 3px; }
.need-card__who { display: flex; align-items: center; gap: 6px 10px; flex-wrap: wrap; min-width: 0; }
.need-card__number { font-weight: 700; }
.need-card__truck { font-size: 0.88rem; }
.need-card__meta { display: flex; align-items: center; justify-content: space-between; gap: 4px 12px; flex-wrap: wrap;
    font-size: 0.78rem; color: var(--md-on-surface-variant); }
.need-card__sum { display: inline-flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.need-card__fold[open] .need-card__sum { display: none; }
.need-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--trk, var(--c-blue)); display: inline-block; }
.need-card__todo { background: var(--c-amber-bg); color: var(--c-amber); font-weight: 700; padding: 1px 8px; border-radius: var(--shape-full); }
.need-card__body { padding: 0 12px 12px; display: grid; gap: 8px; }
.need-card__foot { padding: 0 12px 12px; }
.need-card__why { margin: 0; font-size: 0.86rem; color: var(--md-on-surface-variant); font-style: italic; }

/* The workshop's reception and the returns. */
.badge--issue-given { background: var(--c-amber-bg); color: var(--c-amber); }
.trk__receive { margin-top: 8px; }
.ret-title { display: flex; align-items: center; gap: 8px; font-size: 1rem; font-weight: 600; margin: 0 0 4px; }
.ret-title .material-symbols-outlined { font-size: 20px; color: var(--md-on-surface-variant); }
.ret-total { margin-left: auto; font-variant-numeric: tabular-nums; color: var(--c-amber); }
.ret-list { display: grid; gap: 8px; }
.ret { border: 1px solid var(--md-outline-variant); border-radius: 12px; padding: 10px 12px; display: grid; gap: 6px; background: var(--md-surface); }
.ret--late { border-color: color-mix(in srgb, var(--c-red) 45%, var(--md-outline-variant)); background: color-mix(in srgb, var(--c-red-bg) 40%, var(--md-surface)); }
.ret__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.ret__amount { font-variant-numeric: tabular-nums; }
.ret--late .ret__amount { color: var(--c-red); }
.ret__why { font-size: 0.86rem; color: var(--c-red); }
/* What sending it back means for the money. */
.ret__fate { display: flex; align-items: flex-start; gap: 6px; padding: 6px 10px; border-radius: 10px; font-size: 0.8rem; }
.ret__fate .material-symbols-outlined { font-size: 17px; }
.ret__fate--buyer { background: var(--c-amber-bg); color: var(--c-amber); }
.ret__fate--due { background: var(--c-blue-bg); color: var(--c-blue); }
.ret__fate--not_paid { background: var(--md-surface-container-low); color: var(--md-on-surface-variant); }
.ret__tag--bad { background: var(--c-red-bg); color: var(--c-red); display: inline-flex; align-items: center; height: 24px; padding: 0 10px;
    border-radius: var(--shape-full); font-size: 0.76rem; font-weight: 700; }
.ret__acts { display: grid; gap: 6px; }
.ret__form { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.ret__form select, .ret__form input { height: 36px; flex: 1 1 180px; min-width: 0; }

/* The gérant's view of a request (purchasing/request_detail.html): the
   cart's blocks, read-only -- he ticks an offer, never types one. */
.of--ro { cursor: default; }
label.of--ro { cursor: pointer; }
label.of--ro:hover { border-color: color-mix(in srgb, var(--md-primary) 45%, var(--md-outline-variant)); }
.of--ro .of__sup { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; height: auto; min-height: 28px; font-weight: 500; }
.of--ro .of__price { border: 0; height: auto; padding: 0; background: none; font-variant-numeric: tabular-nums; font-weight: 600; gap: 4px; }
.of--ro .of__price span { padding: 0; }
.of.is-kept { border-color: var(--md-primary); background: color-mix(in srgb, var(--md-primary) 6%, var(--md-surface)); }
.of.is-kept .of__sup { font-weight: 700; }
.of.is-kept .of__dot { border-color: var(--md-primary); background: radial-gradient(circle, var(--md-primary) 0 5px, var(--md-surface) 6px); }
.of__rec { height: 20px; padding: 0 8px; border-radius: var(--shape-full); background: var(--c-blue-bg); color: var(--c-blue);
    font-size: 0.68rem; font-weight: 700; line-height: 20px; white-space: nowrap; }
.of__fees { font-size: 0.74rem; font-weight: 400; color: var(--md-on-surface-variant); }
/* A seller who takes cash only: the gérant sees it before he approves. */
.of__cash { display: inline-flex; align-items: center; gap: 3px; height: 20px; padding: 0 8px; border-radius: var(--shape-full);
    background: var(--c-amber-bg); color: var(--c-amber); font-size: 0.68rem; font-weight: 700; white-space: nowrap; }
.of__cash .material-symbols-outlined { font-size: 14px; }
.cart-bar__cash { flex-basis: 100%; display: flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 10px;
    background: var(--c-amber-bg); color: var(--c-amber); font-size: 0.8rem; font-weight: 600; }
.cart-bar__cash[hidden] { display: none; }
.cart-bar__cash .material-symbols-outlined { font-size: 18px; }
.of__file { display: inline-grid; place-items: center; color: var(--md-on-surface-variant); }
.of__file .material-symbols-outlined { font-size: 18px; }
.of__kept { grid-area: drop; display: inline-flex; align-items: center; gap: 2px; justify-self: end; font-size: 0.7rem; font-weight: 700;
    color: var(--md-primary); white-space: nowrap; }
.of__kept .material-symbols-outlined { font-size: 16px; }
.ci-status--info { background: var(--md-surface-container); color: var(--md-on-surface-variant); }
.ci-note--info { background: var(--md-surface-container); color: var(--md-on-surface-variant); }
.ci-note__text { font-size: 0.86rem; color: var(--md-on-surface); }
.cart-bar--static { position: static; box-shadow: none; }
.of--head .num { text-align: right; }
@media (min-width: 720px) {
    .of--ro, .offers:has(.of--ro) .of--head { grid-template-columns: 28px minmax(160px, 1fr) 170px 120px minmax(30px, auto); }
}

/* Receiving a bon de sortie (stock/_receive.html): its articles, all
   conform unless one is ticked, then the code. */
.rcv { width: min(440px, calc(100vw - 32px)); }
.rcv__lines { list-style: none; margin: 10px 0 4px; padding: 0; display: grid; gap: 6px; }
.rcv__line { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 10px; align-items: center;
    padding: 8px 10px; border: 1px solid var(--md-outline-variant); border-radius: 10px; }
.rcv__line:has([data-nc]:checked) { border-color: color-mix(in srgb, var(--c-red) 45%, var(--md-outline-variant)); background: var(--c-red-bg); }
.rcv__what { min-width: 0; font-size: 0.9rem; overflow-wrap: anywhere; }
.rcv__nc { display: inline-flex; align-items: center; gap: 6px; font-size: 0.78rem; color: var(--md-on-surface-variant); cursor: pointer; white-space: nowrap; }
.rcv__line:has([data-nc]:checked) .rcv__nc { color: var(--c-red); font-weight: 600; }
.rcv__why { grid-column: 1 / -1; height: 36px; }
.rcv__pin-label { display: block; margin-top: 12px; font-size: 0.86rem; font-weight: 600; }
.rcv .pin-input { margin-top: 6px; }
.rcv-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap;
    padding: 10px 12px; border-radius: 12px; background: var(--c-green-bg); }
.rcv-bar__what { font-size: 0.86rem; font-weight: 600; color: var(--c-green); }

/* New work order (a window): the part under the vehicle, and its button
   greyed until a vehicle without an open work order is picked. */
.wo-new { display: grid; gap: 12px; }
.wo-new[aria-busy="true"] { opacity: .5; pointer-events: none; }
.mform:has([data-wo-body][data-ready="0"]) .modal-bar button[type=submit] { opacity: .45; pointer-events: none; }

/* The request form: add a line, or create the article that is missing. */
.need-form__more { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; }

/* ── Factures fournisseurs: the Comptabilité's desk (erp/finance) ── */
.badge--bap-to_pay    { background: var(--c-amber-bg); color: var(--c-amber); }
.badge--bap-settled   { background: var(--c-blue-bg);  color: var(--c-blue); }
.badge--bap-paid      { background: var(--c-green-bg); color: var(--c-green); }
.badge--bap-cancelled { background: transparent; color: var(--md-on-surface-variant); box-shadow: inset 0 0 0 1px var(--md-outline); }
.pay-list { display: grid; gap: 10px; margin-top: 12px; }
.pay-card { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--md-outline-variant);
    border-radius: var(--shape-lg); background: var(--md-surface); color: inherit; text-decoration: none; }
.pay-card:hover { border-color: var(--md-primary); }
/* A card that is a link: the whole card shows it, its text is never underlined. */
a.pay-card:hover, a.list-card:hover, a.cfg-row:hover { text-decoration: none; }
.pay-card__main { flex: 1; min-width: 0; display: grid; gap: 3px; }
.pay-card__title { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.pay-card__chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.pay-card__go { color: var(--md-on-surface-variant); }
.pay-card__amount { white-space: nowrap; }
.pay-chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: .8rem; font-weight: 600; }
.pay-chip .material-symbols-outlined { font-size: 16px; }
.pay-chip--do   { background: var(--md-primary-container); color: var(--md-primary); }
.pay-chip--wait { background: var(--c-amber-bg); color: var(--c-amber); }
.pay-chip--bad  { background: var(--c-red-bg); color: var(--c-red); }
.pay-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: 10px; margin-top: 12px; }
.pay-facts > div { display: grid; gap: 2px; padding: 10px 12px; border-radius: var(--shape-md); background: var(--md-surface-container, rgba(0,0,0,.03)); }
.pay-advance__head { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 10px; }
.pay-advance__head > .material-symbols-outlined { color: var(--md-primary); font-size: 28px; }
.pay-sum { display: grid; gap: 0; }
.pay-sum > div { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--md-outline-variant); }
.pay-sum > div:last-child { border-bottom: 0; }
.pay-sum__total { font-size: 1.05rem; }
.pay-sum__total strong { color: var(--md-primary); }
.pay-sum--dialog { margin: 6px 0 14px; }
.pay-papers { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.pay-papers > li { display: flex; gap: 10px; align-items: flex-start; }
.pay-papers > li > .material-symbols-outlined { color: var(--md-on-surface-variant); margin-top: 2px; }
.chk-lines { display: grid; gap: 10px; }
.chk-line { border: 1px solid var(--md-outline-variant); border-radius: var(--shape-lg); padding: 10px 12px; background: var(--md-surface); }
.chk-line--pay { border-color: var(--md-primary); }
.chk-line__head { margin-bottom: 6px; }
.chk-line__grid { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 0; font-size: .9rem; }
.chk-line__grid dt { color: var(--md-on-surface-variant); }
.chk-line__grid dd { margin: 0; text-align: right; }
.inv-amount { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.inv-amount .receive-input { width: 160px; }
.receive-input.is-invalid { border-color: var(--c-red); }
.receive-attest { display: flex; gap: 8px; align-items: flex-start; margin: 16px 0 0; color: var(--md-on-surface-variant); }
.receive-attest .material-symbols-outlined { color: var(--md-primary); font-size: 20px; }

/* ── Caisse et banque: the treasury (erp/finance/treasury) ── */
.tr-cash { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); gap: 10px; margin-bottom: 12px; }
.tr-cash__acc { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-radius: var(--shape-md);
    background: var(--md-primary-container); }
.tr-cash__acc > div { display: grid; }
.tr-cash__acc .material-symbols-outlined { color: var(--md-primary); }
.pay-card--late { border-color: var(--c-red); }
.pay-card--owed { border-color: var(--c-amber); background: color-mix(in srgb, var(--c-amber-bg) 45%, var(--md-surface)); }
/* Cash in hand: the amount is the approved one, shown, never typed. */
.field input.is-locked { background: var(--md-surface-container-low); color: var(--md-on-surface-variant); cursor: not-allowed; }
.pay-card--off { opacity: .6; }
.tr-kind { color: var(--md-primary); }
.tr-dir--out { color: var(--c-red); }
.tr-dir--in { color: var(--c-green); }
.tr-accounts { display: grid; gap: 8px; }
.tr-account { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--md-outline-variant);
    border-radius: var(--shape-lg); cursor: pointer; background: var(--md-surface); }
.tr-account:has(input:checked) { border-color: var(--md-primary); box-shadow: inset 0 0 0 1px var(--md-primary); }
.tr-account .material-symbols-outlined { color: var(--md-primary); }
.tr-account__main { display: grid; flex: 1; }
.tr-account--short { opacity: .75; }
.tr-lines { margin-top: 8px; }
.tr-lines ul { margin: 6px 0 0; padding-left: 18px; }

/* A referenced transporter's machines and drivers, on its file: one row
   each -- what it is, its papers, its actions. Phone first. */
.sfleet-add { margin-bottom: 12px; }
.sfleet { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.sfleet__row { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; gap: 4px 10px; align-items: center;
    padding: 10px 12px; border: 1px solid var(--md-outline-variant); border-radius: 12px; background: var(--md-surface); }
.sfleet__row.is-inactive { opacity: .6; }
.sfleet__icon { color: var(--md-on-surface-variant); }
.sfleet__main { display: grid; gap: 2px; min-width: 0; }
.sfleet__title { font-weight: 700; }
.sfleet__state { justify-self: end; }
.sfleet__acts { grid-column: 2 / -1; display: flex; gap: 4px; justify-content: flex-end; }
@media (min-width: 700px) {
    .sfleet__row { grid-template-columns: 32px minmax(0, 1fr) auto auto; }
    .sfleet__acts { grid-column: auto; }
}
/* Who does the transport: three choices. */
.hire-switch--3 { grid-template-columns: 1fr; }
@media (min-width: 900px) { .hire-switch--3 { grid-template-columns: repeat(3, 1fr); } }

/* ── An article refused at the door ── */
.po-refused { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; color: var(--c-red); margin: 2px 0; }
.po-refused .material-symbols-outlined { font-size: 15px; }
.receive-nc { display: inline-flex; align-items: center; gap: 4px; margin-left: 8px; font-size: 0.8rem;
    color: var(--md-on-surface-variant); cursor: pointer; white-space: nowrap; }
.receive-nc-row td { background: var(--c-red-bg, var(--md-surface-container-low)); border-top: 0; }
.receive-nc-row__in { display: flex; flex-wrap: wrap; gap: 10px; }
.receive-nc-row__qty { flex: 0 0 140px; margin: 0; }
.receive-nc-row__why { flex: 1 1 220px; margin: 0; }
@media (max-width: 600px) {
    .receive-nc { display: flex; margin: 6px 0 0; }
    .receive-nc-row__qty { flex-basis: 100%; }
}

/* ── Mon profil: notifications on this device (main.js, data-push) ── */
.push-card .alert { margin-bottom: 12px; }
.push-card__state { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; font-weight: 500; color: var(--md-success); }
.push-card__state--off { color: var(--md-on-surface-variant); }
.push-card__actions { flex-wrap: wrap; }
@media (max-width: 600px) {
    .push-card__actions .btn { flex: 1 1 100%; justify-content: center; }
}

/* A view toggle made of buttons (a choice posted, Mon profil's e-mails). */
button.view-toggle__btn { border: 0; font: inherit; cursor: pointer; }

/* The client's tracking link on a mission (erp.missions.tracking). */
.share-row { display: grid; gap: 10px; padding: 12px 0; border-top: 1px solid var(--md-outline-variant); }
.share-row:first-of-type { border-top: 0; padding-top: 0; }
.share-row__url { width: 100%; box-sizing: border-box; padding: 10px 12px; font: inherit; font-size: .85rem;
                  color: var(--md-on-surface); background: var(--md-surface-container); border: 1px solid var(--md-outline-variant);
                  border-radius: var(--shape-md); }
.share-row__actions { display: flex; flex-wrap: wrap; gap: 8px; }
.share-row__actions form { margin: 0; }
@media (max-width: 480px) {
    .share-row__actions > .btn, .share-row__actions > form { flex: 1 1 calc(50% - 4px); }
    .share-row__actions .btn { width: 100%; justify-content: center; }
}

/* A trip with no itinerary: each toll counted, its own amount typed. */
.budget-counts { display: grid; gap: 12px; margin: 4px 0 12px; }
.budget-count { display: grid; gap: 6px; }
.budget-count__q { font-weight: 600; font-size: .9rem; }
.budget-tolls { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin-top: 4px; }
.budget-toll { margin: 0; }

/* ── Administration → Suppressions (super admin) ── */
.purge-group { margin-bottom: 12px; }
.purge-group__title { display: block; font-size: 0.72rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--md-on-surface-variant); margin-bottom: 6px; }
.purge-kinds { display: flex; flex-wrap: wrap; gap: 6px; }
.purge-kind { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px; border: 1px solid var(--md-outline-variant); border-radius: var(--shape-control); color: var(--md-on-surface); font-size: 0.85rem; text-decoration: none; }
.purge-kind .material-symbols-outlined { font-size: 18px; color: var(--md-on-surface-variant); }
.purge-kind--on { background: var(--md-primary-container); border-color: var(--md-primary); color: var(--md-on-primary-container); font-weight: 600; }
.purge-kind__n { min-width: 20px; padding: 0 6px; border-radius: 10px; background: var(--md-surface-container-high); font-size: 0.75rem; text-align: center; }
.purge-rows { list-style: none; margin: 0; padding: 0; }
.purge-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-top: 1px solid var(--md-outline-variant); }
.purge-row__main { display: flex; flex-direction: column; min-width: 0; }
.purge-row__main strong { overflow-wrap: anywhere; }
/* Dossiers are many: a search above their list. */
.purge-search { display: flex; gap: 8px; align-items: center; margin: 0 0 10px; }
.purge-search input { flex: 1; min-width: 0; max-width: 360px; height: 38px; padding: 0 12px;
    border: 1px solid var(--md-outline); border-radius: var(--shape-control);
    background: var(--md-surface); color: var(--md-on-surface); font: inherit; font-size: 0.875rem; }
.purge-search input:focus { border-color: var(--md-primary); outline: none; }
.purge-list { margin: 0 0 10px; padding-left: 20px; }
.purge-list li { margin: 3px 0; }

/* ── Budget → Carburant, Péages, Bacs ── */
.tab__count--warn { background: var(--c-amber-bg); color: var(--c-amber); }
.truck-fuel { list-style: none; margin: 0 0 12px; padding: 0; }
.truck-fuel__row { display: grid; grid-template-columns: 1fr; gap: 6px; padding: 10px 0; border-top: 1px solid var(--md-outline-variant); }
.truck-fuel__row--todo { background: linear-gradient(90deg, var(--c-amber-bg), transparent 60%); }
.truck-fuel__who { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; }
.truck-fuel__row select, .truck-fuel__cons input { min-height: 40px; }
.truck-fuel__cons input { border: 0; box-shadow: none; border-radius: 0; flex: 1; min-width: 0; width: auto;
    padding: 8px 12px; background: transparent; color: var(--md-on-surface); font: inherit; font-size: .92rem; outline: none; }
/* The fuel picked, drawn as every other field. */
.truck-fuel__row select { width: 100%; padding: 8px 12px; border: 1.5px solid var(--md-outline-variant); border-radius: 9px;
    background-color: var(--md-surface); color: var(--md-on-surface); font: inherit; font-size: .92rem; cursor: pointer; outline: none; }
.truck-fuel__row select:focus { border-color: var(--md-primary); box-shadow: 0 0 0 3px var(--md-primary-container); }
.truck-fuel__cons input:focus { box-shadow: none; }
@media (min-width: 720px) {
    .truck-fuel__row { grid-template-columns: minmax(0, 1fr) 200px 210px; align-items: center; }
}
.budget-charges { display: grid; gap: 12px; margin: 10px 0; }
@media (min-width: 720px) { .budget-charges { grid-template-columns: 1fr 1fr; } }
.charge-pick { list-style: none; margin: 6px 0 0; padding: 0; }
.charge-pick__row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 0; border-top: 1px solid var(--md-outline-variant); }
.charge-pick__row--on .charge-pick__name { font-weight: 600; }
.charge-pick__name { min-width: 0; overflow-wrap: anywhere; }
.charge-pick__n { flex: none; width: 84px; }
.charge-pick__n input { width: 100%; text-align: center; }

/* ── Facturation ── */
.inv-rows { list-style: none; margin: 0; padding: 0; }
.inv-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 10px 0; border-top: 1px solid var(--md-outline-variant); }
.inv-row__main { display: flex; flex-direction: column; gap: 2px; flex: 1 1 220px; min-width: 0; color: inherit; text-decoration: none; }
.inv-row__main .badge { align-self: flex-start; }
.inv-row__amount { font-weight: 700; white-space: nowrap; }
.inv-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; }
.inv-head__client { font-size: 1.1rem; display: block; }
.inv-head__status { text-align: right; }
.inv-lines { list-style: none; margin: 0 0 12px; padding: 0; }
.inv-line { display: grid; grid-template-columns: 1fr 70px 130px; gap: 6px; align-items: center; padding: 8px 0; border-top: 1px solid var(--md-outline-variant); }
.inv-line__label { grid-column: 1 / -1; min-width: 0; }
.inv-line__qty, .inv-line__price { min-height: 38px; text-align: right; }
.inv-line__amount { text-align: right; white-space: nowrap; }
.inv-line--read { grid-template-columns: 1fr auto; }
.inv-line--read .inv-line__label { grid-column: auto; }
@media (min-width: 720px) {
    .inv-line { grid-template-columns: minmax(0, 1fr) 80px 150px 150px; }
    .inv-line__label { grid-column: auto; }
}
.inv-totals { display: grid; gap: 6px; max-width: 420px; margin-left: auto; }
.inv-totals > div { display: flex; justify-content: space-between; gap: 12px; }
.inv-totals__total { font-size: 1.1rem; border-top: 1px solid var(--md-outline-variant); padding-top: 6px; }
.inv-actions { flex-wrap: wrap; justify-content: flex-end; }
.deposit-line { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: var(--shape-md); background: var(--md-surface-container); margin-bottom: 10px; }
.deposit-line--paid .material-symbols-outlined { color: var(--c-green, #2e7d32); }
.deposit-line--to_ask .material-symbols-outlined, .deposit-line--draft .material-symbols-outlined,
.deposit-line--issued .material-symbols-outlined { color: var(--c-amber); }
.deposit-waive { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.deposit-waive input { flex: 1 1 220px; min-height: 38px; }

/* ── The mission's own documents ── */
.gen-docs { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 6px; }
.gen-doc { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--md-outline-variant); border-radius: var(--shape-md); }
.gen-doc > .material-symbols-outlined { color: var(--md-primary); }
.gen-doc__main { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; color: inherit; text-decoration: none; }
a.gen-doc__main:hover strong { text-decoration: underline; }
.badge--kind { background: #E0F2F1; color: #115E59; }
.badge--ds-to_finish { background: #FEF3C7; color: #92400E; }

/* Treasury: the agents who pay for us (erp.finance.agents). */
.tr-agents__title { margin: 16px 0 2px; font-size: 0.95rem; font-weight: 600; }
.card-title-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.card-title-row .card-title { margin: 0; }
.tr-owed { color: var(--c-red); }

a.tr-cash__acc { color: inherit; text-decoration: none; }
a.tr-cash__acc:hover { background: var(--md-surface-container); }
.deposit-waive input.pin-input { flex: 0 0 96px; }
