/* Domotique — feuille de style (maquette validée par Jérémy le 25.10.2026). Polices du système : rien de chargé ailleurs. */
:root {
  --fond: #f4f3ef; --carte: #ffffff; --encre: #18191b; --encre-2: #55565a; --encre-3: #8b8c90;
  --trait: #e4e2dc; --trait-fort: #cfccc4; --entete: #1c2127; --entete-2: #2a3038; --accent: #e9a400;
  /* une couleur par sujet, la même partout (validées pour les daltoniens le 25.10.2026) */
  --sol125: #e9a400; --sol60: #d9480f; --maison: #0090a8; --zoe: #7a3ad1;
  --chauffage: #c81e4a; --ecs: #2a78d6; --salon: #1baf7a; --exterieur: #7d7c75;
  --reseau: #6b6a65; --injecte: #23a05a; --bas-tarif: rgba(35, 160, 90, 0.09);
  --ok: #0ca30c; --attention: #fab219; --critique: #d03b3b;
  --rayon: 6px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
/* la page ne bouge jamais de côté (téléphone) : rien ne dépasse, et ce qui dépasserait est coupé.
   « clip » et non « hidden » : hidden fait de body une zone de défilement et décroche l'en-tête collant (Safari, 25.10.2026) */
html { scroll-padding-top: 118px; overflow-x: clip; -webkit-text-size-adjust: 100%; }
body { overflow-x: clip; max-width: 100vw; }
.maintenant > *, .deux > *, .carte, .graphe { min-width: 0; }
.graphe { overflow: hidden; touch-action: pan-y; }
body { margin: 0; background: var(--fond); color: var(--encre);
       font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, system-ui, sans-serif; font-feature-settings: "tnum" 1; }
.chiffre { font-variant-numeric: tabular-nums; }
a { color: inherit; }

/* en-tête */
header { position: sticky; top: 0; z-index: 20; background: var(--entete); color: #f1efe8; padding-top: env(safe-area-inset-top); }
.barre { display: flex; align-items: center; gap: 18px; padding: 0 24px; height: 60px; max-width: 1360px; margin: 0 auto; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; letter-spacing: .2px; white-space: nowrap; }
.modules { display: flex; gap: 4px; margin-left: 18px; }
.module { color: #c9c6bd; text-decoration: none; padding: 7px 12px; border-radius: 5px; font-weight: 500; }
.module.actif { background: var(--entete-2); color: #fff; box-shadow: inset 0 -2px 0 var(--accent); }
.direct { margin-left: auto; display: flex; align-items: center; gap: 10px; color: #c9c6bd; font-size: 13px; white-space: nowrap; }
.pastille { width: 8px; height: 8px; border-radius: 50%; background: var(--encre-3); }
.pastille.vivant { background: var(--ok); box-shadow: 0 0 0 0 rgba(12,163,12,.6); animation: pouls 2s infinite; }
.pastille.vieux { background: var(--attention); }
@keyframes pouls { 70% { box-shadow: 0 0 0 7px rgba(12,163,12,0); } 100% { box-shadow: 0 0 0 0 rgba(12,163,12,0); } }
.canal { font-size: 11px; font-weight: 700; letter-spacing: .5px; padding: 3px 7px; border-radius: 4px; text-decoration: none; color: #fff; }
.canal.prod { background: #1f7a3a; } .canal.dev, .canal.local { background: #d26b00; }
.menu-compte { position: relative; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--entete-2); display: grid; place-items: center; font: 600 12px/1 inherit; color: #fff; border: 1px solid #3b424c; cursor: pointer; padding: 0; }
.menu { position: absolute; right: 0; top: 40px; background: var(--carte); color: var(--encre); border: 1px solid var(--trait); border-radius: var(--rayon);
        box-shadow: 0 8px 24px rgba(0,0,0,.12); min-width: 190px; padding: 6px; display: grid; z-index: 30; }
.menu b { padding: 8px 10px 6px; font-size: 12px; color: var(--encre-2); font-weight: 600; }
.menu a, .menu button { text-align: left; padding: 9px 10px; border-radius: 4px; text-decoration: none; font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
.menu a:hover, .menu button:hover { background: #f4f3ef; }
body.en-dev header { box-shadow: 0 4px 0 0 #d26b00; }
body.en-dev header::after { content: ""; display: block; height: 6px; background: repeating-linear-gradient(135deg, #d26b00 0 8px, #f0a24f 8px 16px); }
.onglets { background: var(--carte); border-bottom: 1px solid var(--trait); }
.onglets nav { display: flex; gap: 2px; max-width: 1360px; margin: 0 auto; padding: 0 24px; overflow-x: auto; scrollbar-width: none; }
.onglets a { color: var(--encre-2); text-decoration: none; padding: 13px 14px 11px; border-bottom: 2px solid transparent; font-weight: 500; white-space: nowrap; }
.onglets a.actif { color: var(--encre); border-bottom-color: var(--encre); }
.onglets a.bientot { color: var(--encre-3); pointer-events: none; }
.onglets a.bientot::after { content: "bientôt"; font-size: 10px; margin-left: 6px; padding: 1px 5px; border-radius: 3px; background: #efede7; color: var(--encre-3); }

main { max-width: 1360px; margin: 0 auto; padding: 22px 24px 40px; }
section { margin-bottom: 34px; }
h2 { font-size: 20px; margin: 0 0 4px; letter-spacing: -.2px; }
.sous { color: var(--encre-2); margin: 0 0 16px; }
.carte { background: var(--carte); border: 1px solid var(--trait); border-radius: var(--rayon); padding: 18px; }
.titre-carte { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.titre-carte h3 { font-size: 14px; margin: 0; font-weight: 600; }
.note { color: var(--encre-3); font-size: 12px; }
.erreur-api { background: #fdecea; border: 1px solid #f3b8b2; color: #8a1f17; border-radius: var(--rayon); padding: 10px 14px; margin: 0 0 18px; }

/* maintenant */
.maintenant { display: grid; grid-template-columns: minmax(320px, 5fr) 7fr; gap: 16px; }
.flux svg { width: 100%; height: auto; display: block; }
.flux .ligne { fill: none; stroke-width: 3; stroke-linecap: round; }
.flux .fond-ligne { fill: none; stroke: #ecebe6; stroke-width: 8; stroke-linecap: round; }
.flux .anime { stroke-dasharray: 2 14; animation: couler linear infinite; }
@keyframes couler { to { stroke-dashoffset: -64; } }
.tuiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.tuile { background: var(--carte); border: 1px solid var(--trait); border-radius: var(--rayon); padding: 14px 14px 12px; position: relative; overflow: hidden; }
.tuile .lib { color: var(--encre-2); font-size: 12px; font-weight: 500; display: flex; align-items: center; gap: 7px; }
.tuile .marque { width: 10px; height: 10px; border-radius: 2px; flex: none; }
.tuile .val { font-size: 26px; font-weight: 600; margin-top: 4px; letter-spacing: -.5px; }
.tuile .val small { font-size: 14px; font-weight: 500; color: var(--encre-2); margin-left: 3px; letter-spacing: 0; }
.tuile .det { color: var(--encre-2); font-size: 12px; margin-top: 2px; }
.tuile .jauge { height: 5px; background: #efede7; border-radius: 3px; margin-top: 10px; overflow: hidden; }
.tuile .jauge i { display: block; height: 100%; border-radius: 3px; transition: width .8s ease; }
.tuile.avenir { background: repeating-linear-gradient(135deg, #fbfaf7, #fbfaf7 8px, #f5f3ee 8px, #f5f3ee 16px); }
.tuile.avenir .val { color: var(--encre-3); font-size: 15px; font-weight: 500; margin-top: 8px; }
.etat { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 3px 8px; border-radius: 4px; }
.etat.arret { background: #f1efe9; color: var(--encre-2); }
.etat.bloque { background: #fdf2dc; color: #8a5a00; }
.etat.marche { background: #e3f4e6; color: #0b6b0b; }

/* journée */
.choix-jour { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.choix-jour input[type=date] { font: inherit; font-weight: 600; border: 1px solid var(--trait-fort); border-radius: 5px; padding: 5px 8px; background: #f3f2ee; color: var(--encre); }
.bouton { border: 1px solid var(--trait-fort); background: var(--carte); color: var(--encre); border-radius: 5px; padding: 6px 11px; font: inherit; font-weight: 500; cursor: pointer; }
.bouton:hover { background: #f6f5f1; }
.bouton.actif, .bouton.principal { background: var(--encre); color: #fff; border-color: var(--encre); }
.bouton.principal:hover { background: #2c2e31; }
.bouton:disabled { opacity: .35; cursor: default; }
.chiffres { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin: 14px 0 16px; }
.chiffres div { border-left: 3px solid var(--trait-fort); padding: 2px 0 2px 10px; }
.chiffres b { display: block; font-size: 19px; font-weight: 600; letter-spacing: -.3px; }
.chiffres span { color: var(--encre-2); font-size: 12px; }
.graphe { width: 100%; }
/* bandeau de lecture : les valeurs du point touché ou survolé, toujours au même endroit, hauteur fixe (rien ne bouge) */
.lecture { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 2px 14px; align-content: center;
  font-size: 12px; line-height: 17px; background: #faf9f6; border: 1px solid var(--trait); border-radius: 5px; padding: 6px 10px;
  height: 46px; overflow: hidden; margin: 0 0 6px; color: var(--encre-2); }
.lecture .v { display: flex; align-items: center; gap: 6px; white-space: nowrap; overflow: hidden; }
.lecture .v i { width: 9px; height: 9px; border-radius: 2px; flex: none; }
.lecture .v b { color: var(--encre); font-weight: 600; margin-left: auto; padding-left: 6px; }
.lecture .t { color: var(--encre); font-weight: 600; }
.lecture .vide { grid-column: 1 / -1; color: var(--encre-3); text-align: center; }
.lecture .ouvrir { color: var(--encre); font-weight: 600; text-decoration: underline; cursor: pointer; background: none; border: 0; font: inherit; padding: 0; justify-self: start; }
@media (min-width: 901px) { .lecture .ouvrir { order: 99; } }   /* au bureau (une seule ligne), le lien vient en dernier */
#lec-jour { position: sticky; top: var(--haut-entete, 106px); z-index: 5; height: 62px; box-shadow: 0 2px 6px rgba(0,0,0,.04); }
.legende { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12px; color: var(--encre-2); margin: 2px 0 6px; }
.legende label, .legende span { display: inline-flex; align-items: center; gap: 6px; user-select: none; }
.legende label { cursor: pointer; }
.legende label.eteint { opacity: .4; }
.legende i { width: 14px; height: 10px; border-radius: 2px; display: inline-block; }
.legende i.trait { height: 3px; }
.legende i.tirets { height: 0; border-top: 2px dashed; }

/* historique, tableaux */
.annees { display: flex; flex-wrap: wrap; gap: 6px; }
.deux { display: grid; grid-template-columns: 3fr 2fr; gap: 16px; margin-top: 16px; }
table { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 13px; }
th { text-align: left; font-weight: 600; color: var(--encre-2); font-size: 12px; padding: 8px 10px; border-bottom: 1px solid var(--trait-fort); background: #faf9f6; position: sticky; top: 0; cursor: pointer; white-space: nowrap; }
th + th, td + td { border-left: 1px solid #efede7; }
td { padding: 7px 10px; border-bottom: 1px solid #f0eee9; }
td.n { text-align: right; font-variant-numeric: tabular-nums; }
#t-recharges td { white-space: nowrap; }
tr:hover td { background: #fbfaf6; }
.cadre-table { max-height: 330px; overflow: auto; border: 1px solid var(--trait); border-radius: 4px; }

footer { max-width: 1360px; margin: 0 auto; padding: 18px 24px calc(30px + env(safe-area-inset-bottom)); color: var(--encre-3); font-size: 12px; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; border-top: 1px solid var(--trait); }
.lien-bouton { background: none; border: 0; padding: 0; font: inherit; color: var(--encre-2); text-decoration: underline; cursor: pointer; }
dialog { border: 1px solid var(--trait); border-radius: 8px; max-width: 560px; width: calc(100% - 32px); padding: 22px 24px; color: var(--encre); }
dialog::backdrop { background: rgba(20, 22, 26, .45); }
dialog h2 { margin-bottom: 12px; }
dialog p { margin: 0 0 10px; }

/* portier : connexion, mot de passe, Face ID */
body.portier main { display: grid; place-items: start center; padding-top: 48px; }
.connexion { background: var(--carte); border: 1px solid var(--trait); border-radius: 8px; padding: 26px 24px; width: min(420px, 100%); }
.connexion h1 { font-size: 22px; margin: 0 0 6px; }
.connexion .aide { color: var(--encre-2); margin: 0 0 16px; }
.connexion label { display: block; font-weight: 600; font-size: 13px; margin: 14px 0 6px; }
.connexion input[type=email], .connexion input[type=password] { width: 100%; font: inherit; font-size: 16px; padding: 11px 12px; border: 1px solid var(--trait-fort);
  border-radius: 5px; background: #f3f2ee; color: var(--encre); }
.connexion input:focus { outline: 2px solid var(--accent); outline-offset: 1px; background: #fff; }
.connexion .bouton.principal { width: 100%; padding: 12px; margin-top: 18px; font-size: 15px; }
.connexion .message { background: #fdecea; color: #8a1f17; border-radius: 5px; padding: 9px 12px; margin: 0 0 12px; }
.connexion .message.ok { background: #e3f4e6; color: #0b6b0b; }
.fid-autre { text-align: center; margin: 14px 0 0; }
.fid-autre.petit { font-size: 12px; color: var(--encre-3); }
.fid-points { font-size: 12px; padding-left: 18px; margin-top: 18px; }
.fid-h2 { font-size: 14px; margin: 18px 0 8px; }
.fid-appareils { list-style: none; padding: 0; margin: 0; font-size: 13px; }
.fid-appareils li { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-top: 1px solid var(--trait); }
.oblig { color: var(--critique); }

@media (max-width: 900px) {
  .maintenant, .deux { grid-template-columns: 1fr; }
  .barre { padding: 0 16px; gap: 10px; } .modules { margin-left: 4px; } .direct .texte { display: none; }
  .onglets nav, main, footer { padding-left: 16px; padding-right: 16px; }
  .tuiles { grid-template-columns: repeat(2, 1fr); }
  .tuile .val { font-size: 22px; }
  .lecture { grid-template-columns: 1fr 1fr; gap: 2px 10px; height: 62px; font-size: 11.5px; }
  #lec-jour { height: 108px; }
  /* graphiques : toute la largeur possible (marges réduites ; noms des rangées au-dessus des barres, voir app.js) */
  main { padding-left: 10px; padding-right: 10px; }
  .carte { padding: 14px 10px; }
  #g-bandes { height: 300px !important; }
}
