:root {
  --bg: #080808;
  --surface: #101010;
  --surface2: #181818;
  --surface3: #222;
  --border: #2a2a2a;
  --border2: #333;
  --accent: #c8ff00;
  --accent-dim: rgba(200,255,0,0.1);
  --accent-dim2: rgba(200,255,0,0.05);
  --text: #f0f0f0;
  --text-mid: #aaaaaa;
  --text-muted: #8a8a8a;
  --success: #00cc88;
  --success-dim: rgba(0,204,136,0.1);
  --warn: #ffaa00;
  --danger: #ff4444;
  --prog: #a78bfa;
  --prog-dim: rgba(167,139,250,0.1);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 6px;
}

body.theme-light {
  --bg: #f2f2f2;
  --surface: #ffffff;
  --surface2: #e8e8e8;
  --surface3: #dedede;
  --border: #d4d4d4;
  --border2: #bbb;
  --text: #111111;
  --text-mid: #505050;
  --text-muted: #606060;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html, body { height: 100%; overflow: hidden; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 20px;
}

/* ── UTILITIES ── */
.hidden { display: none !important; }
.flex { display: flex; }
.col { flex-direction: column; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.prog-col { color: var(--prog); }
.accent-col { color: var(--accent); }
.muted { color: var(--text-muted); }
.mid { color: var(--text-mid); }

/* ── SCREENS ── */
.screen {
  position: fixed; inset: 0;
  display: flex; flex-direction: column;
  overflow: hidden;
}
.screen.hidden { display: none; }

/* ── AUTH SCREEN ── */
#auth-screen {
  background: var(--bg);
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-box {
  width: 100%;
  max-width: 400px;
}

.auth-logo {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 64px;
  letter-spacing: 8px;
  color: var(--accent);
  text-align: center;
  line-height: 1;
  margin-bottom: 6px;
}

.auth-tagline {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  letter-spacing: 2px;
  margin-bottom: 40px;
}

.auth-tabs {
  display: flex;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: 24px;
}

.auth-tab {
  flex: 1;
  background: none;
  border: none;
  padding: 12px;
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  letter-spacing: 1px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
}
.auth-tab.active { background: var(--accent-dim); color: var(--accent); }

.auth-form { display: flex; flex-direction: column; gap: 12px; }

.field-label {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 1px;
  margin-bottom: 5px;
}

.field-input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  color: var(--text);
  transition: border-color 0.15s;
}
.field-input:focus { outline: none; border-color: var(--accent); }
.field-input::placeholder { color: var(--text-muted); }

textarea.field-input { resize: none; min-height: 70px; }

.auth-error {
  background: rgba(255,68,68,0.08);
  border: 1px solid rgba(255,68,68,0.3);
  border-radius: var(--radius-xs);
  padding: 10px 14px;
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  color: var(--danger);
  display: none;
}

.btn {
  border: none;
  border-radius: var(--radius-sm);
  font-family: 'DM Mono', monospace;
  font-size: 13px;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn-primary {
  background: var(--accent);
  color: #000;
  padding: 14px 20px;
  font-size: 14px;
  width: 100%;
  font-weight: 600;
}
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-secondary {
  background: var(--surface2);
  border: 1px solid var(--border2);
  color: var(--text-mid);
  padding: 10px 16px;
}
.btn-secondary:hover { border-color: var(--border2); color: var(--text); }

.btn-ghost {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 8px 14px;
  font-size: 11px;
}
.btn-ghost:hover { border-color: var(--border2); color: var(--text-mid); }

.btn-danger {
  background: rgba(255,68,68,0.08);
  border: 1px solid rgba(255,68,68,0.25);
  color: var(--danger);
  padding: 8px 14px;
  font-size: 11px;
}

.btn-accent {
  background: var(--accent-dim);
  border: 1px solid var(--accent);
  color: var(--accent);
  padding: 10px 16px;
}

.btn-ai {
  background: var(--ai-dim);
  border: 1px solid var(--ai);
  color: var(--ai);
  padding: 10px 16px;
}

/* ── APP SHELL ── */
#app-screen {
  background: var(--bg);
}

.app-header {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 0 16px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  z-index: 50;
}

.app-logo {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 28px;
  letter-spacing: 4px;
  color: var(--accent);
  line-height: 34px;
}

.user-badge {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 10px;
}
.header-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 34px;
  min-width: 34px;
  padding: 0 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: none;
  cursor: pointer;
  font-size: 16px;
  color: var(--text-muted);
  touch-action: manipulation;
  gap: 6px;
}
.header-btn:active { background: var(--surface2); }

/* ── DONATE MODAL ── */
.donate-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 200;
}
.donate-overlay.open { display: block; }
.donate-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  border-radius: 0 0 var(--radius) var(--radius);
  padding: 20px 20px 24px;
  z-index: 201;
  transform: translateY(-100%);
  transition: transform 0.28s cubic-bezier(0.4,0,0.2,1);
}
.donate-modal.open { transform: translateY(0); }
.donate-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.donate-modal-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 22px;
  letter-spacing: 2px;
  color: var(--accent);
}
.donate-modal-close {
  background: none;
  border: none;
  font-size: 20px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 8px;
  touch-action: manipulation;
}
.donate-modal-sub {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  margin-bottom: 18px;
}
.donate-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.donate-select {
  flex: 1;
  height: 44px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: 'DM Mono', monospace;
  font-size: 14px;
  padding: 0 12px;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238a8a8a' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}
.donate-venmo-btn {
  height: 44px;
  padding: 0 18px;
  background: #008CFF;
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  letter-spacing: 1px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  touch-action: manipulation;
}
.donate-venmo-btn:active { opacity: 0.85; }
.header-btn-label {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--text-muted);
}
.header-profile-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: var(--text-muted);
}

.app-body {
  flex: 1;
  overflow: hidden;
  display: flex;
  position: relative;
}

/* ── BOTTOM NAV ── */
.bottom-nav {
  display: flex;
  background: var(--bg);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px 4px;
  background: none;
  border: none;
  cursor: pointer;
  gap: 3px;
  transition: all 0.15s;
  color: var(--text-muted);
}

.nav-btn.active { color: var(--accent); }
.nav-btn.active .nav-icon { color: var(--accent); }

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

.nav-label {
  font-family: 'DM Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.5px;
}

/* ── PANELS ── */
.panel {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px;
  display: none;
}
.panel.active { display: block; }
.ptr-indicator { text-align:center; font-family:'DM Mono',monospace; font-size:11px; color:var(--text-muted); letter-spacing:0.06em; padding:10px 0 0; opacity:0; transition:opacity 0.15s; pointer-events:none; }
.ptr-indicator.visible { opacity:1; }

/* ── SECTION HEADER ── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.section-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 20px;
  letter-spacing: 2px;
  color: var(--text-muted);
}

/* ── WORKOUT CARDS ── */
.workout-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: border-color 0.15s;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.workout-card:hover { border-color: var(--border2); }
.workout-card:active { border-color: var(--accent); }

.workout-card-info { flex: 1; min-width: 0; }

.workout-card-name {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.workout-card-meta {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: var(--text-muted);
}

.workout-card-arrow { color: var(--text-muted); font-size: 18px; }
.workout-drag-handle {
  font-size: 18px;
  color: var(--text-muted);
  padding: 4px 10px 4px 0;
  cursor: grab;
  flex-shrink: 0;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  line-height: 1;
  display: flex;
  align-items: center;
}
.workout-card.is-dragging { opacity: 0.2; }
/* ── REST TIMER ── */
.rest-timer-bar {
  position: relative;
  max-height: 0;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--surface2);
  border-top: 0px solid var(--border);
  transition: max-height 0.25s ease, border-top-width 0.25s;
}
.rest-timer-bar.active {
  max-height: 60px;
  border-top-width: 1px;
}
.rest-timer-progress {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  background: var(--accent-dim);
  transition: width 1s linear;
  z-index: 0;
}
.rest-timer-content {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 8px 16px;
}
.rest-timer-label {
  font-family: 'DM Mono', monospace;
  font-size: 9px;
  letter-spacing: 1.5px;
  color: var(--text-muted);
}
.rest-timer-display {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 30px;
  letter-spacing: 2px;
  color: var(--text);
  min-width: 64px;
  text-align: center;
  line-height: 1;
}
.rest-timer-adj {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface3);
  color: var(--text);
  font-size: 20px;
  cursor: pointer;
  touch-action: manipulation;
  display: flex; align-items: center; justify-content: center;
  line-height: 1;
  flex-shrink: 0;
}
.rest-timer-skip {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: none;
  background: none;
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
  touch-action: manipulation;
  flex-shrink: 0;
}
/* ── SESSION TIMER BAR ── */
.session-timer-bar {
  max-height: 0;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--surface2);
  border-bottom: 0px solid var(--border);
  transition: max-height 0.25s ease, border-bottom-width 0.25s;
}
.session-timer-bar.active {
  max-height: 52px;
  border-bottom-width: 1px;
}
.session-timer-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 8px 16px;
}
.session-timer-label {
  font-family: 'DM Mono', monospace;
  font-size: 9px;
  letter-spacing: 1.5px;
  color: var(--text-muted);
}
.session-timer-display {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 30px;
  letter-spacing: 2px;
  color: var(--accent);
  min-width: 80px;
  text-align: center;
  line-height: 1;
}
.session-timer-ctrl {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.5px;
  padding: 5px 10px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border2);
  background: var(--surface3);
  color: var(--text);
  cursor: pointer;
  touch-action: manipulation;
  flex-shrink: 0;
}
.session-timer-ctrl.running {
  border-color: var(--accent);
  color: var(--accent);
}
/* ── SESSION HISTORY ── */
.history-entry {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  overflow: hidden;
}
.history-entry-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  cursor: pointer;
  gap: 8px;
  background: var(--surface2);
}
.history-entry-header:active { background: var(--surface3); }
.history-entry-left { flex: 1; min-width: 0; }
.history-entry-name {
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.history-entry-meta {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 2px;
}
.history-entry-chevron {
  color: var(--text-muted);
  font-size: 14px;
  transition: transform 0.2s;
  flex-shrink: 0;
}
.history-entry.open .history-entry-chevron { transform: rotate(90deg); }
.history-entry-body {
  display: none;
  padding: 10px 14px 12px;
  border-top: 1px solid var(--border);
}
.history-entry.open .history-entry-body { display: block; }
.history-ex-line {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  color: var(--text-muted);
  padding: 3px 0;
  border-bottom: 1px solid var(--border);
}
.history-ex-line:last-of-type { border-bottom: none; }
.history-session-note {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  color: var(--text);
  background: var(--surface3);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  margin-top: 8px;
  line-height: 1.6;
  white-space: pre-wrap;
}
/* ── BODYWEIGHT ── */
.bw-widget {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
/* ── SESSION NOTE ── */
.session-note-wrap {
  margin: 16px 0 8px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.session-note-wrap .field-input {
  font-size: 13px;
  line-height: 1.5;
}
.workout-rehab-tag {
  display: inline-block;
  font-family: 'DM Mono', monospace;
  font-size: 9px;
  letter-spacing: 1px;
  color: #e8a020;
  background: rgba(232,160,32,0.1);
  border: 1px solid rgba(232,160,32,0.3);
  border-radius: 3px;
  padding: 2px 6px;
  margin-top: 5px;
}

/* ── EMPTY STATE ── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state-icon { font-size: 40px; margin-bottom: 16px; opacity: 0.4; }
.empty-state-text { font-family: 'DM Mono', monospace; font-size: 12px; letter-spacing: 0.5px; line-height: 1.8; }

/* ── STARTER PROGRAMS ── */
.get-started-banner {
  background: var(--accent-dim2);
  border: 1px solid rgba(200,255,0,0.25);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 10px;
  text-align: center;
}
.get-started-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 20px;
  letter-spacing: 2px;
  color: var(--accent);
  margin-bottom: 4px;
}
.get-started-sub {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 14px;
  line-height: 1.6;
}
.program-card {
  background: var(--surface2);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.program-card:hover { border-color: var(--border2); }
.program-card.active { border-color: var(--accent); background: var(--accent-dim); }
.program-card-name {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 20px;
  letter-spacing: 1.5px;
  margin-bottom: 3px;
}
.program-card-tag {
  font-family: 'DM Mono', monospace;
  font-size: 9px;
  letter-spacing: 1.5px;
  color: var(--accent);
  margin-bottom: 10px;
}
.program-card-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.55;
  margin-bottom: 14px;
}
.program-card-days {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.program-day-tag {
  font-family: 'DM Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.5px;
  background: var(--surface3);
  border: 1px solid var(--border2);
  border-radius: 4px;
  padding: 3px 8px;
  color: var(--text-muted);
}
.starter-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
}
.starter-tab {
  flex: 1;
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  letter-spacing: 1px;
  padding: 8px 6px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.starter-tab.active {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}
.rehab-disclaimer {
  background: rgba(255,180,0,0.08);
  border: 1px solid rgba(255,180,0,0.3);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-bottom: 14px;
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  color: var(--text-muted);
  line-height: 1.6;
}

/* ── MODAL ── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.modal-backdrop.hidden { display: none; }

.modal {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius) var(--radius) 0 0;
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 24px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.modal-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 20px;
  letter-spacing: 2px;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 22px;
  cursor: pointer;
  line-height: 1;
  padding: 4px;
}

.modal-footer {
  display: flex;
  gap: 8px;
  margin-top: 20px;
}

.form-group { margin-bottom: 14px; }

/* ── EXERCISE BUILDER ── */
.exercise-builder-item {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  user-select: none;
  -webkit-user-select: none;
}

.exercise-builder-info { flex: 1; min-width: 0; }
.exercise-builder-name { font-size: 14px; font-weight: 500; margin-bottom: 2px; }
.exercise-builder-meta { font-family: 'DM Mono', monospace; font-size: 11px; color: var(--text-muted); }
.exercise-builder-actions { display: flex; gap: 6px; }

.drag-handle {
  color: var(--text-muted);
  cursor: grab;
  font-size: 18px;
  padding: 0 4px;
  flex-shrink: 0;
}

@keyframes jiggle {
  0%   { transform: rotate(-1.5deg); }
  100% { transform: rotate(1.5deg); }
}
.jiggle-mode .exercise-builder-item {
  animation: jiggle 0.18s ease-in-out infinite alternate;
  cursor: grab;
  touch-action: none;
  user-select: none;
}
.jiggle-mode .exercise-builder-item:nth-child(2n) {
  animation-direction: alternate-reverse;
  animation-delay: 0.09s;
}
.exercise-builder-item.is-dragging {
  opacity: 0.2;
  animation: none !important;
}
.drag-ghost {
  position: fixed;
  z-index: 9999;
  pointer-events: none;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  border-radius: var(--radius-sm);
  background: var(--surface2);
  border: 1px solid var(--accent);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  transform: scale(1.04) rotate(1.5deg);
  opacity: 0.95;
}
.jiggle-done-btn {
  display: block;
  margin: 4px auto 8px;
  padding: 8px 28px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 20px;
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  cursor: pointer;
}

/* ── COOL DOWN ── */
.cooldown-wrap { margin: 16px 0 8px; }
.cooldown-toggle { width: 100%; background: none; border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text-muted); font-family: 'DM Mono', monospace; font-size: 12px; letter-spacing: 0.08em; padding: 10px 14px; text-align: left; cursor: pointer; display: flex; justify-content: space-between; align-items: center; }
.cooldown-toggle.open { border-radius: var(--radius-sm) var(--radius-sm) 0 0; border-bottom-color: transparent; color: var(--text); }
.cooldown-items { border: 1px solid var(--border); border-top: none; border-radius: 0 0 var(--radius-sm) var(--radius-sm); margin-bottom: 0; }
.cooldown-item { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-bottom: 1px solid var(--border); }
.cooldown-item:last-child { border-bottom: none; }
.cooldown-item-info { flex: 1; min-width: 0; }
.cooldown-item-name { font-size: 13px; font-weight: 500; margin-bottom: 2px; }
.cooldown-item-meta { font-family: 'DM Mono', monospace; font-size: 10px; color: var(--text-muted); }
.cooldown-timer-btn { font-family: 'DM Mono', monospace; font-size: 13px; font-weight: 700; color: var(--accent); background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; min-width: 46px; text-align: center; cursor: pointer; flex-shrink: 0; user-select: none; }
.cooldown-timer-btn.running { border-color: var(--accent); background: var(--accent-dim2); }
.cooldown-timer-btn.done { color: var(--success); border-color: rgba(0,204,136,0.4); }

/* ── LOG SCREEN ── */
.log-workout-select {
  margin-bottom: 14px;
}

.select-styled {
  flex: 1;
  width: 100%;
  box-sizing: border-box;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}
.select-styled:focus { outline: none; border-color: var(--accent); }

/* ── EXERCISE LOG CARD ── */
.log-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 10px;
  overflow: hidden;
  transition: border-color 0.2s;
}
.log-card.complete { border-color: rgba(0,204,136,0.4); }

.log-card-header {
  padding: 12px 14px 10px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.log-card-name { font-size: 15px; font-weight: 600; margin-bottom: 2px; }
.log-card-meta { font-family: 'DM Mono', monospace; font-size: 12px; color: var(--text-mid); }
.log-card-note { font-size: 12px; color: var(--text-muted); margin-top: 3px; font-style: italic; }

.weight-ctrl {
  display: flex;
  align-items: center;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  flex-shrink: 0;
}

.weight-ctrl-btn {
  background: none;
  border: none;
  color: var(--text-mid);
  width: 44px;
  height: 44px;
  font-size: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
}
.weight-ctrl-btn:active { background: var(--border2); color: var(--accent); }

.weight-ctrl-val {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 22px;
  letter-spacing: 1px;
  min-width: 52px;
  text-align: center;
  line-height: 44px;
}

.weight-ctrl-unit {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  color: var(--text-muted);
  text-align: center;
  margin-top: 2px;
}

.progress-badge {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  color: var(--accent);
  text-align: center;
  margin-top: 2px;
}
.progress-badge.hidden { display: none; }

/* Sets */
.sets-row {
  display: flex;
  gap: 6px;
  padding: 0 14px 12px;
}

.set-btn {
  flex: 1;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 4px;
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.set-btn.done { background: var(--success-dim); border-color: rgba(0,204,136,0.4); color: var(--success); }

/* Timer */
.timer-wrap {
  margin: 0 14px 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}

.timer-top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.timer-label-sm {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 1px;
}

.timer-display {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 32px;
  letter-spacing: 2px;
  color: var(--text);
  line-height: 1;
}
.timer-display.running { color: var(--accent); }
.timer-display.done { color: var(--success); }

.timer-btns { display: flex; gap: 6px; }

.timer-btn {
  flex: 1;
  background: var(--accent-dim);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  color: var(--accent);
  padding: 8px;
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  letter-spacing: 1px;
  cursor: pointer;
  text-align: center;
}
.timer-btn:active { background: var(--accent); color: #000; }
.timer-btn.reset { background: none; border-color: var(--border); color: var(--text-muted); }

/* Log notes */
.log-notes {
  margin: 0 14px 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  color: var(--text);
  width: calc(100% - 28px);
  resize: none;
  min-height: 32px;
}
.log-notes::placeholder { color: var(--text-muted); font-style: italic; }
.log-notes:focus { outline: none; }

/* Finish */
.finish-row {
  padding: 16px 0 40px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.finish-meta {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
}

/* Deload badge */
.deload-strip {
  background: rgba(255,170,0,0.07);
  border-bottom: 1px solid rgba(255,170,0,0.25);
  padding: 8px 16px;
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: var(--warn);
  letter-spacing: 0.5px;
  display: none;
}
.deload-strip.show { display: block; }

/* ── STATS PANEL ── */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}

.stat-tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.stat-tile-label {
  font-family: 'DM Mono', monospace;
  font-size: 9px;
  color: var(--text-muted);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.stat-tile-value {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 32px;
  letter-spacing: 2px;
  color: var(--accent);
  line-height: 1;
}

.stat-tile-sub {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 3px;
}

.chart-tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}

.chart-tile-title {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 1px;
  margin-bottom: 12px;
}

.chart-wrap { height: 200px; }

/* ── PROGRAM PANEL ── */
.program-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}
.program-section-title {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  margin-bottom: 14px;
  text-transform: uppercase;
}
.pr-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.pr-table th {
  font-family: 'DM Mono', monospace;
  font-size: 9px;
  letter-spacing: 1px;
  color: var(--text-muted);
  text-align: left;
  padding: 0 0 10px 0;
  border-bottom: 1px solid var(--border);
}
.pr-table th:last-child,
.pr-table td:last-child { text-align: right; }
.pr-table td {
  padding: 9px 0;
  border-bottom: 1px solid var(--border2);
  color: var(--text);
  vertical-align: middle;
}
.pr-table tr:last-child td { border-bottom: none; }
.pr-weight { font-family: 'Bebas Neue', sans-serif; font-size: 17px; color: var(--accent); letter-spacing: 1px; }
.pr-date { font-family: 'DM Mono', monospace; font-size: 10px; color: var(--text-muted); }
.prog-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 10px;
}
.prog-card-name {
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 10px;
}
.prog-rule-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.prog-select {
  flex: 1;
  position: relative;
}
.prog-select-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-family: 'DM Mono', monospace;
  font-size: 13px;
  letter-spacing: 0.5px;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s;
}
.prog-select-btn:active { border-color: var(--accent); }
.prog-select-arrow { color: var(--text-muted); font-size: 10px; flex-shrink: 0; }
.prog-select-opts {
  position: absolute;
  top: calc(100% + 4px);
  left: 0; right: 0;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  z-index: 20;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
.prog-select-opts.hidden { display: none; }
.prog-select-opt {
  padding: 11px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}
.prog-select-opt:last-child { border-bottom: none; }
.prog-select-opt:active { background: var(--surface3); }
.prog-select-opt-name {
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  letter-spacing: 0.5px;
  color: var(--text);
  margin-bottom: 3px;
}
.prog-select-opt-desc {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
}
.prog-double-range {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: var(--text-muted);
}
.prog-double-range input {
  width: 52px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 5px 8px;
  color: var(--text);
  font-size: 13px;
  text-align: center;
}
.tm-row {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
}
.tm-input-wrap {
  flex: 1;
}
.tm-input-wrap label {
  font-family: 'DM Mono', monospace;
  font-size: 9px;
  letter-spacing: 1px;
  color: var(--text-muted);
  display: block;
  margin-bottom: 5px;
}
.tm-result {
  text-align: center;
  padding: 14px;
  background: var(--surface2);
  border-radius: var(--radius-sm);
  margin-bottom: 14px;
}
.tm-result-label {
  font-family: 'DM Mono', monospace;
  font-size: 9px;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.tm-result-val {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 36px;
  color: var(--accent);
  letter-spacing: 2px;
}
.tm-pct-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.tm-pct-table td {
  padding: 8px 6px;
  border-bottom: 1px solid var(--border);
}
.tm-pct-table tr:last-child td { border-bottom: none; }
.tm-pct-table td:first-child { font-family: 'DM Mono', monospace; font-size: 11px; color: var(--text-muted); white-space: nowrap; }
.tm-pct-table td:nth-child(2) { font-family: 'Bebas Neue', sans-serif; font-size: 16px; color: var(--text); letter-spacing: 1px; text-align: center; }
.tm-pct-table td:last-child { font-family: 'DM Mono', monospace; font-size: 11px; color: var(--text-muted); text-align: right; }
.tm-pct-table tr.hypertrophy-zone td { background: var(--accent-dim2); }
.tm-pct-table tr.hypertrophy-zone td:first-child { color: var(--accent); }
.tm-zone-label {
  font-family: 'DM Mono', monospace;
  font-size: 9px;
  letter-spacing: 1px;
  color: var(--accent);
  text-transform: uppercase;
  margin-left: 6px;
  opacity: 0.8;
}
.tm-safety-note {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  color: var(--text-muted);
  font-style: italic;
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  line-height: 1.6;
}
.deload-setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.deload-setting-label {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: var(--text);
}
.deload-setting-sub {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 2px;
}
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.4} }

/* ── PROFILE PANEL ── */
.profile-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}

.profile-section-title {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 1px;
  margin-bottom: 12px;
}

/* ── LARGE TEXT ── */
body.large-text { font-size: 26px; }
body.large-text .log-card-name       { font-size: 24px; }
body.large-text .log-card-meta       { font-size: 18px; }
body.large-text .set-btn             { font-size: 19px; padding: 16px 8px; }
body.large-text .workout-card-name   { font-size: 24px; }
body.large-text .workout-card-meta   { font-size: 17px; }
body.large-text .exercise-builder-name { font-size: 22px; }
body.large-text .exercise-builder-meta { font-size: 17px; }
body.large-text .section-title       { font-size: 24px; }
body.large-text .field-label         { font-size: 17px; }
body.large-text .field-input         { font-size: 22px; }
body.large-text .nav-label           { font-size: 14px; }
body.large-text .cooldown-item-name  { font-size: 22px; }
body.large-text .cooldown-item-meta  { font-size: 17px; }
body.large-text .cooldown-toggle     { font-size: 19px; }
body.large-text .stat-tile-label     { font-size: 17px; }
body.large-text .stat-tile-value     { font-size: 36px; }
body.large-text .log-card-note       { font-size: 17px; }
body.large-text .weight-ctrl-val     { font-size: 24px; }
body.large-text .btn                 { font-size: 18px; }

/* ── APPEARANCE SETTINGS ── */
.theme-btns { display: flex; gap: 8px; }
.theme-btn {
  flex: 1; padding: 9px 4px;
  border: 1px solid var(--border2);
  border-radius: var(--radius-xs);
  background: var(--surface2);
  color: var(--text-mid);
  font-family: 'DM Mono', monospace;
  font-size: 10px; letter-spacing: 1px;
  cursor: pointer; transition: all 0.15s;
}
.theme-btn.active { background: var(--accent-dim); border-color: var(--accent); color: var(--accent); }
.accent-swatches { display: flex; gap: 12px; flex-wrap: wrap; padding-top: 2px; }
.accent-swatch {
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 3px solid transparent;
  cursor: pointer;
  outline: 2px solid transparent;
  outline-offset: 2px;
  transition: transform 0.15s, outline-color 0.15s;
}
.accent-swatch.active { outline-color: var(--text); transform: scale(1.15); }

/* ── TOAST ── */
.toast {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: var(--surface);
  border: 1px solid var(--border2);
  color: var(--text);
  padding: 10px 20px;
  border-radius: 100px;
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  letter-spacing: 0.5px;
  opacity: 0;
  transition: all 0.25s;
  z-index: 200;
  white-space: nowrap;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.success { border-color: var(--success); color: var(--success); }
.toast.error { border-color: var(--danger); color: var(--danger); }

/* ── LOADING ── */
.loading-spin {
  display: inline-block;
  width: 16px; height: 16px;
  border: 2px solid var(--border2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── EXERCISE FORM INLINE ── */
.exercise-type-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
}

.type-tab {
  flex: 1;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 8px;
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: var(--text-muted);
  cursor: pointer;
  text-align: center;
  transition: all 0.15s;
}
.type-tab.active { background: var(--accent-dim); border-color: var(--accent); color: var(--accent); }

.ex-fields-wrap { display: grid; }
.ex-fields-wrap > * { grid-area: 1 / 1; align-self: start; transition: opacity 0.15s; }
.timed-fields { opacity: 0; visibility: hidden; pointer-events: none; }
.timed-fields.show { opacity: 1; visibility: visible; pointer-events: auto; }
.strength-fields.hidden { opacity: 0; visibility: hidden; pointer-events: none; }

.inline-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* panel-ai needs flex layout only when active */
#panel-ai.active { display: flex; flex-direction: column; }

/* scrollbar */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 2px; }
.autocomplete-list {
  position: fixed;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-top: none;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  max-height: 220px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  z-index: 500;
}
.autocomplete-item {
  padding: 10px 14px;
  font-size: 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}
.autocomplete-item:last-child { border-bottom: none; }
.autocomplete-item:hover, .autocomplete-item.selected {
  background: var(--accent-dim); color: var(--accent);
}
.ac-match { color: var(--accent); font-weight: 600; }
