* { box-sizing: border-box; }

:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --accent: #1f6f5f;
  --accent-soft: #e8f5f1;
  --danger: #b42318;
  --shadow: 0 14px 35px rgba(17, 24, 39, 0.08);
}

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 250px 1fr; }

.sidebar {
  background: #111827;
  color: white;
  padding: 28px 20px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 34px; }
.brand-mark {
  width: 42px; height: 42px; border-radius: 13px; background: #dff3ed;
  color: #174f43; display: grid; place-items: center; font-weight: 900;
}
.brand h1 { font-size: 16px; margin: 0; }
.brand p { margin: 3px 0 0; font-size: 12px; color: #9ca3af; }

.nav { display: grid; gap: 8px; }
.nav-item {
  border: 0; background: transparent; color: #d1d5db; text-align: left;
  padding: 12px 14px; border-radius: 10px; font-weight: 700;
}
.nav-item:hover, .nav-item.active { background: rgba(255,255,255,.1); color: white; }
.sidebar-footer { margin-top: auto; display: grid; gap: 8px; }

.main { padding: 26px 34px 50px; max-width: 1400px; width: 100%; margin: 0 auto; }
.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 28px; }
.topbar h2 { margin: 4px 0 0; font-size: 30px; }
.eyebrow { margin: 0; color: var(--muted); font-size: 12px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }

.primary-button, .secondary-button, .danger-button, .icon-button {
  border: 0; border-radius: 10px; padding: 10px 14px; font-weight: 800;
}
.primary-button { background: var(--accent); color: white; }
.primary-button:hover { filter: brightness(.94); }
.secondary-button { background: white; color: var(--text); border: 1px solid var(--line); }
.danger-button { color: var(--danger); background: #fff1f0; }
.icon-button { width: 40px; height: 40px; padding: 0; background: white; border: 1px solid var(--line); }
.full { width: 100%; text-align: center; }
.file-button { display: block; }

.view { display: none; }
.view.active { display: block; }

.hero-grid {
  display: grid; grid-template-columns: 2fr repeat(3, 1fr); gap: 16px; margin-bottom: 30px;
}
.hero-card, .stat-card, .workout-card, .template-card, .day-column {
  background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow);
}
.hero-card {
  background: linear-gradient(135deg, #14251f, #1f6f5f); color: white;
  padding: 24px; display: flex; justify-content: space-between; align-items: center;
}
.hero-card h3 { font-size: 25px; margin: 18px 0 6px; }
.hero-card p { margin: 0; color: #d4ebe5; }
.pill { display: inline-block; padding: 7px 10px; border-radius: 999px; background: rgba(255,255,255,.14); font-size: 12px; font-weight: 800; }
.progress-ring {
  width: 86px; height: 86px; border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(#d8f3eb 0deg, rgba(255,255,255,.17) 0deg);
  position: relative;
}
.progress-ring::after { content: ""; position: absolute; inset: 8px; background: #1c5e50; border-radius: 50%; }
.progress-ring span { position: relative; z-index: 1; font-weight: 900; }

.stat-card { padding: 22px; display: flex; flex-direction: column; justify-content: center; }
.stat-card span, .stat-card small { color: var(--muted); }
.stat-card strong { font-size: 34px; margin: 8px 0 4px; }

.section-heading { display: flex; justify-content: space-between; align-items: end; gap: 16px; margin: 24px 0 14px; }
.section-heading h3 { margin: 4px 0 0; font-size: 23px; }
.week-controls { display: flex; gap: 8px; align-items: center; }

.card-list { display: grid; gap: 12px; }
.workout-card {
  padding: 18px; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 16px;
}
.workout-icon {
  width: 46px; height: 46px; display: grid; place-items: center; border-radius: 14px;
  background: var(--accent-soft); color: var(--accent); font-size: 22px;
}
.workout-card h4 { margin: 0 0 4px; }
.workout-meta { color: var(--muted); font-size: 14px; }
.workout-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: end; }
.status-complete { color: var(--accent); font-weight: 800; }
.empty-state { background: white; border: 1px dashed var(--line); border-radius: 16px; padding: 28px; text-align: center; color: var(--muted); }

.week-grid { display: grid; grid-template-columns: repeat(7, minmax(150px, 1fr)); gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.day-column { min-height: 240px; padding: 14px; box-shadow: none; }
.day-column.today { border-color: var(--accent); }
.day-header { margin-bottom: 12px; }
.day-header strong { display: block; }
.day-header span { color: var(--muted); font-size: 13px; }
.day-workouts { display: grid; gap: 8px; }
.mini-workout { border-radius: 12px; padding: 10px; background: #f8fafc; border: 1px solid var(--line); }
.mini-workout button { width: 100%; text-align: left; border: 0; background: transparent; padding: 0; color: inherit; }
.mini-workout strong { display: block; font-size: 14px; }
.mini-workout span { font-size: 12px; color: var(--muted); }

.template-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.template-card { padding: 20px; }
.template-card h4 { margin: 0 0 10px; font-size: 19px; }
.exercise-list { margin: 0; padding-left: 20px; color: var(--muted); }
.template-card-footer { margin-top: 18px; display: flex; gap: 8px; }

dialog {
  border: 0; border-radius: 20px; width: min(680px, calc(100% - 24px)); padding: 0;
  box-shadow: 0 28px 70px rgba(17,24,39,.25);
}
dialog::backdrop { background: rgba(17,24,39,.6); backdrop-filter: blur(3px); }
.modal-form { padding: 24px; display: grid; gap: 16px; max-height: 88vh; overflow: auto; }
.modal-header { display: flex; justify-content: space-between; gap: 16px; align-items: start; }
.modal-header h3 { margin: 4px 0 0; font-size: 24px; }
.close-button { border: 0; background: transparent; font-size: 28px; line-height: 1; color: var(--muted); }
label { display: grid; gap: 7px; font-size: 13px; font-weight: 800; color: #374151; }
input, select, textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px;
  background: white; color: var(--text);
}
textarea { resize: vertical; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.modal-actions { display: flex; gap: 10px; align-items: center; padding-top: 4px; }
.spacer { flex: 1; }

.exercise-editor { display: grid; gap: 10px; }
.exercise-row {
  display: grid; grid-template-columns: minmax(160px, 2fr) 70px 70px 90px 36px;
  gap: 8px; align-items: end; background: #f8fafc; border: 1px solid var(--line); border-radius: 12px; padding: 10px;
}
.exercise-row label { font-size: 11px; }
.remove-exercise { height: 40px; border: 0; border-radius: 10px; background: #fff1f0; color: var(--danger); font-weight: 900; }

@media (max-width: 1050px) {
  .hero-grid { grid-template-columns: 1fr 1fr; }
  .hero-card { grid-column: span 2; }
}

@media (max-width: 760px) {
  .app-shell { display: block; }
  .sidebar { height: auto; position: static; padding: 14px; }
  .brand { margin-bottom: 12px; }
  .nav { grid-template-columns: repeat(4, 1fr); }
  .nav-item { text-align: center; padding: 9px 4px; font-size: 12px; }
  .sidebar-footer { display: none; }
  .main { padding: 20px 14px 40px; }
  .topbar { align-items: end; }
  .topbar h2 { font-size: 25px; }
  .hero-grid { grid-template-columns: 1fr 1fr; }
  .hero-card { grid-column: span 2; }
  .stat-card { padding: 16px; }
  .stat-card strong { font-size: 28px; }
  .workout-card { grid-template-columns: auto 1fr; }
  .workout-actions { grid-column: 1 / -1; justify-content: stretch; }
  .workout-actions button { flex: 1; }
  .form-grid { grid-template-columns: 1fr; }
  .exercise-row { grid-template-columns: 1fr 1fr 1fr 36px; }
  .exercise-row label:first-child { grid-column: 1 / -1; }
}
