/* Interface HATARI : sobre, lisible sur téléphone comme sur ordinateur, thème clair et sombre. */
:root {
  --fond: #f4f5f7; --carte: #ffffff; --texte: #1d2330; --doux: #5d6675; --bord: #dfe3e8;
  --accent: #0f5c8c; --accent-texte: #ffffff; --accent-doux: #e3eff7;
  --vert: #1e7f46; --vert-doux: #e3f4ea; --orange: #b35f0e; --orange-doux: #fbeedd;
  --rouge: #b42318; --rouge-doux: #fde7e4; --gris: #6b7280; --gris-doux: #eceef1;
  --rayon: 10px; --ombre: 0 1px 2px rgba(16, 24, 40, .06);
}
@media (prefers-color-scheme: dark) {
  :root {
    --fond: #13161b; --carte: #1c2027; --texte: #e6e8eb; --doux: #9aa3ae; --bord: #2d333c;
    --accent: #4aa3dc; --accent-texte: #0b1520; --accent-doux: #16293a;
    --vert: #4cc27f; --vert-doux: #15291e; --orange: #f0a04b; --orange-doux: #33240f;
    --rouge: #f2706a; --rouge-doux: #3a1714; --gris: #9aa3ae; --gris-doux: #262b33;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--fond); color: var(--texte); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); }
code { font: 13px ui-monospace, Consolas, monospace; background: var(--gris-doux); padding: 1px 5px; border-radius: 4px; }
h1 { font-size: 1.5rem; margin: 0; }
h2 { font-size: 1.05rem; margin: 0 0 12px; }
h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--doux); margin: 10px 0 2px; }
.cache { display: none !important; }
.discret { color: var(--doux); font-size: .9em; }
.chargement { color: var(--doux); padding: 24px; text-align: center; }

/* ---------- boutons et formulaires ---------- */
button { font: inherit; font-weight: 600; border: 1px solid var(--bord); background: var(--carte); color: var(--texte);
  border-radius: 8px; padding: 8px 14px; cursor: pointer; }
button:hover:not(:disabled) { border-color: var(--accent); }
button:disabled { opacity: .55; cursor: wait; }
button.principal { background: var(--accent); border-color: var(--accent); color: var(--accent-texte); }
button.danger { background: var(--rouge); border-color: var(--rouge); color: #fff; }
button.discret { background: transparent; }
input, select, textarea { font: inherit; color: var(--texte); background: var(--carte); border: 1px solid var(--bord);
  border-radius: 8px; padding: 8px 10px; width: 100%; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible, tr:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 1px; }
input[type="checkbox"] { width: auto; }
.champ { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.champ label { font-weight: 600; font-size: .9rem; }
.case { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.formulaire-ligne { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin-top: 12px; }
.formulaire-ligne .champ { margin: 0; flex: 1 1 160px; }
.formulaire-ligne .champ.large { flex: 2 1 280px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.filtres { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.filtres select { width: auto; }

/* ---------- messages ---------- */
.message { border-radius: 8px; padding: 10px 12px; margin: 10px 0; border-left: 4px solid; }
.message-erreur { background: var(--rouge-doux); border-color: var(--rouge); }
.message-succes { background: var(--vert-doux); border-color: var(--vert); }
.message-info { background: var(--accent-doux); border-color: var(--accent); }

/* ---------- connexion ---------- */
.marque { font-weight: 800; letter-spacing: .12em; color: var(--accent); text-decoration: none; font-size: 1.15rem; }

/* ---------- cadre ---------- */
.entete { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  padding: 10px 20px; background: var(--carte); border-bottom: 1px solid var(--bord); }
.navigation { display: flex; gap: 4px; overflow-x: auto; flex: 1 1 auto; }
.navigation a { padding: 6px 10px; border-radius: 6px; text-decoration: none; color: var(--doux); font-weight: 600;
  white-space: nowrap; }
.navigation a:hover { color: var(--texte); background: var(--gris-doux); }
.navigation a.actif { color: var(--accent); background: var(--accent-doux); }
.utilisateur { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.utilisateur .nom { font-weight: 600; }
.choix-organisation { display: flex; align-items: center; gap: 6px; }
.choix-organisation select { width: auto; max-width: 220px; }
.contenu { max-width: 1180px; margin: 0 auto; padding: 22px 20px 60px; }
.titre-page { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }

/* ---------- cartes et grilles ---------- */
.carte { background: var(--carte); border: 1px solid var(--bord); border-radius: var(--rayon); padding: 16px 18px;
  box-shadow: var(--ombre); margin-bottom: 16px; }
.deux-colonnes { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.deux-colonnes > .carte { margin-bottom: 0; }
.deux-colonnes { margin-bottom: 16px; }
.grille-chiffres { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 16px; margin-bottom: 16px; }
.grille-chiffres .carte { margin: 0; }
.chiffre { display: flex; flex-direction: column; text-decoration: none; color: var(--texte); }
.chiffre .nombre { font-size: 2rem; font-weight: 800; }
.chiffre.rouge .nombre { color: var(--rouge); }
.grille-gravites { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.tuile { display: flex; flex-direction: column; align-items: center; padding: 10px 4px; border-radius: 8px;
  text-decoration: none; font-weight: 600; font-size: .85rem; }
.tuile .nombre { font-size: 1.6rem; font-weight: 800; }
.tuile.vide { opacity: .45; }
.resume { display: flex; align-items: center; gap: 24px; }
.jauge { width: 120px; height: 120px; border-radius: 50%; border: 10px solid var(--gris); display: flex;
  flex-direction: column; align-items: center; justify-content: center; flex: none; }
.jauge-valeur { font-size: 2.2rem; font-weight: 800; line-height: 1; }
.jauge-unite { color: var(--doux); font-size: .85rem; }
.jauge-vert { border-color: var(--vert); } .jauge-orange { border-color: var(--orange); }
.jauge-rouge { border-color: var(--rouge); }
.risque { font-weight: 700; font-size: 1.1rem; margin: 0 0 4px; }
.risque-vert { color: var(--vert); } .risque-orange { color: var(--orange); } .risque-rouge { color: var(--rouge); }

/* ---------- badges ---------- */
.badge, .statut, .etat, .score { display: inline-block; border-radius: 999px; padding: 1px 9px; font-size: .78rem;
  font-weight: 700; white-space: nowrap; background: var(--gris-doux); color: var(--gris); margin-right: 4px; }
.gravite-critique { background: var(--rouge-doux); color: var(--rouge); }
.gravite-elevee { background: var(--orange-doux); color: var(--orange); }
.gravite-moyenne { background: var(--accent-doux); color: var(--accent); }
.gravite-faible { background: var(--gris-doux); color: var(--gris); }
.score-vert, .etat-en-ligne, .statut-resolue, .envoi-envoyee { background: var(--vert-doux); color: var(--vert); }
.score-orange, .statut-en_cours, .statut-affectee, .envoi-en_attente { background: var(--orange-doux); color: var(--orange); }
.score-rouge, .etat-isole, .statut-nouvelle, .envoi-abandonnee { background: var(--rouge-doux); color: var(--rouge); }
.etat-hors-ligne { background: var(--gris-doux); color: var(--gris); }

/* ---------- tableaux ---------- */
.defilement { overflow-x: auto; background: var(--carte); border: 1px solid var(--bord); border-radius: var(--rayon);
  margin-bottom: 16px; }
.tableau { width: 100%; border-collapse: collapse; }
.tableau th { text-align: left; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--doux);
  padding: 10px 12px; border-bottom: 1px solid var(--bord); white-space: nowrap; }
.tableau td { padding: 10px 12px; border-bottom: 1px solid var(--bord); vertical-align: top; }
.tableau tr:last-child td { border-bottom: 0; }
.tableau.compact td, .tableau.compact th { padding: 6px 8px; }
.cliquable { cursor: pointer; }
.cliquable:hover, tr.choisi { background: var(--accent-doux); }
.infos { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 0; }
.infos dt { color: var(--doux); }
.infos dd { margin: 0; overflow-wrap: anywhere; }
.liste-simple { margin: 0; padding-left: 18px; }
.liste-simple li { margin: 6px 0; }

/* ---------- onglets ---------- */
.onglets { display: flex; gap: 4px; border-bottom: 1px solid var(--bord); margin-bottom: 14px; overflow-x: auto; }
.onglet { border: 0; border-bottom: 3px solid transparent; border-radius: 0; background: none; color: var(--doux);
  white-space: nowrap; }
.onglet.actif { color: var(--accent); border-bottom-color: var(--accent); }
.onglet-contenu input[type="search"] { margin-bottom: 12px; max-width: 420px; }

/* ---------- alertes ---------- */
.liste-alertes .carte { margin-bottom: 12px; }
.alerte { border-left-width: 5px; }
.bord-critique { border-left-color: var(--rouge); } .bord-elevee { border-left-color: var(--orange); }
.bord-moyenne { border-left-color: var(--accent); } .bord-faible { border-left-color: var(--gris); }
.alerte-tete { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.alerte-tete h2 { margin: 0; flex: 1 1 240px; }
.alerte .section p { margin: 0; }
.ignorer { margin-top: 12px; }

/* ---------- actions et incidents ---------- */
.action { border-left: 5px solid var(--accent); }
.action h2 code { font-size: .95rem; }
.action .infos { margin-top: 6px; }
.sa-en_attente_validation, .si-en_cours { background: var(--orange-doux); color: var(--orange); }
.sa-validee, .sa-envoyee { background: var(--accent-doux); color: var(--accent); }
.sa-executee, .si-resolu { background: var(--vert-doux); color: var(--vert); }
.sa-echouee, .si-ouvert { background: var(--rouge-doux); color: var(--rouge); }
.sa-refusee, .sa-annulee, .si-clos { background: var(--gris-doux); color: var(--gris); }
.formulaire-action { margin-top: 8px; }
.formulaire-action .formulaire-ligne { margin-top: 4px; }
.texte-long { white-space: pre-wrap; }
form.restauration { border-left: 5px solid var(--accent); }
.pastilles { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
fieldset.postes { border: 1px solid var(--bord); border-radius: 8px; padding: 8px 12px; margin: 8px 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 4px 12px; }
fieldset.postes legend { font-weight: 600; padding: 0 4px; }
tr.inactif td { opacity: .55; }
.sd-en_attente { background: var(--orange-doux); color: var(--orange); }
.sd-en_cours { background: var(--accent-doux); color: var(--accent); }
.sd-reussi { background: var(--vert-doux); color: var(--vert); }
.sd-echoue { background: var(--rouge-doux); color: var(--rouge); }
.sd-annule { background: var(--gris-doux); color: var(--gris); }
#sv-chemins, #sv-exclusions { font: 13px ui-monospace, Consolas, monospace; }

/* ---------- divers ---------- */
details.ajout summary { cursor: pointer; font-weight: 700; color: var(--accent); }
.copie { display: flex; gap: 8px; align-items: flex-start; background: var(--gris-doux); border-radius: 8px; padding: 10px; }
.copie code { background: none; padding: 0; flex: 1; overflow-wrap: anywhere; }

@media (max-width: 640px) {
  .entete { padding: 8px 12px; gap: 8px; }
  .navigation { order: 3; flex-basis: 100%; }
  .contenu { padding: 14px 12px 40px; }
  .resume { flex-direction: column; text-align: center; }
  .grille-gravites { grid-template-columns: repeat(2, 1fr); }
  .infos { grid-template-columns: 1fr; gap: 0 0; }
  .infos dd { margin-bottom: 8px; }
}
/* Abonnement, rapports (étape 11) */
.bandeau { max-width: 1180px; margin: 0 auto; padding: 0 20px; }
.bandeau .message { margin: 14px 0 0; }
.formules { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.formule { margin: 0; }
.formule h3 { margin: 0 0 6px; }
.formule.actuelle { border: 2px solid var(--accent); }
.formule .prix { font-size: 1.15rem; font-weight: 700; margin: 4px 0 8px; }
.formule .prix .discret { font-size: .85rem; font-weight: 400; }
ul.fonctions { padding-left: 18px; margin: 8px 0 0; }
ul.fonctions li.absent { color: var(--doux); text-decoration: line-through; }
p.total { font-weight: 700; margin: 12px 0; }
td.actions-ligne { white-space: nowrap; }
td.actions-ligne > * { margin-right: 6px; }
a.bouton { display: inline-block; font-weight: 600; border: 1px solid var(--bord); border-radius: 8px;
  padding: 6px 12px; color: var(--texte); text-decoration: none; }
.ab-essai, .pa-en_attente { background: var(--orange-doux); color: var(--orange); }
.ab-actif, .pa-reussi { background: var(--vert-doux); color: var(--vert); }
.ab-suspendu, .pa-echoue { background: var(--rouge-doux); color: var(--rouge); }
.pa-rembourse { background: var(--gris-doux); color: var(--gris); }
@media (max-width: 700px) { .bandeau { padding: 0 12px; } }
.carte form > button.principal { margin-top: 10px; }
.formule .postes-max { font-weight: 600; margin: 0 0 6px; }
/* Logo HATARI : dessiné dans la couleur du texte (thème clair ou sombre) grâce au masque. */
.logo { display: inline-block; width: 1.6em; height: 1.6em; margin-right: .45em; vertical-align: -.45em;
  background-color: currentColor; -webkit-mask: url("/logo-masque.png") center / contain no-repeat;
  mask: url("/logo-masque.png") center / contain no-repeat; }

/* ---------- écran de connexion : « la veille » ----------
   À gauche, un panneau bleu nuit où le logo veille au centre d'un radar (bleu du drapeau,
   un point jaune repéré au passage du balayage). À droite, le formulaire, sobre. */
.page-connexion { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 11fr) minmax(0, 9fr); }
.veille { --nuit: #0d2236; --nuit-2: #123150; --ciel: #3fa9f5; --etoile: #f7d618;
  position: relative; overflow: hidden; color: #eaf2fa; padding: 48px 56px 40px;
  background: radial-gradient(120% 90% at 50% 38%, var(--nuit-2), var(--nuit) 70%);
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.radar { position: relative; width: min(360px, 70vw); aspect-ratio: 1; border-radius: 50%;
  display: grid; place-items: center; margin-bottom: 28px;
  background: repeating-radial-gradient(circle, transparent 0 44px, rgba(63, 169, 245, .20) 44px 45px);
  box-shadow: inset 0 0 0 1px rgba(63, 169, 245, .35); }
.radar::before, .radar::after { content: ""; position: absolute; background: rgba(63, 169, 245, .14); }
.radar::before { left: 50%; top: 0; bottom: 0; width: 1px; }
.radar::after { top: 50%; left: 0; right: 0; height: 1px; }
.radar .balayage { position: absolute; inset: 0; border-radius: 50%;
  background: conic-gradient(from 0deg, transparent 0deg 285deg, rgba(63, 169, 245, .38) 360deg);
  animation: balayer 6s linear infinite; }
.radar .point { position: absolute; width: 9px; height: 9px; border-radius: 50%; background: var(--etoile);
  left: 71%; top: 21%; box-shadow: 0 0 0 4px rgba(247, 214, 24, .18);
  opacity: .25; animation: reperer 6s linear infinite; }
.radar .logo { position: relative; z-index: 1; width: 30%; height: 30%; margin: 0; color: #ffffff;
  vertical-align: 0; }
.veille .nom { margin: 0; color: #ffffff; font-family: Bahnschrift, "DIN Alternate", "Roboto Condensed",
  "Arial Narrow", system-ui, sans-serif; font-stretch: condensed; font-weight: 700;
  font-size: clamp(2.2rem, 4.4vw, 3.4rem); letter-spacing: .34em; margin-right: -.34em; line-height: 1; }
.veille .devise { margin: 16px 0 0; max-width: 30ch; font-size: 1.12rem; line-height: 1.45; color: #c9d9ea; }
.veille .atouts { list-style: none; padding: 0; margin: 28px 0 0; display: grid; gap: 8px;
  text-align: left; font-size: .95rem; color: #b4c8dd; }
.veille .atouts li { position: relative; padding-left: 20px; }
.veille .atouts li::before { content: ""; position: absolute; left: 0; top: .5em; width: 7px; height: 7px;
  border-radius: 50%; border: 1.5px solid var(--ciel); }
.veille .lieu { position: absolute; left: 0; right: 0; bottom: 18px; margin: 0; font-size: .82rem;
  color: #7f9bb8; letter-spacing: .04em; }
@keyframes balayer { to { transform: rotate(360deg); } }
/* Le point se trouve à environ 36° : le balayage le touche vers 10 % du tour. */
@keyframes reperer { 0%, 9% { opacity: .25; } 11% { opacity: 1; } 55%, 100% { opacity: .25; } }

.cote-formulaire { display: grid; place-items: center; padding: 40px 24px; background: var(--fond); }
.connexion { width: 100%; max-width: 360px; }
.connexion h1 { margin: 0; font-size: 1.75rem; line-height: 1.2; letter-spacing: -.01em; }
.connexion .invite { margin: 6px 0 24px; color: var(--doux); }
.connexion .champ { margin-bottom: 16px; }
.connexion input { padding: 11px 12px; font-size: 1rem; }
.connexion .principal { width: 100%; padding: 12px; margin-top: 6px; font-size: 1rem; }
.connexion .aide { margin: 22px 0 0; font-size: .88rem; color: var(--doux); }

@media (max-width: 820px) {
  .page-connexion { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .veille { padding: 28px 20px 24px; }
  .radar { width: 168px; margin-bottom: 16px;
    background: repeating-radial-gradient(circle, transparent 0 20px, rgba(63, 169, 245, .20) 20px 21px); }
  .veille .devise { font-size: 1rem; margin-top: 10px; }
  .veille .atouts, .veille .lieu { display: none; }
  .cote-formulaire { place-items: start center; padding: 28px 20px 40px; }
}
@media (prefers-reduced-motion: reduce) {
  .radar .balayage { animation: none; transform: rotate(36deg); }
  .radar .point { animation: none; opacity: 1; }
}
