/* ─── Design Tokens ─────────────────────────────────────────── */
:root {
  --bg-primary:    #0f172a;
  --bg-card:       #1e293b;
  --bg-elevated:   #334155;
  --bg-input:      #1e293b;
  --text-primary:  #f1f5f9;
  --text-secondary:#94a3b8;
  --text-muted:    #64748b;
  --accent:        #6366f1;
  --accent-soft:   rgba(99, 102, 241, 0.15);
  --success:       #22c55e;
  --danger:        #ef4444;
  --danger-soft:   rgba(239, 68, 68, 0.12);
  --border:        rgba(255, 255, 255, 0.07);
  --radius-sm:     8px;
  --radius-md:     12px;
  --radius-lg:     16px;
  --radius-xl:     20px;
  --nav-height:    68px;
  --transition:    0.18s ease;
  --shadow-card:   0 2px 12px rgba(0, 0, 0, 0.35);
  --shadow-modal:  0 -4px 32px rgba(0, 0, 0, 0.5);
}

/* ─── Reset & Base ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  height: 100%;
  -webkit-text-size-adjust: 100%;
}

body {
  height: 100%;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  overflow: hidden;
  position: relative;
  max-width: 480px;
  margin: 0 auto;
}

/* ─── View System ────────────────────────────────────────────── */
.view {
  display: none;
  flex-direction: column;
  position: absolute;
  inset: 0;
  bottom: var(--nav-height);
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 0 24px;
  -webkit-overflow-scrolling: touch;
}

.view--active { display: flex; }

/* ─── View Headers ───────────────────────────────────────────── */
.view-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg-primary);
  padding: 20px 20px 12px;
  border-bottom: 1px solid var(--border);
}

.view-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.view-header p {
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin-top: 2px;
}

/* ─── Bottom Navigation ──────────────────────────────────────── */
#bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  height: var(--nav-height);
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  display: flex;
  z-index: 50;
  transition: transform 0.25s ease, opacity 0.25s ease;
}

#bottom-nav.hidden {
  transform: translateX(-50%) translateY(100%);
  opacity: 0;
  pointer-events: none;
}

#bottom-nav button {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  padding: 8px 0;
  transition: color var(--transition);
  -webkit-tap-highlight-color: transparent;
}

#bottom-nav button .nav-icon { font-size: 1.25rem; line-height: 1; }

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

/* ─── Cards ──────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-card);
}

/* ─── Home View ──────────────────────────────────────────────── */
.home-hero {
  background: linear-gradient(135deg, #1a1f3e 0%, #0f172a 100%);
  padding: 24px 20px 20px;
  border-bottom: 1px solid var(--border);
}

.home-hero-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
}

.home-hero-top h1 {
  font-size: 1.625rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.home-hero-top h1 span { color: var(--accent); }

.date-badge {
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  white-space: nowrap;
}

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

.input-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.input-group label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.input-group input[type="date"],
.input-group input[type="time"] {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  padding: 10px 12px;
  font-size: 0.9375rem;
  font-weight: 500;
  width: 100%;
  outline: none;
  transition: border-color var(--transition);
  -webkit-appearance: none;
  appearance: none;
  color-scheme: dark;
}

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

/* ─── Session Type Grid ──────────────────────────────────────── */
.section-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  padding: 16px 20px 10px;
}

.type-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 10px;
  padding: 0 16px;
}

.type-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 14px 8px;
  text-align: center;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.type-card:active { transform: scale(0.94); }

.type-card.selected {
  border-color: var(--card-color, var(--accent));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--card-color, var(--accent)) 20%, transparent);
}

.type-card-emoji { font-size: 1.75rem; line-height: 1; margin-bottom: 6px; }

.type-card-name {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--text-secondary);
  line-height: 1.3;
}

.type-card.selected .type-card-name { color: var(--text-primary); }

/* ─── Start Button ───────────────────────────────────────────── */
.start-section {
  padding: 16px 16px 0;
}

.btn-primary {
  width: 100%;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  padding: 15px 20px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition), opacity var(--transition);
  -webkit-tap-highlight-color: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 52px;
}

.btn-primary:active { transform: scale(0.98); }

.btn-primary:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  transform: none;
}

.btn-secondary {
  width: 100%;
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 20px;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition);
  -webkit-tap-highlight-color: transparent;
  min-height: 52px;
}

.btn-secondary:active {
  transform: scale(0.98);
  background: var(--bg-card);
}

.btn-danger {
  background: var(--danger-soft);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.25);
}

/* ─── Active Session View ────────────────────────────────────── */
#view-session {
  bottom: 0;
  align-items: stretch;
  padding: 24px 20px;
  gap: 0;
  background: var(--bg-primary);
}

.session-backdrop {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at 50% 30%, rgba(99,102,241,0.12) 0%, transparent 70%);
}

.session-card {
  width: 100%;
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  padding: 28px 24px;
  box-shadow: var(--shadow-card);
  position: relative;
  z-index: 1;
}

.session-type-badge {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.session-type-badge-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.625rem;
}

.session-type-badge-info h2 {
  font-size: 1.25rem;
  font-weight: 700;
}

.session-type-badge-info p {
  color: var(--text-secondary);
  font-size: 0.8125rem;
}

.timer-container {
  text-align: center;
  padding: 16px 0 24px;
}

.timer-label {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.timer-display {
  font-size: clamp(3rem, 16vw, 5rem);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  color: var(--accent);
  line-height: 1;
}

.session-notes {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  padding: 12px 14px;
  font-size: 0.9375rem;
  font-family: inherit;
  resize: none;
  outline: none;
  transition: border-color var(--transition);
  margin-bottom: 16px;
}

.session-notes::placeholder { color: var(--text-muted); }
.session-notes:focus { border-color: var(--accent); }

.session-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ─── Session Types View ─────────────────────────────────────── */
.types-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 16px;
}

.type-list-item {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow-card);
}

.type-color-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.type-list-emoji { font-size: 1.5rem; flex-shrink: 0; }

.type-list-info { flex: 1; min-width: 0; }

.type-list-info h3 {
  font-size: 0.9375rem;
  font-weight: 600;
}

.type-list-info span {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.type-delete-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 1.125rem;
  padding: 6px;
  border-radius: var(--radius-sm);
  transition: color var(--transition), background var(--transition);
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
}

.type-delete-btn:hover { color: var(--danger); background: var(--danger-soft); }

.add-type-btn {
  margin: 8px 16px 0;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px dashed rgba(99, 102, 241, 0.4);
  border-radius: var(--radius-lg);
  padding: 14px 20px;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: background var(--transition), transform var(--transition);
  -webkit-tap-highlight-color: transparent;
  width: calc(100% - 32px);
}

.add-type-btn:active { transform: scale(0.98); }

/* ─── Reports View ───────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 12px 16px 4px;
}

.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 14px 10px;
  text-align: center;
  box-shadow: var(--shadow-card);
}

.stat-value {
  font-size: 1.375rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 0.625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  line-height: 1.3;
}

.btn-clear-history {
  margin-top: 10px;
  background: none;
  border: 1px solid rgba(239, 68, 68, 0.35);
  border-radius: var(--radius-md);
  color: var(--danger);
  font-size: 0.8125rem;
  font-weight: 600;
  padding: 7px 14px;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
  -webkit-tap-highlight-color: transparent;
}

.btn-clear-history:hover { background: var(--danger-soft); border-color: var(--danger); }

.view-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.view-header-actions .btn-clear-history {
  margin-top: 0;
}

.btn-export {
  background: none;
  border: 1px solid rgba(99, 102, 241, 0.4);
  border-radius: var(--radius-md);
  color: var(--accent);
  font-size: 0.8125rem;
  font-weight: 600;
  padding: 7px 14px;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
  -webkit-tap-highlight-color: transparent;
}

.btn-export:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.btn-export:disabled,
.btn-clear-history:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}

/* ─── Export Modal ───────────────────────────────────────────── */
.modal-subtitle {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-top: -4px;
  margin-bottom: 4px;
}

/* ─── Finish Session Confirm Modal ───────────────────────────── */
.finish-confirm-summary {
  background: var(--bg-elevated);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-top: 16px;
}
.finish-confirm-stat {
  font-size: 0.9375rem;
  color: var(--text-primary);
  margin: 0 0 6px;
  line-height: 1.5;
}
.finish-confirm-stat strong { color: var(--accent); }
.finish-confirm-subtext {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin: 0;
}

.export-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
}

.export-option {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  background: var(--bg-elevated);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  text-align: left;
  cursor: pointer;
  width: 100%;
  color: var(--text-primary);
  transition: border-color var(--transition), background var(--transition);
  -webkit-tap-highlight-color: transparent;
}

.export-option:hover {
  border-color: var(--accent);
  background: rgba(99, 102, 241, 0.06);
}

.export-option:active { transform: scale(0.98); }

.export-option-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
  margin-top: 1px;
}

.export-option-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.export-option-info strong {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--text-primary);
}

.export-option-info span {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.filter-row {
  padding: 8px 16px;
}

.filter-select {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  padding: 11px 14px;
  font-size: 0.9375rem;
  font-family: inherit;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  color-scheme: dark;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.sessions-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 4px 16px;
}

.session-history-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  box-shadow: var(--shadow-card);
}

.session-history-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.375rem;
  flex-shrink: 0;
}

.session-history-info { flex: 1; min-width: 0; }

.session-history-info h3 {
  font-size: 0.9375rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.session-history-info p {
  color: var(--text-secondary);
  font-size: 0.8125rem;
  margin-top: 1px;
}

.session-card-right {
  display: flex;
  align-items: flex-start;
  gap: 4px;
  flex-shrink: 0;
}

.session-duration {
  text-align: right;
  flex-shrink: 0;
}

.session-duration-value {
  font-size: 1rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
}

.session-duration-label {
  font-size: 0.6875rem;
  color: var(--text-muted);
}

.session-delete-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.875rem;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background var(--transition), color var(--transition);
  -webkit-tap-highlight-color: transparent;
  align-self: flex-start;
  margin-top: 2px;
}

.session-delete-btn:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

.btn-view-notes {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 5px;
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.25);
  border-radius: 6px;
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 9px;
  cursor: pointer;
  transition: background var(--transition);
  -webkit-tap-highlight-color: transparent;
}

.btn-view-notes:hover { background: rgba(99, 102, 241, 0.22); }

.btn-add-note {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 5px;
  background: transparent;
  border: 1px dashed var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 500;
  padding: 3px 9px;
  cursor: pointer;
  transition: border-color var(--transition), color var(--transition), background var(--transition);
  -webkit-tap-highlight-color: transparent;
}
.btn-add-note:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(99, 102, 241, 0.08);
}

.notes-session-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

.notes-session-emoji { font-size: 2rem; }

.notes-session-name {
  font-size: 1rem;
  font-weight: 700;
}

.notes-session-date {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.notes-body {
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--text-primary);
  white-space: pre-wrap;
  word-break: break-word;
}

.notes-edit-textarea {
  width: 100%;
  min-height: 120px;
  background: var(--bg-input);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.9375rem;
  font-family: inherit;
  line-height: 1.6;
  padding: 12px 14px;
  resize: vertical;
  outline: none;
  transition: border-color var(--transition);
}

.notes-edit-textarea:focus {
  border-color: var(--accent);
}

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}

.empty-state-icon { font-size: 3rem; margin-bottom: 12px; }

.empty-state h3 {
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.empty-state p { font-size: 0.875rem; line-height: 1.5; }

/* ─── Modal (bottom sheet) ───────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0);
  z-index: 98;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.modal-backdrop.open {
  opacity: 1;
  pointer-events: auto;
  background: rgba(0, 0, 0, 0.6);
}

.modal {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%) translateY(100%);
  width: 100%;
  max-width: 480px;
  background: var(--bg-card);
  border-radius: 24px 24px 0 0;
  padding: 0 20px 32px;
  z-index: 99;
  box-shadow: var(--shadow-modal);
  transition: transform 0.28s cubic-bezier(0.32, 0.72, 0, 1);
}

.modal.open {
  transform: translateX(-50%) translateY(0);
}

.modal-handle {
  width: 40px;
  height: 4px;
  background: var(--bg-elevated);
  border-radius: 2px;
  margin: 12px auto 20px;
}

.modal h2 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 20px;
}

.modal-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.form-group input[type="text"],
.form-group input[type="number"] {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  padding: 12px 14px;
  font-size: 1rem;
  font-family: inherit;
  outline: none;
  width: 100%;
  transition: border-color var(--transition);
}

.form-group input[type="text"]:focus,
.form-group input[type="number"]:focus { border-color: var(--accent); }

.form-group input[type="text"]::placeholder,
.form-group input[type="number"]::placeholder { color: var(--text-muted); }

.color-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.color-row input[type="color"] {
  width: 52px;
  height: 52px;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  padding: 4px;
  background: var(--bg-elevated);
  flex-shrink: 0;
  outline: none;
}

.color-presets {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.color-preset {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color var(--transition), transform var(--transition);
  -webkit-tap-highlight-color: transparent;
}

.color-preset.selected,
.color-preset:hover { border-color: #fff; transform: scale(1.1); }

.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 6px;
}

/* ─── Scrollbar ──────────────────────────────────────────────── */
.view::-webkit-scrollbar { width: 3px; }
.view::-webkit-scrollbar-track { background: transparent; }
.view::-webkit-scrollbar-thumb { background: var(--bg-elevated); border-radius: 2px; }

/* ─── Animations ─────────────────────────────────────────────── */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.view--active > * { animation: fadeIn 0.2s ease forwards; }
.view--active > *:nth-child(2) { animation-delay: 0.04s; }
.view--active > *:nth-child(3) { animation-delay: 0.08s; }

/* ─── Subtype Picker (Home) ──────────────────────────────────── */
.subtype-section {
  display: none;
  flex-direction: column;
  padding: 0 16px 4px;
}

.subtype-section.visible { display: flex; }

.subtype-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  padding: 12px 0 8px;
}

.optional-tag {
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
}

.subtype-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-bottom: 4px;
}

.subtype-pill {
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: 20px;
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  padding: 7px 16px;
  cursor: pointer;
  transition: border-color var(--transition), color var(--transition), transform var(--transition);
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
}

.subtype-pill.selected {
  border-color: var(--pill-color, var(--accent));
  color: var(--pill-color, var(--accent));
}

.subtype-pill:active { transform: scale(0.95); }

/* ─── Session Badge Subtype ──────────────────────────────────── */
#session-badge-subtype {
  font-size: 0.8125rem !important;
  color: var(--text-muted) !important;
  font-weight: 500;
  margin-top: 0;
  margin-bottom: 2px;
}

/* ─── Types View Accordion ───────────────────────────────────── */
.type-entry {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

.type-entry .type-list-item {
  background: transparent;
  border-radius: 0;
  box-shadow: none;
  cursor: pointer;
}

.type-list-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.type-expand-chevron {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  color: var(--text-muted);
  transition: transform var(--transition), color var(--transition);
  flex-shrink: 0;
  pointer-events: none;
}

.type-expand-chevron.expanded {
  transform: rotate(180deg);
  color: var(--accent);
}

.subtypes-container {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.28s ease;
}

.subtypes-container.open { max-height: 600px; }

.subtype-items {
  border-top: 1px solid var(--border);
  padding: 8px 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.subtype-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
}

.subtype-row-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.subtype-row-name {
  flex: 1;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.subtype-delete-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 0.8125rem;
  padding: 4px 6px;
  border-radius: var(--radius-sm);
  transition: color var(--transition);
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
}

.subtype-delete-btn:hover { color: var(--danger); }

.add-subtype-btn-inline {
  display: flex;
  align-items: center;
  width: 100%;
  background: none;
  border: 1px dashed rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.8125rem;
  font-weight: 500;
  padding: 7px 10px;
  cursor: pointer;
  margin-top: 6px;
  transition: color var(--transition), border-color var(--transition);
  -webkit-tap-highlight-color: transparent;
}

.add-subtype-btn-inline:hover {
  color: var(--accent);
  border-color: rgba(99, 102, 241, 0.4);
}

/* ─── Onboarding View ────────────────────────────────────────── */
.onboarding-view {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: var(--bg-primary);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 24px 32px;
  overflow-y: auto;
}

.onboarding-view.active {
  display: flex;
}

.onboarding-inner {
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.onboarding-brand {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.onboarding-brand-icon {
  font-size: 3.5rem;
  line-height: 1;
  filter: drop-shadow(0 4px 12px rgba(99, 102, 241, 0.4));
}

.onboarding-brand-name {
  font-size: 2.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.onboarding-brand-name span {
  color: var(--accent);
}

.onboarding-brand-tagline {
  color: var(--text-secondary);
  font-size: 0.9375rem;
}

.onboarding-form-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: var(--shadow-card);
}

.onboarding-form-card h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
}

.onboarding-form-sub {
  color: var(--text-secondary);
  font-size: 0.9375rem;
  margin-top: -8px;
}

.onboarding-privacy {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: var(--radius-md);
  padding: 14px 16px;
}

.onboarding-privacy-icon {
  font-size: 1.125rem;
  flex-shrink: 0;
  margin-top: 1px;
}

.onboarding-privacy p {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.55;
}

.onboarding-privacy strong {
  color: var(--text-primary);
}

/* ─── Settings Views ────────────────────────────────────────── */
.settings-list {
  padding: 16px 16px 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.settings-row {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  width: 100%;
  text-align: left;
  border: none;
  color: var(--text-primary);
  transition: background var(--transition);
  box-shadow: var(--shadow-card);
  -webkit-tap-highlight-color: transparent;
}

.settings-row:hover { background: var(--bg-elevated); }

.settings-row-icon { font-size: 1.375rem; flex-shrink: 0; }

.settings-row-info { flex: 1; }

.settings-row-info h3 {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-primary);
}

.settings-row-info p {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin-top: 1px;
}

.settings-row-chevron {
  font-size: 1.375rem;
  color: var(--text-muted);
  line-height: 1;
}

/* ─── Settings Sub-page Common ───────────────────────────────── */
.btn-back {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0;
  cursor: pointer;
  margin-bottom: 6px;
  display: inline-block;
  -webkit-tap-highlight-color: transparent;
}

.settings-section {
  padding: 16px 16px 0;
}

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

.settings-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

/* ─── Units — Radio Rows ─────────────────────────────────────── */
.radio-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  -webkit-tap-highlight-color: transparent;
}

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

.radio-row input[type="radio"],
.radio-row input[type="checkbox"] { display: none; }

.radio-row-label {
  font-size: 0.9375rem;
  color: var(--text-primary);
  font-weight: 500;
}

.radio-custom {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: border-color var(--transition);
}

.radio-custom::after {
  content: '';
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0;
  transition: opacity var(--transition);
}

.radio-row:has(input:checked) .radio-custom {
  border-color: var(--accent);
}

.radio-row:has(input:checked) .radio-custom::after {
  opacity: 1;
}

/* Checkbox variant — square with tick, used where multi-select is allowed */
.check-custom {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 2px solid var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: border-color var(--transition), background var(--transition);
}

.check-custom::after {
  content: '';
  width: 5px;
  height: 9px;
  border-right: 2.5px solid #fff;
  border-bottom: 2.5px solid #fff;
  transform: rotate(45deg) translate(-1px, -1px);
  opacity: 0;
  transition: opacity var(--transition);
}

.radio-row:has(input[type="checkbox"]:checked) .check-custom {
  border-color: var(--accent);
  background: var(--accent);
}

.radio-row:has(input[type="checkbox"]:checked) .check-custom::after {
  opacity: 1;
}

/* ─── Data Page — Action Rows ────────────────────────────────── */
.settings-card--actions { }

.data-action-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  width: 100%;
  background: none;
  border: none;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  text-align: left;
  cursor: pointer;
  transition: background var(--transition);
  -webkit-tap-highlight-color: transparent;
}

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

.data-action-row:hover:not(:disabled) { background: rgba(255,255,255,0.04); }

.data-action-row--disabled {
  opacity: 0.38;
  cursor: not-allowed;
}

.data-action-row--danger strong { color: var(--danger); }

.data-action-icon { font-size: 1.25rem; flex-shrink: 0; }

.data-action-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.data-action-info strong {
  font-size: 0.9375rem;
  font-weight: 600;
  display: block;
}

.data-action-info span {
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

/* ─── About Page ─────────────────────────────────────────────── */
.about-hero {
  text-align: center;
  padding: 28px 20px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.about-hero-icon {
  font-size: 3rem;
  filter: drop-shadow(0 4px 10px rgba(99, 102, 241, 0.35));
}

.about-app-name {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.about-app-name span { color: var(--accent); }

.about-version {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.about-creator-card {
  padding: 18px 18px 4px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.about-creator-name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.about-links {
  display: flex;
  flex-direction: column;
  gap: 0;
  border-top: 1px solid var(--border);
  margin: 0 -18px;
}

.about-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  color: var(--accent);
  text-decoration: none;
  font-size: 0.9375rem;
  font-weight: 500;
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
  -webkit-tap-highlight-color: transparent;
}

.about-link:last-child { border-bottom: none; }

.about-link:hover { background: var(--accent-soft); }

.about-link-icon { font-size: 1.125rem; }

/* ── Release Notes ───────────────────────────── */
.release-notes {
  max-height: 220px;
  overflow-y: auto;
  padding: 4px 0;
  scrollbar-width: thin;
  scrollbar-color: var(--bg-elevated) transparent;
}

.release-notes::-webkit-scrollbar { width: 4px; }
.release-notes::-webkit-scrollbar-track { background: transparent; }
.release-notes::-webkit-scrollbar-thumb { background: var(--bg-elevated); border-radius: 2px; }

.release-version {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}

.release-version--last { border-bottom: none; }

.release-version-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.release-badge {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  background: var(--accent);
  color: #fff;
  padding: 2px 7px;
  border-radius: 20px;
  flex-shrink: 0;
}

.release-badge--muted {
  background: var(--bg-elevated);
  color: var(--text-secondary);
}

.release-version-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
}

.release-list {
  margin: 0;
  padding-left: 18px;
  list-style: disc;
}

.release-list li {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ── Storage note ────────────────────────────── */
.about-storage-note {
  padding: 16px 18px;
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.55;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.about-storage-icon {
  font-size: 1rem;
  flex-shrink: 0;
  line-height: 1.55;
}

.about-storage-note strong { color: var(--text-primary); }

/* ─── Thank Yous ─────────────────────────────────────────────── */
.thankyou-card { padding: 0; overflow: hidden; }
.thankyou-row {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px;
}
.thankyou-avatar {
  font-size: 1.5rem;
  flex-shrink: 0;
  line-height: 1;
  margin-top: 2px;
}
.thankyou-info { flex: 1; min-width: 0; }
.thankyou-name {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 4px;
}
.thankyou-note {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0;
}

/* ─── Home Greeting ──────────────────────────────────────────── */
.home-greeting {
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-weight: 500;
  margin-bottom: 2px;
  min-height: 1.2em;
}

/* ─── Tablet centering ───────────────────────────────────────── */
@media (min-width: 480px) {
  body {
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
  }

  .type-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }
}

/* ═══════════════════════════════════════════════════════════════
   EXERCISE LIBRARY v1.3
   ═══════════════════════════════════════════════════════════════ */

/* ─── Segment Control ─────────────────────────────────────────── */
.segment-control {
  display: flex;
  margin: 12px 20px 16px;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 4px;
  gap: 4px;
}
.segment-btn {
  flex: 1;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 600;
  padding: 8px 12px;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  -webkit-tap-highlight-color: transparent;
}
.segment-btn--active {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

/* ─── Segment Panels ─────────────────────────────────────────── */
.segment-panel { }
.segment-panel--hidden { display: none; }

/* ─── Filter Pills ───────────────────────────────────────────── */
.filter-pills {
  display: flex;
  gap: 8px;
  padding: 4px 20px 12px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.filter-pills--modal {
  padding: 8px 0 12px;
  overflow: visible;
  flex-wrap: wrap;
}
.filter-pill {
  -webkit-appearance: none;
  appearance: none;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: 20px;
  color: var(--text-secondary);
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1;
  padding: 6px 16px;
  min-height: 32px;
  cursor: pointer;
  transition: border-color var(--transition), color var(--transition), background var(--transition);
  -webkit-tap-highlight-color: transparent;
}
.filter-pill--active {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

/* ─── Exercise Library Cards ─────────────────────────────────── */
.exercises-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0 20px 24px;
}
.exercise-entry {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  box-shadow: var(--shadow-card);
}
.exercise-entry-name {
  flex: 1;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-primary);
}
.exercise-type-badge {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 3px 8px;
  border-radius: 20px;
  flex-shrink: 0;
}
.exercise-type-badge--strength {
  background: rgba(99, 102, 241, 0.15);
  color: #818cf8;
}
.exercise-type-badge--cardio {
  background: rgba(239, 68, 68, 0.12);
  color: #f87171;
}
.exercise-entry-indicators {
  display: flex;
  gap: 4px;
  font-size: 0.875rem;
}
.exercise-delete-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.875rem;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background var(--transition), color var(--transition);
  -webkit-tap-highlight-color: transparent;
}
.exercise-delete-btn:hover,
.exercise-delete-btn:active {
  background: var(--danger-soft);
  color: var(--danger);
}

/* ─── Active Session Exercises ───────────────────────────────── */
.session-exercises-section {
  margin-top: 12px;
  margin-bottom: 4px;
}
.session-exercises-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.btn-add-exercise {
  background: var(--accent-soft);
  border: 1.5px solid var(--accent);
  border-radius: var(--radius-md);
  color: var(--accent);
  font-size: 0.8125rem;
  font-weight: 600;
  padding: 6px 14px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background var(--transition);
}
.btn-add-exercise:active {
  background: rgba(99, 102, 241, 0.25);
}
.exercise-empty-hint {
  font-size: 0.8125rem;
  color: var(--text-muted);
  text-align: center;
  padding: 12px 0;
  margin: 0;
}
.active-exercise-card {
  background: var(--bg-elevated);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 8px;
}
.active-exercise-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.active-exercise-card-name {
  flex: 1;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-primary);
}
.active-exercise-sets {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 8px;
}
.active-set-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8125rem;
  color: var(--text-secondary);
}
.active-set-label {
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.75rem;
  min-width: 38px;
}
.active-set-values { flex: 1; }
.set-delete-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.75rem;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
  transition: color var(--transition);
}
.set-delete-btn:hover,
.set-delete-btn:active { color: var(--danger); }
.btn-add-set {
  background: none;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.8125rem;
  font-weight: 600;
  padding: 6px 12px;
  width: 100%;
  cursor: pointer;
  transition: border-color var(--transition), color var(--transition);
  -webkit-tap-highlight-color: transparent;
}
.btn-add-set:hover,
.btn-add-set:active {
  border-color: var(--accent);
  color: var(--accent);
}

/* ─── Exercise Picker Modal ──────────────────────────────────── */
.modal--tall {
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.modal--tall.open {
  transform: translateX(-50%) translateY(0);
}
.modal-exercise-scroll {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  margin-top: 4px;
}
.pick-exercise-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background var(--transition);
}
.pick-exercise-row:last-child { border-bottom: none; }
.pick-exercise-row:active { opacity: 0.7; }
.pick-exercise-row-name {
  flex: 1;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-primary);
}

/* ─── Toggle Switch ──────────────────────────────────────────── */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  padding: 4px 0;
}
.toggle-label {
  font-size: 0.9375rem;
  color: var(--text-primary);
}
.toggle-switch {
  position: relative;
  width: 44px;
  height: 26px;
  flex-shrink: 0;
}
.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}
.toggle-thumb {
  position: absolute;
  inset: 0;
  background: var(--bg-elevated);
  border-radius: 13px;
  border: 1.5px solid var(--border);
  transition: background var(--transition), border-color var(--transition);
}
.toggle-thumb::after {
  content: '';
  position: absolute;
  left: 3px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: transform var(--transition), background var(--transition);
}
.toggle-switch input:checked + .toggle-thumb {
  background: var(--accent-soft);
  border-color: var(--accent);
}
.toggle-switch input:checked + .toggle-thumb::after {
  transform: translateX(18px) translateY(-50%);
  background: var(--accent);
}

/* ─── Radio Row Group ────────────────────────────────────────── */
.radio-row-group {
  background: var(--bg-elevated);
  border-radius: var(--radius-md);
  overflow: hidden;
}

/* ─── Remove Exercise Button ─────────────────────────────────── */
.btn-remove-exercise {
  -webkit-appearance: none;
  appearance: none;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.75rem;
  line-height: 1;
  padding: 4px;
  margin-left: auto;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: color var(--transition), background var(--transition);
  -webkit-tap-highlight-color: transparent;
}
.btn-remove-exercise:hover {
  color: var(--danger);
  background: var(--danger-soft);
}

/* ─── Set Logger Modal ───────────────────────────────────────── */
.modal-set-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.modal-set-exercise-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}

/* ─── Reports Exercise Summary ───────────────────────────────── */
.session-exercise-summary {
  flex: 0 0 100%;
  margin-top: 0;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}
.session-exercise-toggle {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 0;
  width: 100%;
  text-align: left;
  -webkit-tap-highlight-color: transparent;
}
.session-exercise-detail {
  margin-top: 8px;
  padding-bottom: 2px;
}
.report-exercise-block {
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.report-exercise-block:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}
.report-exercise-name {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
}
.report-set-row {
  display: flex;
  gap: 10px;
  font-size: 0.75rem;
  color: var(--text-secondary);
  padding: 2px 0;
}
.report-set-number {
  min-width: 40px;
  color: var(--text-muted);
  font-weight: 600;
}
.report-set-row--pr {
  color: var(--text-primary);
}
.report-pr-badge {
  margin-left: auto;
  font-size: 0.6875rem;
  font-weight: 700;
  color: #f59e0b;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: 4px;
  padding: 1px 6px;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── Toast notification ───────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: calc(var(--nav-height) + 16px);
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #ef4444;
  color: #fff;
  font-size: 0.875rem;
  font-weight: 600;
  padding: 10px 20px;
  border-radius: 100px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.18s ease, transform 0.18s ease;
  z-index: 9999;
}
.toast--visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ─── Weight / Plates Toggle in Log Set Modal ────────────────── */
.set-weight-mode-row {
  margin-bottom: 10px;
  padding: 4px 0;
}

/* ─── Exercise History Hint (Last Session / PR) ─────────────── */
.exercise-history-hint {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 6px 0 8px;
  padding: 8px 12px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
}
.exercise-history-hint-label {
  color: var(--text-muted);
  flex-shrink: 0;
}
.exercise-history-hint-value {
  color: var(--accent);
  font-weight: 600;
  margin-left: auto;
  text-align: right;
}

/* ─── Log Set Modal — Progression Recommendation Banner ──────── */
.set-progression-hint {
  margin: 0 0 14px;
  padding: 12px 14px;
  background: color-mix(in srgb, var(--success) 12%, transparent);
  border: 1.5px solid color-mix(in srgb, var(--success) 45%, transparent);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  gap: 10px;
}
.set-progression-hint-body {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}
.set-progression-hint-icon {
  font-size: 1.25rem;
  flex-shrink: 0;
  line-height: 1;
}
.set-progression-hint-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.set-progression-hint-label {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: color-mix(in srgb, var(--success) 70%, var(--text-secondary));
  line-height: 1;
}
.set-progression-hint-value {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--success);
  line-height: 1.2;
}
.set-progression-info-btn {
  -webkit-appearance: none;
  appearance: none;
  background: none;
  border: none;
  font-size: 1.125rem;
  padding: 4px;
  cursor: pointer;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  opacity: 0.75;
  transition: opacity var(--transition);
  -webkit-tap-highlight-color: transparent;
  line-height: 1;
}
.set-progression-info-btn:hover { opacity: 1; }

/* Sub-description text inside Settings radio rows */
.radio-row-sub {
  display: block;
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ─── Machine / Base Weight field ────────────────────────────── */
.base-weight-row {
  margin-top: 2px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

/* ─── Edit Session Modal ─────────────────────────────────────── */
.modal-edit-scroll {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.edit-section { margin-bottom: 20px; }
.edit-section-label {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.edit-exercise-block {
  background: var(--bg-elevated);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 10px;
}
.edit-exercise-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.edit-set-list { margin-bottom: 6px; }
.edit-set-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-top: 1px solid var(--border);
  font-size: 0.875rem;
}
.edit-set-values { flex: 1; color: var(--text-secondary); }
.btn-edit-set, .btn-delete-set {
  -webkit-appearance: none; appearance: none;
  background: none; border: none;
  color: var(--text-muted); cursor: pointer;
  font-size: 0.75rem; padding: 4px;
  border-radius: var(--radius-sm);
  transition: color var(--transition);
  -webkit-tap-highlight-color: transparent;
}
.btn-edit-set:hover   { color: var(--accent); }
.btn-delete-set:hover { color: var(--danger); }
.btn-edit-swap-exercise {
  -webkit-appearance: none; appearance: none;
  margin-left: auto;
  font-size: 0.75rem;
  color: var(--accent);
  background: none; border: none; cursor: pointer;
  padding: 2px 6px;
  -webkit-tap-highlight-color: transparent;
}
.btn-edit-remove-exercise {
  -webkit-appearance: none; appearance: none;
  background: none; border: none;
  color: var(--text-muted); cursor: pointer;
  font-size: 0.75rem; padding: 4px;
  border-radius: var(--radius-sm);
  transition: color var(--transition);
  -webkit-tap-highlight-color: transparent;
}
.btn-edit-remove-exercise:hover { color: var(--danger); }
.edit-add-exercise-btn { width: 100%; margin-top: 4px; }
.datetime-row {
  display: flex;
  gap: 12px;
}
.duration-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.duration-sep {
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* Edit button on session history cards */
.session-edit-btn {
  -webkit-appearance: none; appearance: none;
  background: none; border: none;
  color: var(--text-muted);
  font-size: 0.875rem;
  padding: 6px; cursor: pointer;
  border-radius: var(--radius-sm);
  transition: color var(--transition);
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
}
.session-edit-btn:hover { color: var(--accent); }

/* Edited badge on session card */
.session-edited-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 0.6875rem;
  color: var(--text-muted);
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  padding: 2px 6px;
  margin-bottom: 2px;
}

/* Styled <select> to match inputs */
.form-select {
  -webkit-appearance: none; appearance: none;
  background: var(--bg-elevated) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24'%3E%3Cpath fill='%236b7280' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E") no-repeat right 14px center;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  padding: 12px 36px 12px 14px;
  font-size: 1rem; font-family: inherit;
  outline: none; width: 100%;
  transition: border-color var(--transition);
}
.form-select:focus { border-color: var(--accent); }

/* ─── Workout Plans ───────────────────────────────────────────── */

/* Plan card in the Plans list */
.workout-plan-card {
  background: var(--bg-elevated);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.workout-plan-card-emoji { font-size: 1.375rem; flex-shrink: 0; }
.workout-plan-card-info  { flex: 1; min-width: 0; }
.workout-plan-card-name  { font-size: 0.9375rem; font-weight: 600; }
.workout-plan-card-meta  { font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; }

/* Assign-plan icon button on type / subtype rows */
.btn-assign-plan {
  -webkit-appearance: none; appearance: none;
  background: none; border: none;
  font-size: 0.875rem; padding: 4px 6px;
  color: var(--text-muted); cursor: pointer;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  transition: color var(--transition);
  -webkit-tap-highlight-color: transparent;
}
.btn-assign-plan:hover { color: var(--accent); }

/* Plan assigned badge on type/subtype rows */
.plan-assigned-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 0.6875rem; color: var(--accent);
  background: var(--accent-soft);
  border-radius: var(--radius-sm);
  padding: 2px 6px; margin-top: 3px;
}

/* Subtype row body (stacks name + plan badge) */
.subtype-row-body {
  display: flex; flex-direction: column; flex: 1; min-width: 0;
}

/* Home plan selector row */
.plan-selector-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 20px;
}
.plan-selector-label {
  font-size: 0.875rem; color: var(--text-secondary); flex-shrink: 0;
}
.form-select--compact {
  padding: 8px 32px 8px 12px;
  font-size: 0.875rem;
  flex: 1;
}

/* Session header exercise buttons row */
.session-exercises-btns {
  display: flex; gap: 6px; align-items: center;
}

/* Load plan rows in the modal */
.load-plan-row {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 0; border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: opacity var(--transition);
}
.load-plan-row:last-child  { border-bottom: none; }
.load-plan-row:active      { opacity: 0.7; }
.load-plan-row:hover .workout-plan-card-name { color: var(--accent); }

/* ─── Progression Settings — disabled Min Reps state ────────── */
.pt-rep-range-disabled label,
.pt-rep-range-disabled {
  opacity: 0.4;
  pointer-events: none;
}
input:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ─── Exercise Search Input ──────────────────────────────────── */
.exercise-search-wrap {
  padding: 0 20px 12px;
  position: relative;
}
.exercise-search-wrap--modal {
  padding: 0 0 12px;
}
.exercise-search-input {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  box-sizing: border-box;
  background: var(--bg-elevated);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.9375rem;
  font-family: inherit;
  padding: 10px 14px 10px 38px;
  outline: none;
  transition: border-color var(--transition);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 12px center;
}
.exercise-search-input:focus {
  border-color: var(--accent);
}
.exercise-search-input::placeholder {
  color: var(--text-muted);
}
/* hide browser's default clear (×) button on search inputs */
.exercise-search-input::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
  display: none;
}

/* ─── New Exercise button inside pick-exercise modal ─────────── */
.btn-picker-add-exercise {
  width: 100%;
  margin-bottom: 12px;
  font-size: 0.875rem;
}

/* ─── Edit buttons on type / subtype / exercise rows ─────────── */
.type-edit-btn,
.subtype-edit-btn,
.exercise-edit-btn {
  -webkit-appearance: none;
  appearance: none;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.8125rem;
  padding: 4px 6px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: color var(--transition);
  -webkit-tap-highlight-color: transparent;
  line-height: 1;
}
.type-edit-btn:hover,
.subtype-edit-btn:hover,
.exercise-edit-btn:hover {
  color: var(--accent);
}

/* ─── Log Set — Unit Converter Row ──────────────────────────── */
.unit-converter-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  padding: 8px 12px;
  background: color-mix(in srgb, var(--accent) 6%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 20%, transparent);
  border-radius: var(--radius-sm);
}
.unit-converter-input {
  -webkit-appearance: none;
  appearance: none;
  width: 80px;
  background: var(--bg-elevated);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.875rem;
  font-family: inherit;
  padding: 6px 10px;
  outline: none;
  transition: border-color var(--transition);
}
.unit-converter-input:focus { border-color: var(--accent); }
.unit-converter-from-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  flex-shrink: 0;
}
.unit-converter-btn {
  -webkit-appearance: none;
  appearance: none;
  margin-left: auto;
  background: var(--accent-soft);
  border: 1.5px solid var(--accent);
  border-radius: var(--radius-sm);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 600;
  font-family: inherit;
  padding: 6px 10px;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--transition), color var(--transition);
  -webkit-tap-highlight-color: transparent;
}
.unit-converter-btn:hover {
  background: var(--accent);
  color: #fff;
}

/* ─── Notes Modal — scrollable body ─────────────────────────── */
.modal--notes .modal-notes-body {
  max-height: 45vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 4px 0 8px;
}

/* ─── Help Carousel ──────────────────────────────────────────── */
.help-carousel-wrapper {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 0 16px 24px;
  min-height: 0;
}

.help-carousel {
  display: flex;
  overflow-x: scroll;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  flex: 1;
  min-height: 0;
}

.help-carousel::-webkit-scrollbar { display: none; }

.help-slide {
  flex: 0 0 100%;
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 4px;
}

.help-slide-title {
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 12px;
  text-align: center;
}

.help-gif-container {
  width: 100%;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg-card);
  box-shadow: var(--shadow-card);
  max-height: 52vh;
}

.help-gif {
  width: 100%;
  max-height: 52vh;
  object-fit: contain;
  display: block;
}

.help-slide-description {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.65;
  text-align: center;
  padding: 14px 4px 0;
}

.help-dots {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  padding: 16px 0 4px;
  flex-shrink: 0;
}

.help-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: background var(--transition), transform var(--transition);
}

.help-dot--active {
  background: var(--accent);
  transform: scale(1.3);
}

/* ─── Home — Help Button ─────────────────────────────────────── */
.home-hero-top-right {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.btn-home-help {
  -webkit-appearance: none;
  appearance: none;
  background: none;
  border: none;
  font-size: 1.125rem;
  line-height: 1;
  padding: 4px 2px;
  cursor: pointer;
  color: var(--text-muted);
  opacity: 0.75;
  transition: opacity var(--transition);
  -webkit-tap-highlight-color: transparent;
}

.btn-home-help:hover { opacity: 1; }

/* ─── Hamburger Button ───────────────────────────────────────── */
#btn-hamburger {
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 150;
  -webkit-appearance: none;
  appearance: none;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 1.125rem;
  line-height: 1;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--transition), opacity var(--transition);
  -webkit-tap-highlight-color: transparent;
  box-shadow: var(--shadow-card);
}
#btn-hamburger:hover { background: var(--accent-soft); color: var(--accent); }
#btn-hamburger.hamburger-hidden { display: none !important; }

/* ─── Fixed Page Logo (beside hamburger) ─────────────────────── */
#page-logo {
  position: fixed;
  top: 14px;
  left: 58px;          /* 14px left + 36px button + 8px gap */
  height: 36px;
  z-index: 150;
  display: flex;
  align-items: center;
  font-size: 0.875rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  pointer-events: none;
  user-select: none;
}
#page-logo span { color: var(--accent); }
#page-logo.page-logo--hidden { display: none !important; }

/* ─── Sidebar Scrim ──────────────────────────────────────────── */
#sidebar-scrim {
  position: fixed;
  inset: 0;
  z-index: 198;
  background: rgba(0, 0, 0, 0.6);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
#sidebar-scrim.open { opacity: 1; pointer-events: auto; }

/* ─── Sidebar Drawer ─────────────────────────────────────────── */
#sidebar-drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 280px;
  z-index: 199;
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  transform: translateX(-100%);
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
  display: flex;
  flex-direction: column;
  box-shadow: 4px 0 32px rgba(0, 0, 0, 0.5);
}
#sidebar-drawer.open { transform: translateX(0); }

#sidebar-header {
  padding: 48px 20px 20px;
  border-bottom: 1px solid var(--border);
}

/* Tappable row: avatar + text side-by-side */
#sidebar-header-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  text-align: left;
  -webkit-tap-highlight-color: transparent;
  border-radius: var(--radius-md);
  transition: opacity var(--transition);
}
#sidebar-header-btn:hover { opacity: 0.8; }

#sidebar-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  flex-shrink: 0;
  overflow: hidden;
}
#sidebar-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}

/* Text column: name on top, "View profile" below */
#sidebar-header-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

#sidebar-name {
  font-weight: 700;
  font-size: 1.125rem;
  color: var(--text-primary);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#sidebar-view-profile {
  font-size: 0.8125rem;
  color: var(--text-muted);
  line-height: 1.3;
}

#sidebar-nav {
  flex: 1;
  padding: 8px 0;
  overflow-y: auto;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px 20px;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 0.9375rem;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  transition: background var(--transition), color var(--transition);
  -webkit-tap-highlight-color: transparent;
  -webkit-appearance: none;
  appearance: none;
}
.sidebar-item:hover { background: var(--bg-elevated); }
.sidebar-item--active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.sidebar-item--disabled { opacity: 0.45; cursor: default; }
.sidebar-item--disabled:hover { background: none; }

.sidebar-item-icon { font-size: 1.125rem; flex-shrink: 0; width: 24px; text-align: center; }
.sidebar-item-label { flex: 1; }

.coming-soon-badge {
  margin-left: auto;
  font-size: 0.625rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: var(--bg-elevated);
  color: var(--text-muted);
  padding: 2px 7px;
  border-radius: 9999px;
  flex-shrink: 0;
}

#sidebar-footer {
  padding: 14px 20px;
  font-size: 0.75rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
}

/* ─── Full-height views (no bottom nav) ──────────────────────── */
.view--full { bottom: 0 !important; }

/* Push the header title below the fixed hamburger + logo on full-screen views.
   Hamburger: top 14px + height 36px = 50px bottom edge; add 14px breathing room. */
.view--full .view-header { padding-top: 64px; }

/* ─── Training Page ──────────────────────────────────────────── */
.training-section {
  padding: 0 16px;
  margin-bottom: 20px;
}
.training-section-label {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

/* Active phase card */
.active-phase-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  position: relative;
}
.active-phase-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.active-phase-type {
  display: flex;
  align-items: center;
  gap: 8px;
}
.phase-type-badge {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 3px 10px;
  border-radius: 9999px;
}
.phase-type-badge--bulk {
  background: rgba(34, 197, 94, 0.15);
  color: #22c55e;
}
.phase-type-badge--cut {
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
}
.phase-type-badge--neither {
  background: var(--accent-soft);
  color: var(--accent);
}
.phase-days-text {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-top: 4px;
}
.phase-progress-bar {
  height: 4px;
  background: var(--bg-elevated);
  border-radius: 9999px;
  overflow: hidden;
  margin-top: 12px;
}
.phase-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 9999px;
  transition: width 0.4s ease;
}
.btn-end-phase {
  -webkit-appearance: none;
  appearance: none;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.75rem;
  padding: 5px 10px;
  cursor: pointer;
  font-family: inherit;
  transition: border-color var(--transition), color var(--transition);
  white-space: nowrap;
  flex-shrink: 0;
}
.btn-end-phase:hover { border-color: var(--danger); color: var(--danger); }

/* Weight card */
.weight-display-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.weight-display-main {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.weight-display-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}
.weight-display-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
}
.weight-display-unit {
  font-size: 1rem;
  color: var(--text-secondary);
  font-weight: 400;
}
.weight-display-date {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}
.btn-log-weight {
  -webkit-appearance: none;
  appearance: none;
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  border-radius: var(--radius-md);
  color: var(--accent);
  font-size: 0.875rem;
  font-weight: 600;
  padding: 10px 14px;
  cursor: pointer;
  font-family: inherit;
  transition: background var(--transition);
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}
.btn-log-weight:hover { background: rgba(99, 102, 241, 0.25); }

/* Weight history */
.weight-history-list { }
.weight-log-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 0;
  border-top: 1px solid var(--border);
  font-size: 0.875rem;
}
.weight-log-row:last-child { border-bottom: 1px solid var(--border); }
.weight-log-date { color: var(--text-secondary); }
.weight-log-value { font-weight: 600; color: var(--text-primary); }
.weight-log-delta {
  font-size: 0.75rem;
  padding: 2px 7px;
  border-radius: 9999px;
}
.weight-log-delta--up   { background: rgba(34,197,94,0.12);  color: #22c55e; }
.weight-log-delta--down { background: rgba(239,68,68,0.10);  color: #ef4444; }
.weight-log-delta--same { background: var(--bg-elevated); color: var(--text-muted); }

/* Start phase / no-phase card */
.no-phase-card {
  background: var(--bg-card);
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.no-phase-icon { font-size: 2rem; }
.no-phase-title { font-size: 1rem; font-weight: 600; color: var(--text-primary); }
.no-phase-sub { font-size: 0.8125rem; color: var(--text-secondary); }

/* Phase history cards */
.phase-history-card {
  background: var(--bg-elevated);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 10px;
}
.phase-history-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.phase-history-title { font-size: 0.9375rem; font-weight: 600; color: var(--text-primary); }
.phase-history-meta { font-size: 0.8125rem; color: var(--text-muted); }
.phase-history-weights {
  display: flex;
  gap: 16px;
  margin-top: 6px;
  font-size: 0.8125rem;
  color: var(--text-secondary);
}
.phase-history-weight-val { font-weight: 600; color: var(--text-primary); }

/* Phase type pill selector (in modal) */
.phase-type-pills {
  display: flex;
  gap: 8px;
}
.phase-type-pill {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  font-family: inherit;
  padding: 10px 6px;
  cursor: pointer;
  transition: all var(--transition);
  text-align: center;
  -webkit-tap-highlight-color: transparent;
}
.phase-type-pill:hover { border-color: var(--accent); color: var(--text-primary); }
.phase-type-pill--selected {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}

/* ─── Profile Page ───────────────────────────────────────────── */
.profile-avatar-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 16px 8px;
  gap: 10px;
}
/* Clickable wrapper around the avatar */
.profile-avatar-wrapper {
  position: relative;
  display: inline-flex;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  border-radius: 50%;
}
.profile-avatar-wrapper:hover .profile-avatar-edit-overlay,
.profile-avatar-wrapper:focus-within .profile-avatar-edit-overlay {
  opacity: 1;
}
.profile-avatar-edit-overlay {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.52);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.375rem;
  opacity: 0;
  transition: opacity var(--transition);
  pointer-events: none;
}

.profile-avatar-lg {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--accent-soft);
  border: 2px solid var(--accent);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  font-weight: 700;
  overflow: hidden;  /* clips the <img> to the circle */
}
.profile-avatar-lg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}
.profile-name-input {
  text-align: center;
  font-size: 1.125rem;
  font-weight: 600;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  padding: 4px 8px;
  width: 100%;
  max-width: 220px;
  outline: none;
  font-family: inherit;
  transition: border-color var(--transition);
}
.profile-name-input:focus { border-color: var(--accent); }

.profile-stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 0 16px 4px;
}
.profile-stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 10px;
  text-align: center;
}
.profile-stat-value {
  font-size: 1.625rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
  display: block;
}
.profile-stat-label {
  font-size: 0.625rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  margin-top: 4px;
  display: block;
}

.goals-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 4px 0;
}
.goal-chip {
  -webkit-appearance: none;
  appearance: none;
  padding: 7px 14px;
  border-radius: 9999px;
  border: 1px solid var(--border);
  font-size: 0.8125rem;
  font-family: inherit;
  cursor: pointer;
  background: none;
  color: var(--text-secondary);
  transition: all var(--transition);
  -webkit-tap-highlight-color: transparent;
}
.goal-chip:hover { border-color: var(--accent); color: var(--text-primary); }
.goal-chip--selected {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 500;
}

/* ─── Coming Soon Card ───────────────────────────────────────── */
.coming-soon-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  gap: 14px;
  padding: 40px 32px;
  text-align: center;
  margin: 0 16px;
}
.coming-soon-icon { font-size: 3.5rem; line-height: 1; }
.coming-soon-card h2 { font-size: 1.25rem; font-weight: 700; color: var(--text-primary); margin: 0; }
.coming-soon-card p { font-size: 0.875rem; color: var(--text-secondary); line-height: 1.65; max-width: 260px; margin: 0; }

/* ─── iOS PWA Safe Area Insets ───────────────────────────────────────────────
   Two parallel rule sets — both must be kept in sync:
   1. @media (display-mode: standalone)  — works on Chrome/Android and modern iOS
   2. html.pwa-standalone                — the reliable iOS fallback. Apple's
      implementation of the display-mode media query has long-standing bugs so we
      also detect standalone via window.navigator.standalone in a <head> script
      and add this class to <html> before first paint.

   IMPORTANT: do NOT set `top: env(safe-area-inset-top)` on sticky .view-header.
   iOS Safari applies that value as a *visual* downward offset in addition to the
   padding-top, doubling the safe-area gap and misaligning header controls with
   the fixed hamburger/logo. Sticky `top` is only needed as a scroll threshold —
   use padding-top alone to push content below the status bar.

   Bottom bar: html background is set to --bg-card so the home-indicator area
   (below the bottom nav) matches the nav colour instead of showing black. */

/* Fill the home-indicator area at the bottom with the nav background colour */
@media (display-mode: standalone) { html { background: var(--bg-card); } }
html.pwa-standalone               { background: var(--bg-card); }

@media (display-mode: standalone) {
  #btn-hamburger { top: calc(14px + env(safe-area-inset-top)); }
  #page-logo     { top: calc(14px + env(safe-area-inset-top)); }
  /* padding-top only — no top: override (avoids iOS Safari sticky double-offset) */
  .view-header   { padding-top: calc(20px + env(safe-area-inset-top)); }
  .view--full .view-header { padding-top: calc(64px + env(safe-area-inset-top)); }
  #view-exercises .view-header,
  #view-reports   .view-header,
  #view-settings  .view-header { padding-top: calc(64px + env(safe-area-inset-top)); }
  #sidebar-drawer { padding-top: env(safe-area-inset-top); }
  #bottom-nav { padding-bottom: env(safe-area-inset-bottom); height: calc(var(--nav-height) + env(safe-area-inset-bottom)); }
  .view      { bottom: calc(var(--nav-height) + env(safe-area-inset-bottom)); }
  .view--full { bottom: 0; }
}

/* iOS-reliable duplicate — added via window.navigator.standalone detection */
html.pwa-standalone #btn-hamburger { top: calc(14px + env(safe-area-inset-top)); }
html.pwa-standalone #page-logo     { top: calc(14px + env(safe-area-inset-top)); }
/* padding-top only — no top: override (avoids iOS Safari sticky double-offset) */
html.pwa-standalone .view-header   { padding-top: calc(20px + env(safe-area-inset-top)); }
html.pwa-standalone .view--full .view-header { padding-top: calc(64px + env(safe-area-inset-top)); }
html.pwa-standalone #view-exercises .view-header,
html.pwa-standalone #view-reports   .view-header,
html.pwa-standalone #view-settings  .view-header { padding-top: calc(64px + env(safe-area-inset-top)); }
html.pwa-standalone #sidebar-drawer { padding-top: env(safe-area-inset-top); }
html.pwa-standalone #bottom-nav { padding-bottom: env(safe-area-inset-bottom); height: calc(var(--nav-height) + env(safe-area-inset-bottom)); }
html.pwa-standalone .view      { bottom: calc(var(--nav-height) + env(safe-area-inset-bottom)); }
html.pwa-standalone .view--full { bottom: 0; }

/* ─── Tab View Headers (Exercises, Reports, Settings) ───────────────────────
   These are the three bottom-nav tab views. They are NOT .view--full but they
   still need their sticky header to clear the fixed hamburger + page-logo
   (which extends to ~50 px from the top). 64 px matches the full-screen views
   and gives the same consistent breathing room. */
#view-exercises .view-header,
#view-reports   .view-header,
#view-settings  .view-header {
  padding-top: 64px;
}

/* ─── Home View Header ───────────────────────────────────────────────────────
   The home page now uses .view-header like Train/Profile. A top controls row
   sits at the same height as the fixed hamburger/logo; the h1 and greeting
   appear below it. */
.home-view-header {
  padding-top: 14px;   /* align controls row with hamburger top (14px from top) */
}

/* Top row: empty left (hamburger lives there, fixed) + right controls */
.home-header-controls {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  height: 36px;        /* matches hamburger height so badge aligns with it */
  margin-bottom: 8px;
}

/* Date/time pickers sit just below the sticky header */
.home-datetime-section {
  padding: 14px 20px 4px;
}

/* iOS PWA: push home header controls down with the rest of the fixed elements */
@media (display-mode: standalone) {
  .home-view-header { padding-top: calc(14px + env(safe-area-inset-top)); }
}
html.pwa-standalone .home-view-header { padding-top: calc(14px + env(safe-area-inset-top)); }

/* ─── Insight Page ───────────────────────────────────────────── */
.insight-scroll { padding-bottom: 32px; }

.insight-section { padding: 16px 16px 0; }
.insight-section--last { padding-bottom: 16px; }

.insight-stats-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* Streak card */
.insight-streak-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
}
.insight-streak-main { display: flex; align-items: baseline; gap: 8px; }
.insight-streak-value { font-size: 2.5rem; font-weight: 700; color: var(--accent); line-height: 1; }
.insight-streak-unit { font-size: 0.875rem; color: var(--text-secondary); font-weight: 500; }
.insight-streak-delta {
  font-size: 0.8125rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 99px;
}
.insight-streak-delta--up     { background: rgba(34, 197, 94, 0.15); color: var(--success); }
.insight-streak-delta--down   { background: rgba(239, 68, 68, 0.12); color: var(--danger); }
.insight-streak-delta--neutral { background: rgba(255, 255, 255, 0.06); color: var(--text-muted); }

/* Chart cards */
.insight-chart-card { padding: 14px 16px 12px; }
.insight-chart-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 10px;
}

/* SVG charts */
.insight-svg { display: block; width: 100%; overflow: visible; }
.insight-axis-label {
  font-size: 9px;
  fill: #64748b;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
}

/* Legend */
.insight-legend { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.insight-legend-item { display: flex; align-items: center; gap: 5px; }
.insight-legend-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.insight-legend-label { font-size: 0.6875rem; color: var(--text-secondary); }

/* PR rows */
.insight-pr-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
}
.insight-pr-row--border { border-bottom: 1px solid var(--border); }
.insight-pr-main { display: flex; flex-direction: column; gap: 2px; }
.insight-pr-name { font-size: 0.9375rem; font-weight: 600; color: var(--text-primary); }
.insight-pr-date { font-size: 0.75rem; color: var(--text-muted); }
.insight-pr-values { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.insight-pr-value { font-size: 1rem; font-weight: 700; color: var(--accent); }
.insight-pr-delta { font-size: 0.75rem; font-weight: 600; color: var(--success); }

/* Volume period toggle */
.insight-period-row { display: flex; gap: 6px; margin-bottom: 12px; }
.insight-period-btn {
  flex: 1;
  padding: 7px 0;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: none;
  color: var(--text-muted);
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
  -webkit-tap-highlight-color: transparent;
}
.insight-period-btn--active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

/* Empty states */
.insight-empty {
  font-size: 0.875rem;
  color: var(--text-muted);
  text-align: center;
  padding: 20px 0 10px;
}
.insight-empty--padded { padding: 16px; }

/* Muscle Distribution coming-soon variant (compact) */
.insight-coming-soon {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 28px 24px;
  text-align: center;
}
.insight-coming-soon h3 {
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}
.insight-coming-soon p {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.6;
  max-width: 240px;
  margin: 0;
}
