:root {
  --bg: #0b1117;
  --surface: #111922;
  --card: #17212b;
  --card-soft: #1b2631;
  --fg: #edf4fb;
  --muted: #9aacbc;
  --muted-strong: #b9c8d8;
  --accent: #2f81f7;
  --accent-strong: #58a6ff;
  --success: #3fb950;
  --warning: #d29922;
  --danger: #f15c6d;
  --border: #2d3a46;
  --border-soft: #23303b;
  --input: #0b1117;
  --shadow: 0 18px 45px rgba(0, 0, 0, .22);
  --radius: 8px;
  --radius-sm: 6px;
  --content: 1080px;
}

* { box-sizing: border-box; }

html { color-scheme: dark; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--fg);
  line-height: 1.5;
}

img,
svg,
canvas { max-width: 100%; }

a { color: var(--accent-strong); }

header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  min-height: 64px;
  padding: 0 1.5rem;
  border-bottom: 1px solid var(--border-soft);
  background: rgba(11, 17, 23, .94);
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  color: var(--fg);
  font-weight: 750;
  font-size: 1.05rem;
  letter-spacing: .01em;
  text-decoration: none;
  white-space: nowrap;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: linear-gradient(135deg, #2f81f7, #3fb950);
  color: #fff;
  font-size: .78rem;
  font-weight: 800;
}

nav {
  flex: 1;
  display: flex;
  align-items: center;
  gap: .25rem;
}

nav a {
  color: var(--muted);
  text-decoration: none;
  padding: .55rem .7rem;
  border-radius: var(--radius-sm);
  font-size: .92rem;
  transition: background .15s ease, color .15s ease;
}

nav a:hover {
  color: var(--fg);
  background: rgba(255, 255, 255, .05);
}

.logout-link {
  margin-left: auto;
  color: #ff8b94;
  font-weight: 600;
}

.hamburger {
  display: none;
  position: relative;
  margin-left: auto;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--fg);
  cursor: pointer;
}

.hamburger > span {
  position: absolute;
  left: 11px;
  width: 20px;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
  transition: transform .18s ease, opacity .18s ease, top .18s ease;
}

.hamburger > span:nth-child(1) { top: 14px; }
.hamburger > span:nth-child(2) { top: 20px; }
.hamburger > span:nth-child(3) { top: 26px; }
.hamburger.is-open > span:nth-child(1) { top: 20px; transform: rotate(45deg); }
.hamburger.is-open > span:nth-child(2) { opacity: 0; }
.hamburger.is-open > span:nth-child(3) { top: 20px; transform: rotate(-45deg); }

.hamburger:focus-visible,
nav a:focus-visible {
  outline: 3px solid rgba(88, 166, 255, .45);
  outline-offset: 2px;
}

.main-content {
  width: min(100%, var(--content));
  margin: 0 auto;
  padding: 3rem 1.5rem 4rem;
}

.content-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.content-header h1,
.content-header h2 {
  margin: 0;
  font-size: clamp(1.75rem, 2.6vw, 2.35rem);
  line-height: 1.15;
  letter-spacing: 0;
}

.header-left {
  min-width: 0;
}

.header-left .muted,
.content-header .muted {
  margin-top: .65rem;
}

h1, h2, h3 {
  margin: 0 0 .85rem;
  line-height: 1.2;
  letter-spacing: 0;
}

h3 { font-size: 1.08rem; }

p { margin: 0 0 1rem; }

.muted {
  color: var(--muted);
  font-size: .92rem;
}

.text-center { text-align: center; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow);
}

.card.warn,
.warn {
  background: rgba(210, 153, 34, .12);
  border-color: rgba(210, 153, 34, .42);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.grid .card { margin-bottom: 0; }

.section-card {
  padding: 1.35rem;
}

.section-card + .section-card {
  margin-top: 1rem;
}

.eyebrow,
.card-kicker {
  display: block;
  margin-bottom: .45rem;
  color: var(--accent-strong);
  font-size: .75rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.onboarding-shell {
  max-width: 920px;
  margin: 0 auto;
}

.onboarding-heading {
  margin-bottom: 1.5rem;
}

.onboarding-steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .75rem;
  margin: 0 0 1.5rem;
  padding: 0;
  list-style: none;
}

.onboarding-steps li {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted);
}

.onboarding-steps li > span {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: none;
  border: 1px solid var(--border);
  border-radius: 50%;
  font-size: .8rem;
  font-weight: 800;
}

.onboarding-steps li b,
.onboarding-steps li small { display: block; }
.onboarding-steps li small { margin-top: .05rem; font-size: .72rem; }
.onboarding-steps li.active { border-color: var(--accent); color: var(--fg); background: rgba(47, 129, 247, .1); }
.onboarding-steps li.active > span { border-color: var(--accent); background: var(--accent); color: #fff; }
.onboarding-steps li.done > span { border-color: var(--success); background: rgba(63, 185, 80, .15); color: var(--success); }

.onboarding-welcome,
.success-card,
.calendar-status-card {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}

.feature-icon,
.section-emoji {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: none;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  font-size: 1.35rem;
}

.sync-banner {
  display: flex;
  align-items: center;
  gap: .85rem;
  padding: 1rem 1.1rem;
  margin-bottom: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.sync-banner p { margin: .18rem 0 0; color: var(--muted); font-size: .88rem; }
.sync-banner.is-running { border-color: rgba(47, 129, 247, .55); background: rgba(47, 129, 247, .08); }
.sync-banner.is-ready { border-color: rgba(63, 185, 80, .45); background: rgba(63, 185, 80, .07); }

.sync-pulse {
  width: 11px;
  height: 11px;
  flex: none;
  border-radius: 50%;
  background: var(--success);
}

.is-running .sync-pulse {
  background: var(--accent-strong);
  box-shadow: 0 0 0 0 rgba(88, 166, 255, .45);
  animation: syncPulse 1.5s infinite;
}

@keyframes syncPulse {
  70% { box-shadow: 0 0 0 9px rgba(88, 166, 255, 0); }
  100% { box-shadow: 0 0 0 0 rgba(88, 166, 255, 0); }
}

.onboarding-findings { margin-bottom: 1rem; }
.activity-count { display: flex; align-items: baseline; gap: .5rem; margin-top: 1rem; }
.activity-count strong { font-size: 1.8rem; line-height: 1; }
.activity-count span { color: var(--muted); font-size: .82rem; }

.section-heading {
  display: flex;
  align-items: flex-start;
  gap: .9rem;
  margin-bottom: 1.1rem;
}

.section-heading h2 { margin: 0; font-size: 1.18rem; }
.section-heading p { margin: .25rem 0 0; color: var(--muted); font-size: .88rem; }

.choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .7rem;
  margin-bottom: 1rem;
}

.choice-grid.compact { grid-template-columns: repeat(auto-fit, minmax(145px, 1fr)); }

.routine-days-filter {
  margin: 0 0 1rem;
  padding: 0;
  border: 0;
}

.routine-days-filter legend {
  margin-bottom: .55rem;
  color: var(--muted);
  font-size: .84rem;
  font-weight: 600;
}

.routine-days-filter [role="group"] { display: flex; flex-wrap: wrap; gap: .45rem; }

.filter-chip {
  min-height: 34px;
  padding: .35rem .7rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: .8rem;
  font-weight: 600;
}

.filter-chip:hover,
.filter-chip.is-selected { border-color: var(--accent); color: var(--fg); background: rgba(47, 129, 247, .11); }

.routine-level-hint { margin: -.35rem 0 1rem; }

.routine-experience-badge {
  display: inline-block;
  margin: .35rem 0 .05rem;
  padding: .16rem .48rem;
  border-radius: 999px;
  font-size: .7rem;
  font-weight: 700;
  line-height: 1.25;
}

.routine-experience-badge.beginner { background: rgba(63, 185, 80, .16); color: var(--success); }
.routine-experience-badge.intermediate { background: rgba(47, 129, 247, .16); color: var(--accent-strong); }
.routine-experience-badge.advanced { background: rgba(210, 153, 34, .17); color: #e3b341; }

.routine-source-details {
  display: flex;
  flex-wrap: wrap;
  gap: .24rem .62rem;
  margin: .42rem 0 .2rem;
}

.routine-detail-fact {
  display: inline-flex;
  align-items: baseline;
  gap: .2rem;
  color: var(--fg);
  font-size: .73rem;
  font-weight: 650;
  line-height: 1.3;
  white-space: nowrap;
}

.routine-detail-fact span {
  color: var(--muted);
  font-weight: 600;
}

.routine-detail-fact.beginner { color: var(--success); }
.routine-detail-fact.intermediate { color: var(--accent-strong); }
.routine-detail-fact.advanced { color: #e3b341; }

.choice-card {
  position: relative;
  display: flex;
  gap: .7rem;
  min-height: 76px;
  padding: .8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease, transform .15s ease;
}

.choice-card:hover { border-color: var(--accent-strong); transform: translateY(-1px); }
.choice-card:has(input:checked) { border-color: var(--accent); background: rgba(47, 129, 247, .11); }
.choice-card input { width: auto; min-height: 0; margin-top: .18rem; accent-color: var(--accent); }
.choice-card > span { flex: 1; min-width: 0; }
.choice-card b,
.choice-card small { display: block; }
.choice-card small { margin-top: .2rem; color: var(--muted); font-size: .78rem; font-weight: 500; }
.choice-card.compact { min-height: 54px; align-items: center; }
.choice-card.is-filtered-out { display: none; }

.routine-match {
  display: grid;
  grid-template-columns: auto minmax(80px, 1fr);
  align-items: center;
  gap: .3rem .55rem;
  margin: .65rem 0 .45rem;
}

.routine-match-heading {
  color: var(--muted);
  font-size: .72rem;
  font-weight: 750;
  white-space: nowrap;
}

.routine-match-track {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(139, 148, 158, .2);
}

.routine-match-track > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--muted);
  transition: width .25s ease;
}

.routine-match[data-tone="strong"] .routine-match-heading { color: var(--success); }
.routine-match[data-tone="strong"] .routine-match-track > span { background: var(--success); }
.routine-match[data-tone="good"] .routine-match-heading { color: var(--accent-strong); }
.routine-match[data-tone="good"] .routine-match-track > span { background: var(--accent); }
.routine-match[data-tone="possible"] .routine-match-heading { color: #e3b341; }
.routine-match[data-tone="possible"] .routine-match-track > span { background: #d29922; }
.routine-match[data-tone="specialty"] .routine-match-heading { color: #e3b341; }
.routine-match[data-tone="specialty"] .routine-match-track > span { background: #d29922; }
.routine-match[data-tone="poor"] .routine-match-heading { color: var(--muted); }

.routine-match small {
  grid-column: 1 / -1;
  margin: 0;
  line-height: 1.35;
}

.onboarding-submit {
  position: sticky;
  bottom: 1rem;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(17, 25, 34, .96);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.onboarding-submit p { margin: .15rem 0 0; color: var(--muted); font-size: .82rem; }
.success-card { border-color: rgba(63, 185, 80, .5); background: rgba(63, 185, 80, .08); }
.success-card .feature-icon { color: var(--success); font-weight: 900; }
.next-session-empty { border-style: dashed; }
.calendar-status-card p,
.success-card p { margin-bottom: 0; color: var(--muted); }

.setup-finding {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.setup-total {
  flex: none;
  min-width: 140px;
  text-align: right;
}

.setup-total span {
  display: block;
  font-size: 2rem;
  font-weight: 800;
  line-height: 1;
}

.setup-total small {
  color: var(--muted);
  font-size: .78rem;
}

.history-bars {
  display: grid;
  gap: .85rem;
}

.history-bar-row {
  display: grid;
  gap: .4rem;
}

.history-bar-label {
  display: flex;
  justify-content: space-between;
  gap: .75rem;
  font-size: .88rem;
  font-weight: 700;
}

.history-bar-label small {
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
}

.history-bar-track {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface);
}

.history-bar-track span {
  display: block;
  min-width: 2px;
  height: 100%;
  border-radius: inherit;
  background: var(--accent-strong);
}

.routine-list {
  display: flex;
  flex-wrap: wrap;
  gap: .55rem;
  margin-top: .85rem;
}

.routine-list span {
  padding: .55rem .7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-weight: 700;
}

.routine-list small {
  display: block;
  margin-top: .15rem;
  color: var(--muted);
  font-size: .74rem;
  font-weight: 600;
}

.option-block {
  margin-top: 1rem;
}

.form-section {
  display: grid;
  gap: 1rem;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.form-grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.field {
  display: grid;
  gap: .35rem;
}

label,
.field-label {
  color: var(--fg);
  font-size: .9rem;
  font-weight: 650;
}

input,
textarea,
select {
  width: 100%;
  min-height: 42px;
  padding: .65rem .75rem;
  margin: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--input);
  color: var(--fg);
  font: inherit;
  font-size: 16px;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}

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

input::placeholder,
textarea::placeholder {
  color: #7f8c99;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent-strong);
  box-shadow: 0 0 0 3px rgba(47, 129, 247, .18);
}

.field-hint {
  color: var(--muted);
  font-size: .82rem;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin: 1rem 0 0;
}

.toolbar.compact {
  margin: 0 0 1.25rem;
}

.btn,
.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  min-height: 40px;
  padding: .58rem .95rem;
  border-radius: var(--radius-sm);
  font-size: .92rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: transform .15s ease, filter .15s ease, background .15s ease, border-color .15s ease;
}

.btn {
  border: 1px solid transparent;
  background: var(--accent);
  color: #fff;
}

.btn-secondary {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, .04);
  color: var(--fg);
}

.btn:hover,
.btn-secondary:hover {
  transform: translateY(-1px);
  filter: brightness(1.08);
}

.btn:disabled {
  opacity: .55;
  cursor: default;
  transform: none;
}

.btn.small,
.btn-secondary.small {
  min-height: 32px;
  padding: .32rem .65rem;
  font-size: .8rem;
}

.notice {
  margin: -.35rem 0 1rem;
  font-size: .88rem;
}

.notice ul {
  margin: .5rem 0 0;
  padding-left: 1.1rem;
}

.badge,
.type-tag {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: .12rem .5rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted-strong);
  background: rgba(255, 255, 255, .04);
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  white-space: nowrap;
}

.type-tag { margin-left: .55rem; }

.badge {
  color: #fff;
  background: rgba(47, 129, 247, .35);
  border-color: rgba(88, 166, 255, .45);
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  padding: .68rem .45rem;
  border-bottom: 1px solid var(--border-soft);
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-weight: 700;
  font-size: .82rem;
}

tr:last-child td {
  border-bottom: 0;
}

.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.template-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(255px, 1fr));
  gap: .65rem;
  margin: 1rem 0;
}

.template-list.compact {
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  margin: .55rem 0 0;
}

.check-row {
  display: flex;
  align-items: flex-start;
  gap: .65rem;
  min-height: 56px;
  padding: .75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
}

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

.check-row input {
  width: auto;
  min-height: 0;
  margin-top: .2rem;
}

.check-row span {
  min-width: 0;
}

.check-row small {
  display: block;
  margin-top: .15rem;
  color: var(--muted);
  font-size: .78rem;
}

.readonly-choice {
  display: flex;
  align-items: center;
  min-height: 42px;
  padding: .65rem .75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--muted-strong);
}

.tile-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: .85rem;
  margin-bottom: 1.25rem;
}

.tile {
  min-width: 0;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  text-align: center;
  box-shadow: var(--shadow);
}

.recovery-signals-tile {
  grid-column: span 2;
  text-align: left;
}

.recovery-signal-list {
  display: grid;
  gap: .55rem;
  margin-top: .85rem;
}

.recovery-signal-row {
  display: grid;
  grid-template-columns: minmax(82px, .55fr) minmax(0, 2fr);
  align-items: baseline;
  gap: .5rem;
  padding-bottom: .5rem;
  border-bottom: 1px solid var(--border-soft);
}

.recovery-signal-row:last-child { border-bottom: 0; }
.recovery-signal-row > span { color: var(--muted); font-size: .78rem; font-weight: 650; }
.recovery-signal-detail { display: flex; flex-wrap: nowrap; justify-content: flex-end; align-items: center; gap: .3rem .45rem; min-width: 0; }
.recovery-signal-detail > strong { font-size: .82rem; font-weight: 720; text-align: right; white-space: nowrap; }
.recovery-signal-indicator { display: inline-flex; align-items: center; gap: .32rem; flex: 0 0 auto; padding: .15rem .42rem; border: 1px solid var(--border); border-radius: 999px; color: var(--muted-strong); background: rgba(154, 172, 188, .08); font-size: .66rem; font-weight: 750; line-height: 1.2; white-space: nowrap; }
.recovery-signal-dot { width: .45rem; height: .45rem; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 2px rgba(154, 172, 188, .1); }
.recovery-signal-indicator.positive { color: var(--success); border-color: rgba(63, 185, 80, .3); background: rgba(63, 185, 80, .09); }
.recovery-signal-indicator.caution { color: #e3b341; border-color: rgba(210, 153, 34, .34); background: rgba(210, 153, 34, .1); }
.recovery-signal-indicator.alert { color: var(--danger); border-color: rgba(241, 92, 109, .34); background: rgba(241, 92, 109, .09); }
.recovery-signal-indicator.comparison { color: var(--accent-strong); border-color: rgba(88, 166, 255, .3); background: rgba(47, 129, 247, .09); }
.recovery-signals-note { margin-top: .7rem; color: var(--muted); font-size: .76rem; }

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

.tile-value {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: .35rem;
  margin-top: .25rem;
  font-size: 1.7rem;
  font-weight: 800;
  line-height: 1.1;
}

.tile-unit {
  color: var(--muted);
  font-size: .78rem;
  font-weight: 600;
}

.tile-sub {
  min-height: 1.4em;
  margin-top: .35rem;
  font-size: .78rem;
}

.trend { font-size: .85rem; }
.trend.up { color: var(--success); }
.trend.down { color: var(--danger); }
.trend.flat { color: var(--muted); }

.tile.tile-green { border-left: 3px solid var(--success); }
.tile.tile-yellow { border-left: 3px solid var(--warning); }
.tile.tile-red { border-left: 3px solid var(--danger); }

.acwr-label {
  font-size: .72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.chart-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.chart-card {
  margin-bottom: 0;
  padding: 1rem;
}

.chart-head {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  margin-bottom: .6rem;
}

.chart-card h3 {
  margin: 0;
  font-size: .98rem;
}

.collapse-btn {
  flex: none;
  width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
}

.collapse-btn:hover {
  color: var(--fg);
  border-color: var(--muted);
}

.chart-wrap {
  position: relative;
  height: 190px;
}

.chart-card.collapsed .chart-wrap,
.collapsible-card.collapsed .collapsible-content {
  display: none;
}

.collapsible-card.collapsed {
  padding-bottom: 1.25rem;
}

.info {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: .4rem;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 1.5px solid var(--muted);
  color: var(--muted);
  background: transparent;
  cursor: help;
  position: relative;
  vertical-align: middle;
  font-size: .62rem;
  font-style: italic;
  font-weight: 700;
  line-height: 1;
  flex-shrink: 0;
  transition: border-color .15s ease, color .15s ease, background .15s ease;
}

.info:hover,
.info:focus {
  border-color: var(--accent-strong);
  color: var(--accent-strong);
  background: rgba(99, 179, 237, .08);
  outline: none;
}

.info::after {
  content: attr(data-tip);
  position: absolute;
  top: calc(100% + 7px);
  left: 50%;
  z-index: 20;
  width: max-content;
  max-width: 260px;
  padding: .55rem .7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #081018;
  color: var(--fg);
  box-shadow: 0 10px 28px rgba(0, 0, 0, .45);
  font-size: .78rem;
  font-weight: 400;
  font-style: normal;
  line-height: 1.4;
  letter-spacing: 0;
  text-transform: none;
  white-space: normal;
  opacity: 0;
  visibility: hidden;
  transform: translateX(-50%);
  transition: opacity .15s ease;
  pointer-events: none;
}

.info:hover::after,
.info:focus::after {
  opacity: 1;
  visibility: visible;
}

.ai-msg {
  white-space: pre-wrap;
  word-wrap: break-word;
}

.stats {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.stats span {
  min-width: 120px;
  padding: .75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.stats b {
  display: block;
  font-size: 1.25rem;
}

.exercise {
  padding: 1rem 0;
  border-bottom: 1px solid var(--border-soft);
}

.exercise:last-of-type { border-bottom: 0; }

.exercise-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: .6rem;
  flex-wrap: wrap;
}

.exercise-name {
  font-weight: 750;
}

.set-pills {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
}

.set-pill {
  padding: .3rem .6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: .86rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.cardio-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(165px, 1fr));
  gap: .85rem;
}

.cardio-stat {
  padding: .85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.cardio-label {
  margin-bottom: .25rem;
  font-size: .76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.cardio-value {
  font-size: 1.15rem;
  font-weight: 750;
}

.hrz {
  display: flex;
  flex-direction: column;
  gap: .55rem;
}

.hrz-row {
  display: grid;
  grid-template-columns: 72px 1fr 84px;
  align-items: center;
  gap: .75rem;
}

.hrz-label {
  font-size: .86rem;
  font-weight: 750;
}

.hrz-track {
  height: 16px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface);
}

.hrz-fill {
  display: block;
  height: 100%;
  min-width: 2px;
  border-radius: 999px;
}

.hrz-time {
  text-align: right;
  font-size: .82rem;
  font-variant-numeric: tabular-nums;
}

.hrz-z0 { background: #5a6b76; }
.hrz-z1 { background: #4593e6; }
.hrz-z2 { background: #3fb9c5; }
.hrz-z3 { background: #3fb950; }
.hrz-z4 { background: #f0883e; }
.hrz-z5 { background: #e5534b; }

.calendar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: .65rem;
}

.calendar-scroll {
  max-width: 100%;
  overflow-x: auto;
  padding-bottom: .35rem;
  -webkit-overflow-scrolling: touch;
  scrollbar-gutter: stable;
}

.calendar-scroll:focus-visible {
  outline: 2px solid var(--accent-strong);
  outline-offset: 3px;
}

.weekday-header {
  padding: .45rem 0;
  color: var(--muted);
  text-align: center;
  font-size: .82rem;
  font-weight: 800;
}

.calendar-cell {
  min-height: 108px;
  min-width: 0;
  padding: .7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
}

.other-month { opacity: .42; }

.today {
  border-color: rgba(88, 166, 255, .75);
  background: #132234;
}

.cell-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .5rem;
  margin-bottom: .55rem;
}

.date-num { font-weight: 800; }

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.dot-green { background-color: var(--success); }
.dot-yellow { background-color: var(--warning); }
.dot-red { background-color: var(--danger); }

.cell-activities {
  display: flex;
  flex-direction: column;
  gap: .35rem;
}

.act-pill {
  display: flex;
  align-items: center;
  gap: .35rem;
  overflow: hidden;
  padding: .35rem .45rem;
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--fg);
  text-decoration: none;
  font-size: .8rem;
  flex-wrap: wrap;
}

.act-pill:hover { background: var(--card-soft); }

.act-icon {
  flex: none;
  font-size: .9rem;
  line-height: 1;
}

.act-dur {
  overflow: hidden;
  text-overflow: ellipsis;
}

.act-name {
  flex: 0 0 100%;
  font-size: .68rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: -.1rem;
}


code {
  padding: .1rem .3rem;
  border-radius: 4px;
  background: var(--surface);
}

details summary {
  cursor: pointer;
  color: var(--accent-strong);
  font-size: .85rem;
}

.tile-gauge { text-align: center; }

.gauge-wrap { padding: 1.25rem 0 .25rem; }

.gauge {
  width: 150px;
  height: 75px;
  overflow: hidden;
  position: relative;
  margin: 0 auto;
}

.gauge-arc {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  background: conic-gradient(
    from -90deg,
    #f15c6d 0 35deg,
    transparent 35deg 36deg,
    #f0883e 36deg 71deg,
    transparent 71deg 72deg,
    #3fb950 72deg 107deg,
    transparent 107deg 108deg,
    #3fb9c5 108deg 143deg,
    transparent 143deg 144deg,
    #8b5cf6 144deg 180deg,
    transparent 180deg 360deg
  );
  -webkit-mask: radial-gradient(transparent 58px, #000 59px);
  mask: radial-gradient(transparent 58px, #000 59px);
}

.gauge-val-text {
  position: absolute;
  right: 0;
  bottom: 5px;
  left: 0;
  color: var(--fg);
  font-size: 1.8rem;
  font-weight: 750;
  line-height: 1.05;
}

.gauge-unit {
  margin-top: .18rem;
  color: var(--muted);
  font-size: .76rem;
  font-weight: 600;
}

.gauge-indicator {
  position: absolute;
  top: 75px;
  left: 75px;
  width: 0;
  height: 0;
  transition: transform .5s ease;
}

.gauge-dot {
  position: absolute;
  top: -7px;
  left: -7px;
  width: 14px;
  height: 14px;
  border: 2px solid var(--card);
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 4px rgba(0, 0, 0, .5);
  transform: translateY(-66.5px);
}

.gauge-footer {
  margin-top: .75rem;
  font-size: .98rem;
  font-weight: 750;
}

.gauge-desc {
  margin-top: .25rem;
  color: var(--muted);
  font-size: .8rem;
}

@media (max-width: 860px) {
  .form-grid,
  .form-grid.two,
  .chart-grid {
    grid-template-columns: 1fr;
  }

  .main-content {
    padding: 1.5rem 1rem 2.5rem;
  }
}

@media (max-width: 768px) {
  body { overflow-x: hidden; }

  body.nav-open { overflow: hidden; }

  header {
    min-height: 60px;
    padding-right: max(.75rem, env(safe-area-inset-right));
    padding-left: max(.75rem, env(safe-area-inset-left));
  }

  .hamburger { display: inline-grid; place-items: center; }

  nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    width: 100%;
    max-height: calc(100dvh - 60px);
    overflow-y: auto;
    padding: .55rem max(.75rem, env(safe-area-inset-right)) calc(.55rem + env(safe-area-inset-bottom)) max(.75rem, env(safe-area-inset-left));
    border-bottom: 1px solid var(--border);
    background: rgba(11, 17, 23, .98);
    box-shadow: 0 18px 35px rgba(0, 0, 0, .38);
    backdrop-filter: blur(14px);
    flex-direction: column;
    align-items: stretch;
  }

  nav.open { display: flex; }

  nav a {
    display: flex;
    align-items: center;
    width: 100%;
    min-height: 48px;
    padding: .75rem;
    font-size: 1rem;
  }

  .logout-link {
    margin-left: 0;
  }

  .content-header,
  .toolbar,
  .setup-finding {
    flex-direction: column;
    align-items: stretch;
  }

  .calendar-header {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: .5rem;
  }

  .calendar-header h2 {
    margin: 0;
    font-size: 1.15rem;
    text-align: center;
    white-space: nowrap;
  }

  .calendar-header .btn-secondary {
    width: auto;
    min-width: 0;
    padding-inline: .65rem;
  }

  .calendar-header .btn-secondary:last-child { justify-self: end; }

  .calendar-grid {
    min-width: 620px;
    gap: .4rem;
  }

  .setup-total {
    text-align: left;
  }

  .card {
    padding: 1rem;
  }

  .btn,
  .btn-secondary,
  .filter-chip,
  .collapse-btn { min-height: 44px; }

  .btn.small,
  .btn-secondary.small { min-height: 40px; }

  .table-scroll {
    max-width: 100%;
    overscroll-behavior-x: contain;
  }

  table {
    min-width: 560px;
  }

  .chart-wrap {
    height: 175px;
  }
}

@media (max-width: 600px) {
  .main-content {
    padding: 1.1rem max(.75rem, env(safe-area-inset-right)) calc(2rem + env(safe-area-inset-bottom)) max(.75rem, env(safe-area-inset-left));
  }

  .brand { font-size: .98rem; }

  .grid,
  .tile-row,
  .template-list,
  .template-list.compact,
  .cardio-grid { grid-template-columns: minmax(0, 1fr); }

  .recovery-signals-tile { grid-column: auto; }

  .recovery-signal-row {
    grid-template-columns: 1fr;
    gap: .15rem;
  }

  .recovery-signal-detail { justify-content: flex-start; align-items: center; }
  .recovery-signal-detail > strong { text-align: left; }

  .content-header h1,
  .content-header h2 { overflow-wrap: anywhere; }

  .sync-banner,
  .onboarding-welcome,
  .success-card,
  .calendar-status-card { align-items: flex-start; }

  .history-bar-label > span { min-width: 0; overflow-wrap: anywhere; }

  .stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .6rem;
  }

  .stats span { min-width: 0; }

  .exercise-head > * { min-width: 0; }
  .exercise-head .exercise-name { overflow-wrap: anywhere; }

  .hrz-row {
    grid-template-columns: 58px minmax(0, 1fr) 66px;
    gap: .5rem;
  }

  .weekday-header { font-size: .72rem; }
  .calendar-cell {
    min-height: 88px;
    padding: .45rem;
    border-radius: 6px;
  }
  .act-pill {
    align-items: flex-start;
    padding: .22rem;
    font-size: .66rem;
    gap: .15rem;
  }
  .act-icon { display: none; }
  .cell-top { margin-bottom: .25rem; }
  .date-num { font-size: .8rem; }

  .picker-dialog {
    max-height: calc(100dvh - 1rem);
    border-radius: 14px;
  }
}

/* ── Plan page ─────────────────────────────────────── */

.plan-profile-card p { margin-bottom: .65rem; }

.profile-card-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.profile-card-heading h3 { margin-bottom: .85rem; }
.profile-card-heading a { font-size: .84rem; font-weight: 700; }
.profile-availability { white-space: normal; }

.plan-proposal-card {
  border-color: rgba(47, 129, 247, .48);
  border-radius: 18px;
  background: linear-gradient(145deg, rgba(47, 129, 247, .14), rgba(47, 129, 247, .04) 48%, var(--card));
  padding: clamp(1.5rem, 3vw, 2.25rem);
  box-shadow: 0 18px 50px rgba(0, 0, 0, .16);
}

.plan-proposal-card .badge { display: inline-flex; margin-bottom: 1rem; }
.plan-proposal-card h2 { margin-bottom: .75rem; font-size: 1.45rem; letter-spacing: -.015em; }
.proposal-rationale { max-width: 68ch; margin-bottom: 1rem; color: var(--fg); line-height: 1.6; }
.proposal-note { display: flex; align-items: center; gap: .55rem; max-width: max-content; padding: .6rem .8rem; border: 1px solid rgba(63, 185, 80, .24); border-radius: 10px; background: rgba(63, 185, 80, .07); color: var(--muted); font-size: .86rem; }
.proposal-note > span:first-child { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: rgba(63, 185, 80, .18); color: #3fb950; font-size: .72rem; font-weight: 800; }
.proposal-footer { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: 1.35rem; padding-top: 1.15rem; border-top: 1px solid var(--border-soft); }
.proposal-source { font-size: .88rem; font-weight: 650; }

.plan-proposal-card form {
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
}

.plan-profile-stats {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-top: .75rem;
}

.plan-stat {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.plan-stat-value {
  font-size: 1.55rem;
  font-weight: 800;
  line-height: 1.1;
  color: var(--fg);
}

.plan-stat-label {
  font-size: .75rem;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-top: .1rem;
}

/* Sessions pill list */
.plan-sessions-list {
  display: flex;
  flex-wrap: wrap;
  gap: .65rem;
  margin-top: .25rem;
}

.plan-session-badge {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .5rem .8rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(127, 140, 153, .06);
  font-size: .9rem;
}

.plan-session-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: .72rem;
  font-weight: 800;
  flex-shrink: 0;
}

.plan-session-name { font-weight: 700; }
.plan-session-type { font-size: .8rem; }

/* Template card */
.plan-template-card {
  padding: 0;
  margin-bottom: 1.5rem;
  overflow: hidden;
  border-color: var(--border-soft);
  border-radius: 18px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, .12);
}

.plan-template-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0;
  padding: 1.15rem 1.35rem;
  border-bottom: 1px solid var(--border-soft);
  background: linear-gradient(90deg, rgba(47, 129, 247, .09), transparent 45%);
}

.plan-template-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .6rem;
  font-size: 1.05rem;
  font-weight: 750;
}

.session-garmin-status {
  padding: .25rem .5rem;
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  color: var(--muted);
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .02em;
}

.session-garmin-status.is-ready {
  border-color: rgba(63, 185, 80, .35);
  background: rgba(63, 185, 80, .08);
  color: #3fb950;
}

.session-garmin-status.is-incomplete {
  border-color: rgba(210, 153, 34, .42);
  background: rgba(210, 153, 34, .08);
  color: #d29922;
}

.plan-template-actions {
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-shrink: 0;
}

.plan-templates-heading { display: flex; align-items: end; justify-content: space-between; gap: 1rem; margin: 2.25rem 0 1rem; }
.plan-templates-heading h2 { margin-bottom: .35rem; font-size: 1.3rem; }
.plan-templates-actions { display: flex; align-items: center; justify-content: flex-end; gap: .55rem; flex-wrap: wrap; }

.add-session-panel {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 1.25rem 1.35rem;
  border: 1px dashed var(--border);
  border-radius: 14px;
  background: rgba(127, 140, 153, .035);
}
.add-session-panel h3 { margin-bottom: .3rem; }
.add-session-panel p { max-width: 48ch; margin-bottom: 0; }
.add-session-form { min-width: min(100%, 360px); }
.add-session-form > label { display: block; margin-bottom: .35rem; color: var(--muted); font-size: .72rem; font-weight: 750; letter-spacing: .055em; text-transform: uppercase; }
.add-session-form > div { display: flex; gap: .5rem; }
.add-session-form input { min-width: 0; }
.add-session-form .btn-secondary { flex: 0 0 auto; }
.add-session-status { display: block; min-height: 1.3em; margin-top: .35rem; font-size: .8rem; }
.approve-status { display: inline-block; max-width: 320px; margin-right: .5rem; color: #d29922; font-size: .8rem; vertical-align: middle; }

.exercise-list { display: grid; gap: .65rem; padding: 1rem 1.35rem; }
.exercise-row {
  display: grid;
  grid-template-columns: minmax(230px, 2.2fr) 72px minmax(160px, 1.15fr) 112px 88px 96px;
  align-items: end;
  gap: .75rem;
  padding: .9rem 1rem;
  border: 1px solid var(--border-soft);
  border-radius: 13px;
  background: rgba(127, 140, 153, .035);
  transition: border-color .15s ease, background .15s ease;
}
.exercise-row:hover { border-color: rgba(47, 129, 247, .34); background: rgba(47, 129, 247, .035); }
.source-progression-note { grid-column: 1 / -1; display: grid; gap: .2rem; font-size: .78rem; color: var(--muted, #6b7280); }
.exercise-identity { display: grid; align-self: stretch; gap: .3rem; min-width: 0; }
.exercise-field-label { min-height: 1em; color: var(--muted); font-size: .68rem; font-weight: 750; letter-spacing: .055em; text-transform: uppercase; }
.exercise-name-line { display: flex; align-items: center; min-height: 42px; gap: .65rem; min-width: 0; }
.exercise-name { overflow: hidden; color: var(--fg); font-size: .96rem; font-weight: 720; text-overflow: ellipsis; white-space: nowrap; }
.exercise-replace { flex: 0 0 auto; padding: .3rem .45rem; border: 1px solid transparent; border-radius: 7px; background: transparent; color: var(--accent-strong); font: inherit; font-size: .76rem; font-weight: 700; cursor: pointer; }
.exercise-replace:hover { border-color: rgba(47, 129, 247, .3); background: rgba(47, 129, 247, .09); text-decoration: none; }
.exercise-field { display: grid; gap: .3rem; min-width: 0; }
.exercise-field > span { min-height: 1em; color: var(--muted); font-size: .68rem; font-weight: 750; letter-spacing: .055em; text-transform: uppercase; }
.exercise-field > span { text-align: center; }
.exercise-field input, .exercise-field select { height: 42px; min-height: 42px; padding: .45rem .55rem; border-radius: 9px; font-size: .86rem; text-align: center; }
.exercise-warmup {
  grid-column: 1 / -1;
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: .55rem .9rem;
  margin-top: -.05rem;
  padding-top: .65rem;
  border-top: 1px dashed var(--border-soft);
}
.exercise-warmup label { display: grid; gap: .25rem; color: var(--muted); font-size: .72rem; font-weight: 700; }
.exercise-warmup > label:first-child { display: flex; align-items: center; min-height: 34px; color: var(--fg); }
.warmup-inputs { display: flex; align-items: end; flex-wrap: wrap; gap: .55rem .9rem; }
.warmup-inputs.is-hidden { display: none; }
.exercise-warmup input[type="checkbox"] { width: auto; min-height: 0; margin: 0 .2rem 0 0; accent-color: var(--accent); }
.exercise-warmup input[type="number"] { width: 86px; min-height: 34px; padding: .3rem .45rem; border-radius: 8px; font-size: .82rem; text-align: center; }
.warmup-target > span, .warmup-weight > span { color: var(--muted); font-size: .68rem; font-weight: 750; letter-spacing: .055em; text-align: center; text-transform: uppercase; }
.warmup-target .target-control { grid-template-columns: 118px 88px; }
.warmup-target .target-control:has(.warmup-target-unit:not(:empty)) { grid-template-columns: 118px 88px 28px; }
.warmup-target .target-control select, .warmup-target .target-control input { min-height: 34px; height: 34px; padding-top: .25rem; padding-bottom: .25rem; font-size: .82rem; line-height: 1.2; }
.warmup-target .target-control input { width: 100%; }
.warmup-target-unit { margin-left: .35rem; color: var(--muted); font-size: .72rem; }
.warmup-weight.is-hidden { display: none; }
.exercise-warmup .field-hint { margin: 0 0 .3rem; font-size: .74rem; }
.target-control { display: grid; grid-template-columns: minmax(70px, .95fr) minmax(58px, .7fr); align-items: center; }
.target-control:has(.target-unit:not(:empty)) { grid-template-columns: minmax(70px, .95fr) minmax(58px, .7fr) 28px; }
.target-select { position: relative; min-width: 0; }
.target-control select { width: 100%; appearance: none; border-radius: 9px 0 0 9px; padding-right: 2rem; }
.target-chevron { position: absolute; top: 50%; right: .8rem; width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); pointer-events: none; transform: translateY(-70%) rotate(45deg); }
.target-control input { border-left: 0; border-radius: 0 9px 9px 0; }
.target-unit { margin-left: .35rem; color: var(--muted); font-size: .72rem; }
.load-field.is-hidden { visibility: hidden; pointer-events: none; }
.exercise-actions { display: grid; grid-template-rows: 1em 42px; align-self: stretch; gap: .3rem; padding-left: 0; }
.exercise-actions > span { min-height: 1em; color: var(--muted); font-size: .68rem; font-weight: 750; letter-spacing: .055em; text-align: center; text-transform: uppercase; }
.btn-icon.remove-exercise { align-self: end; box-sizing: border-box; width: 100%; height: 42px; padding: 0 .65rem; border: 1px solid rgba(241, 92, 109, .34); border-radius: 9px; background: rgba(241, 92, 109, .08); font-size: .76rem; font-weight: 700; }
.btn-icon.remove-exercise:hover { border-color: rgba(241, 92, 109, .65); }
.btn-danger-outline { display: inline-flex; align-items: center; justify-content: center; box-sizing: border-box; min-height: 34px; padding: .38rem .75rem; border: 1px solid rgba(241, 92, 109, .42); border-radius: var(--radius-sm); background: rgba(241, 92, 109, .08); color: var(--danger); font-size: .84rem; font-weight: 700; cursor: pointer; transition: background .15s ease, border-color .15s ease; }
.btn-danger-outline:hover { border-color: rgba(241, 92, 109, .7); background: rgba(241, 92, 109, .15); }
.add-ex-btn { margin: 0 1.35rem 1.25rem; min-height: 40px; padding-inline: .9rem; border-radius: 10px; }

body.picker-open { overflow: hidden; }
.exercise-picker { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: 1rem; }
.exercise-picker[hidden] { display: none; }
.picker-backdrop { position: absolute; inset: 0; width: 100%; border: 0; background: rgba(2, 7, 12, .75); cursor: default; }
.picker-dialog { position: relative; display: flex; flex-direction: column; width: min(600px, 100%); max-height: min(680px, calc(100vh - 2rem)); padding: 1.5rem; border: 1px solid var(--border); border-radius: 18px; background: var(--card); box-shadow: 0 24px 80px rgba(0, 0, 0, .45); }
.picker-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.picker-header h2 { font-size: 1.25rem; }
.picker-context { margin: -.35rem 0 .85rem; }
.picker-close { width: 36px; height: 36px; border: 1px solid var(--border); border-radius: 50%; background: var(--surface); color: var(--fg); font-size: 1.3rem; cursor: pointer; }
.picker-search-label { margin-bottom: .4rem; }
#exercise-search { flex: 0 0 auto; }
.picker-results { display: grid; gap: .35rem; min-height: 140px; margin-top: .75rem; overflow-y: auto; overscroll-behavior: contain; }
.picker-result { width: 100%; padding: .8rem .9rem; border: 1px solid transparent; border-radius: 10px; background: var(--surface); color: var(--fg); font: inherit; text-align: left; cursor: pointer; }
.picker-result:hover, .picker-result:focus { border-color: var(--accent); background: rgba(47, 129, 247, .11); outline: none; }
.picker-empty { padding: 2rem 1rem; color: var(--muted); text-align: center; }

/* Buttons */
.btn-sm {
  min-height: 34px;
  padding: .38rem .75rem;
  font-size: .84rem;
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .45rem .7rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  transition: color .15s, border-color .15s;
}

.btn-ghost:hover {
  color: var(--accent-strong);
  border-color: var(--accent);
}

.add-ex-btn { margin-top: .25rem; }

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  font-size: .8rem;
  transition: background .15s, color .15s;
}

.btn-icon.btn-danger {
  color: var(--danger);
}

.btn-icon.btn-danger:hover {
  background: rgba(241, 92, 109, .15);
  border-color: rgba(241, 92, 109, .35);
}

/* Save status feedback */
.plan-save-status {
  font-size: .84rem;
  font-weight: 600;
  transition: opacity .3s;
}

.plan-save-status.success { color: var(--success); }
.plan-save-status.danger  { color: var(--danger); }

/* Add-on toggle */
.btn-addon-toggle {
  display: inline-flex;
  align-items: center;
  padding: .25rem .6rem;
  border-radius: var(--radius-sm);
  font-size: .75rem;
  font-weight: 700;
  cursor: pointer;
  transition: all .2s;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  margin-left: auto;
}

.btn-addon-toggle.is-addon {
  background: transparent;
  color: var(--muted);
  border: 1px dashed var(--border);
}

.btn-addon-toggle.is-addon:hover {
  color: var(--accent);
  border-color: var(--accent);
}

/* History rows */
tr.from-history td {
  background: rgba(33, 150, 243, 0.05);
}

tr.from-history td:first-child::before {
  content: "From history";
  position: absolute;
  top: -6px;
  left: 6px;
  font-size: 0.6rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--surface);
  padding: 0 4px;
  border-radius: 2px;
}

.plan-exercise-table td { position: relative; }

@media (max-width: 640px) {
  .onboarding-steps li { padding: .55rem; }
  .onboarding-steps li div { display: none; }
  .onboarding-steps li { justify-content: center; }
  .choice-grid,
  .form-grid.two { grid-template-columns: 1fr; }
  .onboarding-submit { position: static; align-items: stretch; flex-direction: column; }
  .onboarding-submit .btn { width: 100%; }
  .plan-templates-heading { align-items: flex-start; flex-direction: column; }
  .add-session-panel { align-items: stretch; flex-direction: column; }
  .add-session-form { min-width: 0; width: 100%; }
  .add-session-form > div { flex-direction: column; }
  .add-session-form .btn-secondary { width: 100%; }
  .plan-template-header { flex-direction: column; align-items: flex-start; }
  .proposal-footer { align-items: flex-start; flex-direction: column; }
  .proposal-footer form { width: 100%; }
  .proposal-footer form .btn,
  .proposal-footer form .btn-secondary { justify-content: center; width: 100%; }
  .btn-addon-toggle { margin-left: 0; margin-top: .5rem; }
  .exercise-list { padding: .85rem; }
  .exercise-row { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
  .exercise-identity { grid-column: 1 / -1; }
  .target-field { grid-column: 1 / -1; }
  .load-field.is-hidden { display: none; }
  .exercise-actions { grid-column: 1 / -1; padding-left: 0; }
  .remove-exercise { position: static; width: 100%; }
  .exercise-row { position: relative; }
  .add-ex-btn { margin: 0 .85rem .9rem; }
  .picker-dialog { padding: 1rem; }
}

@media (min-width: 641px) and (max-width: 1050px) {
  .exercise-row { grid-template-columns: minmax(180px, 2fr) 70px minmax(150px, 1.1fr) 95px 75px 90px; }
}

