* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, sans-serif;
  background: #1a1a1a;
  color: #e5e5e5;
  min-height: 100vh;
}
.page { padding: 14px; max-width: 880px; margin: 0 auto; }

.header {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  margin-bottom: 12px;
}
.header .download-buttons { display: flex; gap: 8px; }
.download-btn {
  padding: 9px 18px;
  background: #444;
  color: #fff;
  text-decoration: none;
  border-radius: 8px;
  font-weight: 600;
  font-size: 15px;
}
.download-btn:hover { background: #555; }

.modal { position: fixed; inset: 0; z-index: 50; }
.modal--hidden { display: none; }
.modal__backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.65); }
.modal__panel {
  position: relative;
  width: min(520px, calc(100vw - 24px));
  margin: 10vh auto 0 auto;
  background: #2d2d2d;
  border: 1px solid #444;
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.6);
  padding: 16px;
}
.modal__title { font-size: 16px; font-weight: 700; margin-bottom: 6px; }
.modal__subtitle { color: #aaa; font-size: 13px; margin-bottom: 12px; }
.modal__input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #444;
  background: #1f1f1f;
  color: #e5e5e5;
  font-size: 15px;
  outline: none;
}
.modal__input:focus { border-color: #666; }
.modal__error { margin-top: 10px; color: #ff6b6b; font-size: 13px; }
.modal__error--hidden { display: none; }
.modal__actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.modal__btn {
  padding: 9px 14px;
  background: #444;
  color: #fff;
  border-radius: 10px;
  font-weight: 700;
  font-size: 14px;
  border: 1px solid #444;
  cursor: pointer;
}
.modal__btn:hover { background: #555; }
.modal__btn--secondary { background: transparent; border-color: #555; }
.modal__btn--secondary:hover { background: rgba(255,255,255,0.06); }

.card {
  border: 1px solid #444;
  border-radius: 12px;
  padding: 17px;
  background: #2d2d2d;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.workout-title {
  font-weight: 600;
  font-size: 18px;
  margin: 0 0 14px 0;
  color: #e5e5e5;
}
.stats { display: flex; flex-direction: column; gap: 14px; margin-bottom: 18px; }
.stat-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  font-size: 16px;
}
.label { display: block; color: #aaa; margin-bottom: 4px; font-size: 12px; }
.value { font-weight: 600; font-variant-numeric: tabular-nums; }

.chart-wrap { height: 34vh; min-height: 220px; }
.chart-wrap canvas { width: 100% !important; height: 100% !important; }

.card-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}
.card-btn {
  padding: 9px 18px;
  background: #444;
  color: #fff;
  border-radius: 8px;
  font-weight: 600;
  font-size: 15px;
  font-family: inherit;
  border: none;
  cursor: default;
}
.card-btn--disabled {
  background: #333;
  color: #666;
  cursor: not-allowed;
}

@media (max-width: 640px) {
  .stat-row { grid-template-columns: repeat(2, 1fr); }
}
