/**
 * ══════════════════════════════════════════════════════════════════════════
 *  CRM WATT ENERGY — Feuille de style commune
 * ══════════════════════════════════════════════════════════════════════════
 *
 *  Le bandeau de la fiche dossier — vert profond, halos turquoise et bleu,
 *  filets clairs, boutons en verre — donne son identité à l'application.
 *  Cette feuille en tire la langue visuelle de TOUTES les pages :
 *
 *    · un bandeau de titre (.we-hero) qui reprend le dégradé du bandeau
 *      dossier, en version resserrée, en tête de chaque écran ;
 *    · des surfaces claires en dessous — blanc, filets fins, ombres douces —
 *      pour que la couleur reste une signature et non un décor ;
 *    · une échelle unique de rayons, d'ombres, de couleurs et de libellés
 *      (les petites majuscules espacées du bandeau).
 *
 *  Règle de composition : UN seul bloc coloré par écran, le bandeau. Tout le
 *  reste est clair. C'est ce qui garde le CRM épuré malgré la couleur.
 */

@import url("icones.css");

:root {
    /* ── Vert de marque (le dégradé du bandeau dossier) ─────────────────── */
    --we-deep:      #06332C;   /* fond le plus sombre du bandeau            */
    --we-green:     #0A5349;   /* vert médian                              */
    --we-green-2:   #0B6A5C;   /* vert clair du dégradé                    */
    --we-accent:    #0a8b7c;   /* vert d'action (boutons, onglet actif)    */
    --we-accent-d:  #0c6f64;   /* le même, survolé                         */
    --we-mint:      #5FE9D5;   /* halo turquoise                           */
    --we-teal:      #39D0BF;   /* turquoise de marque (fonds, liens)       */

    /* ── Encres et filets ──────────────────────────────────────────────── */
    --we-ink:       #12211f;   /* texte principal                          */
    --we-ink-2:     #4d6663;   /* texte secondaire                         */
    --we-ink-3:     #8ea5a2;   /* libellés, mentions                       */
    --we-line:      #e6efed;   /* filet standard                           */
    --we-line-2:    #f0f6f5;   /* filet très clair (lignes de tableau)     */
    --we-wash:      #f4f9f8;   /* fond de cellule / d'en-tête de tableau   */

    /* ── Rayons ────────────────────────────────────────────────────────── */
    --r-xl: 18px;
    --r-lg: 14px;
    --r-md: 10px;
    --r-sm: 8px;

    /* ── Ombres : basses, larges, très diffuses (celles du bandeau) ────── */
    --sh-1:    0 1px 2px rgba(6,51,44,.05), 0 8px 24px -20px rgba(6,51,44,.55);
    --sh-2:    0 2px 6px rgba(6,51,44,.06), 0 18px 38px -28px rgba(6,51,44,.65);
    --sh-hero: 0 18px 40px -26px rgba(6,51,44,.9);

    /* ── Alias historiques : d'anciennes pages s'en servent encore ─────── */
    --primary-color:   #0a8b7c;
    --secondary-color: #5c7a76;
    --success-color:   #17845a;
    --danger-color:    #c8483f;
    --warning-color:   #c98a10;
    --info-color:      #1783c4;
    --light-bg:        #f4f9f8;
    --dark-text:       #12211f;
    --border-color:    #e6efed;
    --shadow:          var(--sh-1);
    --shadow-lg:       var(--sh-2);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    /* Fond très légèrement modulé : deux halos turquoise à 10 % d'opacité.
       Personne ne les remarque, mais sans eux le flou des boutons en verre
       n'a rien à filtrer et l'effet disparaît. */
    background:
        radial-gradient(70% 50% at 15% 0%, rgba(57,208,191,.13), transparent 60%),
        radial-gradient(60% 60% at 92% 8%, rgba(57,208,191,.09), transparent 62%),
        linear-gradient(180deg, #f6faf9, #eff4f4);
    background-attachment: fixed;
    color: var(--we-ink);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

.container {
    max-width: 100%;
    margin: 0;
    padding: 20px;
}

/* Un lien reste un lien : vert d'action, souligné au survol seulement. */
a { color: var(--we-accent); }

/* ══ En-tête de l'application ═════════════════════════════════════════════
   Une barre en verre posée sur le fond dégradé. La navigation ne garde que
   les entrées quotidiennes : Fournisseurs et Emails vivent dans
   Administration. */
.header {
    background: rgba(255,255,255,.84);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    backdrop-filter: blur(16px) saturate(180%);
    border-bottom: 1px solid var(--we-line);
    padding: 9px 0;
    margin-bottom: 18px;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    max-width: 100%;
    margin: 0;
    padding: 0 20px;
}

.logo h1 {
    font-size: 1.5em;
    color: var(--we-accent);
}

.main-nav {
    display: flex;
    gap: 3px;
}

.nav-link {
    padding: 8px 15px;
    text-decoration: none;
    color: #3c5754;
    border-radius: var(--r-md);
    transition: background .16s, color .16s;
    font-weight: 500;
    font-size: .95em;
    white-space: nowrap;
}

.nav-link:hover {
    background: #e4f5f2;
    color: #0a5c52;
}

/* Le turquoise de marque sous du texte blanc ne passe pas le contraste :
   l'onglet actif prend le vert profond du reste de l'application. */
.nav-link.active {
    background: var(--we-accent);
    color: #fff;
    box-shadow: 0 1px 0 rgba(255,255,255,.25) inset,
                0 7px 16px -10px rgba(10,139,124,.9);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 11px;
}

.entreprise {
    font-weight: 600;
    font-size: .93em;
    color: var(--we-ink);
}

/* Le rôle : une mention, pas une alerte — il était en rouge « danger ». */
.badge-role {
    background: #e4f5f2;
    color: #0a5c52;
    border-radius: 999px;
    padding: 3px 11px;
    font-size: .7em;
    font-weight: 700;
    letter-spacing: .06em;
    white-space: nowrap;
}

@supports not ((backdrop-filter: blur(2px)) or (-webkit-backdrop-filter: blur(2px))) {
    .header { background: #fff; }
}

/* ══ Bandeau de titre ═════════════════════════════════════════════════════
   Le bloc qui donne son identité à chaque écran : même dégradé, mêmes halos,
   mêmes boutons en verre que le bandeau de la fiche dossier, en version
   resserrée. Construit par includes/hero.php ; .page-header, présente sur une
   douzaine d'anciennes pages, en hérite telle quelle. */
.we-hero,
.page-header {
    position: relative;
    background:
        radial-gradient(58% 140% at 8% 0%, rgba(95,233,213,.30), transparent 60%),
        radial-gradient(52% 150% at 88% 100%, rgba(23,131,196,.28), transparent 62%),
        linear-gradient(128deg, var(--we-deep) 0%, var(--we-green) 52%, var(--we-green-2) 100%);
    color: #fff;
    border: none;
    border-radius: var(--r-xl);
    box-shadow: var(--sh-hero);
    padding: 18px 24px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 14px 24px;
}

/* Le bandeau porte lui-même le titre : les pages n'ont plus à styler leur h1. */
.we-hero h1,
.page-header h1 {
    font-size: 1.5em;
    font-weight: 700;
    line-height: 1.2;
    color: #fff;
    margin: 0;
    letter-spacing: -.01em;
}

/* Surtitre : la famille de l'écran (Administration, Fournisseurs…), en
   petites majuscules espacées — la typographie des libellés du bandeau. */
.we-hero-sur {
    display: block;
    font-size: .68em;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: rgba(255,255,255,.58);
    margin-bottom: 3px;
}

/* Sous-titre : une phrase d'explication, jamais un paragraphe. */
.we-hero-sous {
    font-size: .87em;
    color: rgba(255,255,255,.72);
    margin-top: 4px;
    max-width: 78ch;
}

.we-hero-texte { min-width: 0; }

.we-hero-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-left: auto;
}

/* Lien de retour : discret, au-dessus du titre, comme sur la fiche. */
.we-hero-retour {
    display: inline-block;
    color: rgba(255,255,255,.66);
    text-decoration: none;
    font-size: .82em;
    font-weight: 600;
    margin-bottom: 6px;
}
.we-hero-retour:hover { color: #fff; }

/* Chiffres clés : des colonnes séparées par un filet, pas des cartes — la
   rangée du bas du bandeau dossier. */
.we-hero-stats {
    flex: 1 1 100%;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    border-top: 1px solid rgba(255,255,255,.18);
    margin-top: 4px;
}

.we-hero-stat {
    padding: 12px 22px 2px;
    border-right: 1px solid rgba(255,255,255,.15);
}
.we-hero-stat:first-child { padding-left: 0; }
.we-hero-stat:last-child  { border-right: none; }

.we-hero-stat .lab {
    display: block;
    font-size: .68em;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: rgba(255,255,255,.55);
}

.we-hero-stat .val {
    display: block;
    font-size: 1.18em;
    font-weight: 700;
    color: #fff;
    font-variant-numeric: tabular-nums;
    margin-top: 1px;
}

/* Dans le bandeau, les boutons flottent sur la couleur : verre translucide. */
.we-hero .btn,
.page-header .btn {
    background: rgba(255,255,255,.15);
    color: #F0FFFC;
    border: none;
    border-radius: var(--r-md);
    -webkit-backdrop-filter: blur(14px) saturate(180%);
    backdrop-filter: blur(14px) saturate(180%);
    box-shadow: 0 0 0 1px rgba(255,255,255,.2) inset,
                0 1px 0 rgba(255,255,255,.4) inset;
}
.we-hero .btn:hover,
.page-header .btn:hover {
    background: rgba(255,255,255,.26);
    color: #fff;
}
/* Le bouton principal du bandeau reste plein : c'est l'action de l'écran. */
.we-hero .btn-primary,
.page-header .btn-primary {
    background: #fff;
    color: var(--we-green);
    box-shadow: 0 6px 18px -10px rgba(0,0,0,.6);
}
.we-hero .btn-primary:hover,
.page-header .btn-primary:hover { background: #eafff9; color: var(--we-deep); }

@supports not ((backdrop-filter: blur(2px)) or (-webkit-backdrop-filter: blur(2px))) {
    .we-hero .btn, .page-header .btn { background: rgba(255,255,255,.24); }
}

/* Un texte libre posé dans le bandeau reste lisible (anciennes pages qui y
   glissent un <span> ou un <p> avec leur propre couleur grise). */
.we-hero p, .page-header p,
.we-hero span:not([class]), .page-header span:not([class]) {
    color: rgba(255,255,255,.75) !important;
}

@media (max-width: 768px) {
    /* Sur un téléphone, le bandeau s'empile : titre, bascule, actions, puis
       les chiffres sur deux colonnes. Rien ne dépasse de l'écran. */
    .we-hero, .page-header {
        padding: 16px 16px;
        border-radius: var(--r-lg);
        flex-direction: column;
        align-items: stretch;
    }
    .we-hero h1, .page-header h1 { font-size: 1.25em; }
    .we-hero-actions { margin-left: 0; }
    .we-hero-actions .btn { flex: 1 1 auto; justify-content: center; }
    .we-hero-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .we-hero-stat {
        border-right: 1px solid rgba(255,255,255,.15);
        border-top: 1px solid rgba(255,255,255,.13);
        padding: 9px 12px 6px;
        min-width: 0;
    }
    .we-hero-stat:nth-child(2n) { border-right: none; }
    .we-hero-stat .val { font-size: 1.02em; overflow-wrap: anywhere; }
}


/* ══ Boutons ══════════════════════════════════════════════════════════════ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 9px 17px;
    border: none;
    border-radius: var(--r-md);
    cursor: pointer;
    text-decoration: none;
    font-size: .92em;
    font-weight: 600;
    font-family: inherit;
    line-height: 1.25;
    white-space: nowrap;
    transition: background .16s, box-shadow .16s, color .16s, transform .06s;
}

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

/* Action principale : le vert d'action, jamais le turquoise clair — en blanc
   sur #39D0BF le texte ne passe pas le contraste AA. */
.btn-primary {
    background: linear-gradient(135deg, var(--we-accent) 0%, #0d7a6d 100%);
    color: #fff;
    box-shadow: 0 1px 0 rgba(255,255,255,.22) inset,
                0 10px 22px -14px rgba(10,139,124,.95);
}
.btn-primary:hover { background: linear-gradient(135deg, #0b9887 0%, var(--we-accent-d) 100%); color: #fff; }

/* Action secondaire : contour, pas un aplat gris. */
.btn-secondary {
    background: #fff;
    color: var(--we-ink-2);
    box-shadow: 0 0 0 1px var(--we-line) inset, var(--sh-1);
}
.btn-secondary:hover { background: var(--we-wash); color: var(--we-ink); }

/* Bouton en verre pour les fonds clairs — l'équivalent du verre du bandeau. */
.btn-glass {
    background: rgba(255,255,255,.62);
    color: #3c5754;
    -webkit-backdrop-filter: blur(12px) saturate(180%);
    backdrop-filter: blur(12px) saturate(180%);
    box-shadow: 0 0 0 1px rgba(18,33,31,.09) inset,
                0 1px 0 rgba(255,255,255,.9) inset,
                0 4px 12px -8px rgba(18,33,31,.4);
}
.btn-glass:hover { background: rgba(255,255,255,.9); color: var(--we-ink); }

/* Confirmation, refus, prudence : des teintes tenues, jamais les rouges et
   jaunes saturés du bootstrap d'origine. */
.btn-success { background: #17845a; color: #fff; }
.btn-success:hover { background: #13704c; }

.btn-danger  { background: #fff; color: #b83a31; box-shadow: 0 0 0 1px #f2d3d0 inset, var(--sh-1); }
.btn-danger:hover  { background: #fdf1f0; color: #98302a; }

.btn-warning { background: #fff; color: #94640a; box-shadow: 0 0 0 1px #f2e2bd inset, var(--sh-1); }
.btn-warning:hover { background: #fdf7e9; color: #7a520a; }

.btn-info    { background: #fff; color: #10688f; box-shadow: 0 0 0 1px #cfe6f2 inset, var(--sh-1); }
.btn-info:hover { background: #f0f8fc; }

.btn-sm { padding: 6px 12px; font-size: .82em; border-radius: var(--r-sm); }
.btn-lg { padding: 12px 24px; font-size: 1em; }
.btn[disabled], .btn:disabled { opacity: .5; cursor: not-allowed; }

/* ══ Cartes ═══════════════════════════════════════════════════════════════
   Surface claire, filet fin, ombre basse et large : le contrepoint calme du
   bandeau. Aucune carte n'est colorée. */
.card {
    background: #fff;
    border: 1px solid var(--we-line);
    border-radius: var(--r-lg);
    box-shadow: var(--sh-1);
    padding: 20px 22px;
    margin-bottom: 18px;
}

/* L'en-tête de carte reprend les petites majuscules du bandeau. */
.card-header {
    font-size: .74em;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--we-ink-3);
    margin: -2px 0 14px;
    padding-bottom: 11px;
    border-bottom: 1px solid var(--we-line);
}

/* Un h1/h2 marqué .card-header garde une taille de titre : quelques pages
   s'en servent comme titre de page dans une carte. */
h1.card-header, h2.card-header {
    font-size: 1.15em;
    letter-spacing: 0;
    text-transform: none;
    color: var(--we-ink);
}

/* ══ Chiffres clés hors bandeau ═══════════════════════════════════════════ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 0;
    background: #fff;
    border: 1px solid var(--we-line);
    border-radius: var(--r-lg);
    box-shadow: var(--sh-1);
    overflow: hidden;
    margin-bottom: 18px;
}

.stat-card {
    background: transparent;
    padding: 15px 22px;
    border-radius: 0;
    box-shadow: none;
    border-right: 1px solid var(--we-line);
    text-align: left;
}
.stat-card:last-child { border-right: none; }

.stat-value {
    font-size: 1.5em;
    font-weight: 700;
    color: var(--we-green);
    font-variant-numeric: tabular-nums;
    margin-bottom: 1px;
    line-height: 1.2;
}

.stat-label {
    color: var(--we-ink-3);
    font-size: .7em;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
}

/* ══ Tableaux ═════════════════════════════════════════════════════════════ */
.table-container {
    background: #fff;
    border: 1px solid var(--we-line);
    border-radius: var(--r-lg);
    box-shadow: var(--sh-1);
    overflow: hidden;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

/* En-tête : un lavis très clair et des libellés en petites majuscules —
   la même typographie que les intitulés du bandeau. */
.table thead { background: var(--we-wash); }

.table th {
    padding: 11px 15px;
    text-align: left;
    font-weight: 700;
    font-size: .7em;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--we-ink-3);
    border-bottom: 1px solid var(--we-line);
    white-space: nowrap;
}

.table td {
    padding: 11px 15px;
    border-bottom: 1px solid var(--we-line-2);
    font-size: .86em;
    color: var(--we-ink);
    vertical-align: middle;
}

.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: var(--we-wash); }
.table tbody tr:last-child td { border-bottom: none; }

/* Un tableau posé nu dans la page (sans .table-container) reçoit quand même
   sa surface : plusieurs écrans anciens l'utilisent ainsi. */
.container > .table,
.main-content > .table {
    background: #fff;
    border: 1px solid var(--we-line);
    border-radius: var(--r-lg);
    box-shadow: var(--sh-1);
    overflow: hidden;
}

/* ══ Pastilles de statut ══════════════════════════════════════════════════ */
.badge {
    display: inline-block;
    padding: 4px 11px;
    border-radius: 999px;
    font-size: .76em;
    font-weight: 700;
    line-height: 1.5;
    white-space: nowrap;
    letter-spacing: .01em;
}

/* ── Le verre ──────────────────────────────────────────────────────────
   Les statuts portent une couleur libre, réglée en administration. Posée
   en aplat sous du texte blanc, elle était souvent illisible : le jaune,
   le vert clair et le cyan ne passent pas le contraste. La pastille prend
   donc la couleur corrigée (includes/pastille.php) et la rend en verre :
   dégradé vertical, arête claire en haut, ombre de la couleur en dessous.

   Les trois variables sont posées en ligne par pastille_style(), qui les
   calcule à partir de la couleur enregistrée. */
.pastille {
    --c:             rgba(108,117,125,.9);
    --c-haut:        rgba(123,132,139,.9);
    --c-ombre:       rgba(108,117,125,.45);
    --c-encre:       #fff;
    --c-reflet:      rgba(255,255,255,.46);
    --c-ombre-texte: 0 1px 1.5px rgba(0,0,0,.26);

    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 11px;
    border-radius: 8px;
    font-size: .68em;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    line-height: 1.5;
    white-space: nowrap;
    color: var(--c-encre);
    background: linear-gradient(180deg, var(--c-haut) 0%, var(--c) 100%);
    -webkit-backdrop-filter: blur(8px) saturate(1.6);
            backdrop-filter: blur(8px) saturate(1.6);
    box-shadow: inset 0 1px 0 var(--c-reflet),
                inset 0 0 0 1px rgba(255,255,255,.17),
                0 2px 6px -2px var(--c-ombre);
    text-shadow: var(--c-ombre-texte);
}

/* « — Définir » : il n'y a pas encore de statut. La pastille reste en creux,
   au même gabarit que ses voisines. */
.pastille-vide {
    background: var(--we-wash);
    color: var(--we-ink-3);
    text-shadow: none;
    box-shadow: inset 0 0 0 1px var(--we-line);
}
.pastille-vide:hover { background: #fff; color: var(--we-ink-2); }
.dossier-header-card .pastille-vide {
    background: rgba(255,255,255,.14);
    color: rgba(255,255,255,.8);
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.24);
}

/* ── Le choix d'une couleur de statut ──────────────────────────────────
   Chaque échantillon est la pastille elle-même, en réduction : la couleur
   choisie est celle qui s'affichera, sans correction au passage. */
.palette-couleur {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(34px, 1fr));
    gap: 6px;
}
.palette-couleur label { cursor: pointer; }
.palette-couleur input { position: absolute; opacity: 0; width: 0; height: 0; }

.echantillon {
    display: block;
    width: 100%; height: 24px;
    border-radius: 7px;
    background: linear-gradient(180deg, var(--c-haut) 0%, var(--c) 100%);
    box-shadow: inset 0 1px 0 var(--c-reflet),
                inset 0 0 0 1px rgba(255,255,255,.17),
                inset 0 0 0 1px rgba(18,33,31,.06),
                0 2px 6px -2px var(--c-ombre);
    transition: transform .12s, box-shadow .12s;
}
.palette-couleur label:hover .echantillon { transform: translateY(-1px); }

.palette-couleur input:checked + .echantillon {
    box-shadow: inset 0 1px 0 rgba(255,255,255,.5),
                0 0 0 2px #fff,
                0 0 0 4px var(--we-accent),
                0 4px 10px -3px var(--c-ombre);
}
.palette-couleur input:focus-visible + .echantillon { outline: 2px solid var(--we-accent); outline-offset: 4px; }

/* Le nuancier libre, en fin de palette : la couleur piochée est ramenée à une
   teinte lisible avant d'être retenue. */
.couleur-libre { position: relative; cursor: pointer; }
.couleur-libre input[type="color"] {
    position: absolute; inset: 0;
    width: 100%; height: 100%;
    opacity: 0;
    border: none; padding: 0;
    cursor: pointer;
}
.echantillon-libre {
    display: grid;
    place-items: center;
    background: #fff;
    color: var(--we-ink-3);
    box-shadow: inset 0 0 0 1px var(--we-line);
}
.couleur-libre:hover .echantillon-libre { color: var(--we-accent); box-shadow: inset 0 0 0 1px var(--we-accent); }

/* La couleur d'un statut créé avant la palette : gardée, et signalée. */
.echantillon-hors { border-bottom: 3px dotted rgba(255,255,255,.7); }

/* L'aperçu : la pastille exacte, sous la palette. */
.apercu-pastille {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 12px;
    padding: 11px 14px;
    background: var(--we-wash);
    border: 1px solid var(--we-line);
    border-radius: var(--r-md);
}
.apercu-pastille .lab {
    font-size: .68em;
    font-weight: 700;
    letter-spacing: .09em;
    text-transform: uppercase;
    color: var(--we-ink-3);
}

/* Une pastille sur laquelle on peut cliquer garde son curseur et s'éclaire. */
.pastille[onclick], .pastille.statut-badge-clickable,
.pastille.statut-cofrac-badge-clickable, .pastille.statut-paiement-badge-clickable {
    cursor: pointer;
    transition: box-shadow .14s, filter .14s;
}
.pastille[onclick]:hover, .pastille.statut-badge-clickable:hover,
.pastille.statut-cofrac-badge-clickable:hover, .pastille.statut-paiement-badge-clickable:hover {
    filter: brightness(1.04);
    box-shadow: inset 0 1px 0 var(--c-reflet),
                inset 0 0 0 1px rgba(255,255,255,.24),
                0 4px 10px -3px var(--c-ombre);
}

/* Le bandeau de la fiche éclaircissait les pastilles d'un cran pour les
   détacher du vert profond : le verre s'en charge désormais. */
.dossier-header-card .pastille { filter: none; box-shadow:
    inset 0 1px 0 var(--c-reflet),
    inset 0 0 0 1px rgba(255,255,255,.28),
    0 2px 8px -2px rgba(0,0,0,.45); }

.badge-success   { background: #e2f6ec; color: #0f6b45; }
.badge-danger    { background: #fdeceb; color: #a4322a; }
.badge-warning   { background: #fdf3dc; color: #86610c; }
.badge-info      { background: #e4f2fb; color: #10688f; }
.badge-secondary { background: #eef3f2; color: #4d6663; }

/* ══ Formulaires ══════════════════════════════════════════════════════════
   Les champs sans classe sont stylés aussi : une quinzaine d'écrans de
   réglage posent des <input> nus, qui gardaient l'apparence par défaut du
   navigateur au milieu d'une page dessinée. */
.form-group { margin-bottom: 15px; }

.form-group label,
.form-label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: .78em;
    letter-spacing: .04em;
    color: var(--we-ink-2);
}

.form-control,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="tel"],
input[type="url"],
input[type="search"],
input[type="date"],
input[type="datetime-local"],
input[type="time"],
select,
textarea {
    width: 100%;
    padding: 9px 13px;
    border: 1px solid var(--we-line);
    border-radius: var(--r-md);
    font-size: .95em;
    font-family: inherit;
    color: var(--we-ink);
    background: #fff;
    transition: border-color .14s, box-shadow .14s;
}

/* Un champ posé dans une grille de filtres ou à côté d'un bouton ne doit pas
   manger la ligne entière : les pages qui le veulent large ont .form-control. */
input[type="color"] {
    width: 46px; height: 34px; padding: 2px;
    border: 1px solid var(--we-line);
    border-radius: var(--r-sm);
    background: #fff;
    vertical-align: middle;
    cursor: pointer;
}

.form-control:focus,
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--we-teal);
    box-shadow: 0 0 0 3px rgba(57,208,191,.18);
}

select, select.form-control { cursor: pointer; }
textarea, textarea.form-control { resize: vertical; min-height: 100px; }

input::placeholder, textarea::placeholder { color: #a9bcb9; }

/* ── Formulaires en pleine largeur ─────────────────────────────────────
   Les écrans de saisie ne sont plus bridés à 600-900 px : les champs se
   répartissent en colonnes qui se replient d'elles-mêmes quand la place
   manque. Un champ long (textarea, liste de cases) prend la ligne entière
   avec .form-group-full. */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 0 24px;
    align-items: start;
}

.form-grid > .form-group-full { grid-column: 1 / -1; }

/* Un couple « nuancier + code hexadécimal », employé par les écrans de
   statuts pour choisir la couleur d'une pastille. */
.champ-couleur { display: flex; align-items: center; gap: 8px; }
.champ-couleur input[type="text"] {
    width: 120px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: .86em;
    background: var(--we-wash);
    color: var(--we-ink-2);
}

/* Texte d'aide sous un champ. */
/* Une précision glissée dans l'intitulé reste sur sa ligne. */
.form-group label small { display: inline; margin: 0 0 0 5px; }

.aide, .help-text, .form-group small {
    display: block;
    margin-top: 5px;
    font-size: .78em;
    font-weight: 400;
    color: var(--we-ink-3);
    letter-spacing: 0;
}

/* Un code technique (code de statut, référence) : monospace, sur un lavis. */
code {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: .88em;
    background: var(--we-wash);
    border: 1px solid var(--we-line);
    border-radius: 6px;
    padding: 1px 6px;
    color: var(--we-ink-2);
}

/* Un titre posé nu en tête de carte : plusieurs écrans écrivent <h2> sans
   classe là où d'autres écrivent .card-header. Les deux se ressemblent. */
.card > h2:first-child,
.card > h3:first-child {
    font-size: 1.05em;
    font-weight: 700;
    color: var(--we-ink);
    margin: -2px 0 14px;
    padding-bottom: 11px;
    border-bottom: 1px solid var(--we-line);
}

/* Écran vide (ancienne écriture .empty-state, voir aussi .we-vide). */
.empty-state {
    text-align: center;
    padding: 42px 20px;
    color: var(--we-ink-3);
}

/* Choix d'une icône : une rangée de pastilles, une seule cochée. */
.choix-icone { display: flex; flex-wrap: wrap; gap: 7px; }
.choix-icone label { cursor: pointer; }
.choix-icone input { position: absolute; opacity: 0; width: 0; height: 0; }
.pastille-icone {
    display: grid;
    place-items: center;
    width: 38px; height: 34px;
    border-radius: var(--r-sm);
    background: #fff;
    color: var(--we-ink-2);
    font-size: 1.05em;
    box-shadow: 0 0 0 1px var(--we-line) inset;
    transition: background .14s, color .14s, box-shadow .14s;
}
.pastille-icone .rien { font-size: .8em; color: var(--we-ink-3); }
.choix-icone label:hover .pastille-icone { background: var(--we-wash); color: var(--we-ink); }
.choix-icone input:checked + .pastille-icone {
    background: var(--we-accent);
    color: #fff;
    box-shadow: 0 1px 0 rgba(255,255,255,.22) inset,
                0 8px 18px -12px rgba(10,139,124,.9);
}
.choix-icone input:focus-visible + .pastille-icone { outline: 2px solid var(--we-accent); outline-offset: 2px; }

/* ══ Barre de filtres ═════════════════════════════════════════════════════ */
.filters-bar {
    background: #fff;
    border: 1px solid var(--we-line);
    padding: 16px 18px;
    border-radius: var(--r-lg);
    box-shadow: var(--sh-1);
    margin-bottom: 18px;
}

/* .filters : l'écriture employée par le suivi des paiements — même
   comportement que .filters-row, pour que ses champs se rangent en ligne. */
.filters-row,
.filters {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    align-items: flex-end;
}

.filters .filter-item { flex: 1; min-width: 190px; }
.filters .btn { flex: none; }

.filter-item { flex: 1; min-width: 200px; }

/* ══ Onglets ══════════════════════════════════════════════════════════════ */
.tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--we-line);
    margin-bottom: 20px;
}

.tab {
    padding: 11px 20px;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: .95em;
    font-weight: 600;
    font-family: inherit;
    color: var(--we-ink-3);
    border-bottom: 2px solid transparent;
    transition: color .16s, border-color .16s;
}

.tab:hover { color: var(--we-accent); }

.tab.active {
    color: var(--we-green);
    border-bottom-color: var(--we-accent);
}

.tab-content { display: none; }
.tab-content.active { display: block; }

/* ══ Fenêtres modales ═════════════════════════════════════════════════════ */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(6,51,44,.45);
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: #fff;
    border-radius: var(--r-xl);
    box-shadow: 0 40px 80px -30px rgba(6,51,44,.6);
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    padding: 18px 22px;
    border-bottom: 1px solid var(--we-line);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 700;
}

.modal-body   { padding: 20px 22px; }
.modal-footer {
    padding: 16px 22px;
    border-top: 1px solid var(--we-line);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.close {
    background: none;
    border: none;
    font-size: 1.4em;
    line-height: 1;
    cursor: pointer;
    color: var(--we-ink-3);
}
.close:hover { color: var(--we-ink); }

/* ══ Alertes ══════════════════════════════════════════════════════════════
   Un filet de couleur à gauche plutôt qu'un pavé teinté : l'information passe,
   la page reste calme. (Les alertes de succès partent en bulle, voir header.) */
.alert {
    padding: 13px 18px;
    border-radius: var(--r-md);
    margin-bottom: 18px;
    background: #fff;
    border: 1px solid var(--we-line);
    border-left: 3px solid var(--we-ink-3);
    box-shadow: var(--sh-1);
    font-size: .93em;
}

.alert-success { border-left-color: #17845a; color: #0f6b45; }
.alert-danger,
.alert-error   { border-left-color: #c8483f; color: #a4322a; }
.alert-warning { border-left-color: #c98a10; color: #86610c; }
.alert-info    { border-left-color: var(--we-teal); color: #0e6a7f; }

/* ══ Pagination ═══════════════════════════════════════════════════════════ */
.pagination {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-top: 22px;
}

.pagination a,
.pagination span {
    padding: 7px 13px;
    border: 1px solid var(--we-line);
    background: #fff;
    color: var(--we-ink-2);
    text-decoration: none;
    border-radius: var(--r-sm);
    font-size: .9em;
    font-weight: 600;
}

.pagination a:hover { background: var(--we-wash); color: var(--we-ink); }

.pagination .active {
    background: var(--we-accent);
    color: #fff;
    border-color: var(--we-accent);
}

/* ══ Divers ═══════════════════════════════════════════════════════════════ */
.actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* Intitulé de section : les petites majuscules du bandeau, en gris, pour
   découper une page sans y ajouter de cadre. */
.we-section {
    font-size: .72em;
    font-weight: 700;
    letter-spacing: .09em;
    text-transform: uppercase;
    color: var(--we-ink-3);
    margin: 26px 0 10px;
}

/* Message d'écran vide : un mot au centre, pas un pavé. */
.we-vide {
    text-align: center;
    padding: 42px 20px;
    color: var(--we-ink-3);
    font-size: .95em;
}

/* ══ Adaptation aux petits écrans ═════════════════════════════════════════ */
@media (max-width: 768px) {
    .container { padding: 12px; }
    .header-content { flex-direction: column; gap: 12px; }
    .main-nav { flex-direction: column; width: 100%; }
    .filters-row { flex-direction: column; }
    .filter-item { width: 100%; }
    .table-container { overflow-x: auto; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .stat-card { border-right: none; border-bottom: 1px solid var(--we-line); }
}

/* ══ Fiche dossier : ajustements hérités ══════════════════════════════════
   Le gros du style de la fiche vit dans dossier.php ; ces règles ne servent
   qu'à la resserrer sur les petits écrans. */
@media (max-width: 1024px) {
    .dossier-header-card { position: relative !important; padding: 15px !important; }
    .container { padding: 15px !important; }
}

@media (max-width: 768px) {
    .dossier-header-card {
        position: relative !important;
        padding: 12px !important;
        margin-bottom: 15px !important;
    }
    .dossier-header-card h1 { font-size: 1.3em !important; margin-bottom: 8px !important; }
    .dossier-header-card h1 + div { font-size: .85em !important; }
    .dossier-header-card .badge { padding: 6px 10px !important; font-size: .85em !important; }
    .dossier-header-card .btn-sm { padding: 6px 10px !important; font-size: .8em !important; margin-left: 5px !important; }
    .info-grid-detail { grid-template-columns: 1fr 1fr !important; gap: 10px !important; }
    .info-item-detail { padding: 10px !important; }
    .info-item-detail label { font-size: .75em !important; }
    .info-item-detail strong { font-size: .95em !important; }
}

@media (max-width: 480px) {
    .dossier-header-card { padding: 10px !important; }
    .dossier-header-card h1 { font-size: 1.1em !important; }
    .info-grid-detail { grid-template-columns: 1fr !important; }
    .dossier-title { flex-direction: column !important; align-items: flex-start !important; }
    .dossier-title > div { width: 100% !important; margin-top: 10px !important; }
}

/* ══ Barre latérale d'administration ══════════════════════════════════════
   Partagée par les vingt-deux écrans de réglage. Elle est posée hors du flux
   pour ne pas avoir à modifier la structure de chaque page : le contenu est
   simplement décalé, quelle que soit son enveloppe (.container ou main). */
.adm-nav-fixe {
    position: fixed;
    top: var(--admnav-top, 64px);
    left: 0;
    bottom: 0;
    width: 232px;
    overflow-y: auto;
    overscroll-behavior: contain;
    /* Le bas est dégagé : le bouton flottant « APF » est posé dans ce coin et
       recouvrait la dernière entrée de la barre, « Utilisateurs ». */
    padding: 10px 10px 84px;
    background: rgba(255,255,255,.82);
    -webkit-backdrop-filter: blur(14px) saturate(180%);
    backdrop-filter: blur(14px) saturate(180%);
    border-right: 1px solid var(--we-line);
    z-index: 30;
    scrollbar-width: thin;
}

.adm-nav .grp {
    font-size: .66em;
    font-weight: 800;
    letter-spacing: .09em;
    text-transform: uppercase;
    color: #9db3b0;
    padding: 11px 10px 5px;
}

.adm-nav a {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 6px 10px;
    border-radius: var(--r-sm);
    text-decoration: none;
    color: #3c5754;
    font-size: .9em;
    line-height: 1.35;
}

.adm-nav a:hover { background: #e4f5f2; color: #0a5c52; }
.adm-nav a.on    { background: var(--we-accent); color: #fff; }
.adm-nav a .ic   { width: 17px; text-align: center; opacity: .85; font-size: .95em; flex: none; }

.adm-nav a .n {
    margin-left: auto;
    font-size: .78em;
    background: #eef4f3;
    color: #4d6663;
    border-radius: 999px;
    padding: 1px 7px;
    font-variant-numeric: tabular-nums;
}
.adm-nav a.on .n { background: rgba(255,255,255,.25); color: #fff; }

/* Le contenu se décale : les pages enveloppent leur corps tantôt dans
   .container, tantôt dans main.main-content. */
body.a-nav > .container,
body.a-nav > main,
body.a-nav > form > .container {
    margin-left: 232px;
    max-width: none;
}

/* Le header reste au-dessus de la barre et occupe toute la largeur. */
.header { position: relative; z-index: 40; }

@media (max-width: 1000px) {
    .adm-nav-fixe {
        position: static;
        width: auto;
        border-right: none;
        border-bottom: 1px solid var(--we-line);
        max-height: 210px;
        /* Barre repliée en haut de page : le bouton flottant ne la couvre plus. */
        padding-bottom: 24px;
    }
    body.a-nav > .container,
    body.a-nav > main,
    body.a-nav > form > .container { margin-left: 0; }
}

@supports not ((backdrop-filter: blur(2px)) or (-webkit-backdrop-filter: blur(2px))) {
    .adm-nav-fixe { background: #fff; }
}
