:root {
  --fond: #F4F2EE;
  --carte: #FFFFFF;
  --encre: #1A1A18;
  --doux: #6B6862;
  --trait: #DDD9D2;
  --separation: #EFECE7;
  --piste: #E8E5DF;
  --accent: #C2501C;
  --accent-fond: #FBF6F2;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--fond); color: var(--encre); }
body {
  font-family: 'Geist', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, input { font-family: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .35; cursor: default; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.ecran {
  max-width: 480px; margin: 0 auto; min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column;
  padding: max(28px, env(safe-area-inset-top)) 20px max(24px, env(safe-area-inset-bottom));
}
.doux { color: var(--doux); }
.petit { font-size: 12px; line-height: 1.45; }
h1 { margin: 0; font-weight: 600; letter-spacing: -0.02em; }

/* ----- Écran du code ----- */
.ecran-code { padding-left: 24px; padding-right: 24px; }
.code-centre { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 36px; }
.code-tete { display: flex; flex-direction: column; gap: 14px; }
.code-tete h1 { font-size: 34px; line-height: 1.1; }
.code-tete p { margin: 0; font-size: 15px; line-height: 1.5; }
.logo { width: 52px; height: 52px; border-radius: 16px; background: var(--carte); color: var(--accent); display: flex; align-items: center; justify-content: center; }
.code-form { display: flex; flex-direction: column; gap: 12px; }
.code-form label { font-size: 13px; font-weight: 500; }
.code-form input {
  height: 60px; padding: 0 20px; border-radius: 16px; border: 1px solid var(--trait);
  background: var(--carte); font-size: 22px; letter-spacing: .12em; color: var(--encre);
  text-transform: uppercase; outline: none;
}
.code-form input::placeholder { color: #B5B1AA; text-transform: none; letter-spacing: .04em; }
.code-form input:focus { border-color: var(--encre); }
.btn-plein {
  height: 56px; border-radius: 16px; border: none; background: var(--encre); color: var(--fond);
  font-size: 16px; font-weight: 500;
}
.pied { margin: 0; font-size: 12px; text-align: center; }
.erreur { margin: 0; font-size: 14px; color: #A3361A; }

/* ----- Écran du chauffage ----- */
.ecran-app { gap: 18px; }
.entete { display: flex; justify-content: space-between; align-items: flex-end; padding: 0 4px; }
.entete h1 { font-size: 30px; }
.entete p { margin: 4px 0 0; font-size: 13px; }

.carte { background: var(--carte); border-radius: 22px; padding: 4px 0; overflow: hidden; }
.chargement { padding: 24px 18px; margin: 0; font-size: 14px; }
.piece { display: flex; align-items: center; gap: 10px; padding: 11px 14px 11px 18px; border-top: 1px solid var(--separation); transition: background .2s; }
.piece:first-child { border-top: none; }
.piece.active { background: var(--accent-fond); }
.piece-nom { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 3px; border: none; background: none; padding: 0; color: var(--encre); text-align: left; }
.piece-nom strong { font-size: 16px; font-weight: 500; }
.piece-info { font-size: 13px; color: var(--doux); display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.piece-info .derog { color: var(--accent); }
.point { width: 6px; height: 6px; border-radius: 3px; background: var(--accent); }
.rond {
  width: 44px; height: 44px; flex-shrink: 0; border-radius: 22px; border: 1px solid var(--trait);
  background: var(--carte); color: var(--encre); display: flex; align-items: center; justify-content: center; padding: 0;
}
.rond:active:not(:disabled) { background: var(--piste); }
.valeur { width: 48px; text-align: center; font-size: 24px; font-weight: 500; letter-spacing: -0.02em; }
.valeur.derog { color: var(--accent); }
.piece.injoignable .piece-info::after { content: '· hors ligne'; }

.duree { display: flex; flex-direction: column; gap: 10px; padding: 0 4px; }
.duree-tete { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 13px; }
.etiquette { font-weight: 500; }
#duree-cible.active { color: var(--accent); }
.segments { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; background: var(--piste); border-radius: 14px; padding: 4px; }
.segments button { height: 40px; border: none; border-radius: 10px; font-size: 14px; font-weight: 500; background: transparent; color: #5F5C57; }
.segments button[aria-pressed="true"] { background: var(--carte); color: var(--encre); box-shadow: 0 1px 2px rgba(26,26,24,.08); }

.pied-app { margin-top: auto; display: flex; flex-direction: column; gap: 10px; padding: 0 4px; }
.pied-app p { margin: 0; }
.boutons-pied { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.btn-rond { height: 44px; padding: 0 14px; border-radius: 22px; font-size: 14px; white-space: nowrap; }
.btn-contour { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--trait); background: var(--carte); color: var(--encre); font-weight: 500; }
.absence { background: var(--carte); border-radius: 18px; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.absence p { margin: 0; line-height: 1.45; }
.reglette { display: flex; flex-direction: column; gap: 8px; }
.reglette-tete { display: flex; justify-content: space-between; align-items: baseline; font-size: 13px; }
.reglette-tete strong { font-size: 15px; font-weight: 600; color: var(--accent); }
.reglette-bornes { display: flex; justify-content: space-between; font-size: 12px; }
input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 32px; background: transparent; margin: 0; }
input[type=range]::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; background: linear-gradient(to right, var(--accent) 0%, var(--accent) var(--rempli, 40%), var(--piste) var(--rempli, 40%)); }
input[type=range]::-moz-range-track { height: 6px; border-radius: 3px; background: var(--piste); }
input[type=range]::-moz-range-progress { height: 6px; border-radius: 3px; background: var(--accent); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 28px; height: 28px; margin-top: -11px; border-radius: 50%; background: var(--carte); border: 1px solid var(--trait); box-shadow: 0 1px 4px rgba(26,26,24,.18); }
input[type=range]::-moz-range-thumb { width: 28px; height: 28px; border-radius: 50%; background: var(--carte); border: 1px solid var(--trait); box-shadow: 0 1px 4px rgba(26,26,24,.18); }
.absence .btn-plein { width: 100%; }
.lien-doux { align-self: center; border: none; background: none; color: var(--doux); font-size: 13px; text-decoration: underline; padding: 4px; }

@media (max-height: 700px) {
  .piece { padding-top: 7px; padding-bottom: 7px; }
  .ecran-app { gap: 14px; }
}
