/* ==========================================================================
   Refonte visuelle IUAC Finance : thème TUILES v9.1 (maquette du 2026-10-31).
   RÉFÉRENCE : Themes/Modele (SGA), via la maquette validée par Michelot le
   30/10/2026 (maquette_theme-tuiles-demonstration_sga_2026-10-30.html) :
   barre bleue, rail bleu nuit, titres à empattements (Roboto Slab), accents
   orange, onglets soulignés, tuiles simples, tableaux à en-tête très clair.
   Jamais repris du modèle déposé : icônes illustrées, bouton « Navigation »,
   menu « … », trois petites tuiles d'information, dessin, logo, texte.
   Chargé APRÈS app.css : jetons puis surcharge des composants, sans changer
   une classe des vues. Aucune bande de couleur sur une carte (R-005).
   ========================================================================== */

/* Polices auto-hébergées (Roboto, Roboto Slab ; licence Apache 2.0 ; sous-ensembles latin et latin étendu ; fichiers variables). */
@font-face { font-family: 'Roboto'; font-style: normal; font-weight: 400 700; font-display: swap; src: url('/fonts/roboto-latin-ext.woff2') format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Roboto'; font-style: normal; font-weight: 400 700; font-display: swap; src: url('/fonts/roboto-latin.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Roboto Slab'; font-style: normal; font-weight: 500 700; font-display: swap; src: url('/fonts/roboto-slab-latin-ext.woff2') format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Roboto Slab'; font-style: normal; font-weight: 500 700; font-display: swap; src: url('/fonts/roboto-slab-latin.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
    --barre: #4f7fb8;
    --section: #4a79ae;
    --nuit: #243049;
    --nuit-texte: #c9d6e8;
    --fond: #eef2f8;
    --zone: #dbe4f1;
    --onglets: #c8d6ea;
    --texte: #1e3a5f;
    --doux: #5d7390;
    --trait: #d3ddec;
    --accent: #f5821f;
    --accent-teinte: #fff0e0;
    --accent-texte: #a4510a;
    --carte: #ffffff;
    --ok: #2f7d3b;
    --ok-fond: #e2f2e4;
    --alerte-fond: #ffd9b3;
    --danger: #b3261e;
    --info-fond: #e4eefb;
    --serif: "Roboto Slab", Georgia, "Times New Roman", serif;
    --sans: Roboto, system-ui, -apple-system, "Segoe UI", sans-serif;
    --ombre: 0 1px 2px rgba(30, 58, 95, 0.08);

    /* Jetons historiques d'app.css, redirigés vers le thème */
    --ceimh-blue: var(--barre);
    --ceimh-dark: var(--texte);
    --ceimh-orange: var(--accent);
    --ceimh-bg: var(--nuit);
    --fond-page: var(--fond);
    --blanc: var(--carte);
    --texte-secondaire: var(--doux);
    --bordure: var(--trait);
    --erreur-fond: #fbe3e1;
    --erreur-bordure: #efc3c0;
    --erreur-texte: var(--danger);
    --hauteur-entete: 60px;
    --largeur-barre: 270px;
}

*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: var(--sans);
    font-size: 15px;
    line-height: 1.45;
    color: var(--texte);
    background: var(--fond);
    -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--serif); letter-spacing: 0; }
a { color: var(--barre); }

/* ---------- Barre du haut (bleue) ---------- */

.entete {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 16px;
    height: var(--hauteur-entete);
    padding: 0 18px;
    background: var(--barre);
    color: #fff;
    border-bottom: 0;
}

.bouton-menu { display: none; background: none; border: 0; color: #fff; padding: 4px; width: 36px; height: 36px; cursor: pointer; }
.bouton-menu svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }

.marque-entete {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    color: #fff;
    text-decoration: none;
}
.sceau {
    display: inline-grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: #fff;
    color: var(--barre);
    font: 700 13px var(--serif);
}
.nom-bar { font: 700 14px/1.15 var(--serif); letter-spacing: 0.2px; }

.recherche-entete {
    flex: 1;
    max-width: 560px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 16px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 24px;
    color: var(--doux);
    font-size: 14px;
}
.recherche-entete svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.recherche-entete input[type="search"] { flex: 1; min-width: 0; border: 0; padding: 0; background: transparent; color: var(--texte); font: inherit; outline: none; box-shadow: none; }
.recherche-entete kbd { font: 500 11px var(--sans); border: 1px solid var(--trait); border-radius: 4px; padding: 0 6px; background: #fff; color: var(--doux); }

.entete-droite { margin-left: auto; display: flex; align-items: center; gap: 16px; }
.entete-droite form { margin: 0; }
.chip-session { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; white-space: nowrap; }
.chip-session svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.icone-haut {
    display: inline-grid;
    place-items: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 0;
    background: none;
    color: #fff;
    cursor: pointer;
}
.icone-haut svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.entete-utilisateur { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; }
.avatar { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: #fff; color: var(--barre); font-weight: 700; font-size: 13px; }
.utilisateur-texte { display: flex; flex-direction: column; line-height: 1.15; }
.utilisateur-texte strong { font-weight: 500; font-size: 14px; }
.utilisateur-texte small { opacity: 0.85; font-size: 12px; }

/* ---------- Cadre : rail bleu nuit + contenu ---------- */

.agencement { display: grid; grid-template-columns: var(--largeur-barre) minmax(0, 1fr); align-items: start; }

.barre-laterale {
    position: sticky;
    top: var(--hauteur-entete);
    z-index: 20;
    width: auto;
    height: calc(100vh - var(--hauteur-entete));
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    padding: 0 0 18px;
    background: var(--nuit);
    color: var(--nuit-texte);
    border-right: 0;
    transform: none;
    box-shadow: none;
}

.selecteur-structure { margin: 0; padding: 14px 16px 6px; }
.selecteur-structure label { display: block; color: var(--nuit-texte); opacity: 0.75; font-size: 11px; font-weight: 600; letter-spacing: 1px; text-transform: uppercase; margin-bottom: 6px; }
.selecteur-structure select {
    width: 100%;
    padding: 9px 10px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.07);
    color: #fff;
    font: 500 14.5px var(--sans);
}
.selecteur-structure option { color: var(--texte); }

.navigation { gap: 0; }
.navigation-groupe {
    margin: 0;
    padding: 18px 18px 6px;
    color: var(--nuit-texte);
    opacity: 0.75;
    font: 600 11px var(--sans);
    letter-spacing: 1px;
    text-transform: uppercase;
}
.navigation a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 18px;
    border: 0;
    border-radius: 0;
    color: var(--nuit-texte);
    font-size: 14.5px;
    font-weight: 400;
    text-decoration: none;
}
.navigation a svg { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.navigation a:hover { background: rgba(255, 255, 255, 0.07); color: #fff; }
.navigation a.actif { background: var(--section); color: #fff; font-weight: 500; }

.rail-pied { margin: auto 0 0; padding: 24px 18px 6px; color: var(--nuit-texte); font-size: 13px; line-height: 1.35; opacity: 0.9; }
.rail-pied small { opacity: 0.7; font-size: 11.5px; }

.contenu { padding: 18px 20px 40px; min-width: 0; background: var(--fond); }
.pied-page { text-align: center; color: var(--doux); font-size: 12.5px; margin: 28px 0 0; }

/* ---------- En-tête de page : fil d'Ariane au-dessus du titre ---------- */

.entete-page, .entete-page-actions { margin: 0 0 14px; }
.entete-page .fil, .hero .fil { margin: 0 0 4px; font-size: 12.5px; color: var(--doux); }
.entete-page h1 { font-family: var(--serif); font-weight: 700; font-size: 30px; line-height: 1.15; color: var(--texte); margin: 0; }
.entete-page-actions { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; }
.sous-titre { color: var(--doux); font-size: 14.5px; margin-top: 2px; }

/* ---------- Accueil ---------- */

.accueil-grille { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.col-g, .col-d { min-width: 0; }

.hero {
    position: relative;
    min-height: 190px;
    margin: 0 0 14px;
    padding: 30px 34px;
    border-radius: 12px;
    overflow: hidden;
    color: #fff;
    background: linear-gradient(105deg, color-mix(in srgb, var(--nuit) 96%, transparent) 0%, color-mix(in srgb, var(--nuit) 78%, transparent) 48%, color-mix(in srgb, var(--barre) 55%, transparent) 100%);
}
.hero::after {
    content: "";
    position: absolute;
    right: -20px;
    top: 0;
    bottom: 0;
    width: 56%;
    opacity: 0.3;
    pointer-events: none;
    background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 200' fill='none' stroke='white' stroke-width='1.2'><path d='M0 190h400'/><path d='M40 190V90l60-30 60 30v100'/><path d='M180 190V70l80-40 80 40v120'/><path d='M300 190v-60l40-20 50 20v60'/></svg>") right bottom / contain no-repeat;
}
.hero-txt { position: relative; z-index: 1; max-width: 60%; }
.hero small { display: block; text-transform: uppercase; letter-spacing: 1.4px; font-size: 12px; opacity: 0.9; margin-bottom: 6px; }
.hero h1 { font-family: var(--serif); font-size: 32px; line-height: 1.15; margin: 0 0 8px; color: #fff; font-weight: 700; }
.hero .trait { display: block; width: 64px; height: 3px; background: var(--accent); border-radius: 2px; margin: 6px 0 12px; }
.hero p { margin: 0; font-size: 16px; opacity: 0.95; }
.hero-note { position: absolute; right: 12px; bottom: 8px; z-index: 2; font-size: 10.5px; opacity: 0.6; }

/* ---------- Cartes ---------- */

.cartes { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 14px; }
.carte, .panneau, .filtres, .panneau-formulaire, .panneau-detail {
    background: var(--carte);
    border: 0;
    border-radius: 8px;
    box-shadow: var(--ombre);
    padding: 14px 16px;
    margin-bottom: 12px;
}
.cartes .carte { margin: 0; }
.carte h2 { font: 600 12px var(--sans); letter-spacing: 1px; text-transform: uppercase; color: var(--doux); margin: 0 0 6px; }
.carte h3, .panneau h2, .panneau-formulaire h2, .panneau-detail h2 { font-family: var(--serif); font-weight: 700; font-size: 18px; color: var(--texte); margin: 0 0 8px; text-transform: none; letter-spacing: 0; }
.carte h3 .n { font: 700 12px var(--sans); background: var(--onglets); color: var(--texte); border-radius: 3px; padding: 1px 6px; margin-left: 6px; vertical-align: middle; }
.carte-tete { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.carte-tete h3 { margin: 0; }
.carte-principale { background: var(--info-fond); border: 0; border-top: 0; }
.carte-principale .montant { color: var(--barre); }
.montant { font: 700 26px var(--serif); color: var(--texte); font-variant-numeric: tabular-nums; }
.montant-negatif { color: var(--accent-texte); }
.texte-vide, .texte-aide { color: var(--doux); }
.lien-p { display: inline-block; margin-top: 10px; font-size: 13px; font-weight: 500; color: var(--barre); text-decoration: none; }
.lien-p:hover { text-decoration: underline; }

/* Tuiles SIMPLES : icône colorée centrée et titre, rien d'autre */
.tuiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; padding-bottom: 6px; }
.tuile {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 118px;
    padding: 18px 10px 16px;
    background: var(--carte);
    border: 1px solid #e6edf6;
    border-radius: 8px;
    box-shadow: var(--ombre);
    text-align: center;
    text-decoration: none;
    color: var(--texte);
    transition: box-shadow 0.15s, transform 0.15s;
}
.tuile:hover, .tuile:focus-visible { box-shadow: 0 4px 12px rgba(30, 58, 95, 0.18); transform: translateY(-1px); text-decoration: none; }
.tuile:focus-visible { outline: 2px solid var(--barre); outline-offset: 2px; }
.tuile b { font-size: 14.5px; font-weight: 700; line-height: 1.2; }
.pastille-icone { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 14px; background: var(--f); }
.pastille-icone svg { width: 28px; height: 28px; fill: none; stroke: var(--c); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.t-bleu { --c: #3f6fae; --f: #e4eefb; }
.t-orange { --c: #d9690c; --f: #fff0e0; }
.t-vert { --c: #2f7d3b; --f: #e2f2e4; }
.t-violet { --c: #6b4fb0; --f: #eee8f8; }
.t-rouge { --c: #b3261e; --f: #fbe3e1; }
.t-turquoise { --c: #1b7f86; --f: #dcf2f3; }

/* Échéances */
.echeances { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.echeances li { display: flex; align-items: center; gap: 12px; font-size: 14px; padding: 6px; border-radius: 8px; }
.echeances li.prem { background: var(--accent-teinte); }
.echeances .date { flex: none; width: 48px; text-align: center; font-size: 11px; text-transform: uppercase; color: var(--doux); line-height: 1.1; background: var(--info-fond); border-radius: 8px; padding: 6px 0; }
.echeances li.prem .date { background: #fff; color: var(--accent-texte); }
.echeances .date b { display: block; font: 700 19px var(--serif); color: var(--texte); }
.echeance-texte { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.echeance-texte a { font-weight: 500; text-decoration: none; }
.echeance-texte small { color: var(--doux); font-size: 12.5px; }
.echeance-montant { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }

.liste-projets { list-style: none; margin: 0; padding: 0; }
.liste-projets li { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid #edf1f7; }
.liste-projets li:last-child { border-bottom: 0; }
.liste-projets-montant { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--texte); }

/* ---------- Boutons ---------- */

.bouton { border-radius: 6px; font: 500 14px var(--sans); padding: 9px 16px; border: 1px solid var(--trait); }
.bouton-principal { background: var(--barre); border-color: var(--barre); color: #fff; }
.bouton-principal:hover { background: #3f6fa8; }
.bouton-secondaire { background: var(--carte); color: var(--texte); border: 1px solid var(--trait); }
.bouton-secondaire:hover { background: var(--info-fond); }
.bouton-discret { background: var(--carte); color: var(--texte); border: 1px solid var(--trait); }
.bouton-discret:hover { background: var(--info-fond); }
.entete-page-actions .bouton-principal { background: var(--accent); border-color: var(--accent); color: #fff; border-radius: 20px; }

/* ---------- Onglets soulignés en orange ---------- */

.onglets { display: flex; flex-wrap: nowrap; gap: 4px; margin: 0 0 14px; padding: 0; background: none; border-bottom: 1px solid var(--trait); overflow-x: auto; }
.onglets a {
    padding: 11px 18px;
    margin-bottom: -1px;
    border: 0;
    border-bottom: 3px solid transparent;
    border-radius: 8px 8px 0 0;
    background: none;
    color: var(--doux);
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
}
.onglets a:hover { background: var(--info-fond); color: var(--texte); }
.onglets a.actif { background: none; color: var(--texte); font-weight: 700; border-bottom-color: var(--accent); }

/* ---------- Filtres et tableaux ---------- */

.filtre label, .filtre-case label { color: var(--doux); font-weight: 500; font-size: 13px; }
.filtre select, .filtre input { border: 1px solid var(--trait); border-radius: 6px; padding: 8px 10px; background: #fff; color: var(--texte); }

.tableau-conteneur { background: #fff; border: 0; border-radius: 10px; box-shadow: var(--ombre); padding: 0; overflow-x: auto; margin-bottom: 12px; }
.panneau .tableau-conteneur, .carte .tableau-conteneur { box-shadow: none; border: 1px solid #edf1f7; }
.tableau { font-size: 14px; }
.tableau th { background: var(--info-fond); color: var(--texte); font: 600 13px var(--sans); text-transform: none; letter-spacing: 0; padding: 10px 14px; border-bottom: 1px solid var(--trait); }
.tableau td { padding: 10px 14px; border-bottom: 1px solid #edf1f7; }
.tableau tbody tr:last-child td { border-bottom: 0; }
.tableau tbody tr:hover { background: #f6f9fd; }
.colonne-montant { color: var(--texte); font-weight: 600; }
.tableau a { color: var(--barre); font-weight: 500; text-decoration: none; }
.tableau a:hover { text-decoration: underline; }

/* ---------- Pastilles de statut : fond teinté, jamais de bande ---------- */

.badge { padding: 1px 9px; border-radius: 10px; font-size: 12.5px; font-weight: 500; border: 0 !important; }
.badge-brouillon, .badge-qualification, .badge-soumis, .badge-envoye, .badge-envoyee, .badge-nouveau { background: var(--accent-teinte) !important; color: var(--accent-texte) !important; }
.badge-validee, .badge-payee, .badge-paye, .badge-actif, .badge-accepte, .badge-acceptee, .badge-gagne, .badge-signe, .badge-approuve, .badge-comptabilise, .badge-solde, .badge-emise { background: var(--ok-fond) !important; color: var(--ok) !important; }
.badge-rejetee, .badge-refuse, .badge-refusee, .badge-perdu, .badge-annulee, .badge-annule, .badge-resilie { background: #fbe3e1 !important; color: var(--danger) !important; }
.badge-expire, .badge-expiree, .badge-archive, .badge-termine, .badge-remplacee, .badge-role { background: var(--info-fond) !important; color: var(--texte) !important; }

/* ---------- Formulaires en cartes ---------- */

.champ label { font-size: 14px; color: var(--texte); font-weight: 500; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="date"], input[type="search"], input[type="tel"], select, textarea {
    font-family: var(--sans);
    border: 1px solid var(--trait);
    border-radius: 6px;
    background: #fff;
    color: var(--texte);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--onglets); border-color: var(--barre); }
.aide-champ, .texte-aide { color: var(--doux); font-size: 12.5px; }
.pied-formulaire { border-top: 1px solid #edf1f7; margin-top: 14px; padding-top: 14px; }
.definition dt, .liste-definition dt { color: var(--doux); font-size: 13px; }
.definition dd, .liste-definition dd { font-weight: 500; }

/* ---------- Alertes ---------- */

.alerte { border-radius: 6px; border: 0; }
.alerte-info { background: var(--info-fond); color: var(--texte); }
.alerte-succes { background: var(--ok-fond); color: var(--ok); }
.alerte-avertissement { background: var(--accent-teinte); color: var(--accent-texte); }
.alerte-erreur { background: #fbe3e1; color: var(--danger); }

/* ---------- Pages invité ---------- */

.invite { background: var(--fond); }
.carte-invite { border-radius: 12px; border: 0; box-shadow: 0 8px 28px rgba(30, 58, 95, 0.16); padding: 32px; max-width: 26rem; }
.carte-invite .marque { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 18px; font: 700 15px/1.15 var(--serif); color: var(--texte); }
.carte-invite .marque .marque-pastille { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 10px; background: var(--barre); color: #fff; font: 700 13px var(--serif); }
.carte-invite h1 { font-size: 24px; color: var(--texte); }
.carte-invite label { font-weight: 500; font-size: 14px; color: var(--texte); }
.carte-invite input[type="email"], .carte-invite input[type="password"], .carte-invite input[type="text"] { width: 100%; padding: 10px 12px; }
.carte-invite a { color: var(--barre); font-weight: 500; }

/* ---------- Écrans larges et mobile ---------- */

@media (max-width: 1180px) {
    .accueil-grille { grid-template-columns: minmax(0, 1fr); }
    .col-d { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; }
    .col-d .carte { margin: 0; }
}

@media (max-width: 900px) {
    .agencement { display: block; }
    .bouton-menu { display: block; }
    .barre-laterale { position: fixed; top: var(--hauteur-entete); left: 0; bottom: 0; width: 78%; max-width: 300px; height: auto; transform: translateX(-102%); transition: transform 0.2s; box-shadow: 4px 0 16px rgba(0, 0, 0, 0.25); }
    .barre-laterale.ouverte { transform: none; }
    .nom-bar, .recherche-entete, .chip-session, .utilisateur-texte { display: none; }
    .contenu { padding: 12px 14px 40px; }
    .hero { padding: 22px 20px; min-height: 160px; }
    .hero-txt { max-width: 100%; }
    .hero h1 { font-size: 24px; }
    .tuiles { grid-template-columns: repeat(2, 1fr); }
    .entete-page h1 { font-size: 24px; }
}

/* Neutralise le décalage historique d'app.css (rail fixe) : le rail est ici dans la grille. */
@media (min-width: 1024px) {
    .contenu { margin-left: 0; padding: 18px 20px 40px; }
    .barre-laterale { transform: none; }
    .bouton-menu { display: none; }
}
@media (max-width: 900px) {
    .bouton-menu { display: block; }
}

/* ==========================================================================
   Adaptation à tout écran (retour Michelot, 2026-10-31 : « espace vide »).
   Le contenu occupe toute la largeur disponible ; tailles, colonnes et
   rail suivent la largeur de l'écran, du téléphone au très grand écran.
   ========================================================================== */

:root { --largeur-barre: clamp(240px, 14vw, 320px); }
body { font-size: clamp(15px, 0.8rem + 0.2vw, 17px); }

.contenu,
.contenu > * { min-width: 0; }
.contenu { max-width: none; width: 100%; padding: clamp(14px, 1.6vw, 32px) clamp(14px, 2vw, 40px) 40px; }

.cartes { grid-template-columns: repeat(auto-fit, minmax(clamp(170px, 14vw, 250px), 1fr)); }
.accueil-grille { grid-template-columns: minmax(0, 1fr) clamp(320px, 25vw, 500px); gap: clamp(12px, 1.2vw, 24px); }
.tuiles { grid-template-columns: repeat(auto-fill, minmax(clamp(140px, 10vw, 200px), 1fr)); }

.panneau-formulaire, .panneau-secrets { max-width: min(100%, 84rem); }
.grille-champs { grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 0 1.25rem; }
.filtres { grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); align-items: end; }

.hero { min-height: clamp(170px, 14vw, 280px); padding: clamp(22px, 2.2vw, 48px); }
.hero h1 { font-size: clamp(24px, 2.2vw, 42px); }
.entete-page h1 { font-size: clamp(24px, 1.8vw, 38px); }
.montant { font-size: clamp(22px, 1.7vw, 32px); }

/* Très grands écrans : trois zones sur l'accueil */
@media (min-width: 2000px) {
    .accueil-grille { grid-template-columns: minmax(0, 1fr) clamp(380px, 22vw, 560px); }
    .tuiles { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
}

/* Tablette : une colonne, rail replié, cartes en deux colonnes */
@media (max-width: 1180px) {
    .accueil-grille { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
    .contenu { padding: 14px; }
    .cartes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .tableau-conteneur, .defil { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .entete { padding: 0 12px; gap: 10px; }
    .entete-droite { gap: 12px; }
    }
/* Téléphone */
@media (max-width: 560px) {
    .cartes { grid-template-columns: 1fr; }
    .tuiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .hero { min-height: 0; }
    .echeances li { flex-wrap: wrap; }
    .entete-page-actions { align-items: flex-start; }
    .entete-page-actions .bouton { align-self: flex-start; }
    .onglets a { padding: 10px 12px; }
}

/* Mobile : les textes réservés aux lecteurs d'écran (position absolue) dans un tableau défilant
   doivent être clippés par leur conteneur, sinon la page entière déborde. */
.tableau-conteneur, .defil { position: relative; }
html, body { max-width: 100%; overflow-x: clip; }

/* Tiroirs d'action (lot 4, 2026-10-31) : un formulaire court s'ouvre à droite de la page de détail. */
.empeche-defilement { overflow: hidden; }
.ao-tiroir-voile { position: fixed; inset: 0; background: rgba(15, 25, 45, 0.45); z-index: 60; display: none; }
.ao-tiroir-voile.est-ouvert { display: block; }
.ao-tiroir { position: fixed; top: 0; right: 0; bottom: 0; width: min(480px, 100%); background: #fff; z-index: 61; box-shadow: -8px 0 30px rgba(0, 0, 0, 0.28); transform: translateX(105%); transition: transform 0.22s; display: flex; flex-direction: column; visibility: hidden; }
.ao-tiroir.est-ouvert { transform: none; visibility: visible; }
.ao-tiroir header { padding: 18px 20px; border-bottom: 1px solid var(--trait); display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.ao-tiroir header h2 { margin: 0; font-family: var(--serif); font-weight: 700; font-size: 19px; color: var(--texte); }
.ao-tiroir .ao-tiroir-corps { padding: 14px 20px 20px; overflow: auto; flex: 1; }
.ao-tiroir .ao-tiroir-corps form { margin: 0; }
@media (prefers-reduced-motion: reduce) { .ao-tiroir { transition: none; } }
.ao-tiroir .ao-lien { background: none; border: 0; padding: 0; font: inherit; color: var(--section); text-decoration: underline; cursor: pointer; }
.bouton[aria-haspopup="dialog"] { width: auto; display: inline-flex; margin: 4px 0; }

/* Menu à groupes repliables (2026-11-01) : une ligne par espace, flèche à droite, entrées en retrait. */
.navigation-groupe-repliable { margin: 0; }
.navigation-groupe-repliable > summary {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 18px;
    color: var(--nuit-texte);
    font-size: 14.5px;
    font-weight: 600;
    cursor: pointer;
    list-style: none;
}
.navigation-groupe-repliable > summary::-webkit-details-marker { display: none; }
.navigation-groupe-repliable > summary:hover { background: rgba(255, 255, 255, 0.07); color: #fff; }
.navigation-groupe-repliable > summary:focus-visible { outline: 2px solid #fff; outline-offset: -2px; }
.navigation-groupe-repliable > summary svg { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.navigation-groupe-repliable > summary .navigation-chevron { margin-left: auto; width: 16px; height: 16px; transition: transform 0.15s ease; }
.navigation-groupe-repliable[open] > summary .navigation-chevron { transform: rotate(180deg); }
.navigation-groupe-repliable a { padding-left: 38px; }
.navigation-groupe-repliable[open] { padding-bottom: 4px; }
@media (prefers-reduced-motion: reduce) { .navigation-groupe-repliable > summary .navigation-chevron { transition: none; } }

/* Menu de gauche repliable (2026-11-20, demande de Michelot) : le bouton reste visible sur grand écran ; replié, le menu
   laisse toute la largeur au contenu. Sur petit écran, le volet d'avant ne change pas. */
@media (min-width: 901px) {
    .bouton-menu { display: block; margin-right: 4px; }
    body.menu-replie .agencement { grid-template-columns: minmax(0, 1fr); }
    body.menu-replie .barre-laterale { display: none; }
}
