* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #0f0f0f;
  --surface: #1a1a1a;
  --surface2: #242424;
  --accent: #f97316;
  --accent-dim: #ea580c;
  --text: #f0f0f0;
  --text-muted: #888;
  --success: #22c55e;
  --border: #333;
  --radius: 12px;
}

/* Light theme (opt-in via <html data-theme="light">; dark is the default) */
:root[data-theme="light"] {
  --bg: #f4f4f5;
  --surface: #ffffff;
  --surface2: #eeeef0;
  --accent: #ea580c;
  --accent-dim: #c2410c;
  --text: #18181b;
  --text-muted: #6b7280;
  --success: #16a34a;
  --border: #e2e2e6;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  min-height: 100vh;
  font-size: 16px;
}

/* ── Layout ── */
.page {
  max-width: 480px;
  margin: 0 auto;
  padding: 0 16px 32px;
}

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}

.logo {
  font-size: 18px;
  font-weight: 700;
  color: #0000f6;
  letter-spacing: 0.5px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ── Cards ── */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  border: 1px solid var(--border);
}

/* ── Buttons ── */
.btn {
  display: block;
  width: 100%;
  padding: 16px;
  border: none;
  border-radius: var(--radius);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
  text-align: center;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-dim);
}

.btn-primary:disabled {
  background: #555;
  cursor: not-allowed;
}

.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--text);
}

.theme-toggle-btn {
  background: none;
  border: 0;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  padding: 4px;
}

.btn-sm {
  width: auto;
  padding: 8px 16px;
  font-size: 14px;
}

/* ── Forms ── */
.field {
  margin-bottom: 16px;
}

label {
  display: block;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

input[type="tel"],
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"] {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  color: var(--text);
  font-size: 18px;
  outline: none;
  transition: border-color 0.15s;
}

/* Password field with a show/hide eye toggle */
.pw-wrap {
  position: relative;
}
.pw-wrap input {
  padding-right: 52px;
}
.pw-eye {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  background: none;
  border: 0;
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  padding: 6px;
  opacity: 0.7;
  transition: opacity 0.15s;
}
.pw-eye:hover {
  opacity: 1;
}

input:focus {
  border-color: var(--accent);
}

input[type="number"] {
  -moz-appearance: textfield;
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
}

/* ── Login page ── */
.login-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 32px 16px;
  max-width: 380px;
  margin: 0 auto;
}

.login-logo {
  font-size: 28px;
  font-weight: 800;
  color: #0000f6;
  margin-bottom: 6px;
  letter-spacing: 1px;
}

.login-sub {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 40px;
  text-align: center;
}

.login-card {
  background: var(--surface);
  border-radius: 16px;
  padding: 28px 24px;
  width: 100%;
  border: 1px solid var(--border);
}

.login-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 6px;
}

.login-hint {
  color: var(--text-muted);
  font-size: 13px;
  margin-bottom: 24px;
}

.divider {
  height: 1px;
  background: var(--border);
  margin: 20px 0;
}

/* ── Machine page ── */
.machine-name {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.2;
}

.muscle-tag {
  display: inline-block;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 12px;
  color: var(--text-muted);
  margin: 8px 4px 0 0;
}

.video-wrap {
  position: relative;
  padding-bottom: 56.25%;
  border-radius: var(--radius);
  overflow: hidden;
  background: #000;
  margin-bottom: 16px;
}

.video-wrap iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
}

/* ── Rest timer ──
   Rendered by js/rest-timer.js into any #rest-timer-slot / .rest-timer-slot. */
.rest-timer {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 18px 16px;
  margin-bottom: 16px;
  text-align: center;
}
/* A <button> so tapping it to set a custom length is reachable by keyboard
   and screen readers, styled back down to look like plain text. */
.rest-timer-display {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  border: none;
  background: none;
  font-family: inherit;
  cursor: pointer;
  font-size: 50px;
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
  font-variant-numeric: tabular-nums;   /* digits stop jittering as they change */
}
.rest-timer-display:active { opacity: .7; }
.rest-timer-display.done { color: var(--success); }
.rest-timer-caption {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 12px;
}
.rest-timer-btns {
  display: flex;
  gap: 8px;
  justify-content: center;
  align-items: center;
  margin-top: 14px;
  flex-wrap: wrap;
}
.rest-timer-btns button {
  padding: 12px 16px;
  border-radius: 11px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  font-family: inherit;
}
.rest-timer-btns button:active { opacity: .7; }
.rest-timer-go {
  flex: 1 1 auto;
  max-width: 150px;
  border: none !important;
  background: var(--accent) !important;
  color: #000 !important;
  letter-spacing: .5px;
}
.rest-timer-go.running { background: #f59e0b !important; }
.rest-timer-reset { background: none !important; color: var(--text-muted) !important; }

/* ── Log form ── */
.set-row {
  display: grid;
  grid-template-columns: 40px 1fr 1fr 36px;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

.set-num {
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
  font-weight: 600;
}

.set-row input {
  padding: 12px;
  font-size: 16px;
}

/* Number stepper: − / typeable number / + as one pill. Shared by reps (step 1)
   and weight (step 5). The centre stays a real number input, so tapping it still
   lets you type a value like 135 directly. */
.num-stepper {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface2);
  overflow: hidden;
}
.num-stepper input {
  width: 100%;
  min-width: 0;
  border: none;
  background: none;
  border-radius: 0;
  text-align: center;
  padding: 12px 2px;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}
.step-btn {
  flex: 0 0 auto;
  width: 40px;
  border: none;
  background: none;
  color: var(--accent);
  font-size: 22px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  font-family: inherit;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  touch-action: manipulation;   /* no long-press callout / double-tap zoom */
}
.step-btn:active { background: var(--surface); }

.btn-remove {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: color 0.15s;
}

.btn-remove:hover {
  color: #ef4444;
}

.set-headers {
  display: grid;
  grid-template-columns: 40px 1fr 1fr 36px;
  gap: 8px;
  margin-bottom: 6px;
}

.set-headers span {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  text-align: center;
}

/* ── History ── */
.history-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.history-item:last-child {
  border-bottom: none;
}

.history-date {
  font-size: 13px;
  color: var(--text-muted);
}

.history-stats {
  text-align: right;
}

.history-main {
  font-size: 15px;
  font-weight: 600;
}

.history-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ── Dashboard ── */
.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.stat-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
}

.stat-value {
  font-size: 32px;
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.machine-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.machine-row:last-child {
  border-bottom: none;
}

.machine-row-name {
  font-size: 15px;
  font-weight: 500;
  flex: 1;
}

.machine-row-stats {
  font-size: 13px;
  color: var(--text-muted);
  text-align: right;
}

.badge {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  border-radius: 20px;
  padding: 2px 10px;
  font-size: 12px;
  font-weight: 600;
}

/* ── Bottom nav ── */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom);
}

.bottom-nav a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px 0;
  text-decoration: none;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  gap: 4px;
  transition: color 0.15s;
}

.bottom-nav a.active {
  color: var(--accent);
}

.bottom-nav .nav-icon {
  font-size: 22px;
  line-height: 1;
}

.page {
  padding-bottom: 80px;
}

/* ── All-Time Banner ── */
.alltime-banner {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
  text-align: center;
}

.alltime-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 2px;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 6px;
}

.alltime-lbs {
  font-size: 38px;
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 8px;
}

.alltime-milestone {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  display: none;
}

/* ── Filter tabs ── */
.filter-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

.filter-tab {
  flex: 1;
  padding: 10px 4px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.filter-tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ── Toast ── */
#toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--success);
  color: #fff;
  padding: 12px 24px;
  border-radius: 30px;
  font-weight: 600;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
  z-index: 999;
  white-space: nowrap;
}

#toast.show {
  opacity: 1;
}

/* ── Nav link ── */
.nav-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-link:hover {
  color: var(--text);
}

/* ── Recaptcha ── */
#recaptcha-container {
  margin-bottom: 16px;
}

/* ── Spinner ── */
.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid #fff4;
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.empty {
  text-align: center;
  color: var(--text-muted);
  padding: 32px 0;
  font-size: 14px;
}

/* ── Admin Dashboard ── */
.admin-stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 24px;
}

.admin-stat-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 10px;
  text-align: center;
}

.admin-stat-num {
  font-size: 28px;
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
}

.admin-stat-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-top: 4px;
}

.section-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--text-muted);
  margin-bottom: 10px;
  font-weight: 700;
}

.member-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 10px;
}

.member-name {
  font-weight: 700;
  font-size: 16px;
}

.member-phone {
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 2px;
}

.member-meta {
  display: flex;
  gap: 20px;
  margin-top: 12px;
}

.member-meta-item {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}

.member-meta-item strong {
  display: block;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  text-transform: none;
  letter-spacing: 0;
  margin-bottom: 2px;
}

.member-toggle {
  margin-top: 12px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 14px;
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color .15s, color .15s;
}

.member-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.member-workouts {
  display: none;
  margin-top: 12px;
  border-top: 1px solid var(--border);
  padding-top: 10px;
}

.member-workouts.open {
  display: block;
}

.workout-log-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
}

.workout-log-row:last-child {
  border-bottom: none;
}

.workout-log-row span:first-child {
  color: var(--text);
  font-weight: 500;
}

.access-denied {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-muted);
}

.access-denied-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.active-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: var(--success);
  border-radius: 50%;
  margin-right: 6px;
}

/* ── Today's Workout Plan ── */
.todays-workout {
  background: var(--surface);
  border: 2px solid var(--accent);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 20px;
}

.todays-workout-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.todays-workout-title {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--accent);
}

.btn-clear-plan {
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color .15s, color .15s;
}

.btn-clear-plan:hover {
  border-color: #ef4444;
  color: #ef4444;
}

.plan-machine-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.plan-machine-row:last-child {
  border-bottom: none;
}

.plan-machine-link {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
}

.plan-machine-link:active {
  opacity: 0.7;
}

.btn-remove-plan {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 22px;
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
  transition: color .15s;
  flex-shrink: 0;
}

.btn-remove-plan:hover {
  color: #ef4444;
}

.btn-add-plan {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .15s;
  flex-shrink: 0;
  line-height: 1;
}

.btn-add-plan.in-plan {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-size: 14px;
}

/* ── Save Plan inline input ── */
.save-plan-row {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.save-plan-input {
  flex: 1;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text);
  font-size: 15px;
  outline: none;
}

.save-plan-input:focus {
  border-color: var(--accent);
}

.btn-save-plan {
  background: var(--accent);
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s;
}

.btn-save-plan:hover { background: var(--accent-dim); }
.btn-save-plan:disabled { background: #555; cursor: not-allowed; }

/* ── Saved Workout Cards ── */
.saved-plan-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}

.saved-plan-name {
  font-size: 17px;
  font-weight: 800;
}

.saved-plan-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 3px;
}

.saved-plan-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.btn-load-plan {
  flex: 1;
  background: var(--accent);
  border: none;
  border-radius: 8px;
  padding: 10px;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s;
}

.btn-load-plan:hover { background: var(--accent-dim); }

.btn-delete-plan {
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  color: var(--text-muted);
  font-size: 14px;
  cursor: pointer;
  transition: border-color .15s, color .15s;
}

.btn-delete-plan:hover {
  border-color: #ef4444;
  color: #ef4444;
}

.saved-machines-list {
  display: none;
  margin-top: 10px;
  border-top: 1px solid var(--border);
  padding-top: 10px;
}

.saved-machines-list.open { display: block; }

.saved-machine-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.saved-machine-item:last-child { border-bottom: none; }

/* ── Sort toggle ── */
.sort-toggle {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.sort-btn {
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: none;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
}

.sort-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ── Machine History (grouped by date) ── */
.history-date-group {
  border-bottom: 1px solid var(--border);
}

.history-date-group:last-of-type {
  border-bottom: none;
}

.history-date-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 0;
  cursor: pointer;
  user-select: none;
}

.history-date-header:active {
  opacity: 0.7;
}

.history-chevron {
  font-size: 11px;
  color: var(--text-muted);
  margin-left: 12px;
  flex-shrink: 0;
}

.history-day-sessions {
  display: none;
  padding-bottom: 10px;
}

.history-day-sessions.open {
  display: block;
}

.history-session-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0 8px 12px;
  border-top: 1px solid var(--border);
}

.btn-show-older {
  display: block;
  width: 100%;
  margin-top: 16px;
  padding: 10px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  text-align: center;
}

.btn-show-older:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ── Personal Records ── */
.pr-bar {
  display: flex;
  gap: 20px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

.pr-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.pr-icon-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  font-weight: 600;
}

.pr-value {
  font-size: 17px;
  font-weight: 800;
  color: var(--text);
}

.pr-date {
  font-size: 11px;
  color: var(--text-muted);
}

.pr-new-toast {
  font-size: 15px;
}

.pr-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: inherit;
  transition: opacity 0.15s;
}

.pr-row:last-child { border-bottom: none; }

a.pr-row:active { opacity: 0.6; }

.pr-machine-name {
  font-size: 14px;
  font-weight: 600;
  flex: 1;
}

.pr-stats {
  text-align: right;
  font-size: 13px;
}

.pr-weight {
  font-weight: 800;
  color: var(--accent);
}

.pr-volume {
  color: var(--text-muted);
  font-size: 12px;
  margin-top: 2px;
}

/* ── Machine list (member directory + admin plan builder) ── */
.category-header {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--accent);
  padding: 20px 0 10px;
  border-bottom: 2px solid var(--accent);
  margin-bottom: 4px;
  scroll-margin-top: 12px;
}
.machine-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 4px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  transition: background 0.1s;
}
.machine-link:last-child { border-bottom: none; }
.machine-link:active { background: var(--surface2); }
.machine-num {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  min-width: 28px;
  text-align: right;
}
.machine-link-name {
  flex: 1;
  font-size: 15px;
  font-weight: 500;
}
.machine-arrow { color: var(--text-muted); font-size: 18px; }
.free-weights-note {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
  margin-bottom: 8px;
}

/* ── Rendered Markdown (announcements, legal pages, previews) ── */
.md-body {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  word-wrap: break-word;
}
.md-body p { margin: 0 0 10px; }
.md-body > :last-child { margin-bottom: 0; }
.md-body h1 { font-size: 20px; font-weight: 800; margin: 16px 0 8px; }
.md-body h2 { font-size: 17px; font-weight: 800; margin: 14px 0 6px; }
.md-body h3 { font-size: 15px; font-weight: 700; margin: 12px 0 6px; }
.md-body ul,
.md-body ol { margin: 0 0 10px; padding-left: 22px; }
.md-body li { margin-bottom: 4px; }
.md-body a { color: var(--accent); }
.md-body strong { font-weight: 700; }

/* ── Admin: site content editors ── */
.site-ta {
  width: 100%;
  min-height: 90px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  color: var(--text);
  font-size: 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  line-height: 1.5;
  outline: none;
  resize: vertical;
}

.site-ta:focus { border-color: var(--accent); }

.md-preview-btn,
.btn-addlink {
  background: none;
  border: 0;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  padding: 0;
}

.md-preview {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  min-height: 90px;
}

.link-input {
  min-width: 0;
  padding: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
  outline: none;
}

.link-input:focus { border-color: var(--accent); }
