/* ---------------------------------------------------------------------------
   AI PROTECTIVE SECURITY ASSISTANT - feuille de style commune
   Interface concue pour un centre de supervision : fond sombre, contrastes
   maitrises, aucune couleur decorative. La couleur porte une information et
   une seule : etat, niveau d'alerte, role d'une personne dans le dispositif.
   --------------------------------------------------------------------------- */

:root {
  --fond: #0b0d10;
  --fond-2: #111419;
  --fond-3: #171b21;
  --fond-survol: #1d222a;
  --bord: #232932;
  --bord-clair: #2f3742;
  --texte: #e6e9ee;
  --texte-2: #9aa4b2;
  --texte-3: #6b7683;
  --accent: #4c8dff;
  --accent-sombre: #1e3a63;
  --vip: #e8a33c;
  --agent: #5bc98a;
  --normal: #4bbf7b;
  --attention: #e0b341;
  --important: #e2802f;
  --critique: #e2564a;
  --insuffisant: #7c8794;
  --rayon: 6px;
  --ombre: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.25);
  --mono: "SF Mono", "Cascadia Mono", "JetBrains Mono", Consolas, monospace;
  --police: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

/* L'attribut hidden doit primer sur toute regle de mise en page. Sans cela,
   une classe qui fixe display (flex, inline-flex) rend visible un element
   pourtant marque hidden : c'est ainsi que le panneau de designation du mobile
   se retrouvait affiche en permanence, par-dessus les commandes. */
[hidden] { display: none !important; }

html, body {
  margin: 0; padding: 0; height: 100%;
  background: var(--fond); color: var(--texte);
  font-family: var(--police); font-size: 14px; line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: 18px; }
h2 { font-size: 15px; }
h3 { font-size: 13px; color: var(--texte-2); text-transform: uppercase; letter-spacing: .06em; }

/* --- structure ---------------------------------------------------------- */
.application { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }

.barre {
  display: flex; align-items: center; gap: 18px;
  height: 52px; padding: 0 18px; flex: 0 0 52px;
  background: var(--fond-2); border-bottom: 1px solid var(--bord);
}
.barre .marque { display: flex; flex-direction: column; line-height: 1.15; }
.barre .marque strong { font-size: 13px; letter-spacing: .04em; }
.barre .marque span { font-size: 10.5px; color: var(--texte-3); letter-spacing: .1em; text-transform: uppercase; }
.navigation { display: flex; gap: 2px; margin-left: 12px; }
.navigation a {
  padding: 7px 13px; border-radius: var(--rayon); color: var(--texte-2);
  font-size: 13px; font-weight: 500;
}
.navigation a:hover { background: var(--fond-3); color: var(--texte); }
.navigation a.actif { background: var(--accent-sombre); color: #cfe0ff; }
.barre .droite { margin-left: auto; display: flex; align-items: center; gap: 14px; }

.contenu { flex: 1; overflow: auto; padding: 18px; }
.contenu.plein { padding: 0; overflow: hidden; }

.grille { display: grid; gap: 14px; }
.grille.deux { grid-template-columns: 1fr 1fr; }
.grille.trois { grid-template-columns: repeat(3, 1fr); }
.grille.quatre { grid-template-columns: repeat(4, 1fr); }

/* --- blocs -------------------------------------------------------------- */
.bloc {
  background: var(--fond-2); border: 1px solid var(--bord);
  border-radius: var(--rayon); overflow: hidden;
}
.bloc > header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; border-bottom: 1px solid var(--bord); background: var(--fond-3);
}
.bloc > .corps { padding: 14px; }
.bloc > .corps.serre { padding: 0; }

/* --- indicateurs -------------------------------------------------------- */
.indicateur { display: flex; flex-direction: column; gap: 4px; }
.indicateur .valeur { font-size: 26px; font-weight: 600; font-variant-numeric: tabular-nums; }
.indicateur .libelle { font-size: 11.5px; color: var(--texte-3); text-transform: uppercase; letter-spacing: .07em; }

.pastille {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px; border-radius: 100px; font-size: 11.5px; font-weight: 500;
  background: var(--fond-3); border: 1px solid var(--bord-clair); color: var(--texte-2);
}
.pastille::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pastille.normal { color: var(--normal); border-color: #1f4433; }
.pastille.attention { color: var(--attention); border-color: #4a3d18; }
.pastille.important { color: var(--important); border-color: #4d3018; }
.pastille.critique { color: var(--critique); border-color: #4d2320; }
.pastille.insuffisant { color: var(--insuffisant); }
.pastille.information { color: var(--accent); border-color: var(--accent-sombre); }

.barre-progression { height: 4px; background: var(--fond-3); border-radius: 2px; overflow: hidden; }
.barre-progression > span { display: block; height: 100%; background: var(--accent); border-radius: 2px; transition: width .4s ease; }
.barre-progression.normal > span { background: var(--normal); }
.barre-progression.attention > span { background: var(--attention); }
.barre-progression.important > span { background: var(--important); }
.barre-progression.critique > span { background: var(--critique); }

/* --- formulaires -------------------------------------------------------- */
label { display: block; font-size: 12px; color: var(--texte-2); margin-bottom: 5px; }
input, select, textarea {
  width: 100%; padding: 8px 10px; background: var(--fond); color: var(--texte);
  border: 1px solid var(--bord-clair); border-radius: var(--rayon);
  font-family: inherit; font-size: 13px; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
.champ { margin-bottom: 12px; }
.ligne-champs { display: flex; gap: 12px; }
.ligne-champs > * { flex: 1; }

button, .bouton {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 8px 14px; border-radius: var(--rayon); border: 1px solid var(--bord-clair);
  background: var(--fond-3); color: var(--texte); font-family: inherit;
  font-size: 13px; font-weight: 500; cursor: pointer; transition: background .15s, border-color .15s;
}
button:hover, .bouton:hover { background: var(--fond-survol); border-color: #3c4552; }
button.principal { background: var(--accent); border-color: var(--accent); color: #06101f; }
button.principal:hover { background: #6ba0ff; }
button.discret { background: transparent; border-color: transparent; color: var(--texte-2); }
button.discret:hover { background: var(--fond-3); color: var(--texte); }
button:disabled { opacity: .45; cursor: not-allowed; }
button.compact { padding: 5px 10px; font-size: 12px; }

/* --- tableaux et listes ------------------------------------------------- */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left; padding: 9px 14px; font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .06em; color: var(--texte-3);
  border-bottom: 1px solid var(--bord); background: var(--fond-3);
}
td { padding: 9px 14px; border-bottom: 1px solid var(--bord); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--fond-3); }
.mono { font-family: var(--mono); font-size: 12px; font-variant-numeric: tabular-nums; }
.vide { padding: 24px; text-align: center; color: var(--texte-3); font-size: 13px; }

/* --- alertes ------------------------------------------------------------ */
.alerte {
  border: 1px solid var(--bord); border-left: 3px solid var(--texte-3);
  border-radius: var(--rayon); background: var(--fond-2); padding: 11px 13px; margin-bottom: 9px;
}
.alerte.critique { border-left-color: var(--critique); }
.alerte.important { border-left-color: var(--important); }
.alerte.attention { border-left-color: var(--attention); }
.alerte.information { border-left-color: var(--accent); }
.alerte header { display: flex; align-items: baseline; gap: 8px; margin-bottom: 4px; }
.alerte header strong { font-size: 13px; font-weight: 600; }
.alerte header .heure { margin-left: auto; font-family: var(--mono); font-size: 11px; color: var(--texte-3); }
.alerte p { margin: 0 0 8px; font-size: 12.5px; color: var(--texte-2); }
.alerte .actions { display: flex; gap: 6px; flex-wrap: wrap; }
.alerte .motifs { margin: 8px 0 0; padding: 9px 11px; background: var(--fond); border-radius: 4px; font-size: 12px; }
.alerte .motifs li { color: var(--texte-2); margin-bottom: 4px; }

/* --- divers ------------------------------------------------------------- */
.messages { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 60; }
.message {
  background: var(--fond-3); border: 1px solid var(--bord-clair); border-radius: var(--rayon);
  padding: 10px 14px; font-size: 13px; box-shadow: var(--ombre); max-width: 340px;
  animation: apparition .18s ease;
}
.message.erreur { border-color: #5a2b26; }
@keyframes apparition { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.modale-fond {
  position: fixed; inset: 0; background: rgba(4,6,9,.72); display: flex;
  align-items: center; justify-content: center; z-index: 70; padding: 24px;
}
.modale {
  background: var(--fond-2); border: 1px solid var(--bord-clair); border-radius: 8px;
  width: min(620px, 100%); max-height: 82vh; overflow: auto; box-shadow: var(--ombre);
}
.modale header { padding: 14px 18px; border-bottom: 1px solid var(--bord); display: flex; justify-content: space-between; align-items: center; }
.modale .corps { padding: 18px; }
.modale footer { padding: 14px 18px; border-top: 1px solid var(--bord); display: flex; gap: 8px; justify-content: flex-end; }

.avis {
  padding: 10px 13px; border-radius: var(--rayon); font-size: 12.5px;
  background: var(--fond-3); border: 1px solid var(--bord-clair); color: var(--texte-2);
}
.avis.attention { border-color: #4a3d18; color: #e8cd8a; }

.separateur { height: 1px; background: var(--bord); margin: 14px 0; }
.discret { color: var(--texte-3); font-size: 12px; }
.tabulaire { font-variant-numeric: tabular-nums; }
