:root {
  --bg: #f1f5f9;
  --surface: #ffffff;
  --surface-2: #e2e8f0;
  --text: #0f172a;
  --muted: #64748b;
  --primary: #0f766e;
  --primary-dark: #115e59;
  --danger: #b91c1c;
  --radius: 18px;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
}
* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
}
button, select, textarea { font: inherit; }
button { cursor: pointer; }
.app-shell { min-height: 100vh; max-width: 880px; margin: 0 auto; padding-bottom: 92px; }
.app-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: max(20px, env(safe-area-inset-top)) 20px 14px;
}
h1,h2,h3,h4,p { margin-top: 0; }
h1 { font-size: 1.65rem; margin-bottom: 0; }
h2 { font-size: 1.55rem; margin-bottom: 0; }
h3 { font-size: 1.05rem; margin-bottom: 0; }
h4 { font-size: 1.1rem; margin-bottom: 8px; }
.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: .72rem; color: var(--muted); margin-bottom: 4px; font-weight: 700; }
main { padding: 0 16px 24px; }
.view { display: none; }
.view.active { display: block; }
.hero-card, .card {
  background: var(--surface); border-radius: var(--radius); padding: 18px;
  box-shadow: var(--shadow); margin-bottom: 14px;
}
.hero-card {
  color: white;
  background: linear-gradient(135deg, #0f172a, #134e4a);
  display: flex; justify-content: space-between; align-items: center; gap: 18px;
}
.hero-card .pill { background: rgba(255,255,255,.14); color: white; }
.hero-card h2 { margin: 8px 0; }
.hero-card p { margin-bottom: 0; color: #cbd5e1; }
.hero-stat { text-align: center; min-width: 90px; }
.hero-stat strong { display:block; font-size: 2rem; }
.hero-stat span { font-size: .75rem; color: #cbd5e1; }
.grid.two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.card-heading, .section-title, .button-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.section-title { margin: 4px 2px 14px; }
.pill { display: inline-flex; padding: 5px 9px; border-radius: 999px; background:#ccfbf1; color:#115e59; font-size:.72rem; font-weight:800; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.primary, .secondary, .danger {
  border: 0; border-radius: 12px; padding: 10px 14px; font-weight: 800;
}
.primary { background: var(--primary); color: white; }
.primary:hover { background: var(--primary-dark); }
.secondary { background: var(--surface-2); color: var(--text); }
.ghost { background: transparent; }
.danger { color: var(--danger); }
.text-btn { border:0; background:transparent; color:var(--primary); font-weight:800; padding:4px; }
.hidden { display: none !important; }
.progress-track { height: 12px; background:#e2e8f0; border-radius:999px; overflow:hidden; margin:14px 0 8px; }
.progress-bar { height:100%; width:0%; background:var(--primary); transition:width .25s ease; }
.exercise-list { display:grid; gap:10px; margin-top:16px; }
.exercise {
  border:1px solid #e2e8f0; border-radius:14px; padding:14px;
  display:flex; justify-content:space-between; align-items:center; gap:12px;
}
.exercise strong { display:block; font-size:1.05rem; }
.exercise span { color:var(--muted); font-size:.85rem; }
.weight { font-size:1.35rem; font-weight:900; white-space:nowrap; }
.settings-grid { display:grid; grid-template-columns:1fr 1fr; gap:12px; margin-top:14px; }
label { color:var(--muted); font-size:.82rem; font-weight:700; display:grid; gap:6px; }
select, textarea {
  width:100%; border:1px solid #cbd5e1; border-radius:12px; padding:11px; background:white; color:var(--text);
}
.notes-label { margin-top:16px; }
.history-list, .plan-list { display:grid; gap:10px; margin-top:14px; }
.history-item, .plan-item {
  border:1px solid #e2e8f0; border-radius:14px; padding:13px;
}
.plan-item { cursor:pointer; }
.plan-item.completed { opacity:.62; background:#f8fafc; }
.plan-item.selected { border-color:var(--primary); box-shadow:0 0 0 2px rgba(15,118,110,.12); }
.row { display:flex; justify-content:space-between; gap:12px; align-items:flex-start; }
.file-btn input { display:none; }
.bottom-nav {
  position:fixed; left:50%; bottom:0; transform:translateX(-50%);
  width:min(880px, 100%); display:grid; grid-template-columns:repeat(4,1fr);
  background:rgba(255,255,255,.96); backdrop-filter:blur(14px);
  border-top:1px solid #e2e8f0; padding:8px 8px calc(8px + env(safe-area-inset-bottom));
  z-index:20;
}
.nav-btn {
  border:0; background:transparent; color:var(--muted); font-size:.72rem; font-weight:800;
  display:grid; gap:3px; place-items:center; padding:6px;
}
.nav-btn span { font-size:1.15rem; }
.nav-btn.active { color:var(--primary); }
.toast {
  position:fixed; left:50%; bottom:95px; transform:translateX(-50%) translateY(20px);
  background:#0f172a; color:white; padding:11px 16px; border-radius:12px;
  opacity:0; pointer-events:none; transition:.2s ease; z-index:30; max-width:90%; text-align:center;
}
.toast.show { opacity:1; transform:translateX(-50%) translateY(0); }
@media (max-width: 620px) {
  .grid.two, .settings-grid { grid-template-columns:1fr; }
  .hero-card { align-items:flex-start; }
  .card-heading { align-items:flex-start; }
  .workout-card .card-heading { flex-direction:column; }
  .workout-card .primary { width:100%; }
}
