/* =============================================
   GLOBAL & VARIABLES
   ============================================= */
:root {
  --bg: #0a0a0a;
  --bg2: #111111;
  --bg3: #1a1a1a;
  --card: #141414;
  --card2: #1e1e1e;
  --border: #2a2a2a;
  --text: #f0f0f0;
  --text2: #aaaaaa;
  --text3: #666666;
  --accent: #00ff87;
  --accent2: #00cc6a;
  --accent-dim: rgba(0, 255, 135, 0.12);
  --blue: #00b4ff;
  --blue-dim: rgba(0, 180, 255, 0.12);
  --orange: #ff6b35;
  --orange-dim: rgba(255, 107, 53, 0.12);
  --red: #ff3b3b;
  --red-dim: rgba(255, 59, 59, 0.12);
  --yellow: #ffcc00;
  --yellow-dim: rgba(255, 204, 0, 0.12);
  --purple: #a855f7;
  --success: #00ff87;
  --warning: #ffcc00;
  --danger: #ff3b3b;
  --radius: 14px;
  --radius-sm: 8px;
  --radius-lg: 20px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
  --shadow-accent: 0 0 20px rgba(0, 255, 135, 0.2);
  --nav-height: 72px;
  --header-height: 60px;
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] {
  --bg: #f0f0f0;
  --bg2: #e8e8e8;
  --bg3: #dcdcdc;
  --card: #ffffff;
  --card2: #f5f5f5;
  --border: #d0d0d0;
  --text: #111111;
  --text2: #555555;
  --text3: #999999;
  --accent-dim: rgba(0, 180, 100, 0.1);
  --blue-dim: rgba(0, 120, 200, 0.1);
  --shadow: 0 4px 24px rgba(0,0,0,0.1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  overflow-x: hidden;
  font-size: 15px;
  line-height: 1.5;
}

/* ── Typography ─────────────────────────────── */
h1, h2, h3, h4, h5 {
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.text-accent { color: var(--accent); }
.text-blue { color: var(--blue); }
.text-orange { color: var(--orange); }
.text-red { color: var(--red); }
.text-yellow { color: var(--yellow); }
.text-muted { color: var(--text2); }
.text-sm { font-size: 13px; }
.text-xs { font-size: 11px; }
.text-lg { font-size: 18px; }
.text-xl { font-size: 22px; }
.text-2xl { font-size: 28px; }
.fw-bold { font-weight: 700; }
.fw-800 { font-weight: 800; }

/* ── Layout ──────────────────────────────────── */
.app-shell {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* app-body: wrapper sidebar + main (aktif di desktop) */
.app-body {
  display: flex;
  flex: 1;
  min-height: 0;
}

.main-content {
  flex: 1;
  padding: 0 0 calc(var(--nav-height) + 12px);
  overflow-x: hidden;
  min-width: 0;
}

.page {
  display: none;
  animation: fadeSlideIn 0.25s ease;
  min-height: calc(100dvh - var(--nav-height) - var(--header-height));
}

.page.active {
  display: block;
}

@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Sidebar Nav (hidden di mobile) ─────────────────── */
.sidebar-nav {
  display: none;
}

/* ══════════════════════════════════════════════
   SCHEDULE EDITOR
   ══════════════════════════════════════════════ */
.schedule-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin-bottom: 14px;
}

.sched-day-card {
  background: var(--bg3);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 4px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
}

.sched-day-card:hover { transform: translateY(-2px); }

.sched-day-name {
  font-size: 9px;
  font-weight: 800;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 5px;
}

.sched-day-icon { font-size: 20px; line-height: 1; margin-bottom: 4px; }

.sched-day-label {
  font-size: 8px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.sched-day-card[data-type="push"] {
  background: var(--orange-dim);
  border-color: rgba(255, 107, 53, 0.4);
}
.sched-day-card[data-type="pull"] {
  background: var(--blue-dim);
  border-color: rgba(0, 180, 255, 0.4);
}
.sched-day-card[data-type="legs"] {
  background: var(--accent-dim);
  border-color: rgba(0, 255, 135, 0.4);
}
.sched-day-card[data-type="rest"] {
  background: var(--bg3);
  border-color: var(--border);
}
.sched-day-card[data-type="core"] {
  background: rgba(168,85,247,0.12);
  border-color: rgba(168,85,247,.4);
}

.schedule-summary {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

/* Progress page: mobile = 1 kolom, desktop = 2 kolom (via media query) */
.progress-desktop-grid {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.progress-desktop-grid .chart-card {
  margin: 0 16px 12px;
}

/* ── Header ──────────────────────────────────── */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  backdrop-filter: blur(10px);
}

.header-logo {
  font-size: 20px;
  font-weight: 900;
  letter-spacing: -0.03em;
  color: var(--text);
}

.header-logo span {
  color: var(--accent);
}

.header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: var(--bg3);
  color: var(--text);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.icon-btn:hover { background: var(--border); transform: scale(1.05); }

/* ── Bottom Navigation ───────────────────────── */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  height: var(--nav-height);
  background: var(--bg2);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 200;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 8px 4px;
  cursor: pointer;
  border: none;
  background: none;
  color: var(--text3);
  transition: var(--transition);
  position: relative;
  -webkit-tap-highlight-color: transparent;
}

.nav-item .nav-icon {
  font-size: 22px;
  line-height: 1;
}

.nav-item .nav-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.nav-item.active {
  color: var(--accent);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 32px;
  height: 3px;
  background: var(--accent);
  border-radius: 0 0 4px 4px;
  box-shadow: 0 0 8px var(--accent);
}

/* ── Cards ───────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.card-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text2);
}

/* ── Buttons ─────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  border: none;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  letter-spacing: 0.02em;
}

.btn-primary {
  background: var(--accent);
  color: #000;
}

.btn-primary:hover {
  background: var(--accent2);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(0, 255, 135, 0.4);
}

.btn-secondary {
  background: var(--bg3);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover { background: var(--border); }

.btn-danger {
  background: var(--red-dim);
  color: var(--red);
  border: 1px solid rgba(255, 59, 59, 0.3);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
}

.btn-outline:hover { background: var(--accent-dim); }

.btn-full { width: 100%; }
.btn-lg { padding: 15px 24px; font-size: 16px; border-radius: var(--radius); }
.btn-sm { padding: 7px 14px; font-size: 12px; }

/* ── Section Headers ──────────────────────────── */
.section-header {
  padding: 20px 16px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.section-title {
  font-size: 20px;
  font-weight: 900;
}

.section-subtitle {
  font-size: 13px;
  color: var(--text2);
  margin-top: 2px;
}

.section-link {
  font-size: 13px;
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

/* ── Badges ───────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.badge-accent { background: var(--accent-dim); color: var(--accent); }
.badge-blue { background: var(--blue-dim); color: var(--blue); }
.badge-orange { background: var(--orange-dim); color: var(--orange); }
.badge-red { background: var(--red-dim); color: var(--red); }
.badge-yellow { background: var(--yellow-dim); color: var(--yellow); }
.badge-gray { background: var(--bg3); color: var(--text2); }
.badge-purple { background: rgba(168,85,247,0.12); color: var(--purple); }

/* ── Progress Indicators ─────────────────────── */
.progress-bar {
  height: 6px;
  background: var(--bg3);
  border-radius: 100px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 100px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 8px rgba(0, 255, 135, 0.5);
}

.progress-fill.blue { background: var(--blue); box-shadow: 0 0 8px rgba(0, 180, 255, 0.5); }
.progress-fill.orange { background: var(--orange); }
.progress-fill.red { background: var(--red); }

/* ══════════════════════════════════════════════
   DASHBOARD PAGE
   ══════════════════════════════════════════════ */
.hero-card {
  margin: 12px 16px;
  padding: 20px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--card) 0%, var(--card2) 100%);
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}

.hero-card::before {
  content: '';
  position: absolute;
  top: -40px; right: -40px;
  width: 140px; height: 140px;
  background: radial-gradient(circle, rgba(0, 255, 135, 0.12), transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

.hero-greeting {
  font-size: 13px;
  color: var(--text2);
  margin-bottom: 4px;
}

.hero-date {
  font-size: 22px;
  font-weight: 900;
  margin-bottom: 16px;
}

.hero-workout-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--accent-dim);
  border: 1px solid rgba(0, 255, 135, 0.2);
  border-radius: 100px;
  color: var(--accent);
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 16px;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 0 16px 12px;
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 12px;
  text-align: center;
}

.stat-value {
  font-size: 26px;
  font-weight: 900;
  line-height: 1;
  color: var(--accent);
}

.stat-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 4px;
}

.quick-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 0 16px 12px;
}

.quick-action-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.quick-action-card:hover {
  border-color: var(--accent);
  background: var(--accent-dim);
  transform: translateY(-2px);
}

.quick-action-icon { font-size: 28px; }
.quick-action-label { font-size: 13px; font-weight: 700; }
.quick-action-sub { font-size: 11px; color: var(--text2); }

/* PR Cards */
.pr-list { margin: 0 16px 12px; }

.pr-item {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
  transition: var(--transition);
}

.pr-item:hover { border-color: var(--accent); }

.pr-icon {
  width: 40px; height: 40px;
  border-radius: var(--radius-sm);
  background: var(--accent-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.pr-info { flex: 1; }
.pr-exercise { font-size: 14px; font-weight: 700; }
.pr-date { font-size: 11px; color: var(--text2); }
.pr-value { font-size: 18px; font-weight: 900; color: var(--accent); }
.pr-unit { font-size: 11px; color: var(--text2); }

/* ══════════════════════════════════════════════
   WORKOUT PAGE
   ══════════════════════════════════════════════ */
.workout-header-card {
  margin: 12px 16px;
  padding: 18px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--card);
}

.workout-day-label {
  font-size: 24px;
  font-weight: 900;
}

.workout-muscles {
  font-size: 13px;
  color: var(--text2);
  margin-top: 4px;
}

.session-controls {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

.session-timer {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg3);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 20px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  letter-spacing: 0.04em;
}

/* Exercise Cards */
.exercise-list { margin: 0 16px; }

.exercise-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 12px;
  overflow: hidden;
  transition: var(--transition);
}

.exercise-card.done { border-color: rgba(0, 255, 135, 0.3); }
.exercise-card.skip { border-color: var(--border); opacity: 0.6; }
.exercise-card.fail { border-color: rgba(255, 59, 59, 0.3); }

.exercise-header {
  padding: 14px 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
}

.exercise-status-icon {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
  transition: var(--transition);
  margin-top: 2px;
}

.exercise-card.done .exercise-status-icon {
  background: var(--accent);
  border-color: var(--accent);
  color: #000;
}

.exercise-card.fail .exercise-status-icon {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}

.exercise-card.skip .exercise-status-icon {
  background: var(--bg3);
  border-color: var(--border);
}

.exercise-info { flex: 1; }
.exercise-name { font-size: 15px; font-weight: 800; }
.exercise-name-id { font-size: 12px; color: var(--text2); margin-top: 1px; }

.exercise-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.meta-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  background: var(--bg3);
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text2);
}

.exercise-expand {
  padding: 0 16px 14px;
  border-top: 1px solid var(--border);
}

.sets-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 10px;
}

.sets-table th {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text3);
  padding: 8px 6px 6px;
  text-align: center;
}

.sets-table th:first-child { text-align: left; }

.sets-table td {
  padding: 6px 6px;
  text-align: center;
  vertical-align: middle;
}

.sets-table tr { border-bottom: 1px solid var(--border); }
.sets-table tr:last-child { border-bottom: none; }

.set-number {
  width: 28px; height: 28px;
  background: var(--bg3);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
}

.set-input {
  width: 64px;
  padding: 6px 8px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  outline: none;
  transition: var(--transition);
}

.set-input:focus {
  border-color: var(--accent);
  background: var(--accent-dim);
  box-shadow: 0 0 0 2px rgba(0, 255, 135, 0.15);
}

.set-done-btn {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: transparent;
  cursor: pointer;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  margin: 0 auto;
}

.set-done-btn.checked {
  border-color: var(--accent);
  background: var(--accent);
  color: #000;
}

.set-done-btn.checked .check-icon::after { content: '✓'; }
.set-done-btn:not(.checked) .check-icon::after { content: ''; }

/* Overload badge */
.overload-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--accent-dim);
  border: 1px solid rgba(0, 255, 135, 0.2);
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
}

/* Exercise action buttons */
.exercise-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

/* Description */
.exercise-desc {
  font-size: 12px;
  color: var(--text2);
  background: var(--bg3);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  margin-top: 10px;
  line-height: 1.6;
}

/* Rest timer */
.rest-timer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 20px;
  backdrop-filter: blur(4px);
}

.rest-timer-label { font-size: 16px; color: var(--text2); font-weight: 600; }

.rest-timer-display {
  font-size: 72px;
  font-weight: 900;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 30px rgba(0, 255, 135, 0.4);
}

.rest-timer-circle {
  position: relative;
  width: 200px; height: 200px;
}

.rest-timer-circle svg {
  transform: rotate(-90deg);
}

.rest-progress-circle {
  stroke-dasharray: 565;
  stroke-dashoffset: 0;
  stroke: var(--accent);
  stroke-width: 6;
  fill: none;
  stroke-linecap: round;
  filter: drop-shadow(0 0 6px rgba(0, 255, 135, 0.5));
  transition: stroke-dashoffset 1s linear;
}

.rest-timer-text {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* Session note */
.session-note-card {
  margin: 0 16px 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.star-rating {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.star-btn {
  font-size: 24px;
  background: none;
  border: none;
  cursor: pointer;
  opacity: 0.3;
  transition: var(--transition);
  padding: 2px;
}

.star-btn.active { opacity: 1; }

.notes-input {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  padding: 10px 12px;
  resize: none;
  min-height: 70px;
  outline: none;
  font-family: inherit;
  margin-top: 10px;
  transition: var(--transition);
}

.notes-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(0, 255, 135, 0.1);
}

/* ══════════════════════════════════════════════
   PROGRESS PAGE
   ══════════════════════════════════════════════ */
.chart-card {
  margin: 0 16px 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.chart-title {
  font-size: 14px;
  font-weight: 800;
  margin-bottom: 4px;
}

.chart-subtitle {
  font-size: 12px;
  color: var(--text2);
  margin-bottom: 14px;
}

.chart-container {
  position: relative;
  height: 180px;
}

.exercise-selector {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin-bottom: 12px;
  scrollbar-width: none;
}

.exercise-selector::-webkit-scrollbar { display: none; }

.ex-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--bg3);
  color: var(--text2);
  transition: var(--transition);
}

.ex-chip.active {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}

.overload-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 700;
}

.overload-up { background: rgba(0, 255, 135, 0.1); color: var(--accent); }
.overload-same { background: var(--yellow-dim); color: var(--yellow); }
.overload-down { background: var(--red-dim); color: var(--red); }

/* Body weight input */
.bw-input-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  margin-bottom: 16px;
}

.input-group { flex: 1; }

.input-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
  display: block;
}

.text-input {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 16px;
  font-weight: 700;
  padding: 10px 12px;
  outline: none;
  transition: var(--transition);
}

.text-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(0, 255, 135, 0.12);
}

/* ══════════════════════════════════════════════
   PHOTOS PAGE
   ══════════════════════════════════════════════ */
.photo-upload-zone {
  margin: 0 16px 12px;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 28px 20px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
}

.photo-upload-zone:hover {
  border-color: var(--accent);
  background: var(--accent-dim);
}

.photo-upload-zone .upload-icon { font-size: 36px; margin-bottom: 8px; }
.photo-upload-zone .upload-text { font-size: 14px; font-weight: 700; color: var(--text2); }
.photo-upload-zone .upload-sub { font-size: 12px; color: var(--text3); margin-top: 4px; }

.photo-type-selector {
  display: flex;
  gap: 8px;
  margin: 0 16px 12px;
}

.type-tab {
  flex: 1;
  padding: 10px;
  text-align: center;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  color: var(--text2);
  transition: var(--transition);
}

.type-tab.active {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin: 0 16px 16px;
}

.photo-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--card);
  border: 1px solid var(--border);
  cursor: pointer;
}

.photo-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.photo-item:hover img { transform: scale(1.05); }

.photo-item-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 24px 10px 10px;
  background: linear-gradient(transparent, rgba(0,0,0,0.7));
  font-size: 11px;
  font-weight: 700;
  color: #fff;
}

.photo-delete-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: rgba(0,0,0,0.6);
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: var(--transition);
}

.photo-item:hover .photo-delete-btn { opacity: 1; }

/* ══════════════════════════════════════════════
   HISTORY PAGE
   ══════════════════════════════════════════════ */
.calendar-card {
  margin: 12px 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.calendar-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.cal-month-label {
  font-size: 18px;
  font-weight: 900;
}

.cal-nav-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg3);
  color: var(--text);
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.cal-nav-btn:hover { border-color: var(--accent); color: var(--accent); }

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.cal-day-header {
  text-align: center;
  font-size: 10px;
  font-weight: 700;
  color: var(--text3);
  text-transform: uppercase;
  padding: 4px 0 8px;
}

.cal-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}

.cal-day:hover { background: var(--bg3); }
.cal-day.other-month { color: var(--text3); }
.cal-day.today { border: 2px solid var(--accent); color: var(--accent); }
.cal-day.workout { background: rgba(0, 255, 135, 0.15); color: var(--accent); font-weight: 800; }
.cal-day.skip { background: rgba(255, 59, 59, 0.1); color: var(--red); }
.cal-day.rest-day { background: rgba(255, 255, 255, 0.04); color: var(--text3); }

.cal-day-dot {
  position: absolute;
  bottom: 3px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px; height: 4px;
  border-radius: 50%;
}

.cal-day.workout .cal-day-dot { background: var(--accent); }

/* Session detail */
.session-detail-card {
  margin: 0 16px 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.session-exercise-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.session-exercise-item:last-child { border-bottom: none; }

.sess-ex-status {
  width: 24px; height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  flex-shrink: 0;
}

.sess-ex-status.done { background: var(--accent-dim); color: var(--accent); }
.sess-ex-status.skip { background: var(--bg3); color: var(--text3); }
.sess-ex-status.fail { background: var(--red-dim); color: var(--red); }

/* ══════════════════════════════════════════════
   SETTINGS PAGE
   ══════════════════════════════════════════════ */
.settings-section {
  margin: 12px 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.settings-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  transition: var(--transition);
}

.settings-item:last-child { border-bottom: none; }
.settings-item:hover { background: var(--bg3); }

.settings-icon {
  width: 38px; height: 38px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.settings-icon.accent { background: var(--accent-dim); }
.settings-icon.blue { background: var(--blue-dim); }
.settings-icon.orange { background: var(--orange-dim); }
.settings-icon.red { background: var(--red-dim); }

.settings-info { flex: 1; }
.settings-label { font-size: 14px; font-weight: 700; }
.settings-value { font-size: 12px; color: var(--text2); margin-top: 1px; }

/* Toggle */
.toggle-switch {
  width: 44px; height: 24px;
  background: var(--bg3);
  border-radius: 100px;
  position: relative;
  cursor: pointer;
  border: 1px solid var(--border);
  transition: var(--transition);
  flex-shrink: 0;
}

.toggle-switch.on {
  background: var(--accent);
  border-color: var(--accent);
}

.toggle-knob {
  position: absolute;
  top: 2px; left: 2px;
  width: 18px; height: 18px;
  background: #fff;
  border-radius: 50%;
  transition: var(--transition);
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

.toggle-switch.on .toggle-knob {
  transform: translateX(20px);
}

/* Profile inputs */
.profile-form {
  padding: 16px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.form-group {
  margin-bottom: 14px;
}

.form-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
  display: block;
}

.form-input {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  padding: 10px 12px;
  outline: none;
  transition: var(--transition);
}

.form-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(0, 255, 135, 0.12);
}

/* BMI display */
.bmi-card {
  background: var(--accent-dim);
  border: 1px solid rgba(0, 255, 135, 0.2);
  border-radius: var(--radius-sm);
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.bmi-value { font-size: 28px; font-weight: 900; color: var(--accent); }
.bmi-label { font-size: 12px; color: var(--text2); }
.bmi-cat { font-size: 14px; font-weight: 700; color: var(--accent); }

/* ══════════════════════════════════════════════
   MODALS
   ══════════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 400;
  display: flex;
  align-items: flex-end;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  backdrop-filter: blur(4px);
}

.modal-overlay.visible {
  opacity: 1;
  pointer-events: all;
}

.modal-sheet {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  background: var(--bg2);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 0 16px 32px;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  max-height: 90dvh;
  overflow-y: auto;
}

.modal-overlay.visible .modal-sheet {
  transform: translateY(0);
}

.modal-handle {
  width: 36px; height: 4px;
  background: var(--border);
  border-radius: 100px;
  margin: 12px auto;
}

.modal-title {
  font-size: 20px;
  font-weight: 900;
  margin-bottom: 16px;
  padding-top: 8px;
}

/* ══════════════════════════════════════════════
   TOAST NOTIFICATIONS
   ══════════════════════════════════════════════ */
.toast-container {
  position: fixed;
  top: 70px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  width: calc(100% - 32px);
  max-width: 440px;
  pointer-events: none;
}

.toast {
  background: var(--card2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: var(--shadow);
  animation: toastSlideIn 0.3s ease, toastFadeOut 0.3s ease 2.7s forwards;
  pointer-events: all;
}

.toast.success { border-left: 4px solid var(--accent); }
.toast.error { border-left: 4px solid var(--red); }
.toast.info { border-left: 4px solid var(--blue); }
.toast.pr { border-left: 4px solid var(--yellow); }

@keyframes toastSlideIn {
  from { opacity: 0; transform: translateY(-12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes toastFadeOut {
  to { opacity: 0; transform: translateY(-8px); }
}

/* ══════════════════════════════════════════════
   EMPTY STATES
   ══════════════════════════════════════════════ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
  gap: 12px;
}

.empty-icon { font-size: 56px; opacity: 0.5; }
.empty-title { font-size: 18px; font-weight: 800; color: var(--text2); }
.empty-desc { font-size: 14px; color: var(--text3); line-height: 1.6; }

/* ══════════════════════════════════════════════
   UTILITY CLASSES
   ══════════════════════════════════════════════ */
.p-16 { padding: 16px; }
.px-16 { padding-left: 16px; padding-right: 16px; }
.py-16 { padding-top: 16px; padding-bottom: 16px; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.hidden { display: none !important; }
.w-full { width: 100%; }

/* ══════════════════════════════════════════════
   DELOAD NOTICE
   ══════════════════════════════════════════════ */
.deload-banner {
  margin: 0 16px 12px;
  padding: 14px 16px;
  background: var(--yellow-dim);
  border: 1px solid rgba(255, 204, 0, 0.3);
  border-radius: var(--radius);
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.deload-icon { font-size: 24px; }
.deload-title { font-size: 14px; font-weight: 800; color: var(--yellow); }
.deload-desc { font-size: 12px; color: var(--text2); margin-top: 2px; }

/* ── Settings desktop grid: mobile = 1 col ───── */
.settings-desktop-grid {
  display: flex;
  flex-direction: column;
}

.settings-desktop-grid > div {
  /* margin sudah di-set inline pada masing-masing div */
}

/* ══════════════════════════════════════════════
   RESPONSIVE BREAKPOINTS
   ══════════════════════════════════════════════ */

/* ── Tablet (640px–1023px) ──────────────────── */
@media (min-width: 640px) and (max-width: 1023px) {
  body {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    background: var(--bg2);
    min-height: 100dvh;
  }

  .app-shell {
    max-width: 600px;
    width: 100%;
    min-height: 100dvh;
    box-shadow: 0 0 60px rgba(0,0,0,0.4);
  }

  .quick-actions {
    grid-template-columns: repeat(4, 1fr);
  }

  .chart-container { height: 220px; }

  .photo-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ── Desktop (1024px+) ───────────────────────── */
@media (min-width: 1024px) {
  :root {
    --sidebar-width: 240px;
    --header-height: 64px;
  }

  body {
    overflow: hidden;
    height: 100dvh;
  }

  /* Shell full width, flex column */
  .app-shell {
    max-width: 100%;
    margin: 0;
    border-radius: 0;
    height: 100dvh;
    overflow: hidden;
  }

  /* Header desktop */
  .app-header {
    height: var(--header-height);
    border-bottom: 1px solid var(--border);
    padding: 0 28px;
  }

  .header-logo { font-size: 22px; }

  /* app-body = sidebar + main side by side */
  .app-body {
    flex: 1;
    overflow: hidden;
    display: flex;
  }

  /* Sidebar */
  .sidebar-nav {
    display: flex;
    flex-direction: column;
    width: var(--sidebar-width);
    flex-shrink: 0;
    background: var(--bg2);
    border-right: 1px solid var(--border);
    height: calc(100dvh - var(--header-height));
    padding: 16px 10px 20px;
    overflow-y: auto;
    position: sticky;
    top: 0;
  }

  .sidebar-section-label {
    font-size: 9px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text3);
    padding: 0 10px;
    margin-bottom: 6px;
    margin-top: 4px;
  }

  .sidebar-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 12px;
    border-radius: var(--radius);
    border: none;
    background: transparent;
    color: var(--text2);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    text-align: left;
    transition: var(--transition);
    margin-bottom: 2px;
  }

  .sidebar-item:hover {
    background: var(--bg3);
    color: var(--text);
  }

  .sidebar-item.active {
    background: var(--accent-dim);
    color: var(--accent);
    font-weight: 800;
  }

  .sidebar-icon { font-size: 20px; line-height: 1; }

  .sidebar-divider {
    height: 1px;
    background: var(--border);
    margin: 12px 4px;
  }

  .sidebar-footer {
    margin-top: auto;
    padding: 12px;
    background: var(--bg3);
    border-radius: var(--radius);
    font-size: 12px;
    color: var(--text2);
  }

  /* Hide bottom nav on desktop */
  .bottom-nav { display: none; }

  /* Main content */
  .main-content {
    flex: 1;
    padding: 0;
    overflow-y: auto;
    height: calc(100dvh - var(--header-height));
    min-width: 0;
  }

  /* Pages: max-width untuk readability */
  .page {
    max-width: 960px;
    margin: 0 auto;
    min-height: auto;
    padding-bottom: 40px;
  }

  /* Section headers bigger */
  .section-title { font-size: 22px; }
  .section-header { padding: 24px 20px 10px; }

  /* Cards padding */
  .card { padding: 20px; }

  /* Hero card */
  .hero-card { margin: 16px 20px; padding: 24px; }

  /* Stats row - lebih banyak kolom */
  .stats-row {
    grid-template-columns: repeat(5, 1fr);
    margin: 0 20px 16px;
  }

  /* Quick actions 4 kolom */
  .quick-actions {
    grid-template-columns: repeat(4, 1fr);
    margin: 0 20px 16px;
  }

  /* PR list */
  .pr-list { margin: 0 20px 16px; }

  /* Chart taller */
  .chart-container { height: 260px; }

  .chart-card { margin: 0 20px 16px; }

  /* Workout page: 2 kolom di desktop untuk exercise list */
  .exercise-list { margin: 0 20px; }

  .workout-header-card { margin: 16px 20px; }

  /* Progress page - chart 2 kolom di desktop */
  .progress-desktop-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin: 0 20px 16px;
    flex-direction: unset;
  }

  .progress-desktop-grid .chart-card {
    margin: 0;
  }

  /* Photos 3 kolom */
  .photo-grid {
    grid-template-columns: repeat(3, 1fr);
    margin: 0 20px 20px;
  }

  .photo-upload-zone { margin: 0 20px 16px; }
  .photo-type-selector { margin: 0 20px 14px; }

  /* Calendar card */
  .calendar-card { margin: 16px 20px; }

  /* Session detail */
  .session-detail-card { margin: 0 20px 16px; }

  /* Settings layout: 2 kolom untuk form di desktop */
  .settings-desktop-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin: 0 20px 16px;
    flex-direction: unset;
  }

  .settings-desktop-grid > div { margin: 0; }

  .settings-section { margin: 0 20px 16px; }

  /* Bigger schedule grid untuk desktop */
  .schedule-grid {
    gap: 10px;
  }

  .sched-day-card { padding: 14px 6px; }
  .sched-day-icon { font-size: 24px; }
  .sched-day-label { font-size: 9px; }

  /* Input lebar penuh di desktop */
  .text-input { font-size: 15px; }

  /* Deload banner */
  .deload-banner { margin: 0 20px 12px; }

  /* Rest timer overlay: lebih besar */
  .rest-timer-circle { width: 240px; height: 240px; }
  .rest-timer-circle svg { width: 240px; height: 240px; }
  .rest-progress-circle { cx: 120; cy: 120; r: 108; }
}

/* ══════════════════════════════════════════════
   SCROLLBAR
   ══════════════════════════════════════════════ */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 100px; }
::-webkit-scrollbar-thumb:hover { background: var(--text3); }

/* ══════════════════════════════════════════════
   PHOTO VIEWER
   ══════════════════════════════════════════════ */
.photo-viewer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.95);
  z-index: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 16px;
}

.photo-viewer-img {
  max-width: calc(100vw - 40px);
  max-height: calc(100dvh - 120px);
  border-radius: var(--radius);
  object-fit: contain;
}

.photo-viewer-info {
  color: var(--text2);
  font-size: 14px;
  text-align: center;
}

/* ══════════════════════════════════════════════
   ANIMATIONS
   ══════════════════════════════════════════════ */
.pulse {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.spin {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Streak fire animation */
.streak-value {
  display: inline-block;
  animation: streakGlow 2s ease-in-out infinite alternate;
}

@keyframes streakGlow {
  from { text-shadow: 0 0 8px rgba(0, 255, 135, 0.3); }
  to { text-shadow: 0 0 24px rgba(0, 255, 135, 0.8); }
}

/* Checkbox animation */
.set-done-btn {
  transform-origin: center;
}

.set-done-btn.checked {
  animation: checkPop 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes checkPop {
  0% { transform: scale(0.8); }
  100% { transform: scale(1); }
}

/* ══════════════════════════════════════════════
   AUTH / LOGIN
   ══════════════════════════════════════════════ */
.login-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-overlay.visible {
  display: flex;
}

.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  box-shadow: var(--shadow);
}

.auth-logo {
  font-size: 22px;
  font-weight: 900;
  letter-spacing: -0.04em;
  color: var(--text3);
  margin-bottom: 4px;
}

.auth-logo span {
  color: var(--accent);
}

.auth-title {
  font-size: 20px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 24px;
}

.auth-error {
  display: none;
  background: var(--red-dim);
  border: 1px solid rgba(255,59,59,.3);
  border-radius: var(--radius-sm);
  color: var(--red);
  font-size: 13px;
  font-weight: 600;
  padding: 10px 14px;
  margin-bottom: 14px;
}

.auth-switch {
  text-align: center;
  font-size: 13px;
  color: var(--text2);
  margin-top: 18px;
}

.auth-link {
  color: var(--accent);
  font-weight: 700;
  cursor: pointer;
  text-decoration: underline;
}

/* User avatar in header */
.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--blue-dim);
  border: 2px solid var(--blue);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 900;
  color: var(--blue);
  cursor: pointer;
  flex-shrink: 0;
  transition: var(--transition);
}

.user-avatar.admin {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}

.user-avatar:hover {
  transform: scale(1.08);
}

/* header-actions flex alignment */
.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
