/* ==========================================================================
   ONE GED — système de design de l'interface documentaire
   Charte alignée sur la liasse fiscale ONE ERP : encre #0d1b2a, indigo
   #335cff, menthe #12b886, sable #f6f7fb. Trilinguisme et RTL natifs.
   Aucune dépendance externe : polices système, icônes SVG inline (sprite).
   ========================================================================== */

/* 1. Jetons de conception ------------------------------------------------- */
:root {
    /* Marque — palette liasse fiscale */
    --brand-900: #0d1b2a;
    --brand-800: #101d2e;
    --brand-700: #2346d8;
    --brand-600: #335cff;
    --brand-500: #4d7cff;
    --brand-400: #7d9aff;
    --brand-200: #c7d2ff;
    --brand-100: #e0e6ff;
    --brand-50: #eef2ff;

    /* Neutres */
    --ink: #0d1b2a;
    --ink-2: #1b2a3d;
    --ink-3: #344054;
    --muted: #667085;
    --muted-2: #667080;
    --bg: #f6f7fb;
    --surface: #ffffff;
    --surface-2: #f8fafc;
    --surface-3: #eef1f6;
    --line: #e4e8ef;
    --line-2: #d5dbe5;

    /* États — teintes textuelles assombries pour respecter le contraste AA
       sur les fonds doux (vert, ambre, rouge restent la signature). */
    --ok: #0b7a56;
    --ok-bg: #e8f8f1;
    --ok-line: #b7ebd6;
    --warn: #8a5a0d;
    --warn-bg: #fff6e6;
    --warn-line: #f6dfb2;
    --danger: #b42318;
    --danger-bg: #fef1f0;
    --danger-line: #fbc9c5;
    --info: #1d3bb8;
    --info-bg: #eef2ff;
    --info-line: #d3ddff;
    --violet: #475467;
    --violet-bg: #f2f4f7;
    --violet-line: #d0d5dd;

    /* Formes */
    --r-xl: 16px;
    --r-lg: 12px;
    --r-md: 10px;
    --r-sm: 8px;
    --r-pill: 999px;
    --shadow-xs: 0 1px 2px rgba(16, 24, 40, .06);
    --shadow-sm: 0 1px 2px rgba(16, 24, 40, .06);
    --shadow-md: 0 1px 2px rgba(16, 24, 40, .05), 0 8px 24px -12px rgba(16, 24, 40, .18);
    --shadow-lg: 0 24px 60px -24px rgba(16, 24, 40, .28);
    --ring: 0 0 0 3px rgba(51, 92, 255, .18);

    /* Gabarit */
    --sidebar-w: 264px;
    --topbar-h: 64px;
    --content-max: 1460px;
    --gutter: 28px;

    /* Typographie */
    --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans Arabic",
        "Noto Naskh Arabic", Tahoma, sans-serif;
    --font-mono: "Cascadia Code", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

/* 2. Base ---------------------------------------------------------------- */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.5;
    color: var(--ink);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

body.no-scroll {
    overflow: hidden;
}

h1, h2, h3, h4, h5 {
    margin: 0;
    font-weight: 650;
    line-height: 1.25;
    letter-spacing: -.012em;
    color: var(--ink);
}

h1 { font-size: 1.5rem; }
h2 { font-size: 1.06rem; }
h3 { font-size: .94rem; }

p { margin: 0; }

a {
    color: var(--brand-600);
    text-decoration: none;
    transition: color .15s ease;
}

a:hover { color: var(--brand-500); }

img, svg { display: block; max-width: 100%; }

hr {
    border: 0;
    border-top: 1px solid var(--line);
    margin: 20px 0;
}

code, kbd, samp, .mono {
    font-family: var(--font-mono);
    font-size: .86em;
}

kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border: 1px solid var(--line-2);
    border-bottom-width: 2px;
    border-radius: 5px;
    background: var(--surface-2);
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
}

:focus-visible {
    outline: 2px solid var(--brand-500);
    outline-offset: 2px;
    border-radius: 4px;
}

::selection {
    background: var(--brand-200);
    color: var(--brand-900);
}

/* 3. Utilitaires --------------------------------------------------------- */
.sr-only {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.skip-link {
    position: fixed;
    inset-inline-start: 16px;
    top: -60px;
    z-index: 1000;
    padding: 10px 18px;
    border-radius: var(--r-sm);
    background: var(--brand-700);
    color: #fff;
    font-weight: 600;
    box-shadow: var(--shadow-md);
    transition: top .18s ease;
}

.skip-link:focus {
    top: 14px;
    color: #fff;
}

.hidden { display: none !important; }
.nowrap { white-space: nowrap; }
.text-muted { color: var(--muted); }
.text-small { font-size: .82rem; }
.text-right { text-align: end; }
.full { width: 100%; }
.stack { display: grid; gap: 16px; }
.stack-sm { display: grid; gap: 10px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.grow { flex: 1 1 auto; min-width: 0; }
.icon-only { padding: 0 !important; width: 38px; height: 38px; justify-content: center; }

/* 4. Icônes -------------------------------------------------------------- */
.ico {
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
    vertical-align: -3px;
}

.ico-sm { width: 15px; height: 15px; stroke-width: 2; }
.ico-lg { width: 22px; height: 22px; }
.ico-xl { width: 28px; height: 28px; }

html[dir="rtl"] .ico-direction { transform: scaleX(-1); }

/* 5. Gabarit ------------------------------------------------------------- */
.app {
    display: flex;
    min-height: 100vh;
}

.app-main {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.content {
    flex: 1 1 auto;
    width: 100%;
    max-width: var(--content-max);
    margin: 0 auto;
    padding: 26px var(--gutter) 40px;
}

.page-footer {
    border-top: 1px solid var(--line);
    padding: 16px var(--gutter);
    color: var(--muted-2);
    font-size: .78rem;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.page-footer .version {
    font-family: var(--font-mono);
    letter-spacing: .02em;
}

/* 6. Barre latérale ------------------------------------------------------ */
.sidebar {
    position: sticky;
    top: 0;
    z-index: 60;
    display: flex;
    flex-direction: column;
    width: var(--sidebar-w);
    height: 100vh;
    flex: 0 0 var(--sidebar-w);
    padding: 18px 14px 14px;
    color: rgba(255, 255, 255, .78);
    background: linear-gradient(180deg, #101d2e 0%, #0a1420 100%);
    border-inline-end: 1px solid rgba(255, 255, 255, .06);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, .2) transparent;
}

.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .18); border-radius: 3px; }

.brand {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 6px 8px 20px;
    color: #fff;
    text-decoration: none;
}

.brand:hover { color: #fff; }

.brand-mark {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: linear-gradient(135deg, #4d7cff, #12b886);
    box-shadow: 0 6px 18px -6px rgba(77, 124, 255, .8);
    color: #fff;
}

.brand-mark .ico { width: 21px; height: 21px; stroke-width: 1.7; }

.brand-text { display: grid; line-height: 1.15; }
.brand-text strong { font-size: 1.02rem; letter-spacing: .01em; font-weight: 700; }
.brand-text span {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .16em;
    color: rgba(255, 255, 255, .48);
}

.nav-section {
    margin-top: 14px;
}

.nav-title {
    padding: 0 10px 7px;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .15em;
    color: rgba(255, 255, 255, .36);
    font-weight: 650;
}

.nav-lien {
    position: relative;
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 9px 11px;
    margin-bottom: 2px;
    border-radius: 9px;
    color: rgba(255, 255, 255, .74);
    font-size: .92rem;
    font-weight: 500;
    text-decoration: none;
    transition: background .15s ease, color .15s ease;
}

.nav-lien .ico { width: 18px; height: 18px; opacity: .8; }

.nav-lien:hover {
    background: rgba(255, 255, 255, .07);
    color: #fff;
}

.nav-lien.actif {
    background: rgba(77, 124, 255, .18);
    color: #fff;
    font-weight: 600;
}

.nav-lien.actif::before {
    content: "";
    position: absolute;
    inset-inline-start: -8px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 20px;
    border-radius: 2px;
    background: #6b8dff;
}

.nav-lien.actif .ico { opacity: 1; }

.nav-badge {
    margin-inline-start: auto;
    min-width: 22px;
    padding: 1px 7px;
    border-radius: var(--r-pill);
    background: rgba(255, 255, 255, .14);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    text-align: center;
}

.sidebar-foot {
    margin-top: auto;
    padding-top: 18px;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-radius: 11px;
    background: rgba(255, 255, 255, .06);
    border: 1px solid rgba(255, 255, 255, .07);
}

.sidebar-user .avatar { background: rgba(255, 255, 255, .16); color: #fff; }

.sidebar-user-infos { min-width: 0; line-height: 1.3; }
.sidebar-user-infos strong {
    display: block;
    font-size: .86rem;
    color: #fff;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar-user-infos span {
    display: block;
    font-size: .72rem;
    color: rgba(255, 255, 255, .52);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user .ico { color: rgba(255, 255, 255, .7); }

/* 7. Barre supérieure ---------------------------------------------------- */
.topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    gap: 14px;
    height: var(--topbar-h);
    padding: 0 var(--gutter);
    background: rgba(255, 255, 255, .88);
    backdrop-filter: saturate(180%) blur(10px);
    border-bottom: 1px solid var(--line);
}

.burger {
    display: none;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
    color: var(--ink-2);
    cursor: pointer;
}

.recherche-top {
    position: relative;
    flex: 1 1 auto;
    max-width: 520px;
}

.recherche-top .ico {
    position: absolute;
    inset-inline-start: 13px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted-2);
    width: 17px;
    height: 17px;
    pointer-events: none;
}

.recherche-top input {
    width: 100%;
    height: 41px;
    padding: 0 84px 0 40px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface-2);
    font: inherit;
    font-size: .9rem;
    color: var(--ink);
    transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}

html[dir="rtl"] .recherche-top input { padding: 0 40px 0 84px; }

.recherche-top input::placeholder { color: var(--muted-2); }

.recherche-top input:focus {
    outline: none;
    background: #fff;
    border-color: var(--brand-400);
    box-shadow: var(--ring);
}

.recherche-top .raccourci {
    position: absolute;
    inset-inline-end: 9px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    gap: 3px;
    pointer-events: none;
    opacity: .8;
}

.topbar-sep {
    width: 1px;
    height: 26px;
    background: var(--line);
}

.langues {
    display: inline-flex;
    padding: 3px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: var(--surface-2);
}

.langues a {
    padding: 3px 8px;
    border-radius: 6px;
    font-size: .75rem;
    font-weight: 650;
    color: var(--muted);
    line-height: 1.5;
}

.langues a:hover { color: var(--brand-600); }

.langues a.actif {
    background: #fff;
    color: var(--brand-700);
    box-shadow: var(--shadow-xs);
}

.utilisateur-menu { position: relative; }

.utilisateur-menu > summary {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 4px 6px 4px 4px;
    border-radius: 10px;
    cursor: pointer;
    list-style: none;
    transition: background .15s ease;
}

.utilisateur-menu > summary::-webkit-details-marker { display: none; }

.utilisateur-menu > summary:hover { background: var(--surface-2); }

.utilisateur-menu .nom {
    display: grid;
    line-height: 1.2;
    text-align: start;
}

.utilisateur-menu .nom strong { font-size: .84rem; font-weight: 600; }
.utilisateur-menu .nom span { font-size: .71rem; color: var(--muted); }

.menu-panneau {
    position: absolute;
    inset-inline-end: 0;
    top: calc(100% + 8px);
    z-index: 80;
    min-width: 230px;
    padding: 7px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    box-shadow: var(--shadow-md);
}

.menu-panneau .entete {
    padding: 8px 10px 10px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 6px;
}

.menu-panneau .entete strong { display: block; font-size: .86rem; }
.menu-panneau .entete span { font-size: .74rem; color: var(--muted); }

.menu-lien {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px 10px;
    border-radius: 8px;
    color: var(--ink-2);
    font-size: .86rem;
    font-weight: 500;
}

.menu-lien:hover { background: var(--surface-2); color: var(--brand-700); }
.menu-lien.danger { color: var(--danger); }
.menu-lien.danger:hover { background: var(--danger-bg); color: var(--danger); }

.avatar {
    display: inline-grid;
    place-items: center;
    width: 34px;
    height: 34px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: var(--brand-100);
    color: var(--brand-700);
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .02em;
    text-transform: uppercase;
}

.avatar-lg { width: 40px; height: 40px; font-size: .9rem; }

/* 8. En-tête de page ----------------------------------------------------- */
.entete-page {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 22px;
}

.entete-page .titre-bloc { min-width: 0; }

.surtitre {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .13em;
    text-transform: uppercase;
    color: var(--brand-500);
    margin-bottom: 6px;
}

.sous-titre {
    color: var(--muted);
    font-size: .9rem;
    margin-top: 5px;
}

.entete-actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }

.fil-ariane {
    display: flex;
    align-items: center;
    gap: 7px;
    flex-wrap: wrap;
    margin-bottom: 14px;
    font-size: .82rem;
    color: var(--muted);
}

.fil-ariane a { color: var(--muted); }
.fil-ariane a:hover { color: var(--brand-600); }
.fil-ariane .ico { width: 14px; height: 14px; color: var(--muted-2); }
.fil-ariane [aria-current="page"] { color: var(--ink-2); font-weight: 600; }

/* 9. Cartes -------------------------------------------------------------- */
.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-sm);
    min-width: 0;
}

.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
    padding: 16px 20px;
    border-bottom: 1px solid var(--line);
}

.card-head h2 { font-size: 1rem; }
.card-head .sous { font-size: .78rem; color: var(--muted); margin-top: 2px; }
.card-body { padding: 20px; }
.card-body.tight { padding: 12px; }
.card-body.flush { padding: 0; }
.card-foot {
    padding: 13px 20px;
    border-top: 1px solid var(--line);
    background: var(--surface-2);
    border-radius: 0 0 var(--r-lg) var(--r-lg);
}

.card-accent { border-top: 3px solid var(--brand-600); }

/* 10. Indicateurs -------------------------------------------------------- */
.kpis {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.kpi {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 18px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.kpi::before {
    content: "";
    position: absolute;
    inset-block: 0;
    inset-inline-start: 0;
    width: 4px;
    background: var(--brand-600);
    opacity: .85;
}

.kpi::after {
    content: "";
    position: absolute;
    inset-inline-end: -30px;
    top: -30px;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: var(--brand-50);
    opacity: .7;
}

.kpi-icone {
    position: relative;
    z-index: 1;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    flex: 0 0 auto;
    border-radius: 12px;
    background: var(--brand-100);
    color: var(--brand-700);
}

.kpi-icone .ico { width: 21px; height: 21px; }
.kpi-icone.ok { background: var(--ok-bg); color: var(--ok); }
.kpi-icone.warn { background: var(--warn-bg); color: var(--warn); }
.kpi-icone.gold { background: var(--warn-bg); color: var(--warn); }
.kpi-icone.violet { background: var(--violet-bg); color: var(--violet); }

.kpi-corps { position: relative; z-index: 1; min-width: 0; }
.kpi-valeur {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -.02em;
    line-height: 1.15;
    font-variant-numeric: tabular-nums;
}
.kpi-valeur small { font-size: .8rem; font-weight: 600; color: var(--muted); letter-spacing: 0; }
.kpi-libelle {
    font-size: .72rem;
    color: var(--muted);
    margin-top: 3px;
    text-transform: uppercase;
    letter-spacing: .06em;
    font-weight: 650;
}
.kpi-note { font-size: .74rem; color: var(--muted-2); margin-top: 7px; display: flex; align-items: center; gap: 5px; }
.kpi-note .ico { width: 13px; height: 13px; }
.kpi-note.hausse { color: var(--ok); }

/* 11. Tableaux ----------------------------------------------------------- */
.tableau-enveloppe {
    position: relative; /* contient les éléments .sr-only positionnés en absolu */
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.tableau {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: .88rem;
}

.tableau th {
    padding: 10px 18px;
    text-align: start;
    font-size: .69rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--muted);
    background: var(--surface-2);
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}

.tableau td {
    padding: 12px 18px;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}

.tableau tbody tr:last-child td { border-bottom: 0; }

.tableau tbody tr {
    transition: background .13s ease;
}

.tableau tbody tr:hover { background: var(--brand-50); }

.tableau .col-date { white-space: nowrap; color: var(--muted); font-variant-numeric: tabular-nums; }
.tableau .col-num { text-align: end; font-variant-numeric: tabular-nums; }

.tableau .actions-ligne {
    display: flex;
    justify-content: flex-end;
    gap: 4px;
    opacity: 0;
    transition: opacity .15s ease;
}

.tableau tbody tr:hover .actions-ligne,
.tableau tbody tr:focus-within .actions-ligne { opacity: 1; }

@media (hover: none) {
    .tableau .actions-ligne { opacity: 1; }
}

/* Cellule document */
.doc-cellule {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.doc-cellule .infos { min-width: 0; }

.doc-cellule .titre {
    display: inline-block;
    max-width: 46ch;
    font-weight: 600;
    color: var(--ink);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: bottom;
}

.doc-cellule .titre:hover { color: var(--brand-600); }

.doc-cellule .sous {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 2px;
    font-size: .75rem;
    color: var(--muted);
}

.doc-cellule .sous .sep { color: var(--line-2); }

/* Pastille de type de fichier */
.fiche-type {
    display: grid;
    place-items: center;
    width: 38px;
    height: 44px;
    flex: 0 0 auto;
    border-radius: 7px;
    background: var(--brand-100);
    color: var(--brand-700);
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
    border: 1px solid rgba(51, 92, 255, .14);
    position: relative;
}

.fiche-type::before {
    content: "";
    position: absolute;
    top: 0;
    inset-inline-end: 0;
    width: 10px;
    height: 10px;
    border-start-start-radius: 3px;
    background: linear-gradient(225deg, #fff 0 48%, rgba(51, 92, 255, .18) 50%);
}

.fiche-type.pdf { background: var(--danger-bg); color: var(--danger); border-color: var(--danger-line); }
.fiche-type.img { background: var(--violet-bg); color: var(--violet); border-color: var(--violet-line); }
.fiche-type.doc { background: var(--info-bg); color: var(--info); }
.fiche-type.tab { background: var(--ok-bg); color: var(--ok); border-color: var(--ok-line); }
.fiche-type.zip { background: var(--warn-bg); color: var(--warn); border-color: var(--warn-line); }
.fiche-type.txt { background: var(--surface-3); color: var(--ink-3); border-color: var(--line-2); }
.fiche-type.lg { width: 52px; height: 60px; font-size: 11px; border-radius: 9px; }
.fiche-type.lg::before { width: 14px; height: 14px; }

/* 12. Pastilles et badges ------------------------------------------------ */
.pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: var(--r-pill);
    border: 1px solid transparent;
    font-size: .72rem;
    font-weight: 650;
    line-height: 1.5;
    white-space: nowrap;
    letter-spacing: .01em;
    background: var(--surface-3);
    color: var(--ink-3);
}

.pill .point {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    flex: 0 0 auto;
    opacity: .9;
}

.pill .ico { width: 12px; height: 12px; stroke-width: 2.2; }

.pill.neutre { background: var(--surface-3); color: var(--ink-3); border-color: var(--line); }
.pill.info { background: var(--info-bg); color: var(--info); border-color: var(--info-line); }
.pill.ok { background: var(--ok-bg); color: var(--ok); border-color: var(--ok-line); }
.pill.warn { background: var(--warn-bg); color: var(--warn); border-color: var(--warn-line); }
.pill.danger { background: var(--danger-bg); color: var(--danger); border-color: var(--danger-line); }
.pill.violet { background: var(--violet-bg); color: var(--violet); border-color: var(--violet-line); }
.pill.gold { background: var(--warn-bg); color: var(--warn); border-color: var(--warn-line); }
.pill.contour { background: transparent; border-color: var(--line-2); color: var(--muted); }
.pill.sm { padding: 1px 7px; font-size: .68rem; }
.pill.lg { padding: 5px 12px; font-size: .78rem; }

/* Statuts documentaires */
.statut-brouillon { background: var(--surface-3); color: var(--ink-3); border-color: var(--line); }
.statut-en_validation { background: var(--warn-bg); color: var(--warn); border-color: var(--warn-line); }
.statut-valide { background: var(--ok-bg); color: var(--ok); border-color: var(--ok-line); }
.statut-publie { background: var(--info-bg); color: var(--info); border-color: var(--info-line); }
.statut-archive { background: var(--violet-bg); color: var(--violet); border-color: var(--violet-line); }
.statut-gele { background: var(--danger-bg); color: var(--danger); border-color: var(--danger-line); }
.statut-detruit { background: #3f1d1d; color: #ffd9d5; border-color: #522423; }

/* Confidentialité */
.conf-public { background: var(--ok-bg); color: var(--ok); border-color: var(--ok-line); }
.conf-interne { background: var(--info-bg); color: var(--info); border-color: var(--info-line); }
.conf-restreint { background: var(--warn-bg); color: var(--warn); border-color: var(--warn-line); }
.conf-confidentiel { background: var(--danger-bg); color: var(--danger); border-color: var(--danger-line); }
.conf-secret { background: var(--brand-900); color: #fff; border-color: var(--brand-800); }

/* 13. Boutons ------------------------------------------------------------ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 38px;
    padding: 0 15px;
    border: 1px solid transparent;
    border-radius: 9px;
    font: inherit;
    font-size: .85rem;
    font-weight: 600;
    line-height: 1;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease, transform .1s ease;
    background: transparent;
    color: var(--ink-2);
}

.btn:active { transform: translateY(1px); }

.btn .ico { width: 16px; height: 16px; }

.btn.primaire {
    background: var(--brand-600);
    border-color: var(--brand-600);
    color: #fff;
    box-shadow: 0 1px 2px rgba(16, 24, 40, .08);
}

.btn.primaire:hover {
    background: var(--brand-700);
    border-color: var(--brand-700);
    color: #fff;
    box-shadow: 0 5px 14px -4px rgba(51, 92, 255, .45);
}

.btn.secondaire {
    background: var(--surface);
    border-color: var(--line-2);
    color: var(--ink-2);
    box-shadow: var(--shadow-xs);
}

.btn.secondaire:hover {
    border-color: var(--brand-400);
    color: var(--brand-700);
    background: var(--brand-50);
}

.btn.ghost { color: var(--ink-3); }
.btn.ghost:hover { background: var(--surface-3); color: var(--brand-700); }

.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger:hover { background: #b42318; color: #fff; }

.btn.danger-doux { background: var(--danger-bg); border-color: var(--danger-line); color: var(--danger); }
.btn.danger-doux:hover { background: #fdd9d5; color: var(--danger); }

.btn.or {
    background: var(--brand-600);
    border-color: var(--brand-600);
    color: #fff;
    box-shadow: 0 1px 2px rgba(16, 24, 40, .08);
}
.btn.or:hover { background: var(--brand-700); border-color: var(--brand-700); color: #fff; }

.btn.sm { height: 31px; padding: 0 11px; font-size: .78rem; border-radius: 8px; }
.btn.sm .ico { width: 14px; height: 14px; }
.btn.lg { height: 44px; padding: 0 20px; font-size: .92rem; border-radius: 10px; }
.btn.plein { width: 100%; }
.btn[disabled], .btn.disabled { opacity: .55; pointer-events: none; }

.btn-lien {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 0;
    border: 0;
    background: none;
    color: var(--brand-600);
    font: inherit;
    font-size: .82rem;
    font-weight: 600;
    cursor: pointer;
}
.btn-lien:hover { color: var(--brand-500); text-decoration: underline; }
.btn-lien .ico { width: 14px; height: 14px; }
.btn-lien.danger { color: var(--danger); }

.lien-discret {
    color: var(--muted);
    font-size: .8rem;
    font-weight: 600;
}
.lien-discret:hover { color: var(--brand-600); }

form.inline { display: inline; }

/* 14. Formulaires -------------------------------------------------------- */
.formulaire { display: grid; gap: 18px; }

.champ { display: grid; gap: 6px; min-width: 0; }

.champ > label,
.champ .etiquette {
    display: flex;
    align-items: baseline;
    gap: 6px;
    font-size: .8rem;
    font-weight: 650;
    color: var(--ink-2);
}

.champ .requis { color: var(--danger); font-weight: 700; }
.champ .facultatif { color: var(--muted-2); font-size: .72rem; font-weight: 500; }

.champ .aide {
    font-size: .74rem;
    color: var(--muted);
    line-height: 1.4;
}

.champ input[type="text"],
.champ input[type="search"],
.champ input[type="number"],
.champ input[type="date"],
.champ input[type="password"],
.champ input[type="email"],
.champ select,
.champ textarea,
.input {
    width: 100%;
    min-height: 41px;
    padding: 8px 12px;
    border: 1px solid var(--line-2);
    border-radius: 9px;
    background: var(--surface);
    font: inherit;
    font-size: .89rem;
    color: var(--ink);
    transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}

.champ textarea { min-height: 104px; resize: vertical; line-height: 1.5; }

.champ input:hover,
.champ select:hover,
.champ textarea:hover { border-color: #b9c6d8; }

.champ input:focus,
.champ select:focus,
.champ textarea:focus {
    outline: none;
    border-color: var(--brand-400);
    box-shadow: var(--ring);
}

.champ input[readonly] { background: var(--surface-2); color: var(--muted); }

.champ input::placeholder,
.champ textarea::placeholder { color: var(--muted-2); }

select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 11px center;
    padding-inline-end: 34px !important;
}

html[dir="rtl"] select { background-position: left 11px center; }

.grille-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.grille-form .pleine { grid-column: 1 / -1; }

.groupe-champs {
    display: grid;
    gap: 16px;
    padding: 18px 20px;
}

.groupe-champs + .groupe-champs { border-top: 1px solid var(--line); }

.groupe-titre {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-bottom: 2px;
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--muted);
}

.groupe-titre .ico { width: 15px; height: 15px; color: var(--brand-500); }

.case {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: .85rem;
    color: var(--ink-2);
    cursor: pointer;
}

.case input[type="checkbox"] {
    width: 17px;
    height: 17px;
    accent-color: var(--brand-600);
    flex: 0 0 auto;
}

.segmented {
    display: inline-flex;
    padding: 3px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: var(--surface-2);
    gap: 2px;
}

.segmented label,
.segmented button {
    padding: 5px 11px;
    border: 0;
    border-radius: 6px;
    background: none;
    font: inherit;
    font-size: .78rem;
    font-weight: 600;
    color: var(--muted);
    cursor: pointer;
}

.segmented .actif {
    background: #fff;
    color: var(--brand-700);
    box-shadow: var(--shadow-xs);
}

/* Message d'aide contextuel */
.note {
    display: flex;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: var(--surface-2);
    font-size: .81rem;
    color: var(--ink-3);
    line-height: 1.5;
}

.note .ico { width: 17px; height: 17px; flex: 0 0 auto; margin-top: 1px; }
.note.info { background: var(--info-bg); border-color: var(--info-line); color: #1d3bb8; }
.note.ok { background: var(--ok-bg); border-color: var(--ok-line); color: #05603a; }
.note.warn { background: var(--warn-bg); border-color: var(--warn-line); color: #7a4a00; }
.note.danger { background: var(--danger-bg); border-color: var(--danger-line); color: #912018; }
.note strong { font-weight: 650; }

/* 15. Zone de dépôt ------------------------------------------------------ */
.depot-zone {
    position: relative;
    display: grid;
    place-items: center;
    gap: 8px;
    padding: 26px 20px;
    border: 2px dashed var(--line-2);
    border-radius: var(--r-lg);
    background: var(--surface-2);
    text-align: center;
    cursor: pointer;
    transition: border-color .18s ease, background .18s ease;
}

.depot-zone:hover,
.depot-zone.survol {
    border-color: var(--brand-400);
    background: var(--brand-50);
}

.depot-zone input[type="file"] {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.depot-zone .rond {
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: #fff;
    color: var(--brand-600);
    border: 1px solid var(--line);
    box-shadow: var(--shadow-xs);
}

.depot-zone strong { font-size: .9rem; font-weight: 650; }
.depot-zone span { font-size: .78rem; color: var(--muted); }

.fichier-choisi {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface-2);
}

.fichier-choisi .infos { min-width: 0; flex: 1; }
.fichier-choisi strong {
    display: block;
    font-size: .85rem;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.fichier-choisi span { font-size: .75rem; color: var(--muted); }

/* 16. Onglets ------------------------------------------------------------ */
.onglets {
    display: flex;
    gap: 2px;
    padding: 0 12px;
    border-bottom: 1px solid var(--line);
    overflow-x: auto;
    scrollbar-width: none;
}

.onglets::-webkit-scrollbar { display: none; }

.onglet {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 13px 13px 12px;
    border: 0;
    border-bottom: 2px solid transparent;
    background: none;
    font: inherit;
    font-size: .85rem;
    font-weight: 600;
    color: var(--muted);
    cursor: pointer;
    white-space: nowrap;
    transition: color .15s ease, border-color .15s ease;
}

.onglet .ico { width: 15px; height: 15px; }

.onglet:hover { color: var(--brand-600); }

.onglet[aria-selected="true"] {
    color: var(--brand-700);
    border-bottom-color: var(--brand-600);
}

.onglet .compteur {
    min-width: 18px;
    padding: 0 5px;
    border-radius: var(--r-pill);
    background: var(--surface-3);
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    line-height: 17px;
    text-align: center;
}

.onglet[aria-selected="true"] .compteur { background: var(--brand-100); color: var(--brand-700); }

.panneau { padding: 20px; }
.js .panneau[hidden] { display: none; }
.panneau:focus { outline: none; }

/* 17. Chronologie -------------------------------------------------------- */
.timeline {
    position: relative;
    margin: 0;
    padding: 0 0 0 24px;
    list-style: none;
}

html[dir="rtl"] .timeline { padding: 0 24px 0 0; }

.timeline::before {
    content: "";
    position: absolute;
    inset-inline-start: 7px;
    top: 6px;
    bottom: 6px;
    width: 2px;
    background: var(--line);
}

.timeline > li { position: relative; padding-bottom: 18px; }
.timeline > li:last-child { padding-bottom: 0; }

.timeline > li::before {
    content: "";
    position: absolute;
    inset-inline-start: -22px;
    top: 5px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid var(--brand-400);
    box-shadow: 0 0 0 3px #fff;
}

.timeline > li.ok::before { border-color: var(--ok); }
.timeline > li.danger::before { border-color: var(--danger); }
.timeline > li.gold::before { border-color: var(--warn); }

.timeline .entete-ligne {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    font-size: .85rem;
    font-weight: 600;
    color: var(--ink-2);
}

.timeline .meta {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    font-size: .75rem;
    color: var(--muted);
    margin-top: 1px;
}

.timeline .texte { font-size: .8rem; color: var(--ink-3); margin-top: 3px; }

/* 18. Tableau de bord ---------------------------------------------------- */
.dash-grille {
    display: grid;
    grid-template-columns: minmax(0, 1.75fr) minmax(280px, 1fr);
    gap: 18px;
    align-items: start;
}

.dash-col { display: grid; gap: 18px; }

.donut-bloc {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.donut {
    position: relative;
    width: 132px;
    height: 132px;
    flex: 0 0 auto;
}

.donut svg { width: 100%; height: 100%; transform: rotate(-90deg); }

.donut circle { fill: none; stroke-width: 3.4; }

.donut .centre {
    position: absolute;
    inset: 0;
    display: grid;
    place-content: center;
    text-align: center;
    line-height: 1.1;
}

.donut .centre strong { font-size: 1.3rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.donut .centre span { font-size: .68rem; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }

.legende { display: grid; gap: 8px; flex: 1 1 130px; min-width: 0; }

.legende-ligne {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: .79rem;
    color: var(--ink-3);
}

.legende-ligne .point { width: 8px; height: 8px; border-radius: 2px; flex: 0 0 auto; }
.legende-ligne .valeur { margin-inline-start: auto; font-weight: 650; font-variant-numeric: tabular-nums; }

.barres { display: grid; gap: 12px; }

.barre-ligne { display: grid; gap: 5px; }

.barre-ligne .entete {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    font-size: .8rem;
    color: var(--ink-3);
}

.barre-ligne .entete strong { font-weight: 600; color: var(--ink-2); }
.barre-ligne .entete span { font-variant-numeric: tabular-nums; color: var(--muted); }

.barre {
    height: 7px;
    border-radius: var(--r-pill);
    background: var(--surface-3);
    overflow: hidden;
}

.barre > i {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--brand-400), var(--brand-600));
}

.barre.or > i { background: linear-gradient(90deg, #e0a33a, var(--warn)); }
.barre.ok > i { background: linear-gradient(90deg, #34a26b, var(--ok)); }
.barre.violet > i { background: linear-gradient(90deg, #98a2b3, var(--violet)); }

.espaces-grille {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 14px;
}

.espace-carte {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px 16px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
    color: var(--ink);
    transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}

.espace-carte:hover {
    border-color: var(--brand-200);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
    color: var(--ink);
}

.espace-carte .icone {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    flex: 0 0 auto;
    border-radius: 10px;
    background: var(--brand-50);
    color: var(--brand-600);
    border: 1px solid var(--brand-100);
}

.espace-carte .infos { min-width: 0; flex: 1; }
.espace-carte .infos strong {
    display: block;
    font-size: .87rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.espace-carte .infos span { font-size: .73rem; color: var(--muted); }

.espace-carte .compte {
    font-size: .72rem;
    font-weight: 700;
    color: var(--brand-700);
    background: var(--brand-50);
    border: 1px solid var(--brand-100);
    border-radius: var(--r-pill);
    padding: 1px 8px;
    white-space: nowrap;
}

.espace-carte > .ico { color: var(--muted-2); width: 16px; height: 16px; }

/* 19. Page document ------------------------------------------------------ */
.doc-entete {
    display: flex;
    gap: 18px;
    align-items: flex-start;
    padding: 20px;
    flex-wrap: wrap;
}

.doc-entete .principal { flex: 1 1 380px; min-width: 0; }
.doc-entete h1 {
    font-size: clamp(1.25rem, 1.05rem + .5vw, 1.55rem);
    line-height: 1.3;
    margin-bottom: 5px;
    overflow-wrap: anywhere;
}
.doc-entete .reference {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    font-size: .8rem;
    color: var(--muted);
}
.doc-entete .reference code {
    background: var(--surface-3);
    padding: 1px 7px;
    border-radius: 5px;
    color: var(--ink-3);
}
.doc-entete .badges { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 11px; }
.doc-entete .actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.doc-grille {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(290px, 1fr);
    gap: 18px;
    align-items: start;
    margin-top: 18px;
}

.doc-col { display: grid; gap: 18px; min-width: 0; }

.apercu-cadre {
    position: relative;
    min-height: 460px;
    background:
        linear-gradient(45deg, var(--surface-2) 25%, transparent 25%, transparent 75%, var(--surface-2) 75%) 0 0/22px 22px,
        linear-gradient(45deg, var(--surface-2) 25%, #fff 25%, #fff 75%, var(--surface-2) 75%) 11px 11px/22px 22px;
    border-radius: var(--r-md);
    overflow: hidden;
    display: grid;
}

.apercu-cadre iframe,
.apercu-cadre img,
.apercu-cadre object {
    width: 100%;
    height: 100%;
    min-height: 520px;
    border: 0;
    background: #fff;
    object-fit: contain;
}

.apercu-cadre.texte {
    display: block;
    padding: 22px;
    background: #fff;
    min-height: 200px;
    max-height: 620px;
    overflow: auto;
    font-family: var(--font-mono);
    font-size: .82rem;
    white-space: pre-wrap;
    color: var(--ink-2);
}

.barre-apercu {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
    background: var(--surface-2);
    font-size: .8rem;
    color: var(--muted);
}

.barre-apercu .nom {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--ink-3);
    font-weight: 600;
    min-width: 0;
}

.barre-apercu .nom span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 46ch;
}

/* Définitions / propriétés */
.definitions {
    display: grid;
    grid-template-columns: minmax(130px, 0.45fr) minmax(0, 1fr);
    gap: 0;
    margin: 0;
    border: 1px solid var(--line);
    border-radius: 10px;
    overflow: hidden;
}

.definitions dt,
.definitions dd {
    margin: 0;
    padding: 10px 14px;
    border-bottom: 1px solid var(--line);
    font-size: .83rem;
    min-width: 0;
}

.definitions dt {
    color: var(--muted);
    background: var(--surface-2);
    font-weight: 550;
    border-inline-end: 1px solid var(--line);
    display: flex;
    align-items: center;
    gap: 7px;
}

.definitions dt .ico { width: 14px; height: 14px; color: var(--brand-400); }
.definitions dd { color: var(--ink-2); overflow-wrap: anywhere; }

.definitions > :nth-last-child(2),
.definitions > :last-child { border-bottom: 0; }

.empreinte-bloc {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 11px;
    border: 1px dashed var(--line-2);
    border-radius: 8px;
    background: var(--surface-2);
    font-family: var(--font-mono);
    font-size: .72rem;
    color: var(--muted);
    word-break: break-all;
}

.empreinte-bloc .ico { flex: 0 0 auto; color: var(--brand-400); }

.copie {
    margin-inline-start: auto;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    color: var(--muted);
    font: inherit;
    font-size: .7rem;
    padding: 2px 7px;
    cursor: pointer;
    white-space: nowrap;
}
.copie:hover { color: var(--brand-700); border-color: var(--brand-200); }

/* Rail latéral */
.rail-card .card-head { padding: 14px 16px; }
.rail-card .card-head h2 { font-size: .92rem; }
.rail-card .card-body { padding: 14px 16px; }

.action-rangee {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 9px 10px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: none;
    font: inherit;
    font-size: .83rem;
    font-weight: 550;
    color: var(--ink-2);
    cursor: pointer;
    text-align: start;
}

.action-rangee:hover { background: var(--surface-2); border-color: var(--line); color: var(--brand-700); }
.action-rangee .ico { width: 16px; height: 16px; color: var(--muted); }
.action-rangee.danger { color: var(--danger); }
.action-rangee.danger .ico { color: var(--danger); }
.action-rangee.danger:hover { background: var(--danger-bg); border-color: var(--danger-line); }

.action-rangee .etat {
    margin-inline-start: auto;
    font-size: .7rem;
    font-weight: 700;
    color: var(--muted-2);
}

/* 20. Recherche ---------------------------------------------------------- */
.recherche-grille {
    display: grid;
    grid-template-columns: 292px minmax(0, 1fr);
    gap: 18px;
    align-items: start;
}

/* Les colonnes de contenu doivent pouvoir rétrécir sous la largeur du tableau. */
.recherche-grille > *,
.dash-grille > *,
.doc-grille > * {
    min-width: 0;
}

.filtres-carte {
    position: sticky;
    top: calc(var(--topbar-h) + 16px);
}

.filtres-carte .card-body { padding: 16px; display: grid; gap: 14px; }

.filtres-carte .champ > label { font-size: .74rem; }

.filtres-pied {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-top: 4px;
}

.filtres-pied .btn.primaire { flex: 1; }

.puces-actives {
    display: flex;
    align-items: center;
    gap: 7px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.puce {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 6px 3px 10px;
    border-radius: var(--r-pill);
    border: 1px solid var(--brand-200);
    background: var(--brand-50);
    color: var(--brand-700);
    font-size: .74rem;
    font-weight: 600;
}

.puce a {
    display: grid;
    place-items: center;
    width: 17px;
    height: 17px;
    border-radius: 50%;
    color: var(--brand-600);
    background: rgba(51, 92, 255, .1);
}

.puce a:hover { background: var(--brand-600); color: #fff; }
.puce .ico { width: 10px; height: 10px; stroke-width: 2.6; }

.resultats-barre {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding: 13px 18px;
    border-bottom: 1px solid var(--line);
}

.resultats-barre h2 { font-size: .95rem; }
.resultats-barre .compte { color: var(--muted); font-weight: 500; font-size: .82rem; }

/* 21. Audit -------------------------------------------------------------- */
.audit-outils {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 14px 18px;
    border-bottom: 1px solid var(--line);
    background: var(--surface-2);
}

.audit-outils .champ-recherche {
    position: relative;
    flex: 1 1 260px;
    max-width: 420px;
}

.audit-outils .champ-recherche .ico {
    position: absolute;
    inset-inline-start: 11px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted-2);
    width: 15px;
    height: 15px;
}

.audit-outils input,
.audit-outils select {
    height: 36px;
    border: 1px solid var(--line-2);
    border-radius: 8px;
    background: #fff;
    font: inherit;
    font-size: .83rem;
    padding: 0 11px;
    color: var(--ink);
}

.audit-outils .champ-recherche input { width: 100%; padding-inline-start: 34px; }

.tableau-audit td { font-size: .81rem; }
.tableau-audit .action-code {
    font-family: var(--font-mono);
    font-size: .74rem;
    color: var(--brand-700);
    background: var(--brand-50);
    border: 1px solid var(--brand-100);
    border-radius: 5px;
    padding: 1px 6px;
    display: inline-block;
}
.tableau-audit .ip { font-family: var(--font-mono); font-size: .72rem; color: var(--muted-2); }
.tableau-audit .acteur { font-weight: 600; color: var(--ink-2); }

.mini-stats {
    display: flex;
    gap: 22px;
    flex-wrap: wrap;
}

.mini-stat { display: grid; gap: 1px; }
.mini-stat strong { font-size: 1.1rem; font-variant-numeric: tabular-nums; }
.mini-stat span { font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }

/* 22. États vides -------------------------------------------------------- */
.vide {
    display: grid;
    place-items: center;
    gap: 8px;
    padding: 46px 24px;
    text-align: center;
    color: var(--muted);
}

.vide .rond {
    display: grid;
    place-items: center;
    width: 56px;
    height: 56px;
    border-radius: 16px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    color: var(--brand-400);
    margin-bottom: 4px;
}

.vide .rond .ico { width: 26px; height: 26px; }
.vide strong { font-size: .95rem; color: var(--ink-2); font-weight: 650; }
.vide p { font-size: .83rem; max-width: 42ch; }
.vide .btn { margin-top: 8px; }

/* 23. Notifications (flash) ---------------------------------------------- */
.toasts {
    position: fixed;
    top: 16px;
    inset-inline-end: 16px;
    z-index: 200;
    display: grid;
    gap: 10px;
    width: min(380px, calc(100vw - 32px));
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: 11px;
    padding: 13px 14px;
    border-radius: 11px;
    background: #fff;
    border: 1px solid var(--line);
    box-shadow: var(--shadow-md);
    pointer-events: auto;
    animation: toast-in .22s ease both;
}

.toast .icone {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    flex: 0 0 auto;
    border-radius: 8px;
    background: var(--info-bg);
    color: var(--info);
}
.toast .icone .ico { width: 16px; height: 16px; }

.toast.succes .icone { background: var(--ok-bg); color: var(--ok); }
.toast.erreur .icone { background: var(--danger-bg); color: var(--danger); }
.toast.attention .icone { background: var(--warn-bg); color: var(--warn); }

.toast .corps { flex: 1; min-width: 0; font-size: .83rem; color: var(--ink-2); line-height: 1.45; padding-top: 3px; }

.toast .fermer {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    border: 0;
    border-radius: 6px;
    background: none;
    color: var(--muted-2);
    cursor: pointer;
}
.toast .fermer:hover { background: var(--surface-3); color: var(--ink-2); }

@keyframes toast-in {
    from { opacity: 0; transform: translateY(-8px) scale(.98); }
    to { opacity: 1; transform: none; }
}

/* 24. Page de connexion -------------------------------------------------- */
.auth {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
    min-height: 100vh;
    background: #fff;
}

.auth-marque {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 32px;
    padding: 44px clamp(28px, 4vw, 64px);
    overflow: hidden;
    color: rgba(255, 255, 255, .8);
    background:
        radial-gradient(80% 50% at 100% 0%, rgba(77, 124, 255, .35), transparent 65%),
        radial-gradient(60% 40% at 0% 100%, rgba(18, 184, 134, .16), transparent 60%),
        linear-gradient(160deg, #101d2e 0%, #0b1626 55%, #070f19 100%);
}

.auth-marque::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, .045) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, .045) 1px, transparent 1px);
    background-size: 46px 46px;
    mask-image: radial-gradient(70% 60% at 50% 40%, #000 0%, transparent 100%);
    pointer-events: none;
}

.auth-marque > * { position: relative; z-index: 1; }

.auth-brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    color: #fff;
    width: fit-content;
}

.auth-brand:hover { color: #fff; }
.auth-brand .brand-mark { width: 44px; height: 44px; }
.auth-brand .brand-text strong { font-size: 1.15rem; }
.auth-brand .brand-text span { color: rgba(255, 255, 255, .5); }

.auth-accroche h1 {
    color: #fff;
    font-size: clamp(1.6rem, 1.2rem + 1.2vw, 2.3rem);
    line-height: 1.2;
    letter-spacing: -.02em;
    max-width: 20ch;
}

.auth-accroche h1 em {
    font-style: normal;
    color: #9db8ff;
}

.auth-accroche p {
    margin-top: 14px;
    max-width: 46ch;
    font-size: .95rem;
    line-height: 1.6;
    color: rgba(255, 255, 255, .66);
}

.auth-points {
    display: grid;
    gap: 13px;
    margin-top: 28px;
    padding: 0;
    list-style: none;
    max-width: 430px;
}

.auth-points li {
    display: flex;
    align-items: flex-start;
    gap: 11px;
    font-size: .87rem;
    color: rgba(255, 255, 255, .78);
}

.auth-points .ico {
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
    margin-top: 1px;
    color: #9db8ff;
}

.auth-illustration {
    position: relative;
    margin-top: 34px;
    padding: 18px;
    border-radius: 16px;
    background: rgba(255, 255, 255, .07);
    border: 1px solid rgba(255, 255, 255, .12);
    backdrop-filter: blur(6px);
    box-shadow: 0 24px 60px -30px rgba(0, 0, 0, .7);
    max-width: 470px;
}

.auth-illustration .ligne-demo {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 9px 10px;
    border-radius: 9px;
    background: rgba(255, 255, 255, .04);
}

.auth-illustration .ligne-demo + .ligne-demo { margin-top: 7px; }

.auth-illustration .fiche-type {
    width: 30px;
    height: 35px;
    font-size: 8px;
    background: rgba(255, 255, 255, .12);
    color: #e6eef9;
    border-color: rgba(255, 255, 255, .14);
}

.auth-illustration .fiche-type::before { display: none; }

.auth-illustration .ligne-demo .txt { min-width: 0; flex: 1; line-height: 1.3; }
.auth-illustration .ligne-demo .txt strong {
    display: block;
    font-size: .8rem;
    color: #fff;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.auth-illustration .ligne-demo .txt span { font-size: .7rem; color: rgba(255, 255, 255, .48); }
.auth-illustration .ligne-demo .pastille {
    font-size: .62rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: var(--r-pill);
    background: rgba(77, 124, 255, .22);
    color: #c7d2ff;
}

.auth-marque .pied {
    font-size: .74rem;
    color: rgba(255, 255, 255, .4);
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
}

.auth-form {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 40px 24px;
    position: relative;
}

.auth-langues {
    position: absolute;
    top: 22px;
    inset-inline-end: 24px;
}

.auth-carte {
    width: 100%;
    max-width: 400px;
}

.auth-carte .logo-mobile { display: none; }

.auth-carte h2 {
    font-size: 1.55rem;
    letter-spacing: -.015em;
}

.auth-carte .intro {
    margin-top: 6px;
    font-size: .88rem;
    color: var(--muted);
    line-height: 1.5;
}

.auth-carte form { margin-top: 24px; display: grid; gap: 16px; }

.champ-mot-de-passe { position: relative; }
.champ-mot-de-passe input { padding-inline-end: 44px; }
.champ-mot-de-passe .oeil {
    position: absolute;
    inset-inline-end: 6px;
    bottom: 3px;
    display: grid;
    place-items: center;
    width: 34px;
    height: 35px;
    border: 0;
    border-radius: 7px;
    background: none;
    color: var(--muted-2);
    cursor: pointer;
}
.champ-mot-de-passe .oeil:hover { background: var(--surface-3); color: var(--ink-2); }

.auth-sep {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 22px 0 0;
    color: var(--muted-2);
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .1em;
}

.auth-sep::before,
.auth-sep::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--line);
}

.auth-aide {
    margin-top: 18px;
    text-align: center;
    font-size: .78rem;
    color: var(--muted);
}

.auth-pied {
    margin-top: 34px;
    font-size: .72rem;
    color: var(--muted-2);
    text-align: center;
}

/* 25. Pages d'erreur ----------------------------------------------------- */
.page-erreur {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 32px;
    background:
        radial-gradient(60% 50% at 50% 0%, var(--brand-50), transparent 70%),
        var(--bg);
}

.erreur-carte {
    width: 100%;
    max-width: 540px;
    padding: 40px;
    text-align: center;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--r-xl);
    box-shadow: var(--shadow-md);
}

.erreur-carte .code {
    font-size: 3.4rem;
    font-weight: 800;
    letter-spacing: -.04em;
    line-height: 1;
    color: var(--brand-600);
}

.erreur-carte .rond {
    display: grid;
    place-items: center;
    width: 64px;
    height: 64px;
    margin: 0 auto 18px;
    border-radius: 18px;
    background: var(--brand-50);
    color: var(--brand-600);
    border: 1px solid var(--brand-100);
}

.erreur-carte h1 { margin-bottom: 8px; }
.erreur-carte p { color: var(--muted); font-size: .9rem; }
.erreur-carte .actions { margin-top: 24px; justify-content: center; }

/* 26. Animations --------------------------------------------------------- */
@keyframes fade-up {
    from { transform: translateY(6px); }
    to { transform: none; }
}

.content > * { animation: fade-up .22s ease both; }
.content > *:nth-child(2) { animation-delay: .04s; }
.content > *:nth-child(3) { animation-delay: .08s; }
.content > *:nth-child(4) { animation-delay: .12s; }

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: .001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .001ms !important;
        scroll-behavior: auto !important;
    }
}

/* 27. Responsive --------------------------------------------------------- */
@media (max-width: 1240px) {
    :root { --gutter: 22px; }
    .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .dash-grille, .doc-grille { grid-template-columns: minmax(0, 1fr); }
    .recherche-grille { grid-template-columns: 250px minmax(0, 1fr); }
}

@media (max-width: 1024px) {
    .sidebar {
        position: fixed;
        inset-block: 0;
        inset-inline-start: 0;
        transform: translateX(-102%);
        transition: transform .22s ease;
        box-shadow: 0 0 60px rgba(0, 0, 0, .35);
        width: 280px;
        flex-basis: 280px;
    }

    html[dir="rtl"] .sidebar { transform: translateX(102%); }

    .sidebar.ouvert,
    html[dir="rtl"] .sidebar.ouvert { transform: translateX(0); }

    .burger { display: inline-flex; }

    .overlay {
        position: fixed;
        inset: 0;
        z-index: 55;
        background: rgba(8, 21, 38, .5);
        backdrop-filter: blur(2px);
        opacity: 0;
        pointer-events: none;
        transition: opacity .2s ease;
    }

    .overlay.visible { opacity: 1; pointer-events: auto; }

    .recherche-grille { grid-template-columns: minmax(0, 1fr); }
    .filtres-carte { position: static; }

    .auth { grid-template-columns: minmax(0, 1fr); }
    .auth-marque { display: none; }
    .auth-carte .logo-mobile {
        display: inline-flex;
        align-items: center;
        gap: 10px;
        margin-bottom: 28px;
        color: var(--ink);
    }
    .auth-carte .logo-mobile .brand-mark { width: 38px; height: 38px; }
    .auth-carte .logo-mobile strong { font-size: 1rem; }
}

@media (max-width: 760px) {
    :root { --gutter: 15px; --topbar-h: 62px; }

    .content { padding-top: 18px; }

    .recherche-top { max-width: none; }
    .recherche-top .raccourci { display: none; }
    .recherche-top input { padding-inline-end: 14px; }

    .topbar { gap: 9px; }
    .topbar .btn .libelle-btn { display: none; }
    .topbar .btn { padding: 0 11px; }
    .topbar-sep { display: none; }
    .utilisateur-menu .nom { display: none; }

    .kpis { grid-template-columns: minmax(0, 1fr); gap: 12px; }
    .entete-page { align-items: flex-start; flex-direction: column; }
    .entete-actions { width: 100%; }
    .entete-actions .btn { flex: 1; }

    .grille-form { grid-template-columns: minmax(0, 1fr); }
    .definitions { grid-template-columns: minmax(0, 1fr); }
    .definitions dt { border-inline-end: 0; border-bottom: 0; padding-bottom: 0; background: transparent; }
    .definitions dd { padding-top: 4px; }

    .doc-entete { padding: 16px; }
    .doc-entete .actions { width: 100%; }
    .doc-entete .actions .btn { flex: 1 1 auto; }

    .onglet { padding: 12px 10px; }
    .panneau { padding: 15px; }
    .card-head, .card-body { padding-inline: 15px; }
    .tableau th, .tableau td { padding-inline: 13px; }

    .masquer-mobile { display: none !important; }

    .page-footer { padding-inline: var(--gutter); }
    .auth-form { padding: 28px 20px; }
    .auth-carte h2 { font-size: 1.35rem; }
}

@media (max-width: 520px) {
    .doc-cellule .titre { max-width: 28ch; }
    .audit-outils { padding: 12px; }
    .resultats-barre { padding: 12px 14px; }
    .toasts { top: 10px; inset-inline-end: 10px; }
}

/* 28. Impression --------------------------------------------------------- */
@media print {
    .sidebar, .topbar, .toasts, .entete-actions, .actions, .onglets, .page-footer, .overlay { display: none !important; }
    .app { display: block; }
    body { background: #fff; }
    .content { max-width: none; padding: 0; }
    .card { box-shadow: none; border-color: #ccc; break-inside: avoid; }
    .panneau { display: block !important; }
    a { color: inherit; text-decoration: none; }
}
