:root {
  --health-green: #3f8068;
  --health-green-soft: #e8f2ed;
  --health-awake: #d09a72;
  --health-rem: #9a82c0;
  --health-core: #6e9bc3;
  --health-deep: #395c83;
  --health-unspecified: #8ca5a0;
  --health-ink: #263631;
}
.health-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
}

.sync-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 5px;
  color: var(--on-muted);
  font-size: .84rem;
  white-space: nowrap;
}

.sync-pill > span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #b7aaa2;
}

.sync-pill.is-good > span { background: var(--health-green); }

.household-count {
  padding: 7px 12px;
  border-radius: 99px;
  background: var(--health-green-soft);
  color: var(--health-green);
  font-size: .76rem;
  font-weight: 700;
}

.household-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.household-grid--top { align-items: start; }
.household-person { min-width: 0; padding: 24px; }
.person-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.person-header h2,
.profile-trends__header h2 {
  margin: 4px 0 0;
  color: var(--health-ink);
  font-family: var(--on-display-font);
  font-size: 1.55rem;
  font-weight: 500;
}

.person-sleep-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 8px;
}

.person-sleep-summary > div {
  padding: 12px;
  border: 1px solid var(--on-line);
  border-radius: 13px;
  background: rgba(255,255,255,.46);
}

.person-sleep-summary strong { display: block; color: var(--health-ink); font-size: 1.35rem; }
.person-sleep-summary strong small { margin-left: 2px; color: var(--on-muted); font-size: .65rem; }
.person-sleep-summary span { display: block; margin-top: 4px; color: var(--on-muted); font-size: .64rem; }
.night-meta { margin: 0 0 18px; color: var(--on-muted); font-size: .75rem; }
.person-signals {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 22px;
}

.compact-signal { padding: 10px 12px; border-radius: 12px; background: var(--on-surface-soft); }
.compact-signal > span { display: block; min-height: 2.3em; color: var(--on-muted); font-size: .64rem; line-height: 1.2; }
.compact-signal > strong { display: block; margin-top: 6px; color: var(--health-ink); font-size: .95rem; }
.compact-signal small { margin-left: 3px; color: var(--on-muted); font-size: .6rem; }
.empty-person { display: grid; min-height: 130px; place-items: center; padding: 20px; border-radius: 14px; background: var(--on-surface-soft); color: var(--on-muted); text-align: center; }
.empty-person p { margin: 0; }

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

.metric-card { padding: 22px; }
.metric-card--sleep { background: linear-gradient(145deg, #f5f0fa, #fff); }
.metric-card--deep { background: linear-gradient(145deg, #eef3f8, #fff); }
.metric-card--rem { background: linear-gradient(145deg, #f3eff8, #fff); }
.metric-card p,
.signal-card p,
.eyebrow {
  margin: 0;
  color: var(--on-muted);
  font-size: .76rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.metric-card > strong {
  display: block;
  margin: 14px 0 8px;
  color: var(--health-ink);
  font-family: var(--on-display-font);
  font-size: clamp(2rem, 3vw, 3rem);
  font-weight: 500;
  line-height: 1;
}

.metric-card strong small,
.signal-card strong small,
.trend-metric strong small {
  margin-left: 4px;
  color: var(--on-muted);
  font-family: var(--on-font);
  font-size: .76rem;
  font-weight: 500;
}

.metric-card > span,
.signal-card > span {
  color: var(--on-muted);
  font-size: .8rem;
  line-height: 1.4;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, .65fr);
  gap: 18px;
}

.dashboard-grid--sleep { align-items: stretch; }
.panel { min-height: 300px; padding: 24px; }
.panel__header,
.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.panel__header h2,
.section-heading h2 {
  margin: 4px 0 0;
  color: var(--health-ink);
  font-family: var(--on-display-font);
  font-size: 1.55rem;
  font-weight: 500;
}

.panel__header a,
.section-heading a {
  color: var(--health-green);
  font-size: .82rem;
  font-weight: 700;
}

.legend-awake { background: var(--health-awake); }
.legend-rem { background: var(--health-rem); }
.legend-core { background: var(--health-core); }
.legend-deep { background: var(--health-deep); }
.legend-unspecified { background: var(--health-unspecified); }

.sync-list { margin: 0; padding: 0; list-style: none; }
.sync-list li {
  display: grid;
  grid-template-columns: 10px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--on-line);
}

.sync-list li:last-child { border-bottom: 0; }
.sync-list strong { display: block; font-size: .83rem; }
.sync-list small { display: block; margin-top: 2px; color: var(--on-muted); font-size: .68rem; }
.sync-list li > span:last-child { color: var(--on-muted); font-size: .69rem; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #b7aaa2; }
.status-dot--imported { background: var(--health-green); }
.status-dot--error { background: #b45e5e; }
.status-dot--duplicate { background: #c99c49; }

.overview-section { margin-top: 28px; }
.signal-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.signal-card { padding: 20px; }
.signal-card > strong {
  display: block;
  margin: 12px 0 6px;
  color: var(--health-ink);
  font-family: var(--on-display-font);
  font-size: 1.8rem;
  font-weight: 500;
}

.empty-inline { padding: 22px; }
.trend-days { display: grid; gap: 16px; }
.sleep-history { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.sleep-history__night { min-width: 0; padding: 18px 20px; }
.sleep-history__date { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 13px; padding-bottom: 11px; border-bottom: 1px solid var(--on-line); }
.sleep-history__date span { display: block; color: var(--health-green); font-size: .55rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.sleep-history__date h2 { margin: 3px 0 0; color: var(--health-ink); font-family: var(--on-display-font); font-size: 1.25rem; font-weight: 500; }
.sleep-history__date time { color: var(--on-muted); font-size: .58rem; }
.sleep-history__people { display: grid; gap: 8px; }
.sleep-history__person { padding: 11px 12px; border-radius: 12px; background: var(--on-surface-soft); }
.sleep-history__person > header { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.sleep-history__person > header > strong { display: inline-flex; align-items: center; color: var(--health-ink); font-size: .7rem; }
.sleep-history__person > header > strong > i { width: 5px; height: 18px; margin-right: 7px; border-radius: 5px; background: #d37b5d; }
.sleep-history__person--2 > header > strong > i { background: #5d8db0; }
.sleep-history__person > header > div { display: flex; align-items: baseline; gap: 8px; }
.sleep-history__person > header b { color: var(--health-ink); font-family: var(--on-display-font); font-size: .95rem; }
.sleep-history__person > header span,
.sleep-history__person > header small { color: var(--on-muted); font-size: .56rem; }
.sleep-history__person > header span { padding: 2px 5px; border-radius: 10px; background: #e4ece7; color: var(--health-green); font-weight: 700; }
.sleep-history__person.is-empty { display: grid; min-height: 62px; align-content: center; }
.sleep-history__person.is-empty > header { margin: 0; }
.sleep-history__track { position: relative; height: 15px; overflow: hidden; border-radius: 8px; background: #e5ebe7; box-shadow: inset 0 1px 2px rgba(38,54,49,.12); }
.sleep-history__track > i { position: absolute; top: 0; bottom: 0; min-width: 2px; border-right: 1px solid rgba(255,255,255,.48); }
.sleep-history__track > i.stage-awake { background: var(--health-awake); }
.sleep-history__track > i.stage-rem { background: var(--health-rem); }
.sleep-history__track > i.stage-core { background: var(--health-core); }
.sleep-history__track > i.stage-deep { background: var(--health-deep); }
.sleep-history__track > i.stage-asleep_unspecified { background: var(--health-unspecified); }
.sleep-history__stage-key { display: flex; align-items: center; gap: 8px 12px; margin-top: 7px; color: var(--on-muted); font-size: .5rem; }
.sleep-history__stage-key span { display: inline-flex; align-items: center; white-space: nowrap; }
.sleep-history__stage-key span > i { width: 6px; height: 6px; margin-right: 4px; border-radius: 2px; }
.sleep-history__stage-key b { margin-left: 3px; color: var(--health-ink); }
.sleep-history__stage-key small { margin-left: auto; color: var(--on-muted); font-size: .5rem; white-space: nowrap; }

.trend-day h2 {
  margin: 5px 0;
  color: var(--health-ink);
  font-family: var(--on-display-font);
  font-size: 1.45rem;
  font-weight: 500;
}

.source-label {
  max-width: 260px;
  overflow: hidden;
  padding: 5px 9px;
  border-radius: 99px;
  background: var(--health-green-soft);
  color: var(--health-green);
  font-size: .68rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.data-notice {
  display: flex;
  align-items: center;
  gap: 10px 18px;
  margin-bottom: 18px;
  padding: 16px 20px;
  background: #f7f4ed;
}
.data-notice strong { color: var(--health-ink); }
.data-notice span { color: var(--on-muted); font-size: .8rem; }
.analysis-grid { display: grid; gap: 12px; }
.analysis-metric { padding: 16px; border: 1px solid var(--on-line); border-radius: 14px; }
.analysis-metric__heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.analysis-metric__heading > span { color: var(--on-muted); font-size: .72rem; font-weight: 700; }
.analysis-metric__heading > strong { color: var(--health-ink); font-size: 1.1rem; }
.analysis-metric__heading small { margin-left: 3px; color: var(--on-muted); font-size: .62rem; }
.spark-bars {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 74px;
  margin: 14px 0 8px;
  border-bottom: 1px solid var(--on-line);
}
.spark-bars i { flex: 1 1 0; min-width: 2px; max-width: 14px; border-radius: 3px 3px 0 0; background: linear-gradient(180deg, #79a995, var(--health-green)); }
.analysis-meta { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 12px; color: var(--on-muted); font-size: .64rem; }
.profile-trends { min-width: 0; }
.profile-trends__header { margin-bottom: 12px; padding: 0 4px; }
.profile-trends .trend-day { grid-template-columns: 1fr; }
.profile-trends .trend-day__metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.trend-day {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 24px;
  padding: 22px;
}

.trend-day__metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(125px, 1fr));
  gap: 10px;
}

.trend-metric {
  padding: 12px 14px;
  border: 1px solid var(--on-line);
  border-radius: 13px;
  background: rgba(255,255,255,.45);
}

.trend-metric > span {
  display: block;
  min-height: 2.5em;
  color: var(--on-muted);
  font-size: .69rem;
  line-height: 1.25;
}

.trend-metric > strong {
  display: block;
  margin-top: 7px;
  color: var(--health-ink);
  font-size: 1rem;
}

.empty-panel { display: grid; justify-items: center; padding: 64px 24px; text-align: center; }
.empty-panel__mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--health-green-soft);
  color: var(--health-green);
  font-size: 1.5rem;
}

.empty-panel h2 { margin: 16px 0 6px; font-family: var(--on-display-font); font-weight: 500; }
.empty-panel p,
.muted-copy { color: var(--on-muted); line-height: 1.6; }

.sleep-overview-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
}

.sleep-overview-header > div:first-child { max-width: 760px; }
.sleep-date-badge {
  display: grid;
  min-width: 220px;
  gap: 3px;
  padding: 14px 17px;
  border: 1px solid var(--on-line);
  border-radius: 16px;
  background: rgba(255,255,255,.72);
  box-shadow: var(--on-shadow);
}
.sleep-date-badge span,
.sleep-date-badge small { color: var(--on-muted); font-size: .68rem; }
.sleep-date-badge span { font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.sleep-date-badge strong { color: var(--health-ink); font-size: .95rem; }

.shared-sleep { padding: 22px 26px 24px; }
.shared-sleep__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}
.shared-sleep__header h2 {
  margin: 0;
  color: var(--health-ink);
  font-family: var(--on-display-font);
  font-size: 1.35rem;
  font-weight: 500;
}
.sleep-stage-legend { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px 14px; max-width: 420px; }
.sleep-stage-legend span { display: inline-flex; align-items: center; color: var(--on-muted); font-size: .68rem; }
.sleep-stage-legend i,
.person-dot { width: 8px; height: 8px; margin-right: 5px; border-radius: 50%; }

.shared-timeline__viewport {
  overflow-x: auto;
  overflow-y: hidden;
  padding: 5px 2px 2px;
  overscroll-behavior-x: contain;
}
.shared-timeline { min-width: 700px; }
.shared-timeline__axis { position: relative; height: 31px; border-bottom: 1px solid var(--on-line); }
.shared-timeline__axis > span {
  position: absolute;
  bottom: 8px;
  color: var(--on-muted);
  font-size: .62rem;
  white-space: nowrap;
  transform: translateX(-50%);
}
.shared-timeline__axis > span:first-child { transform: none; }
.shared-timeline__axis > span.is-end { transform: translateX(-100%); }
.shared-timeline__plot {
  position: relative;
  display: grid;
  gap: 12px;
  padding: 18px 0 4px;
  cursor: crosshair;
  outline: none;
}
.shared-timeline__plot:focus-visible { border-radius: 10px; box-shadow: 0 0 0 3px rgba(37,115,91,.16); }
.shared-timeline__track {
  position: relative;
  height: 34px;
  overflow: hidden;
  border: 1px solid rgba(38,54,49,.11);
  border-radius: 8px;
  background: #eef2ef;
  box-shadow: inset 0 1px 3px rgba(38,54,49,.08);
}
.shared-timeline__track--1 { box-shadow: inset 4px 0 #d37b5d, inset 0 1px 3px rgba(38,54,49,.08); }
.shared-timeline__track--2 { box-shadow: inset 4px 0 #5d8db0, inset 0 1px 3px rgba(38,54,49,.08); }
.shared-timeline__track.is-empty { background: repeating-linear-gradient(135deg, #f3f4f1 0 8px, #eceeea 8px 16px); }
.shared-timeline__gridline { position: absolute; z-index: 1; top: 0; bottom: 0; width: 1px; background: rgba(52,74,67,.12); }
.shared-timeline__segment {
  position: absolute;
  z-index: 2;
  top: 0;
  bottom: 0;
  min-width: 2px;
  border-right: 1px solid rgba(255,255,255,.5);
}
.shared-timeline__segment.stage-awake { background: var(--health-awake); }
.shared-timeline__segment.stage-rem { background: var(--health-rem); }
.shared-timeline__segment.stage-core { background: var(--health-core); }
.shared-timeline__segment.stage-deep { background: var(--health-deep); }
.shared-timeline__segment.stage-asleep_unspecified { background: var(--health-unspecified); }
.timeline-cursor {
  position: absolute;
  z-index: 8;
  top: 4px;
  bottom: -4px;
  width: 2px;
  background: #d4473d;
  box-shadow: 0 0 0 1px rgba(255,255,255,.7), 0 2px 8px rgba(153,42,35,.25);
  pointer-events: none;
  transform: translateX(-1px);
}
.timeline-cursor time {
  position: absolute;
  top: -23px;
  left: 50%;
  padding: 3px 6px;
  border-radius: 5px;
  background: #b9342d;
  color: white;
  font-size: .58rem;
  font-weight: 700;
  white-space: nowrap;
  transform: translateX(-50%);
}
.timeline-selection {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr);
  gap: 18px;
  margin-top: 16px;
  padding: 14px;
  border-radius: 12px;
  background: #f3f6f3;
}
.timeline-selection[hidden] { display: none; }
.timeline-selection > header { display: grid; align-content: center; gap: 3px; }
.timeline-selection > header span { color: var(--on-muted); font-size: .6rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; }
.timeline-selection > header strong { color: var(--health-ink); font-family: var(--on-display-font); font-size: 1.15rem; }
.timeline-selection__people { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.timeline-selection__person {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 9px;
  padding: 10px 12px 10px 17px;
  overflow: hidden;
  border: 1px solid var(--on-line);
  border-radius: 9px;
  background: white;
}
.timeline-selection__person::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 5px; background: #d37b5d; }
.timeline-selection__person--2::before { background: #5d8db0; }
.timeline-selection__person > span { grid-row: 1 / 3; align-self: center; color: var(--on-muted); font-size: .65rem; font-weight: 700; }
.timeline-selection__person strong { color: var(--health-ink); font-size: .78rem; }
.timeline-selection__person small { color: var(--on-muted); font-size: .62rem; }
.timeline-selection__person strong::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 2px; background: #cbd2ce; }
.timeline-selection__person[data-stage="awake"] strong::before { background: var(--health-awake); }
.timeline-selection__person[data-stage="rem"] strong::before { background: var(--health-rem); }
.timeline-selection__person[data-stage="core"] strong::before { background: var(--health-core); }
.timeline-selection__person[data-stage="deep"] strong::before { background: var(--health-deep); }
.timeline-selection__person[data-stage="asleep_unspecified"] strong::before { background: var(--health-unspecified); }

.sleep-comparisons { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-top: 18px; }
.comparison-visual { padding: 18px 20px; }
.comparison-visual header { display: flex; align-items: center; gap: 10px; }
.comparison-visual__icon { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 50%; background: #edf4ef; color: var(--health-accent); font-size: 1rem; }
.comparison-visual header p { margin: 0 0 2px; color: var(--on-muted); font-size: .62rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; }
.comparison-visual header strong { color: var(--health-ink); font-size: .9rem; }
.comparison-visual__axis { position: relative; height: 30px; margin: 14px 5px 8px; }
.comparison-visual__axis > i { position: absolute; top: 14px; left: 0; right: 0; height: 2px; background: #dfe6e1; }
.comparison-visual__axis > b { position: absolute; top: 8px; width: 14px; height: 14px; border: 3px solid white; border-radius: 50%; background: #d37b5d; box-shadow: 0 1px 4px rgba(38,54,49,.2); transform: translateX(-50%); }
.comparison-visual__axis > b.marker-2 { background: #5d8db0; }
.comparison-visual footer { display: flex; justify-content: space-between; gap: 12px; color: var(--on-muted); font-size: .62rem; }
.comparison-visual footer span { display: inline-flex; align-items: center; }
.comparison-visual footer b { margin-left: 4px; color: var(--health-ink); }
.comparison-visual--overlap footer b { margin: 0 4px 0 0; }
.person-dot { display: inline-block; background: #d37b5d; }
.person-dot--2 { background: #5d8db0; }
.overlap-visual { display: grid; gap: 5px; margin: 16px 5px 10px; }
.overlap-visual span { height: 8px; overflow: hidden; border-radius: 8px; background: #e7ece8; }
.overlap-visual i { display: block; width: var(--overlap); height: 100%; border-radius: inherit; background: #d37b5d; }
.overlap-visual span:last-child i { margin-left: calc(100% - var(--overlap)); background: #5d8db0; }
.sleep-upload-notice { margin-top: 18px; }
.night-result { position: relative; overflow: hidden; padding: 20px 22px; }
.night-result::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: #d37b5d; }
.night-result--2::before { background: #5d8db0; }
.night-result__header { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 16px; }
.night-result__identity { display: flex; align-items: center; gap: 12px; }
.night-result__identity > i { width: 9px; height: 42px; border-radius: 9px; background: #d37b5d; }
.night-result--2 .night-result__identity > i { background: #5d8db0; }
.night-result__identity p { margin: 0 0 2px; color: var(--on-muted); font-size: .66rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.night-result__identity strong { color: var(--health-ink); font-family: var(--on-display-font); font-size: 1.75rem; font-weight: 500; line-height: 1; }
.night-result__identity strong small { margin-left: 2px; color: var(--on-muted); font-family: var(--on-font); font-size: .68rem; }
.night-result__identity span { margin-left: 7px; color: var(--on-muted); font-size: .62rem; }
.efficiency-ring {
  position: relative;
  display: grid;
  width: 66px;
  height: 66px;
  place-content: center;
  border-radius: 50%;
  background: conic-gradient(var(--health-green) calc(var(--efficiency) * 1%), #e5ebe7 0);
  text-align: center;
}
.efficiency-ring::before { content: ""; position: absolute; inset: 6px; border-radius: 50%; background: white; }
.efficiency-ring strong,
.efficiency-ring span { position: relative; z-index: 1; display: block; }
.efficiency-ring strong { color: var(--health-ink); font-size: .8rem; line-height: 1; }
.efficiency-ring strong small { font-size: .52rem; }
.efficiency-ring span { margin-top: 3px; color: var(--on-muted); font-size: .46rem; text-transform: uppercase; }
.night-window-visual { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; margin-bottom: 13px; }
.night-window-visual > div { display: grid; grid-template-columns: auto auto; align-items: center; gap: 1px 6px; }
.night-window-visual > div > span { grid-row: 1 / 3; color: var(--health-green); font-size: 1rem; }
.night-window-visual strong { color: var(--health-ink); font-size: .76rem; }
.night-window-visual small { color: var(--on-muted); font-size: .5rem; text-transform: uppercase; }
.night-window-visual > i { height: 2px; background: linear-gradient(90deg, var(--health-deep), var(--health-core), var(--health-rem), var(--health-awake)); }
.stage-mix { display: flex; height: 13px; overflow: hidden; border-radius: 8px; background: #e8ece9; box-shadow: inset 0 1px 2px rgba(38,54,49,.12); }
.stage-mix > i { display: block; min-width: 2px; height: 100%; }
.stage-mix > i.stage-deep { background: var(--health-deep); }
.stage-mix > i.stage-core { background: var(--health-core); }
.stage-mix > i.stage-rem { background: var(--health-rem); }
.stage-mix > i.stage-awake { background: var(--health-awake); }
.stage-mix__key { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 9px; }
.stage-mix__key span { display: flex; align-items: center; color: var(--on-muted); font-size: .55rem; white-space: nowrap; }
.stage-mix__key span > i { width: 7px; height: 7px; margin-right: 4px; border-radius: 2px; }
.stage-mix__key strong { margin-left: 3px; color: var(--health-ink); }
.night-result__meta { display: flex; justify-content: space-between; gap: 12px; margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--on-line); color: var(--on-muted); font-size: .52rem; }

@media (max-width: 1050px) {
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .signal-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .trend-day { grid-template-columns: 1fr; }
  .trend-day__metrics { grid-template-columns: repeat(3, minmax(125px, 1fr)); }
  .person-sleep-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .person-signals { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sleep-overview-header { align-items: flex-start; }
  .shared-sleep__header { flex-direction: column; }
  .sleep-stage-legend { justify-content: flex-start; max-width: none; }
  .sleep-comparisons { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .comparison-visual--overlap { grid-column: 1 / -1; }
  .sleep-history { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
  .health-heading,
  .sleep-overview-header { align-items: flex-start; flex-direction: column; }
  .sleep-date-badge { width: 100%; min-width: 0; }
  .metric-grid,
  .signal-grid,
  .sleep-comparisons { grid-template-columns: 1fr; }
  .comparison-visual--overlap { grid-column: auto; }
  .timeline-selection { grid-template-columns: 1fr; }
  .timeline-selection__people { grid-template-columns: 1fr; }
  .panel,
  .shared-sleep { padding: 18px; }
  .source-label { max-width: 100%; }
  .sleep-history__night { padding: 16px; }
  .sleep-history__stage-key { flex-wrap: wrap; }
  .sleep-history__stage-key small { width: 100%; margin-left: 0; }
  .trend-day__metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sync-list li { grid-template-columns: 10px 1fr; }
  .sync-list li > span:last-child { grid-column: 2; }
  .household-grid { grid-template-columns: 1fr; }
  .household-person { padding: 18px; }
  .person-header,
  .data-notice { align-items: flex-start; flex-direction: column; }
  .profile-trends .trend-day__metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stage-mix__key { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
