:root {
  --bg: #0C1412; --surface: #17221F; --surface2: #1F2D29; --line: #30433A; --text: #F4F7EF; --muted: #A1B4AA;
  --accent: #C5F477; --accent-border: #647A47; --warn: #F2B15C;
  --display: 'Space Grotesk', ui-rounded, system-ui, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.4 Inter, system-ui, -apple-system, sans-serif; -webkit-text-size-adjust: 100%; }
a { color: var(--accent); }
button { font: inherit; color: inherit; }
h1, h2 { margin: 0; }

.screen { max-width: 480px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; }
/* El margen inferior del iPhone lo ponen el menú de abajo (.tabs) y los botones fijos (.foot); sin ellos, el contenido. */
.screen > .content:last-child { padding-bottom: calc(env(safe-area-inset-bottom) + 20px); }
.pad { padding: 24px 20px; }
.content { padding: 14px 20px 20px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.content.tight { gap: 8px; }

.bar { padding: calc(env(safe-area-inset-top) + 12px) 8px 0; display: flex; align-items: center; gap: 4px; }
.bar.top { padding-left: 20px; padding-top: calc(env(safe-area-inset-top) + 24px); }
.bar-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.bar h1 { font: 700 22px/28px var(--display); }
.bar.top h1 { font-size: 32px; line-height: 38px; letter-spacing: -0.5px; }
.eyebrow { font-size: 11px; letter-spacing: 1.5px; font-weight: 700; color: var(--muted); }
.eyebrow.dark { color: var(--bg); }
.icon-btn { width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; color: var(--text); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; }
.row { display: flex; align-items: center; gap: 12px; padding: 8px 12px 8px 8px; min-height: 56px; text-align: left; width: 100%; }
button.row { cursor: pointer; }
.row.link { text-decoration: none; color: var(--text); }
.row.dashed { border-style: dashed; background: transparent; }
.row.editing { border-color: var(--accent-border); }
.list { list-style: none; margin: 0; padding: 0; }
.list .row + .row { border-top: 1px solid var(--line); }
.stack { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.grow { flex: 1; min-width: 0; }
.col { display: flex; flex-direction: column; gap: 2px; }
.strong { font-weight: 600; }
.small { font-size: 13px; }
.muted { color: var(--muted); }
.accent { color: var(--accent); }
.warn { color: var(--warn); }
.center { text-align: center; }
.num { font: 600 17px var(--display); }
.num.big { font-size: 24px; line-height: 30px; font-weight: 700; }
.title { font: 700 20px/24px var(--display); }
.section { margin: 6px 0 0; font-size: 12px; letter-spacing: 1.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; }
.h2 { font: 700 20px/26px var(--display); margin-top: 8px; }

.art { flex-shrink: 0; display: flex; align-items: center; justify-content: center; border-radius: 12px; background: var(--surface2); border: 1px solid var(--line); }
.dot { width: 26px; height: 26px; border-radius: 13px; border: 2px solid var(--line); flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.dot.done { border: 0; background: var(--line); color: var(--text); }

.progress-wrap { padding: 16px 20px 0; display: flex; flex-direction: column; gap: 8px; }
.progress { height: 6px; border-radius: 3px; background: var(--surface2); overflow: hidden; }
.progress > div { height: 100%; background: var(--accent); border-radius: 3px; }

.resume { display: flex; align-items: center; gap: 12px; padding: 10px 14px 10px 10px; border-radius: 16px; background: var(--accent); color: var(--bg); text-decoration: none; }
.resume .art { background: var(--surface2); }

.equip { padding: 6px; min-height: 0; }
.goal { padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; }
.timer { padding: 0 6px 0 14px; min-height: 52px; }
.bar-track { flex: 1; height: 6px; border-radius: 3px; background: var(--bg); overflow: hidden; }
.bar-track > span { display: block; height: 100%; background: var(--muted); }
.text-btn { min-height: 44px; padding: 0 8px; border: 0; background: transparent; color: var(--text); font-weight: 600; font-size: 14px; cursor: pointer; }
.text-link { min-height: 44px; display: flex; align-items: center; padding: 0 8px; color: var(--text); font-weight: 600; font-size: 13px; text-decoration: none; }

.active { padding: 14px; background: var(--surface2); border-color: var(--accent-border); display: flex; flex-direction: column; gap: 12px; }
.fields { display: flex; gap: 10px; }
.field { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--muted); }
.stepper { display: flex; align-items: center; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; }
.stepper button { width: 44px; height: 48px; border: 0; background: transparent; display: flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; }
.stepper input { flex: 1; min-width: 0; width: 0; height: 48px; border: 0; background: transparent; color: var(--text); text-align: center; font: 700 22px var(--display); }
.rir { margin: 0; padding: 0; border: 0; }
.rir legend { padding: 0 0 6px; font-size: 12px; color: var(--muted); }
.rir-row { display: flex; gap: 6px; }
.rir-row button { flex: 1; height: 44px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); font: 600 16px var(--display); cursor: pointer; }
.rir-row button.wide { flex: 1.5; font: 600 13px Inter, system-ui, sans-serif; }
.rir-row button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--bg); }

.toggle { display: flex; align-items: center; gap: 12px; padding: 12px 14px; min-height: 64px; text-align: left; cursor: pointer; width: 100%; }
.toggle.warn-border { border-color: var(--warn); }
.switch { width: 48px; height: 28px; border-radius: 14px; background: var(--line); padding: 3px; display: flex; flex-shrink: 0; }
.switch::after { content: ''; width: 22px; height: 22px; border-radius: 11px; background: var(--muted); }
.toggle.on .switch { background: var(--warn); justify-content: flex-end; }
.toggle.on .switch::after { background: var(--bg); }
.conflict { display: flex; flex-direction: column; gap: 8px; padding: 12px; border: 1px solid var(--warn); border-radius: 12px; }
.conflict p { margin: 0; }
.choice { display: flex; flex-direction: column; gap: 6px; }
.choice button { min-height: 44px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); text-align: left; font-weight: 600; cursor: pointer; }
.earlier { border-color: var(--warn); padding: 10px 12px; }
.closed-day { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.closed-day .text-btn { padding: 0; color: var(--accent); }
.small-num { font-size: 14px; text-align: right; }
.card.note { margin: 0; padding: 12px 14px; font-size: 13px; line-height: 19px; color: var(--muted); }
.note-label { font-size: 13px; font-weight: 600; margin-top: 4px; }
textarea { width: 100%; min-height: 84px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; color: var(--text); font: 15px/21px Inter, system-ui, sans-serif; resize: vertical; }

.foot { position: sticky; bottom: 0; padding: 10px 20px max(12px, calc(env(safe-area-inset-bottom) - 6px)); background: var(--bg); border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; }
.links { min-height: 44px; display: flex; align-items: center; justify-content: center; gap: 6px; }
.links a { color: var(--text); font-weight: 600; font-size: 14px; text-decoration: none; }
.primary, .secondary { min-height: 52px; border-radius: 16px; display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 16px; font-weight: 700; text-decoration: none; cursor: pointer; width: 100%; }
.primary { background: var(--accent); color: var(--bg); border: 0; }
.primary:disabled { background: var(--surface2); color: var(--muted); }
.secondary { background: var(--surface2); color: var(--text); border: 1px solid var(--line); font-weight: 600; }
.alert { margin: 0; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--warn); color: var(--warn); font-size: 14px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.timer.done { padding-top: 6px; padding-bottom: 6px; }

/* Pestañas de abajo */
/* El menú entra un poco en la zona del borde inferior del iPhone (como las barras nativas): si no, queda alto. */
.tabs { position: sticky; bottom: 0; display: flex; border-top: 1px solid var(--line); padding: 6px 8px max(6px, calc(env(safe-area-inset-bottom) - 12px)); background: var(--bg); }
.tab { flex: 1; min-height: 44px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--muted); text-decoration: none; font-size: 11px; font-weight: 600; }
.tab.on { color: var(--accent); }

/* Rutina (pantallas 21, 22 y 25) */
.art-missing { font-size: 10px; color: var(--muted); text-align: center; padding: 0 4px; }
.stepper-value { flex: 1; min-width: 0; text-align: center; font: 700 20px var(--display); }
.stepper button:disabled { opacity: 0.35; cursor: default; }
.week { display: flex; justify-content: space-between; padding: 0 2px 4px; }
.week span { width: 40px; display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.week span.gym { color: var(--text); font-weight: 700; }
.week span.today { color: var(--accent); font-weight: 700; }
.week i { width: 8px; height: 8px; border-radius: 4px; }
.week .gym i { background: var(--text); }
.week .today.gym i { background: var(--accent); }
.day-card { padding: 14px 16px; display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--text); }
.day-card.today { background: var(--surface2); border-color: var(--accent); }
.day-card .title { font-size: 18px; }
.plan-row { display: flex; flex-direction: column; gap: 10px; padding: 8px 4px 8px 8px; }
.plan-row.open { background: var(--surface2); border-color: var(--accent-border); padding-bottom: 12px; }
.plan-head { display: flex; align-items: center; gap: 12px; }
.icon-only { width: 44px; height: 44px; border: 0; background: transparent; color: var(--muted); display: flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; border-radius: 10px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; padding-right: 4px; }
.actions button { flex: 1 1 calc(50% - 4px); min-height: 44px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); font-weight: 600; font-size: 14px; display: flex; align-items: center; justify-content: center; gap: 6px; cursor: pointer; }
.actions button:disabled { opacity: 0.4; cursor: default; }
.actions .danger { border-color: var(--warn); color: var(--warn); }
.plan-edit { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding-right: 4px; }
.plan-edit .field.wide { grid-column: 1 / -1; }
.add-row { min-height: 48px; display: flex; align-items: center; justify-content: center; gap: 8px; border: 1px dashed var(--line); border-radius: 14px; text-decoration: none; font-weight: 600; font-size: 14px; background: transparent; color: var(--accent); cursor: pointer; width: 100%; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips button { min-height: 44px; min-width: 44px; padding: 0 14px; border-radius: 22px; border: 1px solid var(--line); background: transparent; font-weight: 600; font-size: 14px; cursor: pointer; }
.chips button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--bg); }
.chips button:disabled { opacity: 0.35; cursor: default; }
.text-input { width: 100%; height: 50px; padding: 0 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; color: var(--text); font: 500 16px Inter, system-ui, sans-serif; }
.text-input:focus { border-color: var(--accent-border); outline: none; }
select.text-input { appearance: none; -webkit-appearance: none; }
.label { font-size: 13px; color: var(--muted); }
.pick { display: flex; align-items: center; gap: 12px; padding: 6px 14px 6px 6px; border: 0; background: transparent; text-align: left; width: 100%; cursor: pointer; min-height: 76px; }
.list .pick + .pick { border-top: 1px solid var(--line); }
.pick[aria-pressed="true"] { background: var(--surface2); }
.check { width: 24px; height: 24px; border-radius: 12px; background: var(--accent); color: var(--bg); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.banner { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; border: 1px solid var(--accent-border); border-radius: 14px; background: var(--surface2); }
.banner .row-btns { display: flex; gap: 8px; }
.banner .row-btns > * { flex: 1; min-height: 44px; }
.cancel-bar { padding: calc(env(safe-area-inset-top) + 12px) 12px 0; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cancel-bar h1 { font: 700 18px var(--display); }
.cancel-bar .spacer { width: 72px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.text-btn.accent { color: var(--accent); }
.text-btn.warn { color: var(--warn); }
.variant-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.variant-card { padding: 10px 12px; display: flex; flex-direction: column; gap: 3px; background: var(--bg); }

/* Progreso (pantallas 26, 27, 32 y 33) */
.gap8 { gap: 8px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat { padding: 12px 12px; display: flex; flex-direction: column; gap: 2px; }
.stat .num.big { font-size: 28px; line-height: 32px; }
.segmented { display: flex; padding: 4px; background: var(--surface); border-radius: 12px; }
.segmented a { flex: 1; min-height: 40px; border-radius: 9px; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 14px; font-weight: 600; text-decoration: none; }
.segmented a[aria-current="page"] { background: var(--line); color: var(--text); }
.group-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.group-head .section { margin: 0; }
.section.accent { color: var(--accent); }
.chart-card { padding: 14px 14px 10px; display: flex; flex-direction: column; gap: 8px; }
.chart { width: 100%; height: auto; display: block; }
.stat-row { padding: 12px 14px; display: flex; align-items: baseline; gap: 10px; }
.stat-row .num { flex: 1; }
.session { padding: 4px 4px 4px 14px; min-height: 60px; }
.when { width: 52px; flex-shrink: 0; font-size: 13px; }
.sheet { margin: auto auto 0; width: 100%; max-width: 480px; max-height: 90dvh; padding: 0; color: var(--text); background: var(--surface); border: 0; border-top: 1px solid var(--line); border-radius: 24px 24px 0 0; }
.sheet::backdrop { background: rgba(5, 9, 8, 0.72); }
.sheet-body { padding: 12px 20px calc(env(safe-area-inset-bottom) + 24px); display: flex; flex-direction: column; gap: 12px; }
.sheet .grip { align-self: center; width: 40px; height: 4px; border-radius: 2px; background: var(--line); }
.sheet .h2 { margin: 4px 0 0; }
.sheet p { margin: 0; line-height: 20px; }
.sheet-box { padding: 12px; background: var(--bg); border-radius: 12px; display: flex; flex-direction: column; gap: 2px; }
.danger-btn { min-height: 52px; border-radius: 16px; border: 1px solid var(--warn); background: transparent; color: var(--warn); font-size: 16px; font-weight: 700; cursor: pointer; width: 100%; }
.list > li + li { border-top: 1px solid var(--line); }
.right { text-align: right; }

/* Copia de seguridad (pantallas 34 y 36) */
.mono { font-family: ui-monospace, Menlo, monospace; letter-spacing: 1px; }
.recovery { display: block; padding: 12px; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; font: 600 15px/24px ui-monospace, Menlo, monospace; letter-spacing: 0.5px; word-break: break-all; user-select: all; }
.code-row { padding: 0 12px 12px 0; }
.code-row .recovery { margin-left: 12px; }
.code-row > .row { border: 0; background: transparent; }
.file-pick { position: relative; overflow: hidden; }
.file-pick input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.file-pick:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.preview { padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; border-color: var(--accent-border); }
.preview-cols { display: flex; gap: 12px; }
.preview-cols .divider { width: 1px; background: var(--line); }
.check-row { display: flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; }
.check-row input { width: 22px; height: 22px; accent-color: var(--warn); flex-shrink: 0; }
a.links { text-decoration: none; color: var(--text); font-weight: 600; }
.changes { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }

/* Alta y perfil (pantallas 01–08) */
.welcome { padding-top: calc(env(safe-area-inset-top) + 48px); gap: 20px; }
.brand { font: 700 16px var(--display); letter-spacing: 3px; color: var(--accent); }
.welcome-title { font: 700 36px/40px var(--display); letter-spacing: -1px; margin: 0; }
.welcome-steps { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 18px; }
.welcome-steps li { display: flex; gap: 16px; align-items: flex-start; }
.welcome-steps .n { width: 32px; height: 32px; border-radius: 16px; border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; flex-shrink: 0; font: 700 15px var(--display); }
.welcome-steps .n.on { border-color: var(--accent); color: var(--accent); }
.step-title { font: 700 28px/34px var(--display); letter-spacing: -0.5px; margin: 0; }
.step-count { white-space: nowrap; padding: 0 12px 0 4px; }
.bar .progress { height: 6px; }
.big-field { display: flex; align-items: center; gap: 12px; padding: 0 6px 0 16px; min-height: 72px; }
.big-field.bad { border-color: var(--warn); }
.big-field:focus-within { border-color: var(--accent); }
.big-field input { width: 110px; height: 56px; border: 0; background: transparent; color: var(--text); text-align: right; font: 700 30px var(--display); }
.big-field input:focus { outline: none; }
.big-field .unit { width: 40px; font-size: 15px; }
.field-error { margin: 0 4px; }
.option { display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 8px 16px; text-align: left; width: 100%; cursor: pointer; }
.option.on { background: var(--surface2); border-color: var(--accent); }
.radio { width: 24px; height: 24px; border-radius: 12px; border: 2px solid var(--line); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.radio.on { background: var(--accent); border-color: var(--accent); color: var(--bg); }
.seg-buttons { display: flex; gap: 8px; }
.seg-buttons button { flex: 1; min-height: 52px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); font-weight: 600; font-size: 14px; cursor: pointer; padding: 0 6px; }
.seg-buttons button[aria-checked="true"] { background: var(--accent); border-color: var(--accent); color: var(--bg); font-weight: 700; }
.week-pick { display: flex; justify-content: space-between; gap: 4px; }
.week-pick button { width: 44px; height: 44px; border-radius: 22px; border: 1px solid var(--line); background: transparent; font-weight: 600; font-size: 15px; cursor: pointer; padding: 0; }
.week-pick button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--bg); font-weight: 700; }
.equip-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.equip-grid button { min-height: 52px; padding: 6px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); text-align: left; font-weight: 600; font-size: 14px; cursor: pointer; }
.equip-grid button[aria-pressed="true"] { border-color: var(--accent); background: var(--surface2); color: var(--text); }
.row-add { display: flex; gap: 8px; align-items: center; }
.row-add .text-input { flex: 1; }
.small-btn { width: auto; min-height: 50px; padding: 0 16px; font-size: 15px; }
.import-row { padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }

/* App instalada en el iPhone: al abrir, iOS calcula mal el alto visible (100dvh) y el menú de abajo queda alto hasta
   que se desliza. Instalada no hay barras del navegador, así que se usa el alto completo (100vh) con la pantalla
   fija y el contenido deslizando adentro: el menú y los botones quedan siempre abajo. */
@media (display-mode: standalone) {
  html, body { height: 100vh; overflow: hidden; }
  .screen { height: 100vh; min-height: 0; }
  .screen > .content { flex: 1 1 0; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
  .tabs, .foot { position: static; flex-shrink: 0; }
}
.plain { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
