/* vp.css — CHARTE UNIQUE du portail ViaPrevent V2.
 *
 * Pourquoi ce fichier : le portail et ses pages outils avaient chacun leur habillage (le portail en
 * Segoe UI vert facon site vitrine, les pages en monospace gris), si bien qu'on avait l'impression de
 * changer d'application a chaque clic. Tout part desormais d'ici — une seule source de verite.
 *
 * Parti pris (hybride retenu avec Domi) : les COULEURS de la marque (celles de viaprevent.com) avec la
 * SOBRIETE de l'ancien portail a1 — cadre net, typo compacte, boutons en majuscules. C'est un outil
 * d'exploitation, pas une vitrine : on privilegie la lisibilite dense au joli.
 *
 * Servi par le statique generique du portail (l'extension .css est dans STATIC_EXT et les assets sont
 * au niveau 0). Modifiable a chaud : aucune recompilation pour changer l'apparence.
 */

:root{
  /* CHARTE-DEBUT VARIABLES - genere par gen_charte.py depuis C:\V2\server\COULEURS.txt - NE PAS EDITER */
  /* marque (identiques a site_viaprevent) */
  --vert:#1a5f4a; --vert2:#2d8a6e; --menthe:#7dd3c0;
  /* ambiance */
  --fond:#f8f9fa; --txt:#2d2d2d; --gris:#888; --ligne:#e0e0e0;
  --rouge:#c33; --orange:#ff8800;
  /* CHARTE-FIN VARIABLES */
  --rad:5px; --trait:2px solid var(--vert);   /* pas des couleurs : hors charte */
}

*{ margin:0; padding:0; box-sizing:border-box; }

body{
  font-family:'Segoe UI',Tahoma,Geneva,Verdana,sans-serif;
  font-size:13px; line-height:1.5; color:var(--txt); background:var(--fond);
  padding:20px; max-width:560px; margin:10px auto;
}
@media (max-width:640px){ body{ margin:8px; padding:8px; } }

h1{ color:var(--vert); font-size:17px; margin-bottom:12px; }
h2,h3{ color:var(--vert); font-size:14px; }
a{ color:var(--vert2); }
.muted{ color:var(--gris); font-size:11px; }

/* ---- SECTIONS (2026-08-13) : PLUS DE CADRE. Un filet fin gris separe deux sections consecutives
 * (`.panel + .panel`), padding lateral 0 -> le contenu prend toute la largeur = gain de place sur
 * mobile. Demande Domi, applique a TOUT le portail. ---- */
.panel{
  background:transparent; border:0; border-radius:0;
  padding:12px 0; margin:0;
}
.panel + .panel{ border-top:1px solid var(--ligne); }
.panel > label{
  display:block; color:var(--vert); font-weight:700; font-size:12px;
  text-transform:uppercase; letter-spacing:.4px; margin-bottom:6px;
}
.row{ display:flex; flex-direction:column; gap:0; }
.col{ width:100%; }

/* ---- BOUTONS : blancs bordes vert, gras majuscules ; plein pour l'action principale ---- */
button{
  background:#fff; color:var(--vert); border:1px solid var(--vert); border-radius:3px;
  padding:7px 12px; margin:4px 2px; cursor:pointer;
  font-family:inherit; font-size:12px; font-weight:700;
  text-transform:uppercase; letter-spacing:.3px;
}
button:hover{ background:var(--menthe); color:#0d3b2e; }
button.primary,
button.active{ background:var(--vert); color:#fff; border-color:var(--vert); }
button.primary:hover,
button.active:hover{ background:var(--vert2); color:#fff; }
button.danger{ background:var(--rouge); color:#fff; border-color:var(--rouge); }
button.danger:hover{ background:#a00; }
/* Alias historiques des pages outils (go/teal = action principale, on = etat actif, grey = neutre).
 * Conserves pour ne pas avoir a retoucher le HTML et le JS de chaque page. */
button.go,button.teal{ background:var(--vert); color:#fff; border-color:var(--vert); }
button.go:hover,button.teal:hover{ background:var(--vert2); color:#fff; }
button.on{ background:var(--vert2); color:#fff; border-color:var(--vert2); }
button.grey{ background:#fff; color:var(--gris); border-color:#b9c4c0; }
button:disabled,button.disabled{ opacity:.45; cursor:not-allowed; }

/* ---- SAISIE ---- */
input,select,textarea{
  background:#fff; color:var(--txt); border:1px solid #b9c4c0; border-radius:3px;
  padding:6px 9px; font-family:inherit; font-size:13px; width:100%;
}
/* CASES A COCHER ET BOUTONS RADIO (12/11, Domi) : la largeur 100 % ci-dessus est faite pour les champs de texte ;
   appliquee a une case, elle lui donnait toute la ligne et renvoyait son libelle a la ligne suivante (« angles
   radar » decale sur 2 lignes). Une page qui veut une autre taille la pose apres (.chip input, .coche input…). */
input[type=checkbox],input[type=radio]{ width:auto; padding:0; }
input:focus,select:focus,textarea:focus{ outline:none; border-color:var(--vert); }
label{ display:block; font-size:11px; color:var(--gris); margin-bottom:4px; }

/* ---- ONGLETS (page /box) : le trait vert sert de reglure ---- */
#tabbar{
  display:flex; gap:3px; flex-wrap:wrap; margin:0 0 8px;
  border-bottom:var(--trait); padding:6px 0 0;
  /* menu compact FIXE en haut : reste visible au défilement (2026-08-12) */
  position:sticky; top:0; z-index:30; background:var(--fond);
}
#tabbar .tab{
  margin:0; border:1px solid var(--vert); border-bottom:none; border-radius:5px 5px 0 0;
  background:#fff; color:var(--vert); padding:4px 10px; font-size:11px;
}
#tabbar .tab.active{ background:var(--vert); color:#fff; }
#tabbar .tab.disabled{ opacity:.45; cursor:not-allowed; background:#eef1f0; color:#9aa5a1; border-color:#c9d2ce; }
/* Onglets reserves au superadmin (2026-09-28) : groupe pousse A DROITE, legerement grise ; pleine
   intensite au survol et quand l'onglet est actif. */
#tabbar .tab.sa1{ margin-left:auto; }
#tabbar .tab.sa{ opacity:.6; }
#tabbar .tab.sa:hover, #tabbar .tab.sa.active{ opacity:1; }

/* ---- SOUS-ONGLETS : ceux d'une page DANS le portail (boitier ouvert, Gestion client…).
   MEME STYLE QUE LA BARRE DU PORTAIL (2026-10-07, Domi : « les onglets des pages parcourues doivent avoir le
   meme style que l'onglet principal »). Du 02/10 au 07/10 ils etaient volontairement secondaires (texte
   souligne). Les regles ci-dessous reprennent celles de #tabbar une a une ; les sous-onglets sont souvent des
   <button> : on annule donc ce que la regle `button` leur ajoute (majuscules, gras, interlettrage, marge) pour
   qu'ils se lisent comme les liens de la barre. C'est cette barre-ci qui reste collee au defilement. ---- */
.soustabs{
  display:flex; gap:3px; flex-wrap:wrap; margin:0 0 8px; padding:6px 0 0;
  border-bottom:var(--trait);
  position:sticky; top:0; z-index:30; background:var(--fond);
}
.soustabs > .tab, .soustabs > button{
  margin:0; border:1px solid var(--vert); border-bottom:none; border-radius:5px 5px 0 0;
  background:#fff; color:var(--vert); padding:4px 10px; font-size:11px; line-height:1.5;
  font-weight:400; text-transform:none; letter-spacing:0; text-decoration:none; min-height:0;
  box-shadow:none; cursor:pointer;
}
.soustabs > .tab:hover, .soustabs > button:hover{ background:var(--menthe); color:#0d3b2e; }
.soustabs > .tab.active, .soustabs > button.on,
.soustabs > .tab.active:hover, .soustabs > button.on:hover{ background:var(--vert); color:#fff; }
.soustabs > .tab.disabled{ opacity:.45; cursor:not-allowed; background:#eef1f0; color:#9aa5a1; border-color:#c9d2ce; }
.soustabs > .tab.sa1{ margin-left:auto; }
.soustabs > .tab.sa{ opacity:.6; }
.soustabs > .tab.sa:hover, .soustabs > .tab.sa.active{ opacity:1; }

/* ---- TABLEAUX : en-tete souligne menthe (repris du portail) ---- */
table{ width:100%; border-collapse:collapse; font-size:12px; }
th{ text-align:left; color:var(--gris); font-weight:600; padding:4px 6px; border-bottom:2px solid var(--menthe); }
td{ padding:4px 6px; border-bottom:1px solid #eee; }

/* ---- ETAT DE CONNEXION ---- */
#status{ font-size:13px; font-weight:700; }
.dot{ display:inline-block; width:10px; height:10px; border-radius:50%; margin-right:6px; }
.dot.off{ background:var(--rouge); } .dot.on{ background:var(--vert2); }

/* ---- JOURNAL / CONSOLE : le monospace reste legitime ICI (alignement des traces) ---- */
#log,pre,code,.mono{
  font-family:Consolas,'Courier New',monospace; font-size:12px;
  background:#fbfcfb; border:1px solid var(--ligne); border-radius:3px;
}
#log{ padding:10px; height:200px; overflow-y:auto; white-space:pre-wrap; color:#444; }

/* ---- MEDIA ---- */
canvas{ max-width:100%; height:auto; }
video{ background:#000; border:1px solid var(--vert); border-radius:3px; width:100%; }

/* IDENTITE D'UN BOITIER (2026-08-20) : nom, identifiant, flotte. Trois facons de nommer le MEME
   objet — meme libelle, meme police, partout. Elles se lisent d'un coup au lieu d'obliger l'oeil a
   changer de registre entre la liste des boitiers et la page du boitier.
   Vivait dans le CSS du portail seul ; la page boitier ne l'avait pas, d'ou ce passage ici. */
.idpref{color:#888;font-weight:400;font-size:.8rem}

/* ==== ECHELLE DE TEXTE ET UTILITAIRES (2026-09-18, Domi : « une charte graphique uniforme ») ====
 * Les pages ne definissent PLUS de police, de taille ni de couleur de texte : elles posent une de ces
 * classes. Corps 13px ; .small 12px (tableaux, boutons) ; .muted 11px gris (aides, dates) ; .tiny 10px
 * (etiquettes serrees) ; .lead 14px ; .xl / .xxl = chiffres mis en avant. Couleurs = variables ci-dessus :
 * .gris texte secondaire, .vert titre/valeur, .ok / .ko / .warn = etat. Seules exceptions tolerees :
 * les calques dessines (svg/canvas), les visionneuses video et les consoles (fond noir, monospace). */
.small{ font-size:12px; }
.tiny{ font-size:10px; }
.lead{ font-size:14px; }
.xl{ font-size:18px; font-weight:700; }
.xxl{ font-size:28px; font-weight:700; line-height:1.1; }
.gris{ color:var(--gris); }
.vert{ color:var(--vert); }
.ok{ color:var(--vert2); }
.ko{ color:var(--rouge); }
.warn{ color:var(--orange); }
.blanc{ color:#fff; }
.menthe{ color:var(--menthe); }   /* liens sur fond vert (en-tete) */
.fort{ font-weight:700; }
.normal{ font-weight:400; }
.nums{ font-variant-numeric:tabular-nums; }
/* boutons compacts (galeries, lignes de tableau) et champs en ligne */
button.mini{ padding:3px 8px; font-size:11px; }
input.inl,select.inl{ width:auto; display:inline-block; }
/* tableau serre (listes de valeurs) */
table.compact td,table.compact th{ padding:2px 6px; }
/* grille cle / valeur (constantes, telemetrie) */
.kv{ display:grid; grid-template-columns:auto 1fr; gap:2px 12px; }
.kv span{ color:var(--gris); }
.kv b{ font-variant-numeric:tabular-nums; }
/* pastille de legende */
.pt{ display:inline-block; width:11px; height:11px; border-radius:50%; border:2px solid #fff;
     box-shadow:0 0 0 1px #999; vertical-align:middle; margin-right:4px; }
/* badge d'etat (en ligne, fond clair) */
.badge{ display:inline-block; padding:1px 7px; border-radius:9px; font-size:11px; font-weight:700;
        background:#eef3f1; color:var(--vert); }
.badge.ko{ background:#fbe9e7; color:var(--rouge); }
.badge.warn{ background:#fff3e0; color:var(--orange); }
.badge.pico{ background:var(--vert); color:#fff; }   /* carte qui execute : Pico */
.badge.esp{ background:var(--vert2); color:#fff; }   /* ... ou ESP32 */
/* monospace SANS cadre (pictogrammes, barres de signal) — .mono garde le cadre des consoles */
.tt{ font-family:Consolas,'Courier New',monospace; }
/* MOBILE : cibles au doigt et saisies a 16px (iOS zoome sous 16px — contrainte, pas un style) */
@media (max-width:640px){
  button{ min-height:36px; }
  input,select,textarea{ font-size:16px; }
}

/* ETATS DES TRAMES EN DIRECT (30/10) — partages par la liste des boitiers et la page boitier (vp_tel.js) */
.badge-test{ background:#8a5cc7; color:#fff; border-radius:3px; padding:0 5px; font-size:11px; }
.rel-on{ background:var(--rouge); color:#fff; padding:0 6px; border-radius:3px; }
.al-rec{ background:#ffe3c2 !important; color:#7a3b00 !important; }

/* PASTILLES A COCHER (stats 10/09, partagées avec la vue spatiale de la page boîtier le 03/11) */
/* SELECTION DES CLASSES (10/09, Domi : « on voit pas que c'est des boutons a cocher ») : de vraies cases a
   cocher dans des pastilles bordees, etat coche/decoche lisible, titre explicite, boutons tout/aucun/inverser. */
.selt{font-size:12px;color:var(--gris);margin:6px 0 4px}
.chips{display:flex;flex-wrap:wrap;gap:6px;align-items:center}
.chip{display:inline-flex;align-items:center;gap:6px;padding:4px 10px 4px 6px;border:1px solid #c9d3ce;border-radius:16px;
      background:#fff;font-size:12px;cursor:pointer;user-select:none;line-height:1.2}
.chip input{margin:0;width:15px;height:15px;accent-color:var(--vert);cursor:pointer}
.chip i{display:inline-block;width:12px;height:12px;border-radius:2px}
.chip i.ligne{height:3px;border-radius:0}
.chip.off{background:#f3f5f4;color:#8a948f;border-style:dashed}
.chip.off i{opacity:.35}
.chip:hover{border-color:var(--vert)}
.chips .act{margin-left:6px;padding:3px 9px;font-size:11px;border:1px solid #c9d3ce;border-radius:12px;background:#fff;cursor:pointer;color:var(--vert)}
.chips .act:hover{background:#e6f2ed}
