/* Reto 90 · interfaz estilo iOS. Operate: la tarea manda, el color solo marca acción y selección. */
:root {
  --bg: #f2f2f7; --surface: #ffffff; --surface-2: #f2f2f7;
  --label: #000000; --label-2: #56565c; --label-3: #6b6b70;
  --sep: rgba(60, 60, 67, .16); --fill: rgba(120, 120, 128, .14); --fill-2: rgba(120, 120, 128, .22);
  --accent: #bf3a06; --accent-text: #ffffff; --accent-soft: rgba(191, 58, 6, .10);
  --tri: #6a4bd8; --tri-soft: rgba(106, 75, 216, .12);
  --good: #147a3a; --good-soft: rgba(20, 122, 58, .13); --warn: #a35f00; --bad: #c8302a;
  --tab-h: 54px; --cta-h: 0px;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --shadow: 0 1px 2px rgba(0, 0, 0, .06), 0 6px 20px rgba(0, 0, 0, .08); --seg-on: #ffffff;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #000000; --surface: #1c1c1e; --surface-2: #2c2c2e;
    --label: #ffffff; --label-2: #b0b0b6; --label-3: #8e8e93;
    --sep: rgba(84, 84, 88, .6); --fill: rgba(120, 120, 128, .24); --fill-2: rgba(120, 120, 128, .36);
    --accent: #ff7a45; --accent-text: #1a0a02; --accent-soft: rgba(255, 122, 69, .17);
    --tri: #a791ff; --tri-soft: rgba(167, 145, 255, .17);
    --good: #4ade80; --good-soft: rgba(74, 222, 128, .15); --warn: #f5b041; --bad: #ff6b63;
    --shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 8px 24px rgba(0, 0, 0, .55); --seg-on: #636366;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; overscroll-behavior: none; scroll-padding-top: 60px; }
body {
  margin: 0; background: var(--bg); color: var(--label); min-height: 100dvh;
  font: 17px/1.35 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Roboto, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased; font-variant-numeric: tabular-nums;
}
button, input, select { font: inherit; color: inherit; }
button, a, [role="button"], [role="checkbox"] { touch-action: manipulation; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
input, select { font-size: 16px; }
a { color: var(--accent); text-decoration: none; }
::selection { background: var(--accent-soft); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
::-webkit-scrollbar { width: 0; height: 0; }

#app { max-width: 620px; margin: 0 auto; padding: 0 16px calc(var(--tab-h) + var(--cta-h) + env(safe-area-inset-bottom) + 32px); }
.page { animation: in .3s var(--ease); }
.page.back { animation: inback .26s var(--ease); }
@keyframes in { from { opacity: .0; transform: translateX(16px); } to { opacity: 1; transform: none; } }
@keyframes inback { from { opacity: .0; transform: translateX(-16px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .page, .page.back { animation: none; } .navbar, .nb-title, #rest, #toast { transition-duration: .01ms; } .bar > i { transition-duration: .01ms; } }
.page.still { animation: none; }

/* Barra de navegación: título grande que se comprime al hacer scroll */
.navbar { position: sticky; top: 0; z-index: 15; display: flex; align-items: center; height: calc(44px + env(safe-area-inset-top)); padding-top: env(safe-area-inset-top); margin: 0 -16px; padding-left: 8px; padding-right: 8px; transition: background .2s, box-shadow .2s; }
.navbar.scrolled { background: color-mix(in srgb, var(--bg) 78%, transparent); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); box-shadow: 0 .5px 0 var(--sep); }
.nb-title { position: absolute; left: 60px; right: 60px; text-align: center; font-weight: 600; font-size: 17px; opacity: 0; transform: translateY(4px); transition: all .2s var(--ease); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-top: env(safe-area-inset-top); pointer-events: none; }
.navbar.scrolled .nb-title { opacity: 1; transform: none; }
.nb-btn { display: inline-flex; align-items: center; gap: 2px; min-height: 44px; min-width: 44px; padding: 0 8px; border: 0; background: none; color: var(--accent); font-size: 17px; cursor: pointer; border-radius: 10px; z-index: 1; }
.nb-btn svg { width: 22px; height: 22px; }
.nb-btn.right { margin-left: auto; font-weight: 600; }
h1.large { font-size: 34px; line-height: 1.1; letter-spacing: -.022em; margin: 2px 0 4px; font-weight: 700; text-wrap: balance; }
.sub { color: var(--label-2); font-size: 15px; margin: 0 0 14px; }
h2.sec { font-size: 13px; text-transform: uppercase; letter-spacing: .03em; color: var(--label-2); font-weight: 500; margin: 24px 16px 7px; }
p.note { color: var(--label-2); font-size: 13px; margin: 8px 16px 0; line-height: 1.45; text-wrap: pretty; }

/* Listas agrupadas */
.group { background: var(--surface); border-radius: 12px; overflow: hidden; }
.row { display: flex; align-items: center; gap: 12px; padding: 11px 16px; min-height: 48px; position: relative; width: 100%; text-align: left; background: none; border: 0; color: inherit; }
.row + .row::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; height: .5px; background: var(--sep); }
button.row, a.row { cursor: pointer; transition: background .12s; }
@media (hover: hover) and (pointer: fine) { button.row:hover, a.row:hover { background: var(--fill); } }
button.row:active, a.row:active { background: var(--fill-2); }
.row .main { flex: 1; min-width: 0; }
.row .title { font-weight: 500; text-wrap: pretty; }
.row .meta { color: var(--label-2); font-size: 14px; margin-top: 1px; text-wrap: pretty; }
.row .val { color: var(--label-2); white-space: nowrap; }
.row .chev { width: 8px; height: 14px; color: var(--label-3); flex: none; }
.row.top { align-items: flex-start; }
.thumb { width: 56px; height: 56px; border-radius: 9px; object-fit: cover; background: var(--fill); flex: none; }
.badge { font-size: 12px; font-weight: 600; color: var(--accent); background: var(--accent-soft); padding: 3px 9px; border-radius: 99px; white-space: nowrap; }
.badge.good { color: var(--good); background: var(--good-soft); }
.pill { display: inline-block; padding: 1px 8px; border-radius: 99px; background: var(--fill); font-size: 12px; font-weight: 500; color: var(--label-2); vertical-align: 2px; }
.daycol { width: 44px; flex: none; font-weight: 600; font-size: 13px; color: var(--label-2); text-transform: uppercase; letter-spacing: .02em; }

/* Etiquetas de bloque: uniserie / biserie / triserie (texto + color, nunca solo color) */
.blk-head { display: flex; align-items: center; gap: 10px; padding: 10px 16px 6px; }
.chip { font-size: 12px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; padding: 3px 9px; border-radius: 6px; background: var(--fill); color: var(--label-2); }
.chip.bi { background: var(--accent-soft); color: var(--accent); }
.chip.tri { background: var(--tri-soft); color: var(--tri); }
.blk-head .info { color: var(--label-2); font-size: 14px; }
.blk-head .prog { margin-left: auto; font-size: 13px; color: var(--label-2); }
.blk-head .prog.done { color: var(--good); font-weight: 600; }
.letter { width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; font-weight: 700; font-size: 12px; background: var(--fill); color: var(--label-2); flex: none; }
.blk-gap { height: 10px; }
a.blk, button.blk { display: block; width: 100%; text-align: left; background: var(--surface); border: 0; border-radius: 12px; overflow: hidden; color: inherit; cursor: pointer; padding: 0; transition: background .12s; }
a.blk:active, button.blk:active { background: var(--fill-2); }
.blk .row { pointer-events: none; }

/* Botones */
.btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 50px; border-radius: 13px; border: 0; background: var(--accent); color: var(--accent-text); font-weight: 600; font-size: 17px; cursor: pointer; transition: transform .1s var(--ease), opacity .1s; }
.btn:active { transform: scale(.985); opacity: .88; }
.btn.secondary { background: var(--accent-soft); color: var(--accent); }
.btn.quiet { background: var(--fill); color: var(--label); }
.btn.small { min-height: 44px; width: auto; padding: 0 18px; font-size: 16px; }
.btn[disabled] { opacity: .4; pointer-events: none; }
.btn-wrap { margin: 14px 0 0; }
.cta-bar { position: fixed; left: 0; right: 0; z-index: 18; bottom: calc(var(--tab-h) + env(safe-area-inset-bottom)); padding: 10px 16px; display: flex; justify-content: center; background: color-mix(in srgb, var(--bg) 80%, transparent); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); box-shadow: 0 -.5px 0 var(--sep); }
.cta-bar .inner { width: 100%; max-width: 588px; display: flex; gap: 10px; }

/* Controles */
.seg { display: flex; background: var(--fill); border-radius: 11px; padding: 2px; gap: 2px; }
.seg button { flex: 1; min-height: 44px; border: 0; background: none; border-radius: 7px; font-weight: 500; font-size: 14px; cursor: pointer; color: var(--label); transition: background .15s, box-shadow .15s; }
.seg button[aria-pressed="true"] { background: var(--seg-on); box-shadow: 0 1px 3px rgba(0,0,0,.2); font-weight: 600; }
.switch { appearance: none; -webkit-appearance: none; width: 51px; height: 31px; border-radius: 99px; background: var(--fill-2); position: relative; flex: none; cursor: pointer; transition: background .2s; border: 0; margin: 0; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 2px 4px rgba(0,0,0,.28); transition: transform .2s var(--ease); }
.switch:checked { background: var(--good); }
.switch:checked::after { transform: translateX(20px); }
.row.check-row label { flex: 1; cursor: pointer; padding: 3px 0; }
.circle { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--fill-2); background: none; display: grid; place-items: center; flex: none; cursor: pointer; color: transparent; transition: all .15s var(--ease); padding: 0; }
.circle svg { width: 16px; height: 16px; }
.circle.on { background: var(--good); border-color: var(--good); color: #fff; }
.hit { width: 44px; height: 44px; display: grid; place-items: center; background: none; border: 0; cursor: pointer; margin: 0 -8px 0 -10px; flex: none; }
.stepper { display: flex; align-items: center; gap: 8px; }
.stepper button { width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--fill); font-size: 22px; font-weight: 500; cursor: pointer; line-height: 1; }
.stepper button:active { background: var(--fill-2); }
.stepper .v { min-width: 64px; text-align: center; font-weight: 600; }
.bar { height: 5px; background: var(--fill); border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; width: 100%; background: var(--accent); border-radius: 99px; transform: scaleX(var(--p, 0)); transform-origin: left; transition: transform .45s var(--ease); }
.bar.good > i { background: var(--good); }
.mini { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center; width: 100%; }
.mini .l { font-size: 14px; color: var(--label-2); } .mini .r { font-size: 14px; font-weight: 600; text-align: right; }
.mini .bar { grid-column: 1 / -1; }

/* Registro por vueltas */
.round { padding: 4px 0 8px; }
.round-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 16px 2px; }
.round-head b { font-size: 15px; }
.entry { display: grid; grid-template-columns: 26px 1fr 78px 78px; gap: 8px; align-items: center; padding: 5px 16px; }
.entry .nm { font-size: 15px; line-height: 1.2; min-width: 0; text-wrap: pretty; }
.entry .nm small { display: block; color: var(--label-2); font-size: 12px; margin-top: 1px; }
.entry input { width: 100%; height: 44px; border: 0; border-radius: 9px; background: var(--surface-2); text-align: center; font-weight: 600; -moz-appearance: textfield; padding: 0 2px; }
.entry input::-webkit-outer-spin-button, .entry input::-webkit-inner-spin-button { -webkit-appearance: none; }
.entry input::placeholder { color: var(--label-3); font-weight: 400; }
.entry-head { display: grid; grid-template-columns: 26px 1fr 78px 78px; gap: 8px; padding: 10px 16px 0; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--label-3); text-align: center; }
.entry-head span:nth-child(2) { text-align: left; }
.tick { width: 44px; height: 44px; border-radius: 50%; border: 2px solid var(--fill-2); background: none; display: grid; place-items: center; cursor: pointer; color: transparent; transition: all .15s var(--ease); padding: 0; flex: none; }
.tick svg { width: 18px; height: 18px; }
.tick[aria-pressed="true"] { background: var(--good); border-color: var(--good); color: #fff; }
.round.done .entry input { opacity: .65; }
.round + .round { border-top: .5px solid var(--sep); }
.strip { display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; margin: 0 -16px; padding: 0 16px; }

.strip .gif { aspect-ratio: 3 / 2; background: #fff; border-radius: 12px; overflow: hidden; display: flex; align-items: center; justify-content: center; }
.strip .gif img { width: 100%; height: 100%; object-fit: contain; }
.strip .cap { padding: 8px 2px 0; font-weight: 600; font-size: 15px; } .strip .cap small { display: block; font-weight: 400; color: var(--label-2); font-size: 13px; }
.gif-wrap { background: #fff; border-radius: 12px; overflow: hidden; aspect-ratio: 3 / 2; display: flex; align-items: center; justify-content: center; }
.gif-wrap img { width: 100%; height: 100%; object-fit: contain; }
.cues { margin: 0; padding: 0; list-style: none; counter-reset: c; }
.cues li { padding: 9px 16px 9px 44px; position: relative; font-size: 16px; text-wrap: pretty; }
.cues li + li { border-top: .5px solid var(--sep); }
.cues li::before { content: counter(c); counter-increment: c; position: absolute; left: 14px; top: 11px; width: 21px; height: 21px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 700; display: grid; place-items: center; }
.weight-line { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.weight-line .kg { font-size: 22px; font-weight: 700; }

/* Temporizador */
#rest { position: fixed; left: 50%; transform: translate(-50%, 20px); bottom: calc(var(--tab-h) + var(--cta-h) + env(safe-area-inset-bottom) + 12px); background: color-mix(in srgb, var(--surface) 88%, transparent); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); box-shadow: var(--shadow); border-radius: 99px; padding: 7px 7px 7px 18px; display: flex; align-items: center; gap: 10px; opacity: 0; pointer-events: none; transition: all .25s var(--ease); z-index: 30; white-space: nowrap; }
#rest.on { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
#rest .t { font-size: 22px; font-weight: 700; min-width: 54px; }
#rest .lbl { font-size: 13px; color: var(--label-2); }
#rest button { white-space: nowrap; border: 0; background: var(--fill); border-radius: 99px; min-height: 44px; padding: 0 14px; font-weight: 600; cursor: pointer; }

/* Pestañas */
#tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; justify-content: center; padding-bottom: env(safe-area-inset-bottom); background: color-mix(in srgb, var(--bg) 80%, transparent); -webkit-backdrop-filter: saturate(180%) blur(22px); backdrop-filter: saturate(180%) blur(22px); box-shadow: 0 -.5px 0 var(--sep); }
#tabs .inner { display: flex; width: 100%; max-width: 620px; }
#tabs a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: var(--tab-h); color: var(--label-3); font-size: 10.5px; font-weight: 500; padding-top: 4px; }
#tabs a svg { width: 25px; height: 25px; }
#tabs a[aria-current="page"] { color: var(--accent); }
#toast { position: fixed; left: 50%; top: calc(env(safe-area-inset-top) + 10px); transform: translate(-50%, -20px); background: var(--label); color: var(--bg); padding: 10px 18px; border-radius: 99px; font-size: 15px; font-weight: 600; opacity: 0; pointer-events: none; transition: all .25s var(--ease); z-index: 50; max-width: 90vw; text-align: center; }
#toast.on { opacity: 1; transform: translate(-50%, 0); }

/* Gráfica, formularios, prosa */
.chart { width: 100%; height: auto; display: block; }
.chart text { fill: var(--label-3); font-size: 10px; }
.chart .grid { stroke: var(--sep); stroke-width: .5; }
.chart .avg { stroke: var(--accent); stroke-width: 2.5; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.chart .pt { fill: var(--label-3); opacity: .5; }
.input-line { display: flex; gap: 10px; padding: 10px 16px; align-items: center; }
.input-line input { flex: 1; min-width: 0; height: 46px; border: 0; border-radius: 10px; background: var(--surface-2); padding: 0 14px; font-size: 18px; font-weight: 600; text-align: center; }
.input-line .btn { width: auto; flex: none; padding: 0 20px; }
.inline-num { width: 96px; height: 44px; border: 0; border-radius: 9px; background: var(--surface-2); text-align: center; font-weight: 600; }
.field { padding: 12px 16px; }
.field + .field { border-top: .5px solid var(--sep); }
.field label { display: block; font-size: 13px; color: var(--label-2); margin-bottom: 6px; }
.field input[type="date"], .field input[type="number"], .field select { width: 100%; height: 44px; border: 0; border-radius: 10px; background: var(--surface-2); padding: 0 12px; }
.field input[type="range"] { width: 100%; accent-color: var(--accent); }
.prose { padding: 14px 16px; font-size: 16px; line-height: 1.5; text-wrap: pretty; }
.prose p { margin: 0 0 10px; } .prose p:last-child { margin-bottom: 0; }
.prose ul { margin: 6px 0 10px; padding-left: 20px; } .prose li { margin: 5px 0; }
.prose strong { font-weight: 600; }
.empty { text-align: center; color: var(--label-2); padding: 26px 16px; font-size: 15px; }
.opt-radio { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--fill-2); flex: none; display: grid; place-items: center; margin-top: 1px; }
.opt-radio.on { border-color: var(--accent); background: var(--accent); }
.opt-radio.on::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent-text); }
.ing { margin: 6px 0 0; padding-left: 18px; color: var(--label-2); font-size: 14px; }
.trend { font-weight: 600; } .trend.good { color: var(--good); } .trend.warn { color: var(--warn); } .trend.flat { color: var(--label-2); }
@media (min-width: 700px) { h1.large { font-size: 40px; } }

/* Franja semanal (Hoy) */
.weekstrip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin: 14px -4px 0; }
.wd { display: flex; flex-direction: column; align-items: center; gap: 4px; background: none; border: 0; padding: 4px 0; cursor: pointer; min-height: 56px; border-radius: 12px; color: var(--label-2); }
.wd span { font-size: 12px; font-weight: 500; }
.wd i { font-style: normal; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-size: 15px; font-weight: 600; color: var(--label); background: var(--surface); }
.wd i svg { width: 16px; height: 16px; }
.wd.off i { background: none; color: var(--label-3); font-weight: 500; }
.wd.done i { background: var(--good); color: #fff; }
.wd.today i { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent); }
.wd.today span { color: var(--accent); font-weight: 700; }
.round.active { background: color-mix(in srgb, var(--accent) 5%, transparent); }
.chip.cardio { background: var(--good-soft); color: var(--good); }
@media (max-width: 359px) { .entry, .entry-head { grid-template-columns: 24px 1fr 66px 66px; } }

/* Semáforo de alimentos (siempre con texto: el color no es el único indicador) */
.semdot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 8px; vertical-align: 0; }
.semdot.verde { background: var(--good); } .semdot.amarillo { background: #b57d00; } .semdot.rojo { background: var(--bad); }

/* Colores de acento (todos con contraste ≥ 4.5:1 sobre el fondo y el texto del botón) */
:root[data-accent="azul"] { --accent: #0a5bd6; --accent-text: #ffffff; --accent-soft: rgba(10, 91, 214, .10); }
:root[data-accent="morado"] { --accent: #6a3fd1; --accent-text: #ffffff; --accent-soft: rgba(106, 63, 209, .10); --tri: #0f7c8a; --tri-soft: rgba(15, 124, 138, .12); }
:root[data-accent="rosa"] { --accent: #c2185b; --accent-text: #ffffff; --accent-soft: rgba(194, 24, 91, .10); }
@media (prefers-color-scheme: dark) {
  :root[data-accent="azul"]:not([data-theme="light"]) { --accent: #5aa9ff; --accent-text: #04121f; --accent-soft: rgba(90, 169, 255, .17); }
  :root[data-accent="morado"]:not([data-theme="light"]) { --accent: #b39bff; --accent-text: #120a2a; --accent-soft: rgba(179, 155, 255, .17); --tri: #5ad1de; --tri-soft: rgba(90, 209, 222, .15); }
  :root[data-accent="rosa"]:not([data-theme="light"]) { --accent: #ff7fa8; --accent-text: #2a0612; --accent-soft: rgba(255, 127, 168, .17); }
}
/* Retroalimentación al marcar */
@keyframes pop { 0% { transform: scale(.7); } 55% { transform: scale(1.15); } 100% { transform: scale(1); } }
.pop { animation: pop .28s var(--ease); }
@media (prefers-reduced-motion: reduce) { .pop { animation: none; } }

/* Cuestionario inicial */
.dots { display: flex; gap: 6px; margin: 4px 0 14px; }
.dots i { flex: 1; height: 4px; border-radius: 99px; background: var(--fill-2); transition: background .25s var(--ease); }
.dots i.on { background: var(--accent); }
:root.onb #tabs { display: none; }
:root.onb .cta-bar { bottom: 0; padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
:root.onb #app { padding-bottom: calc(var(--cta-h) + env(safe-area-inset-bottom) + 32px); }

/* Tira de ejercicios con acción "Cambiar" */
.strip .si { flex: 0 0 min(64%, 230px); scroll-snap-align: start; }
.strip .si > a:first-child { display: block; color: inherit; }
.strip a.link, a.link { display: inline-flex; align-items: center; min-height: 44px; padding: 0 2px; font-size: 15px; font-weight: 500; color: var(--accent); }

/* ───────── v9: estilo iOS más vivo ───────── */
:root { --water: #1a7fc4; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --water: #5ac0ff; } }

/* Segmentado con indicador que se desliza */
.seg { position: relative; isolation: isolate; gap: 0; }
.seg::before { content: ""; position: absolute; z-index: -1; top: 2px; bottom: 2px; left: 2px; width: calc((100% - 4px) / var(--n, 2)); transform: translateX(calc(var(--i, 0) * 100%)); background: var(--seg-on); border-radius: 9px; box-shadow: 0 1px 3px rgba(0, 0, 0, .2); transition: transform .34s var(--ease); }
.seg button, .seg button[aria-pressed="true"] { background: none; box-shadow: none; }
.seg button[aria-pressed="true"] { font-weight: 600; }

/* Hoja inferior */
.sheet-wrap { position: fixed; inset: 0; z-index: 60; pointer-events: none; }
.sheet-wrap.on { pointer-events: auto; }
.sheet-bd { position: absolute; inset: 0; background: rgba(0, 0, 0, .42); opacity: 0; transition: opacity .3s; -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.sheet-wrap.on .sheet-bd { opacity: 1; }
.sheet { position: absolute; left: 0; right: 0; bottom: 0; max-width: 620px; margin: 0 auto; max-height: 86dvh; display: flex; flex-direction: column; background: var(--bg); border-radius: 16px 16px 0 0; transform: translateY(105%); transition: transform .45s var(--ease); box-shadow: var(--shadow); padding-bottom: env(safe-area-inset-bottom); }
.sheet-wrap.on .sheet { transform: none; }
.sheet-top { touch-action: none; cursor: grab; }
.sheet-grab { width: 36px; height: 5px; border-radius: 99px; background: var(--fill-2); margin: 8px auto 0; }
.sheet-h { display: flex; align-items: center; justify-content: space-between; padding: 4px 8px 6px 16px; }
.sheet-h b { font-size: 17px; }
.sheet-b { overflow: auto; padding: 4px 16px 24px; overscroll-behavior: contain; }

/* Celebración */
.celebrate { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; pointer-events: none; opacity: 0; transition: opacity .25s; }
.celebrate.on { opacity: 1; }
.cel-card { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 28px 36px; border-radius: 26px; background: color-mix(in srgb, var(--surface) 90%, transparent); -webkit-backdrop-filter: saturate(180%) blur(24px); backdrop-filter: saturate(180%) blur(24px); box-shadow: var(--shadow); transform: scale(.8); transition: transform .55s var(--ease); }
.celebrate.on .cel-card { transform: none; }
.cel-card b { font-size: 19px; }
.cel-card svg { width: 76px; height: 76px; fill: none; stroke: var(--good); stroke-width: 3.4; stroke-linecap: round; stroke-linejoin: round; }
.cel-card circle { stroke-dasharray: 145; stroke-dashoffset: 145; animation: dash .6s .1s var(--ease) forwards; }
.cel-card path { stroke-dasharray: 40; stroke-dashoffset: 40; animation: dash .4s .5s var(--ease) forwards; }
@keyframes dash { to { stroke-dashoffset: 0; } }

/* Entradas con escalón, barras que crecen, check que se dibuja */
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
@keyframes grow { from { transform: scaleX(0); } }
@keyframes ringin { from { stroke-dashoffset: var(--c); } }
@keyframes draw { from { stroke-dashoffset: 24; } to { stroke-dashoffset: 0; } }
.page:not(.still) .group > .row, .page:not(.still) a.blk, .page:not(.still) .wd { animation: rise .5s var(--ease) both; }
.page:not(.still) .group > .row:nth-child(2) { animation-delay: .035s; } .page:not(.still) .group > .row:nth-child(3) { animation-delay: .07s; }
.page:not(.still) .group > .row:nth-child(4) { animation-delay: .105s; } .page:not(.still) .group > .row:nth-child(5) { animation-delay: .14s; }
.page:not(.still) .group > .row:nth-child(6) { animation-delay: .175s; } .page:not(.still) .group > .row:nth-child(n+7) { animation-delay: .21s; }
.page:not(.still) .wd:nth-child(2) { animation-delay: .03s; } .page:not(.still) .wd:nth-child(3) { animation-delay: .06s; } .page:not(.still) .wd:nth-child(4) { animation-delay: .09s; }
.page:not(.still) .wd:nth-child(5) { animation-delay: .12s; } .page:not(.still) .wd:nth-child(6) { animation-delay: .15s; } .page:not(.still) .wd:nth-child(7) { animation-delay: .18s; }
.page:not(.still) .bar > i { animation: grow .8s .1s var(--ease) both; }
.page:not(.still) .ring-fg { animation: ringin 1s .15s var(--ease) both; }
.page:not(.still) .chart .avg { stroke-dasharray: 1; stroke-dashoffset: 1; animation: dash 1.1s .15s var(--ease) forwards; }
.circle svg path, .tick svg path { stroke-dasharray: 24; stroke-dashoffset: 24; }
.circle.on svg path, .tick[aria-pressed="true"] svg path { stroke-dashoffset: 0; }
.pop svg path { animation: draw .35s .04s var(--ease) both; }
#tabs a.bump svg { animation: tabpop .45s var(--ease); }
@keyframes tabpop { 0% { transform: scale(.78); } 60% { transform: scale(1.16); } 100% { transform: scale(1); } }
#toast { transition: transform .5s var(--ease), opacity .25s; }
.blk:active { transform: scale(.992); }
@media (prefers-reduced-motion: reduce) {
  .page:not(.still) .group > .row, .page:not(.still) a.blk, .page:not(.still) .wd, .page:not(.still) .bar > i, .page:not(.still) .ring-fg, .page:not(.still) .chart .avg, .pop svg path, #tabs a.bump svg, .cel-card circle, .cel-card path { animation: none; }
  .page:not(.still) .chart .avg { stroke-dasharray: none; stroke-dashoffset: 0; } .cel-card circle, .cel-card path { stroke-dashoffset: 0; }
  .seg::before { transition-duration: .01ms; } .sheet, .sheet-bd { transition-duration: .01ms; }
}

/* Tarjeta "Ahora" y anillos del día */
.nowcard { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; margin-top: 14px; padding: 14px 16px; border: 0; border-radius: 16px; background: var(--accent); color: var(--accent-text); cursor: pointer; transition: transform .12s var(--ease); }
.nowcard:active { transform: scale(.985); }
.nowcard small { display: block; font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; opacity: .85; }
.nowcard b { display: block; font-size: 18px; line-height: 1.2; margin: 2px 0; }
.nowcard span { font-size: 14px; opacity: .92; }
.nowcard .chev { color: inherit; opacity: .8; margin-left: auto; }
.nowcard.done { background: var(--good-soft); color: var(--good); cursor: default; }
.rings-row { display: flex; align-items: center; gap: 16px; padding: 14px 16px; }
.rings { width: 108px; height: 108px; flex: none; }
.ring-bg { fill: none; stroke: var(--fill); stroke-width: 9; }
.ring-fg { fill: none; stroke-width: 9; stroke-linecap: round; transform: rotate(-90deg); transform-origin: 50% 50%; transition: stroke-dashoffset .8s var(--ease); }
.ring-legend { flex: 1; min-width: 0; display: grid; gap: 8px; }
.ring-legend div { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--label-2); }
.ring-legend b { color: var(--label); margin-left: auto; font-weight: 600; font-size: 14px; }
.ring-legend i { width: 9px; height: 9px; border-radius: 50%; flex: none; }

/* Calendario de constancia */
.cal-h { display: flex; align-items: center; justify-content: space-between; padding: 6px 8px 0; }
.cal-h b { font-size: 16px; }
.cal-h .nb-btn[disabled] { opacity: .3; pointer-events: none; }
.cal-w, .cal-g { display: grid; grid-template-columns: repeat(7, 1fr); padding: 0 8px; }
.cal-w span { text-align: center; font-size: 11px; font-weight: 600; color: var(--label-3); padding: 6px 0 2px; }
.cd { border: 0; background: none; min-height: 44px; padding: 0; display: grid; place-items: center; cursor: pointer; }
.cd i { font-style: normal; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-size: 14px; font-weight: 500; transition: background .2s, transform .2s var(--ease); }
.cd:active i { transform: scale(.9); }
.cd.part i { background: var(--accent-soft); color: var(--accent); }
.cd.done i { background: var(--accent); color: var(--accent-text); font-weight: 700; }
.cd.today i { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--label-3); }
.cd.out { opacity: .38; }
.cal-k { display: flex; gap: 16px; padding: 4px 16px 12px; font-size: 12px; color: var(--label-2); }
.kd { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; }
.kd.done { background: var(--accent); } .kd.part { background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }

/* Fotos, sparkline, esqueleto, varios */
.pgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.pth { position: relative; border: 0; padding: 0; border-radius: 10px; overflow: hidden; aspect-ratio: 3 / 4; cursor: pointer; background: var(--fill); }
.pth img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pth span { position: absolute; left: 0; right: 0; bottom: 0; padding: 14px 6px 5px; font-size: 11px; font-weight: 600; color: #fff; background: linear-gradient(transparent, rgba(0, 0, 0, .6)); text-align: left; }
.cmp { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0; }
.cmp figure { margin: 0; } .cmp img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 12px; display: block; }
.cmp figcaption { font-size: 12px; color: var(--label-2); padding: 4px 2px; }
.pfull { width: 100%; border-radius: 12px; display: block; }
.skel { height: 120px; border-radius: 12px; background: linear-gradient(90deg, var(--fill) 25%, var(--fill-2) 50%, var(--fill) 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.spark { width: 64px; height: 22px; flex: none; } .spark path { fill: none; stroke: var(--accent); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.dotpt { fill: var(--accent); }
.danger-soft { background: rgba(200, 48, 42, .12); color: var(--bad); }
button.link { border: 0; background: none; font: inherit; cursor: pointer; display: inline-flex; align-items: center; min-height: 44px; padding: 0 2px; font-size: 15px; font-weight: 500; color: var(--accent); }

.nowcard .chev { width: 10px; height: 17px; flex: none; }

h1.large:focus { outline: none; }

/* Documento del menú (pantalla e impresión) */
.print-doc { --pd-ink: #1c1c1e; --pd-mute: #6c6c70; --pd-line: #d9d9de; --pd-brand: #bf3a06; --pd-soft: #fbeee8; background: #fff; color: var(--pd-ink); border-radius: 14px; padding: 18px; margin-top: 8px; font-size: 13px; line-height: 1.4; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.pd-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; padding-bottom: 14px; background: linear-gradient(var(--pd-brand), var(--pd-brand)) bottom / 100% 3px no-repeat; }
.pd-kicker { margin: 0 0 4px; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--pd-brand); }
.print-doc h2 { margin: 0; font-size: 26px; line-height: 1.1; letter-spacing: -.02em; color: var(--pd-ink); } .print-doc h2 span { font-weight: 500; color: var(--pd-mute); font-size: 18px; }
.pd-meta { margin: 0; text-align: right; font-size: 11px; color: var(--pd-mute); }
.pd-stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin: 14px 0 8px; } .pd-stats div { background: var(--pd-soft); border-radius: 10px; padding: 8px 6px; text-align: center; } .pd-stats b { display: block; font-size: 16px; color: var(--pd-brand); } .pd-stats span { font-size: 10px; color: var(--pd-mute); }
.pd-note { margin: 6px 0 12px; font-size: 11px; color: var(--pd-mute); }
.pd-day { margin: 16px 0; break-inside: avoid; page-break-inside: avoid; }
.pd-day h3 { display: flex; align-items: center; gap: 8px; margin: 0 0 6px; font-size: 16px; color: var(--pd-ink); } .pd-day h3 em { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%; background: var(--pd-brand); color: #fff; font: 700 12px/1 -apple-system, system-ui, sans-serif; } .pd-day h3 small { margin-left: auto; font-size: 10px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--pd-mute); }
.pd-day.rest h3 em { background: #8e8e93; }
.print-doc table { width: 100%; border-collapse: collapse; } .print-doc th, .print-doc td { text-align: left; vertical-align: top; padding: 6px 7px; font-size: 11.5px; border-bottom: .5px solid var(--pd-line); color: var(--pd-ink); }
.print-doc thead th { background: #f2f2f5; color: var(--pd-mute); font-size: 10px; letter-spacing: .05em; text-transform: uppercase; } .print-doc tbody tr:nth-child(even) td { background: #fafafb; }
.print-doc .n { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; } .print-doc td.dish { font-weight: 600; } .print-doc td.ing { color: var(--pd-mute); } .print-doc small { color: var(--pd-mute); font-weight: 400; }
.print-doc tfoot td { font-weight: 700; border-top: 1.5px solid var(--pd-ink); border-bottom: 0; background: var(--pd-soft); color: var(--pd-ink); }
.pd-h { margin: 22px 0 10px !important; font-size: 20px !important; padding-bottom: 9px; background: linear-gradient(var(--pd-brand), var(--pd-brand)) bottom / 100% 3px no-repeat; }
.pd-shop { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; } .pd-col h4 { margin: 0 0 6px; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--pd-brand); }
.pd-col ul { list-style: none; padding: 0; margin: 0; } .pd-col li { display: flex; align-items: center; gap: 8px; padding: 5px 0; border-bottom: .5px solid var(--pd-line); font-size: 12px; } .pd-col li i { flex: none; width: 11px; height: 11px; border: 1.2px solid #8e8e93; border-radius: 3px; } .pd-col li span { flex: 1; } .pd-col li b { font-weight: 600; text-align: right; }
.print-doc footer { margin-top: 18px; padding-top: 8px; border-top: .5px solid var(--pd-line); font-size: 10px; color: var(--pd-mute); }
@media screen and (max-width: 640px) {
  .pd-head { flex-direction: column; align-items: flex-start; } .pd-meta { text-align: left; } .pd-stats { grid-template-columns: repeat(3, 1fr); }
  .print-doc table, .print-doc tbody, .print-doc tr, .print-doc tfoot { display: block; } .print-doc thead { display: none; }
  .print-doc tr { padding: 8px 0; border-bottom: .5px solid var(--pd-line); } .print-doc td, .print-doc tbody tr:nth-child(even) td { display: block; border: 0; padding: 1px 0; background: none; }
  .print-doc td:nth-child(1) { font-weight: 600; } .print-doc td:nth-child(1) small { margin-left: 6px; } .print-doc td:nth-child(1) br { display: none; }
  .print-doc td:nth-child(n+4) { display: inline-block; margin: 3px 12px 0 0; color: var(--pd-mute); text-align: left; }
  .print-doc td:nth-child(4)::after { content: " kcal"; } .print-doc td:nth-child(5)::before { content: "P "; } .print-doc td:nth-child(6)::before { content: "C "; } .print-doc td:nth-child(7)::before { content: "G "; }
  .print-doc tfoot tr { background: var(--pd-soft); padding: 8px; border-radius: 8px; } .print-doc tfoot td:first-child { display: block; } .print-doc tfoot td { background: none; border: 0; }
}
@media print {
  @page { size: A4; margin: 11mm; }
  html, body { background: #fff !important; color: #000 !important; }
  #tabs, .navbar, .cta-bar, #toast, #rest, .noprint, h1.large, .sub { display: none !important; }
  .page { padding: 0 !important; animation: none !important; margin: 0 !important; }
  .print-doc { border-radius: 0; padding: 0; font-size: 10.5px; }
  .pd-day { margin: 0 0 7mm; } .pd-day:nth-of-type(2n) { break-after: page; page-break-after: always; }
  .pd-shopwrap { break-before: page; page-break-before: always; }
  .print-doc th, .print-doc td { padding: 4px 6px; font-size: 10px; }
}
/* Respaldo para navegadores sin color-mix (Android antiguo) */
@supports not (background: color-mix(in srgb, red 50%, blue)) {
  .navbar.scrolled, .cta-bar, #tabs, #rest, .cel-card { background: var(--surface); }
}
/* Tema manual: Oscuro forzado (aunque el teléfono esté en claro) */
:root[data-theme="dark"] {
  --bg: #000000; --surface: #1c1c1e; --surface-2: #2c2c2e;
  --label: #ffffff; --label-2: #b0b0b6; --label-3: #8e8e93;
  --sep: rgba(84, 84, 88, .6); --fill: rgba(120, 120, 128, .24); --fill-2: rgba(120, 120, 128, .36);
  --accent: #ff7a45; --accent-text: #1a0a02; --accent-soft: rgba(255, 122, 69, .17);
  --tri: #a791ff; --tri-soft: rgba(167, 145, 255, .17);
  --good: #4ade80; --good-soft: rgba(74, 222, 128, .15); --warn: #f5b041; --bad: #ff6b63;
  --shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 8px 24px rgba(0, 0, 0, .55); --seg-on: #636366; --water: #5ac0ff;
}
:root[data-accent="azul"][data-theme="dark"] { --accent: #5aa9ff; --accent-text: #04121f; --accent-soft: rgba(90, 169, 255, .17); }
:root[data-accent="morado"][data-theme="dark"] { --accent: #b39bff; --accent-text: #120a2a; --accent-soft: rgba(179, 155, 255, .17); --tri: #5ad1de; --tri-soft: rgba(90, 209, 222, .15); }
:root[data-accent="rosa"][data-theme="dark"] { --accent: #ff7fa8; --accent-text: #2a0612; --accent-soft: rgba(255, 127, 168, .17); }
:root[data-theme="light"] { color-scheme: light; } :root[data-theme="dark"] { color-scheme: dark; }
.stats3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 14px 0 4px; }
.stats3 div { background: var(--surface); border-radius: 14px; padding: 12px 8px; text-align: center; box-shadow: var(--shadow); }
.stats3 b { display: block; font-size: 22px; font-weight: 700; letter-spacing: -.02em; } .stats3 span { font-size: 12px; color: var(--label-2); }
.navbar .gear { margin-left: auto; } .navbar .gear svg { width: 22px; height: 22px; }
.navbar .nb-btn.gear { padding: 8px; color: var(--accent); }
.share-canvas { width: 100%; height: auto; border-radius: 16px; box-shadow: var(--shadow); display: block; }
.field textarea { width: 100%; font: inherit; font-size: 16px; color: var(--label); background: var(--fill); border: 0; border-radius: 10px; padding: 10px 12px; resize: vertical; min-height: 64px; }
