/* Cuaderno de entreno — una pantalla de móvil.
   Paleta: azul de cinturón sobre gris frío; rojo solo para el esfuerzo fuerte del cardio. */
:root {
  --bg: #eef1f5;
  --surface: #ffffff;
  --surface-2: #f5f7fa;
  --ink: #131923;
  --muted: #5b6577;
  --line: #d9dfe8;
  --accent: #1f4fd1;
  --accent-ink: #ffffff;
  --accent-soft: #e2e9fc;
  --hot: #cf4325;
  --hot-soft: #fbe5df;
  --ok: #1b8a4c;
  --ok-soft: #dff2e7;
  --warn: #9a6210;
  --warn-soft: #fbefd8;
  --belt-tip: #131923;
  --font-display: "Barlow Condensed", "Arial Narrow", "Helvetica Neue", sans-serif;
  --font-body: "Barlow", -apple-system, "Helvetica Neue", Arial, sans-serif;
  --r: 14px;
  --tabs-h: 64px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c1117;
    --surface: #151c26;
    --surface-2: #1b2430;
    --ink: #e8edf4;
    --muted: #9aa6b8;
    --line: #283345;
    --accent: #7d9df6;
    --accent-ink: #0c1117;
    --accent-soft: #1b2949;
    --hot: #ff7b5c;
    --hot-soft: #3b1e18;
    --ok: #4cc585;
    --ok-soft: #142e1f;
    --warn: #e3ab4e;
    --warn-soft: #33270e;
    --belt-tip: #000000;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.45 var(--font-body);
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
h1, h2, h3 { text-wrap: balance; margin: 0; }
h1 { font: 700 34px/1.05 var(--font-display); letter-spacing: 0.2px; }
h3 { font: 600 20px/1.15 var(--font-display); letter-spacing: 0.2px; }
p { margin: 0; }
.num, .in, .t-big, .rb-t, .dn, .hr strong { font-variant-numeric: tabular-nums; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

#app { max-width: 560px; margin: 0 auto; min-height: 100%; }

/* ---------- cinturón (motivo de marca) ---------- */
.belt { display: inline-block; width: 26px; height: 9px; border-radius: 2px; background: var(--accent); position: relative; vertical-align: middle; }
.belt span { position: absolute; right: 3px; top: 0; bottom: 0; width: 8px; background: var(--belt-tip); }
.belt.big { width: 120px; height: 26px; border-radius: 4px; }
.belt.big span { width: 34px; right: 12px; }
.splash { display: grid; place-items: center; height: 100vh; }

/* ---------- pantallas de entrada ---------- */
.picker { padding: calc(env(safe-area-inset-top) + 48px) 20px 40px; display: grid; gap: 18px; }
.picker h1 { font-size: 40px; }
.people { display: grid; gap: 12px; }
.person { text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; display: grid; gap: 2px; border-left: 6px solid var(--accent); }
.person.soon { border-left-color: var(--line); }
.pname { font: 700 30px/1 var(--font-display); }
.ptag { color: var(--muted); }
.lead { color: var(--muted); max-width: 40ch; }
.needs { margin: 0; padding-left: 20px; display: grid; gap: 6px; }
.fine { color: var(--muted); font-size: 14px; }
.form { display: grid; gap: 8px; }
.form label { font-weight: 600; font-size: 14px; margin-top: 6px; }
.form input { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 13px 12px; font-size: 17px; }
.msg { background: var(--warn-soft); color: var(--warn); padding: 10px 12px; border-radius: 10px; font-size: 15px; }
.link { background: none; border: 0; color: var(--accent); padding: 8px 0; text-align: left; font-weight: 600; }
.link.muted { color: var(--muted); font-weight: 500; }
.link.center { display: block; margin: 4px auto 0; text-align: center; }

/* ---------- botones ---------- */
.primary { background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 12px; padding: 14px 18px; font-weight: 700; font-size: 17px; }
.primary.wide { width: 100%; }
.primary:disabled { opacity: 0.6; }
.ghost { background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 11px 14px; font-weight: 600; }
.small { background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; font-weight: 600; font-size: 15px; }
.icon { width: 44px; height: 44px; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.icon svg { width: 22px; height: 22px; }
.icon:disabled { opacity: 0.35; }

/* ---------- cabecera y pestañas ---------- */
.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(env(safe-area-inset-top) + 10px) 16px 10px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.who { background: none; border: 0; padding: 4px 0; display: flex; align-items: center; gap: 10px; font: 700 21px/1 var(--font-display); }
.sync { font-size: 13px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; text-align: right; }
.sync::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.sync.ok::before { background: var(--ok); }
.sync.wait::before { background: var(--accent); }
.sync.warn { color: var(--warn); }
.sync.warn::before { background: var(--warn); }

.view { padding: 14px 16px calc(var(--tabs-h) + env(safe-area-inset-bottom) + 90px); display: grid; gap: 14px; }
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(3, 1fr);
  max-width: 560px; margin: 0 auto;
  padding: 6px 8px calc(env(safe-area-inset-bottom) + 6px);
  background: var(--surface); border-top: 1px solid var(--line);
}
.tabs button { background: none; border: 0; display: grid; justify-items: center; gap: 2px; padding: 6px 0; color: var(--muted); font-size: 13px; font-weight: 600; }
.tabs svg { width: 24px; height: 24px; }
.tabs .on { color: var(--accent); }

/* ---------- semana y días ---------- */
.banner { background: var(--accent-soft); color: var(--ink); padding: 12px 14px; border-radius: 12px; font-weight: 500; }
.weeknav { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; gap: 10px; }
.wk { display: grid; justify-items: center; gap: 4px; }
.wk strong { font: 700 22px/1 var(--font-display); }
.phase { display: inline-block; font-size: 12px; font-weight: 700; letter-spacing: 0.4px; text-transform: uppercase; padding: 3px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.phase.p-adapt, small.p-adapt { color: var(--accent); }
.phase.p-adapt { background: var(--accent-soft); }
.phase.p-deload, small.p-deload { color: var(--warn); }
.phase.p-deload { background: var(--warn-soft); }
.phase.p-load, .phase.p-block2 { background: var(--ok-soft); color: var(--ok); }

.strip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.day {
  position: relative; display: grid; justify-items: center; gap: 1px; padding: 8px 0 7px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; min-height: 66px;
}
.dl { font-size: 12px; color: var(--muted); font-weight: 600; }
.dn { font: 600 18px/1.1 var(--font-display); }
.dt { font-size: 11px; font-weight: 700; color: var(--muted); }
.day.k-gym .dt { color: var(--accent); font-size: 13px; }
.day.today { border-color: var(--accent); }
.day.sel { background: var(--accent); border-color: var(--accent); }
.day.sel .dl, .day.sel .dn, .day.sel .dt { color: var(--accent-ink); }
.day .dot { position: absolute; top: 6px; right: 6px; width: 6px; height: 6px; border-radius: 50%; background: var(--ok); }

/* ---------- sesión ---------- */
.shead { display: grid; gap: 4px; padding-top: 4px; }
.eyebrow { font-size: 13px; font-weight: 700; letter-spacing: 0.5px; text-transform: uppercase; color: var(--muted); }
.sub { color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chip { font-size: 13px; font-weight: 600; padding: 4px 10px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); }
.note { padding: 12px 14px; border-radius: 12px; border-left: 4px solid var(--accent); background: var(--accent-soft); font-size: 15px; }
.note.p-deload { border-left-color: var(--warn); background: var(--warn-soft); }

.seg { display: flex; gap: 4px; padding: 4px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; }
.seg button { flex: 1; background: none; border: 0; border-radius: 9px; padding: 9px 4px; font-weight: 600; font-size: 15px; color: var(--muted); }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgb(0 0 0 / 0.12); }
.seg.ten { flex-wrap: wrap; }
.seg.ten button { flex: 1 0 17%; padding: 8px 0; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; display: grid; gap: 10px; }
.card.warm summary, .how summary { font-weight: 600; cursor: pointer; }
.card.warm ol { margin: 0; padding-left: 20px; display: grid; gap: 6px; color: var(--muted); font-size: 15px; }
.weigh { grid-template-columns: 1fr 84px auto auto; align-items: center; gap: 8px; }
.weigh label { font-weight: 600; font-size: 15px; }

.progressline { position: relative; height: 30px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); overflow: hidden; }
.progressline span { position: absolute; inset: 0 auto 0 0; background: var(--ok-soft); transition: width 0.3s; }
.progressline em { position: relative; display: block; text-align: center; line-height: 28px; font-style: normal; font-size: 14px; font-weight: 600; }

.ex { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 12px 12px; display: grid; gap: 10px; }
.ex header { display: grid; grid-template-columns: 36px 1fr; gap: 10px; align-items: start; }
.lbl { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; background: var(--accent-soft); color: var(--accent); font: 700 17px/1 var(--font-display); }
.exh { display: grid; gap: 2px; }
.meta { font-weight: 600; font-variant-numeric: tabular-nums; }
.meta2 { font-size: 14px; color: var(--muted); }
.last { font-size: 14px; color: var(--muted); background: var(--surface-2); border-radius: 8px; padding: 6px 10px; }
.up { font-size: 14px; font-weight: 700; color: var(--ok); background: var(--ok-soft); border-radius: 8px; padding: 6px 10px; }
.sets { display: grid; gap: 6px; }
.set { display: grid; grid-template-columns: 22px 1fr auto 1fr auto 48px; align-items: center; gap: 6px; }
.set:has([data-field="secs"]) { grid-template-columns: 22px 1fr auto 48px; }
.sn { font: 600 16px/1 var(--font-display); color: var(--muted); text-align: center; }
.u { font-size: 13px; color: var(--muted); }
.in {
  width: 100%; min-width: 0; height: 44px; padding: 0 10px; text-align: center;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; font-size: 18px; font-weight: 600;
}
.in::placeholder { color: var(--muted); opacity: 0.55; font-weight: 500; }
.in.bad { border-color: var(--hot); background: var(--hot-soft); }
.tick { width: 48px; height: 44px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--surface); display: grid; place-items: center; color: var(--muted); }
.tick svg { width: 24px; height: 24px; }
.set.done .tick { background: var(--ok); border-color: var(--ok); color: #fff; }
.set.done .in { background: var(--ok-soft); border-color: transparent; }
.how { font-size: 15px; }
.how p { margin-top: 8px; color: var(--muted); }
.how p strong { color: var(--ink); }
.alt { font-size: 14px; }

/* ---------- cardio ---------- */
.cardio { border-left: 5px solid var(--hot); }
.hrrow { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.hr { border-radius: 12px; padding: 10px 12px; display: grid; gap: 0; }
.hr span { font-size: 13px; font-weight: 600; }
.hr strong { font: 700 30px/1.1 var(--font-display); }
.hr em { font-style: normal; font-size: 13px; color: var(--muted); }
.hr.hot { background: var(--hot-soft); }
.hr.hot span, .hr.hot strong { color: var(--hot); }
.hr.easy { background: var(--surface-2); }
.fields { display: grid; gap: 10px; }
.fields label, .flabel { display: grid; gap: 4px; font-size: 14px; font-weight: 600; }
.fields .in { text-align: left; font-size: 17px; }
.levels { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.levels .in { text-align: center; }

/* ---------- BJJ y descanso ---------- */
.q { font-weight: 600; font-size: 15px; }
.tips p { color: var(--muted); font-size: 15px; }
.tips strong { color: var(--ink); }
.nextup { text-align: left; font-size: 16px; }

/* ---------- plan ---------- */
.pgrid { display: grid; gap: 5px; }
.prow { display: grid; grid-template-columns: 64px repeat(3, 1fr); gap: 5px; align-items: stretch; }
.prow.head span { font-size: 13px; font-weight: 700; color: var(--muted); text-align: center; }
.prow.cur .pw { color: var(--accent); }
.pw { display: grid; align-content: center; font: 700 20px/1 var(--font-display); }
.pw small { font: 600 11px/1.2 var(--font-body); color: var(--muted); text-transform: uppercase; letter-spacing: 0.3px; }
.cell { position: relative; display: grid; justify-items: center; gap: 0; padding: 8px 0; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.cell strong { font: 700 20px/1 var(--font-display); }
.cell em { font-style: normal; font-size: 11px; font-weight: 700; color: var(--hot); }
.cell.now { border: 2px solid var(--accent); }
.cell.done { background: var(--ok-soft); border-color: transparent; }
.cell i { position: absolute; top: 4px; right: 4px; width: 16px; height: 16px; color: var(--ok); }
.cell i svg { width: 16px; height: 16px; }
.phases { display: grid; gap: 10px; }
.phaseinfo { display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; align-items: center; }
.phaseinfo p { grid-column: 1 / -1; color: var(--muted); font-size: 15px; }
.pweeks { font-size: 13px; color: var(--muted); font-weight: 600; }
.settings input[type="date"] { background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: 17px; width: 100%; }
.settings label { font-weight: 600; font-size: 15px; }
.acct { display: grid; gap: 8px; border-top: 1px solid var(--line); padding-top: 12px; }

/* ---------- progreso ---------- */
.spark { width: 100%; height: auto; display: block; }
.spark .axis { stroke: var(--line); stroke-width: 1; }
.spark .area { fill: var(--accent-soft); }
.spark .lineq { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.spark .endpt { fill: var(--accent); stroke: var(--surface); stroke-width: 2; }
.spark text { font: 600 12px var(--font-body); fill: var(--muted); }
.spark .lbl1 { fill: var(--ink); text-anchor: end; font-weight: 700; }
.spark .xl1 { text-anchor: end; }
.warnbox { background: var(--warn-soft); color: var(--warn); padding: 10px 12px; border-radius: 10px; font-size: 15px; font-weight: 500; }
.mini { width: 100%; border-collapse: collapse; font-size: 15px; }
.mini td, .mini th { padding: 7px 4px; border-bottom: 1px solid var(--line); text-align: left; }
.mini .num { text-align: right; font-weight: 600; }
.tscroll { overflow-x: auto; }
.tests th, .tests td { text-align: center; white-space: nowrap; }
.tests thead th { font-size: 12px; color: var(--muted); font-weight: 700; }
.bjjhist { display: grid; gap: 6px; }
.bw { display: flex; align-items: center; gap: 6px; }
.bw span { width: 34px; font-weight: 700; color: var(--muted); font-size: 14px; }
.r { font-size: 13px; padding: 3px 8px; border-radius: 999px; background: var(--hot-soft); color: var(--hot); }
.r.r3 { background: var(--warn-soft); color: var(--warn); }
.r.r0 { background: var(--ok-soft); color: var(--ok); }
select { width: 100%; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; font-size: 16px; }

/* ---------- descanso entre series ---------- */
.restbar {
  position: fixed; left: 0; right: 0; z-index: 25; max-width: 560px; margin: 0 auto;
  bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom) + 8px);
  padding: 0 12px;
}
.restbar[hidden] { display: none; }
.rb-in { position: relative; display: grid; grid-template-columns: 1fr auto auto; gap: 8px; align-items: center; background: var(--ink); color: var(--bg); border-radius: 14px; padding: 10px 12px; box-shadow: 0 6px 24px rgb(0 0 0 / 0.25); overflow: hidden; }
.rb-fill { position: absolute; left: 0; bottom: 0; height: 4px; background: var(--accent); transition: width 0.25s linear; }
.rb-in > div { display: grid; }
.rb-t { font: 700 30px/1 var(--font-display); }
.rb-n { font-size: 13px; opacity: 0.8; }
.rb-in .small { background: transparent; color: var(--bg); border-color: color-mix(in srgb, var(--bg) 35%, transparent); }

.flash {
  position: fixed; left: 50%; bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom) + 14px); z-index: 50; transform: translate(-50%, 12px);
  background: var(--accent); color: var(--accent-ink); padding: 9px 14px; border-radius: 12px; font-weight: 600; font-size: 15px;
  opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s; width: max-content; max-width: calc(100vw - 32px); text-align: center;
}
.flash.on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- temporizador a pantalla completa ---------- */
.timer { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: calc(env(safe-area-inset-top) + 20px) 20px calc(env(safe-area-inset-bottom) + 20px); background: var(--surface); color: var(--ink); }
.timer[hidden] { display: none; }
.timer.t-hard { background: var(--hot); color: #fff; }
.timer.t-easy, .timer.t-rec { background: var(--accent); color: var(--accent-ink); }
.t-in { width: 100%; max-width: 420px; display: grid; gap: 10px; text-align: center; }
.t-title { font-weight: 700; letter-spacing: 0.5px; text-transform: uppercase; font-size: 14px; opacity: 0.8; }
.t-phase { font: 700 30px/1.1 var(--font-display); }
.t-big { font: 700 112px/1 var(--font-display); letter-spacing: -1px; }
.t-target { font: 700 26px/1 var(--font-display); }
.t-hint { font-size: 17px; opacity: 0.9; max-width: 32ch; margin: 0 auto; }
.t-bar { height: 8px; border-radius: 999px; background: color-mix(in srgb, currentColor 22%, transparent); overflow: hidden; }
.t-bar span { display: block; height: 100%; background: currentColor; transition: width 0.2s linear; }
.t-next { font-size: 15px; opacity: 0.85; }
.t-btns { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.t-btns:has(> :only-child) { grid-template-columns: 1fr; }
.timer .ghost { background: color-mix(in srgb, currentColor 14%, transparent); border-color: color-mix(in srgb, currentColor 30%, transparent); color: inherit; }

.endpad { height: 8px; }

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