/* HSWF Maison — identité HSWF : bleu nuit, indigo, or, lavande, brume. Sombre d'abord. */
:root {
  color-scheme: dark;
  --sol: #100E2B; --surface: #1E1B4B; --releve: #2A2670; --trait: rgba(199, 210, 254, 0.14);
  --texte: #EEF2FF; --doux: #A9B1E6; --or: #FBBF24; --sur-or: #1E1B4B;
  --ok: #4ADE80; --attente: #93C5FD; --alerte: #FB7185; --voile: rgba(16, 14, 43, 0.88);
  --titre: "Red Hat Display", "Segoe UI", system-ui, sans-serif;
  --corps: "Red Hat Text", "Segoe UI", system-ui, sans-serif;
  --chiffre: "Red Hat Mono", ui-monospace, "Cascadia Mono", monospace;
  --rayon: 18px;
}
@media (prefers-color-scheme: light) {
  :root { color-scheme: light; --sol: #EEF2FF; --surface: #FFFFFF; --releve: #E0E5FF; --trait: rgba(49, 46, 129, 0.14);
    --texte: #1E1B4B; --doux: #4C5191; --or: #F5B312; --ok: #15803D; --attente: #1D4ED8; --alerte: #BE123C; --voile: rgba(238, 242, 255, 0.92); }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--sol); color: var(--texte); font: 15px/1.45 var(--corps);
  padding: env(safe-area-inset-top, 0px) max(16px, env(safe-area-inset-right, 0px)) 0 max(16px, env(safe-area-inset-left, 0px)); }
button, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--or); outline-offset: 2px; }
h1, h2 { font-family: var(--titre); margin: 0; text-wrap: balance; }
.app { max-width: 720px; margin: 0 auto; padding: 12px 0 calc(96px + env(safe-area-inset-bottom, 0px)); }

.bandeau-dev { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 12.5px; color: var(--doux); border: 1px dashed var(--trait); border-radius: 12px; padding: 8px 12px; }
.bandeau-dev b { color: var(--texte); }
.bandeau-dev select { background: var(--releve); border: 1px solid var(--trait); border-radius: 8px; padding: 3px 6px; }
.entete { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; margin-top: 16px; }
.entete h1 { font-size: 30px; font-weight: 800; }
.sous { color: var(--doux); font-size: 13.5px; margin-top: 2px; }
.meteo { text-align: right; font-size: 13px; color: var(--doux); }
.meteo b { display: block; font-family: var(--chiffre); font-size: 22px; color: var(--texte); font-weight: 500; }
.alerte { margin-top: 12px; border-radius: 14px; padding: 10px 12px; font-size: 14px; background: rgba(251, 191, 36, 0.14); border: 1px solid rgba(251, 191, 36, 0.4); }
.alerte.grave { background: rgba(251, 113, 133, 0.14); border-color: rgba(251, 113, 133, 0.5); }
.resume { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.pastille { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 999px; background: var(--releve); font-size: 13px; }
.pastille i { width: 8px; height: 8px; border-radius: 50%; background: var(--doux); }
.pastille.on i { background: var(--or); box-shadow: 0 0 8px var(--or); }
.pastille.ok i { background: var(--ok); }
.pastille.ko i { background: var(--alerte); }
.etiquette { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--doux); font-weight: 600; margin: 24px 0 10px; display: flex; justify-content: space-between; gap: 8px; }
.etiquette span { text-transform: none; letter-spacing: 0; font-weight: 500; }

.pieces { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.pieces::-webkit-scrollbar { display: none; }
.puce { flex: none; border: 1px solid var(--trait); background: transparent; border-radius: 999px; padding: 7px 13px; font-size: 13.5px; }
.puce[aria-pressed="true"] { background: var(--texte); color: var(--sol); border-color: var(--texte); font-weight: 600; }
.piece { background: var(--surface); border-radius: var(--rayon); padding: 14px; margin-top: 12px; border: 1px solid var(--trait); }
.piece.favorite { border-color: rgba(251, 191, 36, 0.55); }
.piece.attente { opacity: .7; }
.piece-tete { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.piece-tete h2 { font-size: 18px; font-weight: 700; }
.piece-tete small { display: block; color: var(--doux); font-size: 12.5px; font-family: var(--corps); font-weight: 400; }
.etoile { color: var(--or); font-size: 13px; margin-left: 6px; font-family: var(--corps); font-weight: 600; }
.tuiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
@media (min-width: 620px) { .tuiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.app-c { display: grid; gap: 6px; background: var(--releve); border-radius: 14px; padding-bottom: 6px; min-width: 0; }
.app-c .app-t { width: 100%; }
.app-c input[type=range] { width: calc(100% - 20px); margin: 0 10px; accent-color: var(--or); height: 18px; }
.app-c.en-cours .app-etat { color: var(--attente); }
.app-t { background: var(--releve); border-radius: 14px; padding: 10px 12px; display: flex; gap: 8px; align-items: center; min-width: 0; border: 0; text-align: left; }
.app-t.on { background: linear-gradient(160deg, rgba(251, 191, 36, 0.30), rgba(251, 191, 36, 0.10)), var(--releve); }
.app-t.a_relier, .app-t.hors_ligne { opacity: .55; }
.icone { width: 30px; height: 30px; border-radius: 50%; flex: none; display: grid; place-items: center; background: var(--surface); }
.icone svg { width: 18px; height: 18px; stroke: var(--doux); fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.app-t.on .icone { background: var(--or); }
.app-t.on .icone svg { stroke: var(--sur-or); }
.app-nom { font-size: 13.5px; font-weight: 600; line-height: 1.2; overflow-wrap: anywhere; }
.app-etat { font-size: 12px; color: var(--doux); font-family: var(--chiffre); }
.ligne { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--releve); border-radius: 14px; padding: 10px 12px; margin-top: 8px; }
.ligne .nom { font-weight: 600; font-size: 14px; min-width: 0; }
.ligne .nom small { display: block; font-weight: 400; color: var(--doux); font-size: 12px; }
.valeur { font-family: var(--chiffre); font-size: 18px; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.valeur small { display: block; font-size: 11px; color: var(--doux); font-family: var(--corps); }
.badge { font-size: 11px; padding: 3px 8px; border-radius: 999px; border: 1px solid var(--trait); color: var(--doux); white-space: nowrap; }
.badge.ok { color: var(--ok); border-color: currentColor; }
.badge.att { color: var(--attente); border-color: currentColor; }
.badge.ko { color: var(--alerte); border-color: currentColor; }

.cams { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
.cam { position: relative; aspect-ratio: 16 / 9; max-width: 100%; border-radius: 12px; overflow: hidden; background: var(--releve); border: 1px solid var(--trait); }
.cam.grande { grid-column: 1 / -1; }
.cam img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cam span { position: absolute; left: 0; right: 0; bottom: 0; padding: 18px 8px 6px; font-size: 12.5px; font-weight: 600; color: #fff; background: linear-gradient(transparent, rgba(0, 0, 0, .65)); }

.apps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.appli { background: var(--surface); border: 1px solid var(--trait); border-radius: 18px; padding: 14px 6px 12px; display: grid; justify-items: center; gap: 6px; text-decoration: none; color: var(--texte); font-size: 13px; font-weight: 600; text-align: center; }
.appli svg { width: 46px; height: 46px; }
.appli small { font-weight: 400; color: var(--doux); font-size: 11.5px; }
.reglage { display: flex; justify-content: space-between; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--trait); border-radius: 14px; padding: 12px; margin-top: 8px; }

.onglets { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--voile); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--trait);
  padding: 8px max(16px, env(safe-area-inset-right, 0px)) calc(10px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); }
.onglets-int { max-width: 460px; margin: 0 auto; display: grid; grid-template-columns: repeat(3, 1fr); }
.onglet { background: none; border: 0; display: grid; justify-items: center; gap: 2px; font-size: 12px; color: var(--doux); padding: 4px 0; }
.onglet svg { width: 26px; height: 26px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.onglet[aria-current="page"] { color: var(--texte); font-weight: 600; }
.onglet[aria-current="page"] svg { stroke: var(--or); }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(90px + env(safe-area-inset-bottom, 0px)); background: var(--texte); color: var(--sol); padding: 10px 16px; border-radius: 12px; font-size: 13.5px; max-width: min(420px, calc(100% - 32px)); z-index: 30; }
.retour { background: none; border: 0; color: var(--doux); padding: 6px 0; font-size: 14px; }
.lien-vue { width: 100%; text-align: left; color: var(--texte); cursor: pointer; }
.fleche { color: var(--doux); font-size: 20px; line-height: 1; }
.texte { background: var(--surface); border: 1px solid var(--trait); border-radius: var(--rayon); padding: 6px 16px 14px; margin-top: 12px; }
.texte h2 { font-size: 16px; margin: 14px 0 4px; }
.texte p { margin: 0 0 6px; max-width: 65ch; color: var(--texte); }
.ip { font-family: var(--chiffre); font-size: 12px; color: var(--doux); }
.note-version { background: var(--surface); border: 1px solid var(--trait); border-radius: 14px; padding: 10px 12px; margin-top: 8px; }
.note-version b { font-family: var(--chiffre); }
.note-version ul { margin: 6px 0 0; padding-left: 18px; color: var(--doux); }
.voile { position: fixed; inset: 0; z-index: 50; background: var(--sol); display: grid; place-items: center; }
.voile[hidden] { display: none; }
.voile-carte { display: grid; justify-items: center; gap: 12px; color: var(--doux); text-align: center; padding: 16px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
