/* Charte Optineris — Performance #275B73, Écoute #6A93A6, Humanité #9FD8CB,
   Agilité #F8B195, Confiance #A66A73, Bienveillance #DE786D */
:root {
  --performance: #275B73; --ecoute: #6A93A6; --humanite: #9FD8CB; --agilite: #F8B195;
  --confiance: #A66A73; --bienveillance: #DE786D;
  --texte: #1F2A30; --texte-doux: #5B6B73; --trait: #E5E5E5; --fond: #F5F7F8;
  --rouge: #B3412F; --rouge-fond: #FBEAE6; --orange: #B86A1D; --orange-fond: #FDF0E3;
  --bleu-fond: #E8F0F4;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: Calibri, Carlito, "Segoe UI", Arial, sans-serif; font-size: 15px;
       color: var(--texte); background: var(--fond); }
a { color: var(--performance); }
h1 { font-size: 26px; color: var(--performance); margin: 0 0 4px; padding-bottom: 6px;
     border-bottom: 2px solid var(--performance); display: inline-block; }
h2 { font-size: 19px; color: var(--performance); }
main { max-width: 1320px; margin: 0 auto; padding: 24px 24px 64px; }
.sous { color: var(--texte-doux); margin: 4px 0 0; }
.vide { color: var(--texte-doux); padding: 16px; }

.bandeau { background: var(--performance); color: #fff; display: flex; align-items: center;
           justify-content: space-between; padding: 0 24px; height: 52px; }
.bandeau a { color: #fff; text-decoration: none; }
.marque { font-size: 18px; } .marque span { font-weight: 700; letter-spacing: .06em; margin-right: 6px; }
.bandeau nav { display: flex; gap: 18px; align-items: center; }
.utilisateur { opacity: .8; }
.choix-agence { border: 0; border-radius: 6px; padding: 4px 8px; font: inherit; }

.carte { background: #fff; border: 1px solid var(--trait); border-radius: 8px; padding: 16px 20px; }
.bouton { display: inline-block; border: 1px solid var(--performance); color: var(--performance); background: #fff;
          border-radius: 6px; padding: 7px 14px; font: inherit; cursor: pointer; text-decoration: none; }
.bouton.principal { background: var(--performance); color: #fff; }
.bouton:disabled { opacity: .35; cursor: default; }
.lien { background: none; border: 0; color: var(--ecoute); cursor: pointer; font: inherit; font-size: 13px; padding: 2px 0; }

.flash { padding: 10px 14px; border-radius: 6px; margin-bottom: 16px; }
.flash-ok { background: #E7F5F1; border: 1px solid var(--humanite); }
.flash-erreur { background: var(--rouge-fond); border: 1px solid var(--bienveillance); }

.connexion { max-width: 380px; margin: 64px auto; display: grid; gap: 14px; }
.connexion label, .formulaire-import label { display: grid; gap: 4px; color: var(--texte-doux); }
input, select, textarea { font: inherit; border: 1px solid #C9D3D8; border-radius: 6px; padding: 6px 8px; background: #fff; }
textarea { width: 100%; resize: vertical; }

.entete-page { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 20px; }

.kpis { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; margin-bottom: 16px; }
.kpi { background: #fff; border: 1px solid var(--trait); border-left: 4px solid var(--ecoute); border-radius: 8px;
       padding: 12px 14px; text-decoration: none; color: var(--texte); display: grid; }
.kpi b { font-size: 28px; color: var(--performance); line-height: 1.1; }
.kpi span { font-weight: 600; } .kpi small { color: var(--texte-doux); }
.kpi.rouge { border-left-color: var(--rouge); } .kpi.rouge b { color: var(--rouge); }
.kpi.orange { border-left-color: var(--agilite); } .kpi.orange b { color: var(--orange); }

.synthese { margin-bottom: 16px; padding: 10px 20px; }
.synthese summary { cursor: pointer; font-weight: 600; color: var(--performance); }

.tableau { width: 100%; border-collapse: collapse; background: #fff; margin-top: 10px; }
.tableau th { background: var(--performance); color: #fff; text-align: left; padding: 7px 10px; font-weight: 600; }
.tableau th.n { text-align: right; }
.tableau td { padding: 6px 10px; border-bottom: 1px solid var(--trait); }
.n { text-align: right; font-variant-numeric: tabular-nums; }

.filtres { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 8px 0 16px; }
.filtres input[type=search] { min-width: 280px; flex: 1; }
.case { display: flex; gap: 6px; align-items: center; color: var(--texte-doux); }
.compteur { color: var(--texte-doux); margin-left: auto; }

.dossier { background: #fff; border: 1px solid var(--trait); border-left: 4px solid var(--ecoute);
           border-radius: 8px; margin-bottom: 12px; }
.dossier-urgent { border-left-color: var(--bienveillance); }
.dossier-retard { border-left-color: var(--rouge); }
.dossier > header { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: baseline; padding: 10px 16px;
                    border-bottom: 1px solid var(--trait); }
.dossier h3 { margin: 0; font-size: 16px; }
.id { color: var(--texte-doux); font-weight: 400; font-size: 13px; margin-left: 4px; }
.clients { color: var(--texte-doux); font-size: 14px; }
.pastilles { margin-left: auto; display: flex; gap: 6px; }
.pastille { font-size: 12px; padding: 2px 8px; border-radius: 10px; background: var(--bleu-fond); color: var(--performance); }
.pastille.rouge { background: var(--rouge-fond); color: var(--rouge); }
.pastille.rouge-plein { background: var(--rouge); color: #fff; }

.anomalies { width: 100%; border-collapse: collapse; }
.anomalies td { padding: 10px 12px; vertical-align: top; border-bottom: 1px solid #F0F0F0; }
.anomalies tr:last-child td { border-bottom: 0; }
.col-controle { width: 34%; } .col-statut { width: 15%; } .col-echeance { width: 14%; }
.col-statut select, .col-echeance input, .motif-na { width: 100%; margin-bottom: 4px; }
.col-actions { width: 9%; text-align: right; } .col-actions .bouton { padding: 5px 10px; font-size: 13px; }
.objet { color: var(--texte); font-size: 14px; margin-top: 2px; }
.meta { margin-top: 4px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.ref { color: var(--texte-doux); font-size: 12px; }
.tag { font-size: 11.5px; padding: 1px 7px; border-radius: 9px; }
.tag.bleu { background: var(--bleu-fond); color: var(--performance); }
.tag.orange { background: var(--orange-fond); color: var(--orange); }
.tag.rouge { background: var(--rouge-fond); color: var(--rouge); }
.tag.gris { background: #EEF0F1; color: var(--texte-doux); }
.gravite { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; }
.gravite-urgente { background: var(--rouge); } .gravite-normale { background: var(--ecoute); }
.statut-resolue, .statut-non_applicable { opacity: .65; }
input.en-retard { border-color: var(--rouge); color: var(--rouge); font-weight: 600; }
tr.modifiee { background: #FFFBF3; }

.grille-agences { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; margin-top: 16px; }
.carte-agence { text-decoration: none; color: var(--texte); }
.carte-agence h2 { margin: 0; }
.mini-kpi { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; color: var(--texte-doux); }
.mini-kpi b { color: var(--performance); } .mini-kpi .alerte b { color: var(--rouge); }
.formulaire-import { display: grid; gap: 12px; max-width: 640px; }
.aide { color: var(--texte-doux); font-size: 13.5px; margin: 0; }

#toast { position: fixed; bottom: 20px; right: 20px; background: var(--performance); color: #fff; padding: 10px 16px;
         border-radius: 6px; opacity: 0; transition: opacity .2s; pointer-events: none; }
#toast.visible { opacity: 1; } #toast.erreur { background: var(--rouge); }
dialog { border: 1px solid var(--trait); border-radius: 8px; max-width: 640px; width: 90%; }
dialog li { margin-bottom: 8px; font-size: 14px; }

@media (max-width: 1000px) {
  .kpis { grid-template-columns: repeat(3, 1fr); }
  .anomalies, .anomalies tbody, .anomalies tr, .anomalies td { display: block; width: 100% !important; }
  .col-actions { text-align: left; }
}

/* ---- Navigation par agence ---- */
.onglets { background: #fff; border-bottom: 1px solid var(--trait); display: flex; gap: 4px; padding: 0 24px; align-items: stretch; }
.onglets a { padding: 12px 16px; text-decoration: none; color: var(--texte-doux); border-bottom: 3px solid transparent; }
.onglets a.actif { color: var(--performance); border-bottom-color: var(--performance); font-weight: 600; }
.onglets-agence { font-weight: 700; color: var(--performance); padding: 12px 16px 12px 0; letter-spacing: .03em; }
.actions-entete { display: flex; gap: 10px; align-items: center; }

/* ---- Situation d'agence ---- */
.messages-cles { background: var(--performance); color: #fff; border-radius: 8px; padding: 16px 22px; margin-bottom: 24px; }
.messages-cles h2 { color: #fff; margin: 0 0 8px; font-size: 18px; }
.messages-cles ol { margin: 0; padding-left: 22px; display: grid; gap: 10px; }
.messages-cles li b { display: block; font-size: 16px; }
.messages-cles li span { display: block; opacity: .9; }
.messages-cles li em { display: block; font-style: normal; color: var(--humanite); }
.volet { margin-bottom: 34px; }
.volet > h2 { border-bottom: 2px solid var(--performance); padding-bottom: 4px; }
.kpis-volet { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.kpi-lib { font-weight: 600; color: var(--texte); }
.kpi-vert { border-left-color: #3F8F7A; } .kpi-orange { border-left-color: var(--agilite); }
.kpi-rouge { border-left-color: var(--rouge); } .kpi-neutre { border-left-color: var(--ecoute); }
.kpi-rouge b { color: var(--rouge); } .kpi-orange b { color: var(--orange); }
.kpis-volet .kpi b { font-size: 24px; }
.graphique-carte { margin-bottom: 14px; }
.graphique { width: 100%; height: auto; font-family: Calibri, Carlito, "Segoe UI", Arial, sans-serif; }
.g-titre { font-size: 15px; font-weight: 600; fill: var(--texte); }
.g-leg, .g-axe { font-size: 12px; fill: var(--texte-doux); }
.g-mois { font-size: 13px; fill: var(--texte); }
.g-grille { stroke: #E5E9EB; } .g-a1 { fill: #C9D3D8; } .g-a { fill: var(--performance); }
.g-obj { stroke: var(--bienveillance); stroke-width: 2.5; }
.g-taux-a1 { font-size: 12px; fill: var(--texte-doux); } .g-taux { font-size: 12px; fill: var(--texte); font-weight: 600; }
.g-baisse { fill: var(--rouge); }
.alertes { list-style: none; padding: 0; margin: 0 0 10px; display: grid; gap: 8px; }
.alertes li { background: #fff; border: 1px solid var(--trait); border-left: 4px solid var(--ecoute); border-radius: 8px;
              padding: 10px 14px; display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; }
.alertes li.niveau-rouge { border-left-color: var(--rouge); } .alertes li.niveau-orange { border-left-color: var(--agilite); }
.alertes p { margin: 3px 0 0; color: var(--texte-doux); font-size: 14px; }
.alertes .action-proposee { color: var(--performance); }
.bouton.petit { padding: 4px 10px; font-size: 13px; white-space: nowrap; }
.bouton.fait { border-color: #3F8F7A; color: #3F8F7A; opacity: 1; }
.rien { color: var(--texte-doux); }
.detail { margin-top: 8px; padding: 8px 16px; }
.detail summary { cursor: pointer; color: var(--performance); font-weight: 600; }
.defilement { overflow-x: auto; }
.actions-table td { vertical-align: top; } .actions-table input, .actions-table select { width: 100%; }
.actions-table td:first-child { width: 34%; }
.statut-fait, .statut-abandonne { opacity: .6; }
.nouvelle-action { display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 0; }
.nouvelle-action input[name=titre] { flex: 1; min-width: 280px; }
.messages-carte { padding-left: 18px; margin: 8px 0; font-size: 14px; }
.messages-carte li.niveau-rouge::marker { color: var(--rouge); }
.carte-agence h2 a { text-decoration: none; }
