:root {
  color-scheme: dark;
  --bg: #080d1b;
  --bg-soft: #0d1427;
  --panel: rgba(25, 32, 59, .86);
  --panel-solid: #171f39;
  --panel-light: #202947;
  --line: rgba(189, 199, 236, .12);
  --text: #f8f7ff;
  --muted: #9aa5c5;
  --muted-2: #697493;
  --primary: #9189ff;
  --primary-2: #b6b0ff;
  --mint: #59d8c4;
  --sun: #ffc86a;
  --coral: #ff8f78;
  --danger: #ff7285;
  --shadow: 0 24px 70px rgba(0, 0, 0, .34);
  --radius: 28px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  font-family: Inter, ui-rounded, "SF Pro Rounded", "Segoe UI", system-ui, -apple-system, sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
}

body {
  color: var(--text);
  overscroll-behavior: none;
  background:
    radial-gradient(circle at 78% 12%, rgba(110, 95, 230, .13), transparent 30%),
    radial-gradient(circle at 14% 88%, rgba(68, 205, 187, .08), transparent 28%),
    var(--bg);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

button,
[role="button"] {
  touch-action: manipulation;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(145, 137, 255, .55);
  outline-offset: 3px;
}

a {
  color: var(--primary-2);
}

#app {
  width: 100%;
  height: 100%;
}

.boot-screen {
  width: 100%;
  height: 100%;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 20px;
  color: var(--muted);
}

.boot-screen p {
  margin: 0;
  animation: breathe 1.8s ease-in-out infinite;
}

.brand-mark {
  position: relative;
  width: 44px;
  height: 44px;
  border-radius: 15px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #a79fff, #6659df);
  box-shadow: 0 10px 30px rgba(116, 101, 238, .35);
  overflow: hidden;
}

.brand-mark--large {
  width: 74px;
  height: 74px;
  border-radius: 24px;
}

.brand-moon {
  width: 22px;
  height: 22px;
  border: 6px solid #fff;
  border-top-color: transparent;
  border-right-color: transparent;
  border-radius: 50%;
  transform: rotate(-28deg);
}

.brand-spines {
  position: absolute;
  top: 5px;
  right: 7px;
  color: #fff;
  font-size: 10px;
}

.login-screen {
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-columns: 1fr;
  position: relative;
  overflow: hidden;
}

.login-art {
  display: none;
}

.login-panel {
  width: min(100%, 470px);
  height: 100%;
  margin: 0 auto;
  padding: calc(28px + var(--safe-top)) 24px calc(24px + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  z-index: 2;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: clamp(24px, 6vh, 54px);
}

.login-brand h1 {
  margin: 0;
  font-size: 28px;
  letter-spacing: -.8px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--primary-2);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.login-copy h2 {
  margin: 0 0 10px;
  font-size: clamp(32px, 9vw, 46px);
  line-height: 1.03;
  letter-spacing: -1.8px;
}

.login-copy > p:last-child {
  margin: 0 0 24px;
  color: var(--muted);
  line-height: 1.55;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 5px;
  margin-bottom: 18px;
  background: rgba(27, 35, 63, .7);
  border: 1px solid var(--line);
  border-radius: 16px;
}

.auth-tab {
  min-height: 44px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 750;
}

.auth-tab.is-active {
  color: #fff;
  background: var(--panel-light);
  box-shadow: 0 8px 18px rgba(0, 0, 0, .18);
}

.form-stack {
  display: grid;
  gap: 13px;
}

.field {
  display: grid;
  gap: 7px;
}

.field span {
  color: #c3cbe1;
  font-size: 13px;
  font-weight: 700;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 52px;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 0 16px;
  color: var(--text);
  background: rgba(24, 32, 58, .78);
  transition: border-color .2s, background .2s;
}

.field textarea {
  padding-top: 14px;
  resize: none;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: rgba(145, 137, 255, .8);
  background: #1a2340;
  outline: 0;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.primary-button,
.secondary-button,
.ghost-button,
.danger-button {
  min-height: 52px;
  border-radius: 17px;
  border: 0;
  padding: 0 20px;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 9px;
  transition: transform .18s, filter .18s, opacity .18s;
}

.primary-button {
  color: #101429;
  background: linear-gradient(135deg, #aaa3ff, #8177f1 70%, #baafff);
  box-shadow: 0 12px 28px rgba(116, 103, 232, .3);
}

.secondary-button {
  background: var(--panel-light);
  border: 1px solid var(--line);
}

.ghost-button {
  color: var(--primary-2);
  background: rgba(145, 137, 255, .08);
  border: 1px solid rgba(145, 137, 255, .18);
}

.danger-button {
  color: #ffb5bf;
  background: rgba(255, 114, 133, .1);
  border: 1px solid rgba(255, 114, 133, .18);
}

button:active {
  transform: scale(.97);
}

button:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.demo-login {
  margin-top: 12px;
  width: 100%;
}

.login-note {
  margin: 18px 0 0;
  color: var(--muted-2);
  text-align: center;
  font-size: 12px;
}

.app-shell {
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-rows: calc(74px + var(--safe-top)) minmax(0, 1fr) calc(78px + var(--safe-bottom));
  position: relative;
  background:
    radial-gradient(circle at 8% 20%, rgba(255,255,255,.35) 0 1px, transparent 1.6px),
    radial-gradient(circle at 88% 8%, rgba(255,255,255,.25) 0 1px, transparent 1.4px),
    radial-gradient(circle at 77% 42%, rgba(255,255,255,.18) 0 1px, transparent 1.3px),
    radial-gradient(circle at 18% 72%, rgba(255,255,255,.16) 0 1px, transparent 1.5px),
    linear-gradient(160deg, #0b1020 0%, #0d1428 58%, #0a1224 100%);
  background-size: 177px 211px, 231px 193px, 149px 181px, 203px 229px, auto;
  overflow: hidden;
}

.topbar {
  grid-row: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--safe-top) 18px 0;
  z-index: 5;
}

.topbar-brand {
  display: none;
  align-items: center;
  gap: 11px;
  font-size: 19px;
  font-weight: 850;
}

.child-switcher {
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 5px 12px 5px 6px;
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--text);
  background: rgba(21, 29, 53, .66);
  backdrop-filter: blur(18px);
  cursor: pointer;
}

.child-switcher strong {
  max-width: 120px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.avatar {
  --avatar-color: var(--primary);
  width: 35px;
  height: 35px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  flex: none;
  color: #fff;
  font-size: 16px;
  font-weight: 850;
  background: color-mix(in srgb, var(--avatar-color) 27%, #151d35);
  border: 1px solid color-mix(in srgb, var(--avatar-color) 62%, transparent);
  box-shadow: 0 7px 20px color-mix(in srgb, var(--avatar-color) 18%, transparent);
}

.avatar--large {
  width: 52px;
  height: 52px;
  border-radius: 18px;
  font-size: 22px;
}

.avatar-symbol {
  font-size: 19px;
  line-height: 1;
}

.icon-button {
  width: 46px;
  height: 46px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: rgba(21, 29, 53, .66);
  cursor: pointer;
}

.screen {
  grid-row: 2;
  min-width: 0;
  min-height: 0;
  padding: 4px 16px 12px;
  overflow: hidden;
  animation: screen-in .28s ease-out;
}

.nav-bar {
  grid-row: 3;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 2px;
  padding: 7px 12px calc(7px + var(--safe-bottom));
  border-top: 1px solid var(--line);
  background: rgba(12, 18, 35, .9);
  backdrop-filter: blur(24px);
  z-index: 10;
}

.nav-logo {
  display: none;
}

.nav-button {
  min-width: 0;
  border: 0;
  border-radius: 16px;
  background: transparent;
  color: var(--muted-2);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  font-weight: 750;
  cursor: pointer;
}

.nav-button.is-active {
  color: var(--primary-2);
  background: rgba(145, 137, 255, .09);
}

.nav-button--track {
  color: #11162d;
  width: 54px;
  height: 54px;
  min-height: 54px;
  justify-self: center;
  align-self: center;
  border-radius: 19px;
  background: linear-gradient(145deg, #aaa4ff, #7d73ee);
  box-shadow: 0 8px 28px rgba(124, 112, 236, .36);
}

.nav-button--track span {
  display: none;
}

.dashboard-screen {
  height: 100%;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 8px;
}

.screen-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  min-height: 44px;
}

.screen-heading h1 {
  margin: 0;
  font-size: clamp(22px, 6.5vw, 30px);
  line-height: 1.05;
  letter-spacing: -1px;
}

.screen-heading p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.date-pill {
  flex: none;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--muted);
  background: rgba(255, 255, 255, .03);
  font-size: 11px;
  font-weight: 750;
}

.recommendation-card {
  min-height: 0;
  position: relative;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 30px;
  background:
    radial-gradient(circle at 50% 46%, rgba(145, 137, 255, .12), transparent 48%),
    linear-gradient(160deg, rgba(24, 32, 59, .83), rgba(13, 20, 39, .7));
  overflow: hidden;
  box-shadow: inset 0 1px rgba(255, 255, 255, .03), var(--shadow);
}

.recommendation-card::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: .42;
  background:
    radial-gradient(circle at 18% 21%, white 0 1px, transparent 1.5px),
    radial-gradient(circle at 72% 17%, white 0 1px, transparent 1.5px),
    radial-gradient(circle at 82% 68%, white 0 1px, transparent 1.5px),
    radial-gradient(circle at 28% 77%, white 0 1px, transparent 1.5px);
  pointer-events: none;
}

.sleep-orbit {
  position: relative;
  width: min(100%, 420px);
  height: min(100%, 410px);
  min-height: 286px;
  z-index: 1;
}

.sleep-orbit svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.orbit-track,
.orbit-progress {
  fill: none;
  stroke-width: 22;
  stroke-linecap: round;
}

.orbit-track {
  stroke: rgba(126, 137, 188, .12);
}

.orbit-progress {
  stroke: url(#orbitGradient);
  filter: drop-shadow(0 0 8px rgba(145, 137, 255, .28));
  transition: stroke-dashoffset .5s ease;
}

.orbit-marker {
  fill: #171f39;
  stroke-width: 3;
}

.orbit-marker--wake { stroke: var(--sun); }
.orbit-marker--sleep { stroke: var(--primary); }

.orbit-content {
  position: absolute;
  left: 50%;
  top: 49%;
  width: 76%;
  transform: translate(-50%, -50%);
  text-align: center;
}

.orbit-kicker {
  margin: 0 0 5px;
  color: var(--muted);
  font-size: clamp(12px, 3.3vw, 15px);
}

.orbit-time {
  display: block;
  font-size: clamp(44px, 14vw, 76px);
  line-height: .98;
  letter-spacing: -4px;
  font-variant-numeric: tabular-nums;
}

.orbit-subtitle {
  margin: 8px 0 0;
  color: var(--primary-2);
  font-size: 14px;
  font-weight: 750;
}

.orbit-range {
  margin: 5px 0 0;
  color: var(--muted-2);
  font-size: 11px;
}

.orbit-label {
  position: absolute;
  bottom: 9%;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.orbit-label--start { left: 8%; }
.orbit-label--end { right: 8%; }

.insight-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.insight-card {
  min-width: 0;
  min-height: 64px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 20px;
  display: flex;
  align-items: center;
  gap: 11px;
  background: rgba(23, 31, 57, .78);
}

.insight-icon {
  width: 40px;
  height: 40px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: var(--primary-2);
  background: rgba(145, 137, 255, .12);
  flex: none;
}

.insight-card p {
  margin: 0 0 3px;
  color: var(--muted);
  font-size: 10px;
}

.insight-card strong {
  display: block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 13px;
}

.quick-track {
  width: 64px;
  min-height: 64px;
  padding: 0;
  border: 0;
  border-radius: 20px;
  display: grid;
  place-items: center;
  color: #11162a;
  background: linear-gradient(145deg, #b1abff, #887ff8);
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(128, 116, 237, .24);
}

.calendar-screen,
.stats-screen,
.profiles-screen {
  height: 100%;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
}

.calendar-content {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 8px;
}

.week-strip {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.week-day {
  min-width: 0;
  padding: 5px 2px;
  border: 0;
  border-radius: 14px;
  display: grid;
  place-items: center;
  gap: 4px;
  color: var(--muted-2);
  background: transparent;
  cursor: pointer;
}

.week-day span {
  font-size: 9px;
  font-weight: 800;
}

.week-day strong {
  width: 31px;
  height: 31px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  font-size: 12px;
}

.week-day.is-selected {
  color: var(--primary-2);
  background: rgba(145, 137, 255, .07);
}

.week-day.is-selected strong {
  color: #fff;
  background: var(--primary);
}

.day-dial {
  min-height: 0;
  position: relative;
  display: grid;
  place-items: center;
}

.day-dial svg {
  height: 100%;
  max-height: 350px;
  width: min(100%, 350px);
  overflow: visible;
}

.day-ring-base {
  fill: rgba(16, 23, 44, .55);
  stroke: rgba(132, 143, 193, .12);
  stroke-width: 24;
}

.day-arc {
  fill: none;
  stroke-width: 21;
  stroke-linecap: round;
  filter: drop-shadow(0 0 7px color-mix(in srgb, currentColor 35%, transparent));
}

.day-arc--nap { stroke: var(--primary); color: var(--primary); }
.day-arc--night { stroke: var(--coral); color: var(--coral); }

.dial-center {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  pointer-events: none;
}

.dial-center p {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
}

.dial-center strong {
  max-width: 220px;
  text-align: center;
  font-size: clamp(25px, 7vw, 38px);
  letter-spacing: -1.5px;
}

.dial-center span {
  margin-top: 6px;
  color: var(--primary-2);
  font-size: 12px;
  font-weight: 750;
}

.day-summary {
  min-height: 68px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
}

.summary-stat {
  min-width: 0;
  padding: 9px 7px;
  border: 1px solid var(--line);
  border-radius: 17px;
  text-align: center;
  background: rgba(24, 32, 58, .7);
}

.summary-stat span {
  display: block;
  margin-bottom: 2px;
  color: var(--muted-2);
  font-size: 9px;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.summary-stat strong {
  display: block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 13px;
}

.stats-content {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 10px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
}

.stat-card {
  min-width: 0;
  padding: 13px 10px;
  border: 1px solid var(--line);
  border-radius: 19px;
  background: rgba(24, 32, 58, .72);
}

.stat-card span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 750;
}

.stat-card strong {
  display: block;
  font-size: clamp(17px, 5vw, 24px);
  letter-spacing: -.7px;
}

.stat-card small {
  color: var(--muted-2);
  font-size: 9px;
}

.chart-card {
  min-height: 0;
  padding: 14px 14px 9px;
  border: 1px solid var(--line);
  border-radius: 24px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  background: rgba(22, 30, 55, .72);
}

.chart-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chart-head h2 {
  margin: 0;
  font-size: 14px;
}

.legend {
  display: flex;
  gap: 9px;
  color: var(--muted);
  font-size: 9px;
}

.legend i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 3px;
}

.bars {
  min-height: 0;
  height: 100%;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  align-items: end;
  padding-top: 14px;
}

.bar-column {
  min-width: 0;
  height: 100%;
  display: grid;
  grid-template-rows: minmax(0, 1fr) 16px;
  gap: 4px;
  align-items: end;
}

.bar-track {
  width: 100%;
  height: 100%;
  max-width: 32px;
  justify-self: center;
  border-radius: 10px;
  display: flex;
  flex-direction: column-reverse;
  overflow: hidden;
  background: rgba(255,255,255,.035);
}

.bar-night { background: linear-gradient(#7f77ed, #6058c6); }
.bar-nap { background: linear-gradient(#70e0ce, #43b9a7); }

.bar-column label {
  color: var(--muted-2);
  text-align: center;
  font-size: 9px;
  font-weight: 750;
}

.rhythm-card {
  padding: 12px 14px;
  border: 1px solid rgba(89, 216, 196, .16);
  border-radius: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(42, 111, 104, .1);
}

.rhythm-card strong,
.rhythm-card p {
  margin: 0;
}

.rhythm-card strong {
  display: block;
  margin-bottom: 3px;
  font-size: 12px;
}

.rhythm-card p {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.35;
}

.profiles-content {
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 10px;
}

.profile-list {
  min-height: 0;
  display: grid;
  align-content: start;
  gap: 8px;
}

.profile-card {
  min-height: 74px;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 21px;
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(23, 31, 57, .74);
}

.profile-card.is-active {
  border-color: rgba(145, 137, 255, .38);
  background: linear-gradient(115deg, rgba(82, 72, 163, .2), rgba(23, 31, 57, .78));
}

.profile-card__copy {
  min-width: 0;
  flex: 1;
}

.profile-card__copy strong {
  display: block;
  margin-bottom: 4px;
  font-size: 15px;
}

.profile-card__copy span {
  color: var(--muted);
  font-size: 11px;
}

.profile-card__actions {
  display: flex;
  gap: 5px;
}

.mini-button {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 13px;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: rgba(255,255,255,.045);
  cursor: pointer;
}

.account-card {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(23, 31, 57, .74);
}

.account-card__copy {
  min-width: 0;
  flex: 1;
}

.account-card__copy strong,
.account-card__copy span {
  display: block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.account-card__copy strong { font-size: 12px; }
.account-card__copy span { margin-top: 2px; color: var(--muted); font-size: 10px; }

.overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: end center;
  background: rgba(3, 7, 16, .72);
  backdrop-filter: blur(9px);
  animation: fade-in .2s ease-out;
}

.modal {
  width: min(100%, 540px);
  max-height: min(92dvh, 760px);
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 30px 30px 0 0;
  padding: 9px 20px calc(22px + var(--safe-bottom));
  background: linear-gradient(155deg, #1b2442, #10172d 72%);
  box-shadow: 0 -20px 80px rgba(0,0,0,.45);
  overflow: auto;
  overscroll-behavior: contain;
  animation: sheet-in .28s cubic-bezier(.2,.85,.25,1);
}

.modal-handle {
  width: 44px;
  height: 5px;
  border-radius: 99px;
  margin: 0 auto 15px;
  background: #5c6687;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.modal-head h2 {
  margin: 0;
  font-size: 23px;
  letter-spacing: -.7px;
}

.modal-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.modal-close {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: rgba(255,255,255,.05);
  cursor: pointer;
}

.action-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.sleep-action {
  min-height: 132px;
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 15px;
  display: grid;
  align-content: space-between;
  text-align: left;
  background: rgba(255,255,255,.035);
  cursor: pointer;
}

.sleep-action__icon {
  width: 48px;
  height: 48px;
  border-radius: 17px;
  display: grid;
  place-items: center;
  color: var(--primary-2);
  background: rgba(145,137,255,.14);
}

.sleep-action--night .sleep-action__icon {
  color: #ffb09c;
  background: rgba(255,143,120,.12);
}

.sleep-action strong { display: block; font-size: 15px; }
.sleep-action small { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; }

.manual-link {
  width: 100%;
  margin-top: 10px;
}

.active-sleep {
  display: grid;
  justify-items: center;
  text-align: center;
  gap: 13px;
  padding: 6px 0 2px;
}

.active-pulse {
  width: 84px;
  height: 84px;
  border-radius: 29px;
  display: grid;
  place-items: center;
  color: var(--primary-2);
  background: rgba(145,137,255,.12);
  box-shadow: 0 0 0 12px rgba(145,137,255,.04);
  animation: breathe 2.4s ease-in-out infinite;
}

.active-sleep h3 { margin: 2px 0 0; font-size: 18px; }
.active-sleep__timer { font-size: 48px; letter-spacing: -2px; font-variant-numeric: tabular-nums; }
.active-sleep p { margin: 0; color: var(--muted); font-size: 12px; }
.active-sleep .primary-button { width: 100%; }

.color-options,
.avatar-options {
  display: flex;
  gap: 9px;
  flex-wrap: wrap;
}

.color-option,
.avatar-option {
  position: relative;
}

.color-option input,
.avatar-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.color-option span {
  width: 38px;
  height: 38px;
  border-radius: 13px;
  display: block;
  border: 3px solid transparent;
  background: var(--choice);
  box-shadow: inset 0 0 0 3px #19213c;
  cursor: pointer;
}

.color-option input:checked + span,
.avatar-option input:checked + span {
  border-color: #fff;
}

.avatar-option span {
  width: 44px;
  height: 44px;
  border: 2px solid transparent;
  border-radius: 15px;
  display: grid;
  place-items: center;
  background: rgba(255,255,255,.055);
  font-size: 21px;
  cursor: pointer;
}

.modal-actions {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  margin-top: 17px;
}

.source-copy {
  color: #c1c9df;
  font-size: 13px;
  line-height: 1.55;
}

.source-copy h3 {
  margin: 18px 0 5px;
  color: #fff;
  font-size: 15px;
}

.source-copy p {
  margin: 0 0 10px;
}

.source-copy ul {
  margin: 8px 0 12px;
  padding-left: 18px;
}

.source-copy .disclaimer {
  padding: 12px;
  border-radius: 15px;
  color: #d7cfe9;
  background: rgba(145,137,255,.08);
  border: 1px solid rgba(145,137,255,.14);
}

.empty-state {
  align-self: center;
  justify-self: center;
  max-width: 280px;
  text-align: center;
  color: var(--muted);
}

.empty-state strong {
  display: block;
  margin-bottom: 5px;
  color: var(--text);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(92px + var(--safe-bottom));
  z-index: 200;
  width: max-content;
  max-width: calc(100% - 32px);
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 15px;
  color: var(--text);
  background: #222b49;
  box-shadow: var(--shadow);
  transform: translateX(-50%);
  font-size: 12px;
  font-weight: 700;
  animation: toast-in .25s ease-out;
}

.toast.is-error {
  border-color: rgba(255,114,133,.28);
  background: #3a2132;
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .65s linear infinite;
}

@media (max-height: 700px) {
  .app-shell {
    grid-template-rows: calc(62px + var(--safe-top)) minmax(0, 1fr) calc(68px + var(--safe-bottom));
  }
  .screen { padding-top: 0; }
  .screen-heading { min-height: 34px; }
  .screen-heading h1 { font-size: 20px; }
  .screen-heading p, .date-pill { display: none; }
  .orbit-time { font-size: 42px; }
  .orbit-content { top: 48%; }
  .insight-row { gap: 7px; }
  .insight-card, .quick-track { min-height: 54px; }
  .quick-track { height: 54px; }
  .week-day { padding: 2px; }
  .week-day strong { height: 28px; width: 28px; }
  .stat-card { padding: 9px 8px; }
}

@media (min-width: 760px) {
  body { padding: 20px; }

  .app-shell {
    max-width: 1180px;
    max-height: 860px;
    margin: auto;
    grid-template-columns: 205px minmax(0, 1fr);
    grid-template-rows: 88px minmax(0, 1fr);
    border: 1px solid rgba(186,198,235,.12);
    border-radius: 34px;
    box-shadow: 0 30px 100px rgba(0,0,0,.46);
  }

  .topbar {
    grid-column: 2;
    grid-row: 1;
    padding: 0 28px;
    border-bottom: 1px solid var(--line);
  }

  .topbar-brand { display: flex; }

  .screen {
    grid-column: 2;
    grid-row: 2;
    padding: 20px 28px 26px;
  }

  .nav-bar {
    grid-column: 1;
    grid-row: 1 / 3;
    grid-template-columns: 1fr;
    grid-template-rows: auto repeat(5, 58px) 1fr;
    gap: 8px;
    padding: 22px 16px;
    border-top: 0;
    border-right: 1px solid var(--line);
    background: rgba(12,18,35,.62);
  }

  .nav-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 2px 5px 28px;
    font-size: 19px;
    font-weight: 850;
  }

  .nav-button {
    flex-direction: row;
    justify-content: flex-start;
    gap: 12px;
    padding: 0 16px;
    font-size: 13px;
  }

  .nav-button--track {
    width: 100%;
    height: 54px;
    min-height: 54px;
    border-radius: 17px;
    justify-content: flex-start;
    color: #11162d;
  }

  .nav-button--track span { display: block; }

  .dashboard-screen {
    grid-template-columns: minmax(0, 1.45fr) minmax(260px, .7fr);
    grid-template-rows: auto minmax(0, 1fr);
    gap: 16px 20px;
  }

  .dashboard-screen .screen-heading { grid-column: 1 / 3; }
  .recommendation-card { grid-column: 1; grid-row: 2; }
  .insight-row {
    grid-column: 2;
    grid-row: 2;
    grid-template-columns: 1fr;
    grid-template-rows: auto 78px;
    align-content: end;
  }
  .insight-card { min-height: 92px; }
  .quick-track { width: 100%; min-height: 78px; }

  .calendar-content {
    grid-template-columns: minmax(0, 1fr) 240px;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 16px 24px;
  }
  .week-strip { grid-column: 1 / 3; }
  .day-dial { grid-column: 1; grid-row: 2; }
  .day-summary {
    grid-column: 2;
    grid-row: 2;
    grid-template-columns: 1fr;
    align-content: center;
  }
  .summary-stat { padding: 16px; }

  .stats-content {
    grid-template-columns: minmax(0, 1fr) 250px;
    grid-template-rows: auto minmax(0,1fr);
  }
  .stats-grid { grid-column: 1 / 3; }
  .chart-card { grid-column: 1; }
  .rhythm-card { grid-column: 2; align-self: stretch; }

  .profile-list { grid-template-columns: 1fr 1fr; }
  .account-card { max-width: 540px; }

  .modal {
    align-self: center;
    border-bottom: 1px solid var(--line);
    border-radius: 30px;
    padding-bottom: 24px;
  }

  .overlay { place-items: center; }
  .modal-handle { display: none; }

  .toast { bottom: 38px; }

  .login-screen { grid-template-columns: minmax(0, 1.1fr) minmax(420px, .9fr); }
  .login-art {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 56px;
    position: relative;
    overflow: hidden;
    background:
      radial-gradient(circle at 48% 39%, rgba(145,137,255,.24), transparent 22%),
      linear-gradient(150deg, #0b1225, #111936);
  }
  .login-art::before {
    content: "";
    position: absolute;
    width: min(48vw, 540px);
    aspect-ratio: 1;
    left: 50%;
    top: 45%;
    transform: translate(-50%, -50%);
    border: 48px solid rgba(145,137,255,.1);
    border-right-color: transparent;
    border-radius: 50%;
    filter: drop-shadow(0 0 32px rgba(145,137,255,.12));
  }
  .login-art::after {
    content: "☾";
    position: absolute;
    left: 50%;
    top: 43%;
    transform: translate(-50%, -50%) rotate(-18deg);
    color: #b8b2ff;
    font-size: min(18vw, 210px);
    text-shadow: 0 0 60px rgba(145,137,255,.4);
  }
  .login-art-copy { position: relative; z-index: 1; max-width: 560px; }
  .login-art-copy p { color: var(--primary-2); font-weight: 800; }
  .login-art-copy h2 { margin: 0; font-size: clamp(34px, 4vw, 58px); line-height: 1.05; letter-spacing: -2px; }
  .login-panel { padding-inline: clamp(38px, 6vw, 90px); width: 100%; max-width: 620px; }
}

@media (min-width: 1180px) {
  .sleep-orbit { width: min(100%, 560px); }
  .profile-list { grid-template-columns: repeat(3, 1fr); }
}

@keyframes screen-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes sheet-in {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 12px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

@keyframes breathe {
  0%, 100% { opacity: .65; transform: scale(.98); }
  50% { opacity: 1; transform: scale(1.02); }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
  }
}
