/* styles/recovery.css — owned by the recovery work package (calm refinement).
 * Shared tokens live in styles.css; use them, never a raw hex. Chart SERIES
 * colours are the one exception and they live in src/recovery.js, because
 * plot() writes them into SVG presentation attributes where var() is not
 * dependable on iOS Safari. */

/* ---- layout ----
 * Phone: one column in reading order — Recent recovery, Trend, Night details.
 * Desktop (>= 900px): Recent recovery and the Trend chart sit side by side and
 * Night details, which is the widest card (nine tiles plus a stages bar), runs
 * the full width beneath them. DOM order and visual order stay identical at
 * every width, so tab order never disagrees with what is on screen. */
.rec-grid{display:grid;gap:12px;grid-template-columns:1fr}
.rec-grid > .card{margin-top:0}
@media (min-width:900px){
  .rec-grid{grid-template-columns:1fr 1fr;align-items:start}
  .rec-recent{grid-column:1;grid-row:1}
  .rec-trend{grid-column:2;grid-row:1}
  .rec-night{grid-column:1 / -1;grid-row:2}
}

/* ---- 1 · Recent recovery ---- */
.rec-today{display:flex;flex-wrap:wrap;align-items:baseline;gap:6px;font-size:20px;font-weight:600;margin-bottom:10px}
.rec-today .eyebrow{flex:0 0 100%;font-weight:400}
.rec-today .rec-sep{color:var(--faint);font-weight:400;margin:0 2px}
.rec-today .bl{font-weight:400}
.rec-obs p{margin:0 0 6px;line-height:1.5}
.rec-obs p:last-child{margin-bottom:0}
.rec-cov{margin-top:8px}

/* ---- 2 · Trend ----
 * Six measures will not fit one 320px row, so the picker wraps instead of
 * squeezing the labels to nothing. Each button keeps its 44px touch target. */
.rec-picker{margin:2px 0 8px}
.rec-picker .segrow{display:flex;flex-wrap:wrap;gap:2px;width:100%}
.rec-picker .seg{flex:1 1 auto;min-width:calc(33% - 4px);white-space:nowrap;padding:0 8px;min-height:40px}
@media (max-width:400px){
  .rec-picker .seg{min-width:calc(50% - 4px)}
}
.rec-ranges{margin-bottom:8px}

/* ---- 3 · Night details ---- */
.rec-night h2 .r{display:inline-flex;align-items:center;gap:2px}
/* "sleep score" must not break across lines at 320px, and the baseline tag
   wraps as a unit under the number rather than splitting the label. */
.rec-night .big small,.rec-night .big .bl{white-space:nowrap}
.rec-nav{display:inline-flex;gap:2px}
.rec-navbtn{display:inline-flex;align-items:center;justify-content:center;
  width:44px;height:44px;background:transparent;border:1px solid var(--line);
  border-radius:var(--radius-s);color:var(--dim);cursor:pointer;-webkit-appearance:none;appearance:none}
.rec-navbtn:hover:not(:disabled){background:var(--panel2);color:var(--txt)}
.rec-navbtn:disabled{opacity:.35;cursor:default}
.rec-perceived{margin-top:8px}
.rec-actions{margin-top:12px;display:flex}
.rec-actions .btn{display:inline-flex;align-items:center;gap:6px}

/* The night card's tiles read as a grid rather than a wrapping row once there
 * is room for one — nine tiles in a flex row leave a ragged last line. */
@media (min-width:600px){
  .rec-night .kpi{display:grid;grid-template-columns:repeat(auto-fit,minmax(110px,1fr));gap:14px 22px}
}

/* ---- 4 · folds ---- */
.rec-grid + .fold{margin-top:12px}
