
/* Espace maintenance Banz-Ai · charte Mint Soul v2 */
:root {
  --navy: #1e2a44;
  --mint: #5bc4a5;
  --mint-fonce: #2fa98c;
  --mint-texte: #1e7a64;
  --mint-clair: #a8e6cf;
  --ok: #2f9e64;
  --ok-fond: #e9f7ef;
  --degrade: #c98a10;
  --degrade-fond: #fdf4e1;
  --panne: #c94a4a;
  --panne-fond: #fbeaea;
  --fond: #f6f8f7;
  --surface: #ffffff;
  --voile: #f3fbf7;
  --titre: #1e2a44;
  --fort: #1a1a1a;
  --texte: #4a4a47;
  --discret: #72726e;
  --filet: #e4e4e1;
  --vide: #e9ecea;
  --ombre: 0 1px 2px rgba(30, 42, 68, 0.06), 0 4px 16px rgba(30, 42, 68, 0.05);
  --ombre-panneau: -12px 0 48px rgba(30, 42, 68, 0.18);
  --voile-modal: rgba(30, 42, 68, 0.38);
  --police: Calibri, Carlito, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --fond: #111827; --surface: #172033; --voile: #18253a;
    --titre: #ffffff; --fort: #ffffff; --texte: #c7d2e0; --discret: #93a0b4;
    --filet: #2c3650; --vide: #2a3449; --mint-texte: #a8e6cf;
    --ok: #5cc98f; --ok-fond: #15302a; --degrade: #e8b24a; --degrade-fond: #33291a; --panne: #ef8a8a; --panne-fond: #3a1f25;
    --ombre: 0 1px 2px rgba(0,0,0,.3); --ombre-panneau: -12px 0 48px rgba(0,0,0,.5); --voile-modal: rgba(0,0,0,.55);
  }
}
html { scroll-padding-top: calc(env(safe-area-inset-top, 0px) + 4rem); -webkit-text-size-adjust: 100%; }
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--fond); color: var(--texte); font-family: var(--police); font-size: 1rem; line-height: 1.5; -webkit-font-smoothing: antialiased; }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--surface); }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--mint-fonce); outline-offset: 2px; border-radius: 4px; }
.cache { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.conteneur { width: min(100% - 2.5rem, 68rem); margin-inline: auto; }

/* En-tête */
.entete { position: sticky; top: 0; padding-top: env(safe-area-inset-top, 0px); z-index: 5; background: var(--surface); border-bottom: 1px solid var(--filet); }
.entete .conteneur { display: flex; align-items: center; gap: 1.5rem; min-height: 3.75rem; }
.marque { display: flex; align-items: center; gap: 0.85rem; text-decoration: none; color: inherit; flex: none; }
.marque img { height: 1.5rem; width: auto; display: block; }
.marque .sep { width: 1px; height: 1.4rem; background: var(--filet); }
.marque .client { font-weight: 700; color: var(--titre); white-space: nowrap; }
.onglets { display: flex; gap: 0.25rem; margin-left: 0.5rem; }
.onglets a { position: relative; display: inline-flex; align-items: center; min-height: 3.75rem; padding: 0 0.75rem; color: var(--discret); text-decoration: none; font-weight: 700; font-size: 0.9375rem; }
.onglets a:hover { color: var(--titre); }
.onglets a[aria-current="page"] { color: var(--titre); }
.onglets a[aria-current="page"]::after { content: ""; position: absolute; left: 0.75rem; right: 0.75rem; bottom: -1px; height: 3px; border-radius: 3px 3px 0 0; background: var(--mint-fonce); }
.compte { margin-left: auto; display: flex; align-items: center; gap: 0.75rem; font-size: 0.875rem; color: var(--discret); }
.avatar { width: 2rem; height: 2rem; border-radius: 50%; background: var(--voile); color: var(--mint-texte); display: grid; place-items: center; font-weight: 700; font-size: 0.8125rem; border: 1px solid var(--filet); }
.bouton-lien { background: none; border: 0; padding: 0; cursor: pointer; color: var(--titre); text-decoration: underline; text-decoration-color: var(--filet); text-underline-offset: 0.25em; }

main { padding: 2rem 0 4rem; }
.vue[hidden] { display: none; }

/* Cartes */
.carte { background: var(--surface); border: 1px solid var(--filet); border-radius: 10px; box-shadow: var(--ombre); }
.carte-tete { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; padding: 1.1rem 1.4rem 0; }
.carte-tete h2 { margin: 0; color: var(--titre); font-size: 1.0625rem; }
.carte-tete .aside { font-size: 0.8125rem; color: var(--discret); }
.lien-fleche { color: var(--mint-texte); font-weight: 700; text-decoration: none; font-size: 0.875rem; }
.lien-fleche:hover { text-decoration: underline; }

/* Bandeau d'état */
.etat { display: flex; align-items: center; gap: 1.1rem; padding: 1.4rem 1.5rem; border-radius: 10px; border: 1px solid transparent; }
.etat.ok { background: var(--ok-fond); border-color: color-mix(in srgb, var(--ok) 25%, transparent); }
.etat.degrade { background: var(--degrade-fond); border-color: color-mix(in srgb, var(--degrade) 30%, transparent); }
.etat.panne { background: var(--panne-fond); border-color: color-mix(in srgb, var(--panne) 30%, transparent); }
.etat-icone { flex: none; width: 2.75rem; height: 2.75rem; border-radius: 50%; display: grid; place-items: center; color: #fff; }
.ok .etat-icone { background: var(--ok); }
.degrade .etat-icone { background: var(--degrade); }
.panne .etat-icone { background: var(--panne); }
.etat-icone svg { width: 1.4rem; height: 1.4rem; }
.etat h1 { margin: 0; color: var(--titre); font-size: clamp(1.25rem, 2.6vw, 1.6rem); line-height: 1.2; }
.etat p { margin: 0.2rem 0 0; font-size: 0.9375rem; }
.etat .maj { margin-left: auto; font-size: 0.8125rem; color: var(--discret); white-space: nowrap; align-self: flex-start; }

/* Agents */
.agents { list-style: none; margin: 0.6rem 0 0; padding: 0 1.4rem 0.6rem; }
.agent { display: grid; grid-template-columns: minmax(10rem, 14rem) 1fr; gap: 0.5rem 2rem; align-items: center; padding: 1rem 0; border-top: 1px solid var(--filet); }
.agent:first-child { border-top: 0; }
.agent-nom { color: var(--fort); font-weight: 700; }
.badge { display: inline-flex; align-items: center; gap: 0.4rem; margin-top: 0.2rem; font-size: 0.8125rem; font-weight: 700; }
.badge::before { content: ""; width: 0.55rem; height: 0.55rem; border-radius: 50%; background: currentColor; }
.badge.ok { color: var(--ok); }
.badge.degrade { color: var(--degrade); }
.badge.panne { color: var(--panne); }
.histo { min-width: 0; }
.histo-barres { display: grid; grid-template-columns: repeat(30, 1fr); gap: 3px; height: 2rem; position: relative; }
.histo-barres span { border-radius: 3px; background: var(--ok); opacity: .85; cursor: default; }
.histo-barres span.degrade { background: var(--degrade); opacity: 1; }
.histo-barres span.panne { background: var(--panne); opacity: 1; }
.histo-barres span:hover { opacity: 1; outline: 2px solid var(--titre); outline-offset: 1px; }
.histo-legende { display: flex; justify-content: space-between; margin-top: 0.35rem; font-size: 0.75rem; color: var(--discret); }
.legende-couleurs { display: flex; flex-wrap: wrap; gap: 0.4rem 1.1rem; padding: 0 1.4rem 1.1rem; font-size: 0.75rem; color: var(--discret); }
.legende-couleurs span::before { content: ""; display: inline-block; width: 0.6rem; height: 0.6rem; border-radius: 2px; margin-right: 0.35rem; vertical-align: -1px; }
.legende-couleurs .l-ok::before { background: var(--ok); }
.legende-couleurs .l-degrade::before { background: var(--degrade); }
.legende-couleurs .l-panne::before { background: var(--panne); }
.bulle { position: absolute; bottom: calc(100% + 8px); transform: translateX(-50%); background: var(--navy); color: #fff; font-size: 0.75rem; line-height: 1.35; padding: 0.4rem 0.6rem; border-radius: 6px; white-space: nowrap; pointer-events: none; z-index: 3; }

/* Indicateurs */
.indicateurs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.indic { padding: 1.2rem 1.4rem; }
.indic h3 { margin: 0; font-size: 0.875rem; color: var(--discret); font-weight: 700; }
.indic .valeur { display: flex; align-items: baseline; gap: 0.5rem; margin-top: 0.4rem; }
.indic .nombre { font-size: 2.25rem; line-height: 1; font-weight: 700; color: var(--titre); font-variant-numeric: tabular-nums; }
.indic .unite { color: var(--discret); font-size: 0.9375rem; }
.indic .verdict { margin: 0.55rem 0 0; font-size: 0.8125rem; }
.verdict.bon { color: var(--ok); font-weight: 700; }
.verdict.attention { color: var(--degrade); font-weight: 700; }
.jauge { margin-top: 0.7rem; height: 6px; border-radius: 3px; background: var(--vide); overflow: hidden; }
.jauge span { display: block; height: 100%; background: var(--mint-fonce); border-radius: 3px; }

.pile { display: grid; gap: 1rem; }

/* Tickets */
.lignes { list-style: none; margin: 0.5rem 0 0; padding: 0; }
.lignes li + li { border-top: 1px solid var(--filet); }
.ligne { all: unset; box-sizing: border-box; display: grid; grid-template-columns: 6rem minmax(0, 1fr) 11rem 9rem; gap: 0.25rem 1.25rem; align-items: center; width: 100%; padding: 0.9rem 1.4rem; cursor: pointer; }
.ligne:hover { background: var(--voile); }
.ligne:focus-visible { outline: 2px solid var(--mint-fonce); outline-offset: -2px; }
.ligne .num { font-weight: 700; color: var(--titre); font-variant-numeric: tabular-nums; font-size: 0.875rem; }
.ligne .objet { color: var(--fort); font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ligne .meta { display: block; font-size: 0.8125rem; color: var(--discret); font-weight: 400; }
.ligne .quand { font-size: 0.8125rem; color: var(--discret); text-align: right; }
.statut { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.8125rem; font-weight: 700; padding: 0.15rem 0.6rem; border-radius: 999px; white-space: nowrap; justify-self: start; }
.statut.analyse { background: var(--vide); color: var(--titre); }
.statut.cours { background: color-mix(in srgb, var(--mint) 18%, transparent); color: var(--mint-texte); }
.statut.resolu { background: var(--ok-fond); color: var(--ok); }
.statut.tiers { background: var(--degrade-fond); color: var(--degrade); }
.grav { display: inline-block; width: 0.5rem; height: 0.5rem; border-radius: 50%; margin-right: 0.35rem; vertical-align: 1px; }
.grav.g1 { background: var(--panne); }
.grav.g2 { background: var(--degrade); }
.grav.g3 { background: var(--mint-clair); border: 1px solid var(--mint-fonce); }
.vide-msg { padding: 1.5rem 1.4rem 1.6rem; margin: 0; color: var(--discret); }

.barre-outils { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; padding: 1rem 1.4rem 0; }
.segments { display: inline-flex; background: var(--vide); border-radius: 8px; padding: 3px; }
.segments button { border: 0; background: none; padding: 0.35rem 0.9rem; border-radius: 6px; cursor: pointer; color: var(--discret); font-weight: 700; font-size: 0.875rem; }
.segments button[aria-pressed="true"] { background: var(--surface); color: var(--titre); box-shadow: var(--ombre); }
.recherche { flex: 1 1 14rem; display: flex; align-items: center; gap: 0.5rem; border: 1px solid var(--filet); border-radius: 8px; background: var(--surface); padding: 0 0.75rem; min-height: 2.4rem; }
.recherche svg { width: 1rem; height: 1rem; color: var(--discret); flex: none; }
.recherche input { border: 0; background: transparent; width: 100%; outline: none; padding: 0.35rem 0; color: var(--fort); }
.recherche:focus-within { outline: 2px solid var(--mint-fonce); outline-offset: 1px; }
.barre-outils select { border: 1px solid var(--filet); border-radius: 8px; background: var(--surface); padding: 0.45rem 0.6rem; color: var(--titre); }

/* Appel à l'action */
.aide { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; padding: 1.2rem 1.4rem; }
.aide p { margin: 0; color: var(--titre); font-weight: 700; }
.aide span { display: block; font-weight: 400; color: var(--discret); font-size: 0.875rem; }
.boutons { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.bouton { display: inline-flex; align-items: center; min-height: 2.5rem; padding: 0 1.1rem; border-radius: 8px; background: var(--mint); color: var(--navy); font-weight: 700; text-decoration: none; border: 0; cursor: pointer; }
.bouton:hover { background: var(--mint-clair); }
.bouton.second { background: var(--surface); color: var(--titre); border: 1px solid var(--filet); }
.bouton.second:hover { background: var(--voile); }

/* Rapport */
.rapport-tete { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.rapport-tete h1 { margin: 0; color: var(--titre); font-size: 1.5rem; }
.rapport-tete p { margin: 0.2rem 0 0; color: var(--discret); font-size: 0.9375rem; }
.grille-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.graph { position: relative; padding: 0.5rem 1.4rem 1.2rem; }
.graph svg { display: block; width: 100%; height: auto; overflow: visible; }
.graph text { fill: var(--discret); font-size: 11px; font-family: var(--police); }
.note-carte { margin: 0.2rem 1.4rem 0; font-size: 0.8125rem; color: var(--discret); }
.legende-graph { display: flex; flex-wrap: wrap; gap: 0.3rem 1rem; padding: 0.5rem 1.4rem 0; font-size: 0.75rem; color: var(--discret); }
.legende-graph i { display: inline-block; width: 0.6rem; height: 0.6rem; border-radius: 2px; margin-right: 0.35rem; vertical-align: -1px; }
.repartition { list-style: none; margin: 0; padding: 0.75rem 1.4rem 1.3rem; display: grid; gap: 0.7rem; }
.repartition li { display: grid; grid-template-columns: 9rem 1fr 2.5rem; gap: 0.75rem; align-items: center; font-size: 0.875rem; }
.repartition .rb { height: 8px; border-radius: 4px; background: var(--mint-fonce); min-width: 4px; }
.repartition .rv { text-align: right; font-weight: 700; color: var(--titre); font-variant-numeric: tabular-nums; }

/* Panneau de détail */
dialog.panneau { margin: 0 0 0 auto; height: 100%; max-height: 100%; width: min(100%, 30rem); padding: 0; border: 0; background: var(--surface); color: var(--texte); box-shadow: var(--ombre-panneau); }
dialog.panneau::backdrop { background: var(--voile-modal); }
@media (prefers-reduced-motion: no-preference) {
  dialog.panneau[open] { animation: glisse 200ms ease-out; }
  @keyframes glisse { from { transform: translateX(28px); opacity: .5; } to { transform: none; opacity: 1; } }
}
.panneau-corps { padding: calc(1.25rem + env(safe-area-inset-top, 0px)) 1.5rem calc(2rem + env(safe-area-inset-bottom, 0px)); }
.panneau-tete { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.panneau-tete .num { font-weight: 700; color: var(--discret); font-size: 0.875rem; }
.fermer { border: 1px solid var(--filet); background: var(--surface); border-radius: 8px; width: 2.25rem; height: 2.25rem; display: grid; place-items: center; cursor: pointer; color: var(--titre); }
.fermer svg { width: 1rem; height: 1rem; }
.panneau h2 { margin: 0.75rem 0 0.6rem; color: var(--titre); font-size: 1.375rem; line-height: 1.25; }
.panneau .faits { display: flex; flex-wrap: wrap; gap: 0.4rem 1rem; font-size: 0.875rem; color: var(--discret); }
.point { margin-top: 1.25rem; padding: 1rem 1.1rem; border-radius: 8px; background: var(--voile); border: 1px solid var(--filet); }
.point .petit { margin: 0 0 0.3rem; font-size: 0.8125rem; color: var(--discret); }
.point p:last-child { margin: 0; color: var(--fort); }
.panneau h3 { margin: 1.6rem 0 0.75rem; font-size: 0.9375rem; color: var(--titre); }
.frise { list-style: none; margin: 0; padding: 0; }
.frise li { position: relative; display: grid; grid-template-columns: 1.5rem minmax(0, 1fr); gap: 0.9rem; padding-bottom: 1.1rem; }
.frise .rond { width: 1.5rem; height: 1.5rem; border-radius: 50%; border: 2px solid var(--vide); background: var(--surface); display: grid; place-items: center; z-index: 1; }
.frise .rond svg { width: 0.8rem; height: 0.8rem; color: #fff; }
.frise li.fait .rond { background: var(--mint-fonce); border-color: var(--mint-fonce); }
.frise li.courant .rond { border-color: var(--mint-fonce); }
.frise li.courant .rond::after { content: ""; width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--mint-fonce); }
.frise li:not(:last-child)::before { content: ""; position: absolute; left: calc(0.75rem - 1px); top: 1.5rem; bottom: 0; width: 2px; background: var(--vide); }
.frise li.fait:not(:last-child)::before { background: var(--mint-fonce); }
.frise strong { display: block; color: var(--titre); }
.frise span { font-size: 0.875rem; color: var(--discret); }
.panneau-pied { margin-top: 1.5rem; padding-top: 1.1rem; border-top: 1px solid var(--filet); font-size: 0.875rem; }
.panneau-pied a { color: var(--mint-texte); font-weight: 700; }

.pied { padding: 0 0 2.5rem; font-size: 0.8125rem; color: var(--discret); }

@media (max-width: 860px) {
  .onglets { margin-left: 0; }
  .compte .nom { display: none; }
  .indicateurs, .grille-2 { grid-template-columns: 1fr; }
  .ligne { grid-template-columns: 1fr auto; }
  .ligne .num { grid-column: 1; }
  .ligne .quand { grid-column: 2; grid-row: 1; }
  .ligne .objet-bloc { grid-column: 1 / -1; }
  .ligne .statut { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
  .entete .conteneur { flex-wrap: wrap; gap: 0 1rem; padding-top: 0.5rem; }
  .onglets { order: 3; width: 100%; overflow-x: auto; }
  .onglets a { min-height: 2.75rem; padding: 0 0.6rem; }
  .onglets a[aria-current="page"]::after { left: 0.6rem; right: 0.6rem; }
  .marque .sep, .marque .client { display: none; }
  .agent { grid-template-columns: 1fr; }
  .etat { flex-wrap: wrap; }
  .etat .maj { margin-left: 0; width: 100%; }
}

/* Logo selon le thème */
.marque .logo-blanc { display: none; }
@media (prefers-color-scheme: dark) { .marque .logo-noir { display: none; } .marque .logo-blanc { display: block; } }

/* Légendes des graphiques */
.c-panne { background: var(--panne); }
.c-degrade { background: var(--degrade); }
.c-question { background: var(--mint-clair); }
.c-conso { background: var(--mint-fonce); }
.c-capacite { background: none; border-top: 2px dashed var(--discret); border-radius: 0; height: 0 !important; }

/* Chargement et erreurs */
.chargement { padding: 4rem 0; color: var(--discret); }
.erreur h1 { color: var(--titre); font-size: 1.5rem; margin: 0 0 0.5rem; }
.erreur p { margin: 0 0 1.25rem; max-width: 60ch; }
.erreur { padding: 3rem 0; }
.contrat-choix { border: 1px solid var(--filet); border-radius: 8px; background: var(--surface); padding: 0.3rem 0.5rem; color: var(--titre); font-weight: 700; max-width: 16rem; }

/* Impression du rapport */
@media print {
  .entete, .pied, #exporter, .aide { display: none !important; }
  body { background: #fff; }
  .carte { box-shadow: none; break-inside: avoid; }
}

/* Pages d'accès refusé et de déconnexion */
.message-etat { padding: 4rem 0; }
.message-etat h1 { color: var(--titre); font-size: 1.75rem; line-height: 1.2; margin: 0 0 1rem; max-width: 26ch; }
.message-etat p { max-width: 60ch; margin: 0 0 1.5rem; }

/* Logo des pages annexes (accès refusé, déconnexion) */
.entete img { height: 1.5rem; width: auto; display: block; }
.entete .logo-blanc { display: none; }
@media (prefers-color-scheme: dark) { .entete .logo-clair { display: none; } .entete .logo-blanc { display: block; } }

/* Historique des points de situation */
.historique-points h3 { margin: 1.5rem 0 0.75rem; font-size: 0.9375rem; color: var(--titre); }
.points { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.6rem; }
.points li { padding: 0.85rem 1rem; border-radius: 8px; border: 1px solid var(--filet); background: var(--surface); }
.points li.recent { background: var(--voile); }
.point-tete { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.4rem 0.75rem; margin-bottom: 0.35rem; }
.point-date { font-size: 0.8125rem; color: var(--discret); font-weight: 700; }
.point-tete .statut { font-size: 0.75rem; padding: 0.05rem 0.5rem; }
.point-texte { margin: 0; color: var(--fort); white-space: pre-line; }

/* Récapitulatif de la déclaration */
.declaration { margin: 0; display: grid; grid-template-columns: 9rem minmax(0, 1fr); gap: 0.45rem 1rem; padding: 1rem 1.1rem; border: 1px solid var(--filet); border-radius: 8px; }
.declaration dt { color: var(--discret); font-size: 0.875rem; }
.declaration dd { margin: 0; color: var(--fort); overflow-wrap: anywhere; white-space: pre-line; }
@media (max-width: 640px) { .declaration { grid-template-columns: 1fr; gap: 0.1rem; } .declaration dd { margin-bottom: 0.5rem; } }

/* Captures jointes par le client */
.captures { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.captures a { display: block; border: 1px solid var(--filet); border-radius: 6px; overflow: hidden; }
.captures img { display: block; width: 8rem; height: 6rem; object-fit: cover; background: var(--vide); }
.captures a:hover { border-color: var(--mint-fonce); }
.capture-absente { font-size: 0.8125rem; color: var(--discret); }

.grav.gb { background: var(--navy); }
@media (prefers-color-scheme: dark) { .grav.gb { background: var(--mint-clair); } }
.note-agents { margin: -0.4rem 1.4rem 1.1rem; font-size: 0.75rem; color: var(--discret); }
