/* Pauta — porcelana fría, tinta marino y cobalto de banda elástica.
   Layout: columna única centrada (≤ 920px); tarjetas en rejilla de 2 en escritorio;
   barra de pestañas abajo en móvil, arriba en escritorio. */
:root {
  --bg: #EEF1F5;
  --surface: #FFFFFF;
  --surface-2: #F6F8FB;
  --ink: #142033;
  --muted: #5A677A;
  --line: #D8DEE8;
  --accent: #2B4ACB;
  --accent-ink: #FFFFFF;
  --accent-soft: #E3E8FB;
  --done: #12865C;
  --done-soft: #D6F0E4;
  --partial: #B77A0E;
  --partial-soft: #F7EACB;
  --danger: #B3352C;
  --skip: #9AA5B5;
  --heat-0: #E3E8EF;
  --heat-1: #C4E6D5;
  --heat-2: #86CCAA;
  --heat-3: #3FA77B;
  --heat-4: #0F7A52;
  --shadow: 0 1px 2px rgb(20 32 51 / .06), 0 8px 24px -12px rgb(20 32 51 / .18);
  --img-filter: none;

  --f-display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --f-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --r: 14px;
  --gutter: max(16px, env(safe-area-inset-left, 0px));
  --gutter-r: max(16px, env(safe-area-inset-right, 0px));
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0D131C;
    --surface: #151E2B;
    --surface-2: #1A2535;
    --ink: #E6EBF3;
    --muted: #94A1B5;
    --line: #26334A;
    --accent: #8098FF;
    --accent-ink: #0D131C;
    --accent-soft: #1F2A4D;
    --done: #3CC48E;
    --done-soft: #123A2B;
    --partial: #E5A93F;
    --partial-soft: #3A2D12;
    --danger: #F07C70;
    --skip: #5B6980;
    --heat-0: #1C2738;
    --heat-1: #173F31;
    --heat-2: #1E6B4D;
    --heat-3: #2A9C6D;
    --heat-4: #45D198;
    --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 10px 30px -14px rgb(0 0 0 / .6);
    --img-filter: brightness(.88) contrast(1.05);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 15px/1.5 var(--f-body);
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(84px + env(safe-area-inset-bottom, 0px));
}
img { max-width: 100%; display: block; }
svg { display: block; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }
:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.num { font-family: var(--f-display); font-variant-numeric: tabular-nums; }

.wrap {
  max-width: 920px;
  margin-inline: auto;
  padding-left: var(--gutter);
  padding-right: var(--gutter-r);
}
main.wrap { padding-block: 20px 40px; display: grid; gap: 28px; }

h1, h2, h3 { font-family: var(--f-display); text-wrap: balance; margin: 0; letter-spacing: -.01em; }
h1 { font-size: clamp(30px, 6vw, 44px); font-weight: 800; line-height: 1.05; letter-spacing: -.025em; }
h2 { font-size: 18px; font-weight: 700; }
h3 { font-size: 17px; font-weight: 700; line-height: 1.25; }
p { margin: 0; }
.eyebrow {
  font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 6px;
}
.eyebrow::first-letter { text-transform: uppercase; }
.lede { color: var(--muted); max-width: 62ch; margin-top: 8px; }
.lede strong { color: var(--ink); }

/* ---------- topbar / tabs */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top, 0px);
}
.topbar-in { display: flex; align-items: center; justify-content: space-between; height: 58px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font: 800 20px var(--f-display); letter-spacing: -.02em; }
.brand svg { width: 30px; height: 30px; color: var(--accent); }
.tabs { display: flex; gap: 4px; }
.tabs a {
  display: flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px;
  color: var(--muted); text-decoration: none; font-weight: 600; font-size: 14px;
}
.tabs a:hover { color: var(--ink); background: var(--surface-2); }
.tabs a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }
.tabs svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

@media (max-width: 640px) {
  /* backdrop-filter atraparía a la barra fija inferior */
  .topbar { backdrop-filter: none; -webkit-backdrop-filter: none; background: var(--bg); }
  .tabs {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    justify-content: space-around;
    background: var(--surface);
    border-top: 1px solid var(--line);
    padding: 6px max(8px, env(safe-area-inset-right, 0px)) calc(6px + env(safe-area-inset-bottom, 0px)) max(8px, env(safe-area-inset-left, 0px));
  }
  .tabs a { flex-direction: column; gap: 2px; font-size: 11px; padding: 6px 18px; border-radius: 12px; }
  .tabs svg { width: 24px; height: 24px; }
  .topbar-in { height: 52px; }
}
@media (min-width: 641px) { body { padding-bottom: 0; } }

/* ---------- buttons */
.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  border: 0; border-radius: 999px; padding: 10px 18px; font-weight: 600; font-size: 14px;
  text-decoration: none; transition: background .15s, transform .1s;
}
.btn:active { transform: scale(.97); }
.btn svg { width: 16px; height: 16px; fill: currentColor; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 88%, var(--ink)); }
.btn-soft { background: var(--accent-soft); color: var(--accent); }
.btn-soft:hover { background: color-mix(in srgb, var(--accent-soft) 70%, var(--accent) 12%); }
.btn-ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.btn-ghost:hover { background: var(--surface-2); }
.link-btn { background: none; border: 0; padding: 6px 2px; color: var(--muted); font-weight: 600; font-size: 14px; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line); }
.link-btn:hover { color: var(--ink); }
.icon-btn {
  width: 40px; height: 40px; display: grid; place-items: center; border-radius: 999px;
  border: 0; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); color: var(--ink);
}
.icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn:hover { background: var(--surface-2); }

.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; letter-spacing: .01em; white-space: nowrap;
}
.pill-done, .pill-on { background: var(--done-soft); color: var(--done); }
.pill-off { background: var(--surface-2); color: var(--muted); box-shadow: inset 0 0 0 1px var(--line); }
.pill-live { background: var(--accent-soft); color: var(--accent); }
.pill-live .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; animation: blink 1.6s ease-in-out infinite; }
@keyframes blink { 50% { opacity: .25; } }

/* ---------- notice */
.notice {
  display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-radius: var(--r);
  background: var(--partial-soft); color: var(--ink);
}
.notice div { display: grid; gap: 2px; min-width: 0; }
.notice-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- hero */
.hero {
  position: relative; overflow: hidden;
  display: grid; grid-template-columns: 1fr auto; gap: 24px; align-items: center;
  padding: 28px clamp(20px, 4vw, 36px);
  background: var(--surface); border-radius: 22px; box-shadow: var(--shadow);
}
.hero::after { /* la banda elástica: una curva suave detrás del botón */
  content: ""; position: absolute; right: -60px; top: 50%; width: 360px; height: 360px; translate: 0 -50%;
  border-radius: 50%; border: 28px solid var(--accent-soft); opacity: .7; pointer-events: none;
}
.hero-done::after { border-color: var(--done-soft); }
.hero-main, .hero-action { position: relative; z-index: 1; min-width: 0; }
.hero-main { display: grid; gap: 10px; justify-items: start; }
.hero-meta { color: var(--muted); display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.hero-action { display: grid; justify-items: center; gap: 6px; }
.clock {
  font: 500 clamp(44px, 11vw, 72px)/1 var(--f-mono); letter-spacing: -.04em;
  font-variant-numeric: tabular-nums; color: var(--ink);
}

.big-btn {
  width: 132px; height: 132px; border-radius: 50%; border: 0;
  display: grid; place-items: center; align-content: center; gap: 4px;
  font: 700 16px var(--f-display); letter-spacing: .01em;
  transition: transform .15s ease, box-shadow .2s;
}
.big-btn svg { width: 34px; height: 34px; fill: currentColor; }
.big-btn:active { transform: scale(.95); }
.big-start { background: var(--accent); color: var(--accent-ink); box-shadow: 0 12px 30px -10px color-mix(in srgb, var(--accent) 70%, transparent); }
.big-start:hover { transform: translateY(-2px); }
.big-start:disabled { background: var(--line); color: var(--muted); box-shadow: none; cursor: not-allowed; transform: none; }
.big-stop { background: var(--ink); color: var(--surface); box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 50%, transparent); animation: breathe 5s ease-in-out infinite; }
@keyframes breathe { /* ritmo de 5 s: el «mantenga 5 segundos» de la pauta */
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 40%, transparent); }
  50% { box-shadow: 0 0 0 18px color-mix(in srgb, var(--accent) 0%, transparent); }
}
.badge-done {
  width: 112px; height: 112px; border-radius: 50%; display: grid; place-items: center;
  background: var(--done); color: var(--surface);
  animation: pop .5s cubic-bezier(.2, 1.4, .4, 1) both;
}
.badge-done svg { width: 54px; height: 54px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
@keyframes pop { from { transform: scale(.6); } }

@media (max-width: 560px) {
  .hero { grid-template-columns: 1fr; text-align: left; padding-top: 24px; }
  .hero-action { justify-items: stretch; }
  .hero-action form:first-child { display: grid; justify-items: center; }
  .hero::after { right: -140px; top: auto; bottom: -200px; translate: none; }
  .hero-action .link-btn { justify-self: center; }
  .big-btn { width: 100%; height: 64px; border-radius: 999px; display: flex; align-items: center; justify-content: center; gap: 10px; font-size: 18px; }
  .hero-action form { text-align: center; }
  .big-btn svg { width: 24px; height: 24px; }
  .hero-action form { width: 100%; }
  .hero-action form:first-child { display: block; }
  .badge-done { width: 72px; height: 72px; justify-self: center; }
  .badge-done svg { width: 36px; height: 36px; }
}

/* ---------- week strip */
.week {
  display: grid; grid-template-columns: auto 1fr; gap: 16px 28px; align-items: center;
  padding: 18px 22px; background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow);
}
.strip { list-style: none; margin: 0; padding: 0; display: flex; gap: 8px; }
.day { display: grid; justify-items: center; gap: 4px; }
.day-l { font-size: 11px; font-weight: 600; color: var(--muted); letter-spacing: .04em; }
.day-dot {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  font: 600 13px var(--f-body); font-variant-numeric: tabular-nums;
  background: var(--surface-2); color: var(--muted); box-shadow: inset 0 0 0 1px var(--line);
}
.day-future .day-dot { background: transparent; opacity: .6; }
.day-done .day-dot { background: var(--done); color: var(--surface); box-shadow: none; }
.day-done svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.day-live .day-dot { background: var(--accent-soft); }
.day-partial .day-dot { background: var(--partial-soft); color: var(--partial); box-shadow: inset 0 0 0 2px var(--partial); }
.is-today .day-l { color: var(--accent); }
.is-today .day-dot { box-shadow: inset 0 0 0 2px var(--accent); color: var(--accent); }
.is-today.day-done .day-dot { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--done); color: var(--surface); }
.goal { display: grid; gap: 6px; min-width: 0; }
.goal p:first-child { font-weight: 500; }
.goal strong { font-size: 22px; font-weight: 800; margin-right: 2px; }
.bar { height: 8px; border-radius: 99px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); overflow: hidden; }
.bar span { display: block; height: 100%; border-radius: inherit; background: var(--done); transition: width .6s ease; }
@media (max-width: 640px) {
  .week { grid-template-columns: 1fr; padding: 16px; }
  .strip { justify-content: space-between; gap: 4px; }
  .day-dot { width: min(40px, 11vw); height: min(40px, 11vw); }
}

/* ---------- groups & cards */
.group { display: grid; gap: 14px; }
.group-h { display: flex; align-items: center; gap: 10px; }
.count {
  font: 600 12px var(--f-body); color: var(--muted); background: var(--surface);
  padding: 2px 9px; border-radius: 99px; box-shadow: inset 0 0 0 1px var(--line);
}
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 400px), 1fr)); gap: 16px; }
.card {
  display: grid; grid-template-rows: auto 1fr;
  background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden;
}
.card-img { border: 0; padding: 0; background: #fff; display: block; width: 100%; cursor: zoom-in; border-bottom: 1px solid var(--line); }
.card-img img { width: 100%; height: auto; filter: var(--img-filter); }
.card-body { display: grid; gap: 12px; align-content: start; padding: 14px 16px 16px; }
.chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 5px; height: 28px; padding: 0 11px; border-radius: 99px;
  font-size: 13px; font-weight: 600; background: var(--surface-2); color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--line); border: 0;
}
.chip-dose { font-family: var(--f-display); font-weight: 700; font-variant-numeric: tabular-nums; background: var(--ink); color: var(--surface); box-shadow: none; }
.chip-hold svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.chip-hold:not(:disabled) { background: var(--accent-soft); color: var(--accent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent); }
.chip-hold:not(:disabled):hover { background: var(--accent); color: var(--accent-ink); }
.chip-hold:disabled { cursor: default; color: var(--muted); }
.card-actions { display: flex; gap: 8px; }

.skipped { padding: 18px 20px; border-radius: var(--r); box-shadow: inset 0 0 0 1px var(--line); }
.skip-list { list-style: none; margin: 0; padding: 0; display: grid; }
.skip-list li { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 8px 0; border-top: 1px dashed var(--line); }
.skip-list li:first-child { border-top: 0; }
.skip-list li > span:first-child { text-decoration: line-through; text-decoration-color: var(--muted); }
.skipped .link-btn { justify-self: start; }

/* ---------- viewer dialog */
.viewer {
  width: min(960px, calc(100vw - 24px)); max-height: calc(100dvh - 24px);
  padding: 0; border: 0; border-radius: 18px; background: var(--surface); color: var(--ink);
  box-shadow: 0 30px 80px -20px rgb(0 0 0 / .5);
}
.viewer::backdrop { background: rgb(8 12 20 / .7); backdrop-filter: blur(4px); }
.viewer-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 12px 12px 20px; }
.viewer-body { background: #000; }
.viewer-body video { width: 100%; max-height: calc(100dvh - 110px); display: block; background: #000; }
.viewer-body img { width: 100%; background: #fff; }
.viewer[open] { animation: rise .22s ease-out; }
@keyframes rise { from { transform: translateY(12px); opacity: 0; } }

/* ---------- hold timer */
.hold {
  position: fixed; inset: 0; z-index: 50; display: grid; place-content: center; justify-items: center; gap: 14px;
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  text-align: center; padding: 24px;
}
.hold-ring { position: relative; width: min(260px, 70vw); aspect-ratio: 1; border: 0; background: none; padding: 0; color: var(--ink); }
.hold-ring svg { width: 100%; height: 100%; rotate: -90deg; }
.hold-track { fill: var(--surface); stroke: var(--line); stroke-width: 8; }
.hold-arc { fill: none; stroke: var(--accent); stroke-width: 8; stroke-linecap: round; stroke-dasharray: 326.7; stroke-dashoffset: 0; }
.hold-num { position: absolute; inset: 0; display: grid; place-items: center; font-size: clamp(64px, 20vw, 96px); font-weight: 800; }
.hold-name { font: 700 18px var(--f-display); }
.hold.is-done .hold-arc { stroke: var(--done); }
.hold.is-done .hold-num { color: var(--done); }

.toast {
  position: fixed; left: 50%; translate: -50% 0; bottom: calc(96px + env(safe-area-inset-bottom, 0px)); z-index: 40;
  background: var(--ink); color: var(--surface); padding: 12px 20px; border-radius: 999px; font-weight: 600;
  box-shadow: var(--shadow); animation: toast 3.6s ease forwards; white-space: nowrap;
}
@media (min-width: 641px) { .toast { bottom: 28px; } }
@keyframes toast { 0% { opacity: 0; transform: translateY(10px); } 10%, 85% { opacity: 1; transform: none; } 100% { opacity: 0; visibility: hidden; } }

/* ---------- page head */
.page-head { display: flex; justify-content: space-between; align-items: end; gap: 16px; flex-wrap: wrap; }
.month-nav { display: flex; gap: 8px; align-items: center; }

/* ---------- calendar */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.stat { display: grid; gap: 2px; padding: 14px 16px; background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); color: var(--muted); font-size: 13px; }
.stat .num { font-size: 30px; font-weight: 800; color: var(--ink); line-height: 1.1; }
.stat small { font-size: 15px; font-weight: 600; color: var(--muted); }
@media (max-width: 640px) { .stats { grid-template-columns: repeat(2, 1fr); } }

.cal { display: grid; gap: 6px; padding: 14px; background: var(--surface); border-radius: 20px; box-shadow: var(--shadow); }
.cal-row { display: grid; grid-template-columns: repeat(7, 1fr) 52px; gap: 6px; }
.cal-head span { text-align: center; font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: .06em; padding: 4px 0; }
.cell {
  position: relative; aspect-ratio: 1 / .92; border-radius: 12px; padding: 7px 8px;
  background: var(--surface-2); display: grid; align-content: space-between; min-width: 0;
}
.cell-n { font-size: 14px; font-weight: 600; color: var(--muted); }
.cell.is-outside { opacity: .35; }
.cell-future { background: transparent; box-shadow: inset 0 0 0 1px var(--line); }
.cell-done { background: var(--done); }
.cell-done .cell-n { color: var(--surface); }
.cell-mark { position: absolute; right: 7px; top: 7px; }
.cell-done .cell-mark svg { width: 18px; height: 18px; fill: none; stroke: var(--surface); stroke-width: 2.8; stroke-linecap: round; stroke-linejoin: round; }
.cell-min { font-size: 11px; font-weight: 600; color: color-mix(in srgb, var(--surface) 85%, transparent); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cell-partial { background: var(--partial-soft); box-shadow: inset 0 0 0 2px var(--partial); }
.cell-partial .cell-n { color: var(--partial); }
.cell-partial .cell-mark { width: 9px; height: 9px; border-radius: 50%; background: var(--partial); top: 10px; right: 10px; }
.cell-live { background: var(--accent-soft); }
.cell-live .cell-mark { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); top: 10px; right: 10px; animation: blink 1.6s ease-in-out infinite; }
.cell.is-today { box-shadow: inset 0 0 0 2px var(--accent); }
.cell.is-today .cell-n { color: var(--accent); }
.cell-done.is-today { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent); }
.cell-done.is-today .cell-n { color: var(--surface); }
.wk-col { text-align: center; }
.wk { display: flex; align-items: center; justify-content: center; border-radius: 12px; font-size: 13px; color: var(--muted); }
.wk .num { font-size: 18px; font-weight: 800; }
.wk-of { font-size: 12px; }
.wk-met { background: var(--done-soft); color: var(--done); }
.wk-missed .num { color: var(--danger); }
@media (max-width: 640px) {
  .cal { padding: 8px; gap: 4px; }
  .cal-row { gap: 4px; grid-template-columns: repeat(7, 1fr) 38px; }
  .cell { border-radius: 9px; padding: 5px; aspect-ratio: 1; }
  .cell-n { font-size: 12px; }
  .cell-min { display: none; }
  .cell-done .cell-mark { right: 50%; top: 55%; translate: 50% -50%; }
  .cell-done .cell-mark svg { width: 16px; height: 16px; }
  .wk .num { font-size: 15px; }
  .wk-of { display: none; }
}
.legend { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 20px; color: var(--muted); font-size: 13px; }
.legend li { display: flex; align-items: center; gap: 8px; }
.lg { width: 14px; height: 14px; border-radius: 4px; }
.lg-done { background: var(--done); }
.lg-partial { background: var(--partial-soft); box-shadow: inset 0 0 0 2px var(--partial); }
.lg-met { background: var(--done-soft); }
.total { margin-top: -12px; }

/* ---------- settings */
.cfg { display: grid; gap: 28px; }
.cfg-list { display: grid; background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; }
.cfg-row {
  display: grid; grid-template-columns: 112px minmax(0, 1fr) auto; gap: 16px; align-items: center;
  padding: 14px 16px; border-top: 1px solid var(--line); transition: background .2s;
}
.cfg-row:first-child { border-top: 0; }
.cfg-row.is-off { background: var(--surface-2); }
.cfg-row.is-off .cfg-thumb { opacity: .45; filter: grayscale(1); }
.cfg-thumb { width: 112px; aspect-ratio: 16 / 7; object-fit: cover; object-position: left top; border-radius: 8px; background: #fff; box-shadow: inset 0 0 0 1px var(--line); }
.cfg-info { display: grid; gap: 4px; min-width: 0; }
.cfg-name { font: 700 16px var(--f-display); cursor: pointer; }
.status { margin-top: 2px; }
.cfg-controls { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; justify-content: end; }

.switch { position: relative; display: inline-flex; cursor: pointer; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.switch-ui { width: 46px; height: 28px; border-radius: 99px; background: var(--line); position: relative; transition: background .2s; }
.switch-ui::after { content: ""; position: absolute; left: 3px; top: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--surface); box-shadow: 0 1px 3px rgb(0 0 0 / .25); transition: translate .2s; }
.switch input:checked + .switch-ui { background: var(--done); }
.switch input:checked + .switch-ui::after { translate: 18px 0; }
.switch input:focus-visible + .switch-ui { outline: 2.5px solid var(--accent); outline-offset: 2px; }

.days { display: flex; gap: 3px; border: 0; margin: 0; padding: 0; }
.daychip { position: relative; }
.daychip input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.daychip span {
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px;
  font-size: 12px; font-weight: 700; color: var(--muted); box-shadow: inset 0 0 0 1px var(--line); background: var(--surface);
}
.daychip input:checked + span { background: var(--accent-soft); color: var(--accent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 40%, transparent); }
.daychip input:focus-visible + span { outline: 2.5px solid var(--accent); outline-offset: 1px; }
.pause { display: grid; gap: 2px; font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.pause input { font-size: 14px; text-transform: none; letter-spacing: 0; padding: 5px 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); min-width: 0; }
.cfg-row.is-dirty { box-shadow: inset 3px 0 0 var(--accent); }

.savebar {
  position: sticky; bottom: calc(80px + env(safe-area-inset-bottom, 0px)); z-index: 15;
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 12px 12px 12px 18px; border-radius: 999px;
  background: var(--surface); box-shadow: var(--shadow), inset 0 0 0 1px var(--line);
}
.savebar.has-changes { box-shadow: var(--shadow), inset 0 0 0 2px var(--accent); }
@media (min-width: 641px) { .savebar { bottom: 16px; } }
@media (max-width: 760px) {
  .cfg-row { grid-template-columns: 80px minmax(0, 1fr); }
  .cfg-thumb { width: 80px; }
  .cfg-controls { grid-column: 1 / -1; justify-content: space-between; }
  .savebar { border-radius: 18px; padding: 10px 10px 10px 14px; }
  .savebar p { flex: 1 1 160px; }
}

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

/* ---------- molestias */
.pain { width: 100%; margin-top: 8px; }
.pain fieldset { border: 0; margin: 0; padding: 0; display: grid; gap: 10px; }
.pain legend { font-weight: 600; padding: 0; margin-bottom: 10px; }
.pain legend .muted { font-weight: 400; font-size: 13px; margin-left: 4px; }
.pain-scale { display: grid; grid-template-columns: repeat(11, minmax(0, 1fr)); gap: 4px; max-width: 520px; }
.pain-btn {
  height: 40px; border: 0; border-radius: 10px; font: 700 15px var(--f-display); font-variant-numeric: tabular-nums;
  background: var(--surface-2); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line);
  transition: background .15s, transform .1s;
}
.pain-btn:active { transform: scale(.94); }
.pain-btn.pain-lo:hover, .pain-btn.pain-lo.is-on { background: var(--done); color: var(--surface); box-shadow: none; }
.pain-btn.pain-mid:hover, .pain-btn.pain-mid.is-on { background: var(--partial); color: var(--surface); box-shadow: none; }
.pain-btn.pain-hi:hover, .pain-btn.pain-hi.is-on { background: var(--danger); color: var(--surface); box-shadow: none; }
.pain-btn.is-on { outline: 2px solid var(--ink); outline-offset: 2px; }
.pain .link-btn { padding: 0; font-size: 13px; }
@media (max-width: 420px) { .pain-btn { height: 36px; font-size: 13px; border-radius: 8px; } .pain-scale { gap: 3px; } }

.cell-foot { display: flex; align-items: end; justify-content: space-between; gap: 4px; min-width: 0; }
.cell-pain {
  display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 4px; border-radius: 6px;
  font: 700 11px var(--f-display); font-variant-numeric: tabular-nums; background: var(--surface); color: var(--ink);
}
.cell-pain.pain-lo { color: var(--done); }
.cell-pain.pain-mid { background: var(--partial-soft); color: var(--partial); }
.cell-pain.pain-hi { background: var(--danger); color: var(--surface); }
.legend .cell-pain { margin-right: -4px; }
.legend .cell-pain.pain-lo { box-shadow: inset 0 0 0 1px var(--line); }
.pain-txt-lo { color: var(--done) !important; }
.pain-txt-mid { color: var(--partial) !important; }
.pain-txt-hi { color: var(--danger) !important; }
@media (max-width: 640px) {
  .cell-foot { position: absolute; inset: auto 3px 3px auto; }
  .cell-pain { min-width: 16px; height: 16px; font-size: 10px; border-radius: 5px; padding: 0 3px; }
}

/* ---------- temporadas */
.seasons { display: grid; gap: 12px; padding: 18px 20px; background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); scroll-margin-top: 80px; }
.seasons-head { display: grid; gap: 4px; }
.flash { padding: 10px 14px; border-radius: 10px; background: var(--done-soft); color: var(--done); font-weight: 600; font-size: 14px; }
.preset-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.preset {
  display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 16px; border-radius: 12px;
  background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line);
}
.preset.is-active { background: var(--done-soft); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--done) 50%, transparent); }
.preset-info { display: grid; flex: 1; min-width: 0; }
.preset-info strong { font-family: var(--f-display); font-size: 16px; overflow-wrap: anywhere; }
.icon-sm { width: 34px; height: 34px; }
.icon-sm svg { width: 16px; height: 16px; }
.preset-new { display: flex; gap: 8px; flex-wrap: wrap; }
.preset-new input {
  flex: 1 1 200px; min-width: 0; padding: 9px 14px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); font-size: 15px;
}
.preset-new input:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 1px; }
.preset-new button:disabled { opacity: .5; cursor: not-allowed; }

.logout { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding-top: 8px; border-top: 1px solid var(--line); }

/* ---------- login */
.login { max-width: 380px; width: 100%; margin: 6vh auto 0; display: grid; gap: 12px; }
.login-mark svg { width: 52px; height: 52px; color: var(--accent); }
.login h1 { font-size: 32px; }
.login-form { display: grid; gap: 14px; margin-top: 12px; padding: 22px; background: var(--surface); border-radius: 18px; box-shadow: var(--shadow); }
.login-form label { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.login-form input {
  padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2);
  color: var(--ink); font-size: 16px; font-weight: 400;
}
.login-form input:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.btn-block { width: 100%; padding-block: 13px; font-size: 16px; margin-top: 4px; }
.form-error { padding: 10px 14px; border-radius: 10px; background: color-mix(in srgb, var(--danger) 14%, var(--surface)); color: var(--danger); font-size: 14px; font-weight: 500; }
.page-login { padding-bottom: 0; }

/* ---------- pausa */
.pill-paused { background: var(--partial-soft); color: var(--partial); }
.pill-paused svg { width: 12px; height: 12px; fill: currentColor; }
.hero-paused::after { border-color: var(--partial-soft); }
.hero-paused .clock { color: var(--muted); }
.hero-sub { margin-top: 4px; }
.hero-sub .btn svg { width: 14px; height: 14px; fill: currentColor; }
@media (max-width: 560px) {
  .hero-sub .btn { width: 100%; padding-block: 12px; font-size: 15px; }
}

/* ---------- ejercicios marcados */
.mark { display: inline-flex; gap: 4px; padding: 3px; border-radius: 999px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); }
.mark-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px; border: 0; border-radius: 999px;
  background: transparent; color: var(--muted); font-weight: 600; font-size: 14px; transition: background .15s, color .15s, transform .1s;
}
.mark-btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.mark-btn:hover { color: var(--ink); }
.mark-btn:active { transform: scale(.95); }
.mark-done[aria-pressed="true"] { background: var(--done); color: var(--surface); }
.mark-skip[aria-pressed="true"] { background: var(--skip); color: var(--surface); }
.card-actions { flex-wrap: wrap; align-items: center; justify-content: space-between; }

.card[data-ex-state] { transition: box-shadow .2s; }
.card[data-ex-state="done"] { box-shadow: var(--shadow), inset 0 0 0 2px var(--done); }
.card[data-ex-state="done"] .card-img { position: relative; }
.card[data-ex-state="done"] .card-img::after {
  content: ""; position: absolute; top: 10px; right: 10px; width: 30px; height: 30px; border-radius: 50%;
  background: var(--done) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 12.5l4 4L18 8' fill='none' stroke='white' stroke-width='2.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 20px no-repeat;
  box-shadow: 0 0 0 3px var(--surface);
}
.card[data-ex-state="skipped"] .card-img img { filter: var(--img-filter) grayscale(1); opacity: .45; }
.card[data-ex-state="skipped"] h3 { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--skip); }

/* barra segmentada: un tramo por ejercicio */
.progress-ex { display: grid; gap: 8px; width: 100%; max-width: 520px; }
.seg { display: flex; gap: 2px; height: 10px; }
.seg span { flex: 1; border-radius: 3px; background: var(--heat-0); transition: background .25s; }
.seg span:first-child { border-radius: 5px 3px 3px 5px; }
.seg span:last-child { border-radius: 3px 5px 5px 3px; }
.seg .seg-done { background: var(--done); }
.seg .seg-skipped { background: var(--skip); }
.seg-legend { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 13px; color: var(--muted); }
.seg-legend span { display: inline-flex; align-items: center; gap: 6px; }
.seg-legend b { color: var(--ink); font-family: var(--f-display); font-variant-numeric: tabular-nums; }
.key { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.key-done { background: var(--done); }
.key-skipped { background: var(--skip); }
.key-pending { background: var(--heat-0); box-shadow: inset 0 0 0 1px var(--line); }

/* ---------- ficha del día */
.crumb { color: var(--muted); text-decoration: none; }
.crumb:hover { color: var(--accent); }
.day-summary { display: grid; gap: 16px; padding: 20px; background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); }
.facts { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.facts li { display: grid; gap: 4px; align-content: start; justify-items: start; }
.fact-k { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.fact-v { font-size: 26px; font-weight: 800; line-height: 1.1; }
.fact-v small { font-size: 14px; color: var(--muted); font-weight: 600; }
@media (max-width: 560px) { .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.ex-list { list-style: none; margin: 0; padding: 0; display: grid; background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; }
.ex-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px 12px 16px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.ex-row:first-child { border-top: 0; }
.ex-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--heat-0); box-shadow: inset 0 0 0 1px var(--line); flex: none; }
.ex-row[data-ex-state="done"] .ex-dot { background: var(--done); box-shadow: none; }
.ex-row[data-ex-state="skipped"] .ex-dot { background: var(--skip); box-shadow: none; }
.ex-row[data-ex-state="skipped"] strong { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--skip); }
.ex-info { display: grid; flex: 1 1 200px; min-width: 0; }
.ex-info strong { font-family: var(--f-display); font-size: 16px; }
.empty { padding: 28px; border-radius: var(--r); box-shadow: inset 0 0 0 1px var(--line); display: grid; gap: 6px; }
.empty-t { font: 700 20px var(--f-display); }

/* calendario: enlace y barra de ejercicios */
a.cell { text-decoration: none; color: inherit; transition: transform .12s, filter .12s; }
a.cell:hover { transform: translateY(-1px); filter: brightness(1.05); }
.cell-bar { position: absolute; left: 6px; right: 6px; bottom: 4px; height: 3px; border-radius: 2px; background: color-mix(in srgb, var(--surface) 35%, transparent); overflow: hidden; }
.cell-bar span { display: block; height: 100%; background: var(--surface); border-radius: inherit; }
.lg-bar { position: relative; }
.lg-bar span { position: absolute; left: 2px; right: 5px; bottom: 2px; height: 2px; background: var(--surface); border-radius: 1px; }

/* ---------- progreso */
.segmented { display: inline-flex; gap: 2px; padding: 3px; border-radius: 999px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.segmented a { padding: 7px 14px; border-radius: 999px; color: var(--muted); text-decoration: none; font-weight: 600; font-size: 14px; white-space: nowrap; }
.segmented a:hover { color: var(--ink); }
.segmented a[aria-current="true"] { background: var(--ink); color: var(--surface); }
.panel { display: grid; gap: 16px; padding: 20px; background: var(--surface); border-radius: 20px; box-shadow: var(--shadow); min-width: 0; }
.panel-head { display: grid; gap: 4px; }

.heat-scroll { overflow-x: auto; padding-bottom: 4px; }
.heat {
  display: grid; gap: 3px; min-width: 520px;
  grid-template-columns: 18px repeat(var(--weeks), minmax(10px, 1fr));
  grid-template-rows: 16px repeat(7, auto);
}
.heat-corner { grid-row: 1; grid-column: 1; }
.heat-month { grid-row: 1; font-size: 11px; color: var(--muted); white-space: nowrap; overflow: visible; }
.heat-day { grid-column: 1; font-size: 10px; font-weight: 600; color: var(--muted); align-self: center; }
.hc { display: block; aspect-ratio: 1; border-radius: 3px; background: var(--heat-0); }
.hc-future { background: transparent; }
.hc-h1 { background: var(--heat-1); }
.hc-h2 { background: var(--heat-2); }
.hc-h3 { background: var(--heat-3); }
.hc-h4 { background: var(--heat-4); }
.hc-partial, .hc-live { background: var(--partial-soft); box-shadow: inset 0 0 0 1.5px var(--partial); }
a.hc:hover { outline: 2px solid var(--ink); outline-offset: 1px; }
.heat-legend { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; font-size: 12px; color: var(--muted); }
.heat-legend .hc { width: 12px; }
.heat-legend span:not(.hc) { margin-inline: 4px; }
.heat-legend .hc-partial { margin-left: 14px; }

.insight { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; padding: 12px 16px; border-radius: 12px; background: var(--surface-2); box-shadow: inset 3px 0 0 var(--skip); }
.insight-good { box-shadow: inset 3px 0 0 var(--done); }
.insight-k { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); width: 100%; }
.insight strong { font-family: var(--f-display); font-size: 17px; }
.adh-legend { display: flex; gap: 16px; font-size: 13px; color: var(--muted); }
.adh-legend span { display: inline-flex; align-items: center; gap: 6px; }
.adh-group { font-size: 14px; color: var(--muted); font-weight: 600; margin-top: 4px; }
.adh { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.adh-row { display: grid; grid-template-columns: minmax(0, 15rem) minmax(0, 1fr) 3.5rem; align-items: center; gap: 12px; }
.adh-name { font-weight: 500; font-size: 14px; }
.adh-bar { display: flex; gap: 2px; height: 12px; border-radius: 4px; background: var(--heat-0); overflow: hidden; }
.adh-done { background: var(--done); border-radius: 4px 0 0 4px; }
.adh-skip { background: var(--skip); }
.adh-bar span:last-child { border-top-right-radius: 4px; border-bottom-right-radius: 4px; }
.adh-num { text-align: right; font-size: 14px; color: var(--muted); }
.adh-num b { color: var(--ink); font-weight: 800; }
.adh-row.is-empty .adh-name { color: var(--muted); }
.adh-none { grid-column: 2 / -1; }
@media (max-width: 560px) {
  .adh-row { grid-template-columns: minmax(0, 1fr) 3rem; gap: 4px 10px; }
  .adh-name { grid-column: 1 / -1; }
  .adh-none { grid-column: 1 / -1; }
  .page-head .segmented { width: 100%; justify-content: space-between; }
  .segmented a { flex: 1; text-align: center; padding-inline: 8px; }
}
@media (max-width: 640px) {
  .tabs a { padding: 6px 10px; }
}
a.cell-done { padding-bottom: 12px; }
@media (max-width: 640px) { a.cell-done { padding-bottom: 7px; } .cell-foot { bottom: 8px; } }

/* ---------- estados del día: parcial y no realizada */
.pill-partial { background: var(--partial-soft); color: var(--partial); }
.cell-partial .cell-min { color: var(--partial); }
.cell-partial .cell-bar { background: color-mix(in srgb, var(--partial) 25%, transparent); }
.cell-partial .cell-bar span { background: var(--partial); }
a.cell-partial { padding-bottom: 12px; }
.cell-missed { background: transparent; box-shadow: inset 0 0 0 1.5px var(--skip); }
.cell-missed .cell-n { color: var(--muted); }
.cell-x { position: absolute; right: 9px; top: 4px; font: 700 18px var(--f-body); color: var(--skip); line-height: 1; }
.lg-missed { background: transparent; box-shadow: inset 0 0 0 1.5px var(--skip); }
.day-missed .day-dot { background: transparent; box-shadow: inset 0 0 0 1.5px var(--skip); color: var(--muted); }
a.day-dot { text-decoration: none; }
a.day-dot:hover { filter: brightness(1.08); }
.hc-missed { background: transparent; box-shadow: inset 0 0 0 1.5px var(--skip); }
.hc.is-partial { box-shadow: inset 0 0 0 1.5px var(--partial); }

/* ---------- cuenta */
.account { display: grid; gap: 12px; }
.account-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.form-error p { margin: 0; }
.form-error p + p { margin-top: 4px; }
.pw-help { margin: -6px 0 0; padding-left: 18px; display: grid; gap: 2px; }

/* Vídeos */
.flash-error { background: var(--partial-soft); color: var(--partial); }
.video-upload input[type=file] { max-width: 230px; font-size: 13px; }
.video-upload button[disabled] { opacity: .6; }
