/* ============================================================
   SOFEC Alerte — charte graphique alignée sur sofec.net
   Bleu SOFEC #0B3A6E · texte #333 · fonds bleu pâle · touche tricolore
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700;800&display=swap');

:root {
  --bleu: #0B3A6E;          /* bleu SOFEC (site) */
  --bleu-logo: #113B6A;     /* bleu du logo */
  --bleu-fonce: #072A52;
  --bleu-pale: #F0F6FC;     /* fonds de section du site */
  --bleu-pale-2: #E3EDF8;
  --bleu-ligne: #BFD0E4;    /* bordures des cartes produits */
  --rouge: #CF2E2E;         /* rouge du bandeau tricolore */
  --rouge-f: #FBE9E9;
  --sarcelle: #008A8B;      /* vert-bleu secondaire du site */
  --sarcelle-f: #E2F3F3;
  --orange: #ED8F69;        /* orange secondaire du site */
  --orange-f: #FDEFE8;
  --texte: #333333;
  --sourd: #5F6B7A;
  --fond: #F6FAFF;
  --carte: #FFFFFF;
  --ligne: #D9E3EF;
  --accent: #0B3A6E;       /* bleu des titres et liens (éclairci en mode sombre) */
  --survol: #FAFCFF;
  --bloc-fond: #FBFDFF;
  --alerte-fond: #fffafa;
  --champ-fond: #FFFFFF;
  --champ-bord: #AFC0D4;
  --danger-bord: #e6b3b3;
  --ok: #0e5a5b;
  --ok-texte: #0e5a5b;
  --err-texte: #8a1f1f;
  --oui-f: #d8f0e0;
  --oui-t: #1e6b3a;
  --orange-t: #8a4a26;
  --bandeau-t: #7a4a2b;
  --bandeau-bord: #f3d6c6;
  --urgence: #B3001B;
  --urgence-fonce: #8c0015;
  --urgence-t: #B3001B;
  --urgence-f: #fdecee;
  --urgence-bord: #e2a3ab;
  --ombre: rgba(11,58,110,.08);
  --police: "Montserrat", "Gotham", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
}
* { box-sizing: border-box; }
html { background: var(--fond); }
body { margin: 0; font: 15.5px/1.5 var(--police); background: var(--fond); color: var(--texte); }
main { max-width: 1020px; margin: 0 auto; padding: 22px 16px 48px; }
a { color: var(--accent); }
h1 { font-size: 1.65rem; font-weight: 800; color: var(--accent); letter-spacing: -.01em; margin: 6px 0 18px; }
h2 { font-size: 1.12rem; font-weight: 700; color: var(--accent); margin: 22px 0 10px; }
h3 { font-size: 1rem; font-weight: 700; color: var(--accent); margin: 16px 0 6px; }

/* ---- En-tête : barre bleue fine + bandeau blanc avec logo + liseré tricolore ---- */
.barre { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; padding: 12px 22px; background: var(--carte);
         border-top: 6px solid var(--bleu); position: relative; }
.barre::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px;
                background: linear-gradient(90deg, var(--bleu) 0 33.3%, #fff 33.3% 66.6%, var(--rouge) 66.6% 100%); }
.marque { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--accent); font-weight: 800; letter-spacing: .02em; }
.marque img { height: 30px; width: auto; display: block; }
.marque span { font-size: .95rem; text-transform: uppercase; color: var(--sourd); font-weight: 600; padding-left: 10px; border-left: 2px solid var(--bleu-ligne); }
nav { display: flex; flex-wrap: wrap; gap: 2px 6px; align-items: center; margin-left: auto; }
nav a { text-decoration: none; color: var(--accent); font-weight: 600; padding: 7px 10px; border-radius: 4px; }
nav a:hover { background: var(--bleu-pale); }
nav a.btn-primaire { background: var(--bleu); color: #fff; padding: 8px 16px; }
nav a.btn-primaire:hover { background: var(--bleu-fonce); }
nav a.discret { color: var(--sourd); font-size: .88rem; font-weight: 500; }
.badge { background: var(--rouge); color: #fff; border-radius: 10px; padding: 0 7px; font-size: .78rem; font-weight: 700; }
.bandeau { background: var(--orange-f); color: var(--bandeau-t); padding: 8px 16px; font-size: .9rem; text-align: center; border-bottom: 1px solid var(--bandeau-bord); }

/* ---- Messages flash ---- */
.flash { padding: 11px 14px; border-radius: 6px; margin-bottom: 14px; border-left: 4px solid; font-weight: 500; }
.flash.ok { background: var(--sarcelle-f); color: var(--ok-texte); border-color: var(--sarcelle); }
.flash.erreur { background: var(--rouge-f); color: var(--err-texte); border-color: var(--rouge); }

/* ---- Cartes (comme les cartes produits du site : bord bleu fin, angles doux) ---- */
.carte { background: var(--carte); border: 1px solid var(--bleu-ligne); border-radius: 8px; padding: 18px 20px; margin-bottom: 16px; }
.carte.alerte { border-color: var(--rouge); border-width: 1px; background: var(--alerte-fond); box-shadow: inset 4px 0 0 var(--rouge); }
details.carte > summary { cursor: pointer; font-weight: 700; color: var(--accent); }

/* ---- Formulaires ---- */
label { display: block; font-weight: 600; margin: 12px 0 5px; color: var(--accent); }
label small, label .aide { font-weight: 500; }
input[type=text], input[type=password], input[type=tel], input[type=number], textarea, select {
  width: 100%; padding: 10px 12px; font: inherit; border: 1px solid var(--champ-bord); border-radius: 4px; background: var(--champ-fond); color: var(--texte); }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--bleu); box-shadow: 0 0 0 3px rgba(11, 58, 110, .14); }
textarea { min-height: 110px; resize: vertical; }
.aide { color: var(--sourd); font-size: .88rem; margin: 4px 0 0; }

/* ---- Boutons : pleins bleu SOFEC, angles nets comme sur le site ---- */
.btn, button { display: inline-block; padding: 10px 18px; font: inherit; font-weight: 700; border-radius: 4px;
               border: 1px solid var(--bleu); background: var(--carte); color: var(--accent); cursor: pointer; text-decoration: none;
               transition: background .12s, color .12s; }
.btn:hover, button:hover { background: var(--bleu-pale); }
.btn-primaire, button.primaire { background: var(--bleu); border-color: var(--bleu); color: #fff; }
.btn-primaire:hover, button.primaire:hover { background: var(--bleu-fonce); border-color: var(--bleu-fonce); }
button.danger { color: var(--rouge); border-color: var(--danger-bord); }
button.danger:hover { background: var(--rouge-f); }
button.petit, .btn.petit { padding: 5px 11px; font-size: .84rem; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; align-items: center; }

/* ---- Tableaux ---- */
table { width: 100%; border-collapse: collapse; background: var(--carte); }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--ligne); vertical-align: top; }
th { font-size: .78rem; color: var(--accent); text-transform: uppercase; letter-spacing: .06em; background: var(--bleu-pale); font-weight: 700; }
tr:hover td { background: var(--survol); }
.tableau { overflow-x: auto; border: 1px solid var(--bleu-ligne); border-radius: 8px; }

/* ---- Étiquettes de niveau et de statut ---- */
.etiq { display: inline-block; padding: 3px 10px; border-radius: 3px; font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.etiq.critique { background: var(--bleu); color: #fff; }
.etiq.important { background: var(--bleu); color: #fff; }
.etiq.information { background: var(--bleu-pale-2); color: var(--accent); }
.etiq.sondage { background: var(--sarcelle, #1a8a8c); color: #fff; }
.etiq.oui { background: var(--oui-f); color: var(--oui-t); }
.etiq.non { background: var(--rouge-f); color: var(--err-texte); }
.stat-oui b { color: var(--oui-t); }
.stat-non b { color: var(--err-texte); }
form.oui-non { display: inline-flex; gap: 4px; }
.etiq.confirme { background: var(--sarcelle-f); color: var(--ok-texte); }
.etiq.envoye, .etiq.attente { background: var(--orange-f); color: var(--orange-t); }
.etiq.erreur { background: var(--rouge-f); color: var(--err-texte); }

/* ---- Choix du niveau / des groupes ---- */
.niveaux { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.niveaux label { margin: 0; padding: 14px; border: 1px solid var(--bleu-ligne); border-radius: 8px; cursor: pointer; font-weight: 400; color: var(--texte); background: var(--carte); }
.niveaux label:has(input:checked) { border-color: var(--bleu); box-shadow: inset 0 0 0 1px var(--bleu); background: var(--bleu-pale); }
.niveaux input { margin-right: 6px; accent-color: var(--bleu); }
.niveaux b { display: block; color: var(--accent); font-weight: 800; }
.groupes { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.groupes label { margin: 0; padding: 10px 12px; border: 1px solid var(--bleu-ligne); border-radius: 6px; cursor: pointer; font-weight: 600; color: var(--texte); background: var(--carte); }
.groupes label:has(input:checked) { border-color: var(--bleu); background: var(--bleu-pale); color: var(--accent); }
.groupes label.tous { grid-column: 1 / -1; border-style: dashed; }
.groupes input { accent-color: var(--bleu); }
.groupes small { color: var(--sourd); font-weight: 500; }

/* ---- Chiffres clés ---- */
.stats { display: flex; flex-wrap: wrap; gap: 12px; margin: 12px 0; }
.stat { background: var(--carte); border: 1px solid var(--bleu-ligne); border-left: 4px solid var(--bleu); border-radius: 6px; padding: 10px 18px; min-width: 130px; }
.stat b { display: block; font-size: 1.7rem; font-weight: 800; color: var(--accent); line-height: 1.1; }
.stat span { color: var(--sourd); font-size: .84rem; font-weight: 500; }

.apercu { background: var(--bleu-pale); border: 1px solid var(--bleu-ligne); border-radius: 6px; padding: 10px 12px; font-family: ui-monospace, Consolas, monospace; white-space: pre-wrap; font-size: .9rem; }
.compteur { color: var(--sourd); font-size: .84rem; text-align: right; }
.centre { max-width: 460px; margin: 48px auto; }
.inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline input { width: auto; flex: 1; }
.journal td:first-child { white-space: nowrap; color: var(--sourd); font-size: .9rem; }
code { background: var(--bleu-pale); color: var(--accent); padding: 1px 6px; border-radius: 3px; font-size: .92em; }
.bloc { margin-top: 8px; padding: 14px 16px; border: 1px dashed var(--bleu-ligne); border-radius: 8px; background: var(--bloc-fond); }
.bloc h2 { margin-top: 0; }
input[type=checkbox], input[type=radio] { accent-color: var(--bleu); }

/* ---- Téléphone : barre de navigation en bas, menu du haut réduit à l'essentiel ---- */
.barre-mobile, .mobile-haut { display: none; }
.mobile-haut { margin-left: auto; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.mobile-haut a { color: var(--sourd); font-size: .8rem; font-weight: 600; text-decoration: none; }
@media (max-width: 640px) {
  .barre { padding: 10px 14px; }
  .barre nav { display: none; }                 /* le menu complet laisse place à la barre du bas */
  .marque span { display: none; }
  .barre .mobile-haut { display: flex; }
  main { padding-bottom: 86px; }               /* place pour la barre du bas */
  .barre-mobile { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
    background: var(--carte); border-top: 1px solid var(--bleu-ligne); box-shadow: 0 -2px 10px var(--ombre);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
  .barre-mobile a { flex: 1; text-align: center; text-decoration: none; color: var(--sourd); font-size: .72rem; font-weight: 600; padding: 4px 2px; border-radius: 8px; line-height: 1.2; }
  .barre-mobile a .ico { display: block; font-size: 1.25rem; line-height: 1.3; }
  .barre-mobile a.actif { color: var(--accent); background: var(--bleu-pale); }
  .barre-mobile .badge { position: relative; top: -2px; }
  th, td { padding: 8px 7px; font-size: .9rem; }
  h1 { font-size: 1.35rem; }
  .niveaux, .groupes { grid-template-columns: 1fr; }
  .stats .stat { flex: 1 1 40%; min-width: 0; }
  .actions form, .actions .btn, .actions button { width: 100%; }
}
.pied { text-align: center; padding: 0 16px 28px; font-size: .85rem; }
.pied a { color: var(--sourd); }
@media (max-width: 640px) { main { padding-bottom: 16px; } .pied { padding-bottom: 92px; } }
@media print { .barre, .bandeau, nav, .actions, details > summary { display: none !important; } body { background: #fff; } }

/* Abus de réponses (rouge) */
.etiq.urgence { background: var(--urgence); color: #fff; }
/* Info officielle SOFEC (clé interne « urgence ») */
.etiq.officiel { background: var(--bleu); color: #fff; }
.niveaux label.type-officiel { border-color: var(--bleu-ligne); }
.niveaux label.type-officiel b { color: var(--accent); }
.niveaux label.type-officiel:has(input:checked) { border-color: var(--bleu); box-shadow: inset 0 0 0 1px var(--bleu); background: var(--bleu-pale); }
.mention-officiel { margin: 8px 0 0; padding: 8px 12px; border-left: 4px solid var(--bleu); background: var(--bleu-pale); color: var(--accent); font-weight: 600; border-radius: 4px; }
.niveaux label.type-urgence { border-color: var(--urgence-bord); }
.niveaux label.type-urgence b { color: var(--urgence-t); }
.niveaux label.type-urgence:has(input:checked) { border-color: var(--urgence); box-shadow: inset 0 0 0 1px var(--urgence); background: var(--urgence-f); }
button.danger-plein, .btn.danger-plein { background: var(--urgence); border-color: var(--urgence); color: #fff; }
button.danger-plein:hover { background: var(--urgence-fonce); }
.etiq.programme { background: var(--orange-f); color: var(--orange-t); }
.chiffres { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); margin: 12px 0; }
.chiffres .stat b { font-size: 1.6rem; }

/* ============================================================
   Mode sombre (bouton ☾ / ☀ en haut à droite ; par défaut : réglage de Windows / du téléphone)
   Même charte SOFEC, fonds bleu nuit, contrastes vérifiés pour la lecture
   ============================================================ */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bleu: #2D6CB4;  --bleu-logo: #2D6CB4;  --bleu-fonce: #3D7DC6;  --accent: #8DBEF0;
  --bleu-pale: #18263A;  --bleu-pale-2: #1F3149;  --bleu-ligne: #2C405A;
  --rouge: #E05A5A;  --rouge-f: #3A1F24;
  --sarcelle: #177F80;  --sarcelle-f: #12302F;
  --orange: #F0A17F;  --orange-f: #3A2A1F;
  --texte: #E4E9F0;  --sourd: #9EABBC;
  --fond: #0E1621;  --carte: #16212F;  --ligne: #253447;
  --survol: #1B2939;  --bloc-fond: #132030;  --alerte-fond: #2A1A1F;
  --champ-fond: #0F1A27;  --champ-bord: #3A506C;  --danger-bord: #6B3238;
  --ok: #7FD6D6;  --ok-texte: #7FD6D6;  --err-texte: #F4A7A7;
  --oui-f: #15321F;  --oui-t: #8FDCA8;  --orange-t: #F2B896;
  --bandeau-t: #F2C7AE;  --bandeau-bord: #4A3426;
  --urgence: #C91D35;  --urgence-fonce: #E0324B;  --urgence-t: #FF8E9E;  --urgence-f: #3A1A21;  --urgence-bord: #7A2A35;
  --ombre: rgba(0,0,0,.45);
}
:root[data-theme="dark"] input:focus, :root[data-theme="dark"] textarea:focus, :root[data-theme="dark"] select:focus { box-shadow: 0 0 0 3px rgba(141,190,240,.22); }
.logo-sombre { display: none !important; }
:root[data-theme="dark"] .logo-clair { display: none !important; }
:root[data-theme="dark"] .logo-sombre { display: block !important; }
.bouton-theme { margin-left: 4px; padding: 6px 10px; font-size: 1rem; line-height: 1; border-color: var(--bleu-ligne); color: var(--accent); background: transparent; font-weight: 600; }
.bouton-theme:hover { background: var(--bleu-pale); }
.bouton-theme .lib { font-size: .8rem; margin-left: 4px; }
@media (max-width: 640px) { .bouton-theme { margin-left: 0; } .bouton-theme .lib { display: none; } }
.marque + .bouton-theme { margin-left: auto; }
nav .bouton-theme .lib, .mobile-haut .bouton-theme .lib { display: none; }
.mobile-haut .bouton-theme { padding: 2px 8px; font-size: .9rem; }
.champs { display: grid; gap: 0 12px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
tr.abus td { background: var(--urgence-f); }
tr.abus:hover td { background: var(--urgence-f); }
a.etiq { text-decoration: none; }
