/* Calculateur de cycles de sommeil : styles propres à l'outil. */
.o-sommeil { display: grid; gap: 22px; min-width: 0; }
.o-sommeil [hidden] { display: none !important; }
.o-sommeil h2 { margin: 0; font-size: 1.2rem; }
.o-sommeil-bloc { display: grid; gap: 12px; min-width: 0; }
.o-sommeil-bloc + .o-sommeil-bloc, .o-sommeil-reglages + .o-sommeil-bloc { padding-top: 20px; border-top: 1px solid var(--bord); }

.o-sommeil-modes { display: flex; flex-wrap: wrap; gap: 8px; }
.o-sommeil-modes .btn { border-radius: 999px; min-height: 42px; }
.atelier .o-sommeil-modes .btn[aria-pressed="true"] { background: var(--marque); border-color: var(--marque); color: var(--sur-marque); }

.o-sommeil-saisie { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 16px; }
.o-sommeil-saisie label { display: flex; flex-direction: column; gap: 4px; font-size: .88rem; color: var(--texte-2); }
.o-sommeil input[type="time"] {
  min-width: 150px; min-height: 48px; padding: 6px 12px; border: 1px solid var(--bord); border-radius: var(--rayon-petit);
  background: var(--surface); color: var(--texte); font: 600 1.35rem var(--police); font-variant-numeric: tabular-nums; color-scheme: light dark;
}
.o-sommeil-saisie select { min-height: 48px; }
.o-sommeil-saisie .btn { min-height: 48px; }
.o-sommeil input:focus-visible, .o-sommeil select:focus-visible, .o-sommeil-option:focus-visible { outline: 3px solid var(--marque); outline-offset: 2px; }
.o-sommeil input[aria-invalid="true"] { border-color: var(--erreur-texte); outline: 1px solid var(--erreur-texte); }

.o-sommeil-resume { display: block; padding: 12px 16px; border-radius: var(--rayon); background: var(--surface-2); color: var(--texte); font-size: 1.05rem; line-height: 1.45; }
.o-sommeil-choix { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.o-sommeil-option {
  position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 3px; min-width: 0; padding: 12px 14px;
  border: 2px solid var(--bord); border-radius: var(--rayon); background: var(--surface); color: var(--texte); font: inherit; text-align: left; cursor: pointer;
}
.o-sommeil-option:hover { background: var(--surface-2); }
.o-sommeil-option.conseille { border-color: var(--ok-texte); }
.o-sommeil-option[aria-pressed="true"] { border-color: var(--marque); box-shadow: 0 0 0 2px var(--marque) inset; background: var(--surface-2); }
.o-sommeil-option.passee .o-sommeil-heure { color: var(--texte-2); text-decoration: line-through; text-decoration-thickness: 2px; }
.o-sommeil-heure { font-size: 1.8rem; line-height: 1.15; font-variant-numeric: tabular-nums; }
.o-sommeil-detail { font-size: .9rem; color: var(--texte); }
.o-sommeil-jour { font-size: .82rem; color: var(--texte-2); }
.o-sommeil-badge { display: inline-block; margin-top: 4px; padding: 1px 8px; border-radius: 999px; background: var(--ok-fond); color: var(--ok-texte); font-size: .78rem; font-weight: 600; }
.o-sommeil-badge.passee { background: var(--surface-2); color: var(--texte-2); }
.o-sommeil .o-sommeil-aide { display: block; }

.o-sommeil-frise { margin: 0; }
.o-sommeil-frise svg { display: block; width: 100%; height: 140px; border: 1px solid var(--bord); border-radius: var(--rayon-petit); background: var(--surface); }
.o-sommeil-frise .lat { fill: var(--surface-2); }
.o-sommeil-frise .courbe { fill: none; stroke: var(--texte-2); stroke-width: 2; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.o-sommeil-frise .profond { fill: #3b4cc0; opacity: .75; }
.o-sommeil-frise .rem { fill: #d9822b; opacity: .85; }
.o-sommeil-frise .borne { stroke: var(--bord); stroke-dasharray: 4 4; vector-effect: non-scaling-stroke; }
.o-sommeil-axe { display: flex; justify-content: space-between; margin-top: 4px; font: 600 .95rem var(--police); font-variant-numeric: tabular-nums; color: var(--texte); }
.o-sommeil-legende { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 0; padding: 0; list-style: none; font-size: .88rem; color: var(--texte-2); }
.o-sommeil-legende li { display: flex; align-items: center; gap: 6px; }
.o-sommeil-pastille { display: inline-block; width: 18px; height: 10px; border-radius: 3px; border: 1px solid var(--bord); }
.o-sommeil-pastille.lat { background: var(--surface-2); }
.o-sommeil-pastille.leger { height: 0; border: 0; border-top: 2px solid var(--texte-2); border-radius: 0; }
.o-sommeil-pastille.profond { background: #3b4cc0; opacity: .75; border: 0; }
.o-sommeil-pastille.rem { background: #d9822b; opacity: .85; border: 0; }
.o-sommeil-note { margin: 0; font-size: .88rem; color: var(--texte-2); }

.o-sommeil-choisie { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin: 0; }
.o-sommeil-choisie span { color: var(--texte-2); font-size: .92rem; }
.o-sommeil-choisie strong { font-size: 1.35rem; font-variant-numeric: tabular-nums; }
.o-sommeil-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }

.o-sommeil-reglages { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.o-sommeil-ages { width: 100%; max-width: 520px; border-collapse: collapse; font-size: .95rem; }
.o-sommeil-ages th, .o-sommeil-ages td { padding: 8px 10px; border-bottom: 1px solid var(--bord); text-align: left; }
.o-sommeil-ages thead th { color: var(--texte-2); font-size: .85rem; font-weight: 600; }
.o-sommeil-ages tbody th { font-weight: 500; }
.o-sommeil-ages td { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.o-sommeil .o-sommeil-avis { display: block; }

@media (max-width: 520px) {
  .o-sommeil-choix { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .o-sommeil-heure { font-size: 1.45rem; }
  .o-sommeil-option { padding: 10px; }
  .o-sommeil-frise svg { height: 110px; }
  .o-sommeil-modes .btn { flex: 1 1 auto; }
}
@media (prefers-reduced-motion: no-preference) {
  .o-sommeil-option { transition: background-color .15s, border-color .15s; }
}
