:root {
  --vine-login-left: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20240%20480%22%20fill%3D%22none%22%3E%0A%3Cg%20stroke%3D%22%236f835f%22%20stroke-width%3D%222.4%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%20opacity%3D%220.8%22%3E%0A%3Cpath%20d%3D%22M68%20456c32-48%2044-89%2042-133-2-50-39-84-30-131%208-45%2049-78%2087-128%22%2F%3E%0A%3Cpath%20d%3D%22M109%20353c33-17%2059-42%2074-82%22%2F%3E%0A%3Cpath%20d%3D%22M82%20401c-18-20-33-31-51-41%22%2F%3E%0A%3Cpath%20d%3D%22M91%20301c-28-10-45-22-59-41%22%2F%3E%0A%3Cpath%20d%3D%22M115%20232c29-12%2052-31%2068-57%22%2F%3E%0A%3Cpath%20d%3D%22M119%20165c-13-17-27-29-43-39%22%2F%3E%0A%3C%2Fg%3E%0A%3Cg%20fill%3D%22%238ea17e%22%20opacity%3D%220.18%22%3E%0A%3Cpath%20d%3D%22M191%2044c-18%204-31%2017-35%2035%2018-4%2031-17%2035-35Z%22%2F%3E%0A%3Cpath%20d%3D%22M160%2084c-16%202-26%2012-31%2028%2016-2%2026-12%2031-28Z%22%2F%3E%0A%3Cpath%20d%3D%22M188%20164c-15%205-26%2014-33%2029%2015-5%2026-14%2033-29Z%22%2F%3E%0A%3Cpath%20d%3D%22M86%20221c13-1%2023-7%2031-18-13%201-23%207-31%2018Z%22%2F%3E%0A%3Cpath%20d%3D%22M149%20258c16%201%2028-4%2039-16-16-1-28%204-39%2016Z%22%2F%3E%0A%3Cpath%20d%3D%22M40%20347c15%200%2026%205%2035%2016-15%200-26-5-35-16Z%22%2F%3E%0A%3Cpath%20d%3D%22M117%20331c14-1%2026%204%2036%2016-14%201-26-4-36-16Z%22%2F%3E%0A%3Cpath%20d%3D%22M66%20402c16%200%2028%206%2037%2019-16%200-28-6-37-19Z%22%2F%3E%0A%3C%2Fg%3E%0A%3C%2Fsvg%3E");
  --vine-login-right: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20220%20360%22%20fill%3D%22none%22%3E%0A%3Cg%20stroke%3D%22%236f835f%22%20stroke-width%3D%222.2%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%20opacity%3D%220.72%22%3E%0A%3Cpath%20d%3D%22M18%20316c36-36%2077-42%20105-76%2029-36%2021-82%2057-137%22%2F%3E%0A%3Cpath%20d%3D%22M76%20286c-6-27-18-46-37-62%22%2F%3E%0A%3Cpath%20d%3D%22M121%20228c23-8%2042-22%2058-44%22%2F%3E%0A%3Cpath%20d%3D%22M139%20149c-11-18-23-30-39-42%22%2F%3E%0A%3C%2Fg%3E%0A%3Cg%20fill%3D%22%236f835f%22%20opacity%3D%220.16%22%3E%0A%3Cpath%20d%3D%22M181%2067c-16%204-27%2014-34%2030%2016-4%2027-14%2034-30Z%22%2F%3E%0A%3Cpath%20d%3D%22M150%20113c-14%201-23%209-29%2023%2014-1%2023-9%2029-23Z%22%2F%3E%0A%3Cpath%20d%3D%22M118%20171c13%201%2024-3%2033-13-13-1-24%203-33%2013Z%22%2F%3E%0A%3Cpath%20d%3D%22M53%20229c16%201%2027%208%2035%2022-16-1-27-8-35-22Z%22%2F%3E%0A%3Cpath%20d%3D%22M24%20291c14%201%2024%207%2031%2019-14-1-24-7-31-19Z%22%2F%3E%0A%3C%2Fg%3E%0A%3C%2Fsvg%3E");
  --vine-page-accent: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20140%20220%22%20fill%3D%22none%22%3E%0A%3Cg%20stroke%3D%22%236f835f%22%20stroke-width%3D%221.8%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%20opacity%3D%220.52%22%3E%0A%3Cpath%20d%3D%22M26%20203c21-24%2034-43%2036-73%201-29-19-52-13-80%206-25%2026-45%2055-72%22%2F%3E%0A%3Cpath%20d%3D%22M61%20143c16-8%2029-19%2038-36%22%2F%3E%0A%3Cpath%20d%3D%22M43%20170c-9-10-17-16-28-21%22%2F%3E%0A%3Cpath%20d%3D%22M58%2090c16-8%2029-19%2038-36%22%2F%3E%0A%3C%2Fg%3E%0A%3Cg%20fill%3D%22%238ea17e%22%20opacity%3D%220.10%22%3E%0A%3Cpath%20d%3D%22M98%2026c-11%203-19%2011-22%2022%2011-3%2019-11%2022-22Z%22%2F%3E%0A%3Cpath%20d%3D%22M88%2082c-10%201-18%206-24%2016%2010-1%2018-6%2024-16Z%22%2F%3E%0A%3Cpath%20d%3D%22M64%20123c10%201%2018-2%2024-10-10-1-18%202-24%2010Z%22%2F%3E%0A%3Cpath%20d%3D%22M17%20148c10%200%2018%204%2024%2011-10%200-18-4-24-11Z%22%2F%3E%0A%3C%2Fg%3E%0A%3C%2Fsvg%3E");
  --olive-900: #41513a;
  --olive-800: #566a4b;
  --olive-700: #6f835f;
  --olive-500: #8ea17e;
  --sage-200: #d9e1cf;
  --sage-100: #eef2e9;
  --lavender-200: #ded3ea;
  --peach-200: #f4d9b6;
  --cream-100: #f8f5ed;
  --cream-200: #f1ecdf;
  --white: #ffffff;
  --ink: #263124;
  --muted: #687066;
  --line: #ddd8ca;
  --danger: #9b4d48;
  --success: #58734b;
  --shadow: 0 14px 34px rgba(63, 79, 56, 0.12);
  --radius-xl: 24px;
  --radius-lg: 18px;
  --radius-md: 13px;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--cream-100); }
body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 0%, rgba(222, 211, 234, .42), transparent 30%),
    radial-gradient(circle at 96% 12%, rgba(244, 217, 182, .42), transparent 26%),
    var(--cream-100);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, a:focus-visible {
  outline: 3px solid rgba(111, 131, 95, .28);
  outline-offset: 2px;
}

.shell { min-height: 100vh; position: relative; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 76px;
  padding: 12px clamp(16px, 4vw, 46px);
  color: var(--white);
  background: linear-gradient(135deg, var(--olive-800), var(--olive-700));
  box-shadow: 0 8px 24px rgba(45, 58, 40, .18);
}
.brand { display: flex; align-items: center; gap: 0; min-width: 0; }
.brand img { width: clamp(150px, 18vw, 220px); height: auto; border-radius: 0; background: transparent; display: block; }
.brand-copy { display: none; }
.brand-title { margin: 0; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; font-size: 16px; white-space: nowrap; }
.brand-subtitle { margin-top: 3px; color: rgba(255,255,255,.8); font-size: 11px; letter-spacing: .13em; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.avatar {
  display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 50%;
  color: var(--olive-900); background: var(--cream-100); font-weight: 800;
}
.icon-button, .ghost-on-dark {
  border: 0; color: white; background: rgba(255,255,255,.13); border-radius: 999px; padding: 10px 13px;
}
.icon-button:hover, .ghost-on-dark:hover { background: rgba(255,255,255,.22); }

.page { width: min(1180px, calc(100% - 32px)); margin: 0 auto; padding: 28px 0 110px; background-image: var(--vine-page-accent), var(--vine-page-accent); background-repeat: no-repeat; background-position: right 20px top 112px, left 14px bottom 26px; background-size: 112px auto, 88px auto; }
.page.narrow { width: min(760px, calc(100% - 28px)); background-position: right 10px top 88px, left 8px bottom 20px; background-size: 92px auto, 72px auto; }

.demo-ribbon {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 18px; padding: 12px 15px; border: 1px solid #e6cfaa; border-radius: var(--radius-md);
  background: #fff5e3; color: #6f5636; font-size: 13px;
}
.demo-ribbon strong { color: #574128; }

.hero {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 18px;
  padding: clamp(20px, 5vw, 34px); border-radius: var(--radius-xl);
  background: linear-gradient(145deg, rgba(255,255,255,.98), rgba(238,242,233,.96));
  border: 1px solid rgba(111,131,95,.18); box-shadow: var(--shadow);
}
.eyebrow { margin: 0 0 6px; color: var(--olive-700); font-size: 12px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
h1 { margin: 0; font-size: clamp(28px, 5vw, 48px); line-height: 1.02; letter-spacing: -.04em; }
.hero p { max-width: 650px; margin: 12px 0 0; color: var(--muted); line-height: 1.55; }
.progress-ring {
  --p: 0;
  display: grid; place-items: center; width: 118px; height: 118px; border-radius: 50%;
  background: conic-gradient(var(--olive-700) calc(var(--p) * 1%), var(--sage-200) 0);
  position: relative;
}
.progress-ring::after { content: ""; position: absolute; inset: 10px; border-radius: 50%; background: var(--white); }
.progress-ring-content { position: relative; z-index: 1; text-align: center; }
.progress-ring strong { display: block; font-size: 24px; }
.progress-ring span { color: var(--muted); font-size: 11px; }

.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin: 30px 0 14px; }
.section-heading h2 { margin: 0; font-size: 22px; letter-spacing: -.02em; }
.section-heading p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }

.day-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.day-card {
  display: flex; flex-direction: column; min-height: 220px; overflow: hidden;
  border: 1px solid var(--line); border-radius: var(--radius-lg); background: rgba(255,255,255,.96); box-shadow: 0 10px 24px rgba(56,70,49,.08);
}
.day-band { height: 9px; background: var(--sage-200); }
.day-card[data-tone="lavender"] .day-band { background: var(--lavender-200); }
.day-card[data-tone="peach"] .day-band { background: var(--peach-200); }
.day-card-body { display: flex; flex-direction: column; flex: 1; padding: 18px; }
.day-meta { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.day-number { color: var(--olive-700); font-size: 12px; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; }
.status-pill { padding: 6px 9px; border-radius: 999px; background: var(--sage-100); color: var(--olive-800); font-size: 11px; font-weight: 800; }
.status-pill.complete { background: #e3efe0; color: #46623f; }
.day-card h3 { margin: 12px 0 5px; font-size: 22px; }
.day-card p { margin: 0; color: var(--muted); font-size: 14px; }
.exercise-preview { margin: 18px 0; padding: 0; list-style: none; color: #4d554b; font-size: 13px; line-height: 1.8; }
.exercise-preview li { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-actions { display: flex; gap: 10px; margin-top: auto; }

.primary, .secondary, .danger-button, .text-button {
  border: 0; border-radius: 12px; padding: 11px 15px; font-weight: 800; transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.primary { color: white; background: var(--olive-700); box-shadow: 0 7px 16px rgba(74,94,65,.2); }
.primary:hover { transform: translateY(-1px); background: var(--olive-800); }
.primary:disabled { cursor: not-allowed; opacity: .45; transform: none; }
.secondary { color: var(--olive-800); background: var(--sage-100); }
.secondary:hover { background: var(--sage-200); }
.danger-button { color: var(--danger); background: #f8e9e8; }
.text-button { padding: 8px 4px; color: var(--olive-700); background: transparent; }
.full { width: 100%; }
.small { padding: 8px 10px; font-size: 12px; }

.recovery-card {
  padding: 20px; border: 1px solid #e1d9c8; border-radius: var(--radius-lg); background: rgba(255,252,245,.95);
}
.recovery-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 18px; margin-top: 14px; }
.recovery-item { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border-radius: 12px; background: white; }
.recovery-item input { margin-top: 3px; accent-color: var(--olive-700); }
.recovery-item strong { display: block; font-size: 14px; }
.recovery-item span { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; line-height: 1.35; }

.login-screen {
  min-height: 100vh; display: grid; place-items: center; padding: 24px; position: relative; overflow: hidden; isolation: isolate;
  background:
    radial-gradient(circle at 10% 10%, rgba(222,211,234,.7), transparent 28%),
    radial-gradient(circle at 90% 86%, rgba(244,217,182,.7), transparent 30%),
    linear-gradient(135deg, #f8f5ed, #eef2e9);
}
.login-screen::before,
.login-screen::after {
  content: ""; position: absolute; z-index: 0; pointer-events: none; background-repeat: no-repeat; background-position: center; background-size: contain;
}
.login-screen::before {
  top: 28px; left: max(10px, calc(50% - 560px)); width: min(240px, 30vw); height: min(430px, 60vh); background-image: var(--vine-login-left); opacity: .20;
}
.login-screen::after {
  right: max(8px, calc(50% - 560px)); bottom: 18px; width: min(220px, 26vw); height: min(340px, 42vh); background-image: var(--vine-login-right); opacity: .14;
}
.login-card {
  position: relative; z-index: 1; width: min(560px, 100%); padding: 34px 32px; border: 1px solid rgba(111,131,95,.17); border-radius: 28px; background: rgba(255,255,255,.96); box-shadow: var(--shadow);
}
.login-logo { display: block; margin-bottom: 22px; }
.login-logo img { width: min(320px, 100%); height: auto; border-radius: 0; background: transparent; display: block; }
.login-card h1 { font-size: 34px; }
.login-card > p { color: var(--muted); line-height: 1.5; }
.field { display: grid; gap: 7px; margin: 15px 0; }
.field label { font-size: 12px; font-weight: 800; color: #4f594b; }
.field input, .field textarea, .field select, .input {
  width: 100%; border: 1px solid #d9d5ca; border-radius: 12px; padding: 12px 13px; color: var(--ink); background: white;
}
.field textarea { min-height: 92px; resize: vertical; }
.demo-accounts { margin-top: 20px; padding: 14px; border-radius: 14px; background: var(--cream-100); color: var(--muted); font-size: 12px; line-height: 1.65; }
.demo-accounts strong { color: var(--ink); }
.error { min-height: 18px; margin: 10px 0 0; color: var(--danger); font-size: 13px; }

.workout-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 18px; }
.workout-head h1 { font-size: clamp(28px, 4vw, 40px); }
.breadcrumb { display: inline-flex; align-items: center; gap: 7px; margin-bottom: 12px; color: var(--olive-700); text-decoration: none; font-weight: 800; font-size: 13px; }
.workout-summary { padding: 15px 17px; border-radius: 15px; background: var(--sage-100); color: #4f5c49; font-size: 13px; line-height: 1.5; }
.exercise-stack { display: grid; gap: 14px; }
.exercise-card { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-lg); background: white; }
.exercise-card.complete { border-color: #a9bea0; box-shadow: inset 4px 0 0 #79966b; }
.exercise-header { display: grid; grid-template-columns: 34px minmax(0,1fr) auto; gap: 12px; align-items: center; padding: 16px; }
.exercise-index { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--sage-100); color: var(--olive-800); font-weight: 900; font-size: 12px; }
.exercise-title { margin: 0; font-size: 17px; }
.exercise-details { margin-top: 4px; color: var(--muted); font-size: 12px; }
.exercise-cue { grid-column: 2 / -1; margin: 3px 0 0; color: #5f675d; font-size: 13px; line-height: 1.45; }
.set-table { border-top: 1px solid var(--line); background: #fcfbf7; }
.set-row { display: grid; grid-template-columns: 64px 1fr 1fr 90px; align-items: end; gap: 10px; padding: 11px 16px; border-bottom: 1px solid #ebe7dd; }
.set-row:last-child { border-bottom: 0; }
.set-row label { display: grid; gap: 5px; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
.set-number { align-self: center; color: var(--olive-700); font-size: 12px; font-weight: 900; }
.set-row input[type="number"], .set-row input[type="text"] { width: 100%; border: 1px solid #dad6cb; border-radius: 10px; padding: 9px 10px; background: white; }
.check-control { align-self: center; display: flex !important; flex-direction: row; align-items: center; gap: 7px !important; color: var(--ink) !important; letter-spacing: 0 !important; text-transform: none !important; }
.check-control input { width: 19px; height: 19px; accent-color: var(--olive-700); }
.workout-footer {
  position: sticky; bottom: 12px; z-index: 10; display: flex; gap: 10px; margin-top: 18px; padding: 12px; border: 1px solid rgba(111,131,95,.18); border-radius: 16px; background: rgba(255,255,255,.94); box-shadow: var(--shadow); backdrop-filter: blur(12px);
}
.workout-footer .primary { flex: 1; }

.coach-layout { display: grid; grid-template-columns: 220px minmax(0,1fr); gap: 24px; }
.coach-nav { align-self: start; position: sticky; top: 100px; display: grid; gap: 7px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: rgba(255,255,255,.94); }
.coach-nav button { display: flex; align-items: center; gap: 10px; border: 0; border-radius: 11px; padding: 12px; color: #556050; background: transparent; text-align: left; font-weight: 800; }
.coach-nav button.active, .coach-nav button:hover { color: var(--olive-900); background: var(--sage-100); }
.panel { padding: 20px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: rgba(255,255,255,.96); box-shadow: 0 10px 24px rgba(56,70,49,.07); }
.panel + .panel { margin-top: 16px; }
.panel h2, .panel h3 { margin-top: 0; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar-group { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.client-list { display: grid; gap: 10px; }
.client-row { display: grid; grid-template-columns: 44px minmax(0,1fr) auto auto; align-items: center; gap: 12px; padding: 13px; border: 1px solid #e5e1d7; border-radius: 14px; background: #fff; }
.client-row .avatar { color: white; background: var(--olive-700); }
.client-row strong { display: block; }
.client-row span { color: var(--muted); font-size: 12px; }
.metric { text-align: right; }
.metric strong { font-size: 18px; }
.metric span { display: block; color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .06em; }

.editor-day { margin-top: 14px; overflow: hidden; border: 1px solid var(--line); border-radius: 15px; }
.editor-day-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 13px 15px; background: var(--sage-100); }
.editor-day-head input { border: 1px solid transparent; background: transparent; font-weight: 900; font-size: 16px; }
.editor-day-head input:focus { background: white; border-color: var(--line); }
.editor-exercise { display: grid; grid-template-columns: minmax(180px, 1.7fr) 72px 100px 88px minmax(210px, 2fr) 38px; gap: 8px; align-items: center; padding: 10px 12px; border-top: 1px solid #ebe7dd; background: white; }
.editor-exercise input { min-width: 0; border: 1px solid #dedacf; border-radius: 9px; padding: 9px 10px; }
.remove-x { display: grid; place-items: center; width: 34px; height: 34px; border: 0; border-radius: 9px; color: var(--danger); background: #faeceb; font-size: 18px; }
.add-row { padding: 11px 12px; border-top: 1px solid #ebe7dd; background: #fcfbf7; }
.submission-card { padding: 16px; border: 1px solid var(--line); border-radius: 15px; background: white; }
.submission-card + .submission-card { margin-top: 12px; }
.submission-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.submission-head h3 { margin: 0 0 5px; }
.submission-head p { margin: 0; color: var(--muted); font-size: 12px; }
.submission-details { margin-top: 14px; overflow-x: auto; }
.submission-details table { width: 100%; border-collapse: collapse; font-size: 12px; }
.submission-details th, .submission-details td { padding: 9px 8px; border-bottom: 1px solid #ece8df; text-align: left; }
.submission-details th { color: var(--muted); font-size: 10px; letter-spacing: .06em; text-transform: uppercase; }
.empty { padding: 34px 18px; text-align: center; color: var(--muted); border: 1px dashed #cbc6b8; border-radius: 14px; }

.modal-backdrop { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 18px; background: rgba(31,39,29,.56); }
.modal { width: min(540px, 100%); max-height: 88vh; overflow: auto; padding: 22px; border-radius: 20px; background: white; box-shadow: 0 26px 70px rgba(0,0,0,.25); }
.modal h2 { margin-top: 0; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

.toast { position: fixed; left: 50%; bottom: 28px; z-index: 100; transform: translate(-50%, 22px); opacity: 0; pointer-events: none; padding: 12px 16px; border-radius: 12px; color: white; background: #34412f; box-shadow: var(--shadow); transition: .2s ease; font-weight: 800; font-size: 13px; }
.toast.show { transform: translate(-50%,0); opacity: 1; }

@media (max-width: 880px) {
  .coach-layout { grid-template-columns: 1fr; }
  .coach-nav { position: static; grid-template-columns: repeat(3, 1fr); }
  .coach-nav button { justify-content: center; }
  .editor-exercise { grid-template-columns: 1fr 64px 88px; }
  .editor-exercise input:nth-of-type(4) { grid-column: 1 / 3; }
  .editor-exercise input:nth-of-type(5) { grid-column: 1 / 3; }
  .editor-exercise .remove-x { grid-column: 3; grid-row: 2; }
}

@media (max-width: 680px) {
  .topbar { min-height: 66px; padding: 9px 14px; }
  .brand img { width: 132px; height: auto; }
  .brand-title { font-size: 13px; }
  .brand-subtitle { font-size: 8px; max-width: 190px; }
  .page { background-size: 72px auto, 56px auto; }
  .login-card { padding: 28px 24px; }
  .login-logo img { width: min(270px, 100%); }
  .ghost-on-dark span { display: none; }
  .page { width: min(100% - 22px, 760px); padding-top: 18px; }
  .hero { grid-template-columns: 1fr; }
  .progress-ring { width: 96px; height: 96px; }
  .day-grid, .recovery-grid { grid-template-columns: 1fr; }
  .workout-head { display: block; }
  .workout-head .status-pill { display: inline-block; margin-top: 10px; }
  .exercise-header { grid-template-columns: 32px minmax(0,1fr); }
  .exercise-header > .status-pill { grid-column: 2; justify-self: start; }
  .exercise-cue { grid-column: 2; }
  .set-row { grid-template-columns: 44px 1fr 1fr; }
  .check-control { grid-column: 2 / 4; }
  .coach-nav { grid-template-columns: repeat(3, minmax(0,1fr)); overflow-x: auto; }
  .coach-nav button { padding: 10px 7px; font-size: 11px; }
  .client-row { grid-template-columns: 42px 1fr auto; }
  .client-row .metric:nth-last-child(1) { display: none; }
  .editor-exercise { grid-template-columns: 1fr 64px; }
  .editor-exercise input:nth-of-type(n) { grid-column: auto; }
  .editor-exercise input:first-child { grid-column: 1 / 3; }
  .editor-exercise input:nth-of-type(4), .editor-exercise input:nth-of-type(5) { grid-column: 1 / 3; }
  .editor-exercise .remove-x { grid-column: 2; grid-row: auto; justify-self: end; }
  .workout-footer { bottom: 8px; }
}

/* Version 2 live portal additions */
.live-ribbon {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 18px;
  padding: 11px 15px;
  border: 1px solid #cbdcc5;
  border-radius: var(--radius-md);
  color: #476242;
  background: #edf6ea;
  font-size: 12px;
}
.live-ribbon span:last-child { color: #647060; }
.live-dot { width: 9px; height: 9px; border-radius: 50%; background: #5d8a50; box-shadow: 0 0 0 4px rgba(93,138,80,.14); }
.privacy-line { margin: 18px 0 0 !important; padding-top: 15px; border-top: 1px solid var(--line); font-size: 11px; }
.field small { color: var(--muted); font-size: 11px; line-height: 1.4; }
.setup-callout {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
  padding: 20px;
  border: 1px solid #c7d7c0;
  border-radius: var(--radius-lg);
  background: linear-gradient(145deg, #f5faF2, #e8f1e4);
}
.setup-callout h2 { margin: 0; }
.setup-callout p:last-child { margin: 7px 0 0; color: var(--muted); }
.video-link { grid-column: 2 / -1; color: var(--olive-700); font-size: 12px; font-weight: 800; text-decoration: none; }
.video-link:hover { text-decoration: underline; }
.feedback-card { margin-top: 16px; padding: 18px; border: 1px solid #cfdcc9; border-radius: 16px; background: #f2f7ef; }
.feedback-card p { margin: 0 0 6px; line-height: 1.5; }
.feedback-card span { color: var(--muted); font-size: 11px; }
.portal-footer { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 36px; color: #7b8176; font-size: 10px; text-align: center; }
.portal-footer img { width: 82px; height: auto; opacity: .82; flex: 0 0 auto; }
.loading-card { display: grid; place-items: center; gap: 16px; text-align: center; }
.loading-card img { width: 78px; height: 78px; }
.spinner { display: inline-block; width: 24px; height: 24px; border: 3px solid rgba(111,131,95,.22); border-top-color: var(--olive-700); border-radius: 50%; animation: rty-spin .8s linear infinite; }
@keyframes rty-spin { to { transform: rotate(360deg); } }
.busy-overlay { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 20px; background: rgba(35,43,32,.28); backdrop-filter: blur(2px); }
.busy-card { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-radius: 14px; background: white; box-shadow: var(--shadow); }
.editor-selectors, .editor-plan-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.editor-labels { display: grid; grid-template-columns: minmax(230px,2fr) 62px 96px 82px 72px 34px; gap: 8px; padding: 8px 12px; border-top: 1px solid var(--line); color: var(--muted); background: #fbfaf6; font-size: 9px; font-weight: 900; letter-spacing: .06em; text-transform: uppercase; }
.editor-exercise.wide {
  grid-template-columns: minmax(230px,2fr) 62px 96px 82px 72px 34px;
  grid-template-areas:
    "name sets reps rest optional remove"
    "cues cues cues video video video";
}
.editor-exercise.wide [data-field="name"] { grid-area: name; }
.editor-exercise.wide [data-field="sets"] { grid-area: sets; }
.editor-exercise.wide [data-field="reps"] { grid-area: reps; }
.editor-exercise.wide [data-field="rest"] { grid-area: rest; }
.editor-exercise.wide [data-field="cues"] { grid-area: cues; }
.editor-exercise.wide [data-field="videoUrl"] { grid-area: video; }
.editor-exercise.wide .tiny-check { grid-area: optional; }
.editor-exercise.wide .remove-x { grid-area: remove; }
.tiny-check { display: grid; justify-items: center; gap: 3px; color: var(--muted); font-size: 9px; }
.tiny-check input { width: 18px; height: 18px; accent-color: var(--olive-700); }
.editor-recovery-section { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.editor-section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.editor-section-head h3 { margin: 0; }
.editor-section-head p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.editor-recovery { display: grid; grid-template-columns: minmax(180px,1.1fr) minmax(110px,.6fr) minmax(230px,1.5fr) 34px; gap: 8px; align-items: center; margin-top: 9px; }
.editor-recovery input { min-width: 0; border: 1px solid #dedacf; border-radius: 9px; padding: 9px 10px; }
.submission-card { padding: 0; overflow: hidden; }
.submission-card summary { display: grid; grid-template-columns: 42px minmax(0,1fr) auto; align-items: center; gap: 12px; padding: 15px; cursor: pointer; list-style: none; }
.submission-card summary::-webkit-details-marker { display: none; }
.submission-card summary:hover { background: #fafbf7; }
.submission-card summary strong, .submission-card summary span { display: block; }
.submission-card summary span { margin-top: 4px; color: var(--muted); font-size: 11px; }
.submission-card summary .status-pill { margin: 0; color: #46623f; }
.submission-body { padding: 0 15px 17px; border-top: 1px solid var(--line); }
.submission-body > p { color: #505a4c; font-size: 13px; line-height: 1.5; }
.log-table { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
.log-row { display: grid; grid-template-columns: minmax(180px,1.8fr) 55px 90px 100px 55px; min-width: 550px; }
.log-row span { padding: 9px 10px; border-bottom: 1px solid #ece8df; font-size: 11px; }
.log-row:last-child span { border-bottom: 0; }
.log-row.header { color: var(--muted); background: #f8f7f2; font-weight: 900; letter-spacing: .04em; text-transform: uppercase; }
.feedback-editor { align-items: start; }
.feedback-editor button { justify-self: start; }

@media (max-width: 1100px) {
  .editor-labels { display: none; }
  .editor-exercise.wide {
    grid-template-columns: minmax(180px,1fr) 68px 100px 90px;
    grid-template-areas:
      "name sets reps rest"
      "cues cues video video"
      "optional optional remove remove";
  }
  .editor-exercise.wide .tiny-check { justify-items: start; grid-auto-flow: column; justify-content: start; align-items: center; }
  .editor-exercise.wide .remove-x { justify-self: end; }
}

@media (max-width: 680px) {
  .live-ribbon { align-items: flex-start; flex-wrap: wrap; }
  .setup-callout { align-items: stretch; flex-direction: column; }
  .editor-selectors, .editor-plan-meta { grid-template-columns: 1fr; gap: 0; }
  .editor-exercise.wide {
    grid-template-columns: 1fr 68px;
    grid-template-areas:
      "name name"
      "sets reps"
      "rest optional"
      "cues cues"
      "video video"
      ". remove";
  }
  .editor-exercise.wide .tiny-check { justify-items: center; grid-auto-flow: row; }
  .editor-exercise.wide .remove-x { justify-self: end; }
  .editor-recovery { grid-template-columns: 1fr 44px; }
  .editor-recovery input { grid-column: 1 / 3; }
  .editor-recovery .remove-x { grid-column: 2; }
  .submission-card summary { grid-template-columns: 38px minmax(0,1fr); }
  .submission-card summary .status-pill { grid-column: 2; justify-self: start; }
  .portal-footer { align-items: flex-start; }
  .stack-mobile { align-items: stretch; }
  .stack-mobile .toolbar-group { display: grid; grid-template-columns: 1fr 1fr; }
}

/* Version 3 exercise video library */
.first-setup-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 13px;
  background: var(--sage-100);
  color: var(--muted);
  font-size: 12px;
}
.signup-card { width: min(500px, 100%); }
.success-message { margin-top: 10px; color: var(--success); font-size: 13px; line-height: 1.5; }

.exercise-video {
  grid-column: 2 / -1;
  width: 100%;
  margin-top: 4px;
  overflow: hidden;
  border: 1px solid #d8ded2;
  border-radius: 13px;
  background: #f7faf5;
}
.exercise-video summary {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 11px 13px;
  color: var(--olive-800);
  cursor: pointer;
  list-style: none;
  font-size: 12px;
  font-weight: 900;
}
.exercise-video summary::-webkit-details-marker { display: none; }
.exercise-video[open] summary { border-bottom: 1px solid #d8ded2; }
.play-icon {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  color: white;
  background: var(--olive-700);
  font-size: 9px;
}
.video-frame {
  position: relative;
  width: 100%;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  background: #1f251d;
}
.video-frame.compact { border-radius: 13px 13px 0 0; }
.video-frame iframe,
.video-frame video {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  object-fit: contain;
  background: #1f251d;
}
.video-cues { margin: 0; padding: 12px 14px; color: #566151; font-size: 12px; line-height: 1.5; }

.editor-exercise.wide .editor-video-picker { grid-area: video; }
.editor-video-picker {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
}
.editor-video-picker select,
.editor-exercise select {
  min-width: 0;
  width: 100%;
  border: 1px solid #dedacf;
  border-radius: 9px;
  padding: 9px 10px;
  color: var(--ink);
  background: white;
}

.library-editor {
  margin-top: 10px;
  padding: 18px;
  border: 1px solid #dfe3da;
  border-radius: 16px;
  background: linear-gradient(145deg, #fbfcf9, #f0f4ed);
}
.library-form-grid { display: grid; grid-template-columns: 1.4fr .8fr; gap: 14px; }
.library-form-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.form-status { color: var(--danger); font-size: 12px; font-weight: 700; }
.upload-drop {
  display: grid;
  gap: 9px;
  padding: 16px;
  border: 1px dashed #aebaa6;
  border-radius: 14px;
  background: white;
}
.upload-drop label { display: grid; gap: 4px; cursor: pointer; }
.upload-drop label strong { color: var(--olive-800); }
.upload-drop label span,
.upload-drop small { color: var(--muted); font-size: 11px; }
.upload-drop input[type="file"] { width: 100%; color: var(--muted); font-size: 12px; }
.library-current-preview { margin-top: 16px; overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: white; }
.library-current-preview .eyebrow { padding: 12px 13px 5px; }
.section-heading.compact { margin-top: 24px; }
.section-heading.compact h3 { margin: 0; }
.library-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.library-card { overflow: hidden; border: 1px solid var(--line); border-radius: 16px; background: white; }
.library-card-body { padding: 15px; }
.library-card-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 10px; }
.library-card h3 { margin: 12px 0 7px; font-size: 17px; }
.library-card p { min-height: 40px; margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.library-card-actions { display: flex; gap: 8px; margin-top: 14px; }
.video-placeholder { display: grid; place-items: center; min-height: 145px; color: var(--muted); background: var(--sage-100); font-size: 12px; }
.library-empty { margin-top: 8px; }

@media (max-width: 880px) {
  .coach-nav { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .library-grid { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
  .coach-nav { grid-template-columns: repeat(4, minmax(112px, 1fr)); }
  .exercise-video { grid-column: 1 / -1; }
  .library-form-grid { grid-template-columns: 1fr; gap: 0; }
  .editor-video-picker { grid-template-columns: 1fr; }
  .first-setup-link { align-items: flex-start; flex-direction: column; }
}

.editor-video-picker { grid-template-columns: 1fr; }
.editor-video-picker .text-button { justify-self: start; padding: 2px 0; }
.editor-day-head > div { display: flex; align-items: center; gap: 8px; min-width: 0; }
.editor-day-head > div input { min-width: 0; }

.password-generator-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 9px; align-items: center; }
.password-generator-row input { min-width: 0; }
.field-help { color: var(--muted); font-size: 11px; line-height: 1.4; }
.credentials-card { display: grid; gap: 5px; margin: 18px 0; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--sage-100); }
.credentials-card span { margin-top: 8px; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.credentials-card span:first-child { margin-top: 0; }
.credentials-card strong { overflow-wrap: anywhere; font-size: 16px; }
@media (max-width: 560px) { .password-generator-row { grid-template-columns: 1fr; } }


.password-choice-callout {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin: 0 0 20px;
  padding: 18px 20px;
  border: 1px solid rgba(111, 131, 95, .24);
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, rgba(238,242,233,.98), rgba(255,255,255,.96));
  box-shadow: 0 8px 20px rgba(56,70,49,.06);
}
.password-choice-callout h2 { margin: 0 0 5px; font-size: 22px; }
.password-choice-callout p:last-child { margin: 0; color: var(--muted); line-height: 1.45; }
.password-choice-callout .primary { flex: 0 0 auto; }
.password-modal { width: min(480px, 100%); }

@media (max-width: 680px) {
  .password-choice-callout { align-items: stretch; flex-direction: column; }
  .password-choice-callout .primary { width: 100%; }
}
