:root {
  color-scheme: light dark;
  --accent: #2a78d6; --bg: #f7f8fa; --card: #fcfcfb; --line: #e1e4ea; --muted: #646b78; --texte: #1d2025;
  --oui: #1e7a3c; --oui-bg: #e6f4ea; --non: #8a5a00; --non-bg: #fdf3e1; --alerte: #b3261e;
  /* Couleurs des sondes (ordre fixe : rdc, étage, dehors, puis capteurs inconnus) */
  --meteo: #6b7280;
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100; --s5: #e87ba4;
}
@media (prefers-color-scheme: dark) {
  :root {
    --accent: #6da7ec; --bg: #131518; --card: #1a1a19; --line: #33373f; --muted: #a0a6b1; --texte: #f0efec;
    --oui: #6fcf8f; --oui-bg: #1d3325; --non: #f0b45a; --non-bg: #33281a; --alerte: #f08a80;
    --meteo: #9ca3af;
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181;
  }
}
* { box-sizing: border-box; }
body { margin: 0; font: 16px/1.5 system-ui, sans-serif; background: var(--bg); color: var(--texte); }
main { max-width: 48rem; margin: 0 auto; padding: 1rem; }
h1 { color: var(--accent); margin: 0; }
h2 { font-size: 1.2rem; margin: 1.5rem 0 .5rem; }
h3 { font-size: 1rem; margin: 1rem 0 .25rem; }
header p { margin: .25rem 0 0; font-size: .9rem; }
small, .muted { color: var(--muted); }
code { font-size: .85em; }
.err, .alerte { color: var(--alerte); }
.tete { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: .5rem; }

.tuiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: .5rem; }
.tuile { background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--c); border-radius: .75rem;
  padding: .6rem .75rem; display: flex; flex-direction: column; }
.tuile h3 { margin: 0; }
.tuile .valeurs { display: flex; gap: 1rem; }
.tuile .valeurs b { font-size: 1.6rem; font-variant-numeric: tabular-nums; }
.tuile .alerte { font-size: .85rem; font-weight: 600; }

.conseil { border-radius: .75rem; padding: .6rem .75rem; margin: 0 0 .75rem; font-weight: 600; }
.conseil.oui { background: var(--oui-bg); color: var(--oui); }
.conseil.non { background: var(--non-bg); color: var(--non); }

.periodes { display: flex; gap: .25rem; }
.periodes button { font: inherit; font-size: .85rem; padding: .2rem .6rem; border-radius: 1rem; cursor: pointer;
  border: 1px solid var(--line); background: var(--card); color: var(--texte); }
.periodes button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }

.legende { font-size: .85rem; display: flex; flex-wrap: wrap; gap: .25rem 1rem; }
.legende i, .bulle i { display: inline-block; width: .8rem; height: .25rem; border-radius: 2px; vertical-align: middle; margin-right: .3rem; }
.legende i.pointille { background: repeating-linear-gradient(90deg, var(--meteo) 0 5px, transparent 5px 8px); }
.courbe { background: var(--card); border: 1px solid var(--line); border-radius: .75rem; padding: .5rem 0; min-height: 3rem; }
.courbe > p { margin: 0 .75rem; }
.zone { position: relative; }
.zone svg { display: block; touch-action: pan-y; }
.zone text { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.zone text.etiquette { fill: var(--texte); font-size: 12px; }
.zone .grille { stroke: var(--line); }
.zone .repere { stroke: var(--muted); stroke-dasharray: 3 3; }
.zone .point { stroke: var(--card); stroke-width: 2; }
.bulle { position: absolute; top: 0; pointer-events: none; background: var(--card); border: 1px solid var(--line);
  border-radius: .5rem; padding: .3rem .5rem; font-size: .85rem; white-space: nowrap; box-shadow: 0 2px 8px #0003; }
