/* Pastillero de Ale — una columna de celular. El pastillero de 7 tapas de colores pastel (L–D) es el
   protagonista; debajo, las tomas del día como renglones grandes para tocar; pestañas fijas abajo.
   Paleta rosa y frambuesa, títulos en serif suave, texto en Atkinson Hyperlegible (hecha para leer fácil). */

@font-face { font-family: "Atkinson Hyperlegible"; src: url("fonts/atkinson-hyperlegible-400.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Atkinson Hyperlegible"; src: url("fonts/atkinson-hyperlegible-700.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Fraunces"; src: url("fonts/fraunces.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; }

:root {
  --bg: #FCF1F4;            /* rubor */
  --surface: #FFFFFF;
  --surface-2: #F7E3EA;
  --ink: #3A1F2B;           /* ciruela */
  --muted: #76525F;
  --line: #EDCFDA;
  --accent: #C2185B;        /* frambuesa */
  --accent-ink: #9C1149;
  --accent-soft: #FCE1EB;
  --on-accent: #FFFFFF;
  --done: #0F7461;          /* menta */
  --done-soft: #D9F2EA;
  --on-done: #FFFFFF;
  --late: #B54708;          /* durazno quemado: se pasó */
  --late-soft: #FDEBD9;
  --paused: #6B5B95;        /* lila: en pausa */
  --paused-soft: #ECE7F7;
  --lid-1: #FAD4E1; --lid-2: #FDE0CC; --lid-3: #FBEFC0; --lid-4: #D6F1E6; --lid-5: #D8E8FB; --lid-6: #E7DDF8; --lid-7: #F9D9EC;
  --shadow: 0 1px 2px rgb(58 31 43 / .07), 0 6px 16px rgb(194 24 91 / .06);
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-body: "Atkinson Hyperlegible", Verdana, "Segoe UI", system-ui, sans-serif;
  --radius: 20px;
  --tab-h: 72px;
  --maxw: 560px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1A0F15; --surface: #251720; --surface-2: #301F2A;
    --ink: #F9E8EF; --muted: #CBA9B8; --line: #45313C;
    --accent: #FF7EB0; --accent-ink: #FFA6C9; --accent-soft: #4A1C33; --on-accent: #2A0716;
    --done: #5FD3B3; --done-soft: #12352D; --on-done: #04130F;
    --late: #FFAD6E; --late-soft: #40250F; --paused: #BBADE6; --paused-soft: #2C2541;
    --lid-1: #5A2539; --lid-2: #5A3424; --lid-3: #514318; --lid-4: #1F4637; --lid-5: #213B55; --lid-6: #3A2D5A; --lid-7: #55243F;
    --shadow: 0 1px 2px rgb(0 0 0 / .45), 0 6px 18px rgb(0 0 0 / .3);
    color-scheme: dark;
  }
}
.hello h1, .auth h1, .page-head h1, .day-head h2, .card h2, .sheet-head h2, .cell .lid, .labs-when, .yay, .stat b, .score b, .chip.day, .month-nav h2 {
  font-variation-settings: "SOFT" 100, "WONK" 0;
}

html { font-size: 112.5%; -webkit-text-size-adjust: 100%; scroll-padding-top: 16px; scroll-padding-bottom: calc(var(--tab-h) + 96px + env(safe-area-inset-bottom, 0px)); }
html.big { font-size: 128%; }
html.locked, html.locked body { overflow: hidden; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--ink); font-family: var(--font-body); font-size: 1rem; line-height: 1.45; -webkit-font-smoothing: antialiased; }
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
button, input, textarea { font: inherit; color: inherit; }
button { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
p { margin: 0; }
img, svg { max-width: 100%; }
.muted { color: var(--muted); }
.hint { font-size: .9rem; color: var(--muted); }
.eyebrow { font-size: .85rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
h1, h2, h3 { text-wrap: balance; }
.vh { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.boot { min-height: 100vh; display: grid; place-items: center; color: var(--muted); padding: 24px; }

.app { max-width: var(--maxw); margin: 0 auto; padding-inline: 16px; padding-block: calc(18px + env(safe-area-inset-top, 0px)) calc(var(--tab-h) + 36px + env(safe-area-inset-bottom, 0px)); }
#main { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; }

/* Arriba: volver a la portada o cerrar sesión, discretos para no competir con el saludo. */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: -8px -8px 10px; }
.top-btn { display: inline-flex; align-items: center; gap: 4px; min-height: 40px; padding: 6px 10px 6px 6px; border: 0; border-radius: 12px; background: none; color: var(--muted); font-size: .88rem; font-weight: 700; text-decoration: none; cursor: pointer; }
.top-btn:hover { color: var(--accent-ink); background: var(--accent-soft); }
.top-btn svg, .auth-foot svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.hint a, .sheet-body p a { color: var(--accent-ink); font-weight: 700; }
.auth-foot { text-align: center; }
.auth-foot a { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; padding: 6px 12px; border-radius: 12px; color: var(--muted); font-weight: 700; text-decoration: none; }
.auth-foot a:hover { color: var(--accent-ink); background: var(--accent-soft); }

/* Entrar / crear clave */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: calc(24px + env(safe-area-inset-top, 0px)) 16px calc(24px + env(safe-area-inset-bottom, 0px)); }
.auth { width: 100%; max-width: 440px; display: grid; gap: 18px; }
.auth h1 { margin: 0; font-family: var(--font-display); font-weight: 800; font-size: clamp(2.3rem, 11vw, 2.9rem); line-height: 1; letter-spacing: -.015em; }
.auth h1 .name { color: var(--accent); }
.auth form { position: relative; display: grid; gap: 14px; }
.auth form .vh { left: 0; top: 0; }
.note { padding: 14px 16px; border-radius: 14px; background: var(--accent-soft); }
.working { display: flex; align-items: center; gap: 10px; color: var(--muted); }

/* Saludo */
.hello { display: grid; gap: 4px; padding-top: 4px; }
/* El saludo a la izquierda y Pili y Jeri a la derecha, sobre la misma línea. */
.hello-top { display: grid; grid-template-columns: minmax(0, 1fr) 48%; align-items: end; gap: 0 4px; }
.hello .pj-slot { height: 132px; margin: -30px -10px -8px 0; }
.hello .date { font-size: .88rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.hello h1 { margin: 0; font-family: var(--font-display); font-weight: 800; font-size: clamp(2.2rem, 10vw, 2.7rem); line-height: 1; letter-spacing: -.015em; }
.hello h1 .name { color: var(--accent); }
.next { margin-top: 8px; font-size: 1.05rem; }
.next.is-late { color: var(--accent-ink); }
.net { margin-top: 6px; font-size: .92rem; color: var(--muted); }

/* Pastillero */
.week-nav { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.week-label { flex: 1; text-align: center; font-weight: 700; }
.week-label .muted { font-weight: 400; }
.icon-btn { appearance: none; border: 0; background: transparent; width: 46px; height: 46px; flex: none; border-radius: 12px; display: grid; place-items: center; cursor: pointer; color: var(--ink); }
.icon-btn:hover { background: var(--surface-2); }
.icon-btn:disabled { opacity: .3; cursor: default; background: transparent; }
.box { background: var(--surface-2); border-radius: 22px; padding: 7px; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.cell { appearance: none; border: 2px solid transparent; background: var(--surface); border-radius: 15px; padding: 0 0 9px; display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; min-height: 98px; cursor: pointer; overflow: hidden; box-shadow: var(--shadow); color: var(--ink); transition: transform .12s ease; }
.cell:active { transform: scale(.96); }
.cell .lid { align-self: stretch; padding: 7px 0 6px; background: var(--surface-2); color: var(--ink); font-family: var(--font-display); font-weight: 700; font-size: 1.1rem; line-height: 1; text-align: center; }
.cell .lid.d1 { background: var(--lid-1); } .cell .lid.d2 { background: var(--lid-2); } .cell .lid.d3 { background: var(--lid-3); }
.cell .lid.d4 { background: var(--lid-4); } .cell .lid.d5 { background: var(--lid-5); } .cell .lid.d6 { background: var(--lid-6); }
.cell .lid.d7 { background: var(--lid-7); }
.cell .num { font-size: 1.15rem; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.cell .dots { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; padding-inline: 3px; min-height: 11px; }
.cell.is-future .num { color: var(--muted); font-weight: 400; }
.cell.is-today .lid { background: var(--accent); color: var(--on-accent); }
.cell[aria-pressed="true"] { border-color: var(--ink); }
.cell.is-today[aria-pressed="true"] { border-color: var(--accent); }
.cell.all-done { background: var(--done-soft); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--muted); flex: none; }
.dot.sq { border-radius: 2px; transform: rotate(45deg) scale(.88); }
.dot.done { background: var(--done); border-color: var(--done); }
.dot.partial { border-color: var(--done); background: linear-gradient(90deg, var(--done) 50%, transparent 50%); }
.dot.due { border-color: var(--accent); }
.dot.missed { border-color: var(--late); }
.dot.skipped { background: var(--muted); border-color: var(--muted); }
.dot.paused { border-color: var(--paused); border-style: dotted; }
.more { font-style: normal; font-size: .72rem; color: var(--muted); line-height: 10px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 10px; padding-inline: 4px; font-size: .85rem; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.soon { margin-top: 12px; display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 14px; background: var(--accent-soft); }
.soon svg { flex: none; color: var(--accent-ink); }

/* Día */
.day-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.day-head h2 { margin: 0; font-family: var(--font-display); font-weight: 800; font-size: 1.65rem; line-height: 1.1; }
.day-head p { margin-top: 2px; }
.day-head .btn { flex: none; }
.doses { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.dose { background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.dose[data-state="done"] { background: var(--done-soft); border-color: transparent; }
.dose[data-state="partial"] { background: var(--done-soft); border-color: var(--done); border-style: dashed; }
.dose[data-state="due"] { border-color: var(--accent); }
.dose[data-state="paused"], .dose[data-state="skipped"] { background: var(--surface-2); border-color: transparent; }
.dose-main { appearance: none; border: 0; background: transparent; width: 100%; text-align: left; display: flex; align-items: center; gap: 14px; padding: 14px 16px; min-height: 80px; cursor: pointer; }
.dose-main:disabled { cursor: default; }
.mark { flex: none; width: 46px; height: 46px; border-radius: 50%; border: 3px solid var(--ink); background: var(--surface); display: grid; place-items: center; color: transparent; }
.dose[data-state="done"] .mark { background: var(--done); border-color: var(--done); color: var(--on-done); }
.dose[data-state="partial"] .mark { background: linear-gradient(90deg, var(--done) 50%, var(--surface) 50%); border-color: var(--done); color: transparent; }
.dose[data-state="due"] .mark { border-color: var(--accent); }
.dose[data-state="missed"] .mark { border-color: var(--late); border-style: dashed; }
.dose[data-state="skipped"] .mark { border-color: var(--muted); background: transparent; color: var(--muted); }
.dose[data-state="paused"] .mark { border-color: var(--paused); border-style: dashed; background: transparent; color: var(--paused); }
.dose[data-state="future"] .mark { border-color: var(--line); }
.dose.just .mark { animation: pop .25s ease-out; }
@keyframes pop { from { transform: scale(.7); } to { transform: scale(1); } }
.dose-text { flex: 1; min-width: 0; display: grid; gap: 2px; }
.dose-name { font-weight: 700; font-size: 1.2rem; line-height: 1.2; overflow-wrap: anywhere; }
.dose-meta { color: var(--muted); }
.dose-note { color: var(--muted); font-size: .95rem; overflow-wrap: anywhere; }
.st { font-weight: 700; }
.st-done, .st-partial { color: var(--done); }
.st-due { color: var(--accent-ink); }
.st-missed { color: var(--late); }
.st-skipped { color: var(--muted); }
.st-paused { color: var(--paused); }
.dose-type { flex: none; color: var(--muted); }
.dose-more { padding: 0 16px 16px 76px; display: grid; gap: 12px; }
@media (max-width: 400px) { .dose-more { padding-left: 16px; } }
.qgroup { display: grid; gap: 10px; }
.more-q { font-weight: 700; }
.more-q .muted { display: block; font-weight: 400; }
.yay { margin-top: 14px; display: flex; align-items: center; gap: 8px; font-family: var(--font-display); font-weight: 600; font-size: 1.25rem; color: var(--accent-ink); }
.yay svg { flex: none; color: var(--accent); }
.add-more { margin-top: 6px; }

/* Cuando las necesites */
.prn h3 { margin: 0 0 10px; }
.prn-row { padding: 14px 16px; display: grid; gap: 12px; }
.prn-main { display: flex; align-items: center; gap: 14px; }
.prn-main > svg { flex: none; color: var(--muted); }

/* Tarjetas, botones, chips */
.card { background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--radius); padding: 18px 16px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.card h2 { margin: 0; font-family: var(--font-display); font-weight: 800; font-size: 1.35rem; line-height: 1.15; }
.card.alert { background: var(--accent-soft); border-color: transparent; }
.card.soft { background: var(--surface-2); border-color: transparent; }
.card.labs.is-on { background: var(--paused-soft); border-color: transparent; }
.labs-when { font-family: var(--font-display); font-weight: 800; font-size: 1.5rem; line-height: 1.1; }
.row { display: flex; flex-wrap: wrap; gap: 10px; }
.row2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 360px) { .row2 { grid-template-columns: 1fr; } }
.empty { padding: 18px 16px; border: 1.5px dashed var(--line); border-radius: var(--radius); color: var(--muted); text-align: center; display: grid; gap: 12px; justify-items: center; }
.err { padding: 12px 14px; border-radius: 12px; background: var(--late-soft); color: var(--late); font-weight: 700; }
.ok-msg { padding: 12px 14px; border-radius: 12px; background: var(--done-soft); color: var(--done); font-weight: 700; }

.btn { appearance: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 12px 18px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); font-weight: 700; line-height: 1.2; text-decoration: none; cursor: pointer; }
.btn:hover { border-color: var(--muted); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { border-color: var(--accent); filter: brightness(1.06); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--accent-ink); padding-inline: 10px; }
.btn.danger { background: transparent; border-color: var(--late); color: var(--late); }
.btn.ghost.danger { border-color: transparent; justify-self: start; }
.btn.block { width: 100%; }
.btn svg { flex: none; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { appearance: none; display: inline-flex; align-items: center; gap: 8px; min-height: 48px; padding: 9px 16px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; }
.chip svg { width: 20px; height: 20px; flex: none; }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.wk { display: grid; grid-template-columns: repeat(7, minmax(0, 52px)); gap: 6px; justify-content: space-between; }
.chip.day { width: 100%; aspect-ratio: 1; min-height: 0; padding: 0; justify-content: center; font-family: var(--font-display); font-weight: 800; font-size: 1.05rem; }
.chip.num { min-width: 52px; justify-content: center; font-variant-numeric: tabular-nums; font-weight: 700; }

/* Avisos de Hoy: confirmar, se te pasaron, se acaba */
.ob-row, .miss-row { display: grid; gap: 10px; padding-top: 12px; border-top: 1px solid rgb(0 0 0 / .08); }
.ob-text, .miss-text { display: grid; gap: 2px; }
.ob-text b, .miss-text b { font-size: 1.1rem; }
.miss { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.why { display: grid; gap: 8px; }
.why-q { font-weight: 700; }
.steps { margin: 0; padding-left: 1.3em; display: grid; gap: 8px; }
.steps svg { vertical-align: -4px; }

/* Cómo te sientes */
.feel-row { display: grid; gap: 8px; }
.feel-l { font-weight: 700; }
.feel-sum { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.feel-sum > div { display: grid; gap: 2px; min-width: 0; }

/* Formularios */
.field { display: grid; gap: 6px; min-width: 0; }
.field > span { font-weight: 700; }
.field small, legend small { font-weight: 400; color: var(--muted); }
input[type="text"], input[type="password"], input[type="time"], input[type="date"], input[type="number"], textarea {
  -webkit-appearance: none; appearance: none; display: block; width: 100%; min-width: 0; min-height: 54px;
  padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); font-size: 1.05rem; text-align: left;
}
input::-webkit-date-and-time-value { text-align: left; }
textarea { min-height: 100px; resize: vertical; line-height: 1.4; }
input:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .85; }
input[type="file"] { font-size: 1rem; max-width: 100%; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
fieldset > * + * { margin-top: 10px; }
legend { padding: 0; font-weight: 700; }
.fallback { min-height: 200px; font-family: ui-monospace, Menlo, monospace; font-size: .85rem; }

.opts { display: grid; gap: 8px; }
.opt { appearance: none; display: flex; align-items: center; gap: 14px; width: 100%; min-height: 64px; padding: 12px 16px; text-align: left; border-radius: 14px; border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; }
.opt .radio { flex: none; width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--muted); display: grid; place-items: center; }
.opt[aria-checked="true"] { border-color: var(--accent); background: var(--accent-soft); }
.opt[aria-checked="true"] .radio { border-color: var(--accent); }
.opt[aria-checked="true"] .radio::after { content: ""; width: 12px; height: 12px; border-radius: 50%; background: var(--accent); }
.opt-l { display: block; font-weight: 700; }
.opt small { display: block; color: var(--muted); font-size: .92rem; }
.sub { display: grid; gap: 18px; padding: 16px; border-radius: 16px; background: var(--surface-2); }

.stepper { display: inline-flex; align-items: stretch; border: 1.5px solid var(--line); border-radius: 14px; background: var(--surface); overflow: hidden; }
.stepper button { appearance: none; border: 0; background: transparent; width: 56px; min-height: 54px; font-size: 1.5rem; font-weight: 700; cursor: pointer; color: var(--ink); }
.stepper button:disabled { opacity: .3; cursor: default; }
.stepper output { display: grid; place-items: center; min-width: 140px; padding-inline: 12px; border-inline: 1.5px solid var(--line); font-weight: 700; font-variant-numeric: tabular-nums; }
.times { display: grid; gap: 8px; }
.time-row { display: flex; align-items: center; gap: 8px; }
.time-row input { flex: 1; }

.switch { appearance: none; display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px 16px; text-align: left; border-radius: 14px; border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; }
.sw-text { flex: 1; min-width: 0; display: grid; gap: 2px; }
.sw-title { font-weight: 700; }
.sw-text small { color: var(--muted); font-size: .92rem; }
.sw { flex: none; position: relative; width: 52px; height: 32px; border-radius: 999px; background: var(--muted); transition: background .15s; }
.sw::after { content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: var(--surface); box-shadow: 0 1px 3px rgb(0 0 0 / .3); transition: transform .15s; }
.switch[aria-checked="true"] .sw { background: var(--done); }
.switch[aria-checked="true"] .sw::after { transform: translateX(20px); }
.checks { display: grid; gap: 8px; }
.check { appearance: none; display: flex; align-items: center; gap: 12px; width: 100%; min-height: 54px; padding: 12px 14px; text-align: left; border-radius: 12px; border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); font-weight: 700; cursor: pointer; }
.box-i { flex: none; width: 28px; height: 28px; border-radius: 8px; border: 2px solid var(--muted); display: grid; place-items: center; color: transparent; }
.box-i svg { width: 18px; height: 18px; }
.check[aria-checked="true"] .box-i { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

/* Mis medicinas */
.page-head { display: grid; gap: 6px; padding-top: 4px; }
.page-head h1 { margin: 0; font-family: var(--font-display); font-weight: 800; font-size: 2.2rem; line-height: 1.05; }
.meds { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.med { appearance: none; display: flex; align-items: center; gap: 14px; width: 100%; padding: 16px; text-align: left; border-radius: var(--radius); border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; }
.med:hover { border-color: var(--muted); }
.med-ico { flex: none; width: 50px; height: 50px; border-radius: 14px; display: grid; place-items: center; background: var(--surface-2); color: var(--ink); }
.med-ico.t-inyeccion { background: var(--accent-soft); color: var(--accent-ink); }
.med-text { flex: 1; min-width: 0; display: grid; gap: 3px; }
.med-name { font-weight: 700; font-size: 1.15rem; overflow-wrap: anywhere; }
.med-note { color: var(--muted); font-size: .95rem; overflow-wrap: anywhere; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.tag { padding: 3px 10px; border-radius: 999px; background: var(--paused-soft); color: var(--paused); font-size: .82rem; font-weight: 700; }
.tag.low { background: var(--late-soft); color: var(--late); }
.chev { flex: none; color: var(--muted); }
.restore { display: grid; gap: 12px; padding-top: 4px; }
.sig { text-align: center; color: var(--muted); font-size: .9rem; }

/* Resumen */
.sums { display: grid; gap: 12px; }
.stat { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; }
.stat b { font-family: var(--font-display); font-weight: 800; font-size: 3rem; line-height: .9; font-variant-numeric: tabular-nums; }
.stat span { padding-bottom: 4px; }
.stat-bits { display: flex; flex-wrap: wrap; gap: 6px 16px; color: var(--muted); }
.sum-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: .88rem; color: var(--muted); }
.sum-legend span { display: inline-flex; align-items: center; gap: 6px; }
.sum-legend .sq { width: 14px; height: 14px; }
.sum-head { display: flex; align-items: center; gap: 12px; }
.sum-title { flex: 1; min-width: 0; }
.sum-title p { margin-top: 2px; font-size: .95rem; }
.score { flex: none; text-align: right; line-height: 1; font-variant-numeric: tabular-nums; }
.score b { display: block; font-family: var(--font-display); font-weight: 800; font-size: 2rem; }
.score span { font-size: .9rem; color: var(--muted); }
.sq-wrap { width: max-content; max-width: 100%; display: grid; gap: 6px; }
.squares { display: grid; gap: 3px; }
.squares.n7 { grid-template-columns: repeat(7, minmax(0, 30px)); }
.squares.n14 { grid-template-columns: repeat(14, minmax(0, 30px)); }
.squares.n30 { grid-template-columns: repeat(30, minmax(0, 30px)); }
.sq { display: block; aspect-ratio: 1; border-radius: 4px; background: var(--surface-2); }
.sq.s-done { background: var(--done); }
.sq.s-partial { background: var(--done-soft); box-shadow: inset 0 0 0 2px var(--done); }
.sq.s-missed { background: transparent; box-shadow: inset 0 0 0 2px var(--late); }
.sq.s-skipped { background: var(--muted); }
.sq.s-paused { background: var(--paused-soft); box-shadow: inset 0 0 0 2px var(--paused); }
.sq.s-pending { background: transparent; box-shadow: inset 0 0 0 2px var(--muted); }
.sq.s-none { background: var(--line); transform: scale(.4); border-radius: 50%; }
.sq-axis { display: flex; justify-content: space-between; gap: 8px; font-size: .85rem; color: var(--muted); }
.plain { margin: 0; padding-left: 1.1em; display: grid; gap: 4px; }
.facts { margin: 0; display: grid; gap: 10px; }
.fact { display: grid; grid-template-columns: minmax(0, 8.5rem) minmax(0, 1fr); gap: 12px; align-items: baseline; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.fact:last-child { padding-bottom: 0; border-bottom: 0; }
.fact dt { font-weight: 700; }
.fact dd { margin: 0; overflow-wrap: anywhere; }
.notes { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.notes b { margin-right: 6px; }
.misslist { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.misslist li + li { border-top: 1px solid var(--line); }
.misslist button { appearance: none; border: 0; background: transparent; width: 100%; text-align: left; display: grid; gap: 2px; padding: 12px 0; cursor: pointer; color: var(--ink); }
.misslist .what { font-weight: 700; }

/* Calendario del mes */
.month-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.month-nav h2 { text-transform: capitalize; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal .dow { text-align: center; font-size: .8rem; font-weight: 700; color: var(--muted); padding-bottom: 2px; }
.cal button, .cal .pad { aspect-ratio: 1; min-width: 0; border-radius: 10px; }
.cal button { appearance: none; border: 2px solid transparent; background: var(--surface-2); color: var(--ink); font-weight: 700; font-variant-numeric: tabular-nums; cursor: pointer; display: grid; place-items: center; font-size: .95rem; }
.cal .c-done { background: var(--done); color: var(--on-done); }
.cal .c-partial { background: var(--done-soft); border-color: var(--late); }
.cal .c-missed { background: var(--late-soft); border-color: var(--late); color: var(--late); }
.cal .c-pending { background: var(--surface); border-color: var(--accent); }
.cal .c-future, .cal .c-none { background: transparent; color: var(--muted); font-weight: 400; }
.cal .c-today { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent); }
.cal-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: .85rem; color: var(--muted); }
.cal-legend span { display: inline-flex; align-items: center; gap: 6px; }
.cal-legend i { width: 14px; height: 14px; border-radius: 4px; display: inline-block; }
.cal-legend .l-done { background: var(--done); }
.cal-legend .l-partial { background: var(--done-soft); box-shadow: inset 0 0 0 2px var(--late); }
.cal-legend .l-missed { background: var(--late-soft); box-shadow: inset 0 0 0 2px var(--late); }

/* Barra de pestañas, hoja de edición, aviso */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--surface); border-top: 1px solid var(--line); padding: 6px 10px calc(6px + env(safe-area-inset-bottom, 0px)); }
.tabbar-in { max-width: var(--maxw); margin: 0 auto; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
/* La barra, como la de ¿Ontoy?: cada lugar es un objeto del universo con ojos y su palabra abajo.
   El activo va en su pastilla llena y en negritas; los otros voltean a verlo; todos parpadean juntos
   y el que eliges da un brinquito. */
.tab { appearance: none; border: 0; background: transparent; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 58px; border-radius: 14px; color: var(--muted); font-size: .8rem; font-weight: 600; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.tab-pastilla { width: 58px; height: 32px; display: grid; place-items: center; border-radius: 999px; transition: background .2s; }
.glifo { width: 28px; height: 28px; overflow: visible; }
.tab[aria-current="page"] { color: var(--accent-ink); font-weight: 700; }
.tab[aria-current="page"] .tab-pastilla { background: var(--accent-soft); }
.g-rosa { fill: var(--pili); }
.g-lila { fill: var(--jeri); }
.g-tinta { fill: var(--ink); }
.g-blanco { fill: #FFFFFF; }
.g-cuerpo { fill: #FFE1EC; stroke: var(--ink); stroke-width: 1.1; }
.g-anillos, .g-renglones { fill: none; stroke-width: 1.5; stroke-linecap: round; }
.g-anillos { stroke: var(--ink); }
.g-renglones { stroke: #FFFFFF; }
.g-pupilas { fill: var(--pupila-pj); transition: transform .25s; }
.tab.mira-der .g-pupilas { transform: translateX(.9px); }
.tab.mira-izq .g-pupilas { transform: translateX(-.9px); }
.g-ojos { transform-box: fill-box; transform-origin: center; animation: parpadeo-tab 5.2s infinite; }
@keyframes parpadeo-tab { 0%, 94%, 100% { transform: scaleY(1); } 96% { transform: scaleY(.1); } }
.glifo { transform-origin: 50% 100%; }
.tab.brinca .glifo { animation: brinco-tab .55s cubic-bezier(.2, 0, 0, 1); }
@keyframes brinco-tab { 0% { transform: translateY(0) scale(1, 1); } 20% { transform: translateY(0) scale(1.12, .86); } 50% { transform: translateY(-5px) scale(.94, 1.06); } 78% { transform: translateY(0) scale(1.06, .94); } 100% { transform: none; } }
@media (prefers-reduced-motion: reduce) { .g-ojos, .tab.brinca .glifo { animation: none; } .g-pupilas, .tab-pastilla { transition: none; } }

.sheet { position: fixed; inset: 0; z-index: 40; overflow-y: auto; overscroll-behavior: contain; background: var(--bg); }
.sheet-in { max-width: var(--maxw); margin: 0 auto; padding-inline: 16px; padding-bottom: calc(120px + env(safe-area-inset-bottom, 0px)); }
.sheet-head { position: sticky; top: 0; z-index: 3; display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; margin-inline: -16px; padding: calc(8px + env(safe-area-inset-top, 0px)) 8px 8px; background: var(--bg); border-bottom: 1px solid var(--line); }
.sheet-head .btn { justify-self: start; }
.sheet-head h2 { margin: 0; font-family: var(--font-display); font-weight: 800; font-size: 1.2rem; text-align: center; }
.sheet-body { display: grid; gap: 22px; padding-top: 20px; }
.sheet-foot { position: fixed; left: 0; right: 0; bottom: 0; z-index: 4; padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px)); background: var(--surface); border-top: 1px solid var(--line); }
.sheet-foot .in { max-width: calc(var(--maxw) - 32px); margin: 0 auto; }

.toast { position: fixed; left: 50%; bottom: calc(var(--tab-h) + 18px + env(safe-area-inset-bottom, 0px)); z-index: 60; transform: translateX(-50%); width: min(calc(100% - 32px), 528px); display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 8px 8px 16px; min-height: 56px; border-radius: 14px; background: var(--ink); color: var(--bg); font-weight: 700; box-shadow: var(--shadow); }
.toast-btn { appearance: none; border: 0; background: transparent; color: var(--bg); min-height: 44px; padding: 0 12px; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; flex: none; }

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

/* ─── Pili y Jeri ─── */
:root {
  --pili: #F2709F; --pili-cuerpo: #FFFFFF; --pili-borde: #F1B9CC;
  --jeri: #B49AF0; --jeri-vidrio: rgba(255, 255, 255, .62); --jeri-borde: #CDBAF5;
  --plastico: #FFF8FC; --plastico-borde: #E2D6F5; --tapon: #5E3A66;
  --pupila-pj: #2B1D26; --sombra-pj: rgba(90, 23, 52, .13);
}
@media (prefers-color-scheme: dark) { :root { --pili-borde: #F7C6D7; --sombra-pj: rgba(0, 0, 0, .35); } }
.pj-slot { position: relative; }
.pj-escena, .pj-capa { position: absolute; inset: 0; }
.pj-escena { overflow: hidden; }
.pj-2d { display: flex; align-items: flex-end; justify-content: center; gap: 4%; padding-bottom: 3%; }
.pj-2d svg { height: 80%; width: auto; }
.pj-escena.con-3d .pj-2d { visibility: hidden; }
.pj-3d canvas { display: block; cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.auth .pj-slot { height: 190px; margin: -6px -8px -4px; }
.pili-a { fill: var(--pili); }
.pili-b { fill: var(--pili-cuerpo); stroke: var(--pili-borde); stroke-width: 1.6; }
.pili-m { fill: var(--pili); }
.jeri-m, .jeri-liquido { fill: var(--jeri); }
.jeri-vidrio { fill: var(--jeri-vidrio); stroke: var(--jeri-borde); stroke-width: 1.6; }
.jeri-plastico { fill: var(--plastico); stroke: var(--plastico-borde); stroke-width: 1.4; }
.jeri-tapon { fill: var(--tapon); }
.jeri-tapa { fill: var(--pili); }
.jeri-rayas { fill: none; stroke: #FFFFFF; stroke-width: 1.7; stroke-linecap: round; opacity: .9; }
.pj-brillo { fill: #FFFFFF; opacity: .45; }
.pj-sombra { fill: var(--sombra-pj); }
.pj .ojo-blanco { fill: #FFFFFF; }
.pj .ojo-pupila { fill: var(--pupila-pj); }

/* ─── Barra del prototipo (solo existe en el prototipo) ─── */
.demo-bar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 30; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px 12px; padding: 8px 14px; background: var(--ink); color: var(--bg); font-size: .82rem; text-align: center; }
.demo-btn { border: 0; border-radius: 999px; padding: 6px 12px; background: var(--accent); color: var(--on-accent); font-weight: 700; font-size: .8rem; cursor: pointer; }

/* El aviso de abajo no estorba: los toques pasan a lo que hay debajo, menos en su botón (Deshacer). */
.toast { pointer-events: none; }
.toast-btn { pointer-events: auto; }
