/* styles.css — móvil primero. */
[hidden] { display: none !important; }
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  padding-bottom: calc(76px + env(safe-area-inset-bottom));
}
h1, h2, h3 { margin: 0; line-height: 1.2; }
h1 { font-size: 1.6rem; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 1.05rem; font-weight: 650; }
h3 { font-size: .95rem; font-weight: 600; }
p { margin: 0; }
a { color: var(--accent); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--sun); outline-offset: 2px; border-radius: 6px; }
.muted { color: var(--ink-2); }
.small { font-size: .85rem; }
.empty { color: var(--ink-2); padding: 1.25rem 0; }
.spacer { flex: 1; }

/* ---------- Estructura ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: .5rem;
  padding: calc(.5rem + env(safe-area-inset-top)) 1rem .5rem;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
}
.brand { display: flex; align-items: center; gap: .5rem; font-weight: 700; color: var(--ink); margin-right: auto; }
.brand img { border-radius: 8px; }
.net { width: 10px; height: 10px; border-radius: 50%; background: var(--ink-2); }
.net[data-online="true"] { background: var(--accent); }
.net[data-online="false"] { background: var(--sun); }
.net[data-sync="offline"] { background: var(--ink-2); }
.net[data-sync="pending"], .net[data-sync="syncing"] { background: var(--sun); }
.net[data-sync="error"] { background: var(--danger); }
.net[data-sync="syncing"] { animation: pulse 1s ease-in-out infinite alternate; }
@keyframes pulse { to { opacity: .35; } }

.view { padding: .5rem 1rem 1.5rem; display: grid; gap: 1rem; outline: none; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a {
  display: grid; justify-items: center; gap: 2px;
  padding: .5rem 0 .55rem; font-size: .72rem; color: var(--ink-2);
}
.tabbar a span { font-size: 1.3rem; line-height: 1; filter: grayscale(.6); }
.tabbar a[aria-current="page"] { color: var(--accent); font-weight: 650; }
.tabbar a[aria-current="page"] span { filter: none; }

/* ---------- Componentes ---------- */
.card {
  background: var(--surface); border-radius: 18px; padding: 1rem;
  box-shadow: var(--shadow); display: grid; gap: .75rem;
  border: 1px solid transparent;
}
[data-theme="dark"] .card { border-color: var(--line); }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; }
.card-head a { font-size: .9rem; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; padding-top: .25rem; }
.subhead { color: var(--ink-2); margin-top: .5rem; }
.row-actions { display: flex; gap: .5rem; flex-wrap: wrap; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  min-height: 44px; padding: .5rem 1rem; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-weight: 550;
}
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.danger-ghost { background: transparent; border-color: transparent; color: var(--danger); }
.btn.small { min-height: 36px; padding: .25rem .75rem; font-size: .9rem; }
.btn:disabled { opacity: .6; cursor: progress; }
.icon-btn {
  display: inline-grid; place-items: center; width: 44px; height: 44px;
  border: 0; border-radius: 12px; background: transparent; cursor: pointer; font-size: 1.2rem; color: var(--ink);
}

.seg { display: inline-flex; background: var(--surface-2); border-radius: 12px; padding: 3px; }
.seg button { border: 0; background: transparent; padding: .4rem .9rem; border-radius: 9px; cursor: pointer; color: var(--ink-2); min-height: 38px; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: var(--shadow); }

.chips { display: flex; gap: .5rem; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: .4rem .85rem; white-space: nowrap; cursor: pointer; min-height: 38px; }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip-count { opacity: .65; margin-left: .15rem; }
.pill { font-size: .72rem; background: var(--sun-soft); color: var(--ink); border-radius: 999px; padding: 0 .5rem; margin-left: .35rem; }

.bar { height: 10px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--accent); border-radius: inherit; transition: width .4s ease; }
.pct { font-size: 1.15rem; font-variant-numeric: tabular-nums; }

/* ---------- Mi día ---------- */
.today { padding: .5rem 0 .25rem; }
.today-greet { color: var(--ink-2); }
.today-date { font-size: 1.45rem; margin-top: .1rem; }
.today-clock { font-size: 3.4rem; font-weight: 250; letter-spacing: -.03em; line-height: 1.05; font-variant-numeric: tabular-nums; margin-top: .35rem; }
.clock-suffix { font-size: .35em; font-weight: 500; letter-spacing: 0; margin-left: .35rem; color: var(--ink-2); }

.stats { display: grid; grid-template-columns: minmax(7.5rem, 1fr) 1.7fr; gap: .75rem; }
.stat {
  text-align: left; border: 1px solid var(--line); background: var(--surface); border-radius: 16px;
  padding: .75rem .9rem; display: grid; gap: .15rem; cursor: pointer; min-height: 76px; align-content: start;
}
.stat-label { font-size: .8rem; color: var(--ink-2); }
.stat-value { font-weight: 650; font-size: 1.05rem; overflow-wrap: break-word; }
.stat-value.is-placeholder { color: var(--accent); font-weight: 550; }

.now-card {
  border-radius: 18px; padding: 1rem 1.1rem; display: grid; gap: .2rem;
  background: var(--sun-soft); border-left: 6px solid var(--sun);
}
.now-label { font-size: .85rem; color: var(--ink-2); }
.now-title { font-size: 1.35rem; font-weight: 700; }
.now-next { font-size: .92rem; margin-top: .25rem; }

/* Línea de tiempo: el elemento distintivo. El hilo del día con el "ahora" dorado. */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 83px; top: 8px; bottom: 8px; width: 2px; background: var(--line); }
.tl-item { display: grid; grid-template-columns: 72px 24px 1fr 44px; align-items: center; min-height: 52px; position: relative; }
.tl-time { font-size: .82rem; color: var(--ink-2); font-variant-numeric: tabular-nums; text-align: right; padding-right: .25rem; white-space: nowrap; }
.tl-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 2px solid var(--accent); justify-self: center; z-index: 1; }
.tl-body { display: grid; text-align: left; padding: .4rem .5rem; border: 0; background: transparent; border-radius: 10px; min-width: 0; }
button.tl-body { cursor: pointer; }
.tl-title { font-weight: 550; overflow-wrap: anywhere; }
.tl-meta { font-size: .8rem; color: var(--ink-2); }
.tl-item.is-past .tl-title, .tl-item.is-past .tl-time { color: var(--ink-2); }
.tl-item.is-past .tl-dot { border-color: var(--line); }
.tl-item.is-current .tl-dot { background: var(--sun); border-color: var(--sun); box-shadow: 0 0 0 5px var(--sun-soft); }
.tl-item.is-current .tl-title { font-weight: 700; }
.tl-item.is-done .tl-title { text-decoration: line-through; text-decoration-color: var(--ink-2); color: var(--ink-2); }
.tl-item.is-done .tl-dot { background: var(--accent); }
.tl-now { position: relative; height: 22px; display: flex; align-items: center; }
.tl-now::before { content: ""; position: absolute; left: 72px; right: 0; height: 2px; background: var(--sun); }
.tl-now::after { content: ""; position: absolute; left: 78px; width: 12px; height: 12px; border-radius: 50%; background: var(--sun); }
.tl-now span { position: relative; margin-left: auto; background: var(--surface); color: var(--sun); font-size: .75rem; font-weight: 700; padding: 0 .4rem; }
.check-spacer { width: 44px; }

.check {
  width: 36px; height: 36px; justify-self: center; border-radius: 50%;
  border: 2px solid var(--line); background: transparent; color: transparent; cursor: pointer; font-weight: 800; font-size: .9rem;
}
.check[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

/* ---------- Tareas ---------- */
.task-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.view-tareas .task-list .task { background: var(--surface); border-radius: 14px; box-shadow: var(--shadow); }
.task { display: grid; grid-template-columns: 48px 1fr 44px 10px; align-items: center; min-height: 58px; padding-right: .75rem; }
.task .check { justify-self: center; }
.task-body { border: 0; background: transparent; text-align: left; display: grid; padding: .5rem .25rem; cursor: pointer; min-width: 0; }
.task-title { font-weight: 550; overflow-wrap: anywhere; }
.task-meta { font-size: .8rem; color: var(--ink-2); }
.task-meta.is-overdue { color: var(--danger); font-weight: 600; }
.task.is-done .task-title { text-decoration: line-through; color: var(--ink-2); }
.prio-mark { width: 6px; height: 28px; border-radius: 3px; background: var(--surface-2); }
.prio-alta .prio-mark { background: var(--danger); }
.prio-media .prio-mark { background: var(--sun); }
.task-list.compact .task { border-bottom: 1px solid var(--line); }
.task-list.compact .task:last-child { border-bottom: 0; }

/* ---------- Agenda ---------- */
.week { display: grid; grid-template-columns: 36px repeat(7, 1fr) 36px; align-items: center; gap: 2px; }
.week .icon-btn { width: 36px; }
.week-day { border: 0; background: transparent; border-radius: 12px; padding: .35rem 0; display: grid; justify-items: center; cursor: pointer; color: var(--ink-2); min-height: 52px; }
.week-day span { font-size: .72rem; }
.week-day strong { font-size: 1.05rem; color: var(--ink); font-variant-numeric: tabular-nums; }
.week-day.is-today strong { color: var(--accent); }
.week-day[aria-pressed="true"] { background: var(--ink); }
.week-day[aria-pressed="true"] span, .week-day[aria-pressed="true"] strong { color: var(--bg); }
.day-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.view-agenda [data-body] { display: grid; gap: 1rem; }
.view-agenda .timeline { background: var(--surface); border-radius: 18px; padding: .5rem 0; box-shadow: var(--shadow); }

.routine-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.routine {
  width: 100%; display: grid; grid-template-columns: 76px 1fr; grid-template-rows: auto auto; column-gap: .5rem;
  text-align: left; border: 0; background: var(--surface); border-radius: 14px; padding: .7rem .9rem; cursor: pointer; box-shadow: var(--shadow);
}
.routine time { grid-row: span 2; color: var(--ink-2); font-variant-numeric: tabular-nums; font-size: .9rem; align-self: center; }
.routine-title { font-weight: 600; }
.routine-days { display: flex; gap: 4px; }
.routine-days i { font-style: normal; font-size: .7rem; width: 20px; height: 20px; display: grid; place-items: center; border-radius: 50%; color: var(--ink-2); background: var(--surface-2); }
.routine-days i.on { background: var(--accent-soft); color: var(--accent); font-weight: 700; }

/* ---------- Reloj ---------- */
.clock-face { display: grid; justify-items: center; text-align: center; gap: .35rem; padding: 2.5rem 0 1.5rem; }
.clock-time { font-size: clamp(3.2rem, 17vw, 6.5rem); font-weight: 200; letter-spacing: -.04em; font-variant-numeric: tabular-nums; line-height: 1; }
.clock-weekday { font-size: 1.4rem; font-weight: 650; margin-top: .75rem; }
.clock-date { color: var(--ink-2); font-size: 1.05rem; margin-bottom: 1rem; }

/* ---------- Progreso ---------- */
.week-bars { display: grid; grid-template-columns: repeat(7, 1fr); gap: .5rem; align-items: end; }
.wb { display: grid; justify-items: center; gap: .25rem; }
.wb-track { width: 100%; max-width: 34px; height: 120px; background: var(--surface-2); border-radius: 10px; display: flex; align-items: flex-end; overflow: hidden; }
.wb-fill { width: 100%; background: var(--accent); border-radius: 10px 10px 0 0; }
.wb.is-today .wb-fill { background: var(--sun); }
.wb-pct { font-size: .75rem; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.wb-label { font-size: .8rem; font-weight: 600; }
.cat-bars { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
.cat-bars li { display: grid; grid-template-columns: minmax(6rem, 8.5rem) 1fr 5.8rem; align-items: center; gap: .5rem; }
.cat-name { font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cat-track { height: 10px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.cat-track span { display: block; height: 100%; background: var(--accent); }
.cat-val { font-size: .85rem; text-align: right; font-variant-numeric: tabular-nums; }
.status-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .35rem; }

/* ---------- Fase 2: tiempo ---------- */
.center { justify-self: center; }
.center-text { text-align: center; }
.ok-text { color: var(--accent); font-weight: 600; }
.btn.big { min-height: 52px; padding: .6rem 1.2rem; font-size: 1.02rem; }
.controls { display: flex; flex-wrap: wrap; gap: .6rem; justify-content: center; }
.play {
  width: 40px; height: 40px; border-radius: 50%; border: 0; cursor: pointer; justify-self: center;
  background: var(--accent-soft); color: var(--accent); font-size: .95rem; padding-left: 3px;
}
.big-label { font-weight: 650; font-size: 1.1rem; }
.big-time { font-size: 2.6rem; font-weight: 250; font-variant-numeric: tabular-nums; letter-spacing: -.02em; line-height: 1.1; }

.subtabs { margin: 0 -1rem; padding: 0 1rem 2px; }
.subtabs .chip { text-decoration: none; color: var(--ink); display: inline-flex; align-items: center; }
.subtabs .chip[aria-current="page"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.tab-body { display: grid; gap: 1rem; }
.keep-awake { font-size: .9rem; color: var(--ink-2); }

.notice { border-left: 5px solid var(--sun); background: var(--surface); border-radius: 14px; padding: .9rem 1rem; display: grid; gap: .5rem; font-size: .93rem; }

/* Alarmas */
.alarm-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
.alarm { display: grid; grid-template-columns: 1fr 64px; align-items: center; background: var(--surface); border-radius: 16px; box-shadow: var(--shadow); }
.alarm-body { border: 0; background: transparent; text-align: left; padding: .8rem 0 .8rem 1rem; display: grid; gap: .1rem; cursor: pointer; min-width: 0; }
.alarm-time { font-size: 2.1rem; font-weight: 300; font-variant-numeric: tabular-nums; line-height: 1.05; letter-spacing: -.02em; }
.alarm-time small { font-size: .9rem; font-weight: 500; margin-left: .3rem; color: var(--ink-2); }
.alarm-name { font-weight: 600; }
.alarm-days { display: flex; gap: 4px; margin-top: .15rem; }
.alarm-days i { font-style: normal; font-size: .7rem; width: 20px; height: 20px; display: grid; place-items: center; border-radius: 50%; color: var(--ink-2); background: var(--surface-2); }
.alarm-days i.on { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.alarm-days em { font-style: normal; font-size: .82rem; color: var(--ink-2); }
.alarm-next { font-size: .8rem; color: var(--accent); }
.alarm.is-off .alarm-time, .alarm.is-off .alarm-name { color: var(--ink-2); }
.alarm.is-off .alarm-next { color: var(--ink-2); }
.toggle { position: relative; width: 52px; height: 32px; justify-self: center; cursor: pointer; }
.toggle input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.toggle span { position: absolute; inset: 0; background: var(--surface-2); border-radius: 999px; transition: background .2s; pointer-events: none; }
.toggle span::after { content: ""; position: absolute; top: 4px; left: 4px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s; }
.toggle input:checked + span { background: var(--accent); }
.toggle input:checked + span::after { transform: translateX(20px); }
.toggle input:focus-visible + span { outline: 3px solid var(--sun); outline-offset: 2px; }
.input-xl { font-size: 1.6rem !important; font-variant-numeric: tabular-nums; }

/* Temporizador: el dial */
.dial-wrap { display: grid; justify-items: center; gap: 1rem; padding: .5rem 0; }
.dial { position: relative; width: min(78vw, 300px); aspect-ratio: 1; }
.dial svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.dial-track { fill: none; stroke: var(--surface-2); stroke-width: 12; }
.dial-fill { fill: none; stroke: var(--accent); stroke-width: 12; stroke-linecap: round; transition: stroke-dashoffset .25s linear; }
.dial.paused .dial-fill { stroke: var(--ink-2); }
.dial.done .dial-fill { stroke: var(--sun); }
.dial-center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; gap: .15rem; padding: 2rem; }
.dial-label { font-weight: 600; font-size: .95rem; }
.dial-time { font-size: clamp(2.6rem, 13vw, 3.6rem); font-weight: 250; font-variant-numeric: tabular-nums; letter-spacing: -.03em; line-height: 1; }
.dial-sub { font-size: .8rem; color: var(--ink-2); }
.hms { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; }
.hms label { display: grid; justify-items: center; gap: .2rem; }
.hms input { width: 100%; text-align: center; font-size: 2rem; font-weight: 300; font-variant-numeric: tabular-nums; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); padding: .4rem 0; }
.hms span { font-size: .8rem; color: var(--ink-2); }
.presets { display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; }
.presets .chip { justify-content: center; font-variant-numeric: tabular-nums; }
.pomo-summary { font-size: .92rem; }

/* Cronómetro */
.watch { display: grid; justify-items: center; text-align: center; gap: .3rem; padding: 2rem 0 .5rem; }
.watch-label { font-weight: 600; }
.watch-time { font-size: clamp(3rem, 16vw, 5.5rem); font-weight: 200; font-variant-numeric: tabular-nums; letter-spacing: -.04em; line-height: 1; }
.watch-time small { font-size: .4em; color: var(--ink-2); }
.watch.running .watch-time span { color: var(--ink); }
.watch.paused .watch-time { color: var(--ink-2); }
.laps { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.laps th { text-align: left; font-size: .8rem; color: var(--ink-2); font-weight: 550; padding: .3rem 0; }
.laps td { padding: .45rem 0; border-top: 1px solid var(--line); }

/* Tiempo */
.play-list, .session-list { list-style: none; margin: 0; padding: 0; display: grid; }
.play-list li { display: grid; grid-template-columns: 1fr 44px; align-items: center; min-height: 52px; border-bottom: 1px solid var(--line); }
.play-list li:last-child, .session-list li:last-child { border-bottom: 0; }
.play-list small, .session-list small { display: block; font-size: .78rem; color: var(--ink-2); }
.session-list li { display: grid; grid-template-columns: 1fr auto 40px; gap: .5rem; align-items: center; padding: .45rem 0; border-bottom: 1px solid var(--line); }
.session-list strong { font-variant-numeric: tabular-nums; font-size: .92rem; }
.session-list .icon-btn { width: 40px; height: 40px; font-size: .9rem; color: var(--ink-2); }
.status-list a { color: var(--ink); }
.now-start { justify-self: start; margin-top: .5rem; }

/* Barra de sesión activa */
.livebar {
  position: fixed; left: .5rem; right: .5rem; z-index: 11;
  bottom: calc(66px + env(safe-area-inset-bottom));
  display: grid; gap: .35rem;
}
.live-item { display: grid; grid-template-columns: 1fr auto auto; align-items: center; background: var(--ink); color: var(--bg); border-radius: 14px; padding-left: .9rem; box-shadow: 0 6px 20px rgba(0,0,0,.2); }
.live-main { display: flex; justify-content: space-between; gap: .75rem; color: inherit; min-height: 48px; align-items: center; min-width: 0; }
.live-main span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .9rem; }
.live-main strong { font-variant-numeric: tabular-nums; color: var(--sun); }
.live-item .icon-btn { color: var(--bg); }
body[data-route="reloj"] .livebar { display: none; }
body.has-livebar:not([data-route="reloj"]) { padding-bottom: calc(136px + env(safe-area-inset-bottom)); }
body.has-livebar:not([data-route="reloj"]) .toasts { bottom: calc(150px + env(safe-area-inset-bottom)); }

/* Pantalla de alarma */
.ringer { position: fixed; inset: 0; z-index: 200; background: var(--ink); color: var(--bg); display: grid; place-items: center; padding: 2rem 1.25rem calc(2rem + env(safe-area-inset-bottom)); }
.ringer[hidden] { display: none; }
.ringer-box { display: grid; justify-items: center; text-align: center; gap: .6rem; width: min(420px, 100%); }
.ringer-emoji { font-size: 4rem; line-height: 1; animation: ring-pulse 1.2s ease-in-out infinite; }
.ringer h2 { font-size: 1.9rem; }
.ringer-sub { opacity: .75; }
.ringer-actions { display: grid; gap: .6rem; width: 100%; margin-top: 1.5rem; }
.ringer-actions .btn { background: transparent; color: var(--bg); border-color: color-mix(in srgb, var(--bg) 35%, transparent); }
.ringer-actions .btn.primary { background: var(--sun); color: #1c1405; border-color: var(--sun); }
@keyframes ring-pulse { 50% { transform: scale(1.12); } }

/* ---------- Formularios ---------- */
.form { gap: 1rem; }
.field { display: grid; gap: .3rem; border: 0; margin: 0; padding: 0; min-width: 0; }
.field > span, .field > legend { font-size: .85rem; color: var(--ink-2); font-weight: 550; padding: 0; }
.field input, .field select, .field textarea {
  width: 100%; min-height: 44px; padding: .55rem .7rem; border-radius: 10px;
  border: 1px solid var(--line); background: var(--bg);
}
.field textarea { resize: vertical; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.grid-emoji { display: grid; grid-template-columns: 5rem 1fr; gap: .75rem; }
.days { display: flex; gap: .35rem; flex-wrap: wrap; margin-top: .3rem; }
.daybox input { position: absolute; opacity: 0; pointer-events: none; }
.daybox span { display: grid; place-items: center; min-width: 44px; height: 40px; border-radius: 10px; border: 1px solid var(--line); cursor: pointer; font-size: .85rem; }
.daybox input:checked + span { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.daybox input:focus-visible + span { outline: 3px solid var(--sun); }
.switch { display: flex; align-items: center; gap: .6rem; min-height: 44px; }
.switch input { width: 20px; height: 20px; accent-color: var(--accent); }

/* ---------- Modal y avisos ---------- */
dialog#modal { border: 0; padding: 0; background: transparent; color: var(--ink); width: min(560px, 100%); max-width: 100%; max-height: 100%; margin: auto auto 0; }
dialog#modal::backdrop { background: rgba(8, 12, 22, .5); }
.modal { background: var(--surface); border-radius: 22px 22px 0 0; display: grid; max-height: 92dvh; grid-template-rows: auto 1fr auto; padding-bottom: env(safe-area-inset-bottom); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1rem .25rem 1.1rem; }
.modal-body { overflow-y: auto; padding: .5rem 1.1rem 1rem; display: grid; gap: .85rem; }
.modal-foot { display: flex; gap: .5rem; padding: .75rem 1rem 1rem; border-top: 1px solid var(--line); flex-wrap: wrap; }

.toasts { position: fixed; left: 50%; bottom: calc(86px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 100; display: grid; gap: .5rem; width: min(92vw, 420px); }
.toast { display: flex; align-items: center; gap: .75rem; background: var(--ink); color: var(--bg); padding: .7rem 1rem; border-radius: 12px; font-size: .92rem; }
.toast-error { background: var(--danger); color: #fff; }
.toast-action { margin-left: auto; border: 0; background: transparent; color: var(--sun); font-weight: 700; cursor: pointer; min-height: 36px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ---------- Google Sheets ---------- */
.sync-state { font-weight: 650; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: .25rem 1rem; margin: 0; font-size: .92rem; }
.kv dt { color: var(--ink-2); }
.kv dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.error-text { color: var(--danger); font-weight: 600; }
.mono { font-family: ui-monospace, "Cascadia Mono", "Roboto Mono", monospace; font-size: .85rem; }
.switch.between { justify-content: space-between; align-items: flex-start; gap: 1rem; }
.switch.between .toggle { flex: none; margin-top: .2rem; }
.more summary { cursor: pointer; color: var(--accent); font-weight: 600; min-height: 44px; display: flex; align-items: center; }
.more > .row-actions { margin: .25rem 0 .5rem; }

/* ---------- Fase 4 ---------- */
.bell { position: relative; }
.badge { position: absolute; top: 4px; right: 2px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 999px; background: var(--danger); color: #fff; font-size: .68rem; font-weight: 700; display: grid; place-items: center; line-height: 1; }
#menu-btn[aria-current="page"] { background: var(--surface-2); }

.habit-chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .5rem; }
.habit-chip { display: inline-flex; align-items: center; gap: .35rem; min-height: 40px; padding: .35rem .8rem; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-size: .9rem; color: var(--ink-2); }
.habit-chip.is-done { background: var(--accent-soft); border-color: var(--accent); color: var(--ink); font-weight: 600; }
.habit-chip.is-done span::after { content: " ✓"; color: var(--accent); }
.habit-list { list-style: none; margin: 0; padding: 0; display: grid; }
.habit-row, .prayer { display: grid; grid-template-columns: 48px 1fr auto; align-items: center; min-height: 58px; border-bottom: 1px solid var(--line); }
.habit-row:last-child, .prayer:last-child { border-bottom: 0; }
.habit-body { border: 0; background: transparent; text-align: left; display: grid; padding: .45rem .25rem; cursor: pointer; min-width: 0; }
.habit-name { font-weight: 600; overflow-wrap: anywhere; }
.habit-meta { font-size: .8rem; color: var(--ink-2); }
.habit-row.is-done .habit-name { color: var(--ink-2); }
.prayer.is-answered .habit-name { text-decoration: line-through; color: var(--ink-2); }
.streak { font-size: .85rem; font-weight: 700; color: var(--sun); padding-right: .25rem; }
.habit-grid-wrap { overflow-x: auto; }
.habit-grid { width: 100%; border-collapse: collapse; font-size: .85rem; }
.habit-grid th, .habit-grid td { padding: .35rem .2rem; text-align: center; }
.habit-grid tbody th { text-align: left; font-weight: 550; white-space: nowrap; max-width: 9rem; overflow: hidden; text-overflow: ellipsis; }
.habit-grid thead th.is-today { color: var(--accent); }
.habit-grid td.yes { color: var(--accent-ink); }
.habit-grid td.yes::before { content: ""; }
.habit-grid td { position: relative; }
.habit-grid td.yes { background: var(--accent); border-radius: 8px; font-weight: 800; border: 2px solid var(--surface); }
.habit-grid td.no { background: var(--surface-2); border-radius: 8px; border: 2px solid var(--surface); }
.habit-grid td.na { color: var(--ink-2); }

.moods { display: flex; justify-content: space-between; gap: .25rem; margin-top: .25rem; }
.mood { flex: 1; display: grid; justify-items: center; gap: .1rem; cursor: pointer; }
.mood input { position: absolute; opacity: 0; pointer-events: none; }
.mood span { font-size: 1.9rem; line-height: 1.3; border-radius: 14px; padding: .15rem .35rem; border: 2px solid transparent; filter: grayscale(.4); }
.mood small { font-size: .7rem; color: var(--ink-2); }
.mood input:checked + span { border-color: var(--sun); background: var(--sun-soft); filter: none; }
.mood input:focus-visible + span { outline: 3px solid var(--sun); }
.closing-blocks { list-style: none; margin: 0; padding: 0; }
.closing-card { text-decoration: none; color: var(--ink); background: var(--accent-soft); border-left-color: var(--accent); }

.water-count { font-size: 1.1rem; }
.water-count strong { font-size: 2.6rem; font-weight: 300; font-variant-numeric: tabular-nums; margin-right: .25rem; }
.row-actions.center { justify-content: center; }
.center-text { text-align: center; }
.linkish { border: 0; background: transparent; text-align: left; display: grid; padding: 0; cursor: pointer; width: 100%; }
.spark { display: flex; align-items: flex-end; gap: 4px; height: 70px; }
.spark span { flex: 1; background: var(--accent); border-radius: 4px 4px 0 0; min-height: 4px; }
button.wb { border: 0; background: transparent; cursor: pointer; padding: 0; color: inherit; font: inherit; }
.wb-track { position: relative; }
.wb-goal { position: absolute; left: 0; right: 0; height: 2px; background: var(--sun); z-index: 1; }
.wb.met .wb-fill { background: var(--accent); }

.god-hero { justify-items: stretch; }
.plan-items { list-style: none; margin: 0 0 .5rem; padding: 0; max-height: 320px; overflow-y: auto; }
.journal { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.journal summary { cursor: pointer; padding: .4rem 0; min-height: 44px; }
.journal-text { white-space: pre-wrap; margin: .25rem 0 .5rem; }

.section-label { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-2); }
.notif-list { list-style: none; margin: 0; padding: 0; display: grid; }
.notif { display: grid; grid-template-columns: 1fr auto; align-items: center; border-bottom: 1px solid var(--line); }
.notif:last-child { border-bottom: 0; }
.notif-body { display: grid; gap: .1rem; padding: .6rem 0; color: var(--ink); text-decoration: none; }
.notif-title { font-weight: 650; }
.notif-text { font-size: .92rem; }
.notif small { color: var(--ink-2); font-size: .78rem; }
.notif.is-read .notif-title, .notif.is-read .notif-text { color: var(--ink-2); font-weight: 500; }
.notif.is-upcoming .notif-title { font-weight: 550; }
.pref-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); gap: 0 .75rem; }
details.card > summary { list-style: none; }

.menu-grid { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); }
.menu-item { display: flex; align-items: center; gap: .85rem; background: var(--surface); border-radius: 16px; padding: .85rem 1rem; color: var(--ink); text-decoration: none; box-shadow: var(--shadow); min-height: 72px; }
.menu-item small { display: block; color: var(--ink-2); font-size: .82rem; }
.menu-emoji { font-size: 1.7rem; width: 2.4rem; text-align: center; }

/* ---------- Fase 5 ---------- */
.plain-list { list-style: none; margin: 0; padding: 0; display: grid; }
.plain-list > li { border-bottom: 1px solid var(--line); }
.plain-list > li:last-child { border-bottom: 0; }
.list-row, .project { display: grid; gap: .15rem; width: 100%; text-align: left; border: 0; background: transparent; padding: .6rem 0; cursor: pointer; color: var(--ink); text-decoration: none; font: inherit; }
.list-row.is-today .habit-name { color: var(--accent); }
.project.is-main .habit-name { font-size: 1.1rem; }
.bar.thin { height: 6px; margin: .2rem 0; }
.check-list { list-style: none; margin: 0; padding: 0; }
.inline-add { display: grid; grid-template-columns: 1fr auto; gap: .5rem; align-items: end; }
.inline-add:has(input[type="date"]) { grid-template-columns: 1fr 9.5rem auto; }
.menu-week { list-style: none; margin: 0; padding: 0; display: grid; gap: .4rem; }
.menu-day { width: 100%; display: grid; grid-template-columns: 6.5rem 1fr auto; align-items: center; gap: .5rem; text-align: left; border: 1px solid var(--line); background: var(--surface); border-radius: 12px; padding: .6rem .8rem; cursor: pointer; min-height: 52px; font: inherit; color: var(--ink); }
.menu-week li.is-today .menu-day { border-color: var(--accent); background: var(--accent-soft); }
.menu-dayname { font-weight: 650; }
.menu-dish { overflow-wrap: anywhere; }
.menu-day small { color: var(--ink-2); }
.subject-list { list-style: none; margin: 0; padding: 0; }
.subject { display: grid; grid-template-columns: 1fr 48px; align-items: center; border-bottom: 1px solid var(--line); }
.subject:last-child { border-bottom: 0; }
.material { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: .5rem; }
.notice.small { font-size: .85rem; }
@media (max-width: 420px) { .inline-add:has(input[type="date"]) { grid-template-columns: 1fr 1fr; } .inline-add:has(input[type="date"]) button { grid-column: 1 / -1; } }

/* ---------- Fase 6 ---------- */
.whatnow-btn { display: flex; justify-content: center; text-decoration: none; }
.now-card.whatnow { background: var(--accent-soft); border-left-color: var(--accent); }
.month-nav { display: flex; align-items: center; justify-content: center; gap: .75rem; }
.month-nav strong { min-width: 10rem; text-align: center; text-transform: capitalize; }
.fin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.fin-box { background: var(--surface-2); border-radius: 14px; padding: .6rem .8rem; display: grid; gap: .1rem; }
.fin-box span { font-size: .8rem; color: var(--ink-2); }
.fin-box strong { font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.up { color: var(--accent); }
.down { color: var(--danger); }
.amount { align-self: center; padding-left: .5rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.plain-list > li { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: .5rem; }
.budget-list { list-style: none; margin: 0; padding: 0; }
.budget-list > li { border-bottom: 1px solid var(--line); }
.budget-list > li:last-child { border-bottom: 0; }
.bar.is-over span { background: var(--danger); }
.cat-track .is-low { background: var(--sun); }
.ok-text { color: var(--accent); font-weight: 650; }
