/* Sarge Trainer — Gym Slate Design System */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  /* ── Surface hierarchy (3-tone) ──────────────── */
  --bg-canvas: #0e1117;
  --bg-card: #161a23;
  --bg-raised: #1c2230;

  /* ── Borders ─────────────────────────────────── */
  --border: #2a3040;
  --border-subtle: #1f2535;

  /* ── Text (high contrast, no dark gray) ──────── */
  --text: #f0f0f3;
  --text-secondary: #b4b8c8;
  --text-muted: #8b90a0;

  /* ── Brand / Actions ─────────────────────────── */
  --accent: #10b981;
  --accent-hover: #059669;
  --accent-subtle: rgba(16, 185, 129, 0.12);

  /* ── Semantic ────────────────────────────────── */
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --danger-subtle: rgba(239, 68, 68, 0.12);

  /* ── Spacing & Shape ─────────────────────────── */
  --radius: 6px;
  --radius-lg: 10px;
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-canvas);
  color: var(--text);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  font-size: 15px;
}

#app {
  min-height: 100vh;
  padding: 12px 14px 80px;
  max-width: 480px;
  margin: 0 auto;
}

/* ── Typography ─────────────────────────────────── */
h1 { font-size: 1.25rem; font-weight: 700; letter-spacing: -0.01em; }
h2 { font-size: 1.1rem; font-weight: 600; }

label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* ── Buttons ────────────────────────────────────── */
button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  border: none;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  background: var(--accent);
  color: white;
  transition: background 0.15s, transform 0.1s;
}

button:hover { background: var(--accent-hover); }
button:active { transform: scale(0.97); }
button:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

.btn-small {
  padding: 5px 10px;
  font-size: 0.8rem;
}

/* ── Forms ──────────────────────────────────────── */
input, select, textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-raised);
  color: var(--text);
  font-size: 0.93rem;
  transition: border-color 0.15s;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-subtle);
}

input::placeholder, textarea::placeholder {
  color: var(--text-muted);
}

/* ── Login ──────────────────────────────────────── */
.login-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 80vh;
  gap: 24px;
}

.login-screen h1 {
  font-size: 1.5rem;
  letter-spacing: -0.02em;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  max-width: 300px;
}

.login-form button[type="submit"] {
  width: 100%;
  margin-top: 4px;
}

.login-tabs {
  display: flex;
  gap: 0;
  width: 100%;
  max-width: 300px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}

.login-tab {
  flex: 1;
  padding: 7px 0;
  font-size: 0.85rem;
  font-weight: 600;
  background: var(--bg-raised);
  color: var(--text-muted);
  border: none;
  border-radius: 0;
  cursor: pointer;
  transition: all 0.15s;
}

.login-tab:hover { background: var(--bg-card); }
.login-tab:active { transform: none; }

.login-tab.active {
  background: var(--accent);
  color: white;
}

.login-divider {
  display: flex;
  align-items: center;
  width: 100%;
  max-width: 300px;
  margin: 12px 0 4px;
  gap: 12px;
}
.login-divider::before,
.login-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}
.login-divider span {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.demo-btn {
  width: 100%;
  max-width: 300px;
  padding: 10px;
  font-size: 0.95rem;
  font-weight: 700;
  border: 2px solid var(--accent);
  border-radius: var(--radius);
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  transition: all 0.15s;
}
.demo-btn:hover {
  background: var(--accent);
  color: white;
}
.demo-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.demo-hint {
  margin-top: 6px;
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
}

.password-wrap {
  position: relative;
  width: 100%;
}

.password-wrap input {
  padding-right: 40px;
}

.pw-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
}

.pw-toggle:hover { color: var(--text-secondary); background: transparent; }
.pw-toggle:active { transform: translateY(-50%); }

/* ── Dashboard / App Header ────────────────────── */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg-canvas);
  padding: 8px 0 6px;
}

.empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: 32px 16px;
  font-size: 0.9rem;
}

/* ── Client List (borderless rows) ──────────────── */
.client-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.client-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 4px;
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: background 0.12s;
}

.client-card:last-child {
  border-bottom: none;
}

.client-card:hover {
  background: var(--bg-card);
}

.client-card-main {
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex: 1;
  min-width: 0;
}

.client-name {
  font-weight: 600;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}

.client-next {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.client-card-meta {
  text-align: right;
  flex-shrink: 0;
}

.client-balance {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.balance-low {
  color: var(--warning);
  font-weight: 600;
}

/* ── Initials Avatar ───────────────────────────── */
.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
  letter-spacing: 0.02em;
}

/* ── Progress Bar (mini) ───────────────────────── */
.progress-bar {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  width: 48px;
  margin-top: 3px;
}

.progress-bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.3s ease;
}

/* ── Status Dot ────────────────────────────────── */
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.status-dot.completed { background: var(--success); }
.status-dot.pending { background: var(--text-muted); }
.status-dot.low-bal { background: var(--warning); vertical-align: middle; margin-left: 4px; }

/* ── Detail Screen ─────────────────────────────── */
.detail-screen {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.detail-row {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.detail-row:empty {
  display: none;
}

.detail-section {
  margin-top: 6px;
}

.detail-section strong {
  display: block;
  margin-bottom: 3px;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.detail-section p {
  font-size: 0.9rem;
}

/* ── Package Cards ─────────────────────────────── */
.package-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  font-size: 0.85rem;
  margin-top: 4px;
}

.package-card.past {
  opacity: 0.45;
}

.pkg-length {
  color: var(--text-muted);
  font-size: 0.75rem;
}

/* ── Forms (screens + stacks) ──────────────────── */
.form-screen {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.form-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.form-stack[hidden] {
  display: none;
}

.form-stack button[type="submit"] {
  margin-top: 2px;
}

/* ── Button Variants ───────────────────────────── */
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  color: var(--text);
  border-color: var(--text-secondary);
  background: var(--bg-raised);
}

/* ── Session List ──────────────────────────────── */
.session-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.session-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 4px;
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: background 0.12s;
}

.session-card:last-child {
  border-bottom: none;
}

.session-card:hover {
  background: var(--bg-card);
}

.session-card-main {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.session-date {
  font-weight: 600;
  font-size: 0.9rem;
}

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

.session-status {
  font-size: 0.75rem;
  font-weight: 600;
}

.session-completed .session-status {
  color: var(--success);
}

.session-pending .session-status {
  color: var(--text-muted);
}

/* ── Session Detail ───────────────────────────── */
.session-detail-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.session-toggle-section {
  padding: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Toggle switch */
.toggle-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 0.95rem;
}

.toggle-label input[type="checkbox"] {
  width: 44px;
  height: 24px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--border);
  border-radius: 12px;
  position: relative;
  cursor: pointer;
  transition: background 0.2s;
  flex-shrink: 0;
  padding: 0;
  border: none;
}

.toggle-label input[type="checkbox"]::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  background: white;
  border-radius: 50%;
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.toggle-label input[type="checkbox"]:checked {
  background: var(--success);
}

.toggle-label input[type="checkbox"]:checked::after {
  transform: translateX(20px);
}

/* ── Completion micro-interaction ──────────────── */
@keyframes check-pulse {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); }
  70% { box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.toggle-label input[type="checkbox"]:checked {
  animation: check-pulse 0.4s ease-out;
}

.session-toggle-section.just-completed {
  border-color: var(--success);
  transition: border-color 0.6s ease;
}

.session-actions {
  display: flex;
  gap: 6px;
}

/* ── Button — Full Width ──────────────────────── */
.btn-full {
  width: 100%;
  padding: 10px;
  font-size: 0.93rem;
}

/* ── Button — Danger ──────────────────────────── */
.btn-danger {
  background: var(--danger-subtle);
  color: var(--danger);
  border: 1px solid transparent;
}

.btn-danger:hover {
  background: var(--danger);
  color: white;
}

/* ── Bottom Nav ────────────────────────────────── */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 52px;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: center;
  z-index: 100;
}

.bottom-nav-inner {
  display: flex;
  max-width: 480px;
  width: 100%;
}

.nav-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 6px 0;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.15s;
  border-radius: 0;
}

.nav-tab:hover {
  color: var(--text-secondary);
  background: transparent;
}

.nav-tab:active { transform: none; }

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

.nav-tab svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ── Search Input ─────────────────────────────── */
.search-input {
  padding: 8px 11px;
  font-size: 0.9rem;
}

/* ── Category Chips ──────────────────────────── */
.chip-row {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 2px 0 6px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.chip-row::-webkit-scrollbar { display: none; }

.chip {
  flex-shrink: 0;
  padding: 5px 12px;
  border-radius: 16px;
  font-size: 0.78rem;
  font-weight: 600;
  background: var(--bg-raised);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.12s;
  white-space: nowrap;
}

.chip:hover {
  background: var(--bg-card);
  border-color: var(--text-muted);
}

.chip.active {
  background: var(--accent-subtle);
  color: var(--accent);
  border-color: var(--accent);
}

/* ── Category dropdown (exercise picker) ─────── */
.category-select {
  width: auto;
  min-width: 110px;
  padding-right: 8px;
  font-size: 0.82rem;
}

/* ── Exercise List ───────────────────────────── */
.exercise-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.exercise-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 4px;
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: background 0.12s;
}

.exercise-row:last-child { border-bottom: none; }
.exercise-row:hover { background: var(--bg-card); }

.exercise-row-main {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

.exercise-name {
  font-size: 0.9rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.exercise-meta {
  font-size: 0.72rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

.badge-custom {
  font-size: 0.65rem;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 3px;
  background: var(--accent-subtle);
  color: var(--accent);
  flex-shrink: 0;
}

.exercise-section-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 8px 4px 4px;
}

/* ── Set Logging ─────────────────────────────── */
.sets-container {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.set-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  transition: border-color 0.3s;
}

.set-row.set-saved {
  border-color: var(--border-subtle);
  opacity: 0.85;
}

.set-row:not(.set-saved) {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-subtle);
}

.set-number {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  min-width: 22px;
  flex-shrink: 0;
}

.set-fields {
  display: flex;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.set-field {
  display: flex;
  align-items: center;
  gap: 3px;
  flex: 1;
  min-width: 0;
}

.set-field input {
  width: 100%;
  min-width: 0;
  padding: 6px 8px;
  font-size: 1rem;
  font-weight: 600;
  text-align: center;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.set-saved .set-field input {
  background: transparent;
  border-color: transparent;
}

.set-field input::placeholder {
  color: #5a5f70;
  font-weight: 400;
  font-style: italic;
}

.set-unit {
  font-size: 0.7rem;
  color: var(--text-muted);
  flex-shrink: 0;
  min-width: 20px;
}

.set-check {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  background: var(--bg-raised);
  color: var(--text-muted);
  border: 2px solid var(--border);
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
  transition: all 0.2s;
}

.set-check:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.set-check.saved {
  background: var(--success);
  border-color: var(--success);
  color: white;
}

@keyframes set-check-pulse {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.5); }
  70% { box-shadow: 0 0 0 10px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.set-check.just-checked {
  animation: set-check-pulse 0.5s ease-out;
}

/* ── Utility ───────────────────────────────────── */
.text-muted {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.text-secondary {
  color: var(--text-secondary);
  font-size: 0.85rem;
}

/* ── Error ──────────────────────────────────────── */
.error {
  color: var(--danger);
  font-size: 0.85rem;
  text-align: center;
}

/* ── Workout History ──────────────────────────── */
.history-session {
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 10px;
}

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

.history-session-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  cursor: pointer;
}

.history-date {
  font-weight: 600;
  font-size: 0.9rem;
}

.history-duration {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.history-exercises {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.history-exercise {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 8px;
  cursor: pointer;
  border-radius: var(--radius);
  transition: background 0.12s;
}

.history-exercise:hover { background: var(--bg-card); }

.history-exercise-name {
  font-size: 0.82rem;
  color: var(--text);
}

.history-exercise-summary {
  font-size: 0.72rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

/* ── AI Panel (bottom sheet) ──────────────────── */
.ai-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 1;
  transition: opacity 0.2s ease;
}

.ai-overlay.ai-hidden {
  opacity: 0;
  pointer-events: none;
}

.ai-panel {
  width: 100%;
  max-width: 480px;
  max-height: 80vh;
  background: var(--bg-card);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  display: flex;
  flex-direction: column;
  transform: translateY(0);
  transition: transform 0.25s ease;
}

.ai-overlay.ai-hidden .ai-panel {
  transform: translateY(100%);
}

.ai-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  background: var(--bg-card);
}

.ai-panel-title {
  font-weight: 600;
  font-size: 0.95rem;
}

.ai-panel-close {
  font-size: 1.2rem;
  line-height: 1;
  padding: 4px 8px;
}

/* Chat thread */
.ai-thread {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 50vh;
  min-height: 60px;
}

.ai-msg {
  max-width: 88%;
  padding: 8px 12px;
  border-radius: var(--radius);
  font-size: 0.88rem;
  line-height: 1.5;
  word-wrap: break-word;
}

.ai-msg span { display: block; }

.ai-msg-user {
  align-self: flex-end;
  background: var(--accent);
  color: white;
  border-radius: var(--radius) var(--radius) 2px var(--radius);
}

.ai-msg-assistant {
  align-self: flex-start;
  background: var(--bg-raised);
  color: var(--text);
  border-radius: var(--radius) var(--radius) var(--radius) 2px;
}

/* Input area (pinned to bottom of panel) */
.ai-panel-input {
  padding: 12px 16px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.ai-panel-input .ai-input {
  flex: 1;
  resize: none;
  min-height: 36px;
  max-height: 80px;
  font-size: 0.88rem;
}

.ai-panel-input .ai-send {
  width: auto;
  padding: 8px 16px;
  flex-shrink: 0;
}

.ai-thinking {
  color: var(--accent);
  font-style: italic;
  font-size: 0.88rem;
}

.ai-response-text {
  font-size: 0.88rem;
  line-height: 1.55;
  white-space: pre-wrap;
}

.ai-error {
  color: var(--danger);
  font-size: 0.85rem;
}

/* ── Settings ─────────────────────────────────── */
.settings-body {
  padding: 0 16px 80px;
}

.settings-section {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}

.settings-section h2 {
  margin: 0 0 12px;
  font-size: 0.95rem;
}

.settings-row {
  margin-bottom: 10px;
}

.settings-row label {
  display: block;
  margin-bottom: 4px;
}

.settings-hint {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin: 0 0 12px;
  line-height: 1.4;
}

.settings-msg {
  font-size: 0.82rem;
  margin: 8px 0 0;
  padding: 6px 10px;
  border-radius: var(--radius);
}

.settings-msg.success {
  color: var(--success);
  background: rgba(16, 185, 129, 0.1);
}

.settings-msg.error {
  color: var(--danger);
  background: rgba(239, 68, 68, 0.1);
}

.settings-version {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.75rem;
  margin: 16px 0 0;
}

/* ── Confirm Modal ────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 300;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 1;
  transition: opacity 0.15s ease;
}

.modal-overlay.modal-hidden {
  opacity: 0;
  pointer-events: none;
}

.modal-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-card);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 24px 20px 20px;
  margin-bottom: 0;
}

@media (min-width: 481px) {
  .modal-overlay { align-items: center; }
  .modal-card {
    border-radius: var(--radius-lg);
    margin-bottom: 0;
  }
}

.modal-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 8px;
}

.modal-body {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.45;
  margin: 0 0 20px;
}

.modal-body[hidden] { display: none; }

.modal-actions {
  display: flex;
  gap: 10px;
}

.modal-btn {
  flex: 1;
  padding: 10px;
  font-size: 0.93rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s;
}

.modal-cancel {
  background: var(--bg-raised);
  color: var(--text-secondary);
}

.modal-cancel:hover {
  background: var(--border);
  color: var(--text);
}

.modal-confirm {
  background: var(--accent);
  color: white;
}

.modal-confirm:hover {
  background: var(--accent-hover);
}

.modal-destructive {
  background: var(--danger);
  color: white;
}

.modal-destructive:hover {
  background: #dc2626;
}

/* ── Debug (remove later) ──────────────────────── */
.debug-info {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.75rem;
  margin-top: 8px;
}
