/* =====================================================================
   Nanita · sistema visual "cielo"
   Un cielo que cambia con el estado del bebé + un reloj de 24 h.
   ===================================================================== */
:root {
  --bg: #f3f5fb;
  --surface: #ffffff;
  --ink: #1f1d47;
  --ink-2: #625f8c;
  --line: #e4e7f3;
  --brand: #5b4fd6;
  --brand-ink: #ffffff;
  --c-night: #3b3486;
  --c-nap: #9c8af2;
  --c-feed: #ff9f6e;
  --c-solids: #f2b93b;
  --c-diaper: #43bfa3;
  --c-pump: #e58bb5;
  --c-med: #5f9ff0;
  --c-growth: #7fbf5c;
  --c-note: #9a93c4;
  --good: #1f9d6f;
  --warn: #d7772a;
  --err: #d64545;
  --shadow: 0 1px 2px rgba(40, 36, 110, 0.05), 0 8px 24px rgba(40, 36, 110, 0.07);
  /* cielo */
  --sky-ink: #1f1d47;
  --sky-ink-2: #4c4a7a;
  --sky-awake: radial-gradient(120% 70% at 88% -10%, #ffe9bf 0%, rgba(255, 233, 191, 0) 55%), linear-gradient(180deg, #bcdcf8 0%, #dcebfb 70%, #e9f1fc 100%);
  --sky-nap: radial-gradient(120% 70% at 12% -10%, #f6e6ff 0%, rgba(246, 230, 255, 0) 55%), linear-gradient(180deg, #c3b5f8 0%, #ddd5fc 70%, #e8e3fd 100%);
  --sky-night: linear-gradient(180deg, #17154a 0%, #27236c 60%, #352f83 100%);
  --dial-track: rgba(255, 255, 255, 0.7);
  --dial-band: rgba(59, 52, 134, 0.13);
  --dial-tick: rgba(31, 29, 71, 0.28);
  --font-display: 'Fredoka', ui-rounded, 'SF Pro Rounded', system-ui, sans-serif;
  --font-body: 'Figtree', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: light;
}

:root[data-theme='dark'] {
  --bg: #15133a;
  --surface: #211e4e;
  --ink: #eeecff;
  --ink-2: #a8a5d6;
  --line: #2f2b63;
  --brand: #8c7dff;
  --brand-ink: #15133a;
  --c-night: #6f62f0;
  --c-nap: #b3a6ff;
  --shadow: none;
  --sky-ink: #eeecff;
  --sky-ink-2: #c3c0ee;
  --sky-awake: radial-gradient(120% 70% at 88% -10%, rgba(255, 210, 150, 0.25) 0%, rgba(255, 210, 150, 0) 55%), linear-gradient(180deg, #2c3a7c 0%, #262a66 100%);
  --sky-nap: linear-gradient(180deg, #3d3088 0%, #2c2669 100%);
  --sky-night: linear-gradient(180deg, #0e0c30 0%, #1b1850 100%);
  --dial-track: rgba(255, 255, 255, 0.1);
  --dial-band: rgba(255, 255, 255, 0.06);
  --dial-tick: rgba(255, 255, 255, 0.3);
  color-scheme: dark;
}

/* Nocturna: rojos tenues para las tomas de madrugada */
:root[data-theme='night'] {
  --bg: #000;
  --surface: #120403;
  --ink: #ff7a6b;
  --ink-2: #a3483d;
  --line: #2a0c09;
  --brand: #c43d2f;
  --brand-ink: #000;
  --c-night: #8f2b20; --c-nap: #c64a3b; --c-feed: #b5542c; --c-solids: #9a4a1e; --c-diaper: #7d3a2a;
  --c-pump: #8a3040; --c-med: #7a3030; --c-growth: #7a4a20; --c-note: #6a3a35;
  --good: #c46a3b; --warn: #ff7a6b;
  --shadow: none;
  --sky-ink: #ff7a6b; --sky-ink-2: #a3483d;
  --sky-awake: linear-gradient(180deg, #1a0503 0%, #0a0201 100%);
  --sky-nap: linear-gradient(180deg, #1a0503 0%, #0a0201 100%);
  --sky-night: linear-gradient(180deg, #1a0503 0%, #0a0201 100%);
  --dial-track: rgba(255, 90, 70, 0.1); --dial-band: rgba(255, 90, 70, 0.06); --dial-tick: rgba(255, 90, 70, 0.3);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body {
  font: 16px/1.45 var(--font-body);
  padding-bottom: calc(84px + env(safe-area-inset-bottom));
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
body:has(.player.show) { padding-bottom: calc(150px + env(safe-area-inset-bottom)); }
#main { max-width: 560px; margin: 0 auto; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; margin: 0; letter-spacing: -0.01em; }
h1 { font-size: 1.75rem; line-height: 1.1; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1rem; margin: 16px 0 8px; }
b { font-weight: 700; }
small { font-size: 0.8rem; }
.muted { color: var(--ink-2); }
.small { font-size: 0.875rem; }
.lead { margin: -4px 0 18px; }
.center { text-align: center; }
.err { color: var(--err); }
.grow { flex: 1; min-width: 0; }
.row { display: flex; align-items: center; }
.row.between { justify-content: space-between; }
.row.gap { gap: 8px; }
.row.wrap { flex-wrap: wrap; }
.mt { margin-top: 10px; }
.code { font-family: var(--font-display); letter-spacing: 0.12em; }
.ico { display: block; flex-shrink: 0; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 55%, transparent); outline-offset: 2px; border-radius: 10px; }

/* ---------- Botones ---------- */
.btn {
  appearance: none; border: 1.5px solid var(--line); background: var(--surface); color: var(--ink);
  font: 600 0.95rem var(--font-body); padding: 10px 16px; border-radius: 999px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px;
}
.btn.primary { background: var(--brand); color: var(--brand-ink); border-color: transparent; }
.btn.big { min-height: 56px; font-size: 1.05rem; }
.btn.round { width: 48px; padding: 0; }
.btn.link { border: 0; background: none; color: inherit; opacity: 0.8; min-height: 40px; text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.btn.danger { color: var(--err); }
.btn.solid-danger { background: var(--err); color: #fff; border-color: transparent; }
.btn.solid-danger:disabled { opacity: 0.35; }
.danger-zone { border: 1.5px dashed color-mix(in srgb, var(--err) 45%, transparent); }
.wipe-opt + .wipe-opt { border-top: 1px solid var(--line); margin-top: 14px; padding-top: 14px; }
.wipe-opt h3 { margin: 0 0 4px; font-size: 1rem; }
.wipe-opt .btn { margin-top: 8px; }
.notice { margin: 12px 16px 0; padding: 12px 14px; border-radius: 14px; background: var(--surface); border: 1.5px solid var(--line); font-weight: 600; }
.wipe input[name=confirm] { font: 600 1.1rem var(--font-body); letter-spacing: 0.15em; text-align: center; }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.6; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; justify-content: center; }
.chips.left { justify-content: flex-start; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; justify-content: flex-start; margin: 0 -16px 6px; padding: 2px 16px 8px; scrollbar-width: none; }
.chips > span { font-size: 0.85rem; opacity: 0.8; margin-right: 2px; }
.chip {
  border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); font: 500 0.875rem var(--font-body);
  padding: 7px 14px; border-radius: 999px; cursor: pointer; white-space: nowrap;
}
.chip.on { background: var(--ink); color: var(--bg); border-color: transparent; }

.badge {
  border: 0; font: 600 0.8rem var(--font-body); padding: 7px 12px; border-radius: 999px; cursor: pointer;
  background: rgba(255, 255, 255, 0.55); color: var(--sky-ink); display: inline-flex; align-items: center; gap: 6px;
  backdrop-filter: blur(6px);
}
.badge.ok .ico { color: var(--good); }
.badge.err { color: var(--err); }
.badge.busy .ico { animation: spin 1.2s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Cielo (cabecera de Inicio) ---------- */
.sky {
  position: relative; overflow: hidden; color: var(--sky-ink);
  padding: calc(14px + env(safe-area-inset-top)) 16px 22px;
  border-radius: 0 0 36px 36px;
  background: var(--sky-awake);
}
.sky-nap { background: var(--sky-nap); }
.sky-night { background: var(--sky-night); --sky-ink: #f1efff; --sky-ink-2: #c3c0ee; --dial-track: rgba(255, 255, 255, 0.1); --dial-band: rgba(255, 255, 255, 0.07); --dial-tick: rgba(255, 255, 255, 0.35); --c-night: #8c7dff; }
:root[data-theme='night'] .sky-night { --sky-ink: #ff7a6b; --c-night: #8f2b20; }
.sky-night .badge { background: rgba(255, 255, 255, 0.12); }
.sky-decor { position: absolute; inset: 0 0 auto 0; width: 100%; height: 60%; pointer-events: none; }
.sky-decor .star { fill: #fff; animation: twinkle 4s ease-in-out infinite; }
.sky-decor .cloud { fill: rgba(255, 255, 255, 0.75); }
.sky-decor .cloud.c2 { fill: rgba(255, 255, 255, 0.55); }
:root[data-theme='dark'] .sky-decor .cloud, :root[data-theme='night'] .sky-decor .cloud { fill: rgba(255, 255, 255, 0.06); }
@keyframes twinkle { 50% { opacity: 0.25; } }
.sky .top { position: relative; display: flex; justify-content: space-between; align-items: flex-start; }
.sky .age { color: var(--sky-ink-2); font-weight: 500; }

/* Reloj */
.dial-wrap { position: relative; width: min(100%, 330px); margin: 4px auto 0; aspect-ratio: 1; }
.dial { width: 100%; height: 100%; display: block; overflow: visible; }
.dial-track { stroke: var(--dial-track); }
.dial-nightband { stroke: var(--dial-band); }
.dial-tick { stroke: var(--dial-tick); stroke-width: 1.5; stroke-linecap: round; }
.dial-tick.major { stroke-width: 2.2; }
.dial-hour { fill: var(--sky-ink-2); font: 600 12px var(--font-display); }
.dial-nap { stroke: var(--c-nap); }
.dial-night { stroke: var(--c-night); }
.dial-pred { stroke: var(--c-nap); stroke-opacity: 0.6; stroke-dasharray: 2 6; stroke-linecap: round; }
.dial-range { stroke: var(--brand); stroke-opacity: 0.35; stroke-width: 4; stroke-linecap: round; }
.sky-night .dial-range { stroke: #fff; }
.dial-bed { fill: var(--c-night); stroke: var(--surface); stroke-width: 2.5; }
.dial-bed-ico { fill: #ffe7a8; }
.dial-feed { fill: var(--c-feed); }
.dial-now { fill: #fff; stroke: var(--brand); stroke-width: 4; }
.sky-night .dial-now { stroke: #ffe7a8; }
.dial-now-halo { fill: var(--brand); opacity: 0.18; transform-box: fill-box; transform-origin: center; animation: halo 2.6s ease-in-out infinite; }
@keyframes halo { 50% { transform: scale(1.35); opacity: 0.06; } }
.dial-center {
  position: absolute; inset: 22%; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; gap: 2px;
}
.dc-label { font-size: 0.85rem; color: var(--sky-ink-2); font-weight: 500; line-height: 1.2; }
.dc-timer { font: 500 2.9rem/1 var(--font-display); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; margin: 2px 0 6px; }
.dc-next { font-size: 0.95rem; }
.dc-next b { font-family: var(--font-display); font-size: 1.15rem; font-weight: 600; }
.dc-in { font-size: 0.8rem; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: rgba(255, 255, 255, 0.6); margin-top: 4px; }
.sky-night .dc-in { background: rgba(255, 255, 255, 0.12); }
.dc-small { font-size: 0.9rem; color: var(--sky-ink-2); }
.dc-small b { color: var(--sky-ink); font-family: var(--font-display); font-size: 1.1rem; }

.hero-cta { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; margin-top: 6px; }
.hero-cta .chips { margin-bottom: 4px; }
.hero-cta .chip { background: rgba(255, 255, 255, 0.55); border-color: transparent; color: var(--sky-ink); }
.sky-night .hero-cta .chip { background: rgba(255, 255, 255, 0.12); }
.btn.cta {
  width: 100%; max-width: 360px; min-height: 60px; font: 600 1.15rem var(--font-display); letter-spacing: 0.01em;
  background: var(--ink); color: var(--bg); border: 0; box-shadow: 0 10px 24px rgba(31, 29, 71, 0.22);
}
.sky-night .btn.cta { background: #ffe7a8; color: #1d1a52; box-shadow: 0 10px 30px rgba(255, 231, 168, 0.18); }
:root[data-theme='night'] .btn.cta { background: var(--brand); color: #000; }
.hero-cta .btn.link { color: var(--sky-ink); font-size: 0.9rem; }

/* ---------- Contenido ---------- */
.content { padding: 16px; }
.content.page { padding-top: calc(18px + env(safe-area-inset-top)); }
.page-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 16px; }
.content > h2 { margin: 22px 4px 10px; }

.panel { background: var(--surface); border-radius: 24px; padding: 18px; margin-bottom: 14px; box-shadow: var(--shadow); }
.panel h2 { margin-bottom: 10px; }
.panel > h2:only-child { margin: 0; }

.hint {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 18px; margin-bottom: 14px;
  background: color-mix(in srgb, var(--brand) 10%, var(--surface)); font-size: 0.9rem;
}
.hint .ico { margin-top: 1px; color: var(--brand); }
.hint.good { background: color-mix(in srgb, var(--good) 12%, var(--surface)); }
.hint.good .ico { color: var(--good); }
.hint.warn { background: color-mix(in srgb, var(--warn) 13%, var(--surface)); }
.hint.warn .ico { color: var(--warn); }

/* Última toma */
.lastfeed { display: flex; align-items: center; gap: 12px; padding: 14px 16px; }
.lastfeed b { display: block; font-weight: 600; }
.lastfeed small { display: block; }
.lf-ico, .action-ico {
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; flex-shrink: 0;
  background: color-mix(in srgb, var(--cat) 20%, var(--surface)); color: color-mix(in srgb, var(--cat) 75%, var(--ink));
}
.lf-next { text-align: right; flex-shrink: 0; }
.lf-next small { display: block; color: var(--ink-2); }
.lf-next b { font-family: var(--font-display); font-weight: 600; font-size: 1.05rem; text-transform: capitalize; }

/* Accesos rápidos */
.actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px 6px; margin: 6px 0 20px; }
.action {
  border: 0; background: none; color: var(--ink); font: 500 0.78rem var(--font-body); cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 0;
}
.action .action-ico { width: 60px; height: 60px; border-radius: 22px; transition: transform 0.15s; }
.action:active .action-ico { transform: scale(0.92); }

/* Hoy */
.today h2 { margin: 0 4px 10px; }
.today { margin-bottom: 14px; }
.today-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 14px; }
.today-grid > div {
  background: var(--surface); border-radius: 20px; padding: 12px 6px 10px; text-align: center; box-shadow: var(--shadow);
  display: flex; flex-direction: column; align-items: center;
}
.today-grid span { color: color-mix(in srgb, var(--cat) 80%, var(--ink)); margin-bottom: 4px; }
.today-grid b { font: 600 1.25rem/1.1 var(--font-display); }
.today-grid small { color: var(--ink-2); font-size: 0.72rem; line-height: 1.2; margin-top: 2px; }

/* Plan del día */
.plan { list-style: none; margin: 6px 0 0; padding: 0; position: relative; }
.plan li { display: grid; grid-template-columns: 52px 18px 1fr; align-items: start; gap: 8px; padding: 8px 0; position: relative; }
.plan li::before { content: ''; position: absolute; left: 60px; top: 24px; bottom: -8px; width: 2px; background: var(--line); }
.plan li:last-child::before { display: none; }
.plan time { font: 600 1rem var(--font-display); font-variant-numeric: tabular-nums; }
.plan .dot { width: 14px; height: 14px; border-radius: 50%; margin-top: 4px; background: var(--c-nap); box-shadow: 0 0 0 4px color-mix(in srgb, var(--c-nap) 22%, var(--surface)); position: relative; z-index: 1; }
.plan .pl-night .dot { background: var(--c-night); box-shadow: 0 0 0 4px color-mix(in srgb, var(--c-night) 18%, var(--surface)); }
.plan .pl-cur .dot { animation: halo-dot 2s ease-in-out infinite; }
@keyframes halo-dot { 50% { box-shadow: 0 0 0 8px color-mix(in srgb, var(--c-nap) 10%, var(--surface)); } }
.plan b { display: block; font-weight: 600; }
.plan small { color: var(--ink-2); }

/* Explicación */
.explain summary { cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.explain summary::-webkit-details-marker { display: none; }
.explain summary b { display: block; font-family: var(--font-display); font-weight: 600; font-size: 1.1rem; }
.explain summary small { color: var(--ink-2); }
.explain ul { padding-left: 18px; margin: 14px 0 0; }
.explain li { margin-bottom: 8px; }
.conf { display: flex; gap: 3px; align-items: flex-end; }
.conf i { width: 6px; border-radius: 3px; background: var(--line); }
.conf i:nth-child(1) { height: 8px; } .conf i:nth-child(2) { height: 13px; } .conf i:nth-child(3) { height: 18px; }
.conf-baja i:nth-child(1), .conf-media i:nth-child(-n + 2), .conf-alta i { background: var(--good); }
.conf-baja i:nth-child(1) { background: var(--warn); }

/* Toma en curso */
.feed-live { box-shadow: 0 0 0 2px var(--cat), var(--shadow); }
.sides { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0; }
.side {
  border: 2px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 20px; padding: 14px 8px;
  font: 500 1.6rem var(--font-display); display: flex; flex-direction: column; align-items: center; cursor: pointer;
  font-variant-numeric: tabular-nums;
}
.side small { font: 600 0.8rem var(--font-body); color: var(--ink-2); }
.side.on { border-color: var(--c-feed); background: color-mix(in srgb, var(--c-feed) 13%, var(--surface)); }

/* ---------- Diario ---------- */
.day { margin: 20px 4px 8px; font-size: 1.05rem; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 46px 30px 1fr; gap: 8px; align-items: start; padding: 6px 0; cursor: pointer; position: relative; }
.timeline li::before { content: ''; position: absolute; left: 68px; top: 34px; bottom: -6px; width: 2px; background: var(--line); }
.timeline li:last-child::before { display: none; }
.timeline time { font: 600 0.95rem var(--font-display); font-variant-numeric: tabular-nums; padding-top: 5px; color: var(--ink-2); }
.tl-node {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; position: relative; z-index: 1;
  background: color-mix(in srgb, var(--cat) 22%, var(--surface)); color: color-mix(in srgb, var(--cat) 75%, var(--ink));
}
.tl-body { background: var(--surface); border-radius: 16px; padding: 9px 12px; box-shadow: var(--shadow); min-width: 0; }
.tl-body b { display: block; font-weight: 600; }
.tl-body small { display: block; color: var(--ink-2); }
.tl-bar { display: block; height: 4px; border-radius: 2px; background: var(--cat); margin-top: 6px; opacity: 0.8; }
.timeline.compact li { grid-template-columns: 90px 30px 1fr; }
.timeline.compact li::before { left: 112px; }
.tl-body { position: relative; }
.by { position: absolute; top: 9px; right: 12px; font-size: 0.7rem; color: var(--ink-2); }
.tl-body:has(.by) b { padding-right: 44px; }
.empty { text-align: center; color: var(--ink-2); padding: 40px 20px; display: grid; justify-items: center; gap: 6px; }

/* ---------- Sonidos ---------- */
.songs { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.song {
  border: 0; padding: 0; background: var(--surface); color: var(--ink); border-radius: 22px; overflow: hidden; cursor: pointer;
  text-align: left; box-shadow: var(--shadow); position: relative; display: flex; flex-direction: column; font: inherit;
}
.song-cover {
  aspect-ratio: 1.35; display: grid; place-items: center; color: rgba(255, 255, 255, 0.92); position: relative;
  background: radial-gradient(90% 90% at 20% 10%, rgba(255, 255, 255, 0.35), transparent 60%), linear-gradient(150deg, var(--c1), var(--c2));
}
.song-cover .pl-eq { position: absolute; left: 12px; bottom: 10px; }
.song-text { padding: 10px 12px 12px; padding-right: 44px; }
.song-text b { display: block; font: 600 1rem/1.2 var(--font-display); }
.song-text small { color: var(--ink-2); }
.song-play {
  position: absolute; right: 10px; bottom: 12px; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  background: var(--ink); color: var(--bg);
}
.song.on { box-shadow: 0 0 0 3px var(--c2), var(--shadow); }
.song.on .song-play { background: var(--c2); color: #fff; }
.noises { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px; }
.noise {
  border: 0; background: var(--surface); color: var(--ink); border-radius: 20px; padding: 14px 6px 12px; cursor: pointer;
  font: 500 0.82rem var(--font-body); display: flex; flex-direction: column; align-items: center; gap: 8px; box-shadow: var(--shadow);
}
.noise span { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; background: color-mix(in srgb, var(--cat) 25%, var(--surface)); color: color-mix(in srgb, var(--cat) 70%, var(--ink)); }
.noise.on { background: color-mix(in srgb, var(--cat) 22%, var(--surface)); box-shadow: 0 0 0 2px var(--cat); }
.noise.on span { background: var(--cat); color: #fff; animation: breathe 3s ease-in-out infinite; }
@keyframes breathe { 50% { transform: scale(0.9); } }
.slider { display: grid; grid-template-columns: 24px 56px 1fr; align-items: center; gap: 8px; margin: 4px 0 8px; font-weight: 600; font-size: 0.9rem; }
.slider-block { display: grid; gap: 8px; font-size: 0.9rem; }
.pl-eq { display: inline-flex; gap: 2px; align-items: flex-end; height: 14px; }
.pl-eq i { width: 3px; background: currentColor; border-radius: 2px; animation: eq 1s ease-in-out infinite; }
.pl-eq i:nth-child(2) { animation-delay: -0.3s; } .pl-eq i:nth-child(3) { animation-delay: -0.6s; }
@keyframes eq { 0%, 100% { height: 4px; } 50% { height: 14px; } }

/* Mini reproductor */
.player {
  position: fixed; left: 12px; right: 12px; bottom: calc(76px + env(safe-area-inset-bottom)); z-index: 41; max-width: 536px; margin: 0 auto;
  display: none; align-items: center; gap: 8px; padding: 8px 8px 8px 14px; border-radius: 20px;
  background: var(--ink); color: var(--bg); box-shadow: 0 10px 30px rgba(20, 18, 60, 0.3);
}
.player.show { display: flex; animation: up 0.25s ease-out; }
.pl-main { flex: 1; min-width: 0; border: 0; background: none; color: inherit; display: flex; align-items: center; gap: 12px; text-align: left; cursor: pointer; font: inherit; padding: 0; }
.pl-text { min-width: 0; }
.pl-text b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.pl-text small { opacity: 0.7; }
.pl-stop { border: 0; width: 42px; height: 42px; border-radius: 50%; background: rgba(255, 255, 255, 0.14); color: inherit; display: grid; place-items: center; cursor: pointer; }

/* ---------- Gráficas ---------- */
.chart { width: 100%; height: auto; display: block; margin-top: 8px; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis { fill: var(--ink-2); font: 500 9px var(--font-body); }
.chart .val { fill: var(--ink); font: 600 9px var(--font-body); }
.chart .row { fill: var(--bg); }
.chart .bar-night { fill: var(--c-night); }
.chart .bar-nap { fill: var(--c-nap); }
.chart .dot-feed { fill: var(--c-feed); }
.chart .now { stroke: var(--err); stroke-width: 1.5; }
.legend { display: flex; gap: 6px; align-items: center; color: var(--ink-2); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-left: 6px; }
.legend i:first-child { margin-left: 0; }
.legend i.round { border-radius: 50%; }
.accbars { display: grid; gap: 10px; margin-top: 10px; }
.accbars div { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center; font-size: 0.875rem; }
.accbars i { grid-column: 1 / -1; grid-row: 2; height: 10px; border-radius: 5px; background: var(--line); }
.accbars i.best { background: var(--good); }
.accbars b { grid-row: 1; grid-column: 2; }

/* ---------- Formularios ---------- */
.form label { display: flex; flex-direction: column; gap: 6px; font-size: 0.875rem; font-weight: 600; margin-bottom: 14px; }
.form label small { font-weight: 400; color: var(--ink-2); }
input, select, textarea {
  font: 400 1rem var(--font-body); color: var(--ink); background: var(--bg); border: 1.5px solid transparent;
  border-radius: 14px; padding: 12px 14px; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); }
input[type='range'] { padding: 0; accent-color: var(--brand); background: transparent; border: 0; }
.row input { flex: 1; }
.toggles { display: flex; gap: 10px; margin-bottom: 14px; }
.toggle { flex: 1; margin: 0 !important; }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle span { display: block; text-align: center; padding: 16px; border-radius: 18px; border: 2px solid var(--line); font: 600 1rem var(--font-display); cursor: pointer; }
.toggle input:checked + span { border-color: var(--c-diaper); background: color-mix(in srgb, var(--c-diaper) 14%, var(--surface)); }
.toggle input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--brand) 55%, transparent); }

/* ---------- Hoja inferior ---------- */
.sheet { position: fixed; inset: 0; z-index: 50; display: none; }
.sheet.open { display: block; }
.sheet-bg { position: absolute; inset: 0; background: rgba(15, 12, 50, 0.42); animation: fade 0.2s; }
.sheet-body {
  position: absolute; left: 0; right: 0; bottom: 0; max-height: 92vh; overflow: auto; background: var(--surface);
  border-radius: 28px 28px 0 0; padding: 10px 18px calc(20px + env(safe-area-inset-bottom));
  max-width: 560px; margin: 0 auto; animation: up 0.24s ease-out;
}
.grabber { display: block; width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 14px; }
.sheet-body > h2 { margin-bottom: 18px; }
.sheet-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.sheet-head .action-ico { width: 48px; height: 48px; border-radius: 16px; }
.sheet-foot { margin-top: 10px; }
@keyframes up { from { transform: translateY(30px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }

/* ---------- Navegación ---------- */
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; display: flex; justify-content: space-around;
  background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(14px);
  border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}
.nav button {
  border: 0; background: none; color: var(--ink-2); font: 500 0.72rem var(--font-body); display: flex; flex-direction: column;
  align-items: center; gap: 3px; padding: 4px 6px; cursor: pointer; min-width: 60px;
}
.nav button span { display: grid; place-items: center; width: 56px; height: 30px; border-radius: 999px; transition: background 0.2s; }
.nav button.on { color: var(--ink); font-weight: 700; }
.nav button.on span { background: color-mix(in srgb, var(--brand) 16%, transparent); color: var(--brand); }
body:has(.onboard) .nav { display: none; }

.toast {
  position: fixed; left: 50%; bottom: calc(100px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 999px; font-weight: 600; opacity: 0;
  transition: 0.25s; pointer-events: none; z-index: 60; white-space: nowrap;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
body:has(.player.show) .toast { bottom: calc(166px + env(safe-area-inset-bottom)); }

/* ---------- Bienvenida ---------- */
.onboard { padding-bottom: 24px; }
.onboard-sky { text-align: center; padding-top: calc(48px + env(safe-area-inset-top)); padding-bottom: 36px; margin-bottom: 16px; }
.onboard-sky h1 { font-size: 2.4rem; margin: 10px 0 6px; position: relative; }
.onboard-sky p { color: var(--sky-ink-2); max-width: 30ch; margin: 0 auto; position: relative; }
.onboard-moon { color: #ffe7a8; display: grid; place-items: center; position: relative; }
.onboard .panel { margin: 0 16px 14px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media (max-width: 360px) {
  .dc-timer { font-size: 2.4rem; }
  .actions .action-ico { width: 54px; height: 54px; }
}

/* Ajustes de contraste en temas oscuros */
:root[data-theme='dark'] .badge, :root[data-theme='night'] .badge,
:root[data-theme='dark'] .dc-in, :root[data-theme='night'] .dc-in,
:root[data-theme='dark'] .hero-cta .chip, :root[data-theme='night'] .hero-cta .chip { background: rgba(255, 255, 255, 0.12); }
:root[data-theme='dark'] .btn.cta { box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3); }
