/* Explorateur clients — feuille de style. Jetons de couleur en tête (clair, puis sombre). */
:root {
  color-scheme: light;
  --fond: #f4f5f7; --surface: #ffffff; --surface-2: #f1f3f6; --survol: #f6f7f9;
  --bord: #e2e5ea; --bord-fort: #cdd2da;
  --texte: #141920; --texte-2: #3b4452; --texte-3: #66707e; --texte-4: #98a0ab;
  --accent: #2458b3; --accent-fort: #1b4590; --accent-fond: #e9f0fb; --accent-texte: #ffffff;
  --rail: #0f1b2e; --rail-texte: #aab6c8; --rail-actif: #ffffff; --rail-fond-actif: rgba(255, 255, 255, .1);
  --ok: #18733a; --ok-fond: #e6f4ea; --attention: #8f5300; --attention-fond: #fdf0da; --alerte: #b42318; --alerte-fond: #fdecea;
  /* séries des graphiques : ordre validé pour le daltonisme (bleu, orange, vert d'eau) */
  --serie-1: #2a78d6; --serie-2: #eb6834; --serie-3: #1baf7a;
  --grille: #eceef2;
  --ombre-1: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
  --ombre-2: 0 16px 40px rgba(16, 24, 40, .18), 0 2px 6px rgba(16, 24, 40, .08);
  --rayon: 10px; --rayon-petit: 7px;
  --police: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --fond: #0e1116; --surface: #161a21; --surface-2: #1d222b; --survol: #1b2029;
    --bord: #2a303b; --bord-fort: #394150;
    --texte: #e9ecf1; --texte-2: #c5cbd5; --texte-3: #949cab; --texte-4: #6b7382;
    --accent: #7ea9ef; --accent-fort: #a6c4f5; --accent-fond: #1a2a45; --accent-texte: #0e1116;
    --rail: #0a0d12; --rail-texte: #8792a5; --rail-fond-actif: rgba(255, 255, 255, .08);
    --ok: #7fd197; --ok-fond: #15301f; --attention: #f2bf6b; --attention-fond: #3a2b10; --alerte: #f3a29b; --alerte-fond: #3f1b18;
    --serie-1: #3987e5; --serie-2: #d95926; --serie-3: #199e70;
    --grille: #252b35;
    --ombre-1: 0 1px 2px rgba(0, 0, 0, .3); --ombre-2: 0 16px 40px rgba(0, 0, 0, .5);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --fond: #0e1116; --surface: #161a21; --surface-2: #1d222b; --survol: #1b2029;
  --bord: #2a303b; --bord-fort: #394150;
  --texte: #e9ecf1; --texte-2: #c5cbd5; --texte-3: #949cab; --texte-4: #6b7382;
  --accent: #7ea9ef; --accent-fort: #a6c4f5; --accent-fond: #1a2a45; --accent-texte: #0e1116;
  --rail: #0a0d12; --rail-texte: #8792a5; --rail-fond-actif: rgba(255, 255, 255, .08);
  --ok: #7fd197; --ok-fond: #15301f; --attention: #f2bf6b; --attention-fond: #3a2b10; --alerte: #f3a29b; --alerte-fond: #3f1b18;
  --serie-1: #3987e5; --serie-2: #d95926; --serie-3: #199e70;
  --grille: #252b35;
  --ombre-1: 0 1px 2px rgba(0, 0, 0, .3); --ombre-2: 0 16px 40px rgba(0, 0, 0, .5);
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--fond); color: var(--texte); font: 13.5px/1.5 var(--police); -webkit-font-smoothing: antialiased; overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
h3 { font-size: 13px; }
p { margin: 0; }
.petit { color: var(--texte-3); font-size: 12.5px; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.ico { flex: none; }
.espace { flex: 1; }
.sur-titre { display: block; color: var(--texte-3); font-size: 11.5px; font-weight: 500; letter-spacing: .04em; text-transform: uppercase; }
kbd { font: 11.5px var(--mono); border: 1px solid var(--bord-fort); border-bottom-width: 2px; border-radius: 4px; padding: 0 4px; background: var(--surface-2); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::selection { background: var(--accent-fond); }
.chargement { display: grid; place-items: center; min-height: 160px; height: 100%; color: var(--texte-3); }
.vide { padding: 40px 24px; color: var(--texte-3); text-align: center; line-height: 1.7; }
.vide b { color: var(--texte-2); }

/* ---------- contrôles ---------- */
.btn { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 12px; border: 1px solid var(--bord); border-radius: var(--rayon-petit);
  background: var(--surface); color: var(--texte-2); font-weight: 500; cursor: pointer; white-space: nowrap; box-shadow: var(--ombre-1); }
.btn:hover:not(:disabled) { background: var(--survol); border-color: var(--bord-fort); color: var(--texte); }
.btn:disabled { opacity: .5; cursor: default; }
.btn-principal { background: var(--accent); border-color: var(--accent); color: var(--accent-texte); }
.btn-principal:hover:not(:disabled) { background: var(--accent-fort); border-color: var(--accent-fort); color: var(--accent-texte); }
.btn-icone { width: 34px; padding: 0; justify-content: center; }
.btn-petit { height: 28px; padding: 0 9px; font-size: 12.5px; box-shadow: none; }
.btn-large { height: 42px; justify-content: center; font-size: 14.5px; }
.btn.actif { border-color: var(--accent); color: var(--accent); background: var(--accent-fond); }
.lien { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; font: inherit; font-weight: 500; }
.lien:hover { text-decoration: underline; }
.lien-aide { color: var(--accent); cursor: pointer; display: inline-flex; vertical-align: -2px; }
select, input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="search"]:not(.recherche input) {
  height: 34px; padding: 0 10px; border: 1px solid var(--bord); border-radius: var(--rayon-petit); background: var(--surface); min-width: 0; }
select { padding-right: 26px; max-width: 100%; cursor: pointer; }
select:hover, input:hover { border-color: var(--bord-fort); }
.champ { display: grid; gap: 5px; font-size: 12.5px; font-weight: 500; color: var(--texte-2); min-width: 0; }
.champ input, .champ select { width: 100%; font-weight: 400; color: var(--texte); }
.champ-ligne { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--texte-3); }
.champ-court { max-width: 110px; }
.case { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; color: var(--texte-2); }
.case input { accent-color: var(--accent); width: 15px; height: 15px; margin: 0; }
.recherche { display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px; border: 1px solid var(--bord); border-radius: var(--rayon-petit);
  background: var(--surface-2); color: var(--texte-3); flex: 1 1 320px; min-width: 200px; max-width: 560px; cursor: text; }
.recherche:focus-within { border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 3px var(--accent-fond); }
.recherche input { border: 0; background: transparent; outline: 0; flex: 1; min-width: 0; height: 100%; color: var(--texte); }
.recherche-petite { flex: none; max-width: none; height: 32px; }
.segments { display: inline-flex; gap: 2px; padding: 3px; background: var(--surface-2); border: 1px solid var(--bord); border-radius: 9px; }
.segments button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 28px; padding: 0 12px; border: 0; border-radius: 6px;
  background: transparent; color: var(--texte-3); font-weight: 500; cursor: pointer; white-space: nowrap; }
.segments button:hover { color: var(--texte); }
.segments button[aria-checked="true"] { background: var(--surface); color: var(--texte); box-shadow: var(--ombre-1); }
.segments-pleins { display: flex; width: 100%; }
.segments-pleins button { flex: 1; padding: 0 6px; font-size: 12.5px; }
.segments-petits button { height: 24px; font-size: 12.5px; padding: 0 10px; }
.pastille { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: var(--accent-texte); font-size: 11px; font-weight: 700; display: inline-grid; place-items: center; }
.tag { display: inline-flex; align-items: center; gap: 5px; background: var(--surface-2); color: var(--texte-2); border: 1px solid var(--bord); border-radius: 6px; padding: 1px 8px; font-size: 12.5px; }
.tag.ok { background: var(--ok-fond); color: var(--ok); border-color: transparent; }
.tag.attention { background: var(--attention-fond); color: var(--attention); border-color: transparent; }
.tag.alerte { background: var(--alerte-fond); color: var(--alerte); border-color: transparent; }
.niveau { display: inline-flex; align-items: center; gap: 5px; border-radius: 6px; padding: 1px 8px; font-size: 12.5px; font-weight: 600; }
.niveau-eleve { background: var(--alerte-fond); color: var(--alerte); }
.niveau-moyen { background: var(--attention-fond); color: var(--attention); }
.niveau-faible { background: var(--ok-fond); color: var(--ok); }
.signif { display: inline-block; border-radius: 5px; padding: 0 6px; font-size: 11.5px; font-weight: 600; white-space: nowrap; cursor: help; }
.signif.oui { background: var(--accent-fond); color: var(--accent); }
.signif.non { background: var(--surface-2); color: var(--texte-3); }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip { background: var(--surface-2); border-radius: 5px; padding: 1px 7px; font-size: 12.5px; }

/* ---------- connexion ---------- */
.connexion { display: grid; place-items: center; min-height: 100vh; padding: 16px;
  background: radial-gradient(1200px 600px at 20% -10%, var(--accent-fond), transparent 60%), var(--fond); }
.connexion-carte { width: 100%; max-width: 390px; background: var(--surface); border: 1px solid var(--bord); border-radius: 16px; padding: 32px 30px 26px; display: grid; gap: 14px; box-shadow: var(--ombre-2); }
.marque-grande { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.marque-grande b { display: block; font-size: 16px; }
.marque-grande span { color: var(--texte-3); font-size: 13px; }
.logo { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; background: linear-gradient(135deg, #3a7be0, #1b4590); color: #fff; font-weight: 700; font-size: 18px; letter-spacing: -.02em; }
.connexion-carte .champ input { height: 40px; }
.erreur { color: var(--alerte); background: var(--alerte-fond); border-radius: var(--rayon-petit); padding: 9px 11px; font-size: 13px; }

/* ---------- coque : rail, barre, vues ---------- */
.coque { display: grid; grid-template-columns: 78px 1fr; height: 100vh; }
.rail { background: var(--rail); display: flex; flex-direction: column; align-items: stretch; gap: 4px; padding: 14px 8px; }
.rail-marque { display: grid; place-items: center; margin-bottom: 14px; }
.rail-btn { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 9px 2px 8px; border: 0; border-radius: 9px; background: transparent;
  color: var(--rail-texte); font-size: 11px; font-weight: 500; cursor: pointer; }
.rail-btn:hover { color: var(--rail-actif); background: var(--rail-fond-actif); }
.rail-btn[aria-current="page"] { color: var(--rail-actif); background: var(--rail-fond-actif); box-shadow: inset 3px 0 0 #6ea2f0; }
.rail-bas { margin-top: auto; display: flex; flex-direction: column; gap: 4px; }
.avatar { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: #2c4a7a; color: #fff; font-size: 11px; font-weight: 700; }
.principal { display: grid; grid-template-rows: auto 1fr; min-width: 0; min-height: 0; }
.barre { background: var(--surface); border-bottom: 1px solid var(--bord); padding: 12px 22px; display: grid; gap: 10px; z-index: 5; }
.barre-ligne { display: flex; align-items: center; gap: 12px; min-width: 0; }
.barre h1 { font-size: 17px; white-space: nowrap; margin-right: 6px; min-width: 150px; }
.compte-fiches { margin-left: auto; color: var(--texte-3); white-space: nowrap; font-size: 13px; }
.compte-fiches b { color: var(--texte); font-size: 14px; }
.puces { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.puce { display: inline-flex; align-items: stretch; border: 1px solid var(--bord); border-radius: 7px; background: var(--surface-2); overflow: hidden; max-width: 100%; }
.puce-critere { background: var(--accent-fond); border-color: transparent; }
.puce button { border: 0; background: transparent; cursor: pointer; font-size: 12.5px; color: var(--texte-2); }
.puce-texte { padding: 4px 4px 4px 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 440px; }
.puce-texte b { color: var(--texte); font-weight: 600; }
.puce-critere .puce-texte { color: var(--accent); }
.puce-x { padding: 0 7px; display: inline-flex; align-items: center; color: var(--texte-3) !important; }
.puce-x:hover { color: var(--alerte) !important; }
.vues { position: relative; min-height: 0; overflow: hidden; }
.vue { position: absolute; inset: 0; overflow: auto; }
.page { max-width: 1560px; margin: 0 auto; padding: 22px 24px 40px; }
.page-entete { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.page-entete h2 { font-size: 21px; margin: 2px 0; }

/* ---------- cartes, indicateurs, grilles ---------- */
.carte { background: var(--surface); border: 1px solid var(--bord); border-radius: 14px; padding: 18px 20px; min-width: 0; box-shadow: var(--ombre-1); }
.carte > header { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.carte > header h3 { font-size: 14px; margin-right: auto; }
.carte-large { grid-column: 1 / -1; }
.controles { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 4px; }
.controles select { flex: 1 1 200px; max-width: 340px; }
.note { color: var(--texte-3); font-size: 12.5px; min-height: 18px; margin: 8px 0 10px; line-height: 1.6; }
.graphe { position: relative; height: 300px; }
.actions-image { display: inline-flex; gap: 4px; }
.actions-image .btn-icone { width: 30px; height: 30px; box-shadow: none; }
.details-donnees { margin-top: 12px; }
.details-donnees summary { cursor: pointer; color: var(--accent); font-size: 12.5px; font-weight: 500; }
.table-defile { max-height: 360px; overflow: auto; margin-top: 8px; }
.pied-carte { display: flex; align-items: center; gap: 12px; margin-top: 12px; }
.texte { color: var(--texte-2); line-height: 1.65; margin-bottom: 12px; max-width: 980px; }
.kpis { display: grid; gap: 12px; }
.kpis-accueil { grid-template-columns: repeat(6, minmax(0, 1fr)); margin-bottom: 18px; }
.kpis-analyse { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 16px; }
.kpis-fiche { grid-template-columns: repeat(6, minmax(0, 1fr)); margin: 12px 0; }
.kpi { background: var(--surface); border: 1px solid var(--bord); border-radius: 12px; padding: 13px 15px; box-shadow: var(--ombre-1); min-width: 0; }
.kpi > span { display: block; color: var(--texte-3); font-size: 12.5px; font-weight: 500; }
.kpi > span[data-aide] { text-decoration: underline dotted var(--texte-4); text-underline-offset: 3px; cursor: help; }
.kpi b { display: block; font-size: 23px; font-weight: 650; letter-spacing: -.02em; margin-top: 3px; font-variant-numeric: tabular-nums; }
.kpi small { display: block; color: var(--texte-3); font-size: 12px; margin-top: 3px; }
.kpi .ecart { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; color: var(--texte-2); font-variant-numeric: tabular-nums; }
.kpis-fiche .kpi { box-shadow: none; background: var(--surface-2); border-color: transparent; padding: 10px 12px; }
.kpis-fiche .kpi b { font-size: 18px; }
.grille-analyse { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 580px), 1fr)); gap: 16px; align-items: start; }
.grille-accueil { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
@media (max-width: 1280px) { .kpis-accueil { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 1100px) { .grille-accueil { grid-template-columns: 1fr; } .kpis-analyse, .kpis-fiche { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* ---------- tableaux ---------- */
table { border-collapse: collapse; width: 100%; }
table.donnees th, table.donnees td { text-align: left; padding: 7px 10px 7px 0; border-bottom: 1px solid var(--bord); font-size: 13px; vertical-align: top; }
table.donnees thead th { color: var(--texte-3); font-weight: 600; font-size: 12px; white-space: nowrap; position: sticky; top: 0; background: var(--surface); z-index: 1; }
table.donnees .num { text-align: right; font-variant-numeric: tabular-nums; }
table.donnees tbody tr:last-child td, table.donnees tbody tr:last-child th { border-bottom: 0; }
.resume-stats { margin-top: 12px; max-width: 520px; }
.defile-x { overflow-x: auto; }
.liste-risque tbody tr, .ca-classement tr[data-rang] { cursor: pointer; }
.liste-risque tbody tr:hover, .ca-classement tr[data-rang]:hover { background: var(--survol); }
.effet { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; }
.effet.hausse { color: var(--alerte); }
.effet.baisse { color: var(--ok); }
.tableau-croise th, .tableau-croise td { padding: 7px 10px !important; }
.tableau-croise tbody th { font-weight: 500; color: var(--texte-2); white-space: nowrap; }
.tableau-croise td.chaleur { border: 2px solid var(--surface) !important; border-radius: 4px; font-weight: 500; }
.tableau-croise .total { color: var(--texte-3); font-weight: 600; }
.tableau-croise tr.total th, .tableau-croise tr.total td { border-top: 2px solid var(--bord-fort); }
.tableau-evolution td { white-space: nowrap; }
.variation { display: inline-flex; align-items: center; gap: 1px; font-size: 12px; font-weight: 600; margin-left: 4px; color: var(--texte-3); }
.variation.bon { color: var(--ok); }
.variation.mauvais { color: var(--alerte); }

/* ---------- tableau de bord ---------- */
.alertes { display: grid; gap: 8px; }
.alerte-ligne { display: grid; grid-template-columns: 64px 1fr auto; align-items: center; gap: 14px; text-align: left; padding: 11px 14px;
  border: 1px solid var(--bord); border-radius: 10px; background: var(--surface); cursor: pointer; color: var(--texte); }
.alerte-ligne:hover:not(:disabled) { border-color: var(--accent); background: var(--accent-fond); }
.alerte-ligne b { display: block; font-weight: 600; }
.alerte-ligne .petit { display: block; }
.alerte-nombre { font-size: 22px; font-weight: 700; color: var(--alerte); text-align: center; font-variant-numeric: tabular-nums; }
.alerte-ligne.calme { cursor: default; }
.alerte-ligne.calme .alerte-nombre { color: var(--texte-4); }
.alerte-action { display: inline-flex; align-items: center; gap: 4px; color: var(--accent); font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.barres-simples { display: grid; gap: 9px; }
.barre-simple { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(80px, 1fr) 34px; align-items: center; gap: 12px; font-size: 13px; }
.barre-simple .jauge { height: 8px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.barre-simple .jauge i { display: block; height: 100%; background: var(--serie-1); border-radius: 4px; }
.barre-simple b { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- analyse : comparaison et onglets ---------- */
.comparaison { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 12px; align-items: stretch; margin-bottom: 16px; }
.segment-carte { display: flex; align-items: center; gap: 14px; background: var(--surface); border: 1px solid var(--bord); border-radius: 14px; padding: 14px 16px; box-shadow: var(--ombre-1); min-width: 0; }
.segment-texte { display: grid; gap: 3px; flex: 1; min-width: 0; }
.segment-texte b { font-size: 15px; }
.segment-texte .petit { overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.segment-texte select { max-width: 280px; height: 30px; font-weight: 600; }
.segment-actions { display: flex; gap: 6px; }
.repere-serie { width: 10px; align-self: stretch; border-radius: 5px; flex: none; }
.repere-serie.a { background: var(--serie-1); }
.repere-serie.b { background: var(--serie-2); }
.repere-serie.eteint { background: var(--bord); }
.comparaison-vs { display: grid; place-items: center; align-content: center; gap: 2px; color: var(--texte-3); font-size: 12px; }
.onglets { display: flex; gap: 4px; border-bottom: 1px solid var(--bord); margin-bottom: 18px; }
.onglets button { border: 0; background: none; padding: 10px 14px; color: var(--texte-3); font-weight: 600; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.onglets button:hover { color: var(--texte); }
.onglets button[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); }

/* ---------- fiches : outils, liste, tableau ---------- */
.vue-fiches { display: grid; grid-template-rows: auto 1fr; overflow: hidden; }
.outils { display: flex; align-items: center; gap: 12px; padding: 10px 22px; border-bottom: 1px solid var(--bord); background: var(--surface); }
.outils .note { margin: 0; }
.corps-fiches { display: grid; grid-template-columns: minmax(300px, 380px) 1fr; min-height: 0; }
.liste { overflow-y: auto; border-right: 1px solid var(--bord); background: var(--surface); }
.ligne { display: flex; gap: 12px; align-items: center; padding: 9px 16px; border-bottom: 1px solid var(--bord); cursor: pointer; }
.ligne:hover { background: var(--survol); }
.ligne.active { background: var(--accent-fond); box-shadow: inset 3px 0 0 var(--accent); }
.ligne img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; flex: none; background: var(--surface-2); }
.ligne .qui { min-width: 0; flex: 1; }
.ligne .nom { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ligne .meta { color: var(--texte-3); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ligne .num { color: var(--texte-4); font-size: 12px; font-variant-numeric: tabular-nums; }
img[data-photo]:not([src]) { visibility: hidden; }
.plus-de-lignes { display: block; width: calc(100% - 32px); margin: 14px 16px 22px; height: 36px; border: 1px dashed var(--bord-fort); border-radius: var(--rayon-petit); background: transparent; cursor: pointer; color: var(--accent); font-weight: 500; }
.plus-de-lignes:hover { background: var(--accent-fond); border-style: solid; }
.tableau-cadre { overflow: auto; background: var(--surface); }
.grille-donnees { table-layout: fixed; border-collapse: separate; border-spacing: 0; }
.grille-donnees th { position: sticky; top: 0; z-index: 2; background: var(--surface-2); text-align: left; font-size: 12px; font-weight: 600; color: var(--texte-2);
  padding: 9px 12px; border-bottom: 1px solid var(--bord-fort); border-right: 1px solid var(--bord); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; user-select: none; }
.grille-donnees th:hover { background: var(--survol); color: var(--texte); }
.grille-donnees th.trie { color: var(--accent); }
.grille-donnees th span { display: inline-block; max-width: calc(100% - 18px); vertical-align: bottom; overflow: hidden; text-overflow: ellipsis; }
.fleche-tri { display: inline-flex; vertical-align: -3px; margin-left: 2px; }
.poignee { position: absolute; top: 0; right: -3px; width: 7px; height: 100%; cursor: col-resize; z-index: 3; }
.poignee:hover { background: var(--accent); opacity: .5; }
.grille-donnees td { padding: 7px 12px; border-bottom: 1px solid var(--bord); border-right: 1px solid var(--bord); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
.grille-donnees .num { text-align: right; font-variant-numeric: tabular-nums; }
.grille-donnees tbody tr { cursor: pointer; }
.grille-donnees tbody tr:hover td { background: var(--survol); }
.cellule-client { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
.cellule-client img { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; background: var(--surface-2); }
.choix-colonnes { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px 18px; max-height: 52vh; overflow: auto; padding: 4px 2px; margin-top: 10px; }
.choix-colonnes fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.choix-colonnes legend { font-weight: 600; font-size: 12px; color: var(--texte-3); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 4px; }
.choix-colonnes .recherche, .choix-colonnes .ex-boutons { grid-column: 1 / -1; }

/* ---------- fiche ---------- */
.detail { overflow-y: auto; padding: 18px 22px 30px; }
.fiche { max-width: 1120px; margin: 0 auto; background: var(--surface); border: 1px solid var(--bord); border-radius: 16px; padding: 18px 26px 24px; box-shadow: var(--ombre-1); }
.fiche-actions { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.retour-liste { display: none; }
.nav-fiches { display: inline-flex; gap: 4px; }
.fiche-tete { display: flex; gap: 22px; align-items: flex-start; padding-bottom: 20px; border-bottom: 1px solid var(--bord); }
.fiche-tete img { width: 132px; height: 132px; border-radius: 14px; object-fit: cover; flex: none; background: var(--surface-2); }
.fiche-titre { flex: 1; min-width: 0; }
.fiche-titre h2 { font-size: 24px; margin: 3px 0 2px; }
.sous-titre { color: var(--texte-2); margin-bottom: 10px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.fiche-grille { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); gap: 0 32px; }
.fiche-grille h3, .bloc-fiche h3 { font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--texte-3); margin: 22px 0 6px; }
.donnees-fiche th, .donnees-fiche td { text-align: left; vertical-align: top; padding: 6px 0; border-bottom: 1px solid var(--bord); }
.donnees-fiche th { font-weight: 500; color: var(--texte-3); width: 34%; padding-right: 14px; }
.bloc-fiche { margin-top: 26px; padding-top: 4px; border-top: 1px solid var(--bord); }
.bloc-fiche h3.titre-bloc { font-size: 14px; letter-spacing: 0; text-transform: none; color: var(--texte); }
.encart-risque { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 10px; margin: 6px 0 10px; line-height: 1.6; }
.encart-risque.niveau-eleve { background: var(--alerte-fond); color: var(--alerte); }
.encart-risque.niveau-moyen { background: var(--attention-fond); color: var(--attention); }
.encart-risque.niveau-faible { background: var(--ok-fond); color: var(--ok); }
.encart-risque .petit { color: inherit; opacity: .9; }
.encart-risque b { color: inherit; }
.filtres-historique { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 6px 0 10px; }
.filtres-historique select { height: 30px; max-width: 230px; }
.frise { margin: 4px 0 6px; }
.frise svg { width: 100%; height: auto; display: block; }
.frise-texte { font-size: 11px; fill: var(--texte-3); }
.frise-ligne { stroke: var(--bord); stroke-width: 1; }
.frise-annee { stroke: var(--bord-fort); stroke-dasharray: 3 3; }
.frise-inter { fill: var(--serie-1); fill-opacity: .55; }
.frise-reclam { fill: var(--serie-2); stroke: var(--surface); stroke-width: 1.5; }
.frise-sinistre { fill: var(--serie-3); }
.frise-souscription { fill: var(--texte-3); }
.frise-resiliation { stroke: var(--alerte); stroke-width: 2; }
.frise-legende { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }
.frise-legende span { display: inline-flex; align-items: center; gap: 5px; }
.frise-legende .pt { width: 9px; height: 9px; border-radius: 50%; display: inline-block; background: var(--serie-1); }
.frise-legende .pt.frise-reclam { background: var(--serie-2); }
.frise-legende .tri { width: 0; height: 0; border-left: 5px solid transparent; border-right: 5px solid transparent; border-bottom: 9px solid var(--serie-3); display: inline-block; }
.frise-legende .car { width: 9px; height: 9px; border-radius: 2px; background: var(--texte-3); display: inline-block; }
.chronologie { list-style: none; margin: 8px 0 0; padding: 0; }
.chronologie li { display: grid; grid-template-columns: 124px 1fr; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--bord); }
.chronologie li.reclamation { box-shadow: inset 3px 0 0 var(--serie-2); padding-left: 10px; }
.chronologie time { color: var(--texte-3); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.chronologie .t { font-weight: 600; }
.sens { display: inline-block; font-size: 11px; border-radius: 4px; padding: 0 6px; margin-right: 6px; background: var(--surface-2); color: var(--texte-3); }
.sens.entrant { background: var(--accent-fond); color: var(--accent); }
.cartes-similaires { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.carte-similaire { display: flex; gap: 10px; align-items: center; text-align: left; padding: 10px; border: 1px solid var(--bord); border-radius: 10px; background: var(--surface); cursor: pointer; color: var(--texte); }
.carte-similaire:hover { border-color: var(--accent); background: var(--accent-fond); }
.carte-similaire img { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; background: var(--surface-2); flex: none; }
.carte-similaire > span { display: grid; gap: 1px; min-width: 0; }
.carte-similaire .petit { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pied-fiche { margin-top: 20px; color: var(--texte-4); font-size: 12px; }

/* ---------- carte ---------- */
.vue-carte { display: grid; grid-template-columns: 316px 1fr; overflow: hidden; }
.ca-panneau { overflow-y: auto; overflow-x: hidden; background: var(--surface); border-right: 1px solid var(--bord); padding: 16px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.ca-panneau > div[data-pour], .ca-panneau > label[data-pour] { display: grid; gap: 10px; }
.ca-panneau h3 { font-size: 12px; letter-spacing: .05em; text-transform: uppercase; color: var(--texte-3); margin-bottom: 6px; }
.ca-section { border-top: 1px solid var(--bord); padding-top: 12px; }
.ca-cle { display: flex; align-items: center; gap: 8px; font-size: 12.5px; padding: 2px 0; }
.ca-cle i { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.ca-legende .petit { margin-top: 6px; }
.ca-degrade { height: 10px; border-radius: 5px; }
.ca-degrade-l { display: flex; justify-content: space-between; }
.ca-zones { display: flex; flex-wrap: wrap; gap: 6px; }
.ca-classement td { padding: 5px 6px 5px 0 !important; font-size: 12.5px !important; }
.outils-zone { display: flex; flex-wrap: wrap; gap: 6px; }
.outils-zone .btn { height: 30px; padding: 0 9px; font-size: 12.5px; box-shadow: none; }
#ca-outil { margin-top: 10px; display: grid; gap: 8px; }
.consigne { background: var(--accent-fond); color: var(--accent); border-radius: 8px; padding: 9px 11px; font-size: 12.5px; line-height: 1.55; }
.zone-resultat { display: grid; gap: 4px; padding: 10px 12px; border: 1px solid var(--bord); border-radius: 10px; }
.ligne-champs { display: flex; gap: 8px; }
.ligne-boutons { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 6px; }
.zone-resultat .btn { white-space: normal; height: auto; min-height: 34px; padding: 6px 12px; }
.ca-carte { min-height: 0; background: var(--surface-2); }
.ca-carte.ca-dessin, .ca-carte.ca-dessin .leaflet-interactive { cursor: crosshair !important; }
.ca-carte .leaflet-tile-pane { filter: grayscale(1) brightness(1.06) contrast(.85); opacity: .8; }
.ca-carte.ca-sombre .leaflet-tile-pane { filter: grayscale(1) invert(1) brightness(.75) contrast(.8); opacity: .5; }
.grappe { display: grid; place-items: center; border-radius: 50%; background: color-mix(in srgb, var(--serie-1) 88%, transparent); color: #fff; font-weight: 700; font-size: 12px;
  border: 2px solid var(--surface); box-shadow: 0 1px 4px rgba(0, 0, 0, .25); cursor: pointer; }
.repere-agence { width: 12px; height: 12px; border-radius: 3px; background: var(--surface); border: 2.5px solid var(--texte); box-shadow: 0 1px 3px rgba(0, 0, 0, .3); }
.zone-brouillon { stroke: var(--accent); stroke-width: 2; stroke-dasharray: 6 5; fill: var(--accent); fill-opacity: .08; }
.zone-active { stroke: var(--texte); stroke-width: 2; stroke-dasharray: 4 5; fill: none; }
.ca-bulle { font-size: 13px; line-height: 1.55; }
.leaflet-container { font: inherit; background: var(--surface-2); }
.leaflet-popup-content-wrapper, .leaflet-popup-tip, .leaflet-tooltip { background: var(--surface); color: var(--texte); }
.leaflet-tooltip { border-color: var(--bord); box-shadow: var(--ombre-1); }
.leaflet-bar a { background: var(--surface); color: var(--texte); border-color: var(--bord); }

/* ---------- panneaux, menus, fenêtres, bulles, notifications ---------- */
.panneau { position: fixed; z-index: 50; background: var(--surface); border: 1px solid var(--bord); border-radius: 14px; box-shadow: var(--ombre-2); }
#panneau-filtres { width: min(680px, calc(100vw - 24px)); max-height: calc(100vh - 90px); overflow: auto; padding: 18px; display: grid; gap: 14px; }
.pf-tete { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.pf-tete h3 { font-size: 15px; margin-bottom: 2px; }
.pf-grille { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.pf-criteres { display: grid; gap: 10px; padding-top: 12px; border-top: 1px solid var(--bord); justify-items: start; }
.pf-sous-titre { display: grid; gap: 2px; }
.pf-sous-titre h4 { font-size: 13px; }
.puces-panneau { display: flex; flex-wrap: wrap; gap: 6px; }
.puces-panneau:empty { display: none; }
.pf-pied { display: flex; align-items: center; gap: 8px; padding-top: 12px; border-top: 1px solid var(--bord); }
.pf-pied .petit { margin-right: auto; }
.panneau-critere { width: 400px; max-height: 74vh; display: flex; flex-direction: column; gap: 10px; padding: 16px; z-index: 60; }
.pc-tete { display: flex; align-items: center; justify-content: space-between; }
#pc-corps { display: flex; flex-direction: column; gap: 8px; min-height: 0; flex: 1; overflow: hidden; }
.pc-liste { overflow-y: auto; border: 1px solid var(--bord); border-radius: 8px; min-height: 80px; max-height: 40vh; }
.pc-option { display: flex; align-items: center; gap: 9px; padding: 6px 10px; border-bottom: 1px solid var(--bord); cursor: pointer; font-size: 13px; }
.pc-option:last-child { border-bottom: 0; }
.pc-option:hover { background: var(--survol); }
.pc-option input { accent-color: var(--accent); margin: 0; }
.pc-option span:first-of-type { flex: 1; }
.choix-colonnes .pc-option { border: 0; padding: 4px 4px; border-radius: 6px; }
.pc-mode { display: grid; gap: 3px; font-size: 13px; }
.pc-bornes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pc-pied { display: flex; align-items: center; gap: 8px; }
.pc-pied .petit { margin-right: auto; }
.menu { position: fixed; z-index: 70; width: 290px; background: var(--surface); border: 1px solid var(--bord); border-radius: 12px; box-shadow: var(--ombre-2); padding: 14px; display: grid; gap: 12px; }
.menu h3 { font-size: 13px; }
.menu-ligne { display: grid; gap: 6px; font-size: 12.5px; color: var(--texte-2); font-weight: 500; }
.menu-email { font-weight: 600; word-break: break-all; }
.pas { display: flex; align-items: center; gap: 10px; }
.pas b { min-width: 46px; text-align: center; }
.tiroir { position: fixed; z-index: 80; top: 0; right: 0; bottom: 0; width: min(460px, 92vw); background: var(--surface); border-left: 1px solid var(--bord); box-shadow: var(--ombre-2); display: grid; grid-template-rows: auto 1fr; }
.tiroir-tete { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--bord); }
.tiroir-tete h2 { font-size: 16px; }
.tiroir-corps { overflow-y: auto; padding: 6px 20px 30px; line-height: 1.65; color: var(--texte-2); }
.tiroir-corps h3 { margin: 18px 0 6px; color: var(--texte); font-size: 14px; }
.tiroir-corps ul { padding-left: 18px; margin: 6px 0; }
.tiroir-corps li { margin: 4px 0; }
.tiroir-corps p { margin: 6px 0; }
.glossaire dt { font-weight: 600; color: var(--texte); margin-top: 10px; }
.glossaire dd { margin: 2px 0 0; }
.modale-fond { position: fixed; inset: 0; z-index: 90; background: rgba(10, 15, 25, .45); display: grid; place-items: center; padding: 20px; }
.modale { width: min(560px, 100%); max-height: calc(100vh - 40px); overflow: auto; background: var(--surface); border-radius: 16px; box-shadow: var(--ombre-2); padding: 20px 22px; display: grid; gap: 14px; }
.modale-large { width: min(900px, 100%); }
.modale-tete { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.modale-tete h2 { font-size: 18px; margin-bottom: 2px; }
.modale-pied { display: flex; align-items: center; gap: 8px; padding-top: 14px; border-top: 1px solid var(--bord); }
.export-grille { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.export-grille fieldset { border: 1px solid var(--bord); border-radius: 12px; padding: 12px 14px; margin: 0; display: grid; gap: 8px; min-width: 0; align-content: start; }
.export-grille fieldset.large { grid-column: 1 / -1; }
.export-grille legend { font-weight: 600; font-size: 13px; padding: 0 6px; }
.export-grille .inactif { opacity: .45; pointer-events: none; }
.option-carte { display: flex; gap: 10px; align-items: flex-start; padding: 10px; border: 1px solid var(--bord); border-radius: 10px; cursor: pointer; }
.option-carte:has(input:checked) { border-color: var(--accent); background: var(--accent-fond); }
.option-carte input { accent-color: var(--accent); margin-top: 3px; }
.option-carte > span { display: grid; gap: 2px; }
.ex-boutons { font-size: 12.5px; color: var(--texte-3); }
/* appels enregistrés : bouton dans l'historique, lecteur et transcription */
.btn-appel { display: flex; width: fit-content; align-items: center; gap: 6px; margin-top: 6px; height: 26px; padding: 0 10px 0 8px; border: 1px solid var(--bord); border-radius: 13px;
  background: var(--accent-fond); color: var(--accent); font-size: 12.5px; font-weight: 600; cursor: pointer; font-variant-numeric: tabular-nums; }
.btn-appel:hover { border-color: var(--accent); }
.avertissement-appel { display: flex; gap: 9px; align-items: flex-start; padding: 9px 12px; border-radius: 10px; background: var(--surface-2); color: var(--texte-2); font-size: 12.5px; }
.avertissement-appel .ico { margin-top: 2px; color: var(--texte-3); }
.lecteur { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--bord); border-radius: 12px; }
.lecteur-jouer { width: 40px; height: 40px; border-radius: 50%; }
.lecteur-temps { font-variant-numeric: tabular-nums; color: var(--texte-3); font-size: 12.5px; min-width: 34px; }
.lecteur input[type="range"] { flex: 1; min-width: 80px; height: 6px; padding: 0; border: 0; border-radius: 3px; appearance: none; cursor: pointer;
  background: linear-gradient(to right, var(--accent) var(--avance, 0%), var(--bord) var(--avance, 0%)); }
.lecteur input[type="range"]::-webkit-slider-thumb { appearance: none; width: 14px; height: 14px; border-radius: 50%; background: var(--accent); border: 2px solid var(--surface); box-shadow: var(--ombre-1); }
.lecteur .segments button { padding: 0 8px; font-variant-numeric: tabular-nums; }
.transcription { list-style: none; margin: 0; padding: 0; max-height: min(46vh, 420px); overflow: auto; border-top: 1px solid var(--bord); }
.transcription li { display: grid; grid-template-columns: 52px 1fr; gap: 10px; padding: 9px 10px; border-bottom: 1px solid var(--bord); border-radius: 0; transition: background .15s; }
.transcription li.client b { color: var(--texte); }
.transcription li.conseiller b { color: var(--accent); }
.transcription li b { font-size: 12.5px; }
.transcription li p { margin: 1px 0 0; color: var(--texte-2); }
.transcription li.en-cours { background: var(--accent-fond); }
.transcription li.en-cours p { color: var(--texte); }
.transcription-repere { align-self: start; border: 0; background: none; padding: 1px 0; color: var(--texte-3); font: 12px var(--mono); cursor: pointer; text-align: left; }
.transcription-repere:hover { color: var(--accent); text-decoration: underline; }
@media (prefers-reduced-motion: reduce) { .transcription li { transition: none; } }
.bulle-aide { position: fixed; z-index: 100; max-width: 340px; background: var(--texte); color: var(--surface); border-radius: 10px; padding: 10px 12px; font-size: 12.5px; line-height: 1.55; box-shadow: var(--ombre-2); pointer-events: none; }
.bulle-aide b { display: block; margin-bottom: 2px; }
[data-aide] { cursor: help; }
.toasts { position: fixed; z-index: 110; bottom: 20px; left: 50%; transform: translateX(-50%); display: grid; gap: 8px; justify-items: center; }
.toast { display: flex; align-items: center; gap: 14px; background: #18202c; color: #f2f4f7; border-radius: 10px; padding: 11px 16px; box-shadow: var(--ombre-2); font-size: 13px;
  max-width: min(640px, 90vw); animation: entree .18s ease-out; transition: opacity .3s, transform .3s; }
.toast .lien { color: #9cc2ff; }
.toast.sortie { opacity: 0; transform: translateY(6px); }
@keyframes entree { from { opacity: 0; transform: translateY(8px); } }
@media (prefers-reduced-motion: reduce) { .toast { animation: none; transition: none; } }

/* ---------- petites largeurs ---------- */
@media (max-width: 1180px) {
  .corps-fiches { grid-template-columns: 1fr; }
  .corps-fiches.montre-detail .liste { display: none; }
  .corps-fiches:not(.montre-detail) .detail { display: none; }
  .retour-liste { display: inline-flex; }
  .comparaison { grid-template-columns: 1fr; }
  .comparaison-vs { grid-auto-flow: column; justify-content: start; gap: 6px; }
}

/* ---------- impression d'une fiche (Imprimer et PDF) ---------- */
@media print {
  @page { size: A4; margin: 12mm; }
  /* même spécificité que les règles du thème sombre, placée après : l'impression est toujours claire */
  :root:not([data-theme="x"]), :root[data-theme] { color-scheme: light; --fond: #fff; --surface: #fff; --surface-2: #f3f4f6; --bord: #dfe2e7; --bord-fort: #c9ced6; --texte: #111; --texte-2: #333; --texte-3: #555; --texte-4: #888;
    --accent: #1f4e8c; --accent-fond: #eef3fb; --ok: #18733a; --ok-fond: #e6f4ea; --attention: #8f5300; --attention-fond: #fdf0da; --alerte: #b42318; --alerte-fond: #fdecea; }
  html, body { height: auto; overflow: visible; background: #fff; font-size: 11px; }
  .rail, .barre, .outils, .liste, .fiche-actions, .tableau-cadre, .toasts, .filtres-historique, #toutes, .similaires, #panneau-filtres, .menu, .tiroir, .bulle-aide, .btn-appel { display: none !important; }
  .coque, .principal, .vues, .vue, .vue-fiches, .corps-fiches, .detail { display: block !important; position: static !important; height: auto !important; overflow: visible !important; padding: 0 !important; }
  .vue:not(#vue-fiches) { display: none !important; }
  .fiche { border: 0; box-shadow: none; padding: 0; max-width: none; }
  .fiche-grille { grid-template-columns: 1fr 1fr; gap: 0 24px; }
  .fiche-grille section, .donnees-fiche tr, .chronologie li, table.donnees tr { break-inside: avoid; }
  .bloc-fiche { break-before: auto; }
  .kpi { box-shadow: none; }
  a { color: inherit; }
  .lien-aide { display: none; }
}
