* { box-sizing: border-box; }
body {
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #f5f5f7; color: #1c1c1e; margin: 0; padding: 24px;
}
h1 { margin: 0 0 4px; font-size: 22px; letter-spacing: 0.3px; }
h2 { margin: 0; font-size: 17px; }
h3 { margin: 0 0 8px; font-size: 14px; text-transform: uppercase; letter-spacing: 1px; color: #6b6b6b; }

.topbar {
  background: #1c1c1e; color: #fff; padding: 14px 20px; border-radius: 12px;
  margin-bottom: 20px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}
.topbar .badge { background: #6c40eb; color: #fff; padding: 3px 10px; border-radius: 6px;
  font-size: 11px; font-weight: 700; letter-spacing: 1px; }
.topbar .meta { font-size: 12px; opacity: 0.8; }
.topbar strong { color: #ffd600; }

.card {
  background: #fff; border-radius: 12px; padding: 20px;
  margin-bottom: 16px; border: 1px solid #d1d1d6;
}

/* Onboarding form */
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px 20px; }
label { display: block; font-size: 12px; font-weight: 600; color: #6b6b6b;
  text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px; }
input, select {
  width: 100%; padding: 8px 10px; border: 1px solid #d1d1d6; border-radius: 6px;
  font-size: 14px; font-family: inherit; background: #fff;
}
input:focus, select:focus { outline: none; border-color: #6c40eb; }
.field { margin-bottom: 4px; }
.hint { font-size: 11px; color: #aeaeb2; margin-top: 2px; }

/* Buttons */
.btn {
  display: inline-block; padding: 10px 18px; border: none; border-radius: 8px;
  font-size: 14px; font-weight: 600; cursor: pointer; text-decoration: none;
  transition: transform 0.05s, opacity 0.15s;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: linear-gradient(90deg, #ea580c, #f59e0b, #ea580c); color: #fff; }
.btn-secondary { background: #fff; color: #4a28d4; border: 1.5px solid #1c1c1e; }
.btn-danger { background: #fff; color: #b91c1c; border: 1.5px solid #b91c1c; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 16px; }

/* Workout table */
.workout-header {
  display: flex; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap;
}
.badge-sess { font-size: 11px; padding: 4px 10px; border-radius: 6px; font-weight: 700; letter-spacing: 0.5px; }
.sess-a { background: #e0f2fe; color: #075985; }
.sess-b { background: #d1fae5; color: #065f46; }
.sess-c { background: #fef3c7; color: #92400e; }

table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.8px;
  color: #6b6b6b; padding: 6px 8px; border-bottom: 2px solid #e8e8ed; }
td { padding: 8px; border-bottom: 1px solid #f2f2f7; vertical-align: middle; }
td.num { font-family: 'SF Mono', Menlo, monospace; text-align: center; font-weight: 500; }
td.ex-name { font-weight: 500; }
td.g-push, td.g-Push { color: #b45309; font-weight: 600; }
td.g-pull, td.g-Pull { color: #1d4ed8; font-weight: 600; }
td.g-core, td.g-Core { color: #6c40eb; font-weight: 600; }
td.g-legs, td.g-Legs { color: #047857; font-weight: 600; }
td.g-shoulder, td.g-Shoulder { color: #be185d; font-weight: 600; }
td.r-main, td.r-endMain { font-weight: 700; }
td.r-accessory { color: #6b6b6b; }
td.r-endMain::before { content: '⚡ '; }
.d-new { color: #6c40eb; font-weight: 700; }
.d-up { color: #047857; font-weight: 600; }
.d-down { color: #b91c1c; font-weight: 600; }
.d-same { color: #aeaeb2; }

/* Feedback per gruppo */
.feedback-row {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px; margin-top: 16px;
}
.feedback-cell { background: #fafafa; padding: 10px 12px; border-radius: 8px; }
.feedback-cell label { display: block; margin-bottom: 6px; }

/* History */
.history-item {
  padding: 8px 10px; border-bottom: 1px solid #f2f2f7;
  display: flex; gap: 12px; font-size: 13px;
}
.history-item .nworkout { font-weight: 700; min-width: 50px; }

.error { background: #fef2f2; color: #991b1b; padding: 10px 14px; border-radius: 8px;
  margin-bottom: 12px; border: 1px solid #fecaca; }
.ok-toast { background: #ecfdf5; color: #065f46; padding: 10px 14px; border-radius: 8px;
  margin-bottom: 12px; border: 1px solid #a7f3d0; }

.muted { color: #aeaeb2; font-size: 12px; }
.right { text-align: right; }
