﻿/* Jetons de design (design tokens) */
:root {
    /* Texte */
    --ink: #0F172A;
    --ink-soft: #334155;
    --ink-muted: #64748B;
    --ink-faint: #94A3B8;
    --ink-mid: #475569;
    /* Surfaces et traits */
    --bg: #F4F6FA;
    --surface: #ffffff;
    --surface-alt: #FAFBFD;
    --surface-sunken: #F8FAFC;
    --chip: #F1F5F9;
    --line: #E6EAF0;
    --line-strong: #CBD5E1;
    --line-soft: #F1F4F8;
    /* Marque */
    --brand: #2563EB;
    --brand-dark: #1D4ED8;
    --brand-light: #3B82F6;
    --brand-tint: #EFF6FF;
    /* Sémantique métier */
    --ok: #16A34A;
    --ok-tint: #DCFCE7;
    --warn: #B45309;
    --warn-tint: #FEF3C7;
    --danger: #DC2626;
    --danger-dark: #B91C1C;
    --danger-tint: #FEE2E2;
    /* Sidebar sombre */
    --night: #0B1220;
    --night-deep: #0F172A;
    --night-line: rgba(255, 255, 255, .07);
    --night-text: #CBD5E1;
    --night-text-strong: #E2E8F0;
    --night-label: #475569;
    --icon-camera: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M23 19a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h4l2-3h6l2 3h4a2 2 0 0 1 2 2z'/%3E%3Ccircle cx='12' cy='13' r='4'/%3E%3C/svg%3E");
    --icon-document: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z'/%3E%3Cpath d='M14 2v6h6'/%3E%3C/svg%3E");
    --icon-images: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='3' width='18' height='18' rx='2' ry='2'/%3E%3Ccircle cx='8.5' cy='8.5' r='1.5'/%3E%3Cpolyline points='21 15 16 10 5 21'/%3E%3C/svg%3E");
    /* Rayons de bordure */
    --r-sm: 8px;
    --r-md: 10px;
    --r-lg: 12px;
    --r-xl: 16px;
    --r-pill: 999px;
    --shadow-xs: 0 1px 2px rgba(15, 23, 42, .05);
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05), 0 1px 3px rgba(15, 23, 42, .04);
    --shadow-md: 0 1px 2px rgba(15, 23, 42, .04), 0 4px 12px rgba(15, 23, 42, .06);
    --shadow-lg: 0 4px 8px rgba(15, 23, 42, .05), 0 16px 40px rgba(15, 23, 42, .10);
    --shadow-brand: 0 1px 2px rgba(37, 99, 235, .2), 0 6px 16px rgba(37, 99, 235, .25);
    --shadow-danger: 0 1px 2px rgba(220, 38, 38, .2), 0 6px 16px rgba(220, 38, 38, .25);
    --ease: 140ms cubic-bezier(.4, 0, .2, 1);
    /* Mobile */
    --tap: 44px;
    --tabbar-h: 58px;
    --topbar-h: 52px;
}

/* Base */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    position: relative;
    min-height: 100%;
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    font-family: 'IBM Plex Sans', system-ui, -apple-system, sans-serif;
    font-size: 15px;
    line-height: 1.55;
    color: var(--ink);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

a {
    color: var(--brand);
    text-decoration: none;
    transition: color var(--ease);
}

    a:hover {
        color: var(--brand-dark);
    }

/* Attribut hidden */
[hidden] {
    display: none !important;
}

:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
    border-radius: 4px;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
    }
}

/* Titre de page */
.page-title {
    font-size: 1.65rem;
    font-weight: 700;
    letter-spacing: -0.3px;
    color: var(--ink);
    margin-bottom: 1.5rem;
}

    .page-title .count {
        display: inline-block;
        background: var(--chip);
        color: var(--ink-muted);
        font-size: 0.75rem;
        font-weight: 600;
        padding: 0.25em 0.6em;
        border-radius: var(--r-pill);
        vertical-align: middle;
        position: relative;
        top: -2px;
    }

/* Barre de recherche */
.search-bar {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 1.5rem;
}

    .search-bar input[type="search"] {
        flex: 0 1 400px;
        padding: 0.55rem 0.85rem;
        border: 1px solid var(--line);
        border-radius: var(--r-sm);
        background: var(--surface);
        transition: border-color var(--ease), box-shadow var(--ease);
    }

        .search-bar input[type="search"]:focus {
            outline: none;
            border-color: var(--brand);
            box-shadow: 0 0 0 3px rgba(37, 99, 235, .14);
        }

    .search-bar button {
        padding: 0.5rem 1rem;
        border: 1px solid var(--line);
        background: #fff;
        color: var(--ink-soft);
        font-weight: 600;
        border-radius: var(--r-sm);
        cursor: pointer;
        transition: background var(--ease), border-color var(--ease);
    }

        .search-bar button:hover {
            background: var(--surface-sunken);
            border-color: var(--line-strong);
        }

    .search-bar .reset-link {
        color: var(--ink-muted);
        text-decoration: none;
    }

    .search-bar select {
        padding: 0.5rem 0.75rem;
        border: 1px solid var(--line);
        border-radius: 8px;
        background: #fff;
    }

    /* Étiquettes de champ et titres de groupe */
    .search-bar__field {
        display: contents;
    }

    .search-bar__caption,
    .search-bar__legend {
        display: none;
    }

    /* Les trois outils repliables (mobile) */
    .filter-tool,
    .filter-tool__panel {
        display: contents;
    }

    .filter-tool__toggle,
    .filter-tool__button {
        display: none;
    }

    .search-bar__field--sort {
        display: none;
    }

/* Tableau de la flotte */
.fleet-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

    .fleet-table th,
    .fleet-table td {
        padding: 0.75rem;
        text-align: left;
        border-bottom: 1px solid var(--line-soft);
    }

    .fleet-table thead th {
        position: sticky;
        top: 0;
        z-index: 1;
        background: var(--surface-alt);
        font-weight: 600;
        font-size: 0.7rem;
        letter-spacing: 0.4px;
        text-transform: uppercase;
        color: var(--ink-faint);
    }

    .fleet-table tbody tr {
        transition: background var(--ease);
    }

    .fleet-table tbody tr:hover {
        background: var(--surface-alt);
    }

    .fleet-table tbody tr:last-child td {
        border-bottom: none;
    }

    /* En-têtes triables (voir wwwroot/js/table-sort.js) */
    .fleet-table thead th.is-sortable {
        cursor: pointer;
        user-select: none;
        white-space: nowrap;
    }

        .fleet-table thead th.is-sortable:hover {
            background: var(--chip);
            color: var(--ink-mid);
        }

        .fleet-table thead th.is-sortable:focus-visible {
            outline: 2px solid var(--brand);
            outline-offset: -2px;
        }

        .fleet-table thead th.is-sorted {
            color: var(--brand);
        }

    .fleet-table thead th.is-sortable > a {
        display: block;
        color: inherit;
        text-decoration: none;
    }

    .sort-arrow {
        display: inline-block;
        margin-left: 0.35rem;
        font-size: 0.7em;
        line-height: 1;
    }

    .fleet-table thead th.is-sortable:not(.is-sorted):hover .sort-arrow::after {
        content: '↕';
        opacity: 0.45;
    }

    .fleet-table .numeric {
        text-align: center;
    }

    .fleet-table .plate {
        font-family: 'IBM Plex Mono', Consolas, monospace;
        font-weight: 600;
        letter-spacing: 0.3px;
    }

    .fleet-table .person-name {
        font-weight: 600;
        color: var(--ink);
    }

/* Pastilles de statut */
.status {
    display: inline-block;
    padding: 0.25em 0.7em;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
}

.status--active {
    background: var(--ok-tint);
    color: var(--ok);
}

.status--retired {
    background: var(--chip);
    color: var(--ink-muted);
}

.status--in-progress {
    background: var(--chip);
    color: var(--brand);
    border: 1px dashed var(--brand);
}

.status--draft {
    background: var(--chip);
    color: var(--ink-muted);
}

.status--sent {
    background: var(--warn-tint);
    color: var(--warn);
}

.status--signed {
    background: var(--ok-tint);
    color: var(--ok);
}

.status--refused {
    background: var(--danger-tint);
    color: var(--danger);
}

/* État vide */
.empty-state {
    padding: 2.5rem 1.5rem;
    background: var(--surface);
    border: 1px dashed var(--line-strong);
    border-radius: var(--r-lg);
    color: var(--ink-muted);
    text-align: center;
    font-size: 0.95rem;
}

/* Pictogrammes : le sprite SVG */
.icon {
    width: 1em;
    height: 1em;
    flex-shrink: 0;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}


/* Barre de pagination */
.pager {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem 1.25rem;
    margin-top: 1rem;
    font-size: 0.85rem;
    color: var(--ink-muted);
}

.pager__info {
    margin: 0;
}

.pager__sizes {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.pager__sizes-label {
    color: var(--ink-faint);
}

.pager__pages {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-left: auto;
}

.pager__size,
.pager__link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2rem;
    height: 2rem;
    padding: 0 0.5rem;
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    background: var(--surface);
    color: var(--ink-mid);
    text-decoration: none;
    transition: background var(--ease), color var(--ease), border-color var(--ease);
}

    .pager__size:hover,
    .pager__link:hover {
        background: var(--chip);
        color: var(--ink);
    }

    .pager__size.is-current,
    .pager__link.is-current {
        background: var(--brand);
        border-color: var(--brand);
        color: #fff;
        font-weight: 600;
        cursor: default;
    }

.pager__ellipsis {
    padding: 0 0.15rem;
    color: var(--ink-faint);
}

/* Structure générale (sidebar + contenu) */
.app-shell {
    display: flex;
    align-items: stretch;
    min-height: 100vh;
}

.sidebar {
    width: 248px;
    flex-shrink: 0;
    background: var(--night);
    color: var(--night-text);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    padding-bottom: 1rem;
}

.sidebar-user {
    margin-top: auto;
    padding: 1rem 1.25rem 0;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-user__name {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--night-text-strong);
    word-break: break-all;
}

.sidebar-user__role {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--ink-muted);
    margin-bottom: 0.5rem;
}

.sidebar-user__logout {
    background: none;
    border: none;
    padding: 0;
    color: var(--ink-faint);
    font-size: 0.8rem;
    text-decoration: underline;
    cursor: pointer;
}

    .sidebar-user__logout:hover {
        color: var(--night-text-strong);
    }

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 24px 22px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, .07);
    color: #fff;
    font-weight: 700;
    font-size: 16px;
    letter-spacing: -0.2px;
}

.sidebar-brand-badge {
    width: 34px;
    height: 34px;
    flex-shrink: 0;
    border-radius: 9px;
    background: linear-gradient(135deg, var(--brand-light), var(--brand-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 14px;
    box-shadow: var(--shadow-brand);
}

.sidebar-section-label {
    font-size: 10.5px;
    letter-spacing: 1px;
    color: var(--night-label);
    padding: 18px 12px 6px;
    font-weight: 600;
    text-transform: uppercase;
}

.sidebar-nav {
    list-style: none;
    margin: 0;
    padding: 0 12px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px 12px;
    border-radius: 9px;
    color: var(--ink-faint);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 500;
    transition: background var(--ease), color var(--ease);
}

    .sidebar-link svg {
        width: 18px;
        height: 18px;
        flex-shrink: 0;
    }

    .sidebar-link:hover {
        background: rgba(255, 255, 255, .06);
        color: var(--night-text);
    }

    .sidebar-link.is-active {
        background: rgba(37, 99, 235, .16);
        color: #fff;
        box-shadow: inset 3px 0 0 var(--brand-light);
    }

/* Bouton « replier / déplier » de la barre latérale */
.sidebar-toggle {
    position: absolute;
    right: -14px;
    top: 27px;
    z-index: 5;
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    background: var(--night);
    border: 1px solid rgba(255, 255, 255, .16);
    border-radius: 50%;
    box-shadow: var(--shadow-sm);
    color: var(--ink-faint);
    cursor: pointer;
    transition: background var(--ease), color var(--ease), border-color var(--ease);
}

    .sidebar-toggle:hover {
        background: var(--brand);
        border-color: var(--brand-light);
        color: #fff;
    }

    .sidebar-toggle svg {
        width: 16px;
        height: 16px;
        stroke-width: 2;
        transition: transform var(--ease);
    }

.sidebar-user__logout svg {
    display: none;
    width: 18px;
    height: 18px;
}

/* Barre latérale repliée */
@media (min-width: 901px) {
    .sidebar {
        transition: width var(--ease);
    }

    .sidebar-collapsed .sidebar {
        width: 72px;
    }

    .sidebar-collapsed .sidebar-link {
        justify-content: center;
        padding-left: 0;
        padding-right: 0;
    }

    .sidebar-collapsed .sidebar-link > span,
    .sidebar-collapsed .sidebar-brand__text,
    .sidebar-collapsed .sidebar-user__name,
    .sidebar-collapsed .sidebar-user__role,
    .sidebar-collapsed .sidebar-user__logout > span {
        display: none;
    }

    .sidebar-collapsed .sidebar-brand {
        justify-content: center;
        padding-left: 0;
        padding-right: 0;
    }

    .sidebar-collapsed .sidebar-toggle svg {
        transform: rotate(180deg);
    }

    .sidebar-collapsed .sidebar-section-label {
        font-size: 0;
        padding: 14px 16px 8px;
    }

        .sidebar-collapsed .sidebar-section-label::after {
            content: "";
            display: block;
            border-top: 1px solid rgba(255, 255, 255, .10);
        }

    .sidebar-collapsed .sidebar-user {
        padding: 0.9rem 0 0;
        text-align: center;
    }

    .sidebar-collapsed .sidebar-user__logout {
        display: inline-flex;
        justify-content: center;
    }

        .sidebar-collapsed .sidebar-user__logout svg {
            display: block;
        }
}

.app-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    background: var(--bg);
}

    .app-main main {
        flex: 1;
        padding: 28px 30px 44px;
    }

.app-footer {
    padding: 1rem 30px;
    color: var(--ink-faint);
    font-size: 0.85rem;
}

/* Formulaire */
.form-card {
    background: #fff;
    padding: 1.5rem;
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: var(--shadow-sm);
    max-width: 640px;
}

.field {
    margin-bottom: 1rem;
}

    .field label {
        display: block;
        font-weight: 600;
        margin-bottom: 0.25rem;
    }

    .field input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
    .field select,
    .field textarea {
        width: 100%;
        padding: 0.55rem 0.8rem;
        border: 1px solid var(--line);
        border-radius: var(--r-sm);
        background: #fff;
        font: inherit;
        color: var(--ink);
        transition: border-color var(--ease), box-shadow var(--ease);
    }

        .field input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):focus,
        .field select:focus,
        .field textarea:focus {
            outline: none;
            border-color: var(--brand);
            box-shadow: 0 0 0 3px rgba(37, 99, 235, .14);
        }

    .field input.input-validation-error,
    .field select.input-validation-error,
    .field textarea.input-validation-error {
        border-color: var(--danger);
        background: #FFFBFB;
    }

    .field label {
        color: var(--ink-soft);
        font-size: 0.9rem;
    }

    .field input[type="checkbox"] {
        width: 17px;
        height: 17px;
        accent-color: var(--brand);
        cursor: pointer;
    }

.field--inline {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

    .field--inline label {
        margin-bottom: 0;
    }

.field-error {
    display: block;
    color: var(--danger);
    font-size: 0.85rem;
    margin-top: 0.25rem;
}

/* Champ mot de passe avec bouton « œil » */
.password-field {
    position: relative;
    display: block;
}

    .password-field input:not([type="checkbox"]):not([type="radio"]):not([type="file"]) {
        padding-right: 2.75rem;
    }

.password-field__button {
    position: absolute;
    top: 0;
    bottom: 0;
    right: 0;
    width: 2.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    background: none;
    color: var(--ink-faint);
    cursor: pointer;
    border-radius: 0 var(--r-sm) var(--r-sm) 0;
    transition: color var(--ease);
}

    .password-field__button:hover {
        color: var(--ink-soft);
    }

    .password-field__button .icon {
        width: 19px;
        height: 19px;
    }

/* Select cherchable (« combobox ») */
.combo {
    position: relative;
}

.combo__select {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    border: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

.combo::after {
    content: "";
    position: absolute;
    top: 50%;
    right: 0.9rem;
    width: 7px;
    height: 7px;
    margin-top: -5px;
    border-right: 2px solid var(--ink-faint);
    border-bottom: 2px solid var(--ink-faint);
    transform: rotate(45deg);
    pointer-events: none;
}

.field .combo select[data-searchable] + input.combo__input {
    cursor: text;
    padding-right: 2rem;
}

.field .combo select[data-searchable].input-validation-error + input.combo__input {
    border-color: var(--danger);
    background-color: #FFFBFB;
}

.combo__list {
    position: absolute;
    z-index: 30;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    max-height: 260px;
    overflow-y: auto;
    margin: 0;
    padding: 0.25rem;
    list-style: none;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    box-shadow: var(--shadow-lg);
}

.combo__option {
    padding: 0.45rem 0.6rem;
    border-radius: var(--r-sm);
    font-size: 0.92rem;
    color: var(--ink-soft);
    cursor: pointer;
}

    .combo__option:hover,
    .combo__option--active {
        background: var(--brand-tint);
        color: var(--brand-dark);
    }

.combo__list--empty::after {
    content: "Aucun résultat";
    display: block;
    padding: 0.5rem 0.6rem;
    color: var(--ink-muted);
    font-size: 0.9rem;
    font-style: italic;
}

/* Récapitulatif d'erreurs d'un formulaire */
.form-errors.validation-summary-valid {
    display: none;
}

.form-errors:not(:empty),
.form-errors.validation-summary-errors {
    background: var(--danger-tint);
    color: var(--danger-dark);
    padding: 0.8rem 1rem;
    border-radius: var(--r-sm);
    margin-bottom: 1rem;
    border-left: 4px solid var(--danger);
    font-weight: 500;
}

.form-errors ul {
    margin: 0;
    padding-left: 1.15rem;
}

    .form-errors ul li {
        margin: 0.15rem 0;
    }

.form-errors ul:has(li:only-child) {
    list-style: none;
    padding-left: 0;
}

/* Fil d'étapes (assistant de Condition/Create) */
.stepper-head {
    margin-bottom: 1.5rem;
}

.stepper {
    display: flex;
    gap: 0.25rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.stepper-progress,
.stepper-legend {
    display: none;
}

.stepper-progress {
    height: 4px;
    background: var(--line);
    border-radius: var(--r-pill);
    overflow: hidden;
}

.stepper-progress__bar {
    display: block;
    height: 100%;
    background: var(--brand);
    border-radius: inherit;
    transition: width var(--ease);
}

.stepper-legend {
    margin: 0.5rem 0 0;
    font-size: 0.82rem;
    color: var(--ink-muted);
}

.stepper-legend__title {
    color: var(--ink);
    font-weight: 600;
}

.stepper__item {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.78rem;
    line-height: 1.2;
    text-align: center;
    color: var(--ink-faint);
}

    .stepper__item[hidden] {
        display: none;
    }

.stepper__num {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border-radius: var(--r-pill);
    background: var(--chip);
    color: var(--ink-muted);
    font-weight: 600;
    font-size: 0.8rem;
}

.stepper__item.is-current {
    color: var(--brand);
    font-weight: 600;
}

    .stepper__item.is-current .stepper__num {
        background: var(--brand);
        color: #fff;
    }

.stepper__item.is-done .stepper__num {
    background: var(--ok-tint);
    color: var(--ok);
}

.form-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 1.5rem;
}

    .form-actions button {
        padding: 0.6rem 1.25rem;
        background: var(--brand);
        color: #fff;
        border: none;
        border-radius: 9px;
        font-weight: 600;
        cursor: pointer;
        box-shadow: var(--shadow-brand);
        transition: background var(--ease), transform var(--ease), box-shadow var(--ease);
    }

        .form-actions button:hover {
            background: var(--brand-dark);
            transform: translateY(-1px);
        }

        .form-actions button:active {
            transform: translateY(0);
            box-shadow: var(--shadow-xs);
        }

.cancel-link {
    color: var(--ink-muted);
    text-decoration: none;
}

/* Messages flash */
.flash {
    padding: 0.8rem 1rem;
    border-radius: var(--r-sm);
    margin-bottom: 1.25rem;
    font-weight: 500;
    border-left: 4px solid currentColor;
    box-shadow: var(--shadow-xs);
}

.flash--success {
    background: var(--ok-tint);
    color: var(--ok);
}

.flash--error {
    background: var(--danger-tint);
    color: var(--danger);
}

/* Actions d'une ligne de tableau */
.row-action,
.link-button,
.link-button--neutral {
    display: inline-flex;
    align-items: center;
    padding: 5px 11px;
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    background: #fff;
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 600;
    line-height: 1.4;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    transition: background var(--ease), border-color var(--ease), color var(--ease);
}

/* Actions neutres */
.row-action,
.link-button--neutral {
    color: var(--ink-soft);
}

    .row-action:hover,
    .link-button--neutral:hover {
        background: var(--brand-tint);
        border-color: var(--brand);
        color: var(--brand-dark);
    }

.link-button {
    color: var(--danger);
    margin-left: 0.75rem;
}

    .link-button:hover {
        background: var(--danger-tint);
        border-color: var(--danger);
        color: var(--danger-dark);
    }

.button-link {
    display: inline-block;
    padding: 9px 15px;
    background-color: #fff;
    color: var(--ink-soft);
    text-decoration: none;
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    cursor: pointer;
    font-size: 13.5px;
    font-weight: 600;
    transition: background var(--ease), border-color var(--ease), color var(--ease);
}

    .button-link:hover {
        background-color: var(--surface-sunken);
        border-color: var(--line-strong);
        color: var(--ink-soft);
    }

/* Bouton principal */
.button-primary {
    display: inline-block;
    padding: 10px 16px;
    background: var(--brand);
    color: #fff;
    text-decoration: none;
    border: none;
    border-radius: 9px;
    cursor: pointer;
    font-size: 13.5px;
    font-weight: 600;
    box-shadow: var(--shadow-brand);
    transition: background var(--ease), transform var(--ease), box-shadow var(--ease);
}

    .button-primary:hover {
        background: var(--brand-dark);
        color: #fff;
        transform: translateY(-1px);
    }

    .button-primary:active {
        transform: translateY(0);
        box-shadow: var(--shadow-xs);
    }

.button-danger {
    display: inline-block;
    padding: 10px 16px;
    background: var(--danger);
    color: #fff;
    text-decoration: none;
    border: none;
    border-radius: 9px;
    cursor: pointer;
    font-size: 13.5px;
    font-weight: 600;
    box-shadow: var(--shadow-danger);
    transition: background var(--ease), transform var(--ease), box-shadow var(--ease);
}

    .button-danger:hover {
        background: var(--danger-dark);
        color: #fff;
        transform: translateY(-1px);
    }

    .button-danger:active {
        transform: translateY(0);
        box-shadow: var(--shadow-xs);
    }

/* Boutons d'une fiche Détail */
.detail-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.row-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.4rem;
    white-space: nowrap;
}

    .row-actions .link-button {
        margin-left: 0;
    }

/* Page détail */

.detail-header {
    background: #fff;
    padding: 1.5rem;
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 2rem;
}

.detail-header__top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

    .detail-header__top .page-title {
        margin-bottom: 0.5rem;
    }

    .detail-header .plate {
        font-family: 'IBM Plex Mono', Consolas, monospace;
        font-size: 0.85rem;
        color: var(--ink-soft);
        background: var(--chip);
        padding: 0.2em 0.6em;
        border-radius: 6px;
        margin-left: 0.5rem;
    }

.detail-meta {
    color: var(--ink-muted);
    font-size: 0.9rem;
    margin: 0.5rem 0;
}

.section-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--ink);
    margin: 2rem 0 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--line);
}

.clickable-row {
    cursor: pointer;
}

    .clickable-row:hover {
        background: var(--surface-alt);
    }

/* Repli d'une carte de liste */
.row-toggle__button {
    display: none;
}

.row-toggle {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    border: 0;
    overflow: hidden;
    clip-path: inset(50%);
}

.row-toggle:focus-visible + .row-toggle__button {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
}

/* Modal générique (AJAX) */
.modal-root {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-root.modal--open {
    display: flex;
}

.modal-root .form-card {
    max-width: 480px;
    width: 90%;
}

.locked-value {
    padding: 0.5rem 0.75rem;
    background: var(--chip);
    border: 1px solid var(--line);
    border-radius: 8px;
    margin: 0;
    color: var(--ink-soft);
}

/* Barème visuel (état des lieux) */
.state-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.state-picker__input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    pointer-events: none;
}

.state-picker__pill {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    background: var(--chip);
    color: var(--ink-muted);
    border: 1px solid transparent;
    transition: background var(--ease), color var(--ease), border-color var(--ease);
}

    .state-picker__pill:hover {
        background: #E6EBF2;
    }

.state-picker__input:focus-visible + .state-picker__pill {
    outline: 2px solid var(--brand);
    outline-offset: 1px;
}

.state-picker__input:checked + .state-picker__pill--good {
    background: var(--ok-tint);
    color: var(--ok);
    border-color: var(--ok);
}

.state-picker__input:checked + .state-picker__pill--minor {
    background: var(--warn-tint);
    color: var(--warn);
    border-color: var(--warn);
}

.state-picker__input:checked + .state-picker__pill--major {
    background: var(--danger-tint);
    color: var(--danger);
    border-color: var(--danger);
}

.state-badge {
    display: inline-block;
    padding: 0.2em 0.7em;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.state-badge--good {
    background: var(--ok-tint);
    color: var(--ok);
}

.state-badge--minor {
    background: var(--warn-tint);
    color: var(--warn);
}

.state-badge--major {
    background: var(--danger-tint);
    color: var(--danger);
}

/* Fiche état des lieux (zones + photos) */
.zone-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    padding: 1rem 1.25rem;
    margin-bottom: 0.75rem;
    box-shadow: var(--shadow-xs);
}

.zone-card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.4rem;
    gap: 1rem;
}

.zone-card__name {
    font-weight: 600;
}

.zone-card__desc {
    color: var(--ink-muted);
    font-size: 0.9rem;
    margin: 0 0 0.75rem;
}

.photo-gallery {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 0.75rem;
}

.photo-gallery__thumb {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: var(--r-sm);
    border: 1px solid var(--line);
    cursor: zoom-in;
    transition: transform var(--ease), box-shadow var(--ease);
}

    .photo-gallery__thumb:hover {
        transform: scale(1.06);
        box-shadow: var(--shadow-md);
    }

.photo-upload-form {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Grille d'infos secondaires (VIN, énergie...) */
.detail-meta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.75rem 1.5rem;
    margin: 0.75rem 0 1rem;
}

    .detail-meta-grid__label {
        display: block;
        font-size: 0.75rem;
        color: var(--ink-faint);
        text-transform: uppercase;
        letter-spacing: 0.3px;
        margin-bottom: 0.15rem;
    }

/* Sélecteur segmenté (carburant, propreté...) */
.segmented-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.segmented-picker__input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    pointer-events: none;
}

.segmented-picker__option {
    padding: 8px 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--ink-soft);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--ease), color var(--ease), border-color var(--ease);
}

    .segmented-picker__option:hover {
        border-color: var(--line-strong);
        background: var(--surface-sunken);
    }

.segmented-picker__input:focus-visible + .segmented-picker__option {
    outline: 2px solid var(--brand);
    outline-offset: 1px;
}

.segmented-picker__input:checked + .segmented-picker__option {
    background: var(--brand);
    color: #fff;
    border-color: var(--brand);
}

/* Variantes colorées : propretés intérieure et extérieure */
.segmented-picker__option--good {
    color: var(--ok);
    border-color: var(--ok);
}

.segmented-picker__option--minor {
    color: var(--warn);
    border-color: var(--warn);
}

.segmented-picker__option--major {
    color: var(--danger);
    border-color: var(--danger);
}

.segmented-picker__option--good:hover {
    background: var(--ok-tint);
    border-color: var(--ok);
}

.segmented-picker__option--minor:hover {
    background: var(--warn-tint);
    border-color: var(--warn);
}

.segmented-picker__option--major:hover {
    background: var(--danger-tint);
    border-color: var(--danger);
}

.segmented-picker__input:checked + .segmented-picker__option--good {
    background: var(--ok);
    border-color: var(--ok);
    color: #fff;
}

.segmented-picker__input:checked + .segmented-picker__option--minor {
    background: var(--warn);
    border-color: var(--warn);
    color: #fff;
}

.segmented-picker__input:checked + .segmented-picker__option--major {
    background: var(--danger);
    border-color: var(--danger);
    color: #fff;
}

/* Checklist équipements */
.equipment-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 8px;
    margin-bottom: 1.5rem;
}

.equipment-check {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--ink-soft);
    cursor: pointer;
    background: #fff;
    transition: background var(--ease), border-color var(--ease), color var(--ease);
}

    .equipment-check:hover {
        border-color: var(--line-strong);
    }

.equipment-check:has(input[type="checkbox"]:checked),
.equipment-check--present {
    border-color: var(--brand);
    background: var(--brand-tint);
    color: var(--brand-dark);
}

/* Groupes de zones repliables */
.zone-group {
    border: 1px solid var(--line);
    border-radius: 12px;
    margin-bottom: 0.75rem;
    overflow: hidden;
    background: #fff;
}

.zone-group__summary {
    padding: 0.9rem 1.1rem;
    font-weight: 700;
    color: var(--ink);
    cursor: pointer;
    background: var(--surface-alt);
    list-style: none;
}

    .zone-group__summary::-webkit-details-marker {
        display: none;
    }

    .zone-group__summary::before {
        content: '▸';
        display: inline-block;
        margin-right: 0.5rem;
        color: var(--ink-faint);
        transition: transform 0.15s;
    }

.zone-group[open] .zone-group__summary::before {
    transform: rotate(90deg);
}

.zone-group .fleet-table {
    border: none;
    border-radius: 0;
    box-shadow: none;
    border-top: 1px solid var(--line);
}

/* Champ fichier « en vrai bouton » */
.file-field {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
    position: relative;
}

.file-field__input {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    border: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

.file-field__button {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 9px 15px;
    background-color: var(--surface);
    color: var(--ink-soft);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    cursor: pointer;
    font-size: 13.5px;
    font-weight: 600;
    transition: background var(--ease), border-color var(--ease), color var(--ease);
}

    .file-field__button:hover {
        background-color: var(--surface-sunken);
        border-color: var(--line-strong);
    }

    .file-field__button::before {
        content: "";
        width: 15px;
        height: 15px;
        flex: none;
        background-color: currentColor;
        opacity: 0.7;
        -webkit-mask: var(--icon-camera) center / contain no-repeat;
        mask: var(--icon-camera) center / contain no-repeat;
    }

    .file-field__button--document::before {
        -webkit-mask-image: var(--icon-document);
        mask-image: var(--icon-document);
    }

    .file-field__button--gallery::before {
        -webkit-mask-image: var(--icon-images);
        mask-image: var(--icon-images);
    }

.file-field__input:focus-visible + .file-field__button {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
}

.file-field__button--primary {
    background: var(--brand);
    color: #fff;
    border-color: var(--brand);
    box-shadow: var(--shadow-brand);
}

    .file-field__button--primary:hover {
        background: var(--brand-dark);
        border-color: var(--brand-dark);
        color: #fff;
    }

.file-field--compact .file-field__button {
    padding: 5px 10px;
    font-size: 12px;
    border-radius: var(--r-sm);
}

.file-field__status {
    color: var(--ink-muted);
    font-size: 12.5px;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-field--compact .file-field__status {
    max-width: 90px;
    font-size: 11.5px;
}

.file-field__status--filled {
    color: var(--ok);
    font-weight: 600;
}

.file-field--error .file-field__button {
    border-color: var(--danger);
    color: var(--danger-dark);
    background-color: var(--danger-tint);
}

.file-field--error .file-field__status {
    color: var(--danger-dark);
}

/* Page PUBLIQUE de signature */
.public-shell {
    background: var(--bg);
    min-height: 100vh;
}

.public-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 1rem 1.5rem;
    background: var(--night-deep);
    color: #fff;
    font-weight: 600;
}

.public-main {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

.sign-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.sign-slot {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 1rem;
    background: #fff;
}

    .sign-slot .section-title {
        margin-top: 0;
    }

.sign-pad {
    margin-top: 0.75rem;
}

.sign-pad__canvas {
    display: block;
    width: 100%;
    height: 180px;
    border: 2px dashed var(--line-strong);
    border-radius: 10px;
    background: #fff;
    touch-action: none;
    cursor: crosshair;
}

.sign-pad--filled .sign-pad__canvas {
    border-style: solid;
    border-color: var(--brand);
}

.sign-pad__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.sign-pad__hint {
    font-size: 0.8rem;
    color: var(--ink-muted);
}

.sign-image {
    display: block;
    width: 100%;
    max-width: 320px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
}

.share-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.share-link__url {
    flex: 1;
    min-width: 0;
    font-family: 'IBM Plex Mono', Consolas, monospace;
    font-size: 0.8rem;
    padding: 0.5rem 0.7rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-sunken);
    color: var(--ink-soft);
}

.share-link__url[readonly] {
    cursor: text;
}

    .share-link [data-copy-link],
    .share-link a {
        flex: none;
        white-space: nowrap;
    }

/* Menu « ⋮ » (actions secondaires) */
.kebab {
    display: inline-flex;
}

.kebab__button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--ink-soft);
    cursor: pointer;
    user-select: none;
    transition: border-color var(--ease), background var(--ease);
}

    .kebab__button {
        list-style: none;
    }

        .kebab__button::-webkit-details-marker {
            display: none;
        }

        .kebab__button::before {
            content: "";
            width: 4px;
            height: 4px;
            border-radius: 50%;
            background: currentColor;
            box-shadow: 0 -6px 0 currentColor, 0 6px 0 currentColor;
        }

    .kebab__button:hover {
        border-color: var(--line-strong);
        background: var(--surface-sunken);
    }

.kebab[open] .kebab__button {
    border-color: var(--brand);
    color: var(--brand-dark);
}

.kebab__menu {
    position: fixed;
    z-index: 200;
    min-width: 210px;
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    background: #fff;
    box-shadow: var(--shadow-md);
}

.kebab__item {
    display: block;
    width: 100%;
    padding: 9px 12px;
    border: 0;
    border-radius: 8px;
    background: none;
    font: inherit;
    font-size: 0.85rem;
    text-align: left;
    text-decoration: none;
    color: var(--ink-soft);
    cursor: pointer;
    white-space: nowrap;
    transition: background var(--ease), color var(--ease);
}

    .kebab__item:hover {
        background: var(--surface-sunken);
        color: var(--ink);
    }

.kebab__item--danger {
    color: var(--danger);
}

    .kebab__item--danger:hover {
        background: var(--danger-tint);
        color: var(--danger);
    }

.kebab__separator {
    height: 1px;
    margin: 6px 4px;
    border: 0;
    background: var(--line);
}

/* Classes utilisées dans les vues */
.muted {
    color: var(--ink-faint);
}

.assignment-warning {
    color: var(--warn);
    font-weight: 600;
    background: var(--warn-tint);
}

/* Modale : apparition en fondu */
.modal-root {
    backdrop-filter: blur(2px);
    animation: modal-fade var(--ease);
}

.modal-root .form-card {
    box-shadow: var(--shadow-lg);
    animation: modal-rise 180ms cubic-bezier(.4, 0, .2, 1);
}

@keyframes modal-fade {
    from {
        opacity: 0;
    }
}

@keyframes modal-rise {
    from {
        opacity: 0;
        transform: translateY(12px) scale(.98);
    }
}

/* Lien de retour en tête de fiche */
.back-link {
    display: inline-block;
    margin-bottom: 0.35rem;
    color: var(--ink-muted);
    font-size: 0.88rem;
    font-weight: 600;
    transition: color var(--ease);
}

    .back-link:hover {
        color: var(--brand);
    }

/* Aperçu d'import : avant → après */
.diff-list {
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: 0.85rem;
}

    .diff-list li {
        display: flex;
        align-items: baseline;
        gap: 0.4rem;
        margin: 0.1rem 0;
    }

.diff-label {
    min-width: 5.5rem;
    color: var(--ink-faint);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.diff-before {
    color: var(--ink-muted);
    text-decoration: line-through;
}

.diff-arrow {
    color: var(--ink-faint);
}

.diff-after {
    color: var(--ok);
    font-weight: 600;
}

.import-check {
    width: 18px;
    height: 18px;
    accent-color: var(--brand);
    cursor: pointer;
}

/* Tableau de bord */

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.75rem;
}

.stat-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.2rem;
    padding: 1.15rem 1.25rem;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--r-xl);
    box-shadow: var(--shadow-sm);
    color: var(--ink);
    text-decoration: none;
    transition: transform var(--ease), box-shadow var(--ease), border-color var(--ease);
}

    .stat-card:hover {
        transform: translateY(-2px);
        box-shadow: var(--shadow-md);
        border-color: var(--brand);
        color: var(--ink);
    }

.stat-card__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    margin-bottom: 0.55rem;
    border-radius: var(--r-md);
    background: var(--brand-tint);
    color: var(--brand);
}

    .stat-card__icon svg {
        width: 20px;
        height: 20px;
    }

.stat-card__value {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -1px;
    font-variant-numeric: tabular-nums;
}

.stat-card__label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--ink-muted);
}

.stat-card--attention {
    border-color: #FBDFA6;
    background: linear-gradient(180deg, #FFFCF5, #fff 60%);
}

    .stat-card--attention .stat-card__icon {
        background: var(--warn-tint);
        color: var(--warn);
    }

    .stat-card--attention .stat-card__value {
        color: var(--warn);
    }

.dashboard-cta {
    margin: 0 0 0.5rem;
}

.dashboard-more {
    margin-top: 0.9rem;
    font-size: 0.88rem;
    font-weight: 600;
}

/* Blocs récupérés */

.addshome-grid {
    display: flex;
    flex-wrap: wrap;
    text-align: center;
    gap: 1rem;
    margin-bottom: 1.75rem;
}

.detail-actions-bottom {
    display: flex;
    width: fit-content;
    margin-right: auto;
    gap: 1rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    padding: 1rem 1.25rem;
    margin-bottom: 0.75rem;
    box-shadow: var(--shadow-xs);
    margin-top: 2rem;
}
