/* HomeTravel — PWA famille — feuille de style unique */
:root {
  --fond: #f4f6f9; --carte: #ffffff; --texte: #1b2430; --texte2: #5b6b7f; --ligne: #e1e6ee;
  --accent: #1f3a5f; --accent-texte: #ffffff; --ok: #2e8b57; --ok-fond: #e5f5ec;
  --attention: #b26a00; --attention-fond: #fff3e0; --panne: #b3261e; --panne-fond: #fdecea;
  --info: #2a5f9e; --info-fond: #e8f0fb; --focus: #ffb300; --rayon: 14px; --ombre: 0 1px 3px rgba(20,30,50,.08);
  --nav-h: 64px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --fond: #0f141b; --carte: #1a2230; --texte: #e8edf4; --texte2: #9fb0c4; --ligne: #2a3546;
    --accent: #7fb0ff; --accent-texte: #0b1626; --ok: #5ccb8a; --ok-fond: #15301f;
    --attention: #ffb84d; --attention-fond: #3a2a0c; --panne: #ff7b72; --panne-fond: #3c1a18;
    --info: #8fbaf5; --info-fond: #172a44; --ombre: none;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font: 17px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--fond); color: var(--texte); min-height: 100vh;
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom));
}
h1, h2, h3 { margin: 0; line-height: 1.25; }
h1 { font-size: 1.35rem; }
h2 { font-size: 1.05rem; color: var(--texte2); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; margin: 22px 0 10px; }
h3 { font-size: 1.1rem; }
p { margin: 0 0 10px; }
a { color: var(--accent); }
button { font: inherit; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* En-tête */
.entete { position: sticky; top: 0; z-index: 5; background: var(--accent); color: var(--accent-texte);
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px; display: flex; align-items: center; gap: 10px; }
.entete .titre { flex: 1; }
.entete small { display: block; opacity: .8; font-size: .8rem; }
.entete .bouton-retour { background: transparent; border: 0; color: inherit; font-size: 1.6rem; line-height: 1; padding: 4px 8px; margin-left: -8px; border-radius: 8px; }
.entete .bouton-retour[hidden] { display: none; }

/* Bandeaux */
.bandeau { padding: 10px 16px; font-size: .95rem; display: flex; gap: 10px; align-items: center; }
.bandeau.panne { background: var(--panne-fond); color: var(--panne); }
.bandeau.attention { background: var(--attention-fond); color: var(--attention); }
.bandeau.info { background: var(--info-fond); color: var(--info); }
.bandeau button { margin-left: auto; }
.bandeau[hidden] { display: none; }

/* Contenu */
main { padding: 8px 16px 24px; max-width: 640px; margin: 0 auto; }
.ecran[hidden] { display: none; }
.carte { background: var(--carte); border-radius: var(--rayon); box-shadow: var(--ombre); padding: 14px 16px; margin-bottom: 12px; border: 1px solid var(--ligne); }
.carte-tete { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.carte-tete h3 { flex: 1; }
.ligne { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-top: 1px solid var(--ligne); font-size: .97rem; }
.ligne:first-of-type { border-top: 0; }
.ligne span:last-child { color: var(--texte2); text-align: right; }
.muet { color: var(--texte2); font-size: .92rem; }

/* Pastilles d'état */
.pastille { display: inline-flex; align-items: center; gap: 6px; font-size: .85rem; font-weight: 600; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.pastille::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: currentColor; }
.pastille.ok { background: var(--ok-fond); color: var(--ok); }
.pastille.panne { background: var(--panne-fond); color: var(--panne); }
.pastille.attention { background: var(--attention-fond); color: var(--attention); }
.pastille.info { background: var(--info-fond); color: var(--info); }
.pastille.neutre { background: var(--fond); color: var(--texte2); }

/* Boutons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 10px 16px; border-radius: 12px;
  border: 1px solid var(--ligne); background: var(--carte); color: var(--texte); font-weight: 600; cursor: pointer; text-decoration: none; width: 100%; }
.btn.primaire { background: var(--accent); color: var(--accent-texte); border-color: var(--accent); }
.btn.danger { color: var(--panne); border-color: var(--panne); }
.btn.petit { min-height: 40px; padding: 6px 12px; width: auto; font-size: .92rem; }
.btn:disabled { opacity: .5; cursor: default; }
.btn-groupe { display: grid; gap: 8px; margin-top: 10px; }
.btn-groupe.deux { grid-template-columns: 1fr 1fr; }
.actions-ligne { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }

/* Choix segmenté (bascules) */
.segment { display: flex; border: 1px solid var(--ligne); border-radius: 12px; overflow: hidden; margin-top: 8px; }
.segment button { flex: 1; min-height: 44px; border: 0; background: transparent; color: var(--texte); font-weight: 600; cursor: pointer; }
.segment button[aria-pressed="true"] { background: var(--accent); color: var(--accent-texte); }
.segment button + button { border-left: 1px solid var(--ligne); }

/* Formulaires */
label.champ { display: block; margin: 12px 0 4px; font-weight: 600; font-size: .95rem; }
input[type=text], input[type=tel], input[type=time], input[type=datetime-local], select {
  width: 100%; min-height: 48px; font: inherit; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--ligne); background: var(--carte); color: var(--texte); }
.case { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-top: 1px solid var(--ligne); }
.case:first-child { border-top: 0; }
.case input { width: 24px; height: 24px; margin: 2px 0 0; flex: none; accent-color: var(--accent); }
.case span small { display: block; color: var(--texte2); }
.interrupteur { margin-left: auto; }

/* Liste d'alertes */
.alerte { border-left: 5px solid var(--info); }
.alerte.decision { border-left-color: var(--attention); }
.alerte.panne { border-left-color: var(--panne); }
.alerte.terminee, .alerte.lue { opacity: .85; }
.alerte .quand { color: var(--texte2); font-size: .85rem; }
.alerte .corps { margin: 6px 0; }

/* Navigation basse */
.nav { position: fixed; bottom: 0; left: 0; right: 0; height: calc(var(--nav-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: var(--carte); border-top: 1px solid var(--ligne); display: flex; z-index: 5; }
.nav button { flex: 1; border: 0; background: transparent; color: var(--texte2); font-size: .72rem; font-weight: 600; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; position: relative; cursor: pointer; }
.nav button[aria-current="page"] { color: var(--accent); }
.nav svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.nav .badge { position: absolute; top: 6px; left: calc(50% + 6px); min-width: 18px; height: 18px; border-radius: 9px; background: var(--panne); color: #fff; font-size: .7rem; display: flex; align-items: center; justify-content: center; padding: 0 5px; }
.nav .badge[hidden] { display: none; }
.nav[hidden] { display: none; }

/* Boîte de confirmation */
dialog { border: 0; border-radius: var(--rayon); padding: 20px; max-width: 420px; width: calc(100% - 32px); background: var(--carte); color: var(--texte); }
dialog::backdrop { background: rgba(0,0,0,.45); }
dialog h3 { margin-bottom: 8px; }

/* Message temporaire */
.toast { position: fixed; left: 50%; bottom: calc(var(--nav-h) + 16px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--texte); color: var(--fond);
  padding: 10px 16px; border-radius: 10px; font-size: .95rem; z-index: 9; max-width: 90%; }
.toast[hidden] { display: none; }

/* Démonstration */
.demo-barre { background: #5b3cc4; color: #fff; font-size: .85rem; padding: 6px 16px; display: flex; gap: 10px; align-items: center; }
.demo-barre select { min-height: 32px; padding: 2px 8px; width: auto; border-radius: 8px; font-size: .85rem; }
.demo-barre[hidden] { display: none; }

.etapes { counter-reset: e; padding-left: 0; list-style: none; }
.etapes li { counter-increment: e; display: flex; gap: 12px; padding: 8px 0; align-items: flex-start; }
.etapes li > span { flex: 1; }
.etapes li::before { content: counter(e); flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: var(--accent-texte); display: flex; align-items: center; justify-content: center; font-weight: 700; }
.grille-contact { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.grille-contact .btn { min-height: 56px; flex-direction: column; gap: 2px; font-size: .95rem; }
.grille-contact .btn small { font-weight: 400; color: var(--texte2); }
.centre { text-align: center; }
.espace { height: 8px; }
.espace-haut { margin-top: 8px; }
.espace-haut-petit { margin-top: 6px; }

/* Diagnostic Wi-Fi : données longues et navigation clavier. */
.wifi-facts { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,2fr); gap: .6rem 1rem; }
.wifi-facts dt { font-weight: 650; }
.wifi-facts dd { margin: 0; overflow-wrap: anywhere; }
#wifi-clients p, #wifi-events li { overflow-wrap: anywhere; line-height: 1.5; }
#wifi-run { white-space: normal; }
#wifi-run:focus-visible, #btn-wifi:focus-visible { outline: 3px solid #1273da; outline-offset: 4px; }
@media (max-width: 480px) { .wifi-facts { grid-template-columns: minmax(0,1fr); } .wifi-facts dd { margin-bottom: .6rem; } }
