/* gymbro · estilos */
:root {
  --purple: #6A1BF2;
  --purple-press: #5212C9;
  --purple-ink: #4B12B0;
  --lavender: #F0E9FF;
  --lavender-soft: #FBF9FF;
  --dash: #B9A3F5;
  --bg: #F6F5FA;
  --bg-outer: #ECE9F3;
  --surface: #FFFFFF;
  --line: #E6E3EE;
  --line-soft: #EFEDF4;
  --line-strong: #DAD6E3;
  --ink: #17141F;
  --ink-2: #3F3A4B;
  --muted: #5F5A6B;
  --placeholder: #8A8597;
  --danger: #A1123A;
  --ok: #155B33;
  --ok-bg: #E3F4EA;
  --warn: #7A4300;
  --warn-bg: #FFF1DC;
  --radius: 20px;
  --font: Inter, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --display: 'Space Grotesk', Inter, system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--purple); }
a:hover { color: var(--purple-press); }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
input::placeholder, textarea::placeholder { color: var(--placeholder); }
:focus-visible { outline: 3px solid var(--purple); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Layout: columna tipo móvil, algo más ancha en escritorio ---------- */
.app {
  max-width: 560px;
  min-height: 100dvh;
  margin: 0 auto;
  background: var(--bg);
  display: flex;
  flex-direction: column;
}
@media (min-width: 600px) {
  body { background: var(--bg-outer); }
  .app { border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
}

.boot { padding: 40px 24px; text-align: center; color: var(--muted); }

.screen { flex: 1; display: flex; flex-direction: column; min-height: 100dvh; }
.content { flex: 1; padding: 8px 20px 24px; display: flex; flex-direction: column; gap: 18px; }
.content.pad-top { padding-top: 16px; }

.topbar { display: flex; align-items: center; gap: 8px; padding: 16px 12px 8px; padding-top: max(16px, env(safe-area-inset-top)); }
.topbar .title { margin: 0; flex: 1; font-family: var(--display); font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.topbar .center { flex: 1; text-align: center; font-size: 15px; font-weight: 600; color: var(--muted); }

.brandbar { display: flex; align-items: center; justify-content: space-between; padding: 20px 20px 8px; padding-top: max(20px, env(safe-area-inset-top)); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.wordmark { font-family: var(--display); font-weight: 700; font-size: 23px; letter-spacing: -0.03em; }
.wordmark b { color: var(--purple); font-weight: 700; }

.footer-bar {
  position: sticky; bottom: 0;
  padding: 12px 20px; padding-bottom: max(20px, env(safe-area-inset-bottom));
  background: var(--bg); border-top: 1px solid var(--line);
  display: flex; gap: 10px;
}

/* ---------- Tipografía ---------- */
.h1 { margin: 0; font-family: var(--display); font-size: 30px; line-height: 1.1; letter-spacing: -0.02em; font-weight: 700; }
.h1.sm { font-size: 26px; }
.h2 { margin: 0; font-size: 15px; font-weight: 600; }
.eyebrow { margin: 0; font-size: 14px; color: var(--muted); font-weight: 500; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.row { display: flex; align-items: center; gap: 12px; }
.row.between { justify-content: space-between; }
.row.baseline { align-items: baseline; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.month { margin: 8px 0 -4px; font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }

/* ---------- Superficies ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
a.card, button.card { display: block; width: 100%; text-align: left; color: var(--ink); text-decoration: none; font: inherit; }
.list { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.list > li + li { border-top: 1px solid var(--line-soft); }
.list-item { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 60px; padding: 12px 16px; border: none; background: none; color: var(--ink); text-decoration: none; text-align: left; font: inherit; }
.list-item .grow { flex: 1; min-width: 0; }

.tile { width: 48px; height: 48px; flex-shrink: 0; border-radius: 14px; background: var(--lavender); display: flex; align-items: center; justify-content: center; color: var(--purple); overflow: hidden; }
.tile img { width: 100%; height: 100%; object-fit: cover; }
.tile.lg { width: 88px; height: 88px; border-radius: 20px; }
.tile.md { width: 60px; height: 60px; }
.avatar { width: 44px; height: 44px; flex-shrink: 0; border-radius: 50%; background: var(--lavender); color: var(--purple-ink); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 15px; text-decoration: none; }
.avatar.solid { background: var(--purple); color: #fff; }
.avatar.off { background: var(--bg-outer); color: var(--muted); }
.avatar.lg { width: 56px; height: 56px; font-size: 19px; }

.badge { display: inline-flex; align-items: center; padding: 4px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--lavender); color: var(--purple-ink); }
.badge.solid { background: var(--purple); color: #fff; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.off { background: var(--bg-outer); color: var(--ink-2); }
.pill { padding: 4px 8px; border-radius: 8px; background: var(--bg); font-size: 13px; font-weight: 500; }
.tag { padding: 6px 10px; border-radius: 999px; background: var(--lavender); color: var(--purple-ink); font-size: 13px; font-weight: 500; }
.wrap { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 0 18px; border-radius: 16px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  font-size: 16px; font-weight: 600; text-decoration: none;
}
.btn:disabled { opacity: 0.55; cursor: default; }
.btn.primary { background: var(--purple); border-color: var(--purple); color: #fff; min-height: 56px; font-size: 17px; }
.btn.primary:hover:not(:disabled) { background: var(--purple-press); }
.btn.primary:disabled { background: var(--line-strong); border-color: var(--line-strong); color: var(--muted); opacity: 1; }
.btn.outline { border: 2px solid var(--purple); color: var(--purple-ink); }
.btn.dashed { border: 2px dashed var(--dash); background: var(--lavender-soft); color: var(--purple-ink); }
.btn.danger { color: var(--danger); }
.btn.block { width: 100%; }
.btn.grow { flex: 1; }
.btn.sm { min-height: 40px; padding: 0 14px; border-radius: 12px; font-size: 14px; }
.btn.tiny { min-height: 36px; padding: 0 14px; border-radius: 10px; font-size: 14px; }
.icon-btn { width: 44px; height: 44px; flex-shrink: 0; border-radius: 50%; border: none; background: transparent; display: inline-flex; align-items: center; justify-content: center; color: var(--ink); text-decoration: none; }
.icon-btn:hover { background: rgba(23, 20, 31, 0.05); }
.link-btn { border: none; background: none; padding: 0; min-height: 32px; color: var(--purple); font-weight: 600; font-size: 14px; }

.hero-action {
  display: flex; flex-direction: column; justify-content: space-between;
  min-height: 172px; padding: 20px; border-radius: 24px;
  background: var(--purple); color: #fff; text-decoration: none;
}
.hero-action:hover { background: var(--purple-press); color: #fff; }
.hero-action .bubble { width: 48px; height: 48px; border-radius: 16px; background: rgba(255,255,255,0.16); display: flex; align-items: center; justify-content: center; }
.hero-action .big { margin: 0; font-family: var(--display); font-size: 26px; font-weight: 700; letter-spacing: -0.02em; }
.hero-action .sub { margin: 4px 0 0; font-size: 14px; color: #E9DDFF; }
.side-action { display: flex; align-items: center; gap: 16px; min-height: 96px; padding: 20px; border-radius: 24px; background: var(--surface); border: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.side-action:hover { color: var(--ink); border-color: var(--line-strong); }
.side-action .big { margin: 0; font-family: var(--display); font-size: 20px; font-weight: 700; letter-spacing: -0.01em; }
.side-action .bubble { width: 48px; height: 48px; flex-shrink: 0; border-radius: 16px; background: var(--lavender); color: var(--purple); display: flex; align-items: center; justify-content: center; }
.actions { display: flex; flex-direction: column; gap: 12px; }
@media (min-width: 520px) {
  .actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .side-action { flex-direction: column; align-items: flex-start; justify-content: space-between; min-height: 172px; }
  .side-action .chev { display: none; }
}

/* ---------- Formularios ---------- */
.field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 600; }
.field .hint { font-weight: 400; color: var(--muted); }
.input, .textarea {
  width: 100%; min-height: 52px; padding: 0 16px; border-radius: 14px;
  border: 1px solid var(--line-strong); background: var(--surface);
  font-size: 16px; font-weight: 400; color: var(--ink);
}
.textarea { padding: 12px 14px; line-height: 1.4; resize: none; }
.input:focus, .textarea:focus { outline: none; border: 2px solid var(--purple); }
.input-group { display: flex; align-items: center; border-radius: 14px; border: 1px solid var(--line-strong); background: var(--surface); padding-left: 14px; min-height: 52px; }
.input-group:focus-within { border: 2px solid var(--purple); }
.input-group input { flex: 1; min-width: 0; border: none; outline: none; background: transparent; font-size: 16px; min-height: 48px; }
.search { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); }
.search:focus-within { border: 2px solid var(--purple); }
.search input { flex: 1; min-width: 0; border: none; outline: none; background: transparent; font-size: 16px; min-height: 44px; }
.search.soft { background: var(--bg); }

.stepper { display: flex; align-items: center; min-height: 64px; border-radius: 16px; background: var(--bg); border: 1px solid var(--line); }
.stepper button { width: 48px; height: 64px; flex-shrink: 0; border: none; background: transparent; font-size: 26px; font-weight: 500; color: var(--purple); }
.stepper input { flex: 1; min-width: 0; width: 100%; text-align: center; border: none; outline: none; background: transparent; font-family: var(--display); font-size: 26px; font-weight: 700; -moz-appearance: textfield; }
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.range { width: 100%; height: 36px; margin: 0; accent-color: var(--purple); }
.scale { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }

.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.chips.wrap { flex-wrap: wrap; overflow: visible; }
.chip { flex-shrink: 0; min-height: 38px; padding: 0 14px; border-radius: 19px; border: 1px solid var(--line-strong); background: var(--surface); font-size: 14px; font-weight: 500; }
.chip[aria-pressed="true"] { background: var(--purple); border-color: var(--purple); color: #fff; font-weight: 600; }

.seg { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; padding: 4px; background: var(--bg-outer); border-radius: 14px; }
.seg button { min-height: 44px; border: none; border-radius: 11px; background: transparent; color: var(--muted); font-size: 15px; font-weight: 500; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(23,20,31,0.08); }
.seg button:disabled { cursor: default; }

.option { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border-radius: 14px; border: 2px solid var(--line); background: var(--surface); cursor: pointer; font-weight: 400; }
.option:has(input:checked) { border-color: var(--purple); background: var(--lavender-soft); }
.option input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--purple); }
.option strong { display: block; font-size: 15px; }
.option span { font-size: 13px; color: var(--muted); }
.check { display: flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 500; }
.check input { width: 20px; height: 20px; margin: 0; accent-color: var(--purple); }

.req { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.req li { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.req li.ok { color: var(--ok); }

.error { margin: 0; padding: 12px 14px; border-radius: 12px; background: #FDE8EE; color: var(--danger); font-size: 14px; font-weight: 500; }
.notice { display: flex; gap: 10px; align-items: flex-start; padding: 14px; border-radius: 14px; background: var(--bg-outer); font-size: 13px; line-height: 1.45; color: var(--ink-2); }
.notice.ok { background: var(--surface); border: 1px solid var(--line); font-size: 15px; color: var(--ink); }
.secret { padding: 12px 14px; border-radius: 14px; background: var(--lavender); }
.secret code { font-family: var(--display); font-size: 18px; font-weight: 700; letter-spacing: 0.03em; word-break: break-all; }

/* ---------- Componentes de entreno ---------- */
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; text-align: center; }
.week .day { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.week .dot { width: 32px; height: 32px; border-radius: 50%; background: var(--line-soft); display: flex; align-items: center; justify-content: center; color: #fff; }
.week .dot.done { background: var(--purple); }
.week .dot.today { background: transparent; border: 2px dashed var(--purple); }
.week .day.is-today { color: var(--ink); font-weight: 700; }

.date-tile { width: 48px; height: 52px; flex-shrink: 0; border-radius: 14px; background: var(--lavender); color: var(--purple-ink); display: flex; flex-direction: column; align-items: center; justify-content: center; }
.date-tile .dow { font-size: 11px; font-weight: 600; text-transform: uppercase; }
.date-tile .dnum { font-family: var(--display); font-size: 20px; font-weight: 700; line-height: 1; }
.date-tile.hot { background: var(--purple); color: #fff; }

.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.desc { margin: 4px 0 0; font-size: 14px; line-height: 20px; color: var(--muted); }

.set-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); text-align: left; color: var(--ink); }
.set-row .num { width: 32px; height: 32px; flex-shrink: 0; border-radius: 10px; background: var(--bg); display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 700; }
.set-row .main { margin: 0; font-family: var(--display); font-size: 18px; font-weight: 700; }
.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.stat { padding: 12px; border-radius: 14px; background: var(--bg); }
.stat p { margin: 0; }

.picker-item { display: flex; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line-soft); }
.picker-item:last-child { border-bottom: none; }

.empty { padding: 40px 12px; text-align: center; }
.empty p { margin: 0; }

/* ---------- Diálogos (hoja inferior en móvil, centrado en escritorio) ---------- */
dialog.sheet {
  border: none; padding: 0; margin: auto auto 0; width: 100%; max-width: 560px;
  max-height: calc(100dvh - 40px); border-radius: 28px 28px 0 0;
  background: var(--surface); color: var(--ink);
  display: flex; flex-direction: column;
}
dialog.sheet:not([open]) { display: none; }
dialog.sheet::backdrop { background: rgba(23, 20, 31, 0.6); }
dialog.sheet.tall { height: calc(100dvh - 40px); }
@media (min-width: 600px) {
  dialog.sheet { margin: auto; border-radius: 28px; max-height: min(86dvh, 820px); }
  dialog.sheet.tall { height: min(86dvh, 820px); }
  .sheet .grip { display: none; }
}
.sheet .grip { display: flex; justify-content: center; padding-top: 8px; }
.sheet .grip span { width: 40px; height: 5px; border-radius: 3px; background: var(--line-strong); }
.sheet-head { display: flex; align-items: flex-start; gap: 8px; padding: 10px 12px 0 20px; }
.sheet-head .t { flex: 1; min-width: 0; }
.sheet-head h2 { margin: 0; font-family: var(--display); font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.sheet-head p { margin: 0 0 2px; font-size: 13px; color: var(--muted); font-weight: 500; }
.sheet-body { flex: 1; min-height: 0; overflow-y: auto; padding: 14px 20px 20px; display: flex; flex-direction: column; gap: 16px; }
.sheet-foot { padding: 12px 20px; padding-bottom: max(20px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line-soft); display: flex; gap: 10px; }

/* ---------- Avisos ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px);
  max-width: min(92vw, 480px); padding: 12px 18px; border-radius: 14px;
  background: var(--ink); color: #fff; font-size: 15px; font-weight: 500;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 50;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.loading { padding: 32px 0; text-align: center; color: var(--muted); }
