/* ==========================================================
   Alfred — thème sombre / or / bleu nuit
   Cabinet d'Avocat — SaaS multi-tenants
   ========================================================== */

:root {
    --bg-anthracite:  #1a1d24;
    --bg-card:        #232730;
    --bg-card-hover:  #2a2f3a;
    --bg-sidebar:     #14171c;
    --border-soft:    #2e3340;

    --text-main:      #f1f3f6;
    --text-muted:     #9098a8;
    --text-inverse:   #14171c;

    --or:             #D4AF37;
    --or-soft:        #b89327;
    --bleu-nuit:      #1e2a4a;
    --bleu-nuit-2:    #2a3866;

    --rouge-alerte:   #d9534f;
    --vert-ok:        #4caf7a;
    --orange-warn:    #e0a23a;

    --radius:         8px;
    --shadow-1:       0 2px 6px rgba(0,0,0,.35);
    --shadow-2:       0 6px 20px rgba(0,0,0,.45);

    --sidebar-w:      240px;
    --header-h:       60px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg-anthracite);
    color: var(--text-main);
    font-size: 14px;
    line-height: 1.5;
}
/* v1.6.13 : empêche le scroll au niveau de la fenêtre — le scroll se fait dans .main
   afin que la sidebar reste toujours visible.
   :has() est supporté par tous les navigateurs modernes (Chrome 105+, Firefox 121+, Safari 15.4+).
   Cible uniquement les pages avec sidebar (login, logout, setup conservent leur scroll natif). */
body:has(.app) { overflow: hidden; }

a { color: var(--or); text-decoration: none; }
a:hover { color: var(--or-soft); }

button { font-family: inherit; cursor: pointer; }

/* ==========================================================
   PAGE DE LOGIN
   ========================================================== */
.login-body {
    display: flex; align-items: center; justify-content: center;
    min-height: 100vh;
    background:
        radial-gradient(ellipse at top, rgba(212,175,55,.05), transparent 60%),
        linear-gradient(180deg, #14171c 0%, #1a1d24 100%);
}

.login-card {
    width: 100%; max-width: 420px;
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    padding: 40px 32px;
    box-shadow: var(--shadow-2);
}

.login-header { text-align: center; margin-bottom: 28px; }
/* v1.40.0 — Le bloc identité Alfred (logo + baseline) remplace l'ancien
   `.logo-or ⚖` + h1 + subtitle. Voir .alfred-logo / .alfred-baseline. */

.login-card label {
    display: block;
    margin: 16px 0 6px;
    font-size: 12px; text-transform: uppercase;
    letter-spacing: .5px; color: var(--text-muted);
}
.login-card input {
    width: 100%;
    padding: 11px 14px;
    background: var(--bg-anthracite);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    color: var(--text-main);
    font-size: 14px;
    transition: border-color .15s, box-shadow .15s;
}
.login-card input:focus {
    outline: none;
    border-color: var(--or);
    box-shadow: 0 0 0 2px rgba(212,175,55,.2);
}

.btn-or {
    width: 100%;
    margin-top: 24px;
    padding: 12px;
    background: var(--or);
    color: var(--text-inverse);
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: background .15s;
}
.btn-or:hover { background: var(--or-soft); }

.login-footer {
    text-align: center;
    margin-top: 24px;
    color: var(--text-muted);
}

/* ==========================================================
   ALERTES
   ========================================================== */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 13px;
    border: 1px solid transparent;
}
.alert-error   { background: rgba(217,83,79,.1);  color: #ff8a86; border-color: rgba(217,83,79,.3); }
.alert-warn    { background: rgba(224,162,58,.1); color: #f0bf6f; border-color: rgba(224,162,58,.3); }
.alert-ok      { background: rgba(76,175,122,.1); color: #74d59c; border-color: rgba(76,175,122,.3); }
.alert-info    { background: rgba(30,42,74,.4);   color: #c7d4f0; border-color: var(--bleu-nuit-2); }

/* ==========================================================
   LAYOUT APP (sidebar + header + content)
   ========================================================== */
.app {
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr;
    grid-template-rows: var(--header-h) 1fr;
    grid-template-areas:
        "sidebar header"
        "sidebar main";
    min-height: 100vh;
    height: 100vh; /* v1.6.13 : empêche le scroll global, le scroll se fait dans .main */
    transition: grid-template-columns 0.2s ease;
}
/* v1.6.13 : Mode sidebar repliée (icônes seulement) */
.app.sidebar-collapsed {
    grid-template-columns: 56px 1fr;
}

/* ----- Sidebar ----- */
.sidebar {
    grid-area: sidebar;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-soft);
    padding: 20px 0;
    overflow-y: auto;
    overflow-x: hidden; /* v1.6.13 : empêche scroll horizontal pendant la transition */

    /* v1.11.8 — Masque la scrollbar (esthétique) tout en gardant le scroll
       fonctionnel (molette, touch, flèches clavier, drag de la souris).
       Firefox : scrollbar-width:none. Webkit/Blink : ::-webkit-scrollbar.
       Anciens IE/Edge legacy : -ms-overflow-style:none. */
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.sidebar::-webkit-scrollbar {
    width: 0;
    height: 0;
}

/* v1.6.13.1 : Bouton de bascule positionné sur .app (et non .sidebar)
   pour éviter le clipping par overflow:hidden de la sidebar.
   Effet "à cheval" sur la bordure droite, design moderne (cf. VS Code, Notion). */
.app { position: relative; }
.sidebar-toggle {
    position: absolute;
    top: 14px;
    left: calc(var(--sidebar-w) - 16px); /* à cheval sur la bordure droite */
    width: 32px;
    height: 32px;
    background: var(--bg-card);
    border: 1px solid var(--or);
    border-radius: 50%;
    color: var(--or);
    font-size: 16px;
    line-height: 1;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    transition: background 0.15s, color 0.15s, transform 0.15s, left 0.2s ease;
}
.sidebar-toggle:hover {
    background: var(--or);
    color: #14171c;
    transform: scale(1.08);
}
.sidebar-toggle:active {
    transform: scale(0.96);
}
.sidebar-toggle .chevron-icon {
    font-weight: 700;
    user-select: none;
    line-height: 1;
}
/* En mode collapsed, le bouton suit la nouvelle largeur (56px - 16px) */
.app.sidebar-collapsed .sidebar-toggle {
    left: calc(56px - 16px);
}

/* v1.6.13 : En mode collapsed, on cache le brand text et les libellés des items nav */
.app.sidebar-collapsed .sidebar-brand h2,
.app.sidebar-collapsed .sidebar-brand small {
    display: none;
}
.app.sidebar-collapsed .sidebar-brand {
    padding: 0 12px 16px;
    text-align: center;
}
.app.sidebar-collapsed .sidebar-brand .logo {
    margin-bottom: 0;
}
.app.sidebar-collapsed .sidebar nav { padding: 8px 6px; }
.app.sidebar-collapsed .sidebar nav a {
    justify-content: center;
    padding: 10px 6px;
    gap: 0;
    overflow: hidden;
    white-space: nowrap;
}
/* En collapsed : on masque tout sauf l'icône (et le badge éventuel) */
.app.sidebar-collapsed .sidebar nav a {
    font-size: 0; /* libellé invisible */
}
.app.sidebar-collapsed .sidebar nav a .nav-icon {
    font-size: 14px; /* icône visible */
}
.app.sidebar-collapsed .sidebar nav a .nav-badge {
    /* Badge en surimpression dans l'angle supérieur droit de l'item */
    position: absolute;
    margin-left: 0;
    top: 4px;
    right: 4px;
    font-size: 9px;
    padding: 1px 4px;
}
.app.sidebar-collapsed .sidebar nav a {
    position: relative;
}
.app.sidebar-collapsed .sidebar nav a.active {
    border-left: none;
    border-right: 3px solid var(--or);
    padding-left: 6px;
    padding-right: 3px;
}
.sidebar-brand {
    padding: 0 16px 18px;
    border-bottom: 1px solid var(--border-soft);
    margin-bottom: 12px;
    text-align: center;
}

/* v1.40.0 — Identité Alfred (sidebar + login) */
@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;500;600&display=swap');

.alfred-logo {
    display: block;
    width: 80px;
    height: auto;
    margin: 4px auto 0;
    user-select: none;
    /* v1.40.1 — Fond noir du PNG fondu dans le fond sombre de l'app
       grâce au mode de fusion 'lighten' (le noir disparaît, l'or reste
       à sa teinte exacte). Sans effet si le PNG est déjà transparent. */
    mix-blend-mode: lighten;
}
.alfred-logo-login {
    width: 180px;
    margin: 0 auto;
}
/* v1.41.0 — Wordmark ALFRED en CSS (Cinzel) sous le médaillon */
.alfred-wordmark {
    font-family: 'Cinzel', 'Trajan Pro', serif;
    font-weight: 600;
    color: var(--or);
    text-transform: uppercase;
    text-align: center;
    letter-spacing: .18em;
    line-height: 1;
    font-size: 18px;
    margin: -6px auto 8px;
}
.alfred-wordmark-login {
    font-size: 36px;
    letter-spacing: .22em;
    margin: -10px auto 14px;
}
.alfred-baseline {
    font-family: 'Cinzel', 'Trajan Pro', serif;
    font-weight: 500;
    font-size: 9.5px;
    letter-spacing: .18em;
    line-height: 1.5;
    color: var(--text-muted);
    text-transform: uppercase;
    text-align: center;
}
.alfred-baseline .alfred-baseline-cab {
    color: var(--or);
    font-weight: 600;
    letter-spacing: .22em;
    font-size: 10.5px;
}
.alfred-baseline-login {
    font-size: 12px;
    margin-top: 0;
}
.alfred-baseline-login .alfred-baseline-cab {
    font-size: 14px;
    letter-spacing: .26em;
}

/* Compat collapsed sidebar : on masque la baseline et le wordmark,
   on garde uniquement le logo médaillon */
.app.sidebar-collapsed .alfred-baseline,
.app.sidebar-collapsed .alfred-wordmark { display: none; }
.app.sidebar-collapsed .alfred-logo {
    width: 36px;
    margin: 4px auto;
}

.sidebar nav { padding: 8px 12px; }
.sidebar nav a {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px;
    color: var(--text-muted);
    border-radius: 6px;
    font-size: 13px;
    margin-bottom: 2px;
    transition: background .12s, color .12s;
}
.sidebar nav a:hover {
    background: var(--bg-card);
    color: var(--text-main);
}
.sidebar nav a.active {
    background: linear-gradient(90deg, var(--bleu-nuit) 0%, transparent 100%);
    color: var(--or);
    border-left: 3px solid var(--or);
    padding-left: 9px;
}
.sidebar nav .nav-icon { width: 18px; text-align: center; font-size: 14px; }
.sidebar nav .nav-badge {
    margin-left: auto;
    background: var(--rouge-alerte);
    color: #fff;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 600;
}

/* ----- Header ----- */
.header {
    grid-area: header;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-soft);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 24px;
}
.header h1 { font-size: 16px; font-weight: 500; }
.header .user-info {
    display: flex; align-items: center; gap: 12px;
    font-size: 13px;
}
.user-info .avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: var(--or);
    color: var(--text-inverse);
    display: flex; align-items: center; justify-content: center;
    font-weight: 600;
}
.user-info .logout {
    color: var(--text-muted);
    padding: 6px 12px;
    border: 1px solid var(--border-soft);
    border-radius: 6px;
}
.user-info .logout:hover { color: var(--or); border-color: var(--or); }

/* ----- Main content ----- */
.main { grid-area: main; padding: 24px; overflow-y: auto; }
.main h2.page-title {
    font-size: 20px; font-weight: 500;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-soft);
}
.main h3.section-title {
    font-size: 15px; font-weight: 500; color: var(--or);
    margin: 24px 0 12px;
}

/* ==========================================================
   COMPOSANTS
   ========================================================== */

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
}
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.kpi-card {
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    padding: 20px;
    border-left: 3px solid var(--or);
}
.kpi-card .label { font-size: 11px; text-transform: uppercase; color: var(--text-muted); letter-spacing: .5px; }
.kpi-card .value { font-size: 28px; font-weight: 600; margin-top: 6px; color: var(--text-main); }
.kpi-card.alert  { border-left-color: var(--rouge-alerte); }
.kpi-card.warn   { border-left-color: var(--orange-warn); }
.kpi-card.ok     { border-left-color: var(--vert-ok); }

/* Tables */
.tbl-wrap { overflow-x: auto; border: 1px solid var(--border-soft); border-radius: var(--radius); }
table.tbl {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
table.tbl thead {
    background: var(--bleu-nuit);
}
table.tbl th {
    text-align: left;
    padding: 10px 12px;
    font-weight: 500;
    color: var(--text-main);
    border-bottom: 1px solid var(--border-soft);
}
table.tbl td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-soft);
    color: var(--text-main);
}
table.tbl tbody tr:hover { background: var(--bg-card-hover); }
table.tbl tbody tr:last-child td { border-bottom: none; }

/* Pastille rouge dossier incomplet */
.pastille {
    display: inline-block;
    width: 10px; height: 10px;
    border-radius: 50%;
    margin-right: 6px;
    vertical-align: middle;
}
.pastille.rouge { background: var(--rouge-alerte); box-shadow: 0 0 6px rgba(217,83,79,.6); }
.pastille.verte { background: var(--vert-ok); }
.pastille.orange { background: var(--orange-warn); }

/* Boutons */
.btn {
    display: inline-block;
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 13px;
    border: 1px solid var(--border-soft);
    background: var(--bg-card);
    color: var(--text-main);
    cursor: pointer;
    transition: all .15s;
}
.btn:hover { border-color: var(--or); color: var(--or); }
.btn-primary {
    background: var(--or); color: var(--text-inverse); border-color: var(--or);
    font-weight: 600;
}
.btn-primary:hover { background: var(--or-soft); border-color: var(--or-soft); color: var(--text-inverse); }
.btn-bleu {
    background: var(--bleu-nuit); color: var(--text-main); border-color: var(--bleu-nuit-2);
}
.btn-bleu:hover { background: var(--bleu-nuit-2); border-color: var(--or); color: var(--or); }

/* Search bar */
.searchbar {
    display: flex; gap: 8px; margin-bottom: 16px;
}
.searchbar input, .searchbar select {
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    border-radius: 6px;
    padding: 9px 12px;
    color: var(--text-main);
    font-size: 13px;
    flex: 1;
}
.searchbar input:focus, .searchbar select:focus {
    outline: none; border-color: var(--or);
}

/* Empty state */
.empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

/* Forms */
form .form-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 12px; }
form label { display: block; font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
form input, form select, form textarea {
    width: 100%;
    background: var(--bg-anthracite);
    border: 1px solid var(--border-soft);
    border-radius: 6px;
    padding: 8px 12px;
    color: var(--text-main);
    font-size: 13px;
    font-family: inherit;
}
form input:focus, form select:focus, form textarea:focus {
    outline: none; border-color: var(--or);
}

/* ==========================================================
   ONGLETS (formulaire dossier)
   ========================================================== */
.tabs {
    display: flex; gap: 2px;
    border-bottom: 1px solid var(--border-soft);
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.tabs button {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 10px 18px;
    font-size: 13px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: color .15s, border-color .15s;
    font-family: inherit;
}
.tabs button:hover { color: var(--text-main); }
.tabs button.active {
    color: var(--or);
    border-bottom-color: var(--or);
    font-weight: 500;
}
.tabs button .badge-mini {
    display: inline-block;
    background: var(--rouge-alerte);
    color: #fff;
    font-size: 10px;
    padding: 1px 5px;
    border-radius: 8px;
    margin-left: 4px;
    font-weight: 600;
}
.tab-pane { display: none; }
.tab-pane.active { display: block; animation: fadein .15s ease; }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }

/* Form layout */
.form-section-title {
    color: var(--or);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: .5px;
    margin: 16px 0 12px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border-soft);
}
.form-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px 16px;
    margin-bottom: 16px;
}
.form-grid .col-2 { grid-column: span 2; }
.form-grid .col-3 { grid-column: span 3; }
.field-required label::after {
    content: ' *';
    color: var(--rouge-alerte);
}

.form-actions {
    display: flex; gap: 8px; justify-content: flex-end;
    padding-top: 16px;
    border-top: 1px solid var(--border-soft);
    margin-top: 20px;
}

/* Fiche de consultation */
.fiche-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 16px;
    align-items: start;
}
.fiche-row {
    display: grid;
    grid-template-columns: 160px 1fr;
    padding: 6px 0;
    font-size: 13px;
    border-bottom: 1px dashed var(--border-soft);
}
.fiche-row:last-child { border-bottom: none; }
.fiche-row .lbl { color: var(--text-muted); font-size: 12px; }
.fiche-row .val { color: var(--text-main); }
.fiche-row .val.empty { color: var(--rouge-alerte); font-style: italic; }

/* ====== Identité : layout 2 colonnes (AJ à droite) ====== */
.identite-layout {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 20px;
    align-items: start;
}
.identite-aj {
    background: var(--bg-anthracite);
    border-left: 3px solid var(--or);
    border-radius: 6px;
    padding: 14px;
    position: sticky;
    top: 20px;
}
.identite-aj label {
    display: block;
    color: var(--text-muted);
    font-size: 11px;
    margin-bottom: 4px;
}
.identite-aj input,
.identite-aj select {
    width: 100%;
}
@media (max-width: 900px) {
    .identite-layout {
        grid-template-columns: 1fr;
    }
    .identite-aj {
        position: static;
        order: -1; /* Sur mobile, mettre AJ EN HAUT pour qu'il soit accessible avant scroll */
    }
}

/* ====== Fenêtre flottante de synthèse ====== */
.floating-synth {
    position: fixed;
    top: 90px;
    right: 20px;
    width: 280px;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    background: var(--bg-card);
    border: 1px solid var(--or);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4), 0 0 0 1px rgba(212, 175, 55, 0.2);
    z-index: 1000;
    font-size: 12px;
}
.fs-header {
    background: linear-gradient(135deg, var(--bleu-nuit), var(--bg-card));
    padding: 8px 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: move;
    user-select: none;
    border-bottom: 1px solid var(--or);
    border-radius: 8px 8px 0 0;
}
.fs-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--or);
}
.fs-grip {
    color: var(--text-muted);
    font-weight: bold;
    margin-right: 4px;
    cursor: move;
    letter-spacing: -2px;
}
.fs-controls {
    display: flex;
    gap: 4px;
}
.fs-controls button {
    background: transparent;
    border: 1px solid var(--border-soft);
    color: var(--text-main);
    width: 22px;
    height: 22px;
    line-height: 1;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    padding: 0;
    transition: all 0.15s;
}
.fs-controls button:hover {
    background: var(--bleu-nuit-2);
    border-color: var(--or);
    color: var(--or);
}
.fs-body {
    padding: 12px;
}
.fs-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
    gap: 8px;
}
.fs-lbl {
    color: var(--text-muted);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    flex-shrink: 0;
}
.fs-val {
    color: var(--text-main);
    font-size: 12px;
    text-align: right;
    word-break: break-word;
}
.fs-sep {
    height: 1px;
    background: var(--border-soft);
    margin: 8px 0;
}
.fs-block {
    padding: 4px 0;
}
.fs-block-title {
    color: var(--text-muted);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}
.fs-reopen {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--or);
    color: var(--text-inverse);
    border: none;
    font-size: 20px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}
.fs-reopen:hover {
    transform: scale(1.1);
}
@media (max-width: 900px) {
    .floating-synth {
        width: calc(100vw - 30px);
        max-width: 320px;
        right: 15px;
        top: 80px;
        font-size: 11px;
    }
}

.badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}
.badge-or    { background: var(--or); color: var(--text-inverse); }
.badge-bleu  { background: var(--bleu-nuit-2); color: var(--text-main); }
.badge-rouge { background: var(--rouge-alerte); color: #fff; }
.badge-vert  { background: var(--vert-ok); color: #fff; }
.badge-gris  { background: var(--border-soft); color: var(--text-muted); }

/* Sous-tableaux dans la fiche */
.subtable th { font-size: 11px; text-transform: uppercase; }

/* Import CSV — preview */
.import-step {
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
}
.import-step h4 { color: var(--or); font-size: 13px; margin-bottom: 8px; }
.mapping-table { font-size: 12px; }
.mapping-table .auto { color: var(--vert-ok); }
.mapping-table .manual { color: var(--orange-warn); }
.mapping-table .ignored { color: var(--text-muted); font-style: italic; }

/* Responsive minimal */
@media (max-width: 900px) {
    .app { grid-template-columns: 1fr; grid-template-areas: "header" "main"; }
    .sidebar { display: none; }
    /* v1.6.13 : neutraliser sidebar-collapsed sur mobile (la sidebar est déjà cachée) */
    .app.sidebar-collapsed { grid-template-columns: 1fr; }
    form .form-row, .form-grid { grid-template-columns: 1fr; }
    .fiche-grid { grid-template-columns: 1fr; }
}

/* ===== v1.3 : Layout 2 colonnes pour onglet Procédure ===== */
.procedure-layout {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 20px;
    align-items: start;
}
.procedure-main { min-width: 0; }
.procedure-side {
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.side-block {
    background: var(--bg-anthracite);
    border-left: 3px solid var(--or);
    border-radius: 6px;
    padding: 14px;
}
.side-block h4.form-section-title {
    font-size: 12px;
    margin-top: 0;
    margin-bottom: 8px;
    color: var(--or);
}
@media (max-width: 900px) {
    .procedure-layout { grid-template-columns: 1fr; }
}

/* =====================================================================
   v1.6.1 — Filtres + tri par colonne (factorisé depuis dossiers.php)
   ---------------------------------------------------------------------
   Réutilisable sur toute liste paginée :
   - .col-th : <th> qui peut accueillir un tri et/ou un filtre
   - .col-filterable : drapeau ajouté si la colonne a une zone de filtre
   - .has-filter / .is-sorted : classes appliquées par le PHP selon l'URL
   ===================================================================== */
.tbl thead th.col-th { vertical-align: top; }
.th-label-row {
    display: flex; align-items: center; justify-content: space-between;
    gap: 6px; min-height: 22px;
}
.th-actions {
    display: inline-flex; align-items: center; gap: 4px; flex-shrink: 0;
}
.th-sort {
    text-decoration: none; cursor: pointer; padding: 0 3px;
    font-size: 11px; opacity: 0.45; line-height: 1;
    color: inherit; transition: opacity .15s ease, color .15s ease;
}
.th-sort:hover { opacity: 1; }
th.col-th.is-sorted .th-sort {
    opacity: 1; color: var(--or, #d4a437); font-weight: bold;
}
.th-filter-toggle {
    background: transparent; border: 0; cursor: pointer; padding: 0 2px;
    font-size: 11px; opacity: 0.45; line-height: 1;
    color: inherit; transition: opacity .15s ease, color .15s ease;
}
.th-filter-toggle:hover { opacity: 1; }
th.col-th.has-filter .th-filter-toggle { opacity: 1; color: var(--or, #d4a437); }
th.col-th.has-filter { background: rgba(212, 164, 55, 0.08); }
.th-filter-zone {
    display: flex; gap: 4px; align-items: center; margin-top: 4px;
}
.th-filter-zone[hidden] { display: none; }
.th-filter-input {
    width: 100%; padding: 3px 6px; font-size: 11px;
    background: var(--bleu-nuit-2, #1a1f28);
    border: 1px solid var(--border-soft, #2c3340);
    border-radius: 4px; color: var(--text-main, #eaeaea);
    font-weight: normal; text-transform: none;
}
.th-filter-input:focus {
    outline: none; border-color: var(--or, #d4a437);
}
.th-filter-clear {
    background: transparent; border: 0; cursor: pointer; padding: 0 4px;
    font-size: 11px; color: var(--text-muted, #8a8f99); line-height: 1;
}
.th-filter-clear:hover { color: var(--rouge-alerte, #d44); }
/* Bandeau récap quand des filtres / un tri sont actifs */
.filter-status {
    margin-top: 8px; font-size: 12px; color: var(--text-muted, #8a8f99);
    min-height: 18px; display: flex; gap: 14px; align-items: center;
    flex-wrap: wrap;
}
.filter-status a {
    color: var(--or, #d4a437); text-decoration: underline; cursor: pointer;
}
