:root {
  --ink: #172033;
  --muted: #6b7280;
  --paper: #f4f7f3;
  --card: #ffffff;
  --line: #e5e9e3;
  --navy: #111827;
  --lime: #c9f31d;
  --lime-dark: #89a900;
  --coral: #ff735c;
  --blood: #ff0000;
  --blue: #5b8def;
  --monthly-fit: #087f8c;
  --monthly-start: #123b4a;
  --monthly-end: #087f8c;
  --monthly-rgb: 8,127,140;
  --monthly-contrast: #ffffff;
  --radius: 24px;
  --shadow: 0 18px 45px rgba(23, 32, 51, .08);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(1.7rem, 4vw, 2.5rem); letter-spacing: -.045em; }
h2 { letter-spacing: -.035em; }
h3 { margin-bottom: 6px; }

.setup-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 15% 20%, rgba(201,243,29,.22), transparent 28rem),
    radial-gradient(circle at 90% 80%, rgba(91,141,239,.14), transparent 30rem),
    var(--paper);
}
.auth-card {
  width: min(100%, 440px);
  padding: 34px;
  border: 1px solid rgba(255,255,255,.9);
  border-radius: 30px;
  background: rgba(255,255,255,.88);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}
.auth-card h1 { margin-bottom: 12px; }
.auth-card > p:not(.eyebrow) { color: var(--muted); line-height: 1.6; }
#login-form > label + label { margin-top: 10px; }
.login-page { padding: clamp(18px, 4vw, 56px); }
.login-shell {
  width: min(1180px, 100%);
  min-height: min(760px, calc(100vh - 48px));
  display: grid;
  grid-template-columns: minmax(330px, .82fr) minmax(0, 1.18fr);
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.92);
  border-radius: 34px;
  background: white;
  box-shadow: 0 28px 80px rgba(23,32,51,.16);
}
.login-card {
  width: 100%;
  max-width: none;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(38px, 6vw, 76px);
  border: 0;
  border-radius: 0;
  background: rgba(255,255,255,.97);
  box-shadow: none;
  backdrop-filter: none;
}
.login-card h1 { max-width: 390px; margin-bottom: 34px; }
.login-card .brand-avatar { width: 76px; height: 76px; border-radius: 50%; object-fit: cover; }
.login-visual {
  position: relative;
  min-height: 560px;
  overflow: hidden;
  background: #0eb3a8;
}
.login-visual::before {
  content: "";
  position: absolute;
  z-index: 1;
  inset: 0 auto 0 0;
  width: 22%;
  background: linear-gradient(90deg, rgba(17,24,39,.3), transparent);
  pointer-events: none;
}
.login-visual img { width: 100%; height: 100%; display: block; object-fit: cover; object-position: center; }
.login-visual-brand {
  position: absolute;
  z-index: 2;
  right: 30px;
  bottom: 28px;
  display: grid;
  gap: 4px;
  max-width: 330px;
  padding: 15px 18px;
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 18px;
  background: rgba(17,24,39,.72);
  color: white;
  box-shadow: 0 12px 35px rgba(0,0,0,.18);
  backdrop-filter: blur(10px);
}
.login-visual-brand strong { font-size: 1.1rem; }
.login-visual-brand > span { color: rgba(255,255,255,.78); font-size: .78rem; line-height: 1.4; }
.brand-fit { color: var(--monthly-fit); }
.brand-kicker { color: var(--ink); font-size: 1.08rem; letter-spacing: -.015em; text-transform: none; }
.modal-brand { color: var(--ink); font-size: .9rem; letter-spacing: -.01em; text-transform: none; }
.login-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}
.brand-mark {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  margin-bottom: 22px;
  border-radius: 18px;
  background: var(--navy);
  color: var(--lime);
  font-weight: 900;
  letter-spacing: -.06em;
  transform: rotate(-4deg);
}
.brand-mark.small { width: 40px; height: 40px; margin: 0; border-radius: 13px; font-size: .82rem; }
.brand-avatar {
  width: 68px;
  height: 68px;
  display: block;
  margin-bottom: 22px;
  border-radius: 22px;
  object-fit: contain;
  filter: drop-shadow(0 8px 16px rgba(17,24,39,.16));
}
.brand-avatar.small { width: 42px; height: 42px; margin: 0; border-radius: 14px; }
#sidebar-avatar { border-radius: 50%; object-fit: cover; }

label { display: grid; gap: 7px; color: var(--ink); font-size: .82rem; font-weight: 750; }
input, textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fbfcfa;
  color: var(--ink);
  outline: none;
  padding: 12px 13px;
  transition: border .2s, box-shadow .2s;
}
textarea { min-height: 90px; resize: vertical; }
input:focus, textarea:focus, select:focus { border-color: var(--lime-dark); box-shadow: 0 0 0 3px rgba(201,243,29,.2); }
.stack { display: grid; gap: 15px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid .wide { grid-column: 1 / -1; }
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 16px;
  border: 0;
  border-radius: 13px;
  text-decoration: none;
  font-weight: 800;
}
.button.primary { background: var(--navy); color: white; }
.button.primary:hover { background: #24314a; }
.button.accent { background: var(--lime); color: var(--navy); }
.hero .button.accent { background: var(--monthly-fit); color: var(--monthly-contrast); }
.button.ghost { border: 1px solid var(--line); background: white; color: var(--ink); }
.button.danger { background: #fff0ed; color: #b83220; }
.button.small { min-height: 36px; padding: 7px 11px; font-size: .8rem; }
.form-error, .alert.error { color: #b83220; }
#login-error { min-height: 1.2em; text-align: center; }
.alert { padding: 12px 14px; border-radius: 12px; background: #f0f7ff; }
.alert.error { background: #fff0ed; }
.membership-expiry-banner {
  margin: 0 0 14px;
  padding: 8px 12px;
  border-radius: 11px;
  background: #b42318;
  color: white;
  font-size: .84rem;
  font-weight: 850;
  line-height: 1.35;
  box-shadow: 0 10px 26px rgba(180,35,24,.18);
}

.app-shell { min-height: 100vh; }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  width: 230px;
  display: flex;
  flex-direction: column;
  padding: 24px 18px;
  background: linear-gradient(145deg, var(--monthly-start), var(--monthly-end));
  color: white;
}
.brand { display: flex; align-items: center; gap: 12px; margin: 0 8px 34px; font-size: 1.2rem; font-weight: 900; }
.nav-list { display: grid; gap: 6px; }
.nav-button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 13px;
  border: 0;
  border-radius: 13px;
  background: transparent;
  color: #aab2c2;
  font-weight: 700;
  text-align: left;
}
.nav-button:hover, .nav-button.active { background: rgba(255,255,255,.08); color: white; }
.nav-button.active .nav-icon { color: var(--monthly-fit); }
.nav-icon { width: 22px; font-size: 1.1rem; text-align: center; }
.sidebar-footer { display: grid; gap: 3px; margin-top: auto; }
.sidebar-copyright {
  margin: 12px 13px 0;
  color: rgba(255,255,255,.62);
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .035em;
}
.app-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin-top: 42px;
  padding: 18px 12px 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: .75rem;
  text-align: center;
}
.app-footer strong { color: var(--ink); }
.app-footer-mark { color: var(--monthly-fit); font-size: .9rem; }
.environment-corner {
  position: fixed;
  z-index: 300;
  top: 0;
  left: 0;
  width: 76px;
  height: 76px;
  overflow: hidden;
  pointer-events: none;
}
.environment-corner::before {
  content: "";
  position: absolute;
  inset: 0;
  background: #e19a18;
  clip-path: polygon(0 0, 100% 0, 0 100%);
  filter: drop-shadow(0 5px 8px rgba(17,24,39,.2));
}
.environment-corner span {
  position: absolute;
  top: 14px;
  left: 5px;
  width: 56px;
  color: white;
  font-size: .65rem;
  font-weight: 950;
  letter-spacing: .09em;
  text-align: center;
  text-shadow: 0 1px 3px rgba(0,0,0,.22);
  transform: rotate(-45deg);
}
.environment-corner-dev::before { background: #b64fc8; }
.environment-corner-test::before { background: #e19a18; }
.main-content { min-height: 100vh; margin-left: 230px; padding: 32px clamp(22px, 4vw, 58px) 70px; }
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 30px; }
.topbar-mobile-avatar { display: none; width: 42px; height: 42px; flex: 0 0 42px; border-radius: 50%; object-fit: cover; filter: drop-shadow(0 7px 14px rgba(17,24,39,.13)); }
.avatar-button, .icon-button {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  color: var(--ink);
  font-weight: 900;
}
.profile-wrap { position: relative; }
.profile-menu {
  position: absolute;
  z-index: 80;
  top: calc(100% + 10px);
  right: 0;
  width: 190px;
  display: grid;
  gap: 5px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: white;
  box-shadow: var(--shadow);
}
.profile-menu .nav-button { color: var(--ink); }
.profile-menu .nav-button:hover { background: #f2f5ef; color: var(--ink); }
.icon-button { width: 38px; height: 38px; font-size: 1.4rem; }
.menu-button svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.mobile-nav { display: none; }

.hero {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: 1.2fr .8fr;
  gap: 24px;
  min-height: 240px;
  padding: clamp(24px, 4vw, 42px);
  border-radius: 30px;
  background: var(--navy);
  color: white;
}
.hero::after {
  content: "";
  position: absolute;
  z-index: 1;
  inset: 0;
  background: linear-gradient(
    90deg,
    rgba(17,24,39,.92) 0%,
    transparent 38%,
    transparent 70%,
    rgba(17,24,39,.58) 100%
  );
  pointer-events: none;
}
.hero-content { position: relative; z-index: 2; }
.hero-backdrop {
  position: absolute;
  z-index: 0;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  opacity: .72;
  pointer-events: none;
}
.hero .eyebrow { color: var(--monthly-fit); }
.hero h2 { max-width: 600px; margin-bottom: 12px; font-size: clamp(1.8rem, 4vw, 3rem); }
.hero p { max-width: 580px; color: #bfc6d3; line-height: 1.6; }
.hero .workout-details { color: #ffffff; }
.xp-orb {
  position: relative;
  z-index: 2;
  align-self: center;
  justify-self: center;
  width: 150px;
  height: 150px;
  display: grid;
  place-items: center;
  border: 2px solid var(--monthly-fit);
  border-radius: 50%;
  background: rgba(var(--monthly-rgb), .7);
  text-align: center;
}
.xp-orb strong { display: block; color: var(--lime); font-size: 2.3rem; line-height: 1; }
.xp-orb .xp-total-number { color: var(--monthly-contrast); }
.xp-orb span { color: var(--monthly-contrast); font-size: .75rem; font-weight: 800; letter-spacing: .12em; }
.grid { display: grid; gap: 18px; }
.grid.stats { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-top: 18px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 18px; }
.dashboard-actions-grid { grid-template-columns: minmax(250px, .65fr) minmax(0, 1.35fr); align-items: start; margin-top: 18px; }
.card {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: 0 10px 30px rgba(23,32,51,.035);
}
.stat-card { min-height: 142px; }
.weight-stat-card { padding-bottom: 12px; }
.weight-stat-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.weight-stat-card .stat-icon { margin-bottom: 8px; }
.weight-chart { width: 100%; height: 56px; display: block; margin-top: 5px; overflow: visible; }
.weight-chart-empty { margin-top: 12px; color: var(--muted); font-size: .7rem; line-height: 1.35; }
.weight-trend { flex: 0 0 auto; padding: 5px 7px; border-radius: 999px; font-size: .66rem; font-weight: 850; }
.weight-trend.down { background: #eaf8be; color: #526900; }
.weight-trend.up { background: #fff2cc; color: #8a5d00; }
.weight-trend.neutral { background: #eef1ed; color: #4b5563; }
.quick-actions-card { align-self: start; padding: 17px 18px; }
.quick-actions-card .card-header { margin-bottom: 12px; }
.quick-actions-card .action-row { gap: 7px; }
.quick-actions-card .button { padding: 9px 11px; font-size: .76rem; }
.stat-icon { margin-bottom: 18px; font-size: 1.4rem; }
.stat-value { margin-bottom: 4px; font-size: 1.45rem; font-weight: 900; letter-spacing: -.04em; }
.stat-label { color: var(--muted); font-size: .78rem; font-weight: 700; }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.card-header h2 { margin: 0; font-size: 1.15rem; }
.action-row { display: flex; flex-wrap: wrap; gap: 9px; }
.button.tiny { min-height: 28px; padding: 5px 8px; font-size: .66rem; }
.exercise-media-view { display: grid; place-items: center; min-height: 220px; }
.exercise-media-view img, .exercise-media-view video { max-width: 100%; max-height: 58vh; border-radius: 16px; object-fit: contain; }
.exercise-media-view video { width: min(100%, 720px); background: #111827; }
.exercise-catalog-card .exercise-card-metrics { margin-top: 18px; }
.exercise-catalog-card .exercise-card-history { margin-top: 18px; }
.exercise-catalog-card .exercise-card-actions { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.exercise-catalog-card-warmup { border-color: #f2c76f; background: linear-gradient(145deg, #fffaf0, #fff3cf); }
.exercise-catalog-card-warmup .stat-icon, .exercise-catalog-card-warmup h2 { color: #9a5b00; }
.exercise-catalog-card-warmup .badge { background: #f7d98f; color: #714100; }
.exercise-catalog-card-cooldown { border-color: #8ecde3; background: linear-gradient(145deg, #f2fbff, #dff4fb); }
.exercise-catalog-card-cooldown .stat-icon, .exercise-catalog-card-cooldown h2 { color: #176987; }
.exercise-catalog-card-cooldown .badge { background: #bde7f4; color: #12566e; }
.exercise-catalog-card-special { border-color: #d9ad45; background: linear-gradient(145deg, #fffaf0, #f8e5af); }
.exercise-catalog-card-special .stat-icon, .exercise-catalog-card-special h2 { color: #855500; }
.exercise-catalog-card-special .badge { background: #e9c76f; color: #694200; }
.button.special-button { border-color: #c99a2e; background: linear-gradient(135deg, #f4d77e, #d9a936); color: #513300; box-shadow: 0 7px 18px rgba(184,130,18,.2); }
.button.special-button:hover { border-color: #ad7d13; background: linear-gradient(135deg, #f8df91, #cf9827); }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.toolbar-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.segmented { display: flex; padding: 4px; border: 1px solid var(--line); border-radius: 13px; background: white; }
.segmented button { padding: 8px 12px; border: 0; border-radius: 9px; background: transparent; font-weight: 750; }
.segmented button.active { background: var(--navy); color: white; }

.list { display: grid; gap: 10px; }
.list-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 15px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: white;
}
.date-chip { min-width: 58px; padding: 9px; border-radius: 13px; background: #f2f5ef; text-align: center; }
.date-chip strong { display: block; font-size: 1.3rem; line-height: 1; }
.date-chip span { color: var(--muted); font-size: .7rem; font-weight: 800; text-transform: uppercase; }
.list-title { margin-bottom: 4px; font-weight: 850; }
.list-meta { color: var(--muted); font-size: .78rem; }
.badge {
  min-height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 9px;
  border-radius: 999px;
  background: #eef1ed;
  color: #4b5563;
  font-size: .68rem;
  font-weight: 850;
  line-height: 1;
  text-align: center;
  text-transform: uppercase;
  vertical-align: middle;
}
.badge.completed, .badge.unlocked { background: #eaf8be; color: #526900; }
.badge.partial, .badge.modified { background: #fff2cc; color: #8a5d00; }
.badge.missed, .badge.skipped { background: #ffe7e2; color: #a73321; }
.badge.redeemed { background: #e5edff; color: #345aab; }
.empty { padding: 38px 20px; border: 1px dashed #cfd5cc; border-radius: var(--radius); color: var(--muted); text-align: center; }

.calendar-head, .calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 7px; }
.calendar-head { margin-bottom: 8px; color: var(--muted); font-size: .72rem; font-weight: 800; text-align: center; }
.calendar-day {
  min-height: 105px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: white;
}
.calendar-day.outside { opacity: .4; }
.calendar-day.today { border-color: var(--lime-dark); box-shadow: inset 0 0 0 1px var(--lime-dark); }
.calendar-number { margin-bottom: 7px; font-size: .78rem; font-weight: 850; }
.calendar-event { width: 100%; display: block; overflow: hidden; margin-top: 4px; padding: 5px 6px; border: 0; border-radius: 7px; background: #edf2ff; color: var(--ink); font-size: .66rem; font-weight: 800; text-align: left; text-overflow: ellipsis; white-space: nowrap; }
.calendar-event.completed { background: #eaf8be; }
.calendar-event.partial { background: #fff2cc; }
.calendar-event.missed { background: #ffe7e2; }
.calendar-week .calendar-day { min-height: 210px; }
.calendar-week .week-row { display: contents; }
.challenge-alert {
  border-color: rgba(91,141,239,.35);
  background: linear-gradient(135deg, #eaf0ff, #f4ecff);
}
.challenge-alert .list-item { background: rgba(255,255,255,.75); }
.settings-group {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fbfcfa;
}
.settings-group summary {
  padding: 17px 19px;
  cursor: pointer;
  font-weight: 850;
  list-style: none;
}
.settings-group summary::-webkit-details-marker { display: none; }
.settings-group summary::after { content: "＋"; float: right; }
.settings-group[open] summary::after { content: "−"; }
.settings-group-content { padding: 0 18px 18px; }
.exercise-achievement-setting { padding: 14px; border: 1px solid var(--line); border-radius: 15px; background: white; }
.exercise-achievement-setting .card-header { align-items: flex-start; margin-bottom: 12px; }
.exercise-achievement-setting h3 { margin: 0 0 4px; }
.merge-preview { display: grid; gap: 12px; }
.merge-preview .alert { display: grid; gap: 7px; }

.progress { height: 8px; overflow: hidden; border-radius: 999px; background: #edf0eb; }
.progress > span { display: block; height: 100%; border-radius: inherit; background: var(--lime-dark); }
.reward-card { position: relative; overflow: hidden; }
.reward-card.redeemed { opacity: .62; }
.reward-cover { width: calc(100% + 44px); height: 170px; margin: -22px -22px 20px; object-fit: cover; background: #f2f5ef; }
.reward-xp-summary { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 7px 14px; }
.reward-xp-summary span { color: var(--muted); font-size: .76rem; font-weight: 750; }
.metric-table { width: 100%; border-collapse: collapse; }
.metric-table th, .metric-table td { padding: 11px 8px; border-bottom: 1px solid var(--line); text-align: left; font-size: .82rem; }
.metric-table th { color: var(--muted); font-size: .7rem; text-transform: uppercase; }

.modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(8,14,26,.62); backdrop-filter: blur(5px); }
.modal-card {
  position: relative;
  width: min(780px, 100%);
  height: 70vh;
  max-height: 70vh;
  overflow-y: auto;
  padding: 24px;
  border-radius: 26px;
  background: var(--card);
  box-shadow: 0 30px 80px rgba(0,0,0,.25);
  scrollbar-gutter: stable;
}
.check-row {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 44px;
}
.check-row input { width: auto; margin: 0; }
.notification-options { gap: 6px; }
.notification-options .check-row {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  justify-content: start;
  min-height: 34px;
}
.notification-options .check-row input { justify-self: center; }
.emergency-check { display: grid; align-self: end; height: 44px; grid-template-columns: auto 1fr; justify-content: start; }
.modal-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.modal-header h2 { margin: 0; }
.modal-header .icon-button { flex: 0 0 38px; display: inline-flex; align-items: center; justify-content: center; padding: 0 0 2px; line-height: 1; }
.exercise-editor { display: grid; gap: 12px; padding: 15px; border: 1px solid var(--line); border-radius: 16px; background: #f9faf8; }
.exercise-editor .exercise-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.exercise-editor-body { display: grid; gap: 12px; }
.exercise-editor.collapsed .exercise-editor-body { display: none; }
.exercise-name-picker { position: relative; }
.exercise-name-menu {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  z-index: 80;
  max-height: 260px;
  overflow: auto;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: white;
  box-shadow: 0 18px 45px rgba(17,24,39,.18);
}
.exercise-name-menu button {
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-weight: 750;
  text-align: left;
  cursor: pointer;
}
.exercise-name-menu button:hover,
.exercise-name-menu button:focus { background: #eef4ff; color: var(--blue); outline: none; }
.exercise-name-empty { padding: 10px 12px; color: var(--muted); font-size: .9rem; }
.exercise-catalog-card { position: relative; }
.exercise-catalog-card .card-header { padding-right: 38px; }
.exercise-recent-edit {
  position: absolute;
  z-index: 2;
  top: 12px;
  right: 12px;
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 50%;
  background: #fff0ee;
  color: #d92d20;
  font-size: 1.15rem;
  font-weight: 900;
  box-shadow: 0 5px 16px rgba(217,45,32,.16);
}
.exercise-recent-edit.merged { right: 12px; background: #fff0ee; }
.exercise-recent-edit.merged.below { top: 50px; }
.assignment-picker { overflow: visible; border: 1px solid var(--line); border-radius: 14px; background: #fbfcfa; }
.assignment-picker summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  cursor: pointer;
  color: var(--ink);
  font-size: .82rem;
  font-weight: 750;
  list-style: none;
}
.assignment-picker summary::-webkit-details-marker { display: none; }
.assignment-picker-panel { display: grid; gap: 10px; padding: 0 10px 10px; }
.assignment-picker-panel input[type="search"] { background: white; }
.assignment-users {
  display: grid;
  max-height: 190px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
}
.assignment-users .check-row { grid-template-columns: 20px minmax(0, 1fr); min-height: 42px; padding: 9px 11px; border-bottom: 1px solid #eef1ec; }
.assignment-users .check-row:last-child { border-bottom: 0; }
.assignment-users .check-row:hover { background: #f4f7f3; }
.assignment-empty { margin: 2px 4px 4px; }
.avatar-settings-card { display: flex; align-items: center; justify-content: space-between; gap: 22px; }
.avatar-settings-preview { display: flex; align-items: center; gap: 16px; }
.avatar-settings-preview img { width: 82px; height: 82px; border-radius: 50%; object-fit: cover; background: #eef3ea; }
.avatar-settings-preview h2 { margin: 0 0 5px; }
.avatar-crop-stage { width: min(100%, 294px); margin-inline: auto; overflow: hidden; border-radius: 50%; background: #edf2ea; box-shadow: inset 0 0 0 1px var(--line); }
.avatar-crop-stage canvas { display: block; width: 100%; height: auto; cursor: grab; touch-action: none; user-select: none; }
.avatar-crop-stage canvas.dragging { cursor: grabbing; }
.exercise-sort-control { display: flex; align-items: center; gap: 8px; margin: 0; font-size: .78rem; }
.exercise-sort-control select { min-width: 150px; padding-block: 9px; }
.exercise-last-performance { margin-top: 4px; line-height: 1.6; }
.model-update-item { cursor: pointer; }
.model-update-item > input { width: 19px; height: 19px; }
.exercise-summary { display: flex; align-items: center; gap: 9px; min-width: 0; color: var(--navy); text-align: left; }
.exercise-summary strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.exercise-toggle-button { width: 38px; min-width: 38px; height: 28px; display: inline-grid; place-items: center; padding: 0; line-height: 0; }
.exercise-summary-chevron { display: block; width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.25; stroke-linecap: round; stroke-linejoin: round; transform-origin: center; transition: transform .2s ease; }
.exercise-editor:not(.collapsed) .exercise-summary-chevron { transform: rotate(180deg); }
.exercise-order-button { width: 38px; min-width: 38px; padding-inline: 0; }
.exercise-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.guided-modal-card { width: min(920px, 100%); }
.guided-workout { gap: 20px; }
.guided-toolbar, .guided-exercise-heading, .guided-footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.guided-top-actions { display: flex; align-items: center; gap: 10px; }
.guided-toolbar h3, .guided-exercise-heading h2 { margin: 8px 0 0; }
.guided-progress { height: 10px; }
.guided-progress-label { margin: -10px 0 0; text-align: right; font-size: .76rem; }
.guided-exercise-card, .guided-results { display: grid; gap: 18px; padding: 22px; border: 1px solid var(--line); border-radius: 20px; background: #f9faf8; }
.guided-media { width: 100%; max-height: 300px; border-radius: 18px; object-fit: contain; background: #111827; }
.guided-media-placeholder {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px dashed var(--line);
  border-radius: 16px;
  background: white;
  color: var(--muted);
  font-size: .86rem;
  font-weight: 800;
}
.guided-targets { display: flex; flex-wrap: wrap; gap: 10px; }
.guided-target { padding: 10px 13px; border-radius: 12px; background: white; border: 1px solid var(--line); font-weight: 850; }
.guided-pause-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.guided-inline-timer { min-width: 96px; padding: 10px 16px; border-radius: 12px; background: var(--navy); color: white; font-size: 1.3rem; font-weight: 900; text-align: center; font-variant-numeric: tabular-nums; }
.guided-duration-timer { background: var(--blue); }
.guided-duration-controls .button { border-color: rgba(37, 99, 235, .22); color: var(--blue); }
.guided-recovery { min-height: 420px; place-content: center; justify-items: center; text-align: center; }
.guided-recovery h2 { margin: 0; }
.guided-recovery-clock { font-size: clamp(4rem, 16vw, 8rem); font-weight: 950; line-height: 1; color: var(--lime-dark); font-variant-numeric: tabular-nums; }
.guided-notes { padding: 18px; border-radius: 16px; background: #f4f7f3; white-space: pre-wrap; line-height: 1.7; }
.guided-navigation { display: flex; gap: 9px; }
.guided-arrow {
  flex: 0 0 48px;
  width: 48px;
  min-width: 48px;
  height: 44px;
  min-height: 44px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  background: white;
  color: var(--navy);
  line-height: 0;
}
.guided-arrow-icon { display: block; width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.25; stroke-linecap: round; stroke-linejoin: round; transform-origin: center; }
.guided-arrow-icon.right { transform: scaleX(-1); }
.guided-arrow:disabled { border-color: var(--line); background: #f2f5ef; color: #a4aaae; opacity: 1; }
.divider { height: 1px; margin: 20px 0; background: var(--line); }
.toast {
  position: fixed;
  z-index: 200;
  right: 20px;
  bottom: 20px;
  max-width: 360px;
  padding: 13px 16px;
  border-radius: 13px;
  background: var(--navy);
  color: white;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: .22s;
}
.toast.show { opacity: 1; transform: translateY(0); }
@media (max-width: 1040px) {
  .grid.stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-actions-grid { grid-template-columns: minmax(230px, .8fr) minmax(0, 1.2fr); }
}
@media (max-width: 760px) {
  body { padding-bottom: env(safe-area-inset-bottom); }
  .login-page { display: block; min-height: 100vh; padding: 0; background: var(--paper); }
  .login-shell { min-height: 100vh; grid-template-columns: 1fr; grid-template-rows: 230px 1fr; border: 0; border-radius: 0; box-shadow: none; }
  .login-visual { grid-row: 1; min-height: 230px; }
  .login-visual::before { inset: auto 0 0; width: auto; height: 45%; background: linear-gradient(0deg, rgba(17,24,39,.35), transparent); }
  .login-visual img { object-position: center 34%; }
  .login-visual-brand { right: 16px; bottom: 14px; padding: 10px 13px; border-radius: 13px; }
  .login-visual-brand > span { display: none; }
  .login-card { grid-row: 2; justify-content: flex-start; padding: 30px 22px calc(36px + env(safe-area-inset-bottom)); }
  .login-card h1 { margin-bottom: 28px; }
  .login-card .brand-avatar { width: 58px; height: 58px; margin-bottom: 16px; }
  .sidebar { display: none; }
  .main-content { margin: 0; padding: 24px 16px 96px; }
  .app-footer { margin-top: 32px; padding-bottom: 10px; font-size: .7rem; }
  .topbar { margin-bottom: 22px; }
  .topbar { display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; gap: 12px; }
  .topbar-mobile-avatar { display: block; }
  .mobile-nav {
    position: fixed;
    inset: auto 10px calc(10px + env(safe-area-inset-bottom)) 10px;
    z-index: 50;
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    padding: 7px;
    border: 1px solid rgba(255,255,255,.14);
    border-radius: 20px;
    background: linear-gradient(100deg, var(--monthly-start), var(--monthly-end));
    box-shadow: 0 15px 50px rgba(0,0,0,.24);
    backdrop-filter: blur(15px);
  }
  .mobile-nav .nav-button { display: grid; justify-items: center; gap: 3px; padding: 7px 2px; font-size: .62rem; text-align: center; }
  .mobile-nav .nav-button.active {
    background: rgba(255,255,255,.92);
    color: var(--monthly-start);
    box-shadow: 0 8px 22px rgba(0,0,0,.16);
  }
  .mobile-nav .nav-button.active .nav-icon { color: var(--monthly-start); }
  .mobile-nav .nav-button:active { transform: translateY(1px); }
  .mobile-nav .nav-icon { width: auto; }
  .hero { grid-template-columns: 1fr; min-height: 320px; }
  .hero-backdrop { object-position: 61% center; opacity: .62; }
  .xp-orb { width: 120px; height: 120px; justify-self: start; }
  .grid.stats, .grid.two, .dashboard-actions-grid { grid-template-columns: 1fr; }
  .avatar-settings-card { align-items: flex-start; flex-direction: column; }
  .toolbar { align-items: stretch; flex-direction: column; }
  .toolbar-actions .button { flex: 1; }
  .calendar-day { min-height: 74px; padding: 5px; border-radius: 9px; }
  .calendar-week {
    display: block;
  }
  .calendar-week .week-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 8px;
  }
  .calendar-week .week-row-last {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-bottom: 0;
  }
  .calendar-week .calendar-day {
    min-height: 130px;
    padding: 9px;
  }
  .calendar-week .calendar-event {
    padding: 5px 4px;
    font-size: .68rem;
    white-space: normal;
  }
  .calendar-week .calendar-event::before { content: none; }
  .calendar-event { padding: 4px 3px; font-size: 0; }
  .calendar-event::before { content: "•"; color: var(--blue); font-size: .9rem; }
  .calendar-event.completed::before { color: var(--lime-dark); }
  .form-grid, .exercise-grid { grid-template-columns: 1fr 1fr; }
  .exercise-editor .exercise-top { align-items: flex-start; flex-direction: column; }
  .exercise-editor .exercise-top > .action-row { width: 100%; flex-wrap: wrap; }
  .guided-toolbar, .guided-exercise-heading { align-items: flex-start; }
  .guided-top-actions { align-items: stretch; flex-wrap: wrap; justify-content: flex-end; }
  .guided-media-placeholder { align-items: stretch; flex-direction: column; text-align: center; }
  .guided-pause-controls { justify-content: center; text-align: center; }
  .guided-pause-controls .button { width: 100%; justify-content: center; }
  .guided-inline-timer { margin-inline: auto; }
  .guided-footer > .button { flex: 1; }
  .modal { align-items: center; padding: 14px; }
  .modal-card { width: 100%; height: 70vh; max-height: 70vh; padding: 21px 16px calc(22px + env(safe-area-inset-bottom)); border-radius: 24px; }
  .list-item { grid-template-columns: auto 1fr; }
  .list-item > .action-row, .list-item > .badge { grid-column: 2; justify-self: start; }
  .metric-table { display: block; overflow-x: auto; }
}
