:root {
  --bg: #10121b;
  --surface: #171a26;
  --surface-2: #1d2130;
  --line: rgba(255, 255, 255, 0.07);
  --text: #e8eaf2;
  --muted: #9aa0b5;
  --sleep: #8fa8d6;
  --feed: #d9a76b;
  --diaper: #7fbfa0;
  --growth: #b79fd6;
  --wake: #e1b865;
  --medication: #bf91c9;
  --appointment: #78a9c6;
  --danger: #d67f8f;
  --on-accent: #10121b;
  --glow: rgba(143,168,214,.18);
  --glow-strong: rgba(143,168,214,.45);
  --nav-bg: rgba(16,18,27,.92);
}

[data-theme="light"] {
  --bg: #f5f4ef;
  --surface: #ffffff;
  --surface-2: #efece4;
  --line: rgba(23,26,38,.09);
  --text: #23242e;
  --muted: #6d7285;
  --sleep: #5f7cb8;
  --feed: #b9854a;
  --diaper: #4f9a78;
  --growth: #8a6bb8;
  --wake: #a97820;
  --medication: #895395;
  --appointment: #477f9f;
  --danger: #c05a6e;
  --on-accent: #ffffff;
  --glow: rgba(95,124,184,.16);
  --glow-strong: rgba(95,124,184,.35);
  --nav-bg: rgba(245,244,239,.92);
}

* { box-sizing: border-box; margin: 0; }
html, body {
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  transition: background .4s ease, color .4s ease;
}

.font-display { font-family: "Fraunces", Georgia, serif; }
.font-mono2 { font-family: "IBM Plex Mono", ui-monospace, monospace; }
.muted { color: var(--muted); }
.hidden { display: none !important; }

.wrap { max-width: 512px; margin: 0 auto; padding: 0 20px; }
.center-screen {
  min-height: 100vh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; padding: 24px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
}

input, select, textarea {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  color: var(--text);
  width: 100%;
  font-size: 16px;
  outline: none;
  font-family: inherit;
}
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 2px solid var(--sleep); outline-offset: 2px; }

.btn-primary {
  background: var(--sleep);
  color: var(--on-accent);
  font-weight: 600;
  border: none;
  border-radius: 12px;
  padding: 13px 18px;
  width: 100%;
  font-size: 16px;
  cursor: pointer;
  font-family: inherit;
}
.btn-primary:disabled { opacity: 0.5; }

.chip {
  border: 1px solid var(--line);
  background: var(--surface-2);
  border-radius: 999px;
  padding: 10px 18px;
  font-size: 16px;
  font-family: "IBM Plex Mono", monospace;
  color: var(--text);
  cursor: pointer;
}
.chip.selected {
  background: var(--feed);
  color: #10121b;
  border-color: transparent;
  font-weight: 600;
}

/* Botón de sueño con respiración */
@keyframes breathe {
  0%, 100% { transform: scale(1); box-shadow: 0 0 40px 0 var(--glow); }
  50% { transform: scale(1.035); box-shadow: 0 0 70px 6px var(--glow-strong); }
}
@keyframes breathe-slow {
  0%, 100% { transform: scale(1); box-shadow: 0 0 60px 4px var(--glow-strong); }
  50% { transform: scale(1.02); box-shadow: 0 0 90px 14px var(--glow-strong); }
}
.sleep-btn {
  width: 176px; height: 176px; border-radius: 50%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; cursor: pointer; color: var(--text);
  background: var(--surface);
  border: 2px solid var(--line);
  animation: breathe 3.2s ease-in-out infinite;
  font-family: inherit; font-size: 16px;
}
.sleep-btn.sleeping {
  background: rgba(143,168,214,.16);
  border-color: var(--sleep);
  animation: breathe-slow 6.5s ease-in-out infinite;
}
.sleep-btn:disabled { opacity: .45; cursor: default; }

@keyframes fade-up {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
.fade-up { animation: fade-up .45s ease both; }

header.app-header {
  padding: 24px 0 12px;
  display: flex; align-items: baseline; justify-content: space-between;
}
header.app-header h1 { font-size: 30px; font-weight: 500; }
header.app-header button {
  background: none; border: none; color: var(--muted); font-size: 14px; cursor: pointer;
  min-width: 44px; min-height: 44px; padding: 8px;
}
.header-actions { display: flex; align-items: center; gap: 14px; }

nav.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--nav-bg); backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  padding-bottom: max(env(safe-area-inset-bottom), 12px);
  z-index: 30;
}
nav.bottom-nav .inner { max-width: 512px; margin: 0 auto; display: flex; }
nav.bottom-nav a {
  flex: 1; padding: 12px 0; text-align: center; font-size: 12px;
  color: var(--muted); text-decoration: none;
}
nav.bottom-nav a.active { color: var(--sleep); }
nav.bottom-nav a .ico { display: block; font-size: 20px; margin-bottom: 4px; }

main { padding-bottom: 110px; }

.status-line { text-align: center; margin-bottom: 24px; font-size: 14px; }

.quick-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 32px 0; }
.quick-grid button {
  padding: 16px 0; display: flex; flex-direction: column; align-items: center; gap: 4px;
  cursor: pointer; color: var(--text); font-size: 12px; font-family: inherit;
}
.quick-grid button:disabled { opacity: .45; }
.quick-grid .ico { font-size: 24px; }

.timeline-item { display: flex; align-items: center; gap: 12px; padding: 12px 16px; margin-bottom: 8px; }
.timeline-item .badge {
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 18px; color: #10121b;
}
.timeline-item .grow { flex: 1; min-width: 0; }
.timeline-item p.title { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.timeline-item p.sub { font-size: 12px; color: var(--muted); }
.entry-actions { display: flex; align-items: center; gap: 2px; }
.timeline-item button.del,
.timeline-item button.edit {
  background: none; border: none; color: var(--muted); cursor: pointer; padding: 6px;
}
.timeline-item button.del { font-size: 18px; }
.timeline-item button.edit { font-size: 11px; font-family: "IBM Plex Mono", monospace; }
.timeline-item button.edit:hover { color: var(--sleep); }

/* Bottom sheet */
.sheet-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 40;
  display: flex; align-items: flex-end; justify-content: center;
}
.sheet {
  width: 100%; max-width: 512px; padding: 20px 20px 32px;
  padding-bottom: max(32px, env(safe-area-inset-bottom));
  background: var(--surface);
  border: 1px solid var(--line);
  border-top-left-radius: 24px; border-top-right-radius: 24px;
  animation: fade-up .3s ease both;
}
.sheet h3 { font-size: 24px; margin-bottom: 16px; }
.sheet .row { display: flex; gap: 8px; margin-bottom: 12px; }
.sheet .row > * { flex: 1; }
.sheet-close {
  background: none; border: none; color: var(--muted); font-size: 24px; cursor: pointer;
}
.sheet-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.edit-sheet { display: flex; flex-direction: column; gap: 10px; }
.edit-sheet h3 { margin-bottom: 0; }
.edit-sheet .field-label { color: var(--muted); font-size: 12px; margin-top: 4px; }
.edit-sheet .btn-primary { margin-top: 8px; }

.stat-card { padding: 16px; text-align: center; }
.stat-card .val { font-size: 18px; }
.stat-card .lbl { font-size: 12px; color: var(--muted); margin-top: 4px; }

.bars { display: flex; align-items: flex-end; gap: 8px; height: 150px; padding: 20px; }
.bars .col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; height: 100%; justify-content: flex-end; }
.bars .bar { width: 100%; border-radius: 8px 8px 0 0; background: linear-gradient(to top, rgba(143,168,214,.45), var(--sleep)); }
.bars .cap { font-size: 12px; color: var(--muted); }
.bars .amt { font-size: 10px; color: var(--muted); font-family: "IBM Plex Mono", monospace; }

.banner-expired {
  display: block; text-decoration: none; padding: 12px 16px; margin-bottom: 16px;
  border-color: rgba(217,167,107,.4) !important; font-size: 14px;
}
.banner-expired .accent { color: var(--feed); }

.tabs { display: flex; gap: 4px; padding: 4px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); margin-bottom: 20px; }
.tabs button {
  flex: 1; padding: 8px 0; font-size: 14px; border-radius: 12px; border: none;
  background: none; color: var(--muted); cursor: pointer; font-family: inherit;
}
.tabs button.active { background: var(--surface-2); color: var(--text); }

form.stack { display: flex; flex-direction: column; gap: 12px; }
.error { color: var(--danger); font-size: 14px; }
.section-card { padding: 20px; margin-bottom: 16px; }
.section-card h3 { font-size: 18px; margin-bottom: 8px; }
.section-card h2 { font-size: 20px; margin-bottom: 4px; }

.member { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; background: var(--surface-2);
  color: var(--sleep); display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 14px;
}

@keyframes pop-in {
  0% { opacity: 0; transform: scale(.92); }
  70% { transform: scale(1.02); }
  100% { opacity: 1; transform: none; }
}
.pop-in { animation: pop-in .35s cubic-bezier(.2,.9,.3,1.2) both; }
@keyframes twinkle {
  0%, 100% { opacity: .25; transform: scale(.85); }
  50% { opacity: 1; transform: scale(1.1); }
}
.twinkle { animation: twinkle 3s ease-in-out infinite; }
.progress-track { height: 7px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.progress-fill { height: 100%; border-radius: inherit; transition: width .35s ease; }
.insights-card { padding: 20px; margin-bottom: 24px; }
.insights-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.insights-card .eyebrow { font-size: 11px; margin-bottom: 4px; }
.insights-card .prediction { color: var(--sleep); font-size: 24px; }
.insights-card .details { font-size: 12px; margin: 4px 0 12px; line-height: 1.5; }
.sleep-alert-banner {
  position: fixed; top: max(14px, env(safe-area-inset-top)); left: 50%; z-index: 60;
  width: min(460px, calc(100% - 32px)); transform: translate(-50%, -140%);
  padding: 13px 16px; border-radius: 14px; background: var(--sleep); color: var(--on-accent);
  box-shadow: 0 14px 36px rgba(0,0,0,.28); font-size: 14px; font-weight: 600;
  opacity: 0; transition: transform .3s ease, opacity .3s ease;
}
.sleep-alert-banner.show { transform: translate(-50%, 0); opacity: 1; }
.chat-card { padding: 20px; margin: 0 0 28px; }
.chat-card .eyebrow { font-size: 11px; margin-bottom: 5px; }
.chat-card h2 { font-size: 20px; margin-bottom: 14px; }
.chat-suggestions { display: flex; gap: 7px; overflow-x: auto; padding-bottom: 10px; }
.chat-suggestions .chip { flex: 0 0 auto; font-size: 11px; padding: 8px 12px; }
.chat-compose { display: flex; gap: 8px; margin-top: 4px; }
.chat-compose .btn-primary { width: 48px; flex: 0 0 48px; padding-inline: 0; }
.chat-answer { white-space: pre-line; line-height: 1.55; font-size: 14px; margin-top: 16px; }
.chat-card #chat-source { font-size: 11px; margin-top: 10px; }
.check-summary { padding: 16px; margin: 16px 0 20px; }
.check-summary-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.check-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; }
.check-item { padding: 12px 16px; display: flex; align-items: center; gap: 12px; }
.check-toggle { width: 28px; height: 28px; flex: 0 0 28px; border-radius: 50%; border: 2px solid var(--line); background: transparent; color: var(--on-accent); cursor: pointer; }
.check-toggle.done { border-color: var(--diaper); background: var(--diaper); }
.check-label { flex: 1; font-size: 14px; }
.check-label.done { text-decoration: line-through; color: var(--muted); }
.check-remove, .link-button { border: 0; background: none; color: var(--muted); cursor: pointer; font: inherit; }
.check-add { display: flex; gap: 8px; }
.check-add .btn-primary { width: auto; padding-inline: 20px; }
.growth-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.advice-answer { white-space: pre-line; line-height: 1.6; font-size: 14px; margin-top: 16px; }

/* dormIA V4 — panel premium y componentes globales */
textarea { width: 100%; min-height: 86px; resize: vertical; background: var(--surface-2); color: var(--text); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; font: inherit; }
.wrap { max-width: 1240px; padding-inline: clamp(16px, 3vw, 32px); }
nav.bottom-nav .inner { max-width: 720px; }
.eyebrow { color: var(--muted); font: 500 10px/1.4 "IBM Plex Mono", monospace; letter-spacing: .12em; }
.today-intro { margin: 0 0 26px; }
.today-intro p { color: var(--muted); margin-bottom: 4px; }
.today-intro strong { font: 400 clamp(20px, 2.5vw, 30px)/1.25 "Fraunces", serif; }
.today-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(320px, .85fr); gap: 24px; align-items: start; }
.today-primary, .today-sidebar { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.prediction-card { padding: clamp(20px, 3vw, 28px); background: radial-gradient(circle at 100% 0, rgba(143,168,214,.16), transparent 46%), var(--surface); }
.prediction-top, .section-title { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.prediction-card h2 { margin-top: 7px; font-size: clamp(27px, 4vw, 42px); font-weight: 500; }
.prediction-state { border: 1px solid var(--line); border-radius: 999px; padding: 7px 10px; font-size: 11px; white-space: nowrap; }
.state-ideal { color: var(--feed); border-color: rgba(217,167,107,.45); }
.state-past { color: var(--danger); }
.state-sleeping { color: var(--sleep); }
.prediction-copy { margin: 14px 0 8px; color: var(--muted); font-size: 14px; }
.prediction-meta { display: flex; flex-wrap: wrap; gap: 8px 18px; font: 11px "IBM Plex Mono", monospace; color: var(--sleep); }
.medical-note { color: var(--muted); font-size: 11px; line-height: 1.5; margin-top: 14px; }
.section-title { align-items: baseline; margin-bottom: 10px; }
.section-title h2 { font-size: 19px; font-weight: 500; }
.section-title a, .section-title > span { color: var(--muted); font-size: 11px; text-decoration: none; }
.primary-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.primary-actions button { min-height: 128px; display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-end; gap: 3px; padding: 18px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); color: var(--text); cursor: pointer; text-align: left; }
.primary-actions button:first-child { background: linear-gradient(145deg, rgba(143,168,214,.2), var(--surface)); }
.primary-actions button:nth-child(2) span { color: var(--feed); }.primary-actions button:nth-child(3) span { color: var(--diaper); }
.primary-actions button span { color: var(--sleep); font-size: 30px; }.primary-actions button strong { font-size: 16px; }.primary-actions button small { color: var(--muted); }
.primary-actions button:disabled { opacity: .45; cursor: default; }
.active-sleep { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-color: rgba(143,168,214,.4); }
.active-sleep strong,.active-sleep small { display: block; }.active-sleep strong { margin-top: 4px; font-size: 22px; }.active-sleep small { color: var(--muted); }
.active-sleep button { border: 0; border-radius: 12px; background: var(--sleep); color: var(--on-accent); padding: 12px 18px; font-weight: 600; }
.routine-card { padding: 10px 20px; }.routine-card ol { list-style: none; padding: 0; }.routine-card li { display: flex; gap: 16px; padding: 13px 0; border-bottom: 1px solid var(--line); font-size: 14px; }.routine-card li:last-child { border: 0; }.routine-card time { color: var(--sleep); font-family: "IBM Plex Mono"; min-width: 58px; }
.side-card { padding: 18px; }.summary-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }.summary-grid div { padding: 13px; background: var(--surface-2); border-radius: 12px; }.summary-grid strong,.summary-grid small { display: block; }.summary-grid strong { font: 18px "IBM Plex Mono"; }.summary-grid small { color: var(--muted); font-size: 10px; margin-top: 4px; }
.handoff-snapshot { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 14px 0; }.handoff-snapshot dt { color: var(--muted); font-size: 10px; }.handoff-snapshot dd { margin: 3px 0 0; font-size: 13px; }.handoff-latest { font-size: 12px; color: var(--muted); background: var(--surface-2); padding: 10px; border-radius: 10px; margin-bottom: 10px; }.handoff-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }.secondary-button { min-height: 44px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); color: var(--text); font-weight: 600; }
.night-summary { display: flex; align-items: baseline; gap: 10px; }.night-summary strong { font: 27px "Fraunces"; color: var(--sleep); }.night-summary span { color: var(--muted); font-size: 12px; }
.alert-settings label { display: flex; align-items: center; gap: 8px; padding: 7px 0; font-size: 13px; }.alert-settings input[type="checkbox"] { width: auto; }.alert-settings select { width: auto; margin-left: auto; padding: 6px 9px; font-size: 13px; }.alert-settings p { color: var(--muted); font-size: 10px; line-height: 1.4; margin-top: 8px; }
.stats-link { display: flex; justify-content: space-between; text-decoration: none; color: var(--text); }.stats-link span { color: var(--muted); font-size: 12px; }.empty-state,.load-error { padding: 22px; color: var(--muted); }.load-error { max-width: 480px; margin: 60px auto; }.load-error h2 { color: var(--text); margin-bottom: 8px; }.load-error .btn-primary { margin-top: 16px; }
.choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin: 16px 0; }.choice-grid.three { grid-template-columns: repeat(3,1fr); }.choice-grid button { border: 1px solid var(--line); border-radius: 14px; padding: 20px 8px; background: var(--surface-2); color: var(--text); font: inherit; }.choice-grid button.selected { background: var(--sleep); color: var(--on-accent); }.sheet-help { color: var(--muted); font-size: 13px; }

/* Asistente global */
.bot-toggle { position: fixed; right: max(20px, env(safe-area-inset-right)); bottom: 92px; z-index: 38; width: 54px; height: 54px; border: 1px solid rgba(143,168,214,.5); border-radius: 50%; background: var(--sleep); color: var(--on-accent); font-size: 22px; box-shadow: 0 12px 35px rgba(0,0,0,.35); }
.bot-panel { position: fixed; right: 24px; bottom: 24px; z-index: 70; width: min(410px, calc(100vw - 32px)); height: min(650px, calc(100vh - 48px)); display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 22px; background: var(--surface); box-shadow: 0 24px 70px rgba(0,0,0,.48); overflow: hidden; }
.bot-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 18px; border-bottom: 1px solid var(--line); }.bot-head p { color: var(--sleep); font-size: 11px; }.bot-head small { color: var(--muted); }.bot-head button { border: 0; background: none; color: var(--muted); font-size: 24px; }
.bot-messages { flex: 1; overflow-y: auto; padding: 16px; }.bot-empty { color: var(--muted); font-size: 13px; line-height: 1.5; }.bot-message { max-width: 88%; padding: 11px 13px; border-radius: 14px; margin-bottom: 8px; white-space: pre-line; line-height: 1.45; font-size: 13px; }.bot-message.user { margin-left: auto; background: var(--sleep); color: var(--on-accent); }.bot-message.assistant { background: var(--surface-2); }.bot-message.loading { opacity: .72; font-style: italic; }
.bot-prompts { display: flex; gap: 6px; padding: 0 16px 8px; }.bot-prompts button { border: 1px solid var(--line); border-radius: 999px; background: transparent; color: var(--muted); padding: 7px 9px; font-size: 10px; }.bot-compose { display: flex; gap: 7px; padding: 10px 16px; }.bot-compose button { flex: 0 0 44px; border: 0; border-radius: 12px; background: var(--sleep); }.bot-disclaimer { padding: 0 16px 12px; color: var(--muted); font-size: 9px; }

/* Legal, onboarding y documentos */
.legal-wrap { max-width: 820px; margin: 0 auto; padding: 32px 20px 80px; }.legal-brand { color: var(--sleep); text-decoration: none; font: 24px "Fraunces"; }.legal-doc { margin-top: 28px; padding: clamp(20px,4vw,42px); }.legal-doc h1 { font: 500 clamp(30px,5vw,48px) "Fraunces"; }.legal-doc h2 { font: 500 22px "Fraunces"; margin: 28px 0 8px; }.legal-doc p,.legal-doc li { color: var(--muted); line-height: 1.7; font-size: 14px; }.legal-doc a { color: var(--sleep); }.legal-placeholder { color: var(--feed)!important; border-left: 3px solid var(--feed); padding-left: 12px; }
.consent-box { display: grid; gap: 12px; margin: 22px 0; }.consent-box label { display: flex; gap: 10px; align-items: flex-start; color: var(--muted); line-height: 1.45; }.consent-box input { width: auto; margin-top: 4px; }

.today-hero { margin: 2px 0 24px; max-width: 850px; }
.today-hero h2 { font-size: clamp(24px, 3vw, 36px); line-height: 1.24; font-weight: 450; margin-top: 7px; }
.primary-actions.four { grid-template-columns: repeat(4, 1fr); }
.primary-actions.four button:last-child { background: linear-gradient(145deg, rgba(183,159,214,.15), var(--surface)); }
.active-sleep-actions { display: flex; gap: 8px; }
.active-sleep-actions button { min-height: 44px; }
.active-sleep-actions .secondary-button { color: var(--text); padding: 10px 13px; }
.timeline-time { flex: 0 0 64px; color: var(--text); font: 600 14px "IBM Plex Mono", monospace; }
.timeline-item p.title { font-size: 15px; }
.timeline-item p.sub { font-size: 13px; margin-top: 3px; }
.empty-state { display: grid; gap: 7px; line-height: 1.5; }
.empty-state strong { color: var(--text); font-size: 15px; }
.compact-empty { color: var(--muted); font-size: 13px; line-height: 1.5; padding: 8px 0; }
.upcoming-list { list-style: none; padding: 0; display: grid; gap: 8px; }
.upcoming-list li { display: grid; grid-template-columns: 96px 1fr; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.upcoming-list li:last-child { border-bottom: 0; }
.upcoming-list time { color: var(--sleep); font: 12px "IBM Plex Mono", monospace; }
.more-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 14px 0 2px; }
.more-actions button, .more-actions a { min-height: 84px; display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-end; gap: 5px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-2); color: var(--text); font: 600 14px inherit; text-decoration: none; }
.more-actions span { color: var(--sleep); font-size: 22px; }
.sheet label { display: grid; gap: 6px; margin: 12px 0; color: var(--muted); font-size: 13px; }
.sheet .inline-check { display: flex; align-items: center; gap: 9px; color: var(--text); }
.sheet .inline-check input { width: auto; }
.bot-toggle { width: auto; min-width: 126px; height: 52px; border-radius: 999px; display: flex; align-items: center; justify-content: center; gap: 7px; padding: 0 16px; font-size: 16px; }
.bot-toggle strong { font-size: 13px; }
.bot-prompts { overflow-x: auto; scrollbar-width: thin; }
.bot-prompts button { flex: 0 0 auto; font-size: 11px; min-height: 36px; }
.medical-note, .bot-disclaimer, .alert-settings p { font-size: 12px; }
.summary-grid small, .handoff-snapshot dt { font-size: 11px; line-height: 1.35; }
.alerts-hero { max-width: 720px; margin-bottom: 24px; }
.alerts-hero h2 { font-size: clamp(28px, 4vw, 42px); margin: 6px 0 9px; }
.alerts-hero > p:last-child { color: var(--muted); line-height: 1.6; font-size: 14px; }
.push-card { margin-bottom: 28px; }
.push-status, .push-status > div, .push-actions { display: flex; align-items: center; gap: 12px; }
.push-status { justify-content: space-between; margin-bottom: 18px; }
.push-status p { color: var(--muted); font-size: 12px; margin-top: 3px; }
.status-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--muted); flex: 0 0 auto; }
.status-dot.success { background: var(--diaper); box-shadow: 0 0 0 5px rgba(127,191,160,.12); }
.status-dot.danger { background: var(--danger); }.status-dot.warning { background: var(--feed); }
.level-badge, .event-tag { border: 1px solid var(--line); border-radius: 999px; color: var(--sleep); padding: 6px 9px; font: 10px "IBM Plex Mono", monospace; }
.config-notice { border-left: 3px solid var(--feed); background: var(--surface-2); padding: 12px; margin: 12px 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.push-actions .btn-primary { width: auto; }.push-actions .secondary-button { min-height: 46px; padding: 0 16px; }
#push-message { margin-top: 12px; min-height: 18px; font-size: 12px; }
.preference-list { display: grid; gap: 9px; }
.preference-row { display: grid; grid-template-columns: minmax(180px,1fr) auto 180px; align-items: center; gap: 18px; padding: 16px 18px; }
.preference-row strong, .preference-row small { display: block; }.preference-row small { color: var(--muted); margin-top: 4px; font-size: 11px; }
.switch-label { display: flex; align-items: center; gap: 7px; font-size: 12px; }.switch-label input { width: auto; }
.lead-label { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 11px; }.lead-label select { padding: 8px; font-size: 12px; }
.preferences-save { margin: 12px 0 30px; max-width: 260px; }
.reminder-form { margin: 24px 0 30px; }.reminder-form h2 { font-size: 25px; margin: 6px 0 16px; }
.reminder-form label { display: grid; gap: 6px; margin: 10px 0; color: var(--muted); font-size: 12px; }
.form-grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: 10px; }
.reminder-list { display: grid; gap: 9px; }
.reminder-item { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 18px; }
.reminder-item > div { display: grid; gap: 5px; }.reminder-item strong { font-size: 14px; }.reminder-item small { color: var(--muted); font-size: 12px; }
.reminder-item button { border: 0; background: none; color: var(--danger); padding: 10px; }
.sr-only { position: absolute!important; width: 1px!important; height: 1px!important; padding: 0!important; margin: -1px!important; overflow: hidden!important; clip: rect(0,0,0,0)!important; white-space: nowrap!important; border: 0!important; }
.login-shell { width: 100%; max-width: 440px; }
.login-brand { text-align: center; margin-bottom: 26px; }.login-mark { display: inline-flex; align-items: center; justify-content: center; width: 72px; height: 72px; border-radius: 50%; color: var(--sleep); font-size: 34px; margin-bottom: 12px; }
.login-brand h1 { font-size: 38px; font-weight: 500; }.login-brand h1 span { color: var(--sleep); }.login-brand p { color: var(--muted); font-size: 13px; margin-top: 4px; }
.google-area { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; margin-top: 16px; color: var(--muted); font-size: 11px; }
.google-area::before,.google-area::after { content: ""; height: 1px; background: var(--line); }
.google-button { grid-column: 1 / -1; min-height: 48px; display: flex; align-items: center; justify-content: center; gap: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--text); text-decoration: none; font-size: 14px; }
.google-button strong { color: #4285f4; font-size: 20px; }
.login-links { text-align: center; color: var(--muted); font-size: 11px; margin-top: 20px; }.login-links a { color: inherit; }
.field-label { color: var(--muted); font-size: 12px; display: grid; gap: 6px; }
.onboarding-summary { padding: 16px; background: var(--surface-2); }.onboarding-summary p { font-size: 24px; }.onboarding-summary span { display: block; color: var(--muted); font-size: 12px; line-height: 1.5; margin-top: 4px; }
#google-onboarding h2 { font-size: 28px; } #google-onboarding > p { font-size: 13px; line-height: 1.5; }
.stats-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 22px; }
.stats-toolbar .tabs { margin: 0; width: 220px; }.stats-toolbar > div:last-child { display: flex; gap: 7px; }.stats-toolbar .chip { font-size: 12px; }
.stats-title { font-size: 29px; margin: 7px 0; }.stats-copy { font-size: 13px; line-height: 1.65; }
.stats-summary { margin-top: 18px; grid-template-columns: repeat(3,1fr); }
.stats-section { margin-top: 24px; }
.trend-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 10px; }
.trend-grid article { padding: 16px; min-height: 132px; display: flex; flex-direction: column; justify-content: space-between; gap: 8px; }
.trend-grid small,.trend-grid span { color: var(--muted); font-size: 11px; line-height: 1.35; }.trend-grid strong { font: 22px "Fraunces"; color: var(--sleep); }
.growth-value { margin-top: 10px; font-size: 18px; }
.routine-settings-grid { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 10px; }
.routine-settings-grid label,.routine-settings-grid input { min-width: 0; }

@media (max-width: 880px) { .today-grid { grid-template-columns: 1fr; }.today-sidebar { display: grid; grid-template-columns: 1fr 1fr; }.handoff-card { grid-row: span 2; } .primary-actions.four { grid-template-columns: repeat(2,1fr); } }
@media (max-width: 600px) {
  .wrap { padding-inline: 14px; }
  header.app-header h1 { font-size: 27px; }
  .today-sidebar { display: flex; }
  .primary-actions { gap: 9px; }
  .primary-actions button { min-height: 112px; padding: 14px; }
  .primary-actions button span { font-size: 25px; }
  .primary-actions button small { font-size: 11px; line-height: 1.3; }
  .prediction-top { flex-direction: column; }
  .prediction-card h2 { font-size: 28px; }
  .prediction-copy { font-size: 14px; line-height: 1.45; }
  .bot-panel { right: 3%; bottom: max(8px, env(safe-area-inset-bottom)); width: 94%; height: min(82vh, 650px); }
  .bot-toggle { right: 14px; bottom: 90px; width: 56px; min-width: 56px; height: 56px; padding: 0; border-radius: 50%; flex-direction: column; gap: 0; }
  .bot-toggle strong { display: none; }
  .bot-toggle::after { content: "IA"; font-size: 10px; font-weight: 700; line-height: 1; }
  .handoff-actions, .active-sleep-actions { grid-template-columns: 1fr; flex-direction: column; }
  .active-sleep { align-items: flex-start; gap: 14px; }
  .timeline-item { gap: 9px; padding: 13px 11px; }
  .timeline-time { flex-basis: 58px; font-size: 13px; }
  .timeline-item .badge { width: 32px; height: 32px; }
  .entry-actions { flex-direction: column; }
  nav.bottom-nav a { font-size: 10px; min-width: 0; padding-inline: 3px; }
  nav.bottom-nav a .ico { font-size: 19px; }
  .push-status, .push-actions { align-items: stretch; flex-direction: column; }
  .push-status .level-badge { align-self: flex-start; }
  .push-actions .btn-primary { width: 100%; }
  .preference-row { grid-template-columns: 1fr auto; gap: 10px; }
  .preference-row .lead-label { grid-column: 1 / -1; }
  .form-grid { grid-template-columns: 1fr; }
  .reminder-item { align-items: flex-start; }
  .stats-toolbar { align-items: stretch; flex-direction: column; }
  .stats-toolbar .tabs { width: 100%; }
  .stats-toolbar > div:last-child { display: grid; grid-template-columns: 1fr 1fr; }
  .stats-summary { grid-template-columns: 1fr 1fr; }
  .trend-grid { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 1200px) { .bot-panel { right: 28px; top: 88px; bottom: auto; height: calc(100vh - 118px); } }
@media print { nav.bottom-nav,.app-header,.bot-toggle,.bot-panel,.print-hide { display:none!important; }.wrap { max-width:none; }.card { break-inside:avoid; border-color:#ccc; }.today-grid { grid-template-columns:1fr; } }
