:root {
    /* ---- Couleurs institutionnelles — CHARTE GRAPHIQUE L'Africaine des Assurances (§1.04).
       Replis ici ; base.html les surcharge depuis core/branding.py. ---- */
    --brand-rgb: 51, 176, 74;      /* vert  Pantone 361 C  = #33B04A */
    --gold-rgb: 237, 233, 71;      /* jaune Pantone 394 C  = #EDE947 */
    --brand: rgb(var(--brand-rgb));
    --gold: rgb(var(--gold-rgb));
    /* Police officielle : famille FUTURA (pile de substitution géométrique). */
    --police-charte: "Futura", "Futura PT", "Century Gothic", "Avenir Next", "Avenir",
                     "Trebuchet MS", system-ui, -apple-system, "Segoe UI", sans-serif;
    --bg: #f4f6f5;
    --panel: #ffffff;
    --text: #231F20;               /* noir Pantone Hexachrome Black C */
    --muted: #231F20;
    --border: #e2e7e4;
    --positive: #33B04A;
    --negative: #c0392b;
    --radius: 10px;
    --shadow: 0 1px 3px rgba(0, 0, 0, .07);
    --brand-ink: #231F20;          /* texte SUR le vert charte (5,8:1 ; le blanc : 2,8:1) */
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: var(--police-charte);
    color: var(--text);
    background: var(--bg);
    font-size: 14px;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

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

.sidebar {
    width: 230px;
    background: rgb(var(--brand-rgb));
    color: var(--brand-ink);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}
.brand { padding: 16px 16px; border-bottom: 1px solid rgba(35, 31, 32, .15); }
.brand-logo { background: #fff; border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; }
.brand-logo img { width: 100%; height: auto; display: block; }
.login-logo { width: 172px; margin: 4px auto 16px; }
.login-logo img { width: 100%; height: auto; display: block; }
.brand-name { font-size: 18px; font-weight: 700; }
.brand-tag { font-size: 12px; opacity: 1; margin-top: 2px; }
.sidebar nav { display: flex; flex-direction: column; padding: 12px 0; }
.sidebar nav a {
    color: var(--brand-ink);
    padding: 11px 18px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 11px;
}
.sidebar nav a svg { flex-shrink: 0; opacity: 1; width: 18px; height: 18px; }
.sidebar nav a span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar nav a:hover { background: rgba(255, 255, 255, .1); text-decoration: none; }
.sidebar nav a.actif {
    background: rgba(255, 255, 255, .16);
    border-left: 3px solid var(--gold);
    color: var(--brand-ink);
    font-weight: 700;
}

.content { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
    display: flex; justify-content: space-between; align-items: center;
    background: var(--panel); padding: 14px 26px; border-bottom: 1px solid var(--border);
    /* Barre du haut FIXE au scroll (titre + cloche + déconnexion toujours visibles). z-index sous
       le drawer mobile (50) et son overlay (40), au-dessus du contenu. */
    position: sticky; top: 0; z-index: 30; box-shadow: 0 1px 8px rgba(22, 28, 45, .05);
}
.topbar-title { font-size: 18px; font-weight: 600; }
.userbox { display: flex; align-items: center; gap: 12px; font-size: 13px; }
.user-name { font-weight: 600; }
.user-role { color: var(--muted); }
.logout { color: var(--negative); }

/* ---- Menu utilisateur (déroulant sous le nom) — remplace .userbox ---- */
.ucompte { position: relative; }
.ucompte .who { display: flex; align-items: center; gap: 9px; background: none;
    border: 1px solid transparent; padding: 5px 9px 5px 5px; border-radius: 999px;
    cursor: pointer; font-family: inherit; font-size: 13px; color: var(--text);
    transition: .15s; }
.ucompte .who:hover { background: #eef2f5; border-color: #dce3e9; }
.ucompte .who:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.ucompte .who .av { width: 28px; height: 28px; border-radius: 50%; background: var(--brand);
    color:#231F20; display: grid; place-items: center; font-weight: 800; font-size: 12px;
    flex-shrink: 0; }
.ucompte .who .un { display: flex; flex-direction: column; align-items: flex-start;
    line-height: 1.25; }
.ucompte .who .un-nom { font-weight: 600; }
.ucompte .who .un-role { color: var(--muted); font-size: 11px; }
.ucompte .who .chev { width: 14px; height: 14px; stroke: currentColor; stroke-width: 2.4;
    fill: none; opacity: .55; transition: transform .2s; }
.ucompte .who[aria-expanded="true"] .chev { transform: rotate(180deg); }
.umenu { position: absolute; top: calc(100% + 8px); right: 0; min-width: 238px;
    background: #fff; border: 1px solid #e3e8ec; border-radius: 12px;
    box-shadow: 0 4px 8px rgba(20,30,40,.06), 0 12px 32px rgba(20,30,40,.14);
    padding: 6px; z-index: 200; }
.umenu[hidden] { display: none; }
.umenu .uhead { padding: 10px 12px 11px; }
.umenu .unom { font-weight: 800; font-size: 14px; }
.umenu .urole { font-size: 11px; color: var(--muted); text-transform: uppercase;
    letter-spacing: .04em; margin-top: 3px; }
.umenu a { display: flex; align-items: center; gap: 10px; padding: 9px 12px;
    border-radius: 9px; font-size: 13.5px; color: var(--text); transition: .12s; }
.umenu a svg { width: 17px; height: 17px; stroke: currentColor; stroke-width: 1.9;
    fill: none; opacity: .75; }
.umenu a:hover { background: rgba(var(--brand-rgb), .09); }
.umenu a.udanger { color: var(--negative); }
.umenu a.udanger:hover { background: #fde2e0; }
.umenu .usep { height: 1px; background: #e6eaee; margin: 5px 8px; }
@media (max-width: 620px) { .ucompte .who .un { display: none; } }

.page { padding: 24px 26px; flex: 1; }
.footer { padding: 14px 26px; color: var(--muted); font-size: 12px; border-top: 1px solid var(--border); }

/* ---------- PANELS / KPI ---------- */
.panel {
    background: var(--panel); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 18px 20px; margin-bottom: 20px; box-shadow: var(--shadow);
}
.panel h3 { margin: 0 0 14px; font-size: 15px; color: var(--brand); }
.panel.center { text-align: center; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 22px; }
.kpi-card {
    background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 18px; box-shadow: var(--shadow);
}
.kpi-label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.kpi-value { font-size: 24px; font-weight: 700; margin-top: 6px; color: var(--brand); }
.kpi-action { display: flex; align-items: center; justify-content: center; }

/* ---------- TABLES ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th, .table td { padding: 9px 10px; text-align: left; border-bottom: 1px solid var(--border); }
.table th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; }
.table .right { text-align: right; }
/* Montants toujours sur UNE ligne (fini l'empilement « 7 292 400 FCFA » sur 3 lignes). */
.table td.right, .table th.right { white-space: nowrap; }
/* Utilitaire responsive : conteneur à défilement horizontal CONTENU (la page ne scrolle jamais en X). */
.tbl-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--border); border-radius: 8px; }
.tbl-scroll > table { margin: 0; }
.table .vide { color: var(--muted); text-align: center; padding: 22px; }
.ligne-total td { font-weight: 700; border-top: 2px solid var(--border); }
.ligne-ttc td { font-weight: 700; font-size: 16px; color: var(--brand); border-top: 2px solid var(--brand); }
.table-mensuel .bar-col { width: 42%; }
.bar-track { background: rgba(var(--brand-rgb), .10); border-radius: 6px; height: 12px; width: 100%; }
.bar-fill { background: rgb(var(--brand-rgb)); border-radius: 6px; height: 12px; min-width: 2px; transition: width .3s; }

/* ---------- FORMS ---------- */
label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 4px; }
input, select, textarea {
    width: 100%; padding: 8px 10px; font-size: 14px; font-family: inherit;
    border: 1px solid var(--border); border-radius: 7px; background: #fff; margin-top: 3px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(var(--brand-rgb), .35); border-color: var(--brand); }
input:disabled { background: #f1f3f2; color: var(--muted); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-2 .col-2 { grid-column: 1 / -1; }
fieldset.garanties { border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; margin-top: 14px; }
fieldset.garanties legend { font-size: 13px; color: var(--muted); padding: 0 6px; }
label.check { display: inline-flex; align-items: center; gap: 7px; font-weight: 400; margin: 5px 18px 5px 0; }
label.check input { width: auto; margin: 0; }

/* ---------- BUTTONS ---------- */
.btn {
    display: inline-block; padding: 9px 16px; font-size: 14px; font-weight: 600;
    border: none; border-radius: 7px; cursor: pointer; text-align: center;
}
.btn:hover { text-decoration: none; filter: brightness(1.06); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--brand); color:#231F20; }
.btn-secondaire { background: #fff; color: var(--brand); border: 1px solid var(--brand); }
.btn-petit { padding: 5px 10px; font-size: 12px; background: var(--gold); color: #3a2c00; }
.btn-block { width: 100%; }
.btn-wa { background: #42B657; color: #231F20; font-weight: 700; }
.btn-wa:hover { filter: brightness(1.06); }
.btn-accent { width: 100%; background: var(--gold); color: #3a2c00; font-weight: 700; }
.btn-accent:hover { filter: brightness(1.06); }

/* ---------- DEVIS LAYOUT ---------- */
.devis-layout { display: grid; grid-template-columns: 1fr 340px; gap: 20px; align-items: start; }
/* 🪤 LA COLLE VA SUR LA COLONNE, PAS SUR SON CONTENU (corrigé 19/08/2026).
   Elle était posée sur `.devis-recap .sticky`, c'est-à-dire sur le PANNEAU à
   l'intérieur de l'aside. Or `align-items: start` ci-dessus dimensionne l'aside à
   la hauteur de son contenu : le panneau n'avait donc aucune course dans son bloc
   conteneur et défilait hors de l'écran comme n'importe quel bloc. Mesuré avant
   correction, à 1280 px : `top = -864` après défilement — le récapitulatif marqué
   « sticky » ne l'a jamais été, sur AUCUNE largeur.
   L'aside, lui, occupe toute la hauteur de la ligne de grille : c'est LUI qui a de
   la course. */
.devis-recap { position: sticky; top: 20px; align-self: start; }
.devis-recap .sticky { position: static; }
.tarif-detail { font-size: 13.5px; }
.t-ligne { display: flex; justify-content: space-between; padding: 5px 0; border-bottom: 1px dashed var(--border); }
.t-ligne.total { font-weight: 700; border-bottom: 2px solid var(--border); }
.tarif-ttc {
    display: flex; justify-content: space-between; align-items: center;
    margin-top: 12px; padding-top: 12px; border-top: 2px solid var(--brand);
}
.tarif-ttc strong { font-size: 22px; color: var(--brand); }
.actions { display: flex; gap: 10px; margin-top: 14px; }
.hint { color: var(--muted); font-size: 12px; margin-top: 10px; }
.avert { color: #9a6b00; font-size: 12px; margin-top: 8px; }
/* Argent décaissé SANS écriture comptable : anomalie rare, mais qui doit se voir de loin.
   Le bloc est `hidden` tant que les deux registres concordent — un cadre rouge permanent
   deviendrait du décor qu'on ne lit plus. */
/* style sobre */ .alerte-ecart { border: 1px solid #c0392b;
  background: #fdf3f2; border-radius: 6px; padding: 12px 14px; margin: 12px 0; }
.alerte-ecart > b { color: #96271b; }
.alerte-ecart .hint { margin: 4px 0 10px; }
.alerte-ecart code { font-size: 11px; }
/* Ligne de recette : visible, mais visiblement pas de l'argent réel. */
.alerte-ecart tr.essai { opacity: .62; }
.etiq-essai { display: inline-block; font-size: 10px; letter-spacing: .04em;
  text-transform: uppercase; color: #231F20; background: #ececec;
  border-radius: 3px; padding: 1px 5px; margin-left: 4px; }
.erreur { color: var(--negative); }
/* Étiquette de source du tarif : officiel (exact) vs estimation locale (hors-ligne). */
.tarif-src { font-size: 12px; font-weight: 600; margin-top: 8px; padding: 4px 8px; border-radius: 6px; }
.tarif-src.ok { color: #33B04A; background: rgba(51,176,74,0.12); }
.tarif-src.est { color: #9a6b00; background: rgba(237,233,63,0.18); }

/* ---------- OCR CARTE GRISE ---------- */
.ocr-panel { border: 1px solid rgb(var(--gold-rgb)); background: rgba(var(--gold-rgb), .06); }
.ocr-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 8px; }
.ocr-row input[type="file"] { width: auto; flex: 1; min-width: 220px; }
.ocr-status { font-size: 13px; color: var(--muted); }
.champ-ocr { background: rgba(var(--gold-rgb), .22) !important; transition: background 1.5s ease; }
/* Champ rendu obligatoire dynamiquement (ex. date MEC exigée par une garantie tous risques). */
.champ-requis { outline: 2px solid var(--negative, #c0392b); outline-offset: 1px; }

/* ---------- TARIF OFFICIEL ---------- */
.police-badge { display: inline-block; background: var(--brand); color:#231F20; font-size: 11px;
    font-weight: 700; padding: 2px 8px; border-radius: 12px; margin-bottom: 6px;
    white-space: nowrap; letter-spacing: .2px; }

/* ---------- FICHE / DL ---------- */
dl.fiche { display: grid; grid-template-columns: 150px 1fr; gap: 6px 12px; margin: 0 0 16px; font-size: 13.5px; }
dl.fiche dt { color: var(--muted); }
dl.fiche dd { margin: 0; font-weight: 500; }

/* ---------- BADGES / CHIPS ---------- */
.badge { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.badge-devis { background: #eef2f7; color: #231F20; }
.badge-souscrit, .badge-valide { background: rgba(51,176,74,.15); color: var(--positive); }
.badge-en_attente, .badge-attente, .badge-warn { background: rgba(212, 160, 23, .18); color: #9a6b00; }
.badge-resilie, .badge-expire { background: rgba(192, 57, 43, .12); color: var(--negative); }
.badge-ok { background: rgba(51,176,74,.15); color: var(--positive); }
.badge-erreur { background: rgba(192, 57, 43, .14); color: var(--negative); }
/* Badge neutre teinté marque (ex. « Avenant n° 12 ») */
.badge-info { background: rgba(var(--brand-rgb), .12); color: var(--brand); }
/* ---------- COUVERTURE (fiche police) ----------
   Une couleur = une conduite à tenir : vert on laisse, ambre on anticipe, rouge on agit
   (échu → renouveler), gris c'est terminé (résilié / annulé : plus rien à encaisser ni à
   attester). Jamais la couleur seule : pictogramme + libellé. Contrastes ≥ 5,4:1 (WCAG AA). */
.badge-couv { font-size: 12.5px; padding: 3px 10px; border: 1px solid transparent; white-space: nowrap; }
.badge-couv.couv-en_cours  { background: #E3F4E6; color: #1F7A35; border-color: #B5E3BE; }
.badge-couv.couv-proche    { background: #FFF3C4; color: #7A4D00; border-color: #F2D675; }
.badge-couv.couv-echue     { background: #FDECEA; color: #B42318; border-color: #F4B4AE; }
.badge-couv.couv-suspendue { background: #FFE9D5; color: #8A3A00; border-color: #F7C08F; }
.badge-couv.couv-resiliee  { background: #EAEEF3; color: #231F20; border-color: #C9D2DD; }
.badge-couv.couv-annulee   { background: #EDEDEF; color: #231F20; border-color: #CFCFD4; }
.badge-couv.couv-projet    { background: #E6EEFB; color: #1849A9; border-color: #B9CDF2; }
.badge-couv.couv-inconnue  { background: #F2F4F7; color: #231F20; }
.police-badge.couv-proche    { background: #8F5B00; }
.police-badge.couv-echue     { background: #B42318; }
.police-badge.couv-suspendue { background: #B54708; }
.police-badge.couv-resiliee  { background: #475467; }
.police-badge.couv-annulee   { background: #52525B; }
.couv-bandeau { display: flex; align-items: center; gap: 12px; margin: 4px 0 14px; padding: 12px 16px;
    border: 1px solid; border-radius: 6px; }
.couv-bandeau-icone { font-size: 0; line-height: 1; flex-shrink: 0; }   /* style sobre : pastille, pas de pictogramme */
.couv-bandeau-icone::before { content: ''; display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: currentColor; }
.badge-couv > span[aria-hidden="true"] { font-size: 0; display: inline-block; vertical-align: 1px; margin-right: 1px; }
.badge-couv > span[aria-hidden="true"]::before { content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.couv-bandeau-texte { flex: 1; min-width: 0; font-size: 13.5px; line-height: 1.45; }
.couv-bandeau-texte b { display: block; font-size: 14.5px; }
.couv-bandeau-cta { flex-shrink: 0; color: #fff !important; border: 0; }
.couv-bandeau.couv-proche    { background: #FFFAEB; border-color: #F2D675; color: #7A4D00; }
.couv-bandeau.couv-echue     { background: #FEF3F2; border-color: #F4B4AE; color: #7A1A12; }
.couv-bandeau.couv-suspendue { background: #FFF6ED; border-color: #F7C08F; color: #7A2E00; }
.couv-bandeau.couv-resiliee  { background: #F2F4F7; border-color: #D0D5DD; color: #231F20; }
.couv-bandeau.couv-annulee   { background: #F4F4F5; border-color: #D4D4D8; color: #231F20; }
.couv-bandeau.couv-echue .couv-bandeau-cta  { background: #B42318; }
.couv-bandeau.couv-proche .couv-bandeau-cta { background: #8F5B00; }
.kpi-couv { }   /* style sobre : l'état se lit dans le texte coloré */
.kpi-couv-etat { display: inline-block; margin-top: 4px; font-size: 12px; font-weight: 700; }
.kpi-couv.couv-proche    { border-left-color: #B7791F; } .kpi-couv.couv-proche .kpi-couv-etat    { color: #7A4D00; }
.kpi-couv.couv-echue     { border-left-color: #B42318; } .kpi-couv.couv-echue .kpi-couv-etat     { color: #B42318; }
.kpi-couv.couv-echue .kpi-value { color: #B42318; }
.kpi-couv.couv-suspendue { border-left-color: #B54708; } .kpi-couv.couv-suspendue .kpi-couv-etat { color: #8A3A00; }
.kpi-couv.couv-resiliee  { border-left-color: #475467; } .kpi-couv.couv-resiliee .kpi-couv-etat  { color: #231F20; }
.kpi-couv.couv-annulee   { border-left-color: #52525B; } .kpi-couv.couv-annulee .kpi-couv-etat   { color: #231F20; }
.kpi-couv.couv-resiliee .kpi-value, .kpi-couv.couv-annulee .kpi-value { color: #231F20; }
@media (max-width: 560px) {
    .couv-bandeau { flex-wrap: wrap; }
    .couv-bandeau-cta { width: 100%; text-align: center; }
}
/* ---------- TROUVER UNE POLICE (recherche dans tout le système de gestion) ---------- */
.couv-non-attestable { background: #F2F4F7; border: 1px solid #D0D5DD; color: #231F20; }
.rp { max-width: 760px; margin: 4px 0 14px; }
.rp-plus { margin-top: 6px; background: none; border: 0; padding: 4px 0; color: var(--brand); font-weight: 600; cursor: pointer; }
.rp-label { display: block; font-size: 14px; font-weight: 700; color: var(--brand); margin-bottom: 6px; }
.rp-champ { position: relative; }
.rp-champ svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.rp-champ input { width: 100%; padding: 12px 14px 12px 40px; font-size: 15px; border: 1px solid #d8dbe0;
    border-radius: 10px; background: #fff; }
.rp-champ input:focus { outline: none; border-color: rgb(var(--brand-rgb)); box-shadow: 0 0 0 3px rgba(var(--brand-rgb), .18); }
.rp-aide { margin: -6px 0 8px; font-size: 12px; color: var(--muted); }
.rp-etat { margin: 6px 0 0; font-size: 12.5px; color: var(--muted); min-height: 1em; }
.rp-etat:empty { display: none; }
.rp-res { list-style: none; margin: 8px 0 0; padding: 0; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.rp-res li + li { border-top: 1px solid var(--border); }
.rp-item { display: flex; align-items: center; gap: 12px; padding: 10px 14px; color: var(--text); text-decoration: none; }
.rp-item:hover, .rp-item:focus-visible { background: rgba(var(--brand-rgb), .07); outline: none; }
.rp-item:focus-visible { box-shadow: inset 3px 0 0 rgb(var(--brand-rgb)); }
.rp-item .police-badge { margin-bottom: 0; flex-shrink: 0; }
.rp-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.rp-info b { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rp-meta { font-size: 12px; color: var(--muted); }
.rp-item .badge-couv { flex-shrink: 0; }
@media (max-width: 560px) {
    .rp-item { flex-wrap: wrap; gap: 6px 10px; }
    .rp-info { flex-basis: 100%; order: 3; }
}
.info { display: inline-block; font-size: 11px; color: #231F20; cursor: help; vertical-align: middle; }
.filtres { margin-bottom: 14px; display: flex; gap: 8px; }
.chip { padding: 5px 12px; border-radius: 18px; background: #eef2f0; font-size: 13px; }
.chip.actif { background: var(--brand); color:#231F20; }

/* ---------- ALERTS ---------- */
.alert { padding: 11px 14px; border-radius: 8px; margin-bottom: 14px; font-size: 13.5px; }
.alert-info { background: rgba(var(--gold-rgb), .14); color: #7a5800; }
.alert-ok { background: rgba(51,176,74,.12); color: var(--positive); }
.alert-erreur { background: rgba(192, 57, 43, .1); color: var(--negative); }
/* Pièces remises au client juste après son paiement. Elles doivent se voir et se
   toucher du pouce : c'est le seul moment où il a le contrat sous les yeux. */
.docs-client { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; }
.docs-client > b { flex-basis: 100%; font-size: 12.5px; }
.docs-client .hint { flex-basis: 100%; font-size: 12px; margin-top: 2px; }
.btn-doc { display: inline-flex; align-items: center; gap: 6px; padding: 9px 13px;
  min-height: 40px; border: 1px solid var(--positive); border-radius: 8px;
  background: #fff; color: var(--positive); font-weight: 600; font-size: 13px;
  text-decoration: none; }
.btn-doc:hover, .btn-doc:focus-visible { background: rgba(51,176,74,.1); }

/* ---------- CONTRAT ---------- */
.contrat-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; }
.contrat-actions { display: flex; gap: 10px; flex-shrink: 0; }
.bareme-edit { font-family: "Cascadia Code", "Consolas", monospace; font-size: 12.5px; }

/* ---------- LOGIN ---------- */
.login-body {
    display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 24px;
    background:
        rgb(var(--brand-rgb));
}
.login-card {
    position: relative; background: #fff; padding: 40px 34px 26px; border-radius: 18px;
    width: 384px; max-width: 92vw; text-align: center; overflow: hidden;
    box-shadow: 0 24px 60px rgba(0, 0, 0, .28);
}
.login-card::before {
    content: ""; position: absolute; top: 0; left: 0; right: 0; height: 5px;
    background: rgb(var(--brand-rgb));
}
.login-brand { font-size: 27px; font-weight: 800; color: var(--brand); letter-spacing: -.3px; line-height: 1.1; }
.login-company { font-size: 13.5px; font-weight: 600; color: #231F20; margin-top: 5px; }
.login-tag { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.login-sep { display: flex; align-items: center; gap: 12px; margin: 24px 0 16px; }
.login-sep::before, .login-sep::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.login-sep span { font-size: 11px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; color: var(--muted); }
.login-form { text-align: left; }
.login-card .field { margin-top: 14px; }
.login-card .field > span { display: block; font-size: 11px; font-weight: 700; letter-spacing: .5px;
    text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.login-card .field input { padding: 12px 14px; border-radius: 10px; }
.login-card .btn { width: 100%; margin-top: 22px; padding: 13px; font-size: 15px; border-radius: 10px; }
.login-foot { margin-top: 22px; font-size: 11.5px; color: var(--muted); }

/* ---------- DASHBOARD (production / CA / évolution) ---------- */
.dash-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.dash-bureau { font-size: 18px; font-weight: 700; color: var(--brand); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
/* Barre d'actions (boutons alignés, responsive → pleine largeur sous 560px via .actions .btn) */
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-start; }
/* Ligne de tags (statut/avenant) sous le titre */
.tags-row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin: 6px 0 2px; }
.tags-row .badge, .tags-row .police-badge { margin-bottom: 0; }
.bureau-select select { min-width: 240px; }
.dash-section { font-size: 14px; color: var(--muted); margin: 14px 0 8px; font-weight: 600; }
.kpi-grid-4 { grid-template-columns: repeat(4, 1fr); }
.kpi-warn { color: var(--negative); }
.evo { font-size: 12.5px; font-weight: 700; }
.evo-up { color: var(--positive); }
.evo-down { color: var(--negative); }
.evo-n1 { display: block; font-size: 11.5px; color: var(--muted); margin-top: 2px; font-weight: 400; }
.periode-form { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin: 10px 0 14px; }
.periode-form label { margin: 0; font-size: 13px; }
.periode-form input[type="date"] { width: auto; }
.periode-res { margin-top: 6px; }

/* ---------- NAV MOBILE (burger + overlay) ---------- */
.burger { display: none; background: none; border: none; font-size: 24px; line-height: 1;
    color: var(--brand); cursor: pointer; margin-right: 6px; padding: 2px 6px; }
.sidebar-overlay { display: none; }

/* ---------- RESPONSIVE ---------- */
@media (max-width: 1100px) {
    .kpi-grid, .kpi-grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 980px) {
    .devis-layout, .two-col, .grid-2 { grid-template-columns: 1fr; }
    /* Une colonne unique : l'aside est le DERNIER bloc, il n'a plus de course.
       Le collant n'apporterait rien et gênerait ; la barre d'action
       (`barre_action.js`) prend le relais sur petit écran. */
    .devis-recap, .devis-recap .sticky { position: static; }
}
@media (max-width: 820px) {
    /* Sidebar hors-écran, ouverte via le burger */
    .burger { display: inline-block; }
    .sidebar {
        position: fixed; top: 0; left: 0; bottom: 0; width: 250px; z-index: 50;
        transform: translateX(-100%); transition: transform .25s ease; overflow-y: auto;
    }
    .app.nav-open .sidebar { transform: translateX(0); box-shadow: 4px 0 20px rgba(0,0,0,.3); }
    .app.nav-open .sidebar-overlay {
        display: block; position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,.4);
    }
    .content { width: 100%; }
    .page { padding: 16px 14px; }
    .topbar { padding: 12px 14px; }
    .topbar-title { font-size: 16px; }
    .kpi-value { font-size: 20px; }
    /* tables scrollables horizontalement */
    .panel { overflow-x: auto; }
    .contrat-head { flex-direction: column; }
    .contrat-actions { width: 100%; }
}
@media (max-width: 560px) {
    .kpi-grid, .kpi-grid-4 { grid-template-columns: 1fr; }
    .userbox .user-role { display: none; }
    .login-card { width: 92vw; }
    .actions { flex-direction: column; }
    .actions .btn { width: 100%; }
}

/* Descriptif vulgarisé du pack d'assistance choisi (aide à la décision du client). */
.assist-detail { margin-top: .4rem; }
.assist-detail .assist-pack {
    background: rgba(var(--brand-rgb), 0.06);
    border: 1px solid rgba(var(--brand-rgb), 0.35);
    border-radius: 6px; padding: .55rem .75rem; font-size: .88em;
}
.assist-detail .assist-fait { margin: 0 0 .35rem; font-weight: 600; }
.assist-detail .assist-age { color: #b06a00; font-weight: 600; }
.assist-detail ul { margin: 0; padding-left: 1.1rem; }
.assist-detail li { margin: .12rem 0; }

/* ===== Fluidité : transitions douces, spinners, états de chargement ===== */
/* Respecte les préférences d'accessibilité (pas d'animation si l'utilisateur l'a désactivée). */
@media (prefers-reduced-motion: no-preference) {
    .btn, .panel, .badge, .t-input, select, input, .check, a { transition:
        background-color .15s ease, color .15s ease, border-color .15s ease,
        box-shadow .15s ease, opacity .15s ease, transform .08s ease; }
    .btn:active { transform: translateY(1px); }
    .panel { transition: box-shadow .2s ease; }
    .assist-detail .assist-pack { animation: fade-in .2s ease; }
}
@keyframes fade-in { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: none; } }
@keyframes spin { to { transform: rotate(360deg); } }

/* Spinner réutilisable. */
.spinner {
    display: inline-block; width: 1em; height: 1em; vertical-align: -0.15em;
    border: 2px solid rgba(var(--brand-rgb), 0.25);
    border-top-color: rgb(var(--brand-rgb));
    border-radius: 50%; animation: spin .7s linear infinite;
}

/* Bouton occupé : texte estompé + spinner, clics bloqués. */
.btn.is-loading { position: relative; color: transparent !important; pointer-events: none; opacity: .85; }
.btn.is-loading::after {
    content: ""; position: absolute; top: 50%; left: 50%; width: 1.05em; height: 1.05em;
    margin: -0.52em 0 0 -0.52em; border: 2px solid rgba(255,255,255,0.5);
    border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite;
}
.btn-secondaire.is-loading::after, .btn.btn-petit.is-loading::after {
    border-color: rgba(var(--brand-rgb),0.35); border-top-color: rgb(var(--brand-rgb));
}

/* ===== Loader de MARQUE (logo de la compagnie + anneau) — white-label ===== */
/* Logo au centre (pulse doux, ne tourne pas → reste lisible) + anneau qui tourne autour. */
.brand-loader { position: relative; display: inline-flex; align-items: center; justify-content: center;
    width: 84px; height: 84px; }
.brand-loader::before { content: ""; position: absolute; inset: 0; border-radius: 50%;
    border: 3px solid rgba(var(--brand-rgb), .15); border-top-color: rgb(var(--brand-rgb));
    animation: spin .85s linear infinite; }
.brand-loader img { width: 46px; height: 46px; object-fit: contain; animation: bl-pulse 1.3s ease-in-out infinite; }
@keyframes bl-pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .55; transform: scale(.9); } }
/* Overlay plein écran pendant la navigation (apparaît après un court délai → pas de flash sur charge rapide). */
.page-loader { position: fixed; inset: 0; z-index: 9999; display: none; align-items: center; justify-content: center;
    background: rgba(255, 255, 255, .72); }
@supports (backdrop-filter: blur(2px)) { .page-loader { backdrop-filter: blur(2px); } }
.page-loader.on { display: flex; }
@media (prefers-reduced-motion: reduce) { .brand-loader::before, .brand-loader img { animation: none; } }

/* Cotation en cours de recalcul : léger estompage anti-clignotement. */
#tarif-detail.calcul, .devis-recap .calcul { opacity: .45; transition: opacity .15s ease; }
.ttc.calcul, #ttc.calcul { opacity: .5; }

/* Surbrillance d'un champ pré-rempli par l'OCR (transition douce). */
.champ-ocr { background: rgba(var(--gold-rgb), 0.25); transition: background-color 1.5s ease; }

/* ===================================================================
   CIBLES TACTILES — MOBILE UNIQUEMENT                    (22/07/2026)
   -------------------------------------------------------------------
   Mesuré en 375 px sur les pages réellement servies : les commandes de
   navigation faisaient 27 à 41 px de haut, et le bouton ☰ lui-même
   28 px. Autrement dit, l'élément qu'il faut viser en premier au doigt
   était le plus petit de l'écran. On porte les COMMANDES à 44 px, seuil
   d'accessibilité usuel.

   Bloc ADDITIF et borné à `max-width` : l'affichage sur poste de travail
   n'est pas touché. Le point de rupture 820 px est celui qui fait déjà
   passer la barre latérale en tiroir dans cette feuille — on reste
   aligné dessus plutôt que d'en introduire un nouveau.

   `min-height` seul ne suffit pas sur un élément `inline` (il n'a pas
   de hauteur propre) : d'où le passage en `inline-flex` pour les
   boutons concernés.
   =================================================================== */
@media (max-width: 820px) {

    /* Entrées et en-têtes de la navigation (déjà en flex : min-height suffit). */
    .sidebar nav a,
    .sidebar .nav-parent { min-height: 44px; }

    /* Boutons et pastilles cliquables. */
    .btn,
    .btn-export,
    .chip,
    .pager-btn,
    .who {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
    }

    /* Listes déroulantes : ce sont aussi des commandes qu'on ouvre au doigt.
       Pas de `display` imposé ici — le rendu natif d'un `select` en dépend. */
    select,
    input[type="date"],
    input[type="search"],
    input[type="text"] { min-height: 44px; }

    /* Boutons-icônes : sans largeur minimale, la zone reste une bande
       étroite malgré les 44 px de hauteur — donc toujours difficile à viser. */
    .burger,
    .notif-btn,
    .notif-bell {
        min-height: 44px;
        min-width: 44px;
        display: inline-grid;
        place-items: center;
    }
}

/* ---------- REMISE COMMERCIALE (écran de cotation agent) ----------
   Le champ napparaît (phrase restée en plan, telle quelle) */
/* 🔴 CE COMMENTAIRE N'ÉTAIT JAMAIS REFERMÉ (55 ouverts / 54 fermés, en local ET en
   production) : tout ce qu'on ajoutait ensuite à la feuille était AVALÉ par lui, donc
   silencieusement sans effet. Refermé le 23/09/2026. La phrase coupée est conservée telle
   quelle : je ne sais pas ce qu'elle devait dire, et l'inventer serait pire. */

/* ═══ RESPONSIVE TÉLÉPHONE — complément du 23/09/2026 (mesuré 375 → 1280 px) ═══
   Constat sur un vrai téléphone : la rangée de périodes était COUPÉE à droite, atteignable
   seulement en faisant défiler le panneau, ce que rien n'indiquait. Et les liens DANS LES
   TABLEAUX (numéro de police, « Ouvrir », « CP », « Reçu », « État ») font 16 px de haut :
   impossibles à viser au pouce.
   🔑 En FIN de feuille : à spécificité égale, c'est la DERNIÈRE règle qui gagne. */
@media (max-width: 820px) {

    /* Les périodes passent à la ligne au lieu d'être tronquées : tout est visible d'un coup. */
    .filtres { flex-wrap: wrap; row-gap: 8px; }

    /* Liens de tableau : la zone atteinte passe à 40 px de haut, la typographie ne change pas.
       Pas de marge négative ici — plusieurs liens cohabitent dans une même cellule
       (« CP », « Reçu », « État ») et leurs zones se chevaucheraient. */
    td a, th a { display: inline-flex; align-items: center; min-height: 40px; padding: 0 4px; }

    /* Fil d'Ariane : « Accueil » faisait 48 × 16. */
    .fil-ariane a { display: inline-flex; align-items: center; min-height: 40px; }

    /* Pagination : la hauteur était bonne (44), la LARGEUR non (34) — une bande étroite
       reste difficile à viser, surtout pour « ‹ » et « › » côte à côte. */
    .pager-btn { min-width: 44px; justify-content: center; }
}

/* Fiche contrat : DEUX états côte à côte — la couverture ORASS (qui fait foi) et le statut
   de la plateforme (où en est le dossier chez nous). Ils ne disent pas la même chose. */
.hero-statuts { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

/* Charte 2ACI : indications de champ à l'encre, en italique (jamais grises). */
::placeholder{color:var(--charte-texte,#231F20);opacity:1;font-style:italic}
