/* FitTrack — diseño limpio y claro, mobile-first, botones grandes. */
:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --ink: #11151c;
  --ink-soft: #5b6573;
  --line: #e6e9ef;
  --brand: #5b5bf6;
  --brand-2: #8b5cf6;
  --brand-grad: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  --ok: #16a34a;
  --ok-soft: #dcfce7;
  --warn: #f59e0b;
  --danger: #ef4444;
  --shadow: 0 1px 3px rgba(17,21,28,.06), 0 8px 24px rgba(17,21,28,.05);
  --on-brand: #ffffff;
  --nav-bg: rgba(255,255,255,.92);
  --chart-grid: #eef0f4;
  --radius: 18px;
  --tap: 52px;
  --nav-h: 72px;
}

/* ── Tema 2 · Dark Athletic ── */
[data-theme="dark"] {
  --bg: #0d1117; --surface: #161b22; --surface-2: #21262d;
  --ink: #f0f3f6; --ink-soft: #8b949e; --line: #2a313a;
  --brand: #c8ff00; --brand-2: #84cc16;
  --brand-grad: linear-gradient(135deg, #c8ff00 0%, #84cc16 100%);
  --ok: #4ade80; --ok-soft: rgba(74,222,128,.16); --warn: #fbbf24; --danger: #f87171;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35);
  --on-brand: #0d1117; --nav-bg: rgba(13,17,23,.92); --chart-grid: #2a313a;
}
[data-theme="dark"] .badge.brand { background: rgba(200,255,0,.14); color: var(--brand); }
[data-theme="dark"] .badge.ok { background: var(--ok-soft); color: var(--ok); }
[data-theme="dark"] .btn.danger { background: rgba(248,113,113,.16); color: var(--danger); }
[data-theme="dark"] .err { background: rgba(248,113,113,.16); }

/* ── Tema 3 · Energy Bold ── */
[data-theme="energy"] {
  --bg: #fff5ef; --surface: #ffffff; --surface-2: #fff0e6;
  --ink: #1d0f14; --ink-soft: #9a6a5a; --line: #ffe1d2;
  --brand: #f5576c; --brand-2: #ff8008;
  --brand-grad: linear-gradient(135deg, #ff8008 0%, #f5576c 100%);
  --ok: #16a34a; --ok-soft: #dcfce7; --warn: #f59e0b; --danger: #ef4444;
  --shadow: 0 2px 6px rgba(245,87,108,.10), 0 12px 28px rgba(245,87,108,.10);
  --on-brand: #ffffff; --nav-bg: rgba(255,245,239,.94); --chart-grid: #ffe1d2;
}

/* ── Tema 4 · Minimal Mono ── */
[data-theme="mono"] {
  --bg: #ffffff; --surface: #ffffff; --surface-2: #f4f4f5;
  --ink: #09090b; --ink-soft: #71717a; --line: #e4e4e7;
  --brand: #18181b; --brand-2: #3f3f46;
  --brand-grad: linear-gradient(135deg, #27272a 0%, #09090b 100%);
  --ok: #16a34a; --ok-soft: #f4f4f5; --warn: #a16207; --danger: #dc2626;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 4px 14px rgba(0,0,0,.05);
  --on-brand: #ffffff; --nav-bg: rgba(255,255,255,.92); --chart-grid: #eeeeef;
}
[data-theme="mono"] .badge.brand { background: var(--surface-2); color: var(--ink); }
[data-theme="mono"] .card, [data-theme="mono"] .kpi, [data-theme="mono"] .list-item { border: 1px solid var(--line); }

/* swatch selector de tema */
.theme-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.theme-opt { border-radius: 14px; padding: 14px; border: 2px solid var(--line); display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 14px; }
.theme-opt.active { border-color: var(--brand); }
.theme-opt .sw { width: 30px; height: 30px; border-radius: 9px; flex: 0 0 auto; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  background: var(--bg); color: var(--ink);
  -webkit-font-smoothing: antialiased; overscroll-behavior-y: none;
}
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select, textarea { font-family: inherit; }

/* ── Boot splash ── */
.boot-splash { position: fixed; inset: 0; display: grid; place-content: center; gap: 12px; justify-items: center; background: var(--bg); }
.boot-logo { font-size: 56px; animation: pop .6s ease; }
.boot-name { font-weight: 800; font-size: 22px; letter-spacing: -.5px; color: var(--brand); }
@keyframes pop { from { transform: scale(.6); opacity: 0 } to { transform: scale(1); opacity: 1 } }

/* ── App shell ── */
.app { max-width: 520px; margin: 0 auto; min-height: 100vh; padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom)); }
.screen { padding: 16px 16px 8px; animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px) } to { opacity: 1; transform: none } }

.topbar { display: flex; align-items: center; justify-content: space-between; padding: 18px 16px 6px; }
.topbar h1 { font-size: 24px; font-weight: 800; letter-spacing: -.6px; margin: 0; }
.topbar .sub { color: var(--ink-soft); font-size: 13px; font-weight: 500; margin-top: 2px; }
.avatar { width: 42px; height: 42px; border-radius: 14px; background: var(--brand-grad); color: var(--on-brand); display: grid; place-content: center; font-weight: 800; box-shadow: var(--shadow); }

/* ── Cards ── */
.card { background: var(--surface); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); margin-bottom: 14px; }
.card-h { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.card-h h3 { margin: 0; font-size: 16px; font-weight: 700; }
.muted { color: var(--ink-soft); font-size: 13px; font-weight: 500; }
.section-title { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--ink-soft); margin: 18px 4px 10px; }

/* ── KPI grid ── */
.kpi-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.kpi { background: var(--surface); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.kpi .label { font-size: 12px; font-weight: 600; color: var(--ink-soft); display: flex; align-items: center; gap: 6px; }
.kpi .value { font-size: 28px; font-weight: 800; letter-spacing: -1px; margin-top: 6px; line-height: 1; }
.kpi .delta { font-size: 12px; font-weight: 700; margin-top: 6px; }
.kpi .delta.up { color: var(--ok); }
.kpi .delta.down { color: var(--danger); }

/* ── Buttons (grandes, fáciles) ── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: var(--tap);
  padding: 0 20px; border-radius: 14px; font-weight: 700; font-size: 16px; background: var(--surface-2); color: var(--ink); transition: transform .08s ease, filter .15s; }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--brand-grad); color: var(--on-brand); box-shadow: var(--shadow); }
.btn.ok { background: var(--ok); color: #fff; }
.btn.ghost { background: transparent; border: 1.5px solid var(--line); }
.btn.danger { background: #fee2e2; color: var(--danger); }
.btn.block { width: 100%; }
.btn.lg { min-height: 60px; font-size: 18px; border-radius: 18px; }
.btn-row { display: flex; gap: 10px; }
.fab { position: fixed; right: 16px; bottom: calc(var(--nav-h) + 16px + env(safe-area-inset-bottom)); z-index: 30;
  width: 60px; height: 60px; border-radius: 20px; background: var(--brand-grad); color: var(--on-brand); font-size: 30px; font-weight: 400;
  display: grid; place-content: center; box-shadow: 0 10px 26px rgba(0,0,0,.22); }
.fab:active { transform: scale(.92); }

/* chips */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 8px; -ms-overflow-style: none; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: 0 0 auto; padding: 9px 16px; border-radius: 999px; background: var(--surface); border: 1.5px solid var(--line);
  font-weight: 600; font-size: 14px; color: var(--ink-soft); }
.chip.active { background: var(--brand); color: var(--on-brand); border-color: var(--brand); }

/* ── Lists ── */
.list-item { display: flex; align-items: center; gap: 12px; padding: 14px 16px; background: var(--surface); border-radius: 16px; box-shadow: var(--shadow); margin-bottom: 10px; }
.list-item .ic { width: 44px; height: 44px; border-radius: 13px; display: grid; place-content: center; font-size: 20px; background: var(--surface-2); flex: 0 0 auto; }
.list-item .body { flex: 1; min-width: 0; }
.list-item .title { font-weight: 700; font-size: 15px; }
.list-item .meta { color: var(--ink-soft); font-size: 13px; font-weight: 500; margin-top: 2px; }
.list-item .chev { color: var(--ink-soft); font-size: 20px; }

/* ── Forms ── */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-soft); margin-bottom: 6px; }
.input, .select, textarea.input { width: 100%; min-height: var(--tap); padding: 12px 14px; border-radius: 13px;
  border: 1.5px solid var(--line); background: var(--surface); font-size: 16px; font-weight: 500; color: var(--ink); }
.input:focus, .select:focus, textarea.input:focus { outline: none; border-color: var(--brand); }
textarea.input { min-height: 84px; resize: vertical; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }

/* ── Stepper (reps/peso fácil de tocar) ── */
.stepper { display: flex; align-items: center; gap: 8px; }
.stepper button { width: 42px; height: 42px; border-radius: 12px; background: var(--surface-2); font-size: 22px; font-weight: 700; flex: 0 0 auto; }
.stepper input { flex: 1; text-align: center; min-width: 0; }

/* set rows */
.set-row { display: grid; grid-template-columns: 34px 1fr 1fr 52px; gap: 8px; align-items: center; margin-bottom: 8px; }
.set-row .setno { width: 34px; height: 34px; border-radius: 10px; background: var(--surface-2); display: grid; place-content: center; font-weight: 700; font-size: 13px; }
.set-row .mini { min-height: 44px; padding: 8px; border-radius: 11px; border: 1.5px solid var(--line); text-align: center; font-size: 16px; font-weight: 600; width: 100%; }
.set-row .done { width: 44px; height: 44px; border-radius: 12px; background: var(--surface-2); display: grid; place-content: center; font-size: 18px; }
.set-row .done.on { background: var(--ok); color: #fff; }

.exercise-block { border: 1.5px solid var(--line); border-radius: 16px; padding: 14px; margin-bottom: 12px; background: var(--surface); }
.exercise-block .ex-h { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.exercise-block .ex-h .name { font-weight: 700; font-size: 15px; }
.col-h { display: grid; grid-template-columns: 34px 1fr 1fr 52px; gap: 8px; font-size: 11px; font-weight: 700; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 6px; padding: 0 2px; }

/* progress bar */
.bar { height: 10px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: 999px; background: var(--brand-grad); }
.bar.ok > span { background: var(--ok); }
.macro-row { display: flex; justify-content: space-between; font-size: 13px; font-weight: 600; margin-bottom: 4px; }

/* badges */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--surface-2); color: var(--ink-soft); }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.brand { background: #eef0ff; color: var(--brand); }

/* chart wrap */
.chart-wrap { position: relative; height: 200px; }

/* ── Bottom nav ── */
.nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom); background: var(--nav-bg); backdrop-filter: blur(12px);
  border-top: 1px solid var(--line); display: flex; max-width: 520px; margin: 0 auto; }
.nav button { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--ink-soft); font-size: 11px; font-weight: 600; }
.nav button .nic { font-size: 22px; line-height: 1; transition: transform .15s; }
.nav button.active { color: var(--brand); }
.nav button.active .nic { transform: translateY(-2px) scale(1.08); }

/* ── Modal / sheet ── */
.sheet-bg { position: fixed; inset: 0; z-index: 50; background: rgba(17,21,28,.45); display: flex; align-items: flex-end; animation: fade .2s; }
.sheet { background: var(--bg); width: 100%; max-width: 520px; margin: 0 auto; border-radius: 26px 26px 0 0; max-height: 92vh; overflow-y: auto;
  padding: 8px 16px calc(20px + env(safe-area-inset-bottom)); animation: up .28s cubic-bezier(.2,.8,.2,1); }
@keyframes up { from { transform: translateY(100%) } to { transform: none } }
.sheet-handle { width: 42px; height: 5px; border-radius: 999px; background: var(--line); margin: 8px auto 14px; }
.sheet h2 { margin: 4px 0 16px; font-size: 20px; font-weight: 800; letter-spacing: -.4px; }

/* login */
.login { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; padding: 24px; max-width: 440px; margin: 0 auto; }
.login .brand { text-align: center; margin-bottom: 28px; }
.login .brand .logo { font-size: 60px; }
.login .brand h1 { font-size: 30px; font-weight: 800; margin: 8px 0 4px; letter-spacing: -.8px; }
.login .brand p { color: var(--ink-soft); margin: 0; font-weight: 500; }
.err { background: #fee2e2; color: var(--danger); padding: 12px 14px; border-radius: 12px; font-size: 14px; font-weight: 600; margin-bottom: 12px; }
.empty { text-align: center; padding: 40px 20px; color: var(--ink-soft); }
.empty .em { font-size: 46px; margin-bottom: 10px; }

.spinner { width: 22px; height: 22px; border: 3px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg) } }
.center-load { display: grid; place-content: center; min-height: 60vh; }
.center-load .spinner { border-color: var(--line); border-top-color: var(--brand); }
.divider { height: 1px; background: var(--line); margin: 14px 0; }

/* segmented control */
.seg { display: flex; background: var(--surface-2); border-radius: 13px; padding: 4px; gap: 4px; margin-bottom: 12px; }
.seg button { flex: 1; min-height: 42px; border-radius: 10px; font-weight: 700; font-size: 14px; color: var(--ink-soft); }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.seg button:disabled { opacity: 1; cursor: default; }

/* tracker de agua */
.water-row { display: flex; gap: 7px; flex-wrap: wrap; margin: 4px 0 12px; }
.glass { width: 30px; height: 38px; border-radius: 5px 5px 9px 9px; border: 2px solid var(--brand); background: transparent; transition: background .15s; }
.glass.full { background: var(--brand); }
.info-card { background: var(--surface-2); border-radius: 14px; padding: 14px; font-size: 14px; line-height: 1.5; }
.tip { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 8px; }
.tip .te { font-size: 18px; flex: 0 0 auto; }
.plan-num { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px solid var(--line); }
.plan-num:last-child { border: none; }
.plan-num b { font-size: 16px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.pr-flag { color: var(--warn); font-weight: 800; }
