:root {
  --bg: #0a0a12;
  --bg-soft: #111320;
  --card: rgba(20, 22, 34, 0.84);
  --card-border: rgba(255, 255, 255, 0.08);
  --text: #f4f7ff;
  --muted: #aab0c5;
  --primary: #8b5cf6;
  --primary-2: #c084fc;
  --accent: #6d28d9;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --shadow: 0 25px 60px rgba(0, 0, 0, 0.35);
  --radius: 24px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; min-height: 100%; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(139, 92, 246, 0.28), transparent 30%),
    radial-gradient(circle at top right, rgba(168, 85, 247, 0.20), transparent 25%),
    linear-gradient(180deg, #090a12 0%, #0d1020 100%);
}

.app-shell {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 24px;
  padding: 24px;
  min-height: 100vh;
}

.glass-card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.sidebar, .main-content { min-width: 0; }
.sidebar {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 16px;
}
.brand h1, .hero h2, .section-heading h3 { margin: 0; }
.brand-mark {
  width: 58px;
  height: 58px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  box-shadow: 0 12px 35px rgba(139, 92, 246, 0.45);
}
.eyebrow {
  margin: 0 0 6px;
  color: var(--primary-2);
  text-transform: uppercase;
  letter-spacing: .14em;
  font-size: .72rem;
  font-weight: 700;
}
.sidebar-title {
  margin: 0 0 12px;
  font-size: .9rem;
  color: var(--muted);
}
.stats-grid {
  display: grid;
  gap: 12px;
}
.stat-card {
  padding: 16px;
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.02));
  border: 1px solid rgba(255,255,255,0.06);
}
.stat-card span {
  display: block;
  color: var(--muted);
  font-size: .85rem;
  margin-bottom: 8px;
}
.stat-card strong {
  font-size: 1.8rem;
}
.history-list {
  display: grid;
  gap: 12px;
  max-height: 55vh;
  overflow: auto;
}
.history-item {
  padding: 14px;
  border-radius: 18px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.06);
}
.history-item h4, .history-item p { margin: 0; }
.history-item h4 { font-size: .98rem; margin-bottom: 6px; }
.history-item p { color: var(--muted); font-size: .86rem; }
.history-badge {
  display: inline-flex;
  margin-top: 10px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: .8rem;
  background: rgba(139, 92, 246, 0.16);
  color: #e9d5ff;
}

.main-content {
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.hero, .form-panel {
  padding: 28px;
}
.hero {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
}
.hero-copy {
  max-width: 760px;
  color: var(--muted);
  line-height: 1.6;
}
.hero-pill {
  border: 1px solid rgba(255,255,255,0.08);
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.22), rgba(192, 132, 252, 0.14));
  padding: 12px 16px;
  border-radius: 999px;
  white-space: nowrap;
}
.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}
.api-status {
  padding: 10px 14px;
  border-radius: 999px;
  font-size: .85rem;
  border: 1px solid rgba(255,255,255,0.08);
}
.api-status.ok { color: #bbf7d0; background: rgba(34, 197, 94, 0.12); }
.api-status.error { color: #fecaca; background: rgba(239, 68, 68, 0.12); }
.api-status.pending { color: #fde68a; background: rgba(245, 158, 11, 0.12); }

form { display: grid; gap: 20px; }
.top-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
label { display: grid; gap: 10px; }
label span {
  font-size: .9rem;
  color: var(--muted);
  font-weight: 600;
}
select, input[type="date"], textarea, .performance-input, .note-input {
  width: 100%;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(9, 10, 18, 0.88);
  color: var(--text);
  outline: none;
}
textarea { resize: vertical; min-height: 120px; }
.session-meta {
  padding: 16px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.14), rgba(255,255,255,0.03));
  color: var(--muted);
}
.exercise-blocks {
  display: grid;
  gap: 18px;
}
.exercise-block {
  padding: 20px;
  border-radius: 22px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
}
.exercise-block h4 {
  margin: 0 0 14px;
  font-size: 1rem;
}
.exercise-row {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 14px;
  align-items: start;
  padding: 14px 0;
  border-top: 1px solid rgba(255,255,255,0.06);
}
.exercise-row:first-of-type { border-top: none; padding-top: 0; }
.check-wrap {
  display: grid;
  place-items: center;
  margin-top: 8px;
}
.exercise-check { display: none; }
.check-ui {
  width: 24px;
  height: 24px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.04);
  position: relative;
}
.exercise-check:checked + .check-ui {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  border-color: transparent;
}
.exercise-check:checked + .check-ui::after {
  content: '✓';
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: .85rem;
  font-weight: 800;
}
.exercise-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}
.exercise-name { margin: 0 0 4px; font-size: 1rem; }
.exercise-target { margin: 0; color: var(--muted); font-size: .9rem; }
.exercise-load {
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(139, 92, 246, 0.12);
  color: #e9d5ff;
  font-size: .82rem;
  text-align: right;
}
.exercise-inputs {
  display: grid;
  grid-template-columns: 1.25fr .75fr;
  gap: 12px;
  margin-top: 12px;
}
.form-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}
.btn {
  border: 0;
  border-radius: 16px;
  padding: 14px 18px;
  font-weight: 700;
  cursor: pointer;
}
.btn-primary {
  color: white;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  box-shadow: 0 16px 30px rgba(109, 40, 217, 0.35);
}
.btn-secondary {
  color: var(--text);
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
}
.empty-state {
  color: var(--muted);
  font-size: .92rem;
  padding: 10px 0;
}

@media (max-width: 1080px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { order: 2; }
}

@media (max-width: 720px) {
  .app-shell, .hero, .form-panel, .sidebar { padding: 16px; }
  .hero { flex-direction: column; align-items: start; }
  .top-fields, .exercise-inputs { grid-template-columns: 1fr; }
  .exercise-head { flex-direction: column; align-items: start; }
  .form-actions { flex-direction: column; }
  .btn { width: 100%; }
}
