/* ─── Design tokens (estilo FORJA) ───────────────── */
:root {
  --bg:       #0a0a0b;
  --surface:  #151517;
  --surface2: #1e1e22;
  --line:     #2a2a30;
  --txt:      #f4f4f2;
  --dim:      #8a8a92;
  --acid:     #d4ff3f;
  --acid-dim: #9bbd2e;
  --hot:      #ff4d2e;
  --blue:     #3f9bff;
  --success:  #22c55e;
  --warning:  #eab308;
  --r:        16px;
  --r-sm:     10px;
  --nav-h:    68px;
  --hdr-h:    58px;
}

/* ─── Reset ────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body {
  height: 100%; background: var(--bg); color: var(--txt);
  font-family: 'Archivo', sans-serif; overflow: hidden;
  overscroll-behavior: none;
}

/* ─── Layout ───────────────────────────────────────── */
body { display: flex; flex-direction: column; height: 100dvh; }
#main { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }

/* ─── Header ───────────────────────────────────────── */
#header {
  height: var(--hdr-h); background: var(--bg);
  display: flex; align-items: center; padding: 0 16px; gap: 8px;
  flex-shrink: 0; position: sticky; top: 0; z-index: 50;
  border-bottom: 1px solid var(--line);
}
.logo {
  flex: 1; font-family: 'Archivo Black'; font-size: 22px;
  letter-spacing: -1px; text-align: center;
}
.logo span { color: var(--acid); }
.hd-left, .hd-right { width: 36px; }
.btn-icon {
  width: 36px; height: 36px; background: none; border: none;
  color: var(--txt); font-size: 20px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}

/* ─── Nav ──────────────────────────────────────────── */
#nav {
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--surface); border-top: 1px solid var(--line);
  padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
  flex-shrink: 0;
}
.nav-i {
  background: none; border: none; color: var(--dim);
  display: flex; flex-direction: column; align-items: center;
  gap: 3px; cursor: pointer; padding: 6px 0;
  font-family: 'Space Mono'; font-size: 9px;
  text-transform: uppercase; letter-spacing: .5px;
  transition: color .15s;
}
.nav-i svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 2; }
.nav-i.active { color: var(--acid); }

/* ─── Cards ────────────────────────────────────────── */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); padding: 18px; margin-bottom: 14px;
}
.card-title {
  font-family: 'Archivo Black'; font-size: 12px; text-transform: uppercase;
  letter-spacing: 1px; margin-bottom: 14px;
  display: flex; align-items: center; gap: 8px;
}
.card-title .dot { width: 8px; height: 8px; background: var(--acid); border-radius: 50%; flex-shrink: 0; }

/* ─── Buttons ──────────────────────────────────────── */
.big-btn {
  width: 100%; padding: 16px; border: none; border-radius: 12px;
  background: var(--acid); color: #0a0a0b;
  font-family: 'Archivo Black'; font-size: 15px;
  text-transform: uppercase; letter-spacing: 1px;
  cursor: pointer; transition: transform .1s;
}
.big-btn:active { transform: scale(.97); }
.big-btn.ghost {
  background: transparent; border: 1px solid var(--line); color: var(--txt);
}
.mini-btn {
  background: var(--surface2); border: 1px solid var(--line);
  color: var(--txt); border-radius: 8px; padding: 7px 12px;
  font-size: 12px; font-family: 'Space Mono'; cursor: pointer;
}

/* ─── Stats row ────────────────────────────────────── */
.stat-row { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; margin-bottom: 14px; }
.stat {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; padding: 14px 10px; text-align: center;
}
.stat .n { font-family: 'Archivo Black'; font-size: 26px; color: var(--acid); line-height: 1; }
.stat .l { font-family: 'Space Mono'; font-size: 9px; text-transform: uppercase; color: var(--dim); letter-spacing: 1px; margin-top: 3px; }

/* ─── Hero card ────────────────────────────────────── */
.hero {
  background: linear-gradient(135deg,#1a1d10,#151517);
  border: 1px solid var(--acid-dim); position: relative; overflow: hidden;
}
.hero::after {
  content: ""; position: absolute; right: -30px; top: -30px;
  width: 140px; height: 140px;
  background: radial-gradient(circle,var(--acid) 0%,transparent 70%);
  opacity: .15;
}
.hero h2 { font-family: 'Archivo Black'; font-size: 20px; line-height: 1.1; margin-bottom: 6px; }
.hero p { color: var(--dim); font-size: 13px; margin-bottom: 16px; }
.day-pill {
  display: inline-block; font-family: 'Space Mono'; font-size: 10px;
  padding: 3px 10px; border-radius: 20px; background: var(--surface2);
  color: var(--acid); border: 1px solid var(--acid-dim);
  text-transform: uppercase; letter-spacing: 1px; margin-bottom: 10px;
}

/* ─── Exercise row (home) ──────────────────────────── */
.ex-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 0; border-bottom: 1px solid var(--line);
}
.ex-row:last-child { border-bottom: none; }
.ex-row b { font-size: 14px; font-weight: 600; display: block; }
.ex-row small { font-family: 'Space Mono'; font-size: 10px; color: var(--dim); }
.ex-target { font-family: 'Space Mono'; font-size: 11px; color: var(--acid); text-align: right; white-space: nowrap; }

/* ─── WORKOUT ──────────────────────────────────────── */
.wo-ex {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); margin-bottom: 14px; overflow: hidden;
}
.wo-head {
  padding: 14px 16px; background: var(--surface2);
  display: flex; justify-content: space-between; align-items: flex-start;
}
.wo-head b { font-size: 15px; display: block; margin-bottom: 2px; }
.wo-head .wo-meta { font-family: 'Space Mono'; font-size: 10px; color: var(--dim); }
.wo-head .wo-actions { display: flex; gap: 6px; }

.sugg {
  margin: 12px 16px; padding: 10px 12px; border-radius: 10px;
  font-size: 12px; display: flex; gap: 8px; align-items: flex-start;
  border: 1px dashed var(--acid-dim);
  background: rgba(212,255,63,.06); color: var(--acid);
  line-height: 1.4;
}
.sugg.hold { color: var(--blue); border-color: var(--blue); background: rgba(63,155,255,.06); }
.sugg.warn { color: var(--warning); border-color: var(--warning); background: rgba(234,179,8,.06); }
.sugg .sugg-w { font-family: 'Archivo Black'; font-size: 18px; white-space: nowrap; }
.sugg-btn { background: none; border: none; color: var(--acid); font-size: 11px; font-family: 'Space Mono'; cursor: pointer; text-decoration: underline; margin-top: 4px; padding: 0; white-space: nowrap; }

.note-band {
  margin: 0 16px 10px; padding: 8px 12px;
  background: rgba(255,77,46,.06); border-left: 3px solid var(--hot);
  border-radius: 0 8px 8px 0; font-size: 12px; color: var(--dim); line-height: 1.4;
}

.set-grid { padding: 4px 16px 14px; }
.set-labels {
  display: grid; grid-template-columns: 34px 1fr 1fr 46px 38px;
  gap: 8px; font-family: 'Space Mono'; font-size: 9px; color: var(--dim);
  text-transform: uppercase; padding: 6px 0; letter-spacing: .5px; text-align: center;
}
.set-labels span:first-child { text-align: left; }
.set-line {
  display: grid; grid-template-columns: 34px 1fr 1fr 46px 38px;
  gap: 8px; align-items: center; margin-bottom: 8px;
}
.set-line .snum { font-family: 'Archivo Black'; font-size: 13px; color: var(--dim); text-align: center; }
.set-line input {
  width: 100%; background: var(--bg); border: 1px solid var(--line);
  border-radius: 9px; padding: 11px 4px; color: var(--txt);
  font-family: 'Space Mono'; font-size: 15px; text-align: center;
  -moz-appearance: textfield; appearance: textfield;
}
.set-line input::-webkit-outer-spin-button,
.set-line input::-webkit-inner-spin-button { -webkit-appearance: none; }
.set-line input:focus { outline: none; border-color: var(--acid); }
.set-line input.done-val { background: rgba(212,255,63,.07); border-color: var(--acid-dim); color: var(--acid); }
.set-line .rir-inp { font-size: 14px; }
.btn-done {
  width: 36px; height: 36px; border-radius: 9px; border: 1px solid var(--line);
  background: var(--bg); color: var(--dim); font-size: 16px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; transition: all .15s;
}
.btn-done.on { background: var(--acid); color: #0a0a0b; border-color: var(--acid); }

.add-set-btn {
  width: calc(100% - 32px); margin: 0 16px 14px;
  padding: 10px; background: transparent;
  border: 1px dashed var(--line); border-radius: 10px;
  color: var(--dim); font-family: 'Space Mono'; font-size: 11px;
  cursor: pointer; text-transform: uppercase; letter-spacing: .5px;
}

.progress-bar-wrap { padding: 12px 16px 0; }
.prog-bar { background: var(--surface2); border-radius: 100px; height: 4px; margin-bottom: 6px; }
.prog-fill { background: var(--acid); height: 100%; border-radius: 100px; transition: width .3s; }
.prog-txt { font-family: 'Space Mono'; font-size: 10px; color: var(--dim); text-align: right; }

.ex-pills { display: flex; gap: 6px; padding: 8px 16px; overflow-x: auto; scrollbar-width: none; }
.ex-pills::-webkit-scrollbar { display: none; }
.ex-pill {
  flex-shrink: 0; padding: 5px 12px; border-radius: 100px;
  border: 1px solid var(--line); background: var(--surface2);
  color: var(--dim); font-family: 'Space Mono'; font-size: 10px;
  cursor: pointer; white-space: nowrap; text-transform: uppercase; transition: all .15s;
}
.ex-pill.active  { background: var(--acid); color: #0a0a0b; border-color: var(--acid); }
.ex-pill.done    { border-color: var(--success); color: var(--success); }
.ex-pill.plateau { border-color: var(--warning); color: var(--warning); }

.finish-bar {
  padding: 10px 16px; background: linear-gradient(0deg, var(--bg) 60%, transparent);
  position: sticky; bottom: 0;
}
.nav-btns { display: flex; gap: 8px; }

/* ─── CALENDAR ─────────────────────────────────────── */
.cal-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.cal-header h3 { font-family: 'Archivo Black'; font-size: 17px; text-transform: capitalize; }
.cal-nav-btn {
  width: 36px; height: 36px; background: var(--surface2);
  border: 1px solid var(--line); border-radius: 8px; color: var(--txt);
  font-size: 18px; cursor: pointer; display: flex; align-items: center; justify-content: center;
}

.cal-grid { display: grid; grid-template-columns: repeat(7,1fr); gap: 4px; }
.cal-dow {
  font-family: 'Space Mono'; font-size: 9px; color: var(--dim);
  text-transform: uppercase; text-align: center; padding: 4px 0 8px; letter-spacing: .5px;
}
.cal-day {
  aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
  border-radius: 8px; font-family: 'Space Mono'; font-size: 12px; font-weight: 700;
  color: var(--dim); cursor: default; position: relative;
}
.cal-day.other-month { opacity: .25; }
.cal-day.today { border: 1px solid var(--acid); color: var(--txt); }
.cal-day.trained {
  background: var(--acid); color: #0a0a0b; font-weight: 900;
}
.cal-day.trained.today { box-shadow: 0 0 0 2px var(--acid-dim); }

.sess-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--line);
}
.sess-item:last-child { border: none; }
.sess-dot { width: 10px; height: 10px; background: var(--acid); border-radius: 50%; flex-shrink: 0; }
.sess-info { flex: 1; }
.sess-info b { font-size: 14px; display: block; margin-bottom: 2px; }
.sess-info small { font-family: 'Space Mono'; font-size: 10px; color: var(--dim); }
.sess-sets { font-family: 'Space Mono'; font-size: 12px; color: var(--acid); }

/* ─── PROGRESS ─────────────────────────────────────── */
.chart-wrap { height: 160px; margin: 8px 0; }
.chart-wrap svg { width: 100%; height: 100%; overflow: visible; }

.pr-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 13px;
}
.pr-row:last-child { border: none; }
.pr-row .v { font-family: 'Space Mono'; color: var(--acid); font-weight: 700; font-size: 12px; }

select.ex-sel {
  width: 100%; background: var(--surface2); border: 1px solid var(--line);
  border-radius: 10px; padding: 12px; color: var(--txt);
  font-family: 'Archivo'; font-size: 14px; margin-bottom: 14px;
  appearance: none;
}

/* ─── Substitutes modal ────────────────────────────── */
.sub-item {
  padding: 14px; border: 1px solid var(--line); border-radius: 10px;
  margin-bottom: 8px; cursor: pointer; transition: border-color .15s;
}
.sub-item:active { border-color: var(--acid); }
.sub-item h4 { font-size: 14px; font-weight: 600; margin-bottom: 3px; }
.sub-item p { font-size: 11px; color: var(--dim); font-family: 'Space Mono'; }

/* ─── Timer overlay ────────────────────────────────── */
#timer-overlay, #modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.8);
  backdrop-filter: blur(6px); display: flex; align-items: flex-end; z-index: 500;
}
#timer-overlay.hidden, #modal-overlay.hidden { display: none; }

.timer-sheet {
  background: var(--surface); width: 100%;
  border-radius: 20px 20px 0 0; border-top: 1px solid var(--line);
  padding: 28px 24px; text-align: center;
}
#timer-label {
  font-family: 'Space Mono'; font-size: 11px; color: var(--dim);
  text-transform: uppercase; letter-spacing: 2px; margin-bottom: 6px;
}
#timer-display {
  font-family: 'Archivo Black'; font-size: 80px; color: var(--acid);
  line-height: 1; font-variant-numeric: tabular-nums; margin-bottom: 20px;
}
.timer-btns { display: flex; gap: 12px; justify-content: center; margin-bottom: 14px; }
.timer-btns button {
  padding: 10px 24px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface2); color: var(--txt);
  font-family: 'Space Mono'; font-size: 14px; font-weight: 700; cursor: pointer;
}
#timer-skip {
  width: 100%; padding: 15px; border-radius: 12px; border: none;
  background: var(--acid); color: #0a0a0b;
  font-family: 'Archivo Black'; font-size: 15px; letter-spacing: 1px;
  text-transform: uppercase; cursor: pointer; margin-bottom: 10px;
}
#timer-mute { background: none; border: none; font-size: 26px; cursor: pointer; color: var(--dim); }

.modal-sheet {
  background: var(--surface); width: 100%; max-height: 72dvh;
  border-radius: 20px 20px 0 0; border-top: 1px solid var(--line);
  display: flex; flex-direction: column; overflow: hidden;
}
.modal-hd {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px; border-bottom: 1px solid var(--line); flex-shrink: 0;
}
.modal-hd h3 { font-family: 'Archivo Black'; font-size: 15px; text-transform: uppercase; letter-spacing: .5px; }
#modal-close { background: none; border: none; color: var(--dim); font-size: 20px; cursor: pointer; }
#modal-body { overflow-y: auto; padding: 14px; }

/* ─── Toast ────────────────────────────────────────── */
.toast {
  position: fixed; bottom: calc(var(--nav-h) + 12px); left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--acid); color: #0a0a0b; padding: 12px 20px;
  border-radius: 12px; font-family: 'Archivo'; font-weight: 700;
  font-size: 13px; opacity: 0; transition: .25s; z-index: 300;
  pointer-events: none; white-space: nowrap;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ─── Utilities ────────────────────────────────────── */
.hidden { display: none !important; }
.loading { text-align: center; padding: 48px 16px; color: var(--dim); font-family: 'Space Mono'; font-size: 12px; }
.empty { text-align: center; padding: 40px 16px; color: var(--dim); font-family: 'Space Mono'; font-size: 12px; line-height: 1.6; }
.screen-pad { padding: 14px 16px; }
.pb { height: 24px; }

.badge {
  display: inline-block; padding: 2px 8px; border-radius: 100px;
  font-family: 'Space Mono'; font-size: 9px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .5px;
}
.badge-c { background: rgba(63,155,255,.15); color: #60a5fa; border: 1px solid rgba(63,155,255,.3); }
.badge-i { background: rgba(212,255,63,.1); color: var(--acid); border: 1px solid var(--acid-dim); }
