/* Pilotage des vitrines — « l'heure bleue » : un ciel du soir où ce qui est allumé brille. */
@font-face { font-family: "Instrument Sans"; font-weight: 400; font-display: swap; src: url(/fonts/instrument-sans-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "Instrument Sans"; font-weight: 500; font-display: swap; src: url(/fonts/instrument-sans-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: "Instrument Sans"; font-weight: 600; font-display: swap; src: url(/fonts/instrument-sans-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: "Instrument Serif"; font-weight: 400; font-display: swap; src: url(/fonts/instrument-serif-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "Instrument Serif"; font-style: italic; font-weight: 400; font-display: swap; src: url(/fonts/instrument-serif-latin-400-italic.woff2) format("woff2"); }

:root {
  --nuit: #0e1828;
  --panneau: #15223a;
  --panneau-2: #1b2a46;
  --trait: #25365299;
  --trait-net: #2c3e5c;
  --ivoire: #ede7da;
  --doux: #93a1b8;
  --laiton: #d4af6a;
  --lumiere: #ffcf7a;
  --corail: #f2765f;
  --sauge: #6fcaa0;
  --serif: "Instrument Serif", "Iowan Old Style", Georgia, serif;
  --sans: "Instrument Sans", system-ui, sans-serif;
  color-scheme: dark;
  font-size: 16px;
}
* { box-sizing: border-box; }
html { background: var(--nuit); }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  font-family: var(--sans); color: var(--ivoire); line-height: 1.5;
  background: radial-gradient(1200px 500px at 70% -200px, #22345a 0%, transparent 70%), var(--nuit);
  -webkit-font-smoothing: antialiased;
}
main { flex: 1; width: 100%; max-width: 1200px; margin: 0 auto; padding: 40px 28px 72px; }
footer { color: #5f6d84; font-size: .82rem; padding: 22px 28px; text-align: center; }
footer a { color: inherit; }
a { color: var(--lumiere); text-decoration-color: #ffcf7a66; text-underline-offset: 3px; }
h1, h2, h3 { font-weight: 400; margin: 0; }
h1 { font-family: var(--serif); font-size: clamp(2.1rem, 4vw, 3rem); line-height: 1.05; letter-spacing: -.01em; }
h2 { font-family: var(--serif); font-size: 1.7rem; line-height: 1.15; }
h3 { font-family: var(--sans); font-weight: 600; font-size: 1rem; }
.sous { color: var(--doux); margin: 10px 0 0; max-width: 62ch; }
.attente { color: var(--doux); }
.retour { display: inline-block; color: var(--doux); text-decoration: none; font-size: .9rem; margin-bottom: 14px; }
.retour:hover { color: var(--ivoire); }
:focus-visible { outline: 2px solid var(--lumiere); outline-offset: 2px; border-radius: 6px; }

/* ---------- Barre du haut ---------- */
#barre { display: flex; align-items: center; gap: 36px; padding: 0 28px; height: 68px; border-bottom: 1px solid var(--trait); }
.marque { display: flex; align-items: center; gap: 12px; color: var(--ivoire); text-decoration: none; font-family: var(--serif); font-size: 1.4rem; white-space: nowrap; }
.pastille { width: 12px; height: 12px; border-radius: 50%; background: var(--lumiere); box-shadow: 0 0 0 4px #ffcf7a22, 0 0 18px 2px #ffcf7a99; }
#menu { display: flex; gap: 26px; flex: 1; }
#menu a { color: var(--doux); text-decoration: none; font-weight: 500; font-size: .95rem; padding: 22px 0; border-bottom: 2px solid transparent; }
#menu a:hover { color: var(--ivoire); }
#menu a.actif { color: var(--ivoire); border-bottom-color: var(--laiton); }
.moi { display: flex; align-items: center; gap: 16px; color: var(--doux); font-size: .9rem; }
.moi .lien { color: var(--ivoire); }

/* ---------- Boutons, champs ---------- */
button, .bouton {
  font: 500 .92rem var(--sans); color: var(--ivoire); background: transparent; border: 1px solid var(--trait-net);
  padding: 9px 16px; border-radius: 10px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 8px;
  transition: background .15s, border-color .15s;
}
button:hover, .bouton:hover { border-color: #3f557a; background: #ffffff08; }
button:disabled { opacity: .45; cursor: default; }
.principal { background: var(--laiton); border-color: var(--laiton); color: #1d1607; }
.principal:hover { background: #e0bd7c; border-color: #e0bd7c; }
.danger { color: var(--corail); }
.lien { background: none; border: none; padding: 0; color: var(--lumiere); text-decoration: underline; text-underline-offset: 3px; }
.lien:hover { background: none; }
.petit { padding: 6px 12px; font-size: .86rem; border-radius: 8px; }
label { display: block; font-size: .86rem; color: var(--doux); margin: 14px 0 6px; }
input, select, textarea {
  font: 400 .95rem var(--sans); color: var(--ivoire); width: 100%; padding: 10px 12px;
  background: #0f1a2d; border: 1px solid var(--trait-net); border-radius: 10px;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--laiton); box-shadow: 0 0 0 3px #d4af6a33; }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--laiton); }
.case { display: flex; gap: 10px; align-items: center; color: var(--ivoire); margin-top: 16px; }
.ligne { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; }
.ligne > * { flex: 1; min-width: 120px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.erreur { color: var(--corail); min-height: 1.3em; margin: 10px 0 0; font-size: .92rem; }
.aide { color: var(--doux); font-size: .86rem; }

/* ---------- Connexion : un ciel de fin de journée ---------- */
.ecran-connexion {
  position: fixed; inset: 0; display: grid; place-items: center; padding: 24px; overflow: auto;
  background:
    radial-gradient(900px 260px at 50% 100%, #f0a35e55, transparent 70%),
    linear-gradient(180deg, #0a1222 0%, #13213f 45%, #2c3566 72%, #7a5779 88%, #e39a62 100%);
}
.connexion { width: min(400px, 100%); background: #0e1828d9; backdrop-filter: blur(14px); border: 1px solid #ffffff14; border-radius: 22px; padding: 38px 34px 30px; }
.connexion .pastille { display: block; margin-bottom: 22px; }
.connexion h1 { font-size: 2.3rem; }
.connexion button { width: 100%; justify-content: center; margin-top: 22px; padding: 12px; font-size: 1rem; }
.connexion .aide { margin-top: 18px; text-align: center; }

/* ---------- Le ciel du jour (pièce maîtresse) ---------- */
.journee { margin: 34px 0 44px; }
.journee-tete { display: grid; grid-template-columns: minmax(120px, 190px) 1fr; column-gap: 18px; }
.ciel { position: relative; height: 92px; border-radius: 18px; overflow: hidden; box-shadow: inset 0 0 0 1px #ffffff12; }
.ciel .astre { position: absolute; bottom: 12px; width: 1px; }
.ciel .astre span { position: absolute; bottom: 0; transform: translateX(-50%); white-space: nowrap; font-size: .78rem; font-weight: 500; color: #0e1828; background: #ffffffc0; padding: 2px 9px; border-radius: 20px; }
.ciel .maintenant { position: absolute; top: 0; bottom: 0; width: 2px; background: #fff; box-shadow: 0 0 12px #fff; }
.ciel .maintenant span { position: absolute; top: 10px; left: 8px; font-size: .8rem; font-weight: 600; color: #fff; white-space: nowrap; text-shadow: 0 1px 6px #000a; }
.ciel .maintenant.droite span { left: auto; right: 8px; }
.heures { position: relative; height: 26px; margin: 0 0 6px; }
.heures span { position: absolute; top: 6px; transform: translateX(-50%); white-space: nowrap; font-size: .76rem; color: #64738c; font-variant-numeric: tabular-nums; }
.pistes { display: grid; grid-template-columns: minmax(120px, 190px) 1fr; column-gap: 18px; row-gap: 2px; align-items: center; }
.pistes .nom-piste { font-size: .9rem; color: var(--doux); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 6px 0; }
.piste { position: relative; height: 26px; }
.piste::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: #2a3b58; }
.piste .feu { position: absolute; top: 50%; height: 6px; margin-top: -3px; border-radius: 4px; background: var(--lumiere); box-shadow: 0 0 10px #ffcf7aaa, 0 0 2px #fff6; }
.piste .feu.habituel { height: 2px; margin-top: -1px; background: #ffcf7a55; box-shadow: none; }
.piste .repere { position: absolute; top: 0; bottom: 0; width: 1px; background: #ffffff66; }
.legende { display: flex; gap: 22px; flex-wrap: wrap; font-size: .82rem; color: var(--doux); margin-top: 14px; }
.legende i { display: inline-block; width: 18px; height: 6px; border-radius: 3px; margin-right: 7px; vertical-align: middle; background: var(--lumiere); box-shadow: 0 0 8px #ffcf7aaa; }
.legende i.habituel { height: 2px; background: #ffcf7a77; box-shadow: none; }

/* ---------- Sites ---------- */
.entete { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap; }
.grille { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 22px; }
.compte { font-family: var(--serif); font-style: italic; font-size: 1.3rem; color: var(--doux); margin: 34px 0 14px; }
.site { background: linear-gradient(180deg, var(--panneau-2), var(--panneau)); border: 1px solid var(--trait); border-radius: 22px; padding: 24px 24px 18px; }
.site.alerte { border-color: #f2765f66; }
.site-tete a { color: inherit; text-decoration: none; }
.site-tete a:hover h2 { color: #fff; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 5px; }
.site .meta { color: var(--doux); font-size: .88rem; margin-top: 4px; }
.circuits { list-style: none; padding: 0; margin: 18px 0 6px; }
.circuits li { display: grid; grid-template-columns: 1fr auto auto; gap: 14px; align-items: center; padding: 13px 0; border-top: 1px solid var(--trait); }
.circuits .nom { min-width: 0; font-weight: 500; }
.circuits .nom small { display: block; font-weight: 400; color: var(--doux); font-size: .85rem; margin-top: 2px; }
.circuits li.allume .nom { color: #fff; }
.watts { font-variant-numeric: tabular-nums; color: var(--doux); font-size: .88rem; white-space: nowrap; }
.allume .watts { color: var(--lumiere); }
.anomalie { color: var(--corail); }
.anomalie::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--corail); margin-right: 7px; vertical-align: 1px; box-shadow: 0 0 8px var(--corail); }
.site-pied { display: flex; gap: 8px; flex-wrap: wrap; padding-top: 14px; border-top: 1px solid var(--trait); }
.vide { color: var(--doux); padding: 34px; text-align: center; border: 1px dashed var(--trait-net); border-radius: 18px; }
.marque-main { color: var(--laiton); font-size: .8rem; font-weight: 500; margin-left: 6px; }

/* Interrupteur : ce qui est allumé brille */
.inter { position: relative; width: 52px; height: 30px; padding: 0; border-radius: 30px; border: 1px solid #33466a; background: #0f1a2d; flex: none; transition: background .25s, box-shadow .25s, border-color .25s; }
.inter::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #61708a; transition: transform .25s, background .25s; }
.inter[aria-checked="true"] { background: linear-gradient(180deg, #ffd88f, #e9b25a); border-color: #ffd88f; box-shadow: 0 0 22px #ffcf7a66; }
.inter[aria-checked="true"]::after { transform: translateX(22px); background: #fffaf0; }
.inter:hover { background: #16243d; }
.inter[aria-checked="true"]:hover { background: linear-gradient(180deg, #ffe0a3, #efbb68); }
.inter:disabled { opacity: .6; }

/* ---------- Détail et administration ---------- */
.bloc { margin-top: 48px; }
.bloc-tete { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 14px; }
.deux { display: grid; grid-template-columns: 1.15fr 1fr; gap: 48px; }
.tableau { width: 100%; border-collapse: collapse; }
.tableau th { text-align: left; font-weight: 500; font-size: .84rem; color: var(--doux); padding: 0 12px 10px; border-bottom: 1px solid var(--trait-net); }
.tableau td { padding: 14px 12px; border-bottom: 1px solid var(--trait); vertical-align: middle; }
.tableau td:first-child, .tableau th:first-child { padding-left: 0; }
.num { font-variant-numeric: tabular-nums; }
.tableau b { font-weight: 600; }
.tableau .titre-ligne { font-family: var(--serif); font-size: 1.25rem; }
.tableau input { padding: 7px 9px; min-width: 96px; }
.tableau .actions { justify-content: flex-end; }
.etat { display: inline-flex; align-items: center; gap: 7px; font-size: .84rem; color: var(--doux); white-space: nowrap; }
.etat::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #61708a; }
.etat.ok { color: var(--sauge); }
.etat.ok::before { background: var(--sauge); box-shadow: 0 0 8px var(--sauge); }
.etat.ko { color: var(--corail); }
.etat.ko::before { background: var(--corail); }
.etat.attente { color: var(--laiton); }
.etat.attente::before { background: var(--laiton); }
.exception { padding: 16px 0; border-bottom: 1px solid var(--trait); display: flex; justify-content: space-between; gap: 14px; align-items: center; }
.exception b { font-weight: 600; }
.code { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: .84rem; background: #0b1424; border: 1px solid var(--trait-net); padding: 12px 14px; border-radius: 10px; word-break: break-all; white-space: pre-wrap; color: #f3e6c8; }
.secret { background: #d4af6a14; border: 1px solid #d4af6a55; padding: 14px 16px; border-radius: 12px; margin: 14px 0; }

/* ---------- Dialogue, toast ---------- */
dialog { border: 1px solid var(--trait-net); border-radius: 22px; padding: 0; width: min(580px, 94vw); background: var(--panneau); color: var(--ivoire); box-shadow: 0 30px 80px #000a; }
dialog::backdrop { background: #070c16b3; backdrop-filter: blur(3px); }
dialog form { padding: 28px 30px 24px; }
dialog h2 { margin-bottom: 6px; }
dialog .actions { justify-content: flex-end; margin-top: 24px; }
#toast { position: fixed; bottom: 26px; left: 50%; transform: translate(-50%, 10px); background: var(--ivoire); color: var(--nuit); font-weight: 500; padding: 11px 20px; border-radius: 12px; opacity: 0; transition: opacity .2s, transform .2s; pointer-events: none; z-index: 10; }
#toast.visible { opacity: 1; transform: translate(-50%, 0); }
#toast.ko { background: var(--corail); color: #fff; }

@media (max-width: 860px) {
  #barre { flex-wrap: wrap; height: auto; padding: 14px 18px 0; gap: 10px 20px; }
  #menu { order: 3; flex-basis: 100%; overflow-x: auto; gap: 20px; }
  #menu a { padding: 10px 0 12px; }
  main { padding: 28px 18px 56px; }
  .deux { grid-template-columns: 1fr; gap: 0; }
  .grille { grid-template-columns: 1fr; }
  .pistes, .journee-tete { grid-template-columns: 92px 1fr; column-gap: 10px; }
  .tableau { display: block; overflow-x: auto; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
[hidden] { display: none !important; }
