* { box-sizing: border-box; }

:root {
  --bg: #f8fafc;
  --panel: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --soft: #f1f5f9;
  --accent: #2563eb;
  --accent-dark: #1d4ed8;
  --danger: #dc2626;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

.hero {
  background: #0f172a;
  color: white;
  padding: 28px max(20px, calc((100vw - 1100px)/2));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.hero h1 {
  margin: 2px 0 8px;
  font-size: clamp(2rem, 6vw, 3.3rem);
  line-height: 1;
}

.eyebrow {
  margin: 0;
  color: #93c5fd;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.8rem;
  letter-spacing: .08em;
}

.subtitle {
  margin: 0;
  color: #cbd5e1;
}

.container {
  width: min(1100px, calc(100% - 24px));
  margin: 24px auto 60px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px;
  box-shadow: 0 8px 30px rgba(15, 23, 42, 0.06);
  margin-bottom: 18px;
}

.top-grid {
  display: grid;
  grid-template-columns: 180px 1fr auto;
  gap: 14px;
  align-items: end;
}

label {
  display: block;
  font-size: .85rem;
  font-weight: 700;
  margin-bottom: 7px;
}

input, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 12px;
  font-size: 16px;
  background: white;
  color: var(--text);
}

input:focus, select:focus {
  outline: 3px solid rgba(37, 99, 235, .15);
  border-color: var(--accent);
}

.btn {
  border: 0;
  border-radius: 10px;
  padding: 11px 14px;
  font-weight: 800;
  cursor: pointer;
}

.btn.primary { background: var(--accent); color: white; }
.btn.primary:hover { background: var(--accent-dark); }
.btn.secondary { background: var(--soft); color: var(--text); }
.btn.ghost { background: transparent; color: white; border: 1px solid #475569; }
.btn.mini { padding: 8px 10px; font-size: .9rem; background: var(--soft); color: var(--text); }

.section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}

.section-title h2 {
  margin: 0 0 4px;
  font-size: 1.2rem;
}

.section-title p {
  margin: 0;
  color: var(--muted);
  font-size: .92rem;
}

.exercise-list {
  display: grid;
  gap: 14px;
}

.exercise-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  background: #fff;
}

.exercise-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.exercise-name {
  font-weight: 800;
  font-size: 1rem;
  border: 0;
  padding: 0;
  border-radius: 0;
}

.exercise-name:focus {
  outline: none;
  border-bottom: 2px solid var(--accent);
}

.muscle-label {
  margin-top: 4px;
  font-size: .82rem;
  color: var(--muted);
}

.sets-table {
  overflow-x: auto;
  margin-bottom: 10px;
}

.set-row {
  display: grid;
  grid-template-columns: 70px minmax(95px, 1fr) minmax(110px, 1fr) 38px;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

.set-head {
  font-size: .78rem;
  color: var(--muted);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.icon-btn {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 9px;
  background: var(--soft);
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
}

.icon-btn:hover {
  background: #fee2e2;
  color: var(--danger);
}

.history-list {
  display: grid;
  gap: 10px;
}

.history-item {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  display: grid;
  grid-template-columns: 130px 1fr auto;
  gap: 12px;
  align-items: center;
}

.history-date { font-weight: 800; }
.history-meta { color: var(--muted); font-size: .9rem; }
.history-actions { display: flex; gap: 8px; }

.empty {
  padding: 26px 10px;
  text-align: center;
  color: var(--muted);
}

@media (max-width: 720px) {
  .hero {
    align-items: flex-start;
    flex-direction: column;
  }

  .top-grid {
    grid-template-columns: 1fr;
  }

  .actions .btn {
    width: 100%;
  }

  .section-title {
    align-items: stretch;
    flex-direction: column;
  }

  .section-title .btn {
    width: 100%;
  }

  .history-item {
    grid-template-columns: 1fr;
  }

  .history-actions {
    width: 100%;
  }

  .history-actions .btn {
    flex: 1;
  }

  .set-row {
    grid-template-columns: 52px minmax(85px, 1fr) minmax(95px, 1fr) 34px;
  }

  .panel {
    padding: 14px;
    border-radius: 14px;
  }
}
