:root {
  --bg: #000000;
  --bg-elevated: #0a0a0a;
  --surface: #111113;
  --surface-2: #16161a;
  --border: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.14);
  --text: #ffffff;
  --text-secondary: rgba(255, 255, 255, 0.62);
  --muted: rgba(255, 255, 255, 0.38);
  --accent: #ffffff;
  --accent-dim: rgba(255, 255, 255, 0.6);
  --success: #fbbf24;
  --danger: #ef4444;
  --warn: #fbbf24;
  --radius: 18px;
  --radius-sm: 12px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  --mono: "SF Mono", ui-monospace, Menlo, monospace;
  --dock-h: 68px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after { box-sizing: border-box; }
html { color-scheme: dark; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  font-weight: 400;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.bg-glow { display: none; }

.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  padding: 0 0 calc(var(--dock-h) + var(--safe-bottom) + 4rem);
}

/* ========== TOPBAR ========== */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.3rem 1.25rem 0.85rem;
}

.brand {
  margin: 0;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  color: var(--muted);
}

.topbar .hero-date {
  margin: 0.2rem 0 0;
  font-size: 0.85rem;
  color: var(--text-secondary);
  text-transform: capitalize;
}

.streak-badge {
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
  padding: 0.45rem 0.8rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
}

.streak-num {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--accent);
  font-family: var(--mono);
}

.streak-lbl {
  font-size: 0.65rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ========== HERO ========== */
.hero-card {
  position: relative;
  margin: 0 1.25rem 1.5rem;
  border-radius: 24px;
  overflow: hidden;
  min-height: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
}

.hero-card-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  background-color: var(--surface-2);
  opacity: 1;
  transition: filter 0.4s;
}

.hero-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg,
    rgba(0,0,0,0.05) 0%,
    rgba(0,0,0,0.4) 50%,
    rgba(0,0,0,0.95) 100%);
  z-index: 1;
}

.hero-card-content {
  position: relative;
  z-index: 2;
  padding: 1.4rem 1.4rem 1.6rem;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 380px;
}

.hero-eyebrow {
  display: block;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 0.65rem;
}

.hero-title {
  margin: 0 0 0.6rem;
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.025em;
  color: var(--text);
}

.hero-meta {
  margin: 0 0 1.25rem;
  font-size: 0.78rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.hero-meta .dot {
  color: var(--muted);
}

.badge.solid {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  padding: 0.18rem 0.55rem;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.stats-row.compact {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 0.85rem;
}

.stats-row.compact .stat-card {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0.75rem 0.4rem;
  text-align: left;
  position: relative;
}

.stats-row.compact .stat-card + .stat-card {
  border-left: 1px solid rgba(255, 255, 255, 0.08);
}

.stat-card .stat-label {
  display: block;
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.15rem;
}

.stat-card .stat-value {
  display: block;
  font-size: 1.65rem;
  font-weight: 700;
  font-family: var(--mono);
  line-height: 1;
  color: var(--text);
  letter-spacing: -0.02em;
}

.stat-card .stat-value.accent {
  color: var(--success);
}

.week-strip {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.35rem;
  margin-top: 0.2rem;
}

.ws-day {
  text-align: center;
  padding: 0.45rem 0.15rem 0.55rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  font-size: 0.62rem;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  cursor: pointer;
  transition: all 0.18s;
}

.ws-day.done {
  background: rgba(251, 191, 36, 0.14);
  color: var(--success);
}

.ws-day.today {
  background: var(--text);
  color: var(--bg);
  font-weight: 700;
}

.ws-day.skip {
  background: rgba(255, 255, 255, 0.02);
  color: var(--muted);
}

.ws-mark {
  font-size: 0.7rem;
  line-height: 1;
}

/* ========== SECTIONS ========== */
section.panel {
  display: none;
}
section.panel.active {
  display: block;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 1.75rem 1.25rem 0.7rem;
}

.section-title {
  margin: 0;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.page-title {
  margin: 1.3rem 1.25rem 0.6rem;
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.page-hint {
  margin: 0 1.25rem 1rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.card {
  margin: 0 1.25rem 1rem;
  padding: 1.1rem 1.2rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.card.card-glass,
.card.card-featured {
  background: var(--surface);
}

.card .section-title {
  margin-bottom: 0.7rem;
}

.label {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ========== PLAN ========== */
.plan-compact summary,
.plan-details summary {
  list-style: none;
  cursor: pointer;
  font-size: 0.82rem;
  color: var(--text-secondary);
  padding: 0.4rem 0;
}
.plan-details summary::-webkit-details-marker { display: none; }
.plan-details summary::before {
  content: "›";
  display: inline-block;
  margin-right: 0.45rem;
  color: var(--muted);
  transition: transform 0.2s;
}
.plan-details[open] summary::before {
  transform: rotate(90deg);
}

.plan-steps {
  list-style: none;
  margin: 0.6rem 0 0;
  padding: 0;
}

.plan-steps li {
  padding: 0.55rem 0;
  border-top: 1px solid var(--border);
  font-size: 0.88rem;
  color: var(--text-secondary);
}

/* ========== EX SUGGESTIONS STRIP ========== */
.ex-strip {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 150px;
  gap: 0.7rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding: 0 1.25rem 0.5rem;
  -webkit-overflow-scrolling: touch;
}
.ex-strip::-webkit-scrollbar { display: none; }

.ex-card-mini {
  scroll-snap-align: start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.15s;
}
.ex-card-mini:active { transform: scale(0.97); }

.ex-card-mini .ex-thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 4/3;
  background: var(--surface-2);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ex-card-mini .ex-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: #fff;
}
.ex-thumb-fallback {
  font-size: 2.4rem;
  opacity: 0.5;
}

.ex-card-mini .ex-thumb-label {
  position: absolute;
  bottom: 0.4rem;
  left: 0.5rem;
  z-index: 1;
  font-size: 0.55rem;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  background: rgba(0,0,0,0.65);
  padding: 0.12rem 0.4rem;
  border-radius: 4px;
}

.ex-card-mini .ex-name {
  padding: 0.55rem 0.65rem 0.65rem;
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.25;
  color: var(--text);
}

/* ========== EXERCISES PANEL GRID ========== */
.exercises-grid.premium {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.85rem;
  padding: 0 1.25rem 1rem;
}

.exercises-grid.premium .ex-card {
  margin: 0;
  padding: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.15s;
}
.exercises-grid.premium .ex-card:active { transform: scale(0.97); }

.exercises-grid.premium .ex-thumb {
  width: 100%;
  aspect-ratio: 1/1;
  background-color: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.exercises-grid.premium .ex-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #fff;
}

.exercises-grid.premium .ex-card h4 {
  margin: 0.7rem 0.75rem 0.2rem;
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.exercises-grid.premium .ex-card .ex-muscle {
  margin: 0 0.75rem 0.75rem;
  font-size: 0.7rem;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.muscle-filter {
  display: flex;
  gap: 0.4rem;
  overflow-x: auto;
  padding: 0 1.25rem 0.7rem;
  -webkit-overflow-scrolling: touch;
}
.muscle-filter::-webkit-scrollbar { display: none; }
.muscle-filter .btn.chip { flex: 0 0 auto; white-space: nowrap; }
.muscle-filter .btn.chip.active {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}

/* ========== BUTTONS ========== */
.btn {
  appearance: none;
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  gap: 0.4rem;
}

.btn:hover { background: rgba(255,255,255,0.06); }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn.primary {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}
.btn.primary:hover { background: rgba(255,255,255,0.92); }

.btn.secondary {
  background: var(--surface-2);
  border-color: var(--border);
}
.btn.secondary:hover { background: rgba(255,255,255,0.08); }

.btn.chip {
  padding: 0.42rem 0.75rem;
  font-size: 0.78rem;
  font-weight: 500;
  border-radius: 999px;
  color: var(--text-secondary);
  border-color: var(--border);
}
.btn.chip:hover {
  color: var(--text);
  border-color: var(--border-strong);
}

.btn.ghost {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 0.8rem;
  padding: 0.3rem 0.55rem;
}
.btn.ghost:hover { color: var(--danger); }

.btn.full { width: 100%; margin-top: 0.5rem; }

.btn.chip.accent-chip {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}

.row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
}

/* ========== FORM ========== */
input, textarea, select {
  font-family: inherit;
  font-size: 0.95rem;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.75rem 0.9rem;
  width: 100%;
  margin: 0.3rem 0;
  transition: border-color 0.15s;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--border-strong);
}
input::placeholder, textarea::placeholder { color: var(--muted); }

textarea { resize: vertical; min-height: 80px; }

.field-label {
  display: block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 0.3rem;
}

.field-hint {
  margin: 0.25rem 0 0.85rem;
  font-size: 0.75rem;
  color: var(--muted);
}

.add-ex-row {
  display: flex;
  gap: 0.45rem;
  margin-top: 0.35rem;
}
.add-ex-row input { flex: 1; margin: 0; }

/* ========== WORKOUT SECTIONS (mobile) ========== */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.workout-main {
  padding: 1rem 1.1rem 1.15rem;
}

.workout-section {
  margin-bottom: 1.35rem;
  padding-bottom: 1.35rem;
  border-bottom: 1px solid var(--border);
}
.workout-section:last-of-type {
  border-bottom: none;
  margin-bottom: 0.5rem;
  padding-bottom: 0;
}

.workout-section-title {
  margin: 0 0 0.55rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text);
}

.how-exercise-block {
  margin: 0;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 0;
}

.workout-section .field-hint {
  margin: 0 0 0.65rem;
}

/* ========== EXERCISE PICK LIST ========== */
.ex-pick-list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin: 0.25rem 0 0.85rem;
}

.ex-pick-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem;
  align-items: stretch;
}

.ex-pick-name,
.ex-pick-how,
.btn-action {
  font-family: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}
.ex-pick-name:active,
.ex-pick-how:active,
.btn-action:active {
  transform: scale(0.98);
}

.ex-pick-name {
  min-height: 50px;
  padding: 0.8rem 1rem;
  text-align: left;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.25;
}

.ex-pick-how {
  min-width: 72px;
  min-height: 50px;
  padding: 0 1rem;
  border-radius: 14px;
  border: 1px solid rgba(251, 191, 36, 0.5);
  background: rgba(251, 191, 36, 0.1);
  color: var(--accent);
  font-size: 0.88rem;
  font-weight: 700;
}

/* ========== ACTION GRID ========== */
.action-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
}

.btn-action {
  min-height: 50px;
  padding: 0.7rem 0.75rem;
  border-radius: 14px;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.86rem;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
}

.btn-action.primary-action {
  grid-column: 1 / -1;
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
  font-size: 0.92rem;
  min-height: 52px;
}

.btn-action.muted-action {
  color: var(--muted);
  border-color: var(--border);
  background: transparent;
}

.add-ex-row .btn-action {
  min-width: 52px;
  flex-shrink: 0;
  font-size: 1.25rem;
  font-weight: 700;
  padding: 0;
}

/* ========== TIMER PANEL ========== */
.timer-panel {
  margin-bottom: 1rem;
  padding: 1rem;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: 16px;
}

.timer-panel-label {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.25rem;
}

.timer-panel-time {
  display: block;
  font-family: var(--mono);
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 0.75rem;
}

.timer-panel-btns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.timer-panel-btns .btn-action {
  min-height: 46px;
}

#timer-display {
  font-family: var(--mono);
  font-size: 1.15rem;
  font-weight: 700;
  min-width: 3.2rem;
}

/* ========== DETAILS / FEELING ========== */
details summary {
  cursor: pointer;
  padding: 0.5rem 0;
  font-size: 0.85rem;
  color: var(--text-secondary);
}
details summary::-webkit-details-marker { display: none; }
.extras-today summary,
.workout-details summary,
.extra-details summary {
  font-weight: 500;
  color: var(--text-secondary);
}
.extras-today summary::before,
.workout-details summary::before,
.extra-details summary::before {
  content: "›";
  display: inline-block;
  margin-right: 0.4rem;
  color: var(--muted);
  transition: transform 0.2s;
}
.extras-today[open] summary::before,
.workout-details[open] summary::before,
.extra-details[open] summary::before {
  transform: rotate(90deg);
}

.feeling {
  display: flex;
  gap: 0.3rem;
  margin-top: 0.3rem;
}
.feeling button {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.feeling button.on {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}

.feeling-wrap { display: block; }
.meta-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
  margin: 0.6rem 0;
}
.meta-row label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
}
.meta-row input[type="number"] {
  width: 5rem;
  margin: 0;
}

/* ========== SMART HINTS ========== */
.smart-block {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 0.85rem;
}
.hint-card {
  padding: 0.6rem 0.75rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 0.8rem;
  color: var(--text-secondary);
}
.hint-card strong {
  display: block;
  color: var(--text);
  font-weight: 600;
  margin-bottom: 0.1rem;
}

/* ========== EX BLOCK DETAILED ========== */
.ex-block {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.75rem;
  margin-bottom: 0.6rem;
}
.ex-head {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 0.45rem;
}
.ex-head input { flex: 1; margin: 0; }
.set-row {
  display: grid;
  grid-template-columns: 28px 1fr 1fr 36px;
  gap: 0.35rem;
  margin-bottom: 0.35rem;
  align-items: center;
}
.set-num {
  font-family: var(--mono);
  color: var(--muted);
  font-size: 0.78rem;
  text-align: center;
}
.set-row input { margin: 0; }

/* ========== REPEAT BANNER ========== */
.repeat-banner {
  margin: 0 1.25rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.6rem;
  padding: 0.85rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
}
.repeat-banner p {
  margin: 0;
  font-size: 0.82rem;
  color: var(--text-secondary);
  flex: 1;
}

/* ========== WARMUP ========== */
.warmup-list { list-style: none; margin: 0; padding: 0; }
.warmup-item label {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.4rem 0;
  font-size: 0.9rem;
  cursor: pointer;
}
.warmup-item input[type=checkbox] {
  width: auto;
  margin: 0;
  accent-color: var(--text);
}

/* ========== JOURNAL ========== */
.search-row {
  display: flex;
  gap: 0.5rem;
  padding: 0 1.25rem 0.85rem;
}
.search-row input { flex: 1; margin: 0; }

.week-cal {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.35rem;
  padding: 0 1.25rem 1rem;
}
.cal-day {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.55rem 0.15rem;
  text-align: center;
  font-size: 0.7rem;
  color: var(--text-secondary);
}
.cal-day.today {
  background: var(--text);
  color: var(--bg);
  font-weight: 700;
}
.cal-day.done {
  background: rgba(251, 191, 36, 0.18);
  color: var(--success);
}
.cal-day.skip {
  background: rgba(255, 255, 255, 0.02);
  color: var(--muted);
}
.cal-wd { display: block; font-weight: 600; font-size: 0.66rem; letter-spacing: 0.05em; }
.cal-mark { font-size: 0.9rem; display: block; margin-top: 0.15rem; }

.timeline {
  list-style: none;
  margin: 0;
  padding: 0 1.25rem 2rem;
}
.timeline li {
  padding: 0.85rem 0;
  border-top: 1px solid var(--border);
}
.timeline li:last-child { padding-bottom: 0; }
.timeline li.skip-entry { opacity: 0.55; }
.log-meta {
  font-size: 0.7rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.4rem;
}
.ex-line {
  font-size: 0.92rem;
  color: var(--text);
  margin-bottom: 0.25rem;
}
.ex-line strong { font-weight: 600; }
.log-note {
  margin-top: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
  white-space: pre-wrap;
}

.empty-msg {
  padding: 2rem 1rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}

/* ========== PROGRESS / METRICS ========== */
.progress-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.7rem;
  padding: 0 1.25rem 1rem;
}
.metric-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0.85rem 0.95rem;
  cursor: pointer;
}
.metric-card.empty .value { color: var(--muted); }
.metric-card.selected { border-color: var(--border-strong); }
.metric-card .name {
  font-size: 0.7rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.45rem;
}
.metric-card .value {
  font-family: var(--mono);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}
.metric-card .value.accent { color: var(--success); }
.metric-card .date {
  font-size: 0.7rem;
  color: var(--muted);
  margin-top: 0.3rem;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}
.grid-2 label { display: block; font-size: 0.8rem; color: var(--text-secondary); }

.chart-wrap { padding: 0.5rem 0; overflow-x: auto; }
.chart {
  display: flex;
  align-items: flex-end;
  gap: 0.35rem;
  min-height: 120px;
}
.chart-bar-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  min-width: 26px;
}
.chart-bar {
  width: 100%;
  background: var(--text);
  border-radius: 4px 4px 0 0;
  min-height: 3px;
}
.chart-label {
  font-size: 0.62rem;
  color: var(--muted);
  margin-top: 0.3rem;
}

.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.data-table th, .data-table td { padding: 0.55rem 0.45rem; text-align: left; border-bottom: 1px solid var(--border); }
.data-table th { color: var(--muted); font-weight: 600; font-size: 0.7rem; text-transform: uppercase; }

.pr-list { list-style: none; margin: 0; padding: 0; }
.pr-item {
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.pr-item:last-child { border-bottom: none; }
.pr-item strong { font-size: 0.95rem; font-weight: 600; }
.pr-item span { font-size: 0.82rem; color: var(--text-secondary); }
.pr-item small { font-size: 0.7rem; color: var(--muted); }

/* ========== MOTIVATIONS ========== */
.mot-grid { list-style: none; margin: 0; padding: 0 1.25rem 1rem; }
.mot-grid li {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0.9rem 1rem;
  margin-bottom: 0.6rem;
}
.mot-text { margin: 0 0 0.4rem; font-size: 0.95rem; line-height: 1.4; }
.mot-tags { font-size: 0.72rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.mot-actions { margin-top: 0.5rem; }

.quote-inline {
  margin: 0;
  font-style: italic;
  font-size: 0.92rem;
  color: var(--text);
  line-height: 1.45;
}

.prev-block {
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border);
}

/* ========== PHOTOS ========== */
.photos-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.7rem;
  padding: 0 1.25rem 1rem;
}
.photo-card {
  margin: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
}
.photo-card img {
  width: 100%;
  aspect-ratio: 3/4;
  object-fit: cover;
  display: block;
}
.photo-card figcaption {
  padding: 0.45rem 0.6rem;
  font-size: 0.75rem;
  color: var(--muted);
}

/* ========== SETTINGS ========== */
#panel-settings label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.55rem 0;
  font-size: 0.92rem;
  color: var(--text-secondary);
}
#panel-settings label input[type=number] {
  width: 4.5rem;
  margin: 0;
}
#panel-settings label input[type=checkbox] {
  width: auto;
  margin: 0;
  accent-color: var(--text);
}

.pwa-error {
  margin: 0.75rem 1.25rem;
  padding: 0.85rem 1rem;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.35);
  border-radius: 12px;
  color: #fca5a5;
  font-size: 0.88rem;
  line-height: 1.4;
}

/* ========== AI PROGRAM ========== */
.ai-program-card {
  border: 1px solid rgba(251, 191, 36, 0.25);
  background: linear-gradient(180deg, rgba(251, 191, 36, 0.05), transparent 60%), var(--card);
  margin-bottom: 1rem;
}
.ai-goals-label {
  display: block;
  margin: 0.5rem 0 0.7rem;
  font-size: 0.85rem;
  color: var(--muted);
}
.ai-goals-label input {
  margin-top: 0.3rem;
}
.ai-program-preview {
  margin-top: 0.8rem;
  display: grid;
  gap: 0.5rem;
}
.ai-day {
  padding: 0.7rem 0.85rem;
}
.ai-day-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.35rem;
}
.ai-day-head strong {
  font-family: var(--mono);
  background: var(--success);
  color: var(--bg);
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
}
.ai-day-where {
  color: var(--muted);
  font-size: 0.8rem;
}
.ai-day-title {
  font-weight: 600;
  margin-bottom: 0.35rem;
}
.ai-day-body {
  white-space: pre-wrap;
  font-family: inherit;
  font-size: 0.88rem;
  color: var(--muted);
  margin: 0;
  background: transparent;
}

/* ========== PLAN EDITOR ========== */
.plan-edit-day {
  margin-bottom: 0.7rem;
}
.plan-edit-head {
  display: flex;
  gap: 0.45rem;
  margin-bottom: 0.45rem;
  align-items: center;
}
.plan-edit-head strong {
  font-family: var(--mono);
  background: var(--text);
  color: var(--bg);
  padding: 0.25rem 0.55rem;
  border-radius: 6px;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
}
.pe-where { flex: 1; margin: 0; }
.pe-title { margin: 0.35rem 0; }

/* ========== STICKY SAVE / DOCK ========== */
.sticky-save {
  position: fixed;
  bottom: calc(var(--dock-h) + var(--safe-bottom) + 0.45rem);
  left: 50%;
  transform: translateX(-50%);
  width: min(480px, 100% - 2rem);
  z-index: 90;
}
.sticky-save .btn {
  width: 100%;
  padding: 0.95rem;
  font-size: 0.95rem;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.5);
}

.dock {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(480px, 100%);
  display: flex;
  justify-content: space-around;
  align-items: stretch;
  padding: 0.35rem 0.5rem calc(0.35rem + var(--safe-bottom));
  background: rgba(0, 0, 0, 0.92);
  border-top: 1px solid var(--border);
  backdrop-filter: blur(20px);
  z-index: 100;
}

.dock-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  border: none;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 0.6rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  cursor: pointer;
  padding: 0.45rem 0.2rem;
  transition: color 0.18s;
}
.dock-icon { font-size: 1.05rem; opacity: 0.7; transition: opacity 0.18s; }
.dock-btn.active { color: var(--text); }
.dock-btn.active .dock-icon { opacity: 1; }

.dock-7 .dock-btn { min-width: 0; font-size: 0.56rem; }

/* ========== MODAL ========== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fadeIn 0.2s;
}
.modal[hidden] { display: none; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
}

.modal-sheet.premium {
  position: relative;
  z-index: 1;
  width: min(520px, 100%);
  max-height: 92vh;
  background: var(--surface);
  border-radius: 24px 24px 0 0;
  padding: 0 0 calc(1rem + var(--safe-bottom));
  overflow-y: auto;
  animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }

.modal-sheet.premium .modal-close {
  position: absolute;
  top: 0.85rem;
  right: 0.85rem;
  z-index: 5;
  background: rgba(0,0,0,0.55);
  color: #fff;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  font-size: 1rem;
  cursor: pointer;
}

.modal-sheet.premium .ex-modal-media {
  position: relative;
  width: 100%;
  aspect-ratio: 4/3;
  background: var(--surface-2);
  border-radius: 24px 24px 0 0;
  overflow: hidden;
}
.modal-sheet.premium .ex-modal-media img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: #fff;
}

.ex-modal-skeleton {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(255,255,255,0.03), rgba(255,255,255,0.08), rgba(255,255,255,0.03));
  background-size: 200% 100%;
  animation: skel 1.4s linear infinite;
}
@keyframes skel { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

.ex-modal-body { padding: 1.25rem 1.3rem 0; }

#ex-modal-muscle {
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.ex-modal-title {
  margin: 0.3rem 0 1rem;
  font-size: 1.7rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.ex-modal-desc {
  white-space: normal;
  line-height: 1.55;
  font-size: 0.92rem;
  color: var(--text-secondary);
  margin: 0 0 1rem;
}
.ex-modal-desc p { margin: 0 0 0.5rem; color: var(--text); }
.ex-modal-desc h4 {
  color: var(--muted);
  font-size: 0.65rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin: 1rem 0 0.4rem;
  font-weight: 700;
}
.ex-modal-desc h4:first-child { margin-top: 0; }
.ex-modal-desc ul { margin: 0 0 0.5rem; padding-left: 0; list-style: none; }
.ex-modal-desc li {
  position: relative;
  padding-left: 1.1rem;
  margin-bottom: 0.35rem;
  color: var(--text);
  font-size: 0.9rem;
}
.ex-modal-desc li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.7rem;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--text);
}

.modal-sheet.premium .modal-actions {
  display: flex;
  gap: 0.5rem;
  margin: 0.5rem 0 0.75rem;
}
.modal-sheet.premium .modal-actions .btn.primary,
.modal-sheet.premium .modal-actions .btn.secondary {
  flex: 1;
  padding: 0.75rem 0.85rem;
}

.modal-sheet.premium .ex-modal-source {
  margin: 0;
  font-size: 0.68rem;
  color: var(--muted);
}

/* ========== AI COACH ========== */
.ai-coach-text {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--text);
  white-space: pre-wrap;
}

/* ========== HINTS ========== */
.hint { margin: 0.5rem 0 0; font-size: 0.82rem; color: var(--muted); }
.hint.ok { color: var(--success); }
.hint.err { color: var(--danger); }

/* ========== STRUCTURED PREVIEW ========== */
.structured-preview .ex-line {
  font-size: 0.85rem;
  color: var(--text-secondary);
  padding: 0.15rem 0;
}
.prev-note {
  margin-top: 0.4rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* ========== UTILS ========== */
hr, .divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1rem 0;
}
