:root {
  /* Shell */
  --bg: #111417;
  --bg-grad-top: #1c2229;
  --panel: #1a1f26;
  /* Foreground */
  --text: #e8edf2;
  --muted: #8a9bb0;
  /* Accent */
  --accent: #0e9ab8;
  --accent-light: #0a7a9a;
  --accent-text: #001a20;
  /* Secondary */
  --pink: #0e9ab8;
  /* Semantic */
  --green: #2fb36d;
  --amber: #f5a623;
  --red: #e95353;
  /* Borders */
  --line: rgba(10, 122, 154, .20);
  --border-strong: rgba(10, 122, 154, .42);
  /* Accent states */
  --accent-dim: #0a7a9a;
  --accent-glow: rgba(14,154,184,0.38);
  /* Surface overlays */
  --tabs-bg: rgba(17, 20, 23, .82);
  --sticky-bg: rgba(17, 20, 23, .92);
  /* Chips */
  --chip-bg: rgba(10, 122, 154, .14);
  --chip-border: rgba(14, 154, 184, .30);
  --chip-text: #b0e4f0;
}

[data-theme="bloom"] {
  --bg: #1e0d18;
  --bg-grad-top: #320f28;
  --panel: #2e1525;
  --text: #faf0f5;
  --muted: #d4a8c7;
  --accent: #e8728a;
  --accent-light: #ffb3c6;
  --accent-text: #2a0a12;
  --pink: #c96eb5;
  --line: rgba(255, 200, 220, .18);
  --border-strong: rgba(232, 114, 138, .40);
  --accent-dim: #d15c7a;
  --accent-glow: rgba(232,114,138,0.38);
  --tabs-bg: rgba(30, 13, 24, .78);
  --sticky-bg: rgba(30, 13, 24, .88);
  --chip-bg: rgba(232, 114, 138, .18);
  --chip-border: rgba(232, 114, 138, .42);
  --chip-text: #ffe0e8;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: linear-gradient(180deg, var(--bg-grad-top), var(--bg) 45%, var(--bg));
  color: var(--text);
  font-family: 'Outfit', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

body {
  padding: max(10px, env(safe-area-inset-top)) 10px max(90px, env(safe-area-inset-bottom));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

button, input, select, textarea {
  font: inherit;
}

button {
  touch-action: manipulation;
}

#app {
  max-width: 760px;
  margin: 0 auto;
}

/* ─── Hero ─────────────────────────────────────────────── */

.hero {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 4px 10px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .12em;
  font-weight: 900;
}

h1 {
  margin: 0;
  font-size: clamp(26px, 7vw, 40px);
  line-height: 1;
}

.sub {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.35;
}

/* ─── Pills / Small ─────────────────────────────────────── */

.pill, .small {
  white-space: nowrap;
  background: rgba(255, 255, 255, .09);
  border: 1px solid var(--line);
  color: var(--muted);
  border-radius: 999px;
  padding: 7px 9px;
  font-size: 12px;
  font-weight: 800;
}

/* ─── Tabs ──────────────────────────────────────────────── */

.tabs {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 7px;
  padding: 8px 0;
  backdrop-filter: blur(14px);
  background: var(--tabs-bg);
}

/* ─── Buttons ───────────────────────────────────────────── */

.tab, .toggle, .secondary, .ghost, .tiny {
  border: 1px solid var(--line);
  color: var(--text);
  background: rgba(255, 255, 255, .08);
  border-radius: 13px;
  padding: 10px 8px;
  min-height: 44px;
  font-weight: 900;
}

.tab.active, .toggle.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  color: var(--accent-text);
  border-color: transparent;
}
.tab:hover:not(.active) {
  border-color: var(--border-strong);
  background: rgba(255, 255, 255, .12);
}
.ghost:hover, .secondary:hover {
  border-color: var(--border-strong);
  background: rgba(255, 255, 255, .12);
}

.toggle.green.active {
  background: linear-gradient(135deg, #2fb36d, #95f0bd);
  color: #06180d;
}

.toggle.amber.active {
  background: linear-gradient(135deg, #f2b84b, #ffe199);
  color: #241004;
}

.toggle.red.active {
  background: linear-gradient(135deg, #e95353, #ffa6a6);
  color: #260404;
}

/* ─── Cards ─────────────────────────────────────────────── */

.card {
  background: linear-gradient(180deg, rgba(255, 255, 255, .08), rgba(255, 255, 255, .045));
  border: 1px solid var(--border-strong);
  border-radius: 24px;
  padding: 16px;
  margin: 6px 0 16px;
}

.head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

h2 {
  margin: 0 0 8px;
  font-size: 26px;
}

h3 {
  margin: 16px 0 10px;
  font-size: 19px;
}

h4 {
  margin: 0 0 5px;
  color: var(--accent);
}

label {
  display: block;
  color: var(--muted);
  font-weight: 800;
  font-size: 13px;
}

.field-hint {
  display: block;
  font-size: 11px;
  font-weight: 400;
  color: var(--muted);
  opacity: 0.7;
  margin-top: 4px;
}

/* ─── Inputs ─────────────────────────────────────────────── */

.select, input, textarea {
  width: 100%;
  border: 1px solid var(--border-strong);
  background: rgba(0, 0, 0, .22);
  color: var(--text);
  border-radius: 15px;
  padding: 13px;
  outline: none;
  margin-top: 6px;
}

button:disabled {
  opacity: .38;
  cursor: not-allowed;
}

select option {
  color: #111;
}

/* ─── Alert / Info Boxes ────────────────────────────────── */

.safety, .tread, .note, .hint {
  border-radius: 17px;
  padding: 12px;
  margin: 10px 0;
  line-height: 1.4;
  color: var(--text);
  border: 1px solid var(--line);
}

.hint {
  background: rgba(255, 255, 255, .055);
  color: var(--muted);
}

.green {
  background: rgba(47, 179, 109, .18);
  border-color: rgba(47, 179, 109, .45);
}

.amber, .tread {
  background: rgba(242, 184, 75, .16);
  border-color: rgba(242, 184, 75, .45);
}

.red {
  background: rgba(233, 83, 83, .16);
  border-color: rgba(233, 83, 83, .45);
}

/* ─── Readiness ──────────────────────────────────────────── */

.readiness {
  margin-top: 12px;
}

.readiness-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

/* ─── Progress ───────────────────────────────────────────── */

.progress-wrap {
  margin: 10px 0 13px;
  padding: 11px;
  border-radius: 17px;
  background: rgba(255, 255, 255, .055);
  border: 1px solid var(--line);
}

.progress-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
}

.bar {
  height: 10px;
  border-radius: 999px;
  margin-top: 8px;
  background: rgba(255, 255, 255, .12);
  overflow: hidden;
}

.bar i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--pink));
}

/* ─── List / Mini / Log / Set Row ───────────────────────── */

.list {
  display: grid;
  gap: 9px;
}

.mini, .log, .set-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px;
  border-radius: 15px;
  background: rgba(255, 255, 255, .06);
  border: 1px solid var(--line);
}

.mini span, .log span, .set-row span {
  color: var(--muted);
  font-size: 13px;
  display: block;
}

/* ─── Primary Button ─────────────────────────────────────── */

.primary {
  width: 100%;
  border: 0;
  border-radius: 17px;
  padding: 15px 16px;
  margin-top: 14px;
  background: var(--accent);
  color: var(--accent-text);
  font-size: 16px;
  font-weight: 950;
  transition: background 150ms ease;
}
.primary:hover {
  background: var(--accent-dim);
}
.primary:disabled {
  opacity: .4;
  cursor: not-allowed;
}

/* ─── Chips ──────────────────────────────────────────────── */

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 6px 0 10px;
}

.chips span {
  padding: 6px 9px;
  border-radius: 999px;
  background: var(--chip-bg);
  border: 1px solid var(--chip-border);
  color: var(--chip-text);
  font-size: 12px;
  font-weight: 800;
}

/* ─── Grid Layouts ───────────────────────────────────────── */

.toggle-row, .inputs, .nav-row, .button-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  margin-top: 10px;
}

/* ─── Visual / Media ─────────────────────────────────────── */

.visual {
  min-height: 190px;
  border: 1px solid var(--line);
  border-radius: 20px;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 50% 18%, rgba(242, 184, 75, .18), rgba(255, 255, 255, .04) 42%, rgba(0, 0, 0, .22));
}

.visual img {
  display: block;
  width: 100%;
  max-height: 290px;
  object-fit: contain;
}

.placeholder {
  text-align: center;
  padding: 22px 16px;
  color: var(--muted);
}

/* ─── Avatar ─────────────────────────────────────────────── */

.avatar {
  width: 78px;
  height: 78px;
  margin: 0 auto 10px;
  border-radius: 24px;
  display: grid;
  place-items: center;
  color: var(--accent-text);
  background: linear-gradient(135deg, var(--accent), var(--pink));
  font-size: 26px;
  font-weight: 950;
}

/* ─── Coach ──────────────────────────────────────────────── */

.coach {
  display: grid;
  gap: 9px;
  margin-top: 11px;
}

.coach details, .summary-card, .cue-grid div {
  background: rgba(255, 255, 255, .055);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 11px;
}

.coach summary {
  cursor: pointer;
  color: var(--accent);
  font-weight: 950;
}

.coach p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.38;
}

.summary-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.38;
}

/* ─── Cue Grid ───────────────────────────────────────────── */

.cue-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.cue-grid b {
  display: block;
  color: var(--accent);
  margin-bottom: 4px;
}

.cue-grid span {
  display: block;
  color: var(--muted);
  line-height: 1.35;
}

.full-guide p {
  margin: 8px 0;
  color: var(--muted);
}

/* ─── Log Panel / Timer ──────────────────────────────────── */

.log-panel {
  margin-top: 11px;
  padding: 12px;
  border-radius: 20px;
  background: rgba(0, 0, 0, .18);
  border: 1px solid var(--line);
}

.log-panel h3 {
  margin: 0;
}

.timer {
  margin-top: 10px;
  padding: 11px;
  border-radius: 15px;
  background: rgba(47, 179, 109, .13);
  border: 1px solid rgba(47, 179, 109, .38);
  color: #dffff0;
  text-align: center;
  font-weight: 900;
}

/* ─── Sticky Actions ─────────────────────────────────────── */

.sticky-actions {
  position: sticky;
  bottom: 8px;
  z-index: 8;
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-top: 10px;
  padding: 9px;
  border-radius: 19px;
  background: var(--sticky-bg);
  border: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.sticky-actions .primary {
  margin-top: 0;
}

/* ─── Set History / Day Group ────────────────────────────── */

.set-history {
  margin-top: 12px;
  display: grid;
  gap: 8px;
}

.day-group {
  margin-top: 18px;
}

/* ─── Button Grid / Tiny / Secondary ────────────────────── */

.button-grid {
  grid-template-columns: 1fr;
}

.tiny {
  padding: 8px 10px;
  font-size: 12px;
  color: var(--text);
}

.del-btn {
  color: var(--red);
}

.secondary:disabled {
  opacity: .35;
}

.finish {
  margin-top: 11px;
}

/* ─── Stats ──────────────────────────────────────────────── */

.stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin: 12px 0;
}

.stats div, .hero-stat {
  text-align: center;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .06);
  border-radius: 18px;
  padding: 14px;
}

.stats b, .hero-stat b {
  display: block;
  font-size: 28px;
  color: var(--accent);
}

.stats span, .hero-stat span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.hero-stat {
  margin: 18px 0;
}

.hero-stat b {
  font-size: 54px;
}

/* ─── Responsive — Wide ──────────────────────────────────── */

@media (min-width: 720px) {
  .coach {
    grid-template-columns: 1fr;
  }

  .cue-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .button-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .readiness-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .sticky-actions {
    grid-template-columns: 2fr 1fr;
  }
}

/* ─── Responsive — Mobile ────────────────────────────────── */

@media (max-width: 430px) {
  .hero {
    display: block;
  }

  .pill {
    display: inline-block;
    margin-top: 10px;
  }

  .card {
    padding: 12px;
    border-radius: 21px;
  }

  .compact-gym h2 {
    font-size: 23px;
  }

  .mini, .log, .set-row {
    display: grid;
    grid-template-columns: 1fr;
    align-items: start;
  }

  .nav-row, .toggle-row {
    grid-template-columns: 1fr;
  }

  .compact-toggle {
    grid-template-columns: 1fr 1fr;
  }

  .inputs {
    grid-template-columns: 1fr 1fr;
  }

  .stats {
    grid-template-columns: 1fr;
  }

  .progress-head {
    display: block;
  }

  .tabs {
    gap: 6px;
  }

  .tab {
    font-size: 12px;
    padding: 10px 6px;
  }

  .visual {
    min-height: 155px;
  }

  .summary-card p {
    font-size: 13px;
  }

  .cue-grid span {
    font-size: 13px;
  }

  .log-panel .head {
    display: grid;
    grid-template-columns: 1fr;
  }

  .sticky-actions {
    grid-template-columns: 1fr 1fr;
  }

  .sticky-actions button {
    font-size: 13px;
    padding: 12px 8px;
  }
}

/* ─── v1.3.2 One-Screen Gym Overrides ───────────────────── */

.hero {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: start;
  padding-top: 10px;
  padding-bottom: 8px;
}

.hero .ghost {
  min-width: 42px;
}

.compact-gym .cue-grid {
  display: none;
}

.compact-gym .visual {
  min-height: 145px;
}

.compact-gym .coach {
  margin-top: 8px;
  gap: 7px;
}

.compact-gym .summary-card,
.compact-gym .full-guide {
  padding: 10px;
}

.compact-gym .summary-card p {
  font-size: 13px;
  line-height: 1.32;
}

.compact-gym .log-panel {
  margin-top: 8px;
  padding: 10px;
}

.compact-gym .progress-wrap {
  margin: 7px 0 9px;
  padding: 9px;
}

.compact-gym h2 {
  font-size: 22px;
  margin-bottom: 5px;
}

.compact-gym .chips {
  margin: 4px 0 7px;
}

.compact-gym .toggle-row {
  margin-top: 7px;
}

.compact-gym .timer {
  padding: 9px;
  margin-top: 8px;
}

.compact-gym .set-history {
  margin-top: 9px;
}

.compact-gym .nav-row {
  margin-top: 8px;
}

.compact-gym .finish {
  margin-top: 8px;
}

@media (max-width: 430px) {
  .hero {
    display: grid;
    grid-template-columns: 1fr auto;
  }

  .hero .pill {
    margin-top: 0;
  }

  .compact-gym .visual {
    min-height: 132px;
  }

  .compact-gym .summary-card p {
    font-size: 12.5px;
  }

  .compact-gym .full-guide p {
    font-size: 13px;
  }

  .compact-gym .inputs {
    gap: 7px;
  }

  .compact-gym .primary {
    padding: 12px 10px;
  }

  .compact-gym .secondary {
    padding: 12px 8px;
  }
}

/* ─── v1.8 WorkoutX Visuals ──────────────────────────────── */

.workoutx-visual {
  min-height: 280px;
  padding: 0;
  background: rgba(0, 0, 0, .18);
}

.workoutx-card {
  width: 100%;
  display: grid;
  gap: 0;
  background: #fff;
  color: #241004;
}

.workoutx-gif {
  width: 100%;
  max-height: 310px;
  object-fit: contain;
  background: var(--bg);
  mix-blend-mode: multiply;
}

.workoutx-info {
  padding: 12px;
  background: var(--panel);
  color: var(--text);
  border-top: 1px solid var(--line);
}

.workoutx-info h4 {
  font-size: 18px;
  margin: 0;
  color: var(--accent);
}

.workoutx-info p,
.workoutx-info li {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.workoutx-info ol {
  margin: 8px 0 0;
  padding-left: 20px;
}

.workoutx-info .chips {
  margin: 6px 0;
}

.text-only-media {
  min-height: 180px;
  display: grid;
  place-items: center;
}

.media-error-note {
  display: none;
}

.media-error .media-error-note {
  display: block;
  color: #ffd5d5;
}

.compact-gym .workoutx-visual {
  min-height: 240px;
}

@media (max-width: 430px) {
  .workoutx-visual {
    min-height: 230px;
  }

  .workoutx-gif {
    max-height: 240px;
  }

  .workoutx-info {
    padding: 10px;
  }

  .workoutx-info li {
    font-size: 12.5px;
  }
}

/* ─── feat/today-compact Additions ──────────────────────── */

.compact-hero h1 {
  font-size: clamp(20px, 5vw, 28px);
  line-height: 1.1;
}

.compact-hero .sub {
  display: none;
}

.compact-hero .eyebrow {
  font-size: 10px;
  margin-bottom: 2px;
}

.compact-hero {
  padding-top: 8px;
  padding-bottom: 6px;
}

.today-card {
  padding: 14px;
}

.day-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.day-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
  min-width: 0;
}

.day-badge {
  font-size: 14px;
  font-weight: 900;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: .06em;
}

.day-title {
  font-size: 15px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.25;
  word-break: break-word;
}

.change-btn {
  flex-shrink: 0;
  font-size: 12px;
  padding: 5px 9px;
  white-space: nowrap;
}

.compact-progress {
  margin: 8px 0 10px;
  padding: 9px 11px;
}

.compact-progress .progress-head {
  font-size: 12px;
}

.compact-progress .bar {
  margin-top: 6px;
  height: 8px;
}

.readiness {
  margin-top: 8px;
}

.readiness-desc {
  margin: 6px 0 0;
  padding: 7px 10px;
  border-radius: 13px;
  font-size: 13px;
  line-height: 1.35;
  border: 1px solid var(--line);
}

.readiness-desc.green {
  background: rgba(47, 179, 109, .14);
  border-color: rgba(47, 179, 109, .4);
}

.readiness-desc.amber {
  background: rgba(242, 184, 75, .14);
  border-color: rgba(242, 184, 75, .4);
}

.readiness-desc.red {
  background: rgba(233, 83, 83, .14);
  border-color: rgba(233, 83, 83, .4);
}

.exercise-preview {
  margin: 10px 0 0;
}

.exercise-preview-toggle {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 900;
  color: var(--muted);
  padding: 8px 0;
  user-select: none;
}

.exercise-preview-toggle::marker,
.exercise-preview > summary::marker {
  display: none;
  content: '';
}

.exercise-preview > summary {
  cursor: pointer;
  list-style: none;
  font-size: 13px;
  font-weight: 900;
  color: var(--muted);
  padding: 8px 0;
}

.exercise-preview > summary::before {
  content: '\25B6 ';
  font-size: 11px;
  transition: transform .15s;
}

.exercise-preview[open] > summary::before {
  content: '\25BC ';
}

.today-card .primary {
  margin-top: 14px;
}

@media (max-width: 430px) {
  .compact-hero h1 {
    font-size: 22px;
  }

  .day-title {
    font-size: 14px;
  }

  .readiness-desc {
    font-size: 12.5px;
  }
}


/* ============================================================ */
/* PR DETECTION + ENRICHED SUMMARY STYLES */
/* ============================================================ */
.pr-block {
  background: rgba(242, 43, 132, 0.12);
  border: 1px solid rgba(242, 43, 132, 0.35);
  border-radius: 12px;
  padding: 12px 16px;
  margin: 12px 0;
}

.pr-block b {
  display: block;
  color: var(--pink);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
}

.pr-badge {
  display: inline-block;
  background: rgba(242, 43, 132, 0.18);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 600;
  border-radius: 20px;
  padding: 4px 10px;
  margin: 3px 4px 3px 0;
}

.finish-msg {
  font-size: 0.88rem;
  color: var(--muted);
  font-style: italic;
  text-align: center;
  margin: 16px 0 8px;
  line-height: 1.5;
}

/* --- Auto-progression nudge --- */
.progression-nudge {
  margin: 6px 0 2px;
  padding: 6px 10px;
  background: rgba(255, 200, 80, 0.12);
  border-left: 3px solid #f5c842;
  border-radius: 6px;
  font-size: 0.82rem;
  color: #e0c96e;
  line-height: 1.4;
}
.progression-nudge b {
  color: #f5c842;
}

/* GIF preview in gym card */
.gif-preview {
  margin: 0 0 12px 0;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  overflow: hidden;
  background: rgba(255,255,255,0.03);
}
.gif-preview summary {
  padding: 10px 14px;
  font-size: 0.85rem;
  color: #aaa;
  cursor: pointer;
  user-select: none;
  list-style: none;
}
.gif-preview summary::-webkit-details-marker { display: none; }
.gif-preview[open] summary {
  border-bottom: 1px solid rgba(255,255,255,0.06);
  color: #ddd;
}
.exercise-gif {
  display: block;
  width: 100%;
  max-height: 280px;
  object-fit: contain;
  background: var(--bg);
  mix-blend-mode: multiply;
}
.gif-empty {
  padding: 12px 14px;
  font-size: 0.8rem;
  color: #666;
  margin: 0;
}

/* ─── Log Calendar View ──────────────────────────────── */
.log-view-toggle {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
}
.log-view-toggle .toggle {
  flex: 1;
  text-align: center;
}
.cal-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.cal-title {
  font-size: 15px;
  font-weight: 700;
}
.cal-summary {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 14px;
}
.cal-dow-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
  margin-bottom: 5px;
}
.cal-dow {
  text-align: center;
  font-size: 11px;
  color: var(--muted);
  font-weight: 700;
}
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.cal-cell {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 500;
  border-radius: 8px;
  border: none;
  background: rgba(255,255,255,0.05);
  color: var(--text);
  cursor: pointer;
  padding: 0;
  min-height: 36px;
  transition: background 0.15s;
}
.cal-cell.cal-empty {
  background: transparent;
  pointer-events: none;
}
.cal-cell.cal-trained {
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 700;
}
.cal-cell.cal-today:not(.cal-trained) {
  border: 2px solid var(--accent);
  color: var(--accent);
}
.week-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 5px;
}
.week-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 10px 0 8px;
  border-radius: 10px;
  border: none;
  background: rgba(255,255,255,0.05);
  color: var(--text);
  cursor: pointer;
  min-height: 72px;
  justify-content: center;
  transition: background 0.15s;
}
.week-cell.cal-trained {
  background: var(--accent);
  color: var(--accent-text);
}
.week-cell.cal-today:not(.cal-trained) {
  border: 2px solid var(--accent);
  color: var(--accent);
}
.week-cell-day {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  opacity: 0.7;
}
.week-cell-num {
  font-size: 18px;
  font-weight: 800;
}
.week-cell-sets {
  font-size: 10px;
  font-weight: 600;
  opacity: 0.85;
}

/* Weekly momentum chip */
.momentum-chip {
  display: inline-block;
  padding: 4px 12px;
  margin: 8px 0 2px;
  border-radius: 20px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--muted);
  background: rgba(255,255,255,0.06);
  letter-spacing: 0.01em;
}

/* ── Exercise notes (C2) ── */
.exercise-note {
  margin: 8px 0 4px;
  border-radius: 8px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  overflow: hidden;
}
.exercise-note summary {
  padding: 8px 12px;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--accent, #f5c842);
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
  user-select: none;
}
.exercise-note summary::-webkit-details-marker { display: none; }
.exercise-note summary #ex-note-text-placeholder {
  color: #ccc;
  font-style: normal;
  font-size: 0.85rem;
  white-space: pre-wrap;
  word-break: break-word;
}
.note-body {
  padding: 8px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.note-body textarea {
  width: 100%;
  box-sizing: border-box;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 6px;
  color: #fff;
  padding: 8px;
  font-size: 0.9rem;
  resize: vertical;
  font-family: inherit;
}
.note-body textarea::placeholder { color: rgba(255,255,255,0.35); }
.note-body button { align-self: flex-start; }

/* ── Readiness simplified (B3) ── */
.readiness-label {
  font-size: 0.875rem;
  color: var(--muted);
  margin: 8px 0 6px;
  font-weight: 700;
}
.readiness .readiness-grid {
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
}

/* ── Inline weight log panel (B4) ── */
.weight-log-panel {
  margin: 4px 0 12px;
  border-radius: 8px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  overflow: hidden;
}
.weight-log-panel summary {
  padding: 8px 12px;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--accent, #f5c842);
  list-style: none;
  user-select: none;
}
.weight-log-panel summary::-webkit-details-marker { display: none; }
.weight-log-panel .note-body {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  padding: 8px 12px 12px;
}
.weight-log-panel .note-body input {
  flex: 1;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 6px;
  color: #fff;
  padding: 8px;
  font-size: 0.95rem;
  font-family: inherit;
}


/* ── F12: Focus visible styles (accessibility) ── */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ── F03: Edit note button — min touch target 44x44px ── */
.edit-note-btn {
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}


/* ── Supplement tracker (C5) ── */
.supp-divider {
  border: none;
  border-top: 1px solid var(--line);
  margin: 20px 0 16px;
}

.supp-heading {
  font-size: 1rem;
  font-weight: 900;
  margin: 0 0 12px;
  color: var(--text);
}

.supp-add-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.supp-input {
  flex: 1;
  min-width: 140px;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 10px;
  color: var(--text);
  padding: 10px 12px;
  font-size: 0.9rem;
  font-family: inherit;
}

.supp-input::placeholder {
  color: rgba(255,255,255,0.35);
}

.supp-select {
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 10px;
  color: var(--text);
  padding: 10px 12px;
  font-size: 0.9rem;
  font-family: inherit;
  min-height: 44px;
}

.supp-add-btn {
  min-height: 44px;
  white-space: nowrap;
}

.supp-empty {
  color: var(--muted);
  font-size: 0.875rem;
  padding: 8px 0;
  margin: 0;
}

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

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

.supp-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.09);
  margin-bottom: 6px;
  transition: background 200ms ease;
}

.supp-row.supp-taken {
  background: rgba(47,179,109,0.12);
  border-color: rgba(47,179,109,0.3);
}

.supp-check {
  width: 32px;
  height: 32px;
  min-width: 32px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.25);
  background: transparent;
  color: var(--green);
  font-size: 1rem;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: border-color 200ms ease, background 200ms ease;
}

.supp-taken .supp-check {
  border-color: var(--green);
  background: rgba(47,179,109,0.2);
}

.supp-name-label {
  flex: 1;
  font-size: 0.9rem;
  color: var(--text);
}

.supp-taken .supp-name-label {
  color: var(--muted);
  text-decoration: line-through;
}

.supp-delete {
  min-width: 32px;
  min-height: 32px;
  padding: 0;
  font-size: 0.8rem;
  border-radius: 8px;
  opacity: 0.5;
}

.supp-delete:hover {
  opacity: 1;
}


/* ── Exercise history / per-exercise charts (C6) ── */
.ex-hist-item {
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: rgba(255,255,255,0.04);
  margin-bottom: 8px;
  overflow: hidden;
}

.ex-hist-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  cursor: pointer;
  list-style: none;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text);
  user-select: none;
}

.ex-hist-summary::-webkit-details-marker { display: none; }

.ex-hist-count {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  background: rgba(255,255,255,0.07);
  border-radius: 20px;
  padding: 2px 9px;
}

.ex-hist-body {
  padding: 4px 14px 14px;
  border-top: 1px solid var(--line);
}

.ex-hist-stats {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-bottom: 4px;
  padding-top: 10px;
}

.ex-hist-stats div {
  text-align: center;
  background: rgba(255,255,255,0.05);
  border-radius: 10px;
  padding: 8px 6px;
}

.ex-hist-stats b {
  display: block;
  font-size: 1rem;
  color: var(--accent);
  font-weight: 900;
}

.ex-hist-stats span {
  font-size: 0.72rem;
  color: var(--muted);
  display: block;
  margin-top: 2px;
}

.ex-hist-recent {
  margin-top: 8px;
  display: grid;
  gap: 5px;
}

.ex-hist-set {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  padding: 5px 8px;
  background: rgba(255,255,255,0.04);
  border-radius: 7px;
  color: var(--text);
}

.ex-hist-date {
  color: var(--muted);
  font-size: 0.78rem;
}

/* ====================================================
   C7 — Body Measurements
   ==================================================== */
.meas-list {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.meas-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  background: rgba(255,255,255,.06);
  border-radius: 8px;
  font-size: 13px;
}
.meas-date {
  font-size: 11px;
  color: var(--muted);
  min-width: 80px;
  flex-shrink: 0;
}

/* C8 Progress Photos */
.photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 8px; }
.photo-thumb { position: relative; border-radius: 8px; overflow: hidden; background: rgba(255,255,255,0.06); }
.photo-thumb img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; cursor: pointer; }
.photo-date { font-size: 10px; color: var(--muted); text-align: center; padding: 4px 2px; }
.photo-del { position: absolute; top: 4px; right: 4px; background: rgba(0,0,0,0.6); border: none; color: #fff; border-radius: 50%; width: 36px; height: 36px; font-size: 16px; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.photo-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.92); display: flex; flex-direction: column; align-items: center; justify-content: center; z-index: 9999; }
.photo-overlay img { max-width: 90vw; max-height: 75vh; border-radius: 8px; object-fit: contain; }
.photo-overlay-date { color: var(--muted); font-size: 13px; margin-top: 12px; }
.photo-overlay-close { margin-top: 16px; background: rgba(255,255,255,0.12); border: none; color: #fff; border-radius: 50%; width: 40px; height: 40px; font-size: 18px; cursor: pointer; }

/* ─── Theme Switcher ─────────────────────────────────────── */
.theme-btn {
  border: 2px solid var(--line);
  background: rgba(255, 255, 255, .06);
  color: var(--text);
  border-radius: 13px;
  padding: 12px;
  min-height: 44px;
  font-weight: 900;
  font-size: 14px;
  transition: border-color 150ms ease, background 150ms ease;
}
.theme-btn.theme-active {
  border-color: var(--accent);
  background: rgba(255, 255, 255, .11);
  color: var(--accent);
}

/* Downloads / Backup panel */
.dl-panel { margin-top: 4px; }
.dl-summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0 6px;
  color: var(--accent);
  font-weight: 700;
  font-size: 15px;
  user-select: none;
}
.dl-summary::-webkit-details-marker { display: none; }
details[open] .dl-summary svg { transform: rotate(180deg); }

/* C9: Check-In response layer */
.ci-confirm { margin-top: 1rem; padding: 1rem; background: rgba(255,255,255,0.06); border-radius: 10px; border-left: 3px solid var(--pink); }
.ci-saved-icon { font-size: 1.5rem; color: var(--pink); font-weight: bold; margin-bottom: 0.25rem; }
.ci-saved-label { font-size: 0.95rem; font-weight: 600; color: var(--text); margin-bottom: 0.5rem; }
.ci-summary { font-size: 0.85rem; color: var(--muted); margin-bottom: 0.2rem; }
.ci-note-preview { font-size: 0.82rem; color: var(--muted); font-style: italic; margin-top: 0.4rem; padding: 0.4rem 0.6rem; background: rgba(255,255,255,0.04); border-radius: 6px; }
.ci-today-strip { display: flex; align-items: center; justify-content: space-between; margin: 6px 0 2px; padding: 7px 10px; background: rgba(255,255,255,.05); border-radius: 8px; border-left: 2px solid var(--accent); }
.ci-today-vals { font-size: 0.8rem; color: var(--muted); }
.ci-today-edit { font-size: 0.75rem; padding: 2px 8px; min-height: unset; opacity: 0.7; }
.ci-banner { background: rgba(255,255,255,.06); border-radius: 10px; border-left: 3px solid var(--accent); padding: 14px 16px; cursor: pointer; transition: background .15s; }
.ci-banner:hover, .ci-banner:active { background: rgba(255,255,255,.10); }
.ci-banner-check { font-size: 0.9rem; font-weight: 700; color: var(--accent); margin-bottom: 8px; }
.ci-banner-values { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-bottom: 4px; }
.ci-bv { font-size: 0.85rem; color: var(--text); }
.ci-banner-note { font-size: 0.82rem; color: var(--muted); font-style: italic; margin-top: 6px; }
.ci-banner-edit { font-size: 0.75rem; color: var(--muted); margin-top: 10px; opacity: 0.55; letter-spacing: .02em; }
.ci-field-row { display: flex; align-items: center; justify-content: space-between; padding: 7px 0; border-bottom: 1px solid var(--line); }
.ci-field-row:last-child { border-bottom: none; }
.ci-field-name { font-size: 0.9rem; color: var(--text); }
.ci-add-form { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; padding: 12px; background: rgba(255,255,255,.04); border-radius: 8px; }


/* --- C4-A: Extra focus decision sheet --- */
.ef-sheet {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.72);
  display: flex; align-items: flex-end; justify-content: center;
}
.ef-sheet-inner {
  background: var(--bg, #111);
  border-top: 2px solid var(--pink, #e05c97);
  border-radius: 14px 14px 0 0;
  padding: 1.6rem 1.4rem 2rem;
  width: 100%; max-width: 480px;
  display: flex; flex-direction: column; gap: 0.8rem;
}
.ef-sheet-title {
  font-size: 1.1rem; font-weight: 600;
  color: var(--text, #f0f0f0);
  margin: 0 0 0.4rem; text-align: center;
}
.ef-focus-btn {
  border-color: var(--pink, #e05c97);
  color: var(--pink, #e05c97);
}


/* --- C4-B: Focus selection UI --- */
.ef-focus-inner {
  max-height: 80vh; overflow-y: auto;
}
.ef-sub {
  font-size: 0.8rem; color: var(--muted, #d9c7df);
  margin: 0.2rem 0 0.4rem; text-align: center;
}
.ef-suggestions {
  display: flex; flex-direction: column; gap: 0.5rem;
}
.ef-suggest-btn {
  background: rgba(255,255,255,0.06);
  border: 1.5px solid var(--pink, #e05c97);
  border-radius: 10px;
  color: var(--text, #f0f0f0);
  padding: 0.65rem 1rem;
  font-size: 0.95rem; font-weight: 600;
  cursor: pointer; text-align: left;
  display: flex; align-items: center; justify-content: space-between;
  min-height: 44px; width: 100%;
  transition: background 150ms ease;
}
.ef-suggest-btn:hover {
  background: rgba(224,92,151,0.15);
}
.ef-count {
  font-size: 0.75rem; color: var(--muted, #d9c7df);
  font-weight: 400; margin-left: 0.5rem;
}
.ef-dropdown {
  width: 100%; padding: 0.6rem 0.8rem;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 8px;
  color: var(--text, #f0f0f0);
  font-size: 0.9rem; min-height: 44px;
  appearance: none;
}
.ef-next-btn { margin-top: 0.2rem; }
.ef-cancel-btn { margin-top: 0.2rem; }


/* --- C4-C: Result card --- */
.ef-result-card {
  background: rgba(255,255,255,0.05);
  border: 1.5px solid var(--pink, #e05c97);
  border-radius: 10px;
  padding: 1rem 1.1rem;
  margin-bottom: 0.6rem;
}
.ef-result-label {
  font-size: 0.72rem; font-weight: 700;
  color: var(--pink, #e05c97);
  text-transform: uppercase; letter-spacing: 0.06em;
  display: block; margin-bottom: 0.3rem;
}
.ef-result-name {
  font-size: 1.05rem; font-weight: 700;
  color: var(--text, #f0f0f0);
  margin: 0 0 0.3rem;
}
.ef-result-why {
  font-size: 0.82rem;
  color: var(--muted, #d9c7df);
  margin: 0 0 0.6rem;
}
.ef-backup-list {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-direction: column; gap: 0.3rem;
}
.ef-backup {
  font-size: 0.82rem; color: var(--muted, #d9c7df);
  display: flex; align-items: center; gap: 0.5rem;
}
.ef-backup-rank {
  font-size: 0.68rem; font-weight: 700;
  color: var(--pink, #e05c97);
  background: rgba(224,92,151,0.12);
  border-radius: 4px; padding: 0.1rem 0.35rem;
  white-space: nowrap;
}
.ef-start-btn { margin-top: 0.4rem; }

/* ─── Set logger redesign (Phase 1) ─────────────────────── */

.gym-redesign .gym-sticky-header {
  position: sticky;
  top: 60px; /* sit just below the .tabs sticky bar */
  z-index: 9;
  background-color: rgba(17, 20, 23, 0.97);
  background-image: linear-gradient(180deg, rgba(28, 34, 41, 0.99), rgba(17, 20, 23, 0.97));
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  margin: -16px -16px 12px;
  padding: 12px 16px 10px;
  border-bottom: 1px solid var(--line);
  border-radius: 24px 24px 0 0;
}
@media (max-width: 430px) {
  .gym-redesign .gym-sticky-header {
    margin: -12px -12px 12px;
    padding: 12px 12px 10px;
    border-radius: 21px 21px 0 0;
  }
}
.gym-redesign .gym-sticky-header .head { margin-bottom: 6px; }
.gym-redesign .gym-ex-title {
  margin: 0 0 4px; font-size: 22px; line-height: 1.15;
}
.gym-redesign .gym-set-counter {
  font-size: 12px; color: var(--muted); font-weight: 700;
}
.gym-redesign .gym-next-peek {
  font-size: 11px; color: rgba(255,255,255,0.40);
  margin-top: 4px; font-weight: 600;
}

.set-rows {
  display: grid; gap: 10px; margin: 12px 0;
}

.set-row-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 56px;
  grid-template-rows: auto auto auto;
  gap: 8px 10px;
  padding: 12px;
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  background: rgba(255,255,255,0.05);
  align-items: center;
}
.set-row-card.committed {
  grid-template-columns: 60px 1fr 60px;
  grid-template-rows: auto;
  background: rgba(47,179,109,0.10);
  border-color: rgba(47,179,109,0.32);
}
.set-row-card.committed .set-row-num { font-weight: 800; color: var(--muted); }
.set-row-card.committed .set-row-vals {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.set-row-card.committed .set-row-done {
  color: #2fb36d; font-weight: 900; font-size: 18px;
}
.set-row-card.pending .set-row-head {
  grid-column: 1 / -1;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.set-row-card.pending .set-row-num {
  font-size: 13px; font-weight: 800; color: var(--muted); letter-spacing: .04em;
}
.set-same-as {
  font-size: 12px; font-weight: 700;
  background: var(--chip-bg);
  color: var(--chip-text);
  border: 1px solid var(--chip-border);
  border-radius: 999px;
  padding: 6px 12px;
  min-height: 32px;
  cursor: pointer;
}
.set-stepper {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto auto;
  gap: 6px;
  align-items: stretch;
  min-width: 0;
}
.set-stepper > .step-val { grid-column: 1 / -1; grid-row: 1; }
.set-stepper > .step-btn:nth-of-type(1) { grid-column: 1; grid-row: 2; }
.set-stepper > .step-btn:nth-of-type(2) { grid-column: 2; grid-row: 2; }
.set-stepper .step-btn {
  min-width: 0; min-height: 48px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.10);
  color: var(--text);
  font-size: 22px; font-weight: 900; line-height: 1;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}
.set-stepper .step-btn:active {
  background: rgba(255, 255, 255, 0.18);
  transform: scale(0.96);
}
.set-stepper .step-val {
  display: flex; flex-direction: column; align-items: stretch; justify-content: center;
  min-height: 48px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(0,0,0,0.22);
  cursor: pointer;
  padding: 4px 6px 3px;
  min-width: 0;
}
.set-stepper input {
  display: block;
  width: 100%; min-width: 0;
  margin: 0; padding: 0;
  background: transparent; border: 0;
  color: rgba(255,255,255,0.45);
  font-size: 28px; font-weight: 900; line-height: 1.05;
  text-align: center;
  outline: none;
  -moz-appearance: textfield;
}
.set-stepper input::-webkit-outer-spin-button,
.set-stepper input::-webkit-inner-spin-button {
  -webkit-appearance: none; margin: 0;
}
.set-row-card.touched .set-stepper input,
.set-stepper input:not(:placeholder-shown) {
  color: var(--text);
}
.set-stepper input::placeholder { color: rgba(255,255,255,0.40); }
.set-stepper .step-unit {
  display: block;
  font-size: 10px; color: var(--muted); font-weight: 700; letter-spacing: .06em;
  text-align: center; text-transform: uppercase;
  margin-top: 1px;
}
.set-commit {
  grid-column: 3;
  grid-row: 2 / span 2;
  min-width: 56px; min-height: 100%;
  border: 0; border-radius: 14px;
  background: var(--accent);
  color: var(--accent-text);
  font-size: 26px; font-weight: 900;
  cursor: pointer;
  touch-action: manipulation;
  transition: background 150ms ease;
}
.set-commit:hover {
  background: var(--accent-dim);
}
.set-commit:active { transform: scale(0.96); }
.set-row-edit { justify-self: end; }

@keyframes set-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(242,184,75,0.55); }
  60%  { box-shadow: 0 0 0 14px rgba(242,184,75,0); }
  100% { box-shadow: 0 0 0 0 rgba(242,184,75,0); }
}
.set-row-card.pulse {
  animation: set-pulse 1.4s ease-out 1;
  border-color: var(--accent);
}

@media (max-width: 380px) {
  .set-row-card.pending {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 52px;
  }
  .set-stepper .step-btn { min-height: 44px; font-size: 20px; }
  .set-stepper .step-val { min-height: 44px; }
}

/* ─── Program Position Editor ───────────────────────────── */

.program-pos-editor {
  margin: 8px 0 12px;
}

.program-pos-label {
  margin: 0 0 10px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
}

.week-stepper {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.stepper-center {
  flex: 1;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.stepper-val {
  font-size: 17px;
  font-weight: 900;
  color: var(--text);
}

.stepper-phase {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
}

.stepper-btn {
  min-width: 48px;
  min-height: 48px;
  font-size: 26px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  flex-shrink: 0;
}

.day-picker {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}

.day-picker .toggle {
  font-size: 13px;
  padding: 10px 4px;
}

/* ─── Tab entrance stagger ───────────────────────────────── */

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: no-preference) {
  .tab-enter > * {
    opacity: 0;
    animation: fadeUp 200ms ease-out forwards;
  }
  .tab-enter > *:nth-child(1) { animation-delay:  0ms; }
  .tab-enter > *:nth-child(2) { animation-delay: 50ms; }
  .tab-enter > *:nth-child(3) { animation-delay: 100ms; }
  .tab-enter > *:nth-child(4) { animation-delay: 150ms; }
  .tab-enter > *:nth-child(5) { animation-delay: 200ms; }
  .tab-enter > *:nth-child(6) { animation-delay: 250ms; }
  .tab-enter > *:nth-child(7) { animation-delay: 300ms; }
  .tab-enter > *:nth-child(8) { animation-delay: 350ms; }
}

/* ─── Chat ────────────────────────────────────────────────── */
@keyframes chat-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(14,154,184,0.55), 0 4px 16px rgba(0,0,0,0.5); }
  60%  { box-shadow: 0 0 0 10px rgba(14,154,184,0), 0 4px 16px rgba(0,0,0,0.5); }
  100% { box-shadow: 0 0 0 0 rgba(14,154,184,0), 0 4px 16px rgba(0,0,0,0.5); }
}
[data-theme="bloom"] .chat-fab { animation-name: chat-pulse-bloom; }
@keyframes chat-pulse-bloom {
  0%   { box-shadow: 0 0 0 0 rgba(232,114,138,0.55), 0 4px 16px rgba(0,0,0,0.5); }
  60%  { box-shadow: 0 0 0 10px rgba(232,114,138,0), 0 4px 16px rgba(0,0,0,0.5); }
  100% { box-shadow: 0 0 0 0 rgba(232,114,138,0), 0 4px 16px rgba(0,0,0,0.5); }
}
.chat-fab {
  position: fixed;
  bottom: 24px;
  right: 16px;
  height: 44px;
  border-radius: 22px;
  padding: 0 16px 0 12px;
  gap: 7px;
  background: var(--accent);
  border: none;
  cursor: pointer;
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 150ms ease-out;
  color: var(--accent-text);
  font-family: inherit;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
  animation: chat-pulse 2s ease-out infinite;
}
.chat-fab:active { transform: scale(0.96); }
.chat-fab-label { letter-spacing: 0.01em; }
#chat-root .chat-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 901;
}
#chat-root .chat-panel {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 75vh;
  background: var(--panel);
  border-radius: 16px 16px 0 0;
  z-index: 902;
  flex-direction: column;
  overflow: hidden;
}
#chat-root.chat-open .chat-backdrop { display: block; }
#chat-root.chat-open .chat-panel { display: flex; }
.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  flex-shrink: 0;
}
.chat-header-title { font-size: 15px; font-weight: 800; color: var(--text); }
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.chat-msg {
  max-width: 82%;
  font-size: 14px;
  line-height: 1.5;
  padding: 10px 13px;
  border-radius: 14px;
}
.chat-msg.user {
  align-self: flex-end;
  background: var(--accent);
  color: var(--accent-text);
  border-bottom-right-radius: 4px;
}
.chat-msg.coach {
  align-self: flex-start;
  background: rgba(255,255,255,0.07);
  color: var(--text);
  border-bottom-left-radius: 4px;
}
.chat-msg a { color: var(--accent); text-decoration: underline; word-break: break-all; }
.chat-msg.user a { color: var(--accent-text); opacity: 0.85; }
.chat-copy-btn { display: block; margin-top: 6px; margin-left: auto; background: none; border: none; color: var(--muted); cursor: pointer; font-size: 11px; padding: 2px 4px; opacity: 0.6; }
.chat-msg.user .chat-copy-btn { color: var(--accent-text); }
.chat-copy-btn:active { opacity: 1; }
.chat-msg.typing {
  align-self: flex-start;
  background: rgba(255,255,255,0.07);
  color: var(--muted);
  font-style: italic;
  font-size: 13px;
}
.chat-input-row {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid rgba(255,255,255,0.08);
  flex-shrink: 0;
  background: var(--panel);
}
.chat-input {
  flex: 1;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 22px;
  color: var(--text);
  font-size: 14px;
  padding: 9px 14px;
  outline: none;
  font-family: inherit;
  height: 40px;
}
.chat-input:focus { border-color: var(--accent); }
.chat-send {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--accent-text);
  font-size: 18px;
}
.chat-send:disabled { opacity: 0.4; cursor: not-allowed; }

/* ─── Session cards (D1) ────────────────────────────────── */
.session-card {
  background: rgba(255,255,255,.05);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 16px;
  margin-bottom: 10px;
}
.session-card--active {
  border-color: var(--accent);
  background: rgba(255,255,255,.08);
}
.session-card--legacy { opacity: 0.65; }
.session-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.session-card__date {
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.session-card__title {
  font-size: 16px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 6px;
}
.session-card__meta {
  font-size: 13px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.session-card__badge {
  font-size: 11px;
  font-weight: 800;
  padding: 3px 9px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.session-card__badge--done {
  background: rgba(74,222,128,.15);
  color: #4ade80;
}
.session-card__badge--active {
  background: rgba(var(--accent-rgb, 180,120,255),.2);
  color: var(--accent);
}
.session-card__badge--legacy {
  background: rgba(255,255,255,.08);
  color: var(--muted);
}
.session-card__pr {
  background: rgba(251,191,36,.15);
  color: #fbbf24;
  font-size: 11px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 999px;
}
.session-section-label {
  font-size: 11px;
  font-weight: 800;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 8px 0 6px;
}

/* ─── Routine cards (Settings) ─────────────────────────── */
.routine-card {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255,255,255,.04);
  border: 1px solid var(--line);
  margin-bottom: 8px;
}
.routine-card--active { border-color: var(--accent); background: rgba(255,255,255,.07); }
.routine-card__info { display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 0; }
.routine-card__name { font-size: 15px; font-weight: 800; color: var(--text); }
.routine-card__desc { font-size: 12px; color: var(--muted); line-height: 1.4; }
.routine-card__day { font-size: 11px; font-weight: 800; color: var(--accent); margin-top: 2px; }
.routine-card__btn  { flex-shrink: 0; padding: 7px 14px; font-size: 13px; align-self: center; }
.routine-card__actions { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex-shrink: 0; }
.routine-card__edit { font-size: 12px; opacity: 0.55; padding: 2px 6px; }
.routine-card__del  { font-size: 12px; opacity: 0.4;  padding: 2px 6px; color: var(--muted); }

/* ─── Routine builder ──────────────────────────────────── */
.rb-builder { padding-bottom: 8px; }
.rb-name-input {
  width: 100%; box-sizing: border-box;
  background: rgba(255,255,255,.07);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 14px;
  color: var(--text);
  font-size: 16px; font-weight: 700;
  margin-bottom: 4px;
}
.rb-name-input:focus { outline: none; border-color: var(--accent); }
.rb-day-tabs {
  display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px;
}
.rb-day-tab {
  flex: 1; min-width: 36px;
  padding: 8px 4px;
  border-radius: 10px;
  background: rgba(255,255,255,.05);
  border: 1px solid var(--line);
  color: var(--muted); font-size: 13px; font-weight: 700;
  cursor: pointer; position: relative;
  transition: background 150ms, border-color 150ms;
}
.rb-day-tab--active {
  background: var(--accent);
  border-color: var(--accent);
  color: #1a0510;
}
.rb-day-tab--rest { opacity: 0.45; }
.rb-day-tab--active.rb-day-tab--rest { opacity: 0.7; }
.rb-day-dot {
  position: absolute; top: 4px; right: 4px;
  width: 5px; height: 5px; border-radius: 50%;
  background: #1a0510;
}
.rb-day-tab:not(.rb-day-tab--active) .rb-day-dot { background: var(--accent); }
.rb-day-body { margin-top: 4px; }
.rb-rest-toggle {
  display: flex; gap: 6px; margin-bottom: 12px;
}
.rb-day-title-input {
  width: 100%; box-sizing: border-box;
  background: rgba(255,255,255,.06);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 9px 12px;
  color: var(--text); font-size: 14px; font-weight: 700;
  margin-bottom: 10px;
}
.rb-day-title-input:focus { outline: none; border-color: var(--accent); }
.rb-ex-row {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  gap: 6px 8px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.rb-ex-name { font-size: 14px; font-weight: 700; color: var(--text); grid-column: 1; align-self: center; }
.rb-ex-del  { grid-column: 2; grid-row: 1 / 3; align-self: center; font-size: 13px; opacity: 0.4; padding: 4px 6px; }
.rb-ex-inputs { grid-column: 1; display: flex; gap: 8px; }
.rb-ex-label {
  display: flex; flex-direction: column; gap: 3px;
  font-size: 10px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .04em; flex: 1;
}
.rb-ex-input {
  background: rgba(255,255,255,.07);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 8px;
  color: var(--text); font-size: 13px; font-weight: 700;
  width: 100%; box-sizing: border-box;
}
.rb-ex-input:focus { outline: none; border-color: var(--accent); }
.rb-picker {
  max-height: 280px; overflow-y: auto;
  background: rgba(255,255,255,.04);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  margin-top: 8px;
}
.rb-picker-group { margin-bottom: 10px; }
.rb-picker-group:last-child { margin-bottom: 0; }
.rb-picker-group-label {
  font-size: 10px; font-weight: 800; color: var(--muted);
  text-transform: uppercase; letter-spacing: .06em;
  margin-bottom: 6px;
}
.rb-picker-item {
  display: block; width: 100%;
  text-align: left; padding: 8px 10px;
  font-size: 13px; font-weight: 600; color: var(--text);
  background: rgba(255,255,255,.04);
  border: 1px solid transparent;
  border-radius: 8px; margin-bottom: 4px;
  cursor: pointer;
  transition: background 100ms;
}
.rb-picker-item:hover  { background: rgba(255,255,255,.09); }
.rb-picker-item--added { opacity: 0.45; }
.rb-chip-row {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-bottom: 10px;
}
.rb-chip {
  padding: 5px 11px; font-size: 12px; font-weight: 700;
  border-radius: 20px; border: 1px solid var(--line);
  background: rgba(255,255,255,.04); color: var(--muted);
  cursor: pointer; white-space: nowrap;
  transition: background 100ms, color 100ms;
}
.rb-chip--active {
  background: var(--accent); color: #fff; border-color: var(--accent);
}
.rb-search-input {
  width: 100%; padding: 8px 10px; font-size: 13px;
  background: rgba(255,255,255,.06); border: 1px solid var(--line);
  border-radius: 8px; color: var(--text);
  margin-bottom: 10px; box-sizing: border-box;
}
.rb-search-input:focus { outline: none; border-color: var(--accent); }
.rb-picker-hint {
  font-size: 12px; color: var(--muted); text-align: center;
  padding: 10px 0; margin: 0;
}
.rb-suggest-btn {
  margin-left: auto; padding: 2px 8px; font-size: 11px; font-weight: 700;
  border-radius: 10px; border: 1px solid var(--accent);
  background: transparent; color: var(--accent);
  cursor: pointer; white-space: nowrap;
  transition: background 100ms, color 100ms;
}
.rb-suggest-btn:hover { background: var(--accent); color: #fff; }
.rb-picker-group-label { display: flex; align-items: center; }
.rb-ai-panel {
  background: rgba(10,122,154,.08); border: 1px solid rgba(10,122,154,.3);
  border-radius: 10px; padding: 10px 12px; margin-bottom: 8px;
}
.rb-ai-header {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 11px; font-weight: 800; color: var(--accent);
  text-transform: uppercase; letter-spacing: .06em; margin-bottom: 8px;
}
.rb-ai-dismiss {
  background: none; border: none; color: var(--muted);
  cursor: pointer; font-size: 14px; padding: 0 2px;
}
.rb-ai-pick {
  display: flex; flex-direction: column; width: 100%;
  text-align: left; padding: 8px 10px; margin-bottom: 6px;
  background: rgba(255,255,255,.04); border: 1px solid transparent;
  border-radius: 8px; cursor: pointer; transition: background 100ms;
}
.rb-ai-pick:hover { background: rgba(255,255,255,.09); }
.rb-ai-pick--winner {
  background: rgba(10,122,154,.15); border-color: rgba(10,122,154,.4);
}
.rb-ai-badge {
  font-size: 10px; font-weight: 800; color: var(--accent);
  text-transform: uppercase; letter-spacing: .05em; margin-bottom: 2px;
}
.rb-ai-pick--winner .rb-ai-badge { color: var(--accent); }
.rb-ai-name { font-size: 13px; font-weight: 700; color: var(--text); margin-bottom: 2px; }
.rb-ai-reason { font-size: 12px; color: var(--muted); }
.rb-ai-loading {
  font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 8px;
}
.rb-ai-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent); opacity: .7;
  animation: rb-pulse 1s ease-in-out infinite;
}
@keyframes rb-pulse { 0%,100%{opacity:.3} 50%{opacity:1} }
.rb-ai-error { font-size: 13px; color: var(--muted); }
.rb-ai-error .rb-ai-dismiss { margin-left: 8px; font-size: 12px; color: var(--accent); text-decoration: underline; }

/* ─── Profile indicator (Today tab) ────────────────────── */
.profile-today-strip {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 800;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 10px;
  cursor: pointer;
  width: fit-content;
}
.profile-today-strip:hover { color: var(--text); }
.profile-today-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}

/* ─── Profile list (Settings) ───────────────────────────── */
.profile-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.profile-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255,255,255,.04);
  border: 1px solid var(--line);
}
.profile-row--active { border-color: var(--accent); background: rgba(255,255,255,.07); }
.profile-row__info { display: flex; align-items: center; gap: 10px; }
.profile-row__avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  font-weight: 900;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.profile-row__name { font-size: 15px; font-weight: 700; color: var(--text); }
.profile-row__badge {
  font-size: 10px; font-weight: 800;
  padding: 2px 8px; border-radius: 999px;
  background: rgba(255,255,255,.1);
  color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.04em;
}
.profile-row__switch { padding: 6px 14px; font-size: 13px; }
.profile-add-row {
  display: flex; gap: 8px; align-items: center; margin-bottom: 16px;
}
.profile-add-row .supp-input { flex: 1; }

/* ─── Active session strip (Today tab) ─────────────────── */
.active-sess-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255,255,255,.06);
  border: 1px solid var(--accent);
  border-radius: 12px;
  padding: 10px 14px;
  margin-bottom: 12px;
}
.active-sess-badge {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent);
  white-space: nowrap;
}
.active-sess-meta {
  font-size: 13px;
  color: var(--muted);
  font-weight: 700;
}

/* ─── Edit set sheet inputs ─────────────────────────────── */
.edit-set-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}
.edit-set-inputs label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.edit-set-inputs input {
  background: rgba(255,255,255,.07);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  color: var(--text);
  font-size: 16px;
  font-weight: 700;
  width: 100%;
  box-sizing: border-box;
}
.edit-set-inputs input:focus {
  outline: none;
  border-color: var(--accent);
}

/* ─── Cardio tab ─────────────────────────────────────────── */
.cardio-goal-block {
  background: rgba(255,255,255,0.05);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 12px;
}
.cardio-goal-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}
.cardio-goal-text {
  font-size: 13px;
  color: rgba(255,255,255,0.8);
  line-height: 1.5;
}
.cardio-week-strip {
  font-size: 13px;
  color: rgba(255,255,255,0.65);
  background: rgba(255,255,255,0.04);
  border-radius: 8px;
  padding: 8px 12px;
  margin-bottom: 4px;
}
.cardio-week-strip b {
  color: var(--accent);
  font-weight: 700;
}
.cardio-entry {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.cardio-entry:last-child {
  border-bottom: none;
}
.cardio-entry__left {
  flex: 1;
  min-width: 0;
}
.cardio-entry__type {
  display: block;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}
.cardio-entry__date {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-top: 1px;
}
.cardio-entry__meta {
  font-size: 12px;
  color: rgba(255,255,255,0.55);
  padding-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cardio-entry__notes {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
  font-style: italic;
}
.cardio-entry__del {
  flex-shrink: 0;
  font-size: 13px;
  padding: 2px 6px;
  opacity: 0.4;
  color: var(--muted);
}
