/* =====================================================================
   AEGIS — feuille de style commune
   Deux thèmes (sombre / clair) entièrement pilotés par variables CSS.
   Aucune police externe : pile système, chiffres en monospace.
   ===================================================================== */

:root {
    --police: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --police-mono: ui-monospace, "Cascadia Mono", "SF Mono", Consolas, "Liberation Mono", monospace;
    --rayon: 6px;
    --rayon-petit: 4px;
    --espace: 1rem;
    --transition: 120ms ease;

    /* Couleurs par service (surchargées par /s/{slug}/styles.css) */
    --svc-pompiers: #d0342c;
    --svc-samu: #1f9d6b;
    --svc-police: #2f6fd6;
    --svc-gendarmerie: #5363b8;
    --svc-police-municipale: #d99a1e;

    /* Priorités et états */
    --etat-ok: #2e9d5b;
    --etat-alerte: #d99a1e;
    --etat-danger: #d0342c;
    --etat-info: #2f6fd6;
}

/* Thème sombre (par défaut) : bleu nuit du logo */
:root,
[data-theme="sombre"] {
    color-scheme: dark;
    --fond: #07101c;
    --surface: #0d1828;
    --surface-2: #122034;
    --surface-3: #1a2b44;
    --bordure: #213551;
    --bordure-forte: #304a6e;
    --texte: #dce5f1;
    --texte-doux: #8b9db6;
    --accent: #2f6fd6;
    --accent-texte: #ffffff;
    --danger: #e0443b;
    --focus: #6aa2ff;
    --ombre: 0 1px 2px rgb(0 0 0 / 0.4);
}

[data-theme="clair"] {
    color-scheme: light;
    --fond: #edf1f6;
    --surface: #ffffff;
    --surface-2: #f4f7fb;
    --surface-3: #e5ebf3;
    --bordure: #d1dae6;
    --bordure-forte: #aab8cb;
    --texte: #0f1b2c;
    --texte-doux: #56667c;
    --accent: #1d56b8;
    --accent-texte: #ffffff;
    --danger: #c22a22;
    --focus: #1d56b8;
    --ombre: 0 1px 2px rgb(15 27 44 / 0.08);
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--fond);
    color: var(--texte);
    font: 15px/1.5 var(--police);
}

a { color: var(--accent); text-underline-offset: 2px; }
[data-theme="sombre"] a { color: #7fb0ff; }
img { max-width: 100%; height: auto; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .6em; }
h1 { font-size: 1.6rem; font-weight: 650; letter-spacing: -0.01em; }
h2 { font-size: 1.15rem; font-weight: 600; }
h3 { font-size: 1rem; font-weight: 600; }
p { margin: 0 0 .8em; }
code, .mono { font-family: var(--police-mono); font-size: .9em; }
code { background: var(--surface-3); padding: .05em .35em; border-radius: var(--rayon-petit); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

[hidden] { display: none !important; }
.texte-doux { color: var(--texte-doux); }
.visuellement-cache {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.lien-evitement { position: absolute; left: -9999px; }
.lien-evitement:focus { left: 1rem; top: 1rem; z-index: 100; background: var(--surface); padding: .5rem 1rem; }

/* ---------- Boutons ---------- */
.bouton {
    display: inline-flex; align-items: center; justify-content: center; gap: .4em;
    min-height: 36px; padding: .4em .95em;
    border: 1px solid var(--bordure-forte); border-radius: var(--rayon);
    background: var(--surface-2); color: var(--texte);
    font: inherit; font-weight: 550; text-decoration: none; cursor: pointer;
    transition: background var(--transition), border-color var(--transition);
}
.bouton:hover { background: var(--surface-3); }
[data-theme] a.bouton { color: var(--texte); }
.bouton--principal, [data-theme] a.bouton--principal { background: var(--accent); border-color: var(--accent); color: var(--accent-texte); }
.bouton--principal:hover { filter: brightness(1.08); background: var(--accent); }
.bouton--danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 55%, transparent); background: transparent; }
.bouton--danger:hover { background: color-mix(in srgb, var(--danger) 12%, transparent); }
.bouton--discret { background: transparent; border-color: transparent; color: var(--texte-doux); }
.bouton--discret:hover { color: var(--texte); background: var(--surface-2); }
.bouton--discord, [data-theme] a.bouton--discord { background: #5865f2; border-color: #5865f2; color: #fff; }
.bouton--petit { min-height: 28px; padding: .15em .6em; font-size: .85rem; }
.bouton--grand { min-height: 46px; padding: .6em 1.4em; font-size: 1.02rem; }
.bouton--large { width: 100%; }
.bouton--icone { width: 36px; padding: 0; }
.bouton:disabled { opacity: .5; cursor: not-allowed; }

/* Icône du thème : lune / soleil dessinés en CSS */
.icone-theme { width: 16px; height: 16px; border-radius: 50%; display: inline-block; }
[data-theme="sombre"] .icone-theme { box-shadow: inset -5px -3px 0 0 var(--texte); }
[data-theme="clair"] .icone-theme { background: var(--etat-alerte); box-shadow: 0 0 0 3px color-mix(in srgb, var(--etat-alerte) 35%, transparent); }

/* ---------- Formulaires ---------- */
.formulaire { display: grid; gap: .9rem; }
.formulaire label { display: grid; gap: .3rem; font-weight: 550; font-size: .92rem; }
.formulaire label small { font-weight: 400; color: var(--texte-doux); }
input[type="text"], input[type="email"], input[type="password"], input[type="url"], input[type="number"],
input[type="search"], input[type="file"], input[type="datetime-local"], input[type="date"], select, textarea {
    width: 100%; min-height: 38px; padding: .45em .65em;
    border: 1px solid var(--bordure-forte); border-radius: var(--rayon);
    background: var(--surface-2); color: var(--texte); font: inherit;
}
input[type="color"] { width: 48px; height: 34px; padding: 2px; border: 1px solid var(--bordure-forte); border-radius: var(--rayon); background: var(--surface-2); }
input:focus, select:focus, textarea:focus { border-color: var(--focus); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 25%, transparent); }
.formulaire label.case { display: flex; gap: .6rem; align-items: flex-start; font-weight: 400; }
.case input { margin-top: .25em; width: 18px; height: 18px; flex: none; accent-color: var(--accent); }
.champ-court { max-width: 7.5rem; }
.champ-prefixe { display: flex; align-items: stretch; }
.champ-prefixe > span {
    display: flex; align-items: center; padding: 0 .6em; font-family: var(--police-mono); font-size: .85rem;
    color: var(--texte-doux); background: var(--surface-3); border: 1px solid var(--bordure-forte); border-right: 0;
    border-radius: var(--rayon) 0 0 var(--rayon); white-space: nowrap;
}
.champ-prefixe input { border-radius: 0 var(--rayon) var(--rayon) 0; }
.formulaire--ligne { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); align-items: end; }
.formulaire-ligne { display: flex; gap: .4rem; align-items: center; }
.actions { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
.bloc-code { font-family: var(--police-mono); font-size: .85rem; }
.copie { display: flex; gap: .5rem; }
.copie input { font-family: var(--police-mono); font-size: .9rem; }

/* ---------- Messages flash ---------- */
.flashs { display: grid; gap: .5rem; margin-bottom: 1.2rem; }
.flash {
    display: flex; justify-content: space-between; gap: 1rem; align-items: center;
    padding: .65rem .9rem; border-radius: var(--rayon); border: 1px solid; border-left-width: 4px;
    background: var(--surface);
}
.flash--succes { border-color: var(--etat-ok); }
.flash--erreur { border-color: var(--etat-danger); }
.flash--alerte { border-color: var(--etat-alerte); }
.flash--info { border-color: var(--etat-info); }
.flash__fermer { background: none; border: 0; color: var(--texte-doux); font-size: 1.3rem; line-height: 1; cursor: pointer; }

/* ---------- Structure des pages publiques ---------- */
.entete, .barre-app {
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    padding: .6rem clamp(1rem, 3vw, 2rem);
    background: var(--surface); border-bottom: 1px solid var(--bordure);
}
.marque { display: flex; align-items: center; gap: .6rem; font-weight: 750; letter-spacing: .08em; text-decoration: none; }
[data-theme] .marque { color: var(--texte); }
.marque img { border-radius: 50%; }
.entete__nav, .barre-app__nav, .barre-app__compte { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.entete__nav > a:not(.bouton), .barre-app__nav a { color: var(--texte-doux); text-decoration: none; font-weight: 550; }
.entete__nav > a[aria-current], .barre-app__nav a[aria-current], .entete__nav > a:not(.bouton):hover, .barre-app__nav a:hover { color: var(--texte); }
.principal { flex: 1; width: 100%; max-width: 1180px; margin: 0 auto; padding: clamp(1rem, 3vw, 2rem); }
.principal--etroit { max-width: 720px; }
.section-etroite { max-width: 760px; margin: 0 auto; }
.section-auth { max-width: 440px; margin: 2rem auto; }
.liens-auth { display: flex; justify-content: space-between; margin-top: 1rem; font-size: .92rem; }
.separateur { display: flex; align-items: center; gap: .8rem; color: var(--texte-doux); font-size: .85rem; margin: 1.2rem 0; }
.separateur::before, .separateur::after { content: ""; flex: 1; border-top: 1px solid var(--bordure); }

.pied { border-top: 1px solid var(--bordure); background: var(--surface); font-size: .85rem; color: var(--texte-doux); }
.pied__contenu { max-width: 1180px; margin: 0 auto; padding: 1rem clamp(1rem, 3vw, 2rem); display: flex; flex-wrap: wrap; gap: .8rem 2rem; justify-content: space-between; }
.pied__liens { display: flex; flex-wrap: wrap; gap: 1rem; }
[data-theme] .pied__liens a { color: var(--texte-doux); }

/* Accueil */
.accroche { display: grid; grid-template-columns: 1fr auto; gap: 2rem; align-items: center; padding: 2rem 0 3rem; }
.accroche h1 { font-size: clamp(1.7rem, 3.4vw, 2.5rem); max-width: 22ch; }
.accroche__intro { font-size: 1.08rem; color: var(--texte-doux); max-width: 60ch; }
.accroche__actions { display: flex; flex-wrap: wrap; gap: .8rem; margin-top: 1.4rem; }
.accroche__logo { width: clamp(180px, 26vw, 320px); border-radius: 50%; }
.surtitre { font-family: var(--police-mono); letter-spacing: .12em; text-transform: uppercase; font-size: .8rem; color: var(--texte-doux); }
.grille-services { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 1rem; margin-bottom: 2.5rem; }
.carte-service { background: var(--surface); border: 1px solid var(--bordure); border-top: 3px solid var(--svc); border-radius: var(--rayon); padding: 1.1rem; }
.carte-service__numero { font-family: var(--police-mono); font-weight: 700; font-size: 1.6rem; color: var(--svc); }
.bandeau-info { background: var(--surface); border: 1px solid var(--bordure); border-radius: var(--rayon); padding: 1.4rem; }
.liste-points { padding-left: 1.2rem; margin: 0 0 1rem; }
.liste-points li { margin-bottom: .35rem; }

/* Tarifs */
.carte--offre { text-align: left; }
.prix { font-size: 2.4rem; font-weight: 700; margin: .2rem 0; font-family: var(--police-mono); }
.prix small { font-size: .9rem; font-weight: 400; color: var(--texte-doux); font-family: var(--police); }

/* Documents légaux */
.document-legal { max-width: 780px; margin: 0 auto; }
.document-legal h1 { margin-top: .4em; }
.document-legal h2 { margin-top: 1.8em; padding-top: .6em; border-top: 1px solid var(--bordure); }
.document-legal h3 { margin-top: 1.4em; }
.document-legal blockquote { margin: 1rem 0; padding: .6rem 1rem; border-left: 3px solid var(--accent); background: var(--surface); }

/* ---------- Espace connecté ---------- */
.compte-lien { display: flex; align-items: center; gap: .5rem; text-decoration: none; }
[data-theme] .compte-lien { color: var(--texte); }
.avatar { width: 28px; height: 28px; border-radius: 50%; }
.avatar--initiale { display: inline-flex; align-items: center; justify-content: center; background: var(--surface-3); font-weight: 700; font-size: .85rem; }
.cadre-app { flex: 1; display: flex; width: 100%; }
.principal--app { max-width: 1280px; min-width: 0; }
.menu-lateral {
    width: 250px; flex: none; padding: 1rem .8rem; background: var(--surface); border-right: 1px solid var(--bordure);
}
.menu-lateral nav { display: grid; gap: 2px; }
.menu-lateral nav a { display: flex; align-items: center; gap: .55rem; padding: .45rem .6rem; border-radius: var(--rayon-petit); text-decoration: none; font-weight: 500; }
[data-theme] .menu-lateral nav a { color: var(--texte-doux); }
[data-theme] .menu-lateral nav a:hover, [data-theme] .menu-lateral nav a[aria-current] { background: var(--surface-3); color: var(--texte); }
.menu-lateral__titre { margin: 1rem .6rem .3rem; font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; color: var(--texte-doux); }
.menu-lateral__serveur { display: flex; align-items: center; gap: .7rem; padding: .3rem .4rem 1rem; border-bottom: 1px solid var(--bordure); margin-bottom: .6rem; }
.menu-lateral__serveur img, .marque img { border-radius: 50%; }
.menu-lateral__serveur div { display: grid; }
.menu-lateral__serveur small { color: var(--texte-doux); }

.titre-page { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1.2rem; }
.titre-page h1 { margin: 0; }
.titre-section { margin: 1.6rem 0 .8rem; }
.carte { background: var(--surface); border: 1px solid var(--bordure); border-radius: var(--rayon); padding: 1.2rem; box-shadow: var(--ombre); margin-bottom: 1rem; }
.carte--accent { border-left: 4px solid var(--accent); }
.carte--formulaire { max-width: 640px; }
.grille-cartes + .grille-2, section + .grille-2 { margin-top: 1.2rem; }
.carte h3 { margin-top: 1.4rem; }
.grille-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1rem; }
.grille-cartes { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.etat-vide { text-align: center; padding: 2.5rem 1rem; }
.carte-serveur, .carte-console { display: flex; align-items: center; gap: .9rem; text-decoration: none; margin: 0; transition: border-color var(--transition); }
[data-theme] .carte-serveur, [data-theme] .carte-console { color: var(--texte); }
a.carte-serveur:hover, a.carte-console:hover { border-color: var(--bordure-forte); }
.carte-serveur img { border-radius: var(--rayon-petit); }
.carte-serveur__texte, .carte-console > span:last-child { display: grid; flex: 1; }
.carte-serveur small, .carte-console small { color: var(--texte-doux); }
.carte-serveur__initiale { width: 48px; height: 48px; display: flex; align-items: center; justify-content: center; border-radius: var(--rayon-petit); background: var(--surface-3); font-weight: 700; font-size: 1.3rem; }
.carte-console { border-left: 4px solid var(--svc); }
.carte-console--inactive { opacity: .55; }

/* Pastille de service (numéro d'appel) */
.svc-pompiers { --svc: var(--svc-pompiers); }
.svc-samu { --svc: var(--svc-samu); }
.svc-police { --svc: var(--svc-police); }
.svc-gendarmerie { --svc: var(--svc-gendarmerie); }
.svc-police-municipale { --svc: var(--svc-police-municipale); }
.pastille-service {
    display: inline-flex; align-items: center; justify-content: center; min-width: 30px; height: 24px; padding: 0 .35em;
    border-radius: var(--rayon-petit); background: var(--svc, var(--surface-3)); color: #fff;
    font-family: var(--police-mono); font-weight: 700; font-size: .8rem;
}
.pastille-service--grande { min-width: 46px; height: 38px; font-size: 1.05rem; }

.etiquette { display: inline-block; padding: .05em .5em; border-radius: 99px; font-size: .75rem; font-weight: 600; background: var(--surface-3); color: var(--texte-doux); vertical-align: middle; }
.etiquette--alerte { background: color-mix(in srgb, var(--etat-alerte) 20%, transparent); color: var(--etat-alerte); }

/* Étapes (assistant, installateur) */
.etapes { display: flex; flex-wrap: wrap; gap: .4rem 1.4rem; list-style: none; padding: 0; margin: 0 0 1.2rem; color: var(--texte-doux); font-weight: 550; }
.etapes__courante { color: var(--texte); border-bottom: 2px solid var(--accent); }
.etapes__faite { color: var(--etat-ok); }
.choix-services { display: grid; gap: .6rem; }
.choix-service { display: flex !important; grid-template-columns: none !important; flex-direction: row; align-items: center; gap: .8rem !important; padding: .7rem .9rem; border: 1px solid var(--bordure); border-left: 4px solid var(--svc); border-radius: var(--rayon); cursor: pointer; }
.choix-service input { width: 18px; height: 18px; accent-color: var(--svc); }
.choix-service span:last-child { display: grid; font-weight: 400; }
.choix-service small { color: var(--texte-doux); }
.recapitulatif { display: grid; grid-template-columns: max-content 1fr; gap: .4rem 1.2rem; margin: 0 0 1rem; }
.recapitulatif dt { color: var(--texte-doux); }
.recapitulatif dd { margin: 0; font-weight: 550; }
.apercu-logo { display: block; margin-bottom: 1rem; border-radius: var(--rayon); background: var(--surface-2); }

/* Tableaux */
.tableau-conteneur { position: relative; overflow-x: auto; border: 1px solid var(--bordure); border-radius: var(--rayon); background: var(--surface); margin-bottom: 1rem; }
.tableau { width: 100%; border-collapse: collapse; font-size: .92rem; }
.tableau th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--texte-doux); font-weight: 600; background: var(--surface-2); }
.tableau th, .tableau td { padding: .55rem .7rem; border-bottom: 1px solid var(--bordure); vertical-align: middle; }
.tableau tr:last-child td { border-bottom: 0; }
.tableau--dense th, .tableau--dense td { padding: .4rem .6rem; }
.tableau select, .tableau input[type="text"] { min-height: 32px; padding: .25em .45em; width: 100%; min-width: 6rem; }
.cellule-actions > * { display: inline-block; vertical-align: middle; margin: .15rem .3rem .15rem 0; }
.cellule-actions > *:last-child { margin-right: 0; }
.ligne-suspendue td { opacity: .6; }
.details-json { font-family: var(--police-mono); font-size: .78rem; color: var(--texte-doux); max-width: 340px; word-break: break-all; }
.pagination { display: flex; gap: .6rem; }
.recherche { display: flex; gap: .4rem; }
.grille-chiffres { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.chiffre { display: grid; margin: 0; }
.chiffre span { font-family: var(--police-mono); font-size: 2rem; font-weight: 700; }
.chiffre small { color: var(--texte-doux); }

/* Installateur */
.install-entete { display: flex; gap: 1rem; align-items: center; margin-bottom: 1.4rem; }
.install-entete h1 { margin: 0; }
.controles { list-style: none; padding: 0; display: grid; gap: .35rem; }
.controle__etat { display: inline-block; width: 1.4em; font-weight: 700; }
.controle--ok .controle__etat { color: var(--etat-ok); }
.controle--ko .controle__etat { color: var(--etat-danger); }
.controle--alerte .controle__etat { color: var(--etat-alerte); }

/* Erreurs */
.page-erreur { text-align: center; padding: 3rem 0; }
.code-erreur { font-family: var(--police-mono); font-size: 3.5rem; font-weight: 700; color: var(--texte-doux); margin: 0; }

/* ---------- Mobile ---------- */
@media (max-width: 860px) {
    .accroche { grid-template-columns: 1fr; }
    .accroche__logo { order: -1; width: 160px; }
    .cadre-app { flex-direction: column; }
    .menu-lateral { width: 100%; border-right: 0; border-bottom: 1px solid var(--bordure); }
    .menu-lateral nav { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
    .menu-lateral__titre { grid-column: 1 / -1; }
    .compte-lien__nom { display: none; }
    .barre-app { flex-wrap: wrap; }
}
@media (max-width: 520px) {
    .entete { flex-wrap: wrap; }
    .entete__nav { gap: .6rem; }
    .recapitulatif { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ---------- Bandeau d'état de l'abonnement ---------- */
.bandeau-acces {
    display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem 1rem; align-items: center;
    padding: .55rem .9rem; margin-bottom: 1rem; border-radius: var(--rayon); font-weight: 550;
    background: color-mix(in srgb, var(--etat-alerte) 16%, var(--surface)); border: 1px solid var(--etat-alerte);
}
.bandeau-acces--lecture_seule, .bandeau-acces--suspendu, .bandeau-acces--aucun {
    background: color-mix(in srgb, var(--etat-danger) 14%, var(--surface)); border-color: var(--etat-danger);
}
.bandeau-acces--complet { background: var(--surface); border-color: var(--bordure-forte); font-weight: 400; }
.page-console .bandeau-acces { margin: 0; border-radius: 0; border-width: 0 0 1px; }
.etiquette--ok { background: color-mix(in srgb, var(--etat-ok) 20%, transparent); color: var(--etat-ok); }
.etiquette--info { background: color-mix(in srgb, var(--etat-info) 18%, transparent); color: var(--etat-info); }

/* ---------- Administration opérationnelle (catalogues, unités) ---------- */
.onglets { display: flex; flex-wrap: wrap; gap: .3rem; margin: 1rem 0 1.4rem; border-bottom: 1px solid var(--bordure); }
.onglet {
    display: inline-flex; align-items: center; gap: .45rem; padding: .45rem .8rem; margin-bottom: -1px;
    border: 1px solid transparent; border-radius: var(--rayon) var(--rayon) 0 0; color: var(--texte-doux); text-decoration: none; font-weight: 600;
}
.onglet[aria-current="page"] { background: var(--surface); border-color: var(--bordure); border-bottom-color: var(--surface); color: var(--texte); }
.section-catalogue { margin-bottom: 2rem; }
.section-catalogue .titre-section small { font-weight: 400; }
.ligne-ajout td { background: var(--surface-2); }
.tableau input[type="color"] { width: 44px; height: 32px; padding: 2px; }
.etiquette-statut {
    display: inline-block; padding: .1em .55em; border-radius: var(--rayon-petit); font-size: .8rem; font-weight: 600;
    background: color-mix(in srgb, var(--couleur, #6b7a90) 22%, transparent); border-left: 4px solid var(--couleur, #6b7a90);
}

/* ---------- Zones de compétence (Phase 4) ---------- */
.zones-disposition { display: grid; grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); gap: 1rem; align-items: start; }
.zones-carte { height: 460px; border: 1px solid var(--bordure); border-radius: var(--rayon-petit); background:
    linear-gradient(var(--bordure) 1px, transparent 1px) 0 0 / 40px 40px,
    linear-gradient(90deg, var(--bordure) 1px, transparent 1px) 0 0 / 40px 40px, var(--surface-2); }
.zones-carte.carte-tactique--fond { background: #0a1220; }
.zones-carte.carte-tactique--placement { cursor: crosshair; outline: 2px dashed var(--accent, #2f6fd6); outline-offset: -3px; }
.zones-carte.carte-tactique--placement.leaflet-grab, .zones-carte.carte-tactique--placement .leaflet-interactive { cursor: crosshair; }
.zones-outils { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: .5rem; }
.zones-outils select { max-width: 18rem; }
.zones-liste { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 1rem; }
.zone-fiche h3 { margin-top: 0; }
.zone-fiche textarea { font-size: .85rem; }
@media (max-width: 900px) { .zones-disposition { grid-template-columns: 1fr; } .zones-carte { height: 320px; } }
.zones-carte.leaflet-container { background:
    linear-gradient(var(--bordure) 1px, transparent 1px) 0 0 / 40px 40px,
    linear-gradient(90deg, var(--bordure) 1px, transparent 1px) 0 0 / 40px 40px, var(--surface-2); }
.zones-carte.leaflet-container.carte-tactique--fond { background: #0a1220; }

/* ---------- Terminal embarqué : choix de l'unité (Phase 5) ---------- */
.grille-unites-terminal { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: .6rem; margin-bottom: 1.4rem; }
.grille-unites-terminal form { margin: 0; }
.choix-terminal {
    display: grid; gap: .25rem; width: 100%; height: 100%; text-align: left; font: inherit; color: var(--texte); cursor: pointer;
    border-left: 6px solid var(--couleur, var(--bordure));
}
.choix-terminal strong { font-family: var(--police-mono); font-size: 1.1rem; }
.choix-terminal.est-selectionne { outline: 2px solid var(--accent); }

/* Liaison jeu : touches du boîtier de statut */
.grille-touches { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .5rem; }
.grille-touches label { display: flex !important; align-items: center; gap: .5rem; font-weight: 400; }
.grille-touches select { flex: 1; min-width: 0; }
.touche-ber { display: inline-flex; align-items: center; justify-content: center; width: 2rem; height: 2rem; flex: none; border-radius: 6px;
    background: var(--surface-3); border: 1px solid var(--bordure); font-family: var(--police-mono); font-weight: 700; }
.liste-simple { margin: .5rem 0 0; padding-left: 1.2rem; display: grid; gap: .2rem; }

/* Fiche de garde */
.garde__colonnes { display: grid; grid-template-columns: minmax(280px, 1fr) 2fr; gap: 1.4rem; align-items: start; }
.garde h3 { margin-top: 0; display: flex; align-items: center; gap: .5rem; }
.garde__personnels { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.garde__personnels li { display: grid; grid-template-columns: auto 1fr; gap: .2rem .7rem; align-items: center; padding: .55rem .7rem; border: 1px solid var(--bordure); border-radius: var(--rayon); background: var(--surface-2); }
.garde__personnels form { grid-column: 1 / -1; }
.garde__personnels select { flex: 1; }
.garde__matricule { font-weight: 700; }
.garde__nom { display: flex; flex-direction: column; }
.garde__equipage { list-style: none; margin: 0; padding: 0; }
.garde__equipage li { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.garde__equipage form { margin-left: auto; }
.garde__vide td:first-child { opacity: .7; }
.pastille-statut { display: inline-block; width: .7rem; height: .7rem; border-radius: 50%; background: var(--couleur, #6b7a90); vertical-align: middle; }
@media (max-width: 900px) { .garde__colonnes { grid-template-columns: 1fr; } }
.identite-jeu { display: flex; align-items: center; gap: 1.4rem; flex-wrap: wrap; }
.identite-jeu > div { display: flex; flex-direction: column; }
.identite-jeu p { margin: 0; flex: 1; min-width: 260px; }
.identite-jeu__matricule { font-size: 1.8rem; letter-spacing: .08em; }
.identite-jeu form { display: flex; align-items: center; gap: .4rem; }

/* Statistiques */
.graphe { display: block; width: 100%; height: auto; }
.graphe__barre { fill: var(--accent); }
.graphe__barre:hover { fill: var(--accent-survol, var(--accent)); opacity: .8; }
.graphe__axe { stroke: var(--bordure-forte); stroke-width: 1; }
.graphe__texte { fill: var(--texte-doux); font-size: 11px; font-family: var(--police-mono); }
.classement { width: 100%; border-collapse: collapse; }
.classement th { text-align: left; font-weight: 400; padding: .2rem .6rem .2rem 0; width: 40%; overflow-wrap: anywhere; }
.classement td { padding: .2rem 0; }
.classement__barre { display: block; width: 100%; height: .7rem; }
.classement__barre rect { fill: var(--accent); }
.classement__valeur { width: 3.5rem; text-align: right; font-family: var(--police-mono); }

/* Webhooks, support */
.groupe-boutons { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .8rem; }
.formulaire fieldset { border: 1px solid var(--bordure); border-radius: 8px; padding: .6rem .9rem; display: grid; gap: .35rem; }
.formulaire legend { padding: 0 .3rem; color: var(--texte-doux); }
.fil-support { list-style: none; margin: 0 0 1rem; padding: 0; display: grid; gap: .8rem; }
.fil-support li { border: 1px solid var(--bordure); border-radius: 8px; padding: .7rem .9rem; }
.fil-support li.equipe { border-color: var(--accent); }
.fil-support header { display: flex; justify-content: space-between; gap: 1rem; color: var(--texte-doux); font-size: .85rem; margin-bottom: .35rem; }
.fil-support p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }

/* =====================================================================
   Page affichée dans une fenêtre du bureau : la fenêtre tient lieu d'en-tête et de menu
   ===================================================================== */
.dans-bureau .barre-app,
.dans-bureau .menu-lateral,
.dans-bureau .pied,
.dans-bureau .lien-evitement,
.dans-bureau .console-quitter { display: none; }
.dans-bureau body { min-height: 100vh; }
.dans-bureau .principal--app { max-width: none; padding: clamp(.8rem, 2.4vw, 1.6rem); }
.dans-bureau .titre-page h1 { font-size: 1.35rem; }

/* Administration › Connexions */
.etapes-reglage { margin: .4rem 0 1rem; padding-left: 1.2rem; display: grid; gap: .45rem; color: var(--texte-doux); }
.etapes-reglage strong, .etapes-reglage code { color: var(--texte); }
.liste-verifications { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
.bandeau-secret { margin: 0 0 1rem; padding: .8rem 1rem; border-radius: var(--rayon); border: 1px solid var(--etat-alerte); background: color-mix(in srgb, var(--etat-alerte) 10%, var(--surface)); }
.bandeau-secret p { margin-bottom: .5rem; }
.bandeau-secret input { width: 100%; }

/* Facturation : choix des services et formules */
.choix-services { border: 0; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr)); gap: .4rem .8rem; }
.choix-services legend { font-weight: 600; margin-bottom: .4rem; }
.grille-formules { list-style: none; padding: 0; margin: .4rem 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: .6rem; }
.formule { border: 1px solid var(--bordure); border-radius: var(--rayon, 8px); padding: .7rem .8rem; display: flex; flex-direction: column; gap: .25rem; transition: border-color .15s, background-color .15s; }
.formule__prix { font-family: var(--police-mono); font-size: 1.15rem; font-weight: 700; white-space: nowrap; }
.formule__prix small { font-family: var(--police); font-size: .8rem; font-weight: 400; color: var(--texte-doux); }
.formule .etiquette { align-self: flex-start; }
.formule--choisie { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); }
.encart-essai { border-left: 3px solid var(--accent); padding: .5rem .8rem; margin: 0; background: color-mix(in srgb, var(--accent) 8%, transparent); }
.section-tarifs { max-width: 60rem; }
.grille-offres { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 1rem; margin: 1rem 0; }

/* Chiffres cliquables : toute la carte est le lien */
a.chiffre { color: inherit; text-decoration: none; transition: border-color var(--transition), background var(--transition); }
a.chiffre:hover, a.chiffre:focus-visible { border-color: var(--bordure-forte); background: var(--surface-2); }
a.chiffre small::after { content: " ›"; }

/* Bloc repliable : le détail ne s'affiche qu'à la demande */
.repli { border: 1px solid var(--bordure); border-radius: var(--rayon); background: var(--surface); box-shadow: var(--ombre); margin-bottom: .6rem; }
.repli > summary {
    display: flex; align-items: center; gap: .6rem; padding: .75rem 1rem;
    cursor: pointer; list-style: none; user-select: none;
}
.repli > summary::-webkit-details-marker { display: none; }
.repli > summary::before {
    content: ""; flex: none; width: .45rem; height: .45rem; margin-right: .1rem;
    border-right: 2px solid var(--texte-doux); border-bottom: 2px solid var(--texte-doux);
    transform: rotate(-45deg); transition: transform var(--transition);
}
.repli[open] > summary::before { transform: rotate(45deg); }
.repli > summary:hover { background: var(--surface-2); }
.repli > summary .repli__titre { font-weight: 600; }
.repli > summary .repli__info { margin-left: auto; color: var(--texte-doux); font-size: .85rem; }
.repli__corps { padding: 0 1rem 1rem; border-top: 1px solid var(--bordure); padding-top: 1rem; }
.repli--discret { border: 0; background: none; box-shadow: none; margin: .4rem 0; }
.repli--discret > summary { padding: .4rem 0; color: var(--texte-doux); }
.repli--discret > summary:hover { background: none; color: var(--texte); }
.repli--discret .repli__corps { border: 0; padding: .4rem 0 0; }

.barre-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-top: .4rem; }
.barre-actions__fin { margin-left: auto; }
.cases-ligne { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: .15rem 1rem; }
.section-suite { margin-top: 1.4rem; }
.tableau--edition .cellule-actions { white-space: nowrap; text-align: right; }
.tableau--edition tr.ligne-modifiee td { background: color-mix(in srgb, var(--accent) 8%, transparent); }
.carte--formulaire .grille-2 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.grille--haut { align-items: start; gap: 0 1rem; }
.tableau .bouton--danger.bouton--petit:not(:hover):not(:focus-visible) { border-color: transparent; background: none; }

.carte--offre { display: flex; flex-direction: column; margin: 0; }
.carte--offre h2 { display: flex; align-items: center; gap: .5rem; margin-top: 0; }
.carte--offre .texte-doux { flex: 1; }
.carte--offre__action { align-self: flex-start; margin-top: .6rem; }
.carte--offre-phare { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), var(--ombre); }

/* Filtres en tête de page */
.barre-filtres { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .6rem 1rem; margin-bottom: 1.4rem; }
.barre-filtres label { display: grid; gap: .3rem; min-width: 12rem; }
.barre-filtres__fin { margin-left: auto; }
.sans-coupure { white-space: nowrap; }

/* Ma garde (gestion opérationnelle) */
.ma-garde { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; }
.ma-garde__etat { display: flex; align-items: flex-start; gap: .9rem; }
.ma-garde__etat p { margin: 0; }
.ma-garde__voyant { flex: none; width: 12px; height: 12px; margin-top: .35rem; border-radius: 50%; background: var(--texte-doux); box-shadow: 0 0 0 4px color-mix(in srgb, var(--texte-doux) 18%, transparent); }
.ma-garde--active .ma-garde__voyant { background: var(--etat-ok); box-shadow: 0 0 0 4px color-mix(in srgb, var(--etat-ok) 22%, transparent); }
.ma-garde__libelle { font-size: .74rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--texte-doux); }
.ma-garde--active .ma-garde__libelle { color: var(--etat-ok); }
.ma-garde__unite { font: 700 1.35rem/1.25 var(--police-mono); }
.ma-garde__unite small { font: 400 .85rem var(--police); }
.ma-garde__statut { display: inline-flex; align-items: center; gap: .35rem; margin-left: .6rem; }
.ma-garde__avant-fin h2 { margin-top: 0; }
.rapports { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.rapports__ligne { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .7rem .85rem; border: 1px solid var(--bordure); border-left: 3px solid var(--etat-info); border-radius: var(--rayon-petit); background: var(--surface-2); }
.rapports__texte { display: grid; gap: .15rem; min-width: 0; }
.rapports__texte p { margin: 0; }
@media (max-width: 600px) {
    .rapports__ligne { flex-direction: column; align-items: stretch; }
}

/* Annonce de la plateforme */
.annonce {
    display: flex; align-items: center; gap: .8rem; padding: .55rem 1rem;
    background: color-mix(in srgb, var(--etat-info) 16%, var(--surface)); border-bottom: 1px solid color-mix(in srgb, var(--etat-info) 45%, transparent);
    font-size: .92rem;
}
.annonce[hidden], .dans-bureau .annonce { display: none; }
.annonce > span { flex: 1; }
.annonce--alerte { background: color-mix(in srgb, var(--etat-alerte) 18%, var(--surface)); border-color: color-mix(in srgb, var(--etat-alerte) 55%, transparent); }
.annonce__fermer { flex: none; width: 28px; height: 28px; border: 0; border-radius: 50%; background: none; color: inherit; font-size: 1.2rem; line-height: 1; cursor: pointer; }
.annonce__fermer:hover { background: color-mix(in srgb, var(--texte) 12%, transparent); }
.page-bureau .annonce {
    position: fixed; z-index: 900; top: 54px; left: 50%; transform: translateX(-50%);
    width: min(720px, calc(100% - 24px)); border: 1px solid color-mix(in srgb, var(--etat-info) 45%, transparent); border-radius: 10px;
    box-shadow: 0 10px 30px rgb(0 0 0 / .35); backdrop-filter: blur(10px);
}
.page-bureau .annonce--alerte { border-color: color-mix(in srgb, var(--etat-alerte) 55%, transparent); }

/* Fiches de l'administration */
.fil-ariane { margin: 0 0 .2rem; font-size: .85rem; }
.fil-ariane a { color: var(--texte-doux); text-decoration: none; }
.fil-ariane a::before { content: "‹ "; }
.fil-ariane a:hover { color: var(--texte); }
.titre-page h1 .etiquette, .titre-compte .etiquette { vertical-align: middle; margin-left: .3rem; font-size: .75rem; }
.titre-compte { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.liste-services { list-style: none; margin: 0 0 1rem; padding: 0; display: grid; gap: .55rem; }
.liste-services li { display: flex; align-items: center; gap: .7rem; }
.liste-services .pastille-service { background: var(--couleur, var(--accent)); }
.liste-services--eteint { opacity: .5; }
.voyant-texte { font-size: 1.35rem !important; display: inline-flex; align-items: center; gap: .5rem; }
.voyant-texte::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--texte-doux); }
.voyant-texte--ok::before { background: var(--etat-ok); box-shadow: 0 0 0 4px color-mix(in srgb, var(--etat-ok) 22%, transparent); }
.choix-role { border: 0; margin: 0 0 .6rem; padding: 0; display: grid; gap: .55rem; }
.choix-role .case { align-items: flex-start; }
.repli--danger { border-color: color-mix(in srgb, var(--danger) 45%, var(--bordure)); }
.repli--danger > summary .repli__titre { color: var(--danger); }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* Aide à distance */
.assistance-page { text-align: center; }
.assistance-etapes { display: inline-grid; gap: .3rem; margin: 0 0 1.4rem; padding-left: 1.2rem; text-align: left; }
.assistance-code { margin: 1rem 0; font: 700 clamp(2.4rem, 8vw, 3.6rem)/1 var(--police-mono); letter-spacing: .12em; }
.assistance-attente, .assistance-active { display: inline-flex; align-items: center; gap: .55rem; }
.assistance-voyant { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--etat-alerte); animation: assistance-pulse 1.6s ease-in-out infinite; }
.assistance-voyant--direct { background: var(--etat-danger); }
@keyframes assistance-pulse { 50% { opacity: .35; } }
.champ-code { font: 600 1.4rem var(--police-mono); letter-spacing: .15em; width: 9ch; }

.assistance-bandeau {
    position: fixed; z-index: 2147483000; top: 10px; left: 50%; transform: translateX(-50%);
    display: flex; align-items: center; gap: .7rem; padding: .45rem .55rem .45rem .9rem;
    border-radius: 999px; background: #b3261e; color: #fff; font: 600 .9rem/1.2 var(--police);
    box-shadow: 0 8px 24px rgb(0 0 0 / .35);
}
.assistance-bandeau .assistance-voyant { background: #fff; }
.assistance-bandeau--attente { background: #8a5a00; }
.assistance-bandeau--fin { padding: .55rem 1rem; background: #1d3b5c; }
.assistance-bandeau__bouton { border: 1px solid rgb(255 255 255 / .6); border-radius: 999px; padding: .3rem .8rem; background: rgb(255 255 255 / .14); color: inherit; font: inherit; cursor: pointer; }
.assistance-bandeau__bouton:hover { background: rgb(255 255 255 / .28); }
.assistance-pointeur { position: fixed; z-index: 2147483001; top: 0; left: 0; pointer-events: none; transition: transform 160ms linear; }
.assistance-pointeur::before {
    content: ""; position: absolute; top: 0; left: 0; width: 20px; height: 22px;
    background: #e0302a; clip-path: polygon(0 0, 0 100%, 30% 74%, 52% 100%, 66% 92%, 44% 66%, 82% 66%);
    filter: drop-shadow(0 1px 1px rgb(0 0 0 / .6));
}
.assistance-pointeur span { position: absolute; top: 20px; left: 14px; padding: .1rem .45rem; border-radius: 4px; background: #e0302a; color: #fff; font: 600 .72rem var(--police); white-space: nowrap; }
.assistance-pointeur[hidden] { display: none; }
.assistance-signal { position: fixed; z-index: 2147483000; top: -22px; left: -22px; width: 44px; height: 44px; border: 3px solid #e0302a; border-radius: 50%; pointer-events: none; animation: assistance-signal 1.1s ease-out forwards; }
@keyframes assistance-signal { from { opacity: 1; scale: .3; } to { opacity: 0; scale: 1.8; } }

.assistance-vue__barre { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1.2rem; margin-bottom: 1rem; }
.assistance-vue__barre h1 { margin: 0; }
.assistance-vue__barre form { margin-left: auto; }
.assistance-vue__etat { margin: 0; display: inline-flex; align-items: center; gap: .45rem; font-weight: 600; color: var(--etat-ok); }
.assistance-vue__etat::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: currentColor; }
.assistance-vue__etat--alerte { color: var(--etat-alerte); }
.assistance-vue__aide { margin: 0; flex-basis: 100%; font-size: .88rem; }
.assistance-scene { position: relative; overflow: hidden; border: 1px solid var(--bordure-forte); border-radius: var(--rayon); background: #000; min-height: 300px; }
.assistance-scene__ecran { position: absolute; top: 0; left: 0; transform-origin: 0 0; }
.assistance-scene__ecran iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: var(--fond); pointer-events: none; }
.assistance-scene__ecran iframe[hidden] { display: none; }
.assistance-scene__ecran .assistance-pointeur { position: absolute; transition-duration: 380ms; }
.assistance-pointeur--client::before { background: #2f8fff; }
.assistance-pointeur--client span { background: #2f8fff; }
.assistance-calque { position: absolute; inset: 0; cursor: crosshair; }
.assistance-scene__vide { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; color: #9aa7b8; }
.assistance-scene__vide[hidden] { display: none; }
.assistance-vue--finie .assistance-scene { opacity: .45; }
.assistance-vue--finie .assistance-calque { cursor: default; }
.principal--app:has(.assistance-vue) { max-width: none; }
