/* ============================================================
   BRYAN BUIZA — Design System Tokens
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  --bg-0:      #0f172a;
  --bg-1:      #1e293b;
  --bg-2:      #334155;
  --bg-glass:  rgba(15, 23, 42, 0.75);

  --fg-1:      #e2e8f0;
  --fg-2:      #94a3b8;
  --fg-3:      #64748b;

  --accent:        #a78bfa;
  --accent-strong: #8b5cf6;
  --accent-deep:   #7c3aed;
  --accent-soft:   #c4b5fd;
  --accent-tint:   rgba(167, 139, 250, 0.10);
  --accent-glow:   rgba(99, 66, 173, 0.15);

  --font-sans: 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;

  --r-sm:   0.25rem;
  --r-md:   0.375rem;
  --r-lg:   0.5rem;
  --r-full: 9999px;

  --shadow-sm:  0 1px 2px rgba(0,0,0,0.4);
  --shadow-md:  0 10px 20px rgba(0,0,0,0.35);
  --shadow-glow: 0 0 24px rgba(139, 92, 246, 0.35);
  --inset-hairline: inset 0 1px 0 0 rgba(148,163,184,0.1);

  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; min-height: 100%; }
body {
  background: var(--bg-0);
  color: var(--fg-2);
  font-family: var(--font-sans);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; }
::selection { background: var(--accent); color: #1a0050; }
a { color: inherit; text-decoration: none; transition: color .15s var(--ease); }
a:hover { color: var(--accent-soft); }

/* ---- App frame ---- */
.app { display: flex; min-height: 100vh; }

/* ---- Sidebar (desktop) ---- */
.sidebar {
  display: none;
  width: 248px; flex-shrink: 0; flex-direction: column; gap: 4px;
  padding: 24px 16px;
  border-right: 1px solid var(--bg-2);
  background: rgba(15,23,42,.82);
  backdrop-filter: blur(10px);
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.side-brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 22px; }
.side-brand b { color: var(--fg-1); font-size: 16px; font-weight: 700; letter-spacing: -.01em; }
.side-brand span { color: var(--fg-3); font-size: 11px; display: block; font-weight: 500; }
.side-link {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px; border-radius: var(--r-md);
  color: var(--fg-3); font-size: 14px; font-weight: 600;
  background: none; border: none; width: 100%; text-align: left;
  transition: all .18s var(--ease); text-decoration: none;
}
.side-link:hover { color: var(--fg-1); background: var(--bg-1); }
.side-link.on { color: var(--accent-soft); background: var(--accent-tint); }
.side-cta {
  margin-top: 14px; display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px; border-radius: var(--r-md); border: none;
  background: var(--accent-strong); color: #fff; font-weight: 700; font-size: 14px;
  box-shadow: var(--shadow-md); transition: all .18s var(--ease); text-decoration: none;
}
.side-cta:hover { background: var(--accent-deep); box-shadow: var(--shadow-glow); color: #fff; }

/* ---- Main column ---- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.screen {
  flex: 1; width: 100%; max-width: 760px; margin: 0 auto;
  padding: 20px 18px 120px;
}

/* ---- Topbar (mobile) ---- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px; min-height: 58px;
  background: var(--bg-glass); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--bg-2);
}
.topbar h1 {
  font-size: 20px; font-weight: 700; letter-spacing: -.02em;
  color: var(--fg-1); margin: 0; flex: 1;
}

/* ---- Bottom tab bar (mobile) ---- */
.tabbar { display: none; }

/* ---- Responsive ---- */
@media (min-width: 880px) {
  .sidebar { display: flex; }
  .topbar { display: none; }
  .screen { padding: 32px 28px 60px; }
  .desktop-only { display: block !important; }
}
@media (max-width: 879px) {
  .tabbar {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 40;
    align-items: flex-end; justify-content: space-around;
    background: var(--bg-glass); backdrop-filter: blur(12px);
    border-top: 1px solid var(--bg-2);
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  }
  .tab {
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    background: none; border: none; color: var(--fg-3);
    font-size: 10px; font-weight: 600; padding: 6px 12px; flex: 1;
    transition: color .15s; text-decoration: none;
  }
  .tab.on { color: var(--accent-soft); }
  .tab svg { display: block; }
  .fab {
    flex: 0 0 auto; margin-top: -26px;
    width: 56px; height: 56px; border-radius: var(--r-full);
    background: var(--accent-strong); color: #fff;
    border: 3px solid var(--bg-0); box-shadow: var(--shadow-glow);
    display: flex; align-items: center; justify-content: center;
    text-decoration: none;
  }
  .desktop-only { display: none !important; }
  body { padding-bottom: 80px; }
}

/* ---- Cards ---- */
.card {
  background: var(--bg-1);
  border: 1px solid var(--bg-2);
  border-radius: var(--r-lg);
  box-shadow: var(--inset-hairline);
}
.card-hover { transition: all .2s var(--ease); }
.card-hover:hover {
  border-color: rgba(167,139,250,.4);
  box-shadow: var(--inset-hairline), var(--shadow-md);
  transform: translateY(-1px);
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: none; font-weight: 600; border-radius: var(--r-md);
  transition: all .18s var(--ease); font-size: 15px; padding: 11px 18px;
  cursor: pointer; text-decoration: none; min-height: 44px;
}
.btn-primary {
  background: var(--accent-strong); color: #fff; box-shadow: var(--shadow-md);
}
.btn-primary:hover { background: var(--accent-deep); box-shadow: var(--shadow-glow); color: #fff; }
.btn-ghost {
  background: transparent; color: var(--fg-1); border: 1px solid var(--bg-2);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent-soft); }
.btn-block { width: 100%; }
.btn-sm { padding: 8px 12px; font-size: 13px; min-height: 36px; }
.btn-danger { background: transparent; color: var(--fg-3); border: 1px solid var(--bg-2); }
.btn-danger:hover { color: #f87171; border-color: #f87171; }

/* ---- Icon button ---- */
.iconbtn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: var(--r-md);
  background: none; border: none; color: var(--fg-2);
  transition: all .15s var(--ease); cursor: pointer;
}
.iconbtn:hover { color: var(--fg-1); background: var(--bg-1); }

/* ---- Fields ---- */
.field {
  background: var(--bg-0); border: 1px solid var(--bg-2); color: var(--fg-1);
  border-radius: var(--r-md); padding: 10px 12px; font-size: 15px; width: 100%;
  transition: border-color .15s var(--ease);
}
.field:focus { outline: none; border-color: var(--accent); }
.field::placeholder { color: var(--fg-3); }
textarea.field { resize: vertical; min-height: 44px; line-height: 1.5; }
.field-sm { padding: 8px 10px; font-size: 14px; text-align: center; }

/* ---- Stepper ---- */
.stepper {
  display: inline-flex; align-items: center;
  border: 1px solid var(--bg-2); border-radius: var(--r-md); overflow: hidden;
}
.stepper button {
  width: 38px; height: 40px; background: var(--bg-0); border: none;
  color: var(--fg-2); font-size: 18px; transition: background .15s;
}
.stepper button:hover { background: var(--bg-1); color: var(--accent-soft); }
.stepper .val {
  min-width: 52px; text-align: center; color: var(--fg-1);
  font-weight: 600; font-variant-numeric: tabular-nums; font-size: 14px;
}

/* ---- Set check button ---- */
.setcheck {
  width: 30px; height: 30px; flex-shrink: 0; border-radius: 8px;
  border: 1.5px solid var(--bg-2); background: var(--bg-0);
  display: inline-flex; align-items: center; justify-content: center;
  transition: all .15s var(--ease); cursor: pointer; color: transparent;
}
.setcheck.done { background: var(--accent-strong); border-color: var(--accent-strong); color: #fff; }

/* ---- Set row grid ---- */
.set-grid {
  display: grid;
  grid-template-columns: 26px 1fr 1fr 36px 32px;
  gap: 8px; align-items: center;
}
.set-grid-header {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .12em; color: var(--fg-3); padding-bottom: 6px;
  border-bottom: 1px solid var(--bg-2); margin-bottom: 4px;
}
.set-num {
  font-size: 12px; font-weight: 700; color: var(--fg-3);
  font-variant-numeric: tabular-nums; text-align: center;
}

/* ---- Pills ---- */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  border-radius: var(--r-full); background: var(--accent-tint);
  padding: 4px 11px; font-size: 12px; font-weight: 500; color: var(--accent-soft);
}
.pill-muted { background: var(--bg-2); color: var(--fg-2); }

/* ---- Target badge ---- */
.target-badge {
  font-size: 11px; font-weight: 600; padding: 3px 9px;
  background: var(--accent-tint); color: var(--accent-soft);
  border-radius: var(--r-full); white-space: nowrap;
}

/* ---- Misc ---- */
.label {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .14em; color: var(--fg-3);
}
.muted { color: var(--fg-3); }
.divider { height: 1px; background: var(--bg-2); border: none; margin: 0; }
.empty { text-align: center; color: var(--fg-3); padding: 56px 20px; }
.tnum { font-variant-numeric: tabular-nums; }

/* ---- Stat block ---- */
.stat { display: flex; flex-direction: column; }
.stat-value {
  font-size: 22px; font-weight: 700; color: var(--fg-1);
  font-variant-numeric: tabular-nums; line-height: 1.1;
}
.stat-value.accent { color: var(--accent-soft); }
.stat-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .1em; color: var(--fg-3); margin-top: 2px; }

/* ---- Progress bar ---- */
.progress-bar { height: 5px; border-radius: 3px; background: var(--bg-2); overflow: hidden; }
.progress-bar-fill { height: 100%; background: var(--accent-strong); transition: width .3s var(--ease); }

/* ---- Page title (desktop) ---- */
.page-title {
  font-size: 30px; font-weight: 700; letter-spacing: -.02em;
  color: var(--fg-1); margin: 0 0 6px;
}

/* ---- Exercise card ---- */
.exercise-card .card-header {
  padding: 12px 14px;
  border-bottom: 1px solid var(--bg-2);
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.exercise-card .card-body { padding: 12px 14px; }
.exercise-name {
  font-size: 15px; font-weight: 700; color: var(--fg-1);
  background: none; border: none; padding: 0; flex: 1;
}
.exercise-name::placeholder { color: var(--fg-3); font-weight: 400; }

/* ---- Fade in ---- */
.fade-in { animation: fadeUp .25s var(--ease); }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

/* ---- Workout sticky header ---- */
.workout-header {
  position: sticky; top: 0; z-index: 10;
  background: var(--bg-glass); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--bg-2);
  padding: 12px 18px;
}
@media (min-width: 880px) {
  .workout-header { top: 0; }
}
