:root {
  --bg: #0f0f13;
  --bg2: #1b1c27;
  --bg3: #242634;
  --text: #f3f4f8;
  --muted: #8a8faf;
  --accent: #4caf50;
  --accent-soft: rgba(76, 175, 80, 0.14);
  --amber: #ff9800;
  --blue: #2196f3;
  --red: #f44336;
  --border: #2c2f3d;
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

body {
  display: flex;
  justify-content: center;
}

#app {
  width: min(100%, 1120px);
  padding: 0 14px 90px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  padding: 18px 0 10px;
}

.brand {
  font-size: 1.2rem;
  font-weight: 800;
}

.subtext {
  color: var(--muted);
  margin-top: 6px;
  font-size: 0.95rem;
}

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 15, 19, 0.98);
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0;
  padding: 8px 10px;
  z-index: 50;
}

.nav-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 0.8rem;
  padding: 10px 8px;
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  transition: transform 0.2s ease, color 0.2s ease, background 0.2s ease;
}

.nav-btn.active,
.nav-btn:hover {
  color: #fff;
  background: rgba(76, 175, 80, 0.18);
}

.page {
  display: none;
  animation: fadeIn 0.25s ease;
}

.page.active {
  display: block;
}

.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 14px;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.78rem;
  font-weight: 700;
}

.badge-small {
  background: rgba(76, 175, 80, 0.16);
  color: var(--accent);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: 14px;
  padding: 12px 16px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

.btn.secondary {
  background: #32344b;
  color: var(--text);
}

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

.input-group {
  display: grid;
  gap: 10px;
}

input,
select,
textarea {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 14px;
  color: var(--text);
  padding: 14px 14px;
  font-size: 0.98rem;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

@media (max-width: 720px) {
  .grid-2 {
    grid-template-columns: 1fr;
  }

  #app {
    padding-bottom: 128px;
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .nav-btn {
    min-height: 62px;
    font-size: 0.82rem;
  }
}

@media (max-width: 480px) {
  .topbar {
    padding: 14px 0 8px;
  }

  .brand {
    font-size: 1.1rem;
  }

  .btn {
    width: 100%;
  }

  .bottom-nav {
    padding: 10px 8px;
  }
}

.progress-bar {
  background: var(--bg3);
  border-radius: 999px;
  height: 12px;
  overflow: hidden;
  margin-top: 12px;
}

.progress-fill {
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width 0.4s ease;
}

.exercise-card,
.supplement-card,
.log-card {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px;
  margin-bottom: 12px;
}

.exercise-card .row,
.log-card .row,
.supplement-card .row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.exercise-card .title,
.log-card .title,
.supplement-card .title {
  font-weight: 700;
}

.small-label {
  color: var(--muted);
  font-size: 0.88rem;
}

.video-preview {
  width: 120px;
  min-width: 120px;
  height: 78px;
  border-radius: 14px;
  object-fit: cover;
  background: var(--border);
  cursor: pointer;
}

.video-missing {
  width: 120px;
  min-width: 120px;
  height: 78px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: #35384a;
  color: var(--muted);
  font-size: 0.78rem;
  text-align: center;
  padding: 10px;
}

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

.day-grid .day {
  border-radius: 12px;
  background: var(--bg3);
  border: 1px solid var(--border);
  padding: 10px 6px;
  text-align: center;
  font-size: 0.8rem;
  cursor: pointer;
}

.day-grid .day.today {
  border-color: var(--accent);
}

.day-grid .day.complete {
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.day-grid .day.gym {
  background: rgba(76, 175, 80, 0.18);
  border-color: rgba(76, 175, 80, 0.3);
}

.day-grid .day.bike {
  background: rgba(33, 150, 243, 0.16);
  border-color: rgba(33, 150, 243, 0.3);
}

.day-grid .day.pool {
  background: rgba(33, 150, 243, 0.12);
  border-color: rgba(33, 150, 243, 0.28);
}

.day-grid .day.run {
  background: rgba(255, 152, 0, 0.18);
  border-color: rgba(255, 152, 0, 0.3);
}

.day-grid .day.home {
  background: rgba(244, 67, 54, 0.12);
  border-color: rgba(244, 67, 54, 0.28);
}

.day-grid .day.soccer {
  background: rgba(76, 175, 80, 0.16);
  border-color: rgba(76, 175, 80, 0.3);
}

.day-grid .day.rest {
  background: rgba(128, 128, 128, 0.12);
  border-color: rgba(128, 128, 128, 0.2);
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: grid;
  place-items: center;
  padding: 16px;
}

.overlay.hidden {
  display: none;
}

.modal {
  width: min(100%, 520px);
  background: var(--bg2);
  border-radius: 24px;
  padding: 20px;
  box-shadow: 0 20px 70px rgba(0, 0, 0, 0.35);
}

.chart-canvas {
  width: 100%;
  height: 180px;
}

.text-muted {
  color: var(--muted);
}

.type-badge {
  display: inline-flex;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

.type-badge.gym { background: rgba(76, 175, 80, 0.18); color: var(--accent); }
.type-badge.bike { background: rgba(33, 150, 243, 0.18); color: var(--blue); }
.type-badge.pool { background: rgba(33, 150, 243, 0.12); color: var(--blue); }
.type-badge.run { background: rgba(255, 152, 0, 0.18); color: var(--amber); }
.type-badge.home { background: rgba(244, 67, 54, 0.16); color: var(--red); }
.type-badge.soccer { background: rgba(76, 175, 80, 0.16); color: var(--accent); }

.week-preview {
  margin-bottom: 16px;
}

.week-preview:last-child {
  margin-bottom: 0;
}

.week-header {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}

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

.week-days .day {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  transition: all 0.2s ease;
}

.week-days .day.completed {
  background: rgba(76, 175, 80, 0.2);
  border-color: var(--accent);
}

.week-days .day.gym { background: rgba(76, 175, 80, 0.1); color: var(--accent); }
.week-days .day.bike { background: rgba(33, 150, 243, 0.1); color: var(--blue); }
.week-days .day.pool { background: rgba(33, 150, 243, 0.08); color: var(--blue); }
.week-days .day.run { background: rgba(255, 152, 0, 0.1); color: var(--amber); }
.week-days .day.home { background: rgba(244, 67, 54, 0.1); color: var(--red); }
.week-days .day.soccer { background: rgba(76, 175, 80, 0.12); color: var(--accent); }
.week-days .day.rest { background: rgba(255, 255, 255, 0.03); color: var(--muted); }

.program-section {
  margin-bottom: 24px;
}

.program-section h3 {
  color: var(--accent);
  margin: 20px 0 10px 0;
  font-size: 1.1rem;
}

.program-section h4 {
  color: var(--text);
  margin: 16px 0 8px 0;
  font-size: 1rem;
}

.program-section p {
  margin: 8px 0;
  line-height: 1.5;
}

.program-section ul {
  margin: 8px 0;
  padding-left: 20px;
}

.program-section li {
  margin: 4px 0;
  line-height: 1.4;
}

.schedule-day {
  margin: 8px 0;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.schedule-day:last-child {
  border-bottom: none;
}

.workout-table {
  margin: 12px 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.workout-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 12px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
}

.workout-row.header {
  background: rgba(255, 255, 255, 0.05);
  font-weight: 600;
}

.workout-row:last-child {
  border-bottom: none;
}

.workout-row div {
  display: flex;
  align-items: center;
  font-size: 0.9rem;
}

.hr-zones {
  display: grid;
  gap: 12px;
}

.zone {
  background: rgba(255, 255, 255, 0.05);
  padding: 12px;
  border-radius: 8px;
  border-left: 4px solid var(--accent);
}

.supplement {
  margin-bottom: 16px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 8px;
}

.supplement h4 {
  margin: 0 0 8px 0;
  color: var(--accent);
}

.supplement p {
  margin: 4px 0;
  font-size: 0.9rem;
  line-height: 1.4;
}

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