:root {
    color-scheme: dark;
    --bg: #070707;
    --surface: #101010;
    --surface-2: #161616;
    --surface-3: #1d1d1d;
    --surface-4: #252525;
    --line: rgba(255, 255, 255, 0.09);
    --line-strong: rgba(255, 255, 255, 0.18);
    --text: #f7f7f4;
    --muted: #aaa9a3;
    --muted-2: #6f6f6b;
    --brand: #f6c900;
    --brand-support: #d98a00;
    --brand-deep: #8a5700;
    --celebrate: #ff6b35;
    --green: #34d399;
    --amber: #fbbf24;
    --azure-strong: var(--brand);
    --azure-soft: var(--brand-support);
    --rose: #fb7185;
    --teal: var(--brand-support);
    --violet: var(--celebrate);
    --gold: var(--brand);
    --bg-glow-primary: rgba(246, 201, 0, 0.07);
    --bg-glow-secondary: rgba(217, 138, 0, 0.035);
    --bg-glow-floor: rgba(255, 255, 255, 0.018);
    --chrome: rgba(7, 7, 7, 0.94);
    --focus-border: rgba(246, 201, 0, 0.72);
    --focus-ring: rgba(246, 201, 0, 0.14);
    --button-border: #f6c900;
    --button-bg: linear-gradient(135deg, #f6c900, #d98a00);
    --button-bg-hover: linear-gradient(135deg, #ffe14a, #f6c900);
    --button-text: #090909;
    --button-shadow: rgba(246, 201, 0, 0.16);
    --button-shadow-hover: rgba(246, 201, 0, 0.27);
    --accent-hover-border: rgba(246, 201, 0, 0.38);
    --accent-hover-bg: rgba(246, 201, 0, 0.08);
    --shadow: 0 20px 60px rgba(0, 6, 20, 0.65), 0 4px 16px rgba(0, 2, 10, 0.4);
    --shadow-sm: 0 4px 16px rgba(0, 4, 14, 0.4);
    --radius: 10px;
    --radius-sm: 7px;
    --topbar-h: 64px;
    --display: Anton, Impact, "Arial Narrow", sans-serif;
}

* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
}

body {
    margin: 0;
    background:
        radial-gradient(ellipse 70% 45% at 15% 0%, var(--bg-glow-primary), transparent),
        radial-gradient(ellipse 50% 35% at 85% 0%, var(--bg-glow-secondary), transparent),
        radial-gradient(ellipse 100% 60% at 50% 110%, var(--bg-glow-floor), transparent),
        var(--bg);
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
}

button,
input,
select {
    font: inherit;
}

button,
a,
select,
input {
    transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms ease, box-shadow 160ms ease, opacity 160ms ease;
}

a {
    color: inherit;
}

.hidden {
    display: none !important;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* The dashboard chrome is edge-anchored: the topbar spans the full viewport
   and the rail is flush against the left edge, so neither reads as a floating
   card. --topbar-h keeps the rail's sticky offset in step with the topbar. */
.shell {
    width: 100%;
    margin: 0;
    /* No bottom padding: it would add scrollable space below .dash-shell and
       let the sticky rail slide up under the topbar. .dash-main owns the
       bottom breathing room now. */
    padding: 0;
}

/* ─── Topbar ─── */

.topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 18px;
    min-height: var(--topbar-h);
    padding: 10px clamp(14px, 2.2vw, 26px);
    border: none;
    border-bottom: 1px solid var(--line-strong);
    border-radius: 0;
    background: var(--chrome);
    backdrop-filter: blur(20px) saturate(1.5);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset;
}

.brand {
    display: inline-flex;
    align-items: center;
    min-width: 0;
}

.brand img {
    width: 132px;
    height: auto;
    filter: invert(1);
}

.topbar-wordmark {
    color: #fff;
    font-family: var(--display);
    font-size: 2.05rem;
    font-weight: 400;
    line-height: 0.9;
    letter-spacing: 0.015em;
    text-decoration: none;
}

.topbar-wordmark-outline {
    color: #080808;
    -webkit-text-stroke: 1.2px #fff;
    paint-order: stroke fill;
}

.topbar-wordmark-solid {
    color: #fff;
}

/* The page heading is the only place the team is named. Coaches on two or more
   teams get a caret beside that title to switch; on one team there is nothing. */
.team-switcher {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.team-switch-button {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border: 1px solid var(--line-strong);
    border-radius: 50%;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    transition: transform 160ms ease, color 160ms ease, border-color 160ms ease, background 160ms ease;
}

.team-switch-button:hover,
.team-switch-button[aria-expanded="true"] {
    color: var(--text);
    border-color: var(--accent-hover-border);
    background: var(--accent-hover-bg);
}

.team-switch-button:focus-visible {
    outline: 2px solid var(--focus-border);
    outline-offset: 2px;
}

.team-switch-button[aria-expanded="true"] svg {
    transform: rotate(180deg);
}

.team-switch-button svg {
    transition: transform 180ms ease;
}

.team-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    z-index: 60;
    min-width: 240px;
    max-width: 340px;
    max-height: 60vh;
    overflow-y: auto;
    display: grid;
    gap: 2px;
    padding: 6px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    background: var(--surface-2);
    box-shadow: var(--shadow);
}

.team-menu.is-hidden {
    display: none;
}

.team-menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    min-height: 38px;
    padding: 0 10px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text);
    font-size: 0.9rem;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
}

.team-menu-item:hover,
.team-menu-item:focus-visible {
    background: rgba(255, 255, 255, 0.06);
}

.team-menu-item.is-active {
    color: var(--azure-strong);
}

.team-menu-item span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.team-menu-check {
    margin-left: auto;
    flex-shrink: 0;
    opacity: 0;
}

.team-menu-item.is-active .team-menu-check {
    opacity: 1;
}

.detail-select-wrap select,
.detail-select-wrap input,
.push-form select,
.push-form input,
.workout-builder select,
.workout-builder input,
.create-team-form input,
.group-create-form select,
.group-create-form input,
.modal-card select,
.modal-card input {
    width: 100%;
    min-height: 40px;
    padding: 0 12px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    background: var(--surface-3);
    color: var(--text);
}

.detail-select-wrap select:focus,
.detail-select-wrap input:focus,
.push-form select:focus,
.push-form input:focus,
.workout-builder select:focus,
.workout-builder input:focus,
.create-team-form input:focus,
.group-create-form select:focus,
.group-create-form input:focus,
.modal-card select:focus,
.modal-card input:focus {
    outline: none;
    border-color: var(--focus-border);
    box-shadow: 0 0 0 3px var(--focus-ring);
}

.account {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    min-width: 0;
    color: var(--muted);
    font-size: 0.88rem;
}

.profile-menu-trigger {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    padding: 2px;
    border: 1px solid rgba(255, 255, 255, 0.24);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
    cursor: pointer;
}

.profile-menu-trigger:hover,
.profile-menu-trigger[aria-expanded="true"] {
    border-color: rgba(255, 255, 255, 0.58);
    background: rgba(255, 255, 255, 0.12);
}

.profile-menu-trigger:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.75);
    outline-offset: 3px;
}

.profile-menu-avatar {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    flex: 0 0 auto;
    overflow: hidden;
    border-radius: 50%;
    background: linear-gradient(135deg, #ffffff, #b8b8b2);
    color: #0a0a0a;
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.02em;
}

.profile-menu-avatar img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.profile-menu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    z-index: 70;
    width: min(270px, calc(100vw - 24px));
    padding: 7px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 12px;
    background: #151515;
    color: #f7f7f4;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.48);
}

.profile-menu-identity {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px;
}

.profile-menu-avatar-large {
    width: 40px;
    height: 40px;
    font-size: 0.82rem;
}

.profile-menu-copy {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.profile-menu-copy strong,
.profile-menu-copy span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.profile-menu-copy strong {
    color: #ffffff;
    font-size: 0.9rem;
}

.profile-menu-copy span {
    color: #9c9c97;
    font-size: 0.76rem;
}

.profile-menu-action {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 42px;
    padding: 0 11px;
    border: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.11);
    background: transparent;
    color: #f2f2ee;
    border-radius: 0 0 7px 7px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 700;
    text-align: left;
}

.profile-menu-action:hover,
.profile-menu-action:focus-visible {
    outline: none;
    background: rgba(255, 255, 255, 0.08);
}

/* ─── Buttons ─── */

.ghost-button,
.primary-button {
    min-height: 40px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 700;
    letter-spacing: 0.01em;
}

.ghost-button {
    padding: 0 14px;
    border: 1px solid var(--line-strong);
    color: var(--text);
    background: transparent;
}

.ghost-button:hover,
.ghost-button:focus-visible,
.page-tab:hover,
.page-tab:focus-visible {
    border-color: var(--accent-hover-border);
    background: var(--accent-hover-bg);
}

.icon-button {
    min-width: 40px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: 400;
}

.primary-button {
    padding: 0 18px;
    border: 1px solid var(--button-border);
    background: var(--button-bg);
    color: var(--button-text);
    font-weight: 800;
    box-shadow: 0 2px 12px var(--button-shadow);
}

.primary-button:hover,
.primary-button:focus-visible {
    transform: translateY(-1px);
    box-shadow: 0 6px 22px var(--button-shadow-hover);
    background: var(--button-bg-hover);
}

.primary-button:disabled {
    opacity: 0.45;
    cursor: default;
    box-shadow: none;
}

.primary-button:disabled:hover {
    transform: none;
    box-shadow: none;
    background: var(--button-bg);
}

/* ─── Loading / Auth / Empty states ─── */

.center-state,
.auth-panel,
.empty-state {
    /* The shell is full-bleed now, so these carry their own side gutter. */
    width: min(calc(100% - 32px), 620px);
    margin: 100px auto 0;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.center-state {
    display: grid;
    place-items: center;
    gap: 14px;
    padding: 48px;
    color: var(--muted);
}

.spinner {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 3px solid var(--line-strong);
    border-top-color: var(--azure-strong);
    animation: spin 900ms linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Authentication checks use the same visual language as the iPhone splash:
   outlined TH stays anchored while RISE enters upward, one letter at a time. */
body.auth-checking {
    overflow: hidden;
    background: #080808;
}

.coach-auth-splash {
    position: fixed;
    z-index: 100;
    inset: 0;
    display: grid;
    place-items: center;
    overflow: hidden;
    background: #080808;
}

.coach-splash-wordmark {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 0.035em;
    height: 1.08em;
    padding-inline: 18px;
    overflow: hidden;
    color: #fff;
    font-family: var(--display);
    font-size: clamp(4.8rem, 13vw, 9rem);
    font-weight: 400;
    line-height: 1;
    letter-spacing: 0;
    animation: coach-splash-pulse 0.9s ease-in-out 0.95s infinite alternate;
}

.coach-splash-letter {
    display: block;
    flex: 0 0 auto;
}

.coach-splash-outline {
    color: #080808;
    -webkit-text-stroke: 2px #fff;
    paint-order: stroke fill;
}

.coach-splash-rise {
    color: #fff;
    opacity: 0;
    filter: blur(4px);
    transform: translateY(125%);
    animation: coach-splash-rise 0.42s cubic-bezier(0.2, 0.78, 0.24, 1.16) forwards;
}

.coach-splash-r { animation-delay: 0.08s; }
.coach-splash-i { animation-delay: 0.185s; }
.coach-splash-s { animation-delay: 0.29s; }
.coach-splash-e { animation-delay: 0.395s; }

@keyframes coach-splash-rise {
    to {
        opacity: 1;
        filter: blur(0);
        transform: translateY(0);
    }
}

@keyframes coach-splash-pulse {
    to {
        opacity: 0.88;
        transform: scale(1.018);
    }
}

/* ─── Dashboard loading skeleton ─── */
.dash-skeleton {
    margin-top: 0;
}

.sk {
    display: block;
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    background-image: linear-gradient(90deg,
        var(--surface-2) 0%,
        var(--surface-3) 40%,
        var(--surface-4) 50%,
        var(--surface-3) 60%,
        var(--surface-2) 100%);
    background-size: 220% 100%;
    animation: sk-shimmer 1.35s ease-in-out infinite;
}

@keyframes sk-shimmer {
    0% { background-position: 130% 50%; }
    100% { background-position: -30% 50%; }
}

.skeleton-rail {
    align-content: start;
}

.sk-rail-label {
    height: 12px;
    width: 60%;
    margin: 2px 8px 10px;
}

.sk-rail-item {
    height: 30px;
    width: 100%;
    border-radius: var(--radius-sm);
    opacity: 0.85;
}

.skeleton-heading {
    display: grid;
    gap: 12px;
    margin-bottom: 24px;
}

.sk-eyebrow {
    height: 12px;
    width: 90px;
}

.sk-title {
    height: 30px;
    width: min(340px, 60%);
}

.skeleton-kpis {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.sk-kpi {
    height: 96px;
}

.skeleton-panels {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.sk-panel {
    height: 220px;
}

.sk-panel--wide {
    grid-column: 1 / -1;
    height: 180px;
}

@media (max-width: 900px) {
    .skeleton-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .skeleton-panels { grid-template-columns: minmax(0, 1fr); }
}

/* ── Per-page skeleton: shapes mirror each page's above-the-fold layout ── */
.sk-circle { width: 40px; height: 40px; border-radius: 999px; flex: 0 0 auto; }
.sk-circle--sm { width: 26px; height: 26px; }
.sk-line { height: 12px; border-radius: 6px; }
.sk-line--sm { height: 10px; width: 42%; }
.sk-line--md { height: 14px; width: 45%; }
.sk-line--lg { height: 13px; width: 62%; }
.sk-search { height: 38px; flex: 1; max-width: 320px; border-radius: 9px; }
.sk-chip { height: 30px; width: 96px; border-radius: 999px; flex: 0 0 auto; }
.sk-btn { height: 40px; width: 132px; border-radius: 9px; }
.sk-field { height: 40px; border-radius: 9px; }

/* ── Edit-workout popup skeleton: mirrors the builder form while it loads ── */
.workout-edit-skeleton {
    display: grid;
    gap: 12px;
    padding: 4px 2px;
}
.workout-edit-skeleton .sk-field-label { height: 11px; width: 120px; border-radius: 6px; }
.workout-edit-skeleton .sk-field { height: 40px; width: 100%; border-radius: 9px; }
.workout-edit-skeleton .sk-search { height: 40px; width: 100%; max-width: none; border-radius: 9px; }
.workout-edit-skeleton .wes-row { display: flex; gap: 12px; }
.workout-edit-skeleton .wes-grow { flex: 1; }
.workout-edit-skeleton .wes-color { width: 56px; flex: 0 0 auto; }
.workout-edit-skeleton .wes-exercise {
    display: grid;
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md, 12px);
    background: var(--surface-1);
}
.workout-edit-skeleton .wes-exercise-head { display: flex; align-items: center; gap: 12px; }
.workout-edit-skeleton .sk-circle-sm { width: 30px; height: 30px; border-radius: 999px; flex: 0 0 auto; }
.workout-edit-skeleton .sk-ex-title { height: 14px; flex: 1; border-radius: 7px; }
.workout-edit-skeleton .sk-ex-action { height: 26px; width: 68px; border-radius: 8px; flex: 0 0 auto; }
.workout-edit-skeleton .wes-sets { display: flex; flex-wrap: wrap; gap: 8px; }
.workout-edit-skeleton .sk-set { height: 30px; width: 84px; border-radius: 8px; }

/* Panel wrapper mirrors .panel */
.sk-panel-box {
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}
.sk-panel-box + .sk-panel-box,
.sk-two-col + .sk-panel-box,
.sk-panel-box + .sk-two-col { margin-top: 14px; }
.sk-panel-head {
    display: flex; justify-content: space-between; align-items: flex-start; gap: 12px;
    padding-bottom: 14px; margin-bottom: 16px;
    border-bottom: 1px solid var(--line);
}
.sk-panel-titles { display: grid; gap: 9px; min-width: 0; }
.sk-h2 { width: 172px; height: 15px; }
.sk-sub { width: 250px; max-width: 55vw; height: 11px; }

/* Stat grid (overview) */
.sk-stat-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.sk-stat-card { min-height: 112px; border-radius: var(--radius-sm); }

/* Calendar (overview) */
.sk-calendar { margin-top: 14px; display: grid; gap: 6px; }
.sk-cal-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.sk-cal-dow { height: 14px; border-radius: 5px; }
.sk-cal-cell { height: 46px; border-radius: 7px; }

/* Table (athletes, migration) */
.sk-table { display: grid; gap: 10px; }
.sk-tr { display: grid; grid-template-columns: 48px 2fr repeat(6, minmax(0, 1fr)); gap: 12px; align-items: center; }
.sk-tr--4 { grid-template-columns: 44px 2fr minmax(0, 1fr) 120px; }
.sk-tr--head { padding-bottom: 10px; margin-bottom: 2px; border-bottom: 1px solid var(--line); opacity: 0.75; }
.sk-td { height: 14px; border-radius: 5px; }
.sk-tr--head .sk-td { height: 11px; }

/* Podium (leaderboards) */
.sk-podium { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; align-items: end; padding-top: 12px; }
.sk-podium-col { display: grid; justify-items: center; gap: 12px; }
.sk-podium-col .sk-circle { width: 54px; height: 54px; }
.sk-podium-bar { width: 100%; border-radius: 10px 10px 0 0; }
.sk-podium-bar--1 { height: 150px; }
.sk-podium-bar--2 { height: 112px; }
.sk-podium-bar--3 { height: 82px; }

/* Forms (workouts, settings, groups) */
.sk-form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; align-items: end; }
.sk-form-grid--stack { grid-template-columns: 1fr; }
.sk-field-group { display: grid; gap: 8px; min-width: 0; }
.sk-flabel { width: 88px; height: 11px; }
.sk-form-submit { align-self: end; }

/* Media editor (library) */
.sk-media-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 14px; margin-bottom: 16px; }
.sk-media-col { display: grid; gap: 10px; align-content: start; }
.sk-dropzone { height: 196px; border-radius: 12px; }
.sk-textarea { height: 108px; border-radius: 9px; }

/* Two-column (groups) */
.sk-two-col { display: grid; grid-template-columns: 2fr 1fr; gap: 14px; align-items: start; }
.sk-stack { display: grid; gap: 12px; }

/* Messages: mirrors .messages-container */
.sk-messages {
    display: grid; grid-template-columns: minmax(240px, 25%) 1fr;
    height: calc(100vh - 190px); min-height: 460px;
    border: 1px solid var(--line-strong); border-radius: var(--radius);
    overflow: hidden; background: var(--surface);
}
.sk-msg-sidebar { display: grid; gap: 12px; align-content: start; padding: 16px; border-right: 1px solid var(--line-strong); }
.sk-msg-title { width: 118px; height: 16px; margin-bottom: 2px; }
.sk-msg-controls { display: flex; gap: 8px; margin-bottom: 4px; }
.sk-msg-controls .sk-search { max-width: none; }
.sk-msg-thread { display: grid; grid-template-rows: auto 1fr auto; min-height: 0; }
.sk-chat-row { display: flex; align-items: center; gap: 12px; }
.sk-list-copy { flex: 1; min-width: 0; display: grid; gap: 8px; }
.sk-list-copy .sk-line--lg { width: 62%; }
.sk-thread-head { display: flex; align-items: center; gap: 12px; padding: 16px; border-bottom: 1px solid var(--line); }
.sk-thread-body { display: flex; flex-direction: column; gap: 12px; padding: 20px; overflow: hidden; }
.sk-bubble { height: 44px; width: 56%; border-radius: 14px; align-self: flex-start; }
.sk-bubble--sm { width: 36%; height: 34px; }
.sk-bubble--me { align-self: flex-end; }
.sk-composer { height: 46px; margin: 14px 16px; border-radius: 12px; }

@media (max-width: 900px) {
    .sk-stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .sk-media-grid, .sk-two-col { grid-template-columns: 1fr; }
    .sk-tr { grid-template-columns: 40px 2fr repeat(3, minmax(0, 1fr)); }
    .sk-tr .sk-td:nth-child(n+6) { display: none; }
}
@media (max-width: 760px) {
    .sk-messages { grid-template-columns: 1fr; height: auto; }
    .sk-msg-thread { min-height: 320px; }
}

@media (prefers-reduced-motion: reduce) {
    .sk { animation: none; }

    .coach-splash-wordmark,
    .coach-splash-rise {
        animation: none;
    }

    .coach-splash-rise {
        opacity: 1;
        filter: none;
        transform: none;
    }
}

.auth-panel,
.empty-state {
    display: grid;
    gap: 22px;
    padding: 32px;
    position: relative;
    overflow: hidden;
}

.auth-panel::before,
.empty-state::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--azure-strong), var(--teal));
}

.auth-panel h1,
.empty-state h1,
.page-heading h1,
.panel h2,
.chart-head h3,
.leaderboard-header h3,
.detail-card h3,
.detail-copy h3 {
    margin: 0;
    letter-spacing: 0;
}

/* Anton carries the Thrise voice in short, high-impact moments. Dense UI,
   controls, helper text, and tables stay in Inter for quick scanning. */
.auth-panel h1,
.empty-state h1,
.page-heading h1,
.panel h2,
.chart-head h3,
.leaderboard-header h3,
.detail-card h3,
.detail-copy h3,
.sidebar-header h3,
.oneoff-designer-title h2,
.builder-modal-header h2,
.migration-page-head h2 {
    font-family: var(--display);
    font-weight: 400;
    letter-spacing: 0.015em;
}

.auth-panel h1,
.empty-state h1 {
    font-size: clamp(2rem, 5vw, 3rem);
    line-height: 1;
}

.auth-copy,
.empty-state p,
.helper,
.heading-copy,
.panel-head p,
.detail-card p,
.chart-head p,
.leaderboard-header p {
    margin: 0;
    color: var(--muted);
    line-height: 1.55;
}

.eyebrow {
    display: inline-flex;
    width: fit-content;
    margin: 0 0 10px;
    padding: 4px 10px;
    border: 1px solid rgba(246, 201, 0, 0.22);
    border-radius: 999px;
    color: var(--azure-soft);
    background: rgba(246, 201, 0, 0.08);
    font-size: 0.72rem;
    font-weight: 900;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.auth-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.secondary-link {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    padding: 0 14px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    color: var(--text);
    text-decoration: none;
}

.secondary-link:hover,
.secondary-link:focus-visible {
    border-color: rgba(138, 87, 0, 0.35);
    background: rgba(246, 201, 0, 0.06);
}

/* ─── Signed-out coach landing ─── */

body.auth-visible {
    background: #080808;
}

body.auth-visible .account {
    visibility: hidden;
    pointer-events: none;
}

.coach-auth-landing {
    width: 100%;
    max-width: none;
    min-height: calc(100svh - var(--topbar-h));
    margin: 0;
    padding: 0;
    gap: 0;
    border: 0;
    border-radius: 0;
    background: #080808;
    box-shadow: none;
    color: #f7f7f4;
}

.coach-auth-landing::before {
    display: none;
}

.coach-auth-hero {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(420px, 0.95fr);
    min-height: calc(100svh - var(--topbar-h));
}

.coach-auth-pitch {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: clamp(24px, 3.5vh, 42px) clamp(28px, 5vw, 84px);
    background:
        linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px),
        #080808;
    background-size: 48px 48px;
}

.coach-auth-pitch::after {
    content: "";
    position: absolute;
    z-index: -1;
    right: -120px;
    bottom: 6%;
    width: 420px;
    height: 420px;
    border: 1px solid rgba(246, 201, 0, 0.16);
    border-radius: 50%;
    box-shadow: 0 0 0 52px rgba(246, 201, 0, 0.025), 0 0 0 104px rgba(246, 201, 0, 0.018);
    pointer-events: none;
}

.coach-auth-pitch .eyebrow {
    margin-bottom: clamp(14px, 2.2vh, 22px);
    color: var(--brand);
    border-color: rgba(246, 201, 0, 0.38);
    background: rgba(246, 201, 0, 0.08);
}

.coach-auth-landing h1 {
    max-width: 780px;
    font-size: clamp(3.7rem, 6.15vw, 6.8rem);
    line-height: 0.94;
    letter-spacing: 0.005em;
    text-transform: uppercase;
}

.coach-auth-landing h1 span {
    display: inline-block;
    margin-top: 0.075em;
    color: var(--brand);
}

.coach-auth-landing .auth-copy {
    max-width: 650px;
    margin-top: clamp(23px, 3vh, 31px);
    color: #c9c8c2;
    font-size: clamp(0.94rem, 1.2vw, 1.08rem);
    line-height: 1.5;
}

.coach-auth-proof {
    display: grid;
    gap: 9px;
    max-width: 720px;
    margin: clamp(21px, 2.8vh, 28px) 0 0;
    padding: 0;
    list-style: none;
    color: #f1f0eb;
    font-size: 0.82rem;
    font-weight: 700;
}

.coach-auth-proof li {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.coach-auth-proof li::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--brand);
    box-shadow: 0 0 0 4px rgba(246, 201, 0, 0.1);
}

.coach-auth-landing .auth-actions {
    display: grid;
    justify-items: start;
    width: min(100%, 650px);
    margin-top: clamp(26px, 3.5vh, 36px);
    gap: 13px;
}

.coach-auth-sign-in {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    width: 100%;
    min-height: 68px;
    padding: 0 26px;
    border: 0;
    border-radius: 4px;
    background: var(--brand);
    color: #090909;
    box-shadow: 0 18px 44px rgba(246, 201, 0, 0.18);
    font-family: var(--display);
    font-size: clamp(1.25rem, 2vw, 1.65rem);
    font-weight: 400;
    letter-spacing: 0.025em;
    text-transform: uppercase;
}

.coach-auth-sign-in b {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    flex: 0 0 auto;
    border: 1px solid rgba(9, 9, 9, 0.35);
    border-radius: 50%;
    font-family: Inter, sans-serif;
    font-size: 1.25rem;
}

.coach-auth-sign-in:hover,
.coach-auth-sign-in:focus-visible {
    background: #ffe14a;
    box-shadow: 0 22px 56px rgba(246, 201, 0, 0.27);
}

.coach-auth-secondary-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.coach-auth-secondary-actions .secondary-link {
    min-height: 32px;
    padding-inline: 0;
    border: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.24);
    border-radius: 0;
    color: #d7d6d0;
    font-size: 0.82rem;
}

.coach-auth-secondary-actions .secondary-link:hover,
.coach-auth-secondary-actions .secondary-link:focus-visible {
    color: var(--brand);
    border-bottom-color: var(--brand);
    background: transparent;
}

.coach-auth-price {
    margin: 14px 0 0;
    color: #85857f;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.7rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.coach-auth-pitch > .helper,
.coach-auth-pitch > .error {
    max-width: 650px;
    margin-top: 11px;
    font-size: 0.78rem;
}

.coach-auth-pitch > .helper:empty,
.coach-auth-pitch > .error:empty {
    display: none;
}

.coach-auth-visual {
    position: relative;
    min-height: calc(100svh - var(--topbar-h));
    overflow: hidden;
    background: #171717;
}

.coach-auth-visual > img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    object-position: center 30%;
    filter: grayscale(1) contrast(1.08) brightness(0.76);
    transform: scale(1.015);
}

.coach-auth-visual-shade {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(90deg, #080808 0%, rgba(8, 8, 8, 0.1) 18%, transparent 45%),
        linear-gradient(180deg, rgba(8, 8, 8, 0.04), rgba(8, 8, 8, 0.66));
    pointer-events: none;
}

.coach-auth-dashboard-card {
    position: absolute;
    right: clamp(20px, 4vw, 56px);
    bottom: clamp(52px, 8vw, 92px);
    width: min(390px, calc(100% - 40px));
    padding: 24px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 8px;
    background: rgba(242, 240, 235, 0.94);
    color: #111;
    box-shadow: 0 28px 80px rgba(0, 0, 0, 0.34);
    backdrop-filter: blur(12px);
}

.coach-auth-dashboard-card > div:first-child {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    color: #5f5d57;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.coach-auth-dashboard-card > div:first-child b {
    padding: 4px 7px;
    border-radius: 999px;
    background: var(--brand);
    color: #111;
    font-size: 0.62rem;
}

.coach-auth-dashboard-card > strong {
    display: block;
    margin-top: 18px;
    font-family: var(--display);
    font-size: clamp(4.5rem, 8vw, 7rem);
    font-weight: 400;
    line-height: 0.8;
}

.coach-auth-dashboard-card > p {
    margin: 10px 0 18px;
    color: #66635c;
    font-size: 0.86rem;
}

.coach-auth-progress {
    width: 100%;
    height: 9px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(17, 17, 17, 0.1);
}

.coach-auth-progress span {
    display: block;
    width: 84%;
    height: 100%;
    border-radius: inherit;
    background: var(--brand);
}

.coach-auth-dashboard-card ul {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin: 20px 0 0;
    padding: 16px 0 0;
    border-top: 1px solid rgba(17, 17, 17, 0.12);
    list-style: none;
    color: #66635c;
    font-size: 0.72rem;
}

.coach-auth-dashboard-card li {
    display: grid;
    gap: 3px;
}

.coach-auth-dashboard-card li span {
    color: #111;
    font-family: var(--display);
    font-size: 1.5rem;
}

.coach-auth-photo-note {
    position: absolute;
    right: 20px;
    bottom: 18px;
    margin: 0;
    color: rgba(255, 255, 255, 0.7);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.62rem;
    letter-spacing: 0.14em;
}

@media (min-width: 981px) {
    body.auth-visible {
        overflow: hidden;
    }

    .coach-auth-landing,
    .coach-auth-hero {
        height: calc(100svh - var(--topbar-h));
        min-height: 0;
        overflow: hidden;
    }

    .coach-auth-pitch,
    .coach-auth-visual {
        min-height: 0;
    }
}

@media (max-width: 980px) {
    .coach-auth-hero {
        grid-template-columns: 1fr;
        min-height: 0;
    }

    .coach-auth-pitch {
        min-height: calc(100svh - var(--topbar-h));
    }

    .coach-auth-pitch::after {
        right: -220px;
    }

    .coach-auth-visual {
        min-height: 620px;
    }

    .coach-auth-visual-shade {
        background: linear-gradient(180deg, #080808 0%, transparent 22%, rgba(8, 8, 8, 0.6) 100%);
    }

}

@media (max-width: 620px) {
    .coach-auth-pitch {
        min-height: auto;
        padding: 54px 20px 60px;
    }

    .coach-auth-landing h1 {
        font-size: clamp(3.35rem, 18vw, 5.2rem);
    }

    .coach-auth-proof {
        display: grid;
    }

    .coach-auth-sign-in {
        min-height: 70px;
        padding-inline: 18px;
        font-size: 1.16rem;
    }

    .coach-auth-visual {
        min-height: 500px;
    }

    .coach-auth-dashboard-card {
        right: 14px;
        bottom: 54px;
        width: calc(100% - 28px);
        padding: 20px;
    }

}

.error {
    margin: 0;
    color: var(--rose);
}

/* ─── Dashboard shell ─── */

/* No gap under the topbar — the rail has to meet it, not float below it.
   The old top margin now lives in .dash-main's padding. */
.dashboard {
    margin-top: 0;
}

.page-heading {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
    padding: 10px 0 22px;
}

.page-heading h1 {
    font-size: clamp(2rem, 4.4vw, 3.4rem);
    line-height: 1;
    color: #f7f7f4;
}

.heading-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.invite-card {
    display: grid;
    gap: 6px;
    min-width: 160px;
    padding: 14px 18px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    background: var(--surface-2);
    position: relative;
    overflow: hidden;
}

.invite-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--azure-strong), rgba(246, 201, 0, 0.3));
}

.invite-card.subtle::before {
    background: linear-gradient(90deg, var(--teal), rgba(45, 212, 191, 0.3));
}

.invite-card span,
.kpi span,
.detail-stat-label,
.calendar-legend span,
.workout-meta,
.form-field label {
    color: var(--muted-2);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
}

.invite-card strong {
    font-size: 1.3rem;
    color: #f7f7f4;
}

/* ─── KPI cards ─── */

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.kpi {
    display: grid;
    gap: 8px;
    min-height: 130px;
    padding: 20px;
    border: 1px solid var(--line);
    border-left-width: 3px;
    border-radius: var(--radius);
    background: var(--surface);
    position: relative;
    overflow: hidden;
}

.kpi::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.022) 0%, transparent 60%);
    pointer-events: none;
}

.kpi:nth-child(1) { border-left-color: var(--azure-strong); }
.kpi:nth-child(2) { border-left-color: var(--teal); }
.kpi:nth-child(3) { border-left-color: var(--green); }
.kpi:nth-child(4) { border-left-color: var(--gold); }

.kpi strong {
    font-size: clamp(1.8rem, 4vw, 2.6rem);
    line-height: 1;
    color: #f7f7f4;
    font-family: var(--display);
    font-weight: 400;
    letter-spacing: 0.015em;
}

.kpi small,
.muted,
.inline-feedback {
    color: var(--muted);
    font-size: 0.82rem;
}

/* ─── Page navigation ─── */

/* ─── Sidebar layout ─── */

.dash-shell {
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr);
    gap: 0;
    align-items: start;
    margin-top: 0;
    /* Sticky children can't outgrow their container, so short pages would
       otherwise leave the rail stopping mid-screen. */
    min-height: calc(100vh - var(--topbar-h));
}

.side-rail {
    position: sticky;
    top: var(--topbar-h);
    align-self: start;
    height: calc(100vh - var(--topbar-h));
    overflow-y: auto;
    overscroll-behavior: contain;
    display: grid;
    align-content: start;
    gap: 8px;
    padding: 18px 12px 28px;
    border: none;
    border-right: 1px solid var(--line-strong);
    border-radius: 0;
    background: var(--surface);
    box-shadow: none;
    scrollbar-width: thin;
}

.rail-label {
    margin: 2px 8px 6px;
    color: var(--muted-2);
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.13em;
    text-transform: uppercase;
}

.page-nav {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.page-nav::-webkit-scrollbar {
    display: none;
}

.page-tab {
    position: relative;
    display: flex;
    align-items: center;
    gap: 11px;
    width: 100%;
    min-height: 42px;
    padding: 0 12px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font-family: var(--display);
    font-weight: 400;
    font-size: 1rem;
    text-align: left;
    letter-spacing: 0.025em;
}

.page-tab svg {
    flex-shrink: 0;
    opacity: 0.7;
    transition: opacity 160ms ease;
}

.page-tab:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.035);
    border-color: transparent;
}

.page-tab:hover svg {
    opacity: 1;
}

.page-tab:focus-visible {
    outline: 2px solid rgba(246, 201, 0, 0.5);
    outline-offset: -2px;
}

.page-tab.is-active {
    color: #f7f7f4;
    background: linear-gradient(90deg, rgba(246, 201, 0, 0.16), rgba(246, 201, 0, 0.03));
}

.page-tab.is-active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 20px;
    border-radius: 0 3px 3px 0;
    background: var(--azure-strong);
}

.page-tab.is-active svg {
    opacity: 1;
    color: var(--azure-strong);
}

/* ─── Sidebar sub-nav ─── */

.nav-group {
    display: grid;
}

.page-tab-caret {
    flex-shrink: 0;
    margin-left: auto;
    opacity: 0.55;
    transition: transform 180ms ease, opacity 160ms ease;
}

.nav-group.is-open .page-tab-caret {
    transform: rotate(180deg);
    opacity: 1;
}

/* Collapsed by default; the group opens only while its page is selected, which
   also keeps the closed entries out of the tab order. */
.page-subnav {
    display: none;
    gap: 1px;
    padding-left: 27px;
}

.nav-group.is-open .page-subnav {
    display: grid;
    padding-top: 3px;
    padding-bottom: 5px;
}

.page-subtab {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    min-height: 32px;
    padding: 0 10px;
    border: none;
    border-left: 1px solid var(--line-strong);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 600;
    text-align: left;
    letter-spacing: 0.01em;
}

.page-subtab:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.03);
}

.page-subtab:focus-visible {
    outline: 2px solid rgba(246, 201, 0, 0.5);
    outline-offset: -2px;
}

.page-subtab.is-active {
    color: #f7f7f4;
    border-left-color: var(--azure-strong);
    background: rgba(246, 201, 0, 0.09);
}

/* Section filtering: a page with a sub-nav shows only the selected section.
   renderPageTabs owns the toggle so each element keeps its own display value
   when shown (both .panel and .dashboard-grid are grids). */
.panel.is-section-hidden,
.dashboard-grid.is-section-hidden,
.plans-page.is-section-hidden {
    display: none;
}

.dash-main {
    min-width: 0;
    width: 100%;
    max-width: 1480px;
    margin-inline: auto;
    display: grid;
    gap: 0;
    padding: 22px clamp(16px, 2.4vw, 34px) 72px;
}

.dash-main .page-heading {
    padding-top: 0;
}

.dash-main .kpi-grid {
    margin-bottom: 18px;
}

.dashboard-page {
    display: none;
}

.dashboard-page.is-active {
    display: block;
}

/* ─── Grid + Panel ─── */

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 14px;
}

.panel {
    display: grid;
    gap: 0;
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    min-width: 0;
    position: relative;
    overflow: hidden;
}

.panel > * + * {
    margin-top: 16px;
}

.panel.panel-overflow-visible {
    overflow: visible;
}

.panel.wide {
    grid-column: span 8;
}

.panel.full {
    grid-column: 1 / -1;
}

/* Settings panels stack vertically, each full width. */
.settings-grid > .panel {
    grid-column: 1 / -1;
}

.panel-head,
.chart-head,
.leaderboard-header {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 2px;
}

.panel-head strong,
.chart-head strong {
    font-size: 1rem;
}

.panel-head.compact {
    align-items: center;
    padding-bottom: 10px;
}

.panel h2 {
    font-size: 1.2rem;
    font-weight: 400;
    line-height: 1.08;
    color: var(--text);
}

.chart-head h3,
.leaderboard-header h3,
.detail-card h3,
.detail-copy h3,
.sidebar-header h3 {
    line-height: 1.08;
}

.invite-card strong,
.detail-score strong,
.detail-stat strong,
.podium-metric strong,
.settings-seat-card strong,
.billing-summary-card strong,
.group-summary-card strong {
    font-family: var(--display);
    font-weight: 400;
    letter-spacing: 0.015em;
}

/* ─── Overview page ─── */

.activity-stat-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.activity-stat-card {
    display: grid;
    gap: 8px;
    min-height: 112px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    position: relative;
    overflow: hidden;
}

.activity-stat-card::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
}

.activity-stat-card:nth-child(1)::after { background: var(--green); }
.activity-stat-card:nth-child(2)::after { background: var(--teal); }
.activity-stat-card:nth-child(3)::after { background: var(--azure-strong); }
.activity-stat-card:nth-child(4)::after { background: var(--gold); }
.activity-stat-card:nth-child(5)::after { background: var(--violet); }
.activity-stat-card:nth-child(6)::after { background: var(--rose); }

.activity-stat-card strong {
    font-size: 1.55rem;
    line-height: 1;
    color: #f7f7f4;
    font-family: var(--display);
    font-weight: 400;
    letter-spacing: 0.015em;
}

.activity-stat-card small {
    color: var(--muted);
}

/* ─── List / card items ─── */

.rank-list,
.session-list,
.alert-list,
.workout-library,
.push-list,
.leaderboard-list,
.detail-list {
    display: grid;
    gap: 10px;
}

.rank-item,
.session-item,
.alert-item,
.workout-card,
.push-card,
.leaderboard-item,
.detail-list-item {
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    min-width: 0;
}

.rank-top,
.session-top,
.push-top,
.leaderboard-top {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
}

.rank-meta,
.session-meta,
.leaderboard-copy span,
.detail-list-copy span,
.push-meta,
.alert-item p,
.calendar-note {
    color: var(--muted);
    font-size: 0.88rem;
}

/* ─── Alert items ─── */

.alert-item {
    display: grid;
    gap: 8px;
    border-left-width: 3px;
}

.alert-item strong {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.alert-item[data-severity="positive"] {
    border-color: rgba(52, 211, 153, 0.22);
    border-left-color: var(--green);
    background: rgba(52, 211, 153, 0.07);
}

.alert-item[data-severity="warning"] {
    border-color: rgba(251, 191, 36, 0.22);
    border-left-color: var(--amber);
    background: rgba(251, 191, 36, 0.07);
}

.alert-item[data-severity="critical"] {
    border-color: rgba(251, 113, 133, 0.22);
    border-left-color: var(--rose);
    background: rgba(251, 113, 133, 0.07);
}

/* ─── Table ─── */

.table-wrap {
    overflow: auto;
    min-width: 0;
    -webkit-overflow-scrolling: touch;
}

/* Show ~5 rows, then scroll the rest (header stays pinned). */
.table-wrap.scroll-rows {
    max-height: 372px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--surface-4) transparent;
}

.table-wrap.scroll-rows thead th {
    position: sticky;
    top: 0;
    z-index: 2;
}

table {
    width: 100%;
    min-width: 720px;
    border-collapse: collapse;
}

th,
td {
    padding: 12px 10px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: middle;
}

thead th {
    color: var(--muted-2);
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    background: var(--surface-2);
}

tbody tr:hover {
    background: rgba(246, 201, 0, 0.04);
}

tbody tr.is-selected {
    background: rgba(246, 201, 0, 0.1);
}

.ranking-row {
    cursor: pointer;
}

.ranking-row:focus-visible {
    outline: 2px solid rgba(246, 201, 0, 0.5);
    outline-offset: -2px;
}

.table-button {
    width: 100%;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    cursor: pointer;
    text-align: left;
}

/* ─── Avatar + name cells ─── */

.athlete-cell,
.detail-person,
.leaderboard-item,
.workout-meta-row,
.push-completion-row {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(45, 212, 191, 0.22), rgba(167, 139, 250, 0.22));
    border: 1px solid var(--line-strong);
    display: grid;
    place-items: center;
    font-size: 0.85rem;
    font-weight: 800;
    color: var(--text);
    flex: 0 0 auto;
    overflow: hidden;
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.athlete-name,
.detail-copy,
.leaderboard-copy,
.detail-list-copy,
.push-copy,
.workout-copy {
    display: grid;
    gap: 4px;
    min-width: 0;
}

.athlete-name strong,
.leaderboard-copy strong,
.detail-list-copy strong,
.detail-copy h3,
.workout-copy strong,
.push-copy strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.athlete-name span,
.detail-copy p,
.leaderboard-copy span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ─── Bar chart ─── */

.bar-chart {
    display: grid;
    grid-template-columns: repeat(8, minmax(0, 1fr));
    gap: 12px;
    align-items: end;
    min-height: 250px;
}

.bar-item {
    display: grid;
    gap: 8px;
    align-items: end;
}

.bar-track {
    position: relative;
    height: 180px;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--line);
    overflow: hidden;
}

.bar-fill {
    position: absolute;
    inset: auto 0 0;
    border-radius: 6px 6px 0 0;
    background: linear-gradient(180deg, var(--azure-soft), rgba(246, 201, 0, 0.7));
}

.bar-value {
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--text);
}

.bar-label {
    color: var(--muted);
    font-size: 0.8rem;
}

/* ─── Calendar ─── */

.calendar-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.calendar-card {
    display: grid;
    gap: 12px;
}

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

.calendar-day-label {
    color: var(--muted-2);
    font-size: 0.74rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    padding: 0 2px;
}

.calendar-cell {
    min-height: 154px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: border-color 160ms ease;
}

.calendar-cell-team {
    display: grid;
    grid-template-rows: auto 68px minmax(0, 1fr);
    align-items: stretch;
}

.calendar-cell:hover {
    border-color: var(--line-strong);
}

.calendar-cell.is-clickable {
    cursor: pointer;
}

.calendar-cell.is-clickable:hover,
.calendar-cell.is-clickable:focus-visible {
    border-color: rgba(246, 201, 0, 0.45);
    background: rgba(246, 201, 0, 0.06);
    outline: none;
}

.calendar-cell.is-outside {
    opacity: 0.3;
}

.calendar-cell.is-empty {
    background: rgba(255, 255, 255, 0.015);
}

/* Past vs future cues. Elapsed days read as solid/filled; upcoming days are
   hollow with a dashed border so they clearly look "not yet." Activity itself is
   carried by the participation bar / volume tint, not by these states. Inline
   heatmap styles on worked days win over the class background, so past sessions
   keep their color while still reading as elapsed. */
.calendar-cell.is-past {
    background: var(--surface-2);
    border-color: rgba(246, 201, 0, 0.16);
}

.calendar-cell.is-future {
    background: rgba(10, 13, 20, 0.35);
    border-style: dashed;
    border-color: rgba(246, 201, 0, 0.16);
}

.calendar-cell.is-future .calendar-day-number {
    color: rgba(170, 169, 163, 0.65);
}

/* Today: accent ring via inset shadow so it survives the inline border-color
   set on worked cells. */
.calendar-cell.is-today {
    border-color: rgba(246, 201, 0, 0.6);
    box-shadow: inset 0 0 0 2px rgba(246, 201, 0, 0.5);
}

.calendar-cell.is-today .calendar-day-number {
    color: var(--brand-deep);
}

/* Don't let a leaked adjacent-month "today" cell shout over the current view. */
.calendar-cell.is-outside.is-today {
    box-shadow: none;
    border-color: rgba(246, 201, 0, 0.16);
}

.calendar-day-top {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    align-items: center;
}

.calendar-day-number {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--muted);
}

.calendar-level {
    height: 6px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.05);
    overflow: hidden;
}

.calendar-level span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--brand);
}

.calendar-scheduled {
    display: grid;
    gap: 4px;
    min-width: 0;
}

.calendar-scheduled.has-fixed-slots {
    height: 68px;
    grid-template-rows: repeat(3, 20px);
    align-content: start;
}

.calendar-scheduled-item,
.calendar-scheduled-more,
.calendar-scheduled-placeholder {
    display: flex;
    align-items: center;
    gap: 5px;
    min-width: 0;
    min-height: 20px;
    padding: 2px 6px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text);
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1.2;
}

.calendar-scheduled-item span:last-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.calendar-scheduled-dot {
    width: 7px;
    height: 7px;
    border-radius: 999px;
    flex: 0 0 auto;
}

.calendar-scheduled-more {
    color: var(--muted);
    font-weight: 600;
}

.calendar-scheduled-placeholder {
    border-style: dashed;
    opacity: 0;
    pointer-events: none;
}

.calendar-bottom {
    margin-top: auto;
    display: grid;
    gap: 5px;
    justify-content: stretch;
}

.calendar-cell-team .calendar-bottom {
    margin-top: 0;
    min-height: 100%;
    align-self: stretch;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.calendar-cell-team .calendar-bottom .calendar-stat {
    line-height: 1.15;
}

.calendar-stat {
    font-size: 0.82rem;
    color: var(--muted);
}

.calendar-legend {
    display: flex;
    justify-content: space-between;
    gap: 12px 24px;
    align-items: center;
    flex-wrap: wrap;
    padding: 6px 2px 14px;
    margin-bottom: 6px;
    line-height: 1.5;
}

.calendar-legend .calendar-note {
    flex: 1 1 220px;
    min-width: 0;
}

.legend-scale {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 0 0 auto;
}

.legend-ramp {
    width: 130px;
    height: 8px;
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(246, 201, 0, 0.12), rgba(246, 201, 0, 0.45), var(--azure-strong));
}

.calendar-cell-volume {
    align-content: start;
    gap: 5px;
}

.calendar-cell-volume.is-rest {
    background: rgba(255, 255, 255, 0.012);
}

.calendar-cell-volume.is-rest .calendar-day-number {
    opacity: 0.5;
}

.calendar-cell-volume.is-worked {
    box-shadow: 0 0 0 1px rgba(246, 201, 0, 0.12) inset;
}

.calendar-cell-volume.is-worked .calendar-day-number,
.calendar-cell-volume.is-worked .calendar-stat {
    color: #f7f7f4;
}

.calendar-stat-strong {
    color: var(--text);
    font-weight: 700;
}

/* ─── Athlete detail ─── */

.detail-layout,
.leaderboard-layout {
    display: grid;
    gap: 16px;
}

.detail-hero {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, rgba(45, 212, 191, 0.07), rgba(167, 139, 250, 0.07));
}

.detail-score {
    display: grid;
    gap: 6px;
    min-width: 160px;
}

.detail-score strong {
    font-size: 2rem;
    line-height: 1;
    color: #f7f7f4;
}

.detail-score p,
.detail-stat-note {
    color: var(--muted);
    margin: 0;
}

.detail-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.detail-stat,
.detail-card,
.chart-panel,
.list-panel {
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    min-width: 0;
}

.detail-stat strong {
    display: block;
    margin-top: 8px;
    font-size: 1.4rem;
    color: #f7f7f4;
}

.detail-grid {
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
    gap: 12px;
    align-items: start;
}

.detail-stack {
    display: grid;
    gap: 12px;
}

.detail-duo {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    align-items: start;
}

.detail-trio {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    align-items: stretch;
}

.detail-trio .detail-list {
    margin-top: 6px;
}

/* ─── Muscle activity map ─── */

.muscle-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.muscle-toggle {
    display: inline-flex;
    flex: 0 0 auto;
    padding: 3px;
    gap: 2px;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    background: var(--surface-2);
}

.muscle-toggle-btn {
    min-height: 28px;
    padding: 0 12px;
    border: none;
    border-radius: 999px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 700;
}

.muscle-toggle-btn.is-active {
    background: var(--azure-strong);
    color: #0b0b0b;
}

.muscle-card {
    display: flex;
    flex-direction: column;
}

.muscle-map-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 4px;
    min-height: 0;
}

.muscle-figure {
    flex: 1;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Fixed height so toggling Front/Back never changes the card height. */
.muscle-figure svg {
    height: 340px;
    width: auto;
    max-width: 100%;
    display: block;
}

.muscle-figure [data-muscle] {
    stroke: rgba(138, 87, 0, 0.18);
    stroke-width: 0.5;
    transition: fill 220ms ease;
}

.muscle-legend {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: var(--muted);
    font-size: 0.78rem;
    padding-bottom: 6px;
}

.muscle-ramp {
    width: 90px;
    height: 8px;
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(138, 87, 0, 0.15), rgba(251, 113, 133, 0.55), rgba(251, 113, 133, 0.95));
}

.detail-list-button {
    width: 100%;
    font: inherit;
    color: inherit;
    text-align: left;
    cursor: pointer;
    transition: border-color 160ms ease, background 160ms ease;
}

.detail-list-button:hover,
.detail-list-button:focus-visible {
    border-color: rgba(246, 201, 0, 0.35);
    background: rgba(246, 201, 0, 0.06);
    outline: none;
}

.detail-list-item,
.leaderboard-item,
.push-completion-row,
.workout-card {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
}

.detail-list-value,
.leaderboard-value {
    display: grid;
    gap: 3px;
    justify-items: end;
    text-align: right;
    flex: 0 0 auto;
}

/* ─── Leaderboard ─── */

.leaderboard-layout {
    grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr);
    align-items: start;
}

/* ─── Exercise combobox ─── */

.exercise-combobox {
    position: relative;
    width: min(100%, 280px);
}

.exercise-combobox input {
    width: 100%;
    min-height: 40px;
    padding: 0 12px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    background: var(--surface-3);
    color: var(--text);
}

.exercise-combobox input:focus {
    outline: none;
    border-color: rgba(246, 201, 0, 0.45);
    box-shadow: 0 0 0 3px rgba(246, 201, 0, 0.1);
}

.combobox-options {
    position: absolute;
    z-index: 25;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    display: grid;
    gap: 3px;
    padding: 6px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    box-shadow: var(--shadow);
    max-height: 280px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--surface-4) transparent;
}

.athlete-combobox {
    width: 300px;
    max-width: 100%;
}

.workout-combobox {
    width: 100%;
    max-width: none;
}

.combobox-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    min-height: 38px;
    padding: 0 10px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text);
    cursor: pointer;
    text-align: left;
    font-size: 0.92rem;
}

.combobox-option:hover,
.combobox-option:focus-visible {
    background: rgba(246, 201, 0, 0.08);
    outline: none;
}

.combobox-option.is-selected {
    color: var(--azure-soft);
    background: rgba(246, 201, 0, 0.12);
}

.combobox-option svg {
    flex: 0 0 auto;
    color: var(--azure-strong);
}

.combobox-option strong,
.combobox-option small {
    display: block;
}

.combobox-option strong {
    font-size: 0.9rem;
    font-weight: 700;
}

.combobox-option small {
    margin-top: 2px;
    font-size: 0.76rem;
    color: var(--muted);
}

.combobox-empty {
    padding: 10px;
    color: var(--muted);
    font-size: 0.9rem;
    text-align: center;
}

.combobox-create {
    display: block;
    width: 100%;
    margin-top: 3px;
    padding: 9px 10px;
    border: 1px dashed var(--line-strong);
    border-radius: 6px;
    background: transparent;
    color: var(--azure-soft);
    cursor: pointer;
    text-align: left;
    font-size: 0.88rem;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.combobox-create:hover,
.combobox-create:focus-visible {
    background: rgba(246, 201, 0, 0.08);
    border-color: var(--azure-strong);
    outline: none;
}

/* ─── Leaderboard athlete picker (right column) ─── */

.list-panel-head {
    display: grid;
    gap: 2px;
    margin-bottom: 10px;
}

.list-panel-head h3 {
    margin: 0;
    font-size: 1rem;
}

.leaderboard-athlete-search {
    width: 100%;
    min-height: 40px;
    margin-bottom: 12px;
    padding: 0 12px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    background: var(--surface-3);
    color: var(--text);
}

.leaderboard-athlete-search:focus {
    outline: none;
    border-color: rgba(246, 201, 0, 0.45);
    box-shadow: 0 0 0 3px rgba(246, 201, 0, 0.1);
}

.leaderboard-list {
    max-height: 360px;
    overflow: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--surface-4) transparent;
}

.leaderboard-pick {
    display: flex;
    align-items: center;
    gap: 11px;
    width: 100%;
    padding: 9px 11px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    color: var(--text);
    cursor: pointer;
    text-align: left;
}

.leaderboard-pick:hover,
.leaderboard-pick:focus-visible {
    border-color: var(--line-strong);
    outline: none;
}

.leaderboard-pick.is-active {
    border-color: var(--chip-color, var(--azure-strong));
    background: color-mix(in srgb, var(--chip-color, var(--azure-strong)) 12%, transparent);
}

.leaderboard-check {
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    border-radius: 5px;
    border: 1.5px solid var(--line-strong);
    background: var(--surface);
    position: relative;
}

.leaderboard-pick.is-active .leaderboard-check {
    border-color: var(--chip-color, var(--azure-strong));
    background: var(--chip-color, var(--azure-strong));
}

.leaderboard-pick.is-active .leaderboard-check::after {
    content: '';
    position: absolute;
    left: 5.5px;
    top: 2px;
    width: 4px;
    height: 8px;
    border: solid #0a0f18;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.toggle-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.toggle-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 34px;
    padding: 0 12px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    color: var(--muted);
    cursor: pointer;
    font-size: 0.88rem;
    font-weight: 600;
    transition: all 160ms ease;
}

.toggle-chip:hover {
    color: var(--text);
    border-color: var(--line-strong);
    background: var(--surface-3);
}

.toggle-chip.is-active {
    color: var(--text);
    border-color: var(--chip-color, var(--line-strong));
    background: color-mix(in srgb, var(--chip-color, var(--azure-strong)) 14%, transparent);
}

.toggle-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--chip-color, var(--azure-strong));
    flex-shrink: 0;
}

.line-chart-card {
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface);
    min-height: 320px;
    padding: 10px;
}

.line-chart-card svg {
    width: 100%;
    height: 300px;
    display: block;
}

.line-chart-empty {
    min-height: 300px;
    display: grid;
    place-items: center;
    color: var(--muted);
}

.chart-axis {
    stroke: rgba(138, 87, 0, 0.1);
    stroke-width: 1;
}

.chart-label {
    fill: var(--muted);
    font-size: 11px;
    font-family: Inter, ui-sans-serif, system-ui, sans-serif;
}

.chart-line {
    fill: none;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.chart-dot {
    stroke: rgba(8, 14, 24, 0.9);
    stroke-width: 2;
}

/* ─── Pills ─── */

.rank-pill,
.status-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 52px;
    padding: 5px 8px;
    border-radius: 999px;
    font-size: 0.76rem;
    font-weight: 800;
    border: 1px solid var(--line-strong);
    background: rgba(255, 255, 255, 0.03);
    letter-spacing: 0.02em;
}

.status-pill.is-complete {
    border-color: rgba(246, 201, 0, 0.3);
    background: rgba(246, 201, 0, 0.1);
    color: var(--azure-soft);
}

.status-pill.is-missed {
    border-color: rgba(251, 113, 133, 0.3);
    background: rgba(251, 113, 133, 0.1);
    color: var(--rose);
}

/* ─── Send a workout form ─── */

.push-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(190px, 0.3fr);
    gap: 22px 16px;
    align-items: end;
}

.push-field-workout { grid-column: 1; }
.push-field-date { grid-column: 2; }
.push-field-note,
.push-audience-row,
.push-submit-button { grid-column: 1 / -1; }

.push-field-note textarea {
    min-height: 72px;
    line-height: 1.45;
    resize: vertical;
}

.push-audience-row {
    display: grid;
    gap: 14px;
    min-width: 0;
    padding: 20px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-md, 12px);
    background: rgba(246, 201, 0, 0.055);
}

.push-audience-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
}

.push-audience-heading label {
    display: block;
    color: var(--text);
    font-size: 0.82rem;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.push-audience-heading p {
    margin: 5px 0 0;
    color: var(--muted);
    font-size: 0.84rem;
    line-height: 1.45;
}

.push-audience-heading strong {
    flex: 0 0 auto;
    padding: 7px 10px;
    border: 1px solid rgba(217, 138, 0, 0.26);
    border-radius: 999px;
    background: rgba(246, 201, 0, 0.16);
    color: #4c3500;
    font-size: 0.74rem;
    font-weight: 900;
}

.push-audience-search-wrap {
    position: relative;
}

.push-audience-search-wrap svg {
    position: absolute;
    z-index: 1;
    top: 50%;
    left: 14px;
    color: #6b665c;
    pointer-events: none;
    transform: translateY(-50%);
}

.push-audience-search-wrap input {
    min-height: 48px;
    padding-left: 44px;
    background: #fff;
    color: #111;
    caret-color: #111;
}

.push-audience-grid {
    display: flex;
    gap: 16px;
    min-width: 0;
    padding: 2px 1px 9px;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scroll-snap-type: inline proximity;
    scrollbar-color: rgba(17, 17, 17, 0.25) transparent;
    scrollbar-width: thin;
}

.push-audience-card {
    position: relative;
    display: grid;
    flex: 0 0 154px;
    align-content: space-between;
    aspect-ratio: 1 / 0.92;
    min-height: 142px;
    padding: 14px;
    border: 1px solid rgba(17, 17, 17, 0.14);
    border-radius: 16px;
    background: #fff;
    color: #111;
    cursor: pointer;
    scroll-snap-align: start;
    text-align: left;
    transition: border-color 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}

.push-audience-card:hover,
.push-audience-card:focus-visible {
    border-color: rgba(17, 17, 17, 0.42);
    box-shadow: 0 10px 26px rgba(17, 17, 17, 0.08);
    outline: none;
    transform: translateY(-2px);
}

.push-audience-card.is-selected {
    border-color: #d98a00;
    background: #fff9da;
    box-shadow: 0 0 0 2px rgba(246, 201, 0, 0.28);
}

.push-audience-card-icon {
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    overflow: hidden;
    border-radius: 50%;
    background: var(--audience-color, #f6c900);
    color: #111;
    font-size: 0.68rem;
    font-weight: 950;
    letter-spacing: 0.04em;
}

.push-audience-card-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.push-audience-team .push-audience-card-icon {
    border-radius: 12px;
    background: #111;
    color: #fff;
}

.push-audience-card > span:nth-child(2) {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.push-audience-card strong,
.push-audience-card small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.push-audience-card strong {
    font-size: 0.9rem;
}

.push-audience-card small {
    color: #6b665c;
    font-size: 0.72rem;
}

.push-audience-card i {
    position: absolute;
    top: 12px;
    right: 12px;
    display: grid;
    width: 24px;
    height: 24px;
    place-items: center;
    border: 1px solid rgba(17, 17, 17, 0.14);
    border-radius: 50%;
    background: #f5f2ea;
    color: #111;
    font-size: 0.8rem;
    font-style: normal;
    font-weight: 900;
}

.push-audience-card.is-selected i {
    border-color: #111;
    background: #111;
    color: #f6c900;
}

.push-audience-empty {
    width: 100%;
    padding: 28px 16px;
    border: 1px dashed rgba(17, 17, 17, 0.18);
    border-radius: 14px;
    color: var(--muted);
    text-align: center;
}

.push-submit-button {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    min-height: 70px;
    padding: 0 24px;
    font-family: "Anton", sans-serif;
    font-size: 1.28rem;
    font-weight: 400;
    letter-spacing: 0.025em;
}

.push-submit-button b {
    font-family: inherit;
    font-size: 1.7rem;
    font-weight: 400;
    line-height: 1;
}

/* ─── Workout builder ─── */

.workout-builder,
.builder-top-grid,
.builder-selected-card {
    display: grid;
    gap: 12px;
}

.builder-top-grid {
    grid-template-columns: minmax(220px, 1fr) 160px minmax(260px, 1.2fr);
}

.builder-selected-card {
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
}

/* ─── Selected list: actions, drag, inline circuits ─── */

/* Scoped to the builder so the empty frame reads as the workout's body rather
   than a thin notice — other .empty-inline states keep their compact padding. */
.builder-selected-list .empty-inline {
    padding: 46px 20px;
}

.builder-list-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.builder-list-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex: 1 1 200px;
    min-height: 44px;
    padding: 0 16px;
    border: 1px dashed var(--line-strong);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text);
    cursor: pointer;
    font-size: 0.86rem;
    font-weight: 700;
}

.builder-list-action:hover,
.builder-list-action:focus-visible {
    border-color: var(--accent-hover-border);
    background: var(--accent-hover-bg);
}

.builder-list-action.is-primary {
    border-style: solid;
    border-color: var(--button-border);
    background: rgba(246, 201, 0, 0.1);
    color: var(--azure-soft);
}

.builder-list-action.is-primary:hover {
    background: rgba(246, 201, 0, 0.18);
}

.builder-drag-handle {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    align-self: stretch;
    margin: -2px 2px -2px -4px;
    border-radius: 5px;
    color: var(--muted-2);
    cursor: grab;
}

.builder-drag-handle:hover,
.builder-drag-handle:focus-visible {
    color: var(--text);
    background: rgba(255, 255, 255, 0.05);
}

.builder-drag-handle:active {
    cursor: grabbing;
}

.builder-exercise-row.is-dragging {
    opacity: 0.45;
}

/* Insertion line for the pending drop position. */
.builder-exercise-row.is-drop-before,
.builder-exercise-row.is-drop-after {
    position: relative;
}

.builder-exercise-row.is-drop-before::after,
.builder-exercise-row.is-drop-after::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    height: 2px;
    border-radius: 2px;
    background: var(--azure-strong);
    box-shadow: 0 0 8px rgba(246, 201, 0, 0.6);
}

.builder-exercise-row.is-drop-before::after { top: -6px; }
.builder-exercise-row.is-drop-after::after { bottom: -6px; }

.builder-circuit-block {
    display: grid;
    gap: 10px;
    padding: 12px;
    border: 1px solid color-mix(in srgb, var(--azure-strong) 38%, var(--line));
    border-radius: var(--radius-sm);
    background: rgba(246, 201, 0, 0.045);
}

.builder-circuit-block-head {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    flex-wrap: wrap;
}

.builder-circuit-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-right: auto;
    /* The field group is taller (it carries labels), so centring keeps the
       circuit label from sinking to the bottom of the row. */
    align-self: center;
}

.builder-circuit-count {
    color: var(--muted);
    font-size: 0.78rem;
}

/* One row under the head: mode tabs pinned left, the fields filling the rest. */
.builder-circuit-settings {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    flex-wrap: wrap;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: rgba(0, 0, 0, 0.16);
}

.builder-circuit-modes {
    display: flex;
    gap: 4px;
    padding: 3px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    background: var(--surface-3);
    flex: 0 0 auto;
    max-width: 100%;
}

.builder-circuit-mode {
    min-height: 30px;
    padding: 0 16px;
    border: none;
    border-radius: 5px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 700;
}

.builder-circuit-mode:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.05);
}

.builder-circuit-mode:focus-visible {
    outline: 2px solid var(--focus-border);
    outline-offset: -2px;
}

.builder-circuit-mode.is-active {
    color: #f7f7f4;
    background: linear-gradient(90deg, rgba(246, 201, 0, 0.28), rgba(246, 201, 0, 0.12));
    box-shadow: 0 0 0 1px rgba(246, 201, 0, 0.35) inset;
}

.builder-pill-mode {
    color: var(--gold) !important;
    border-color: color-mix(in srgb, var(--gold) 45%, var(--line)) !important;
}

.builder-pill-superset {
    color: var(--violet) !important;
    border-color: color-mix(in srgb, var(--violet) 45%, var(--line)) !important;
}

.builder-exercise-row.is-superset-member {
    box-shadow: inset 3px 0 0 var(--violet);
}

/* The fields take whatever width is left beside the tabs, sharing it evenly. */
.builder-circuit-block .builder-circuit-fields {
    display: flex;
    gap: 10px;
    margin-top: 0;
    flex: 1 1 320px;
    min-width: 0;
}

.builder-circuit-block .builder-circuit-fields .form-field {
    flex: 1 1 0;
    min-width: 0;
}

.builder-circuit-block .builder-circuit-fields label {
    white-space: nowrap;
}

.builder-circuit-block .builder-circuit-fields input {
    width: 100%;
}

.builder-circuit-members {
    display: grid;
    gap: 8px;
    padding: 8px;
    border: 1px dashed transparent;
    border-radius: var(--radius-sm);
    transition: border-color 160ms ease, background 160ms ease;
}

.builder-circuit-members.is-drop-into {
    border-color: var(--azure-strong);
    background: rgba(246, 201, 0, 0.08);
}

.builder-circuit-empty {
    padding: 12px;
    border: 1px dashed var(--line-strong);
    border-radius: var(--radius-sm);
    color: var(--muted);
    font-size: 0.8rem;
    text-align: center;
}

.builder-circuit-block .builder-exercise-row.is-circuit-member {
    background: var(--surface-2);
}

.builder-create-card {
    display: grid;
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-3);
}

.builder-create-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) repeat(2, minmax(0, 180px));
    gap: 10px;
    align-items: end;
}

.builder-create-actions {
    display: flex;
    justify-content: flex-start;
}


.builder-search-row,
.builder-actions {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.builder-search-row .form-field {
    flex: 1 1 auto;
    min-width: 0;
}

.builder-search-results,
.builder-selected-list {
    display: grid;
    gap: 10px;
}

.builder-create-exercise-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    min-height: 44px;
    padding: 0 14px;
    border: 1px dashed var(--line-strong);
    border-radius: var(--radius-sm);
    background: rgba(246, 201, 0, 0.04);
    color: var(--azure-soft);
    cursor: pointer;
    font-weight: 700;
    font-size: 0.92rem;
}

.builder-create-exercise-button:hover,
.builder-create-exercise-button:focus-visible {
    border-color: rgba(246, 201, 0, 0.45);
    background: rgba(246, 201, 0, 0.1);
    color: var(--text);
}

.exercise-modal-card {
    width: min(100%, 480px);
}

/* ─── Add-exercises pop-out ─── */

/* Sits above the workout-edit modal, since the builder can be opened inside it,
   and below the create-exercise modal it can launch. */
#builder-search-modal {
    z-index: 70;
}

#exercise-modal {
    z-index: 80;
}

/* The results viewport stays the same height in empty, loading, and populated
   states so the pop-out never jumps while the coach searches. */
.modal-card.builder-search-modal-card {
    width: min(100%, 720px);
    height: min(88vh, 650px);
    max-height: min(88vh, 650px);
    display: flex;
    flex-direction: column;
    gap: 14px;
    overflow: hidden;
}

/* The card never changes size. Opening the create form only gives the exercise
   results less room inside this same frame. */
#builder-search-modal {
    place-items: center;
    padding: 12px;
}

.modal-card.builder-search-modal-card.has-inline-create {
    width: min(100%, 720px);
    height: min(88vh, 650px);
    max-height: min(88vh, 650px);
}

.builder-search-modal-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}

.builder-search-modal-body .builder-search-results {
    flex: 1 1 0;
    height: auto;
    min-height: 240px;
    max-height: none;
    overflow-y: auto;
    scrollbar-gutter: stable;
    scrollbar-color: rgba(17, 17, 17, 0.32) transparent;
    scrollbar-width: thin;
}

.builder-search-modal-card.has-inline-create .builder-search-results {
    flex: 1 1 0;
    height: auto;
    min-height: 96px;
    max-height: none;
}

.builder-search-modal-body .builder-search-results::-webkit-scrollbar {
    width: 8px;
}

.builder-search-modal-body .builder-search-results::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: rgba(17, 17, 17, 0.28);
}

.builder-search-modal-body .builder-search-results > .empty-inline {
    display: grid;
    min-height: 100%;
    place-items: center;
    text-align: center;
}

.builder-search-more-sentinel {
    flex: 0 0 1px;
    min-height: 1px;
}

.builder-search-more-sentinel.is-loading {
    display: grid;
    flex-basis: 48px;
    min-height: 48px;
    place-items: center;
}

.builder-search-more-sentinel > span {
    width: 22px;
    height: 22px;
    border: 3px solid rgba(17, 17, 17, 0.14);
    border-top-color: var(--brand-support);
    border-radius: 50%;
    animation: spin 720ms linear infinite;
}

@media (prefers-reduced-motion: reduce) {
    .builder-search-more-sentinel > span {
        animation: none;
    }
}

.builder-search-modal-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
}

.builder-search-added {
    color: var(--muted);
    font-size: 0.82rem;
}

.exercise-modal-form {
    display: grid;
    gap: 14px;
    margin-top: 4px;
}

.exercise-modal-form .primary-button {
    width: 100%;
    margin-top: 4px;
}

.builder-inline-exercise-create {
    flex: 0 0 auto;
    display: grid;
    gap: 14px;
    padding: 16px;
    border: 1px solid rgba(17, 17, 17, 0.14);
    border-radius: var(--radius-md);
    background: #ffffff;
    box-shadow: 0 16px 36px rgba(17, 17, 17, 0.08);
    transform-origin: bottom center;
    animation: builder-inline-create-rise 180ms ease-out both;
}

.builder-inline-exercise-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
}

.builder-inline-exercise-head h3 {
    margin: 0;
    color: var(--text);
    font-family: "Anton", sans-serif;
    font-size: clamp(1.25rem, 2.4vw, 1.65rem);
    font-weight: 400;
    letter-spacing: 0.01em;
    line-height: 1.08;
}

.builder-inline-exercise-head p {
    margin: 5px 0 0;
    color: var(--muted);
    font-size: 0.84rem;
}

.builder-inline-collapse {
    flex: 0 0 auto;
    min-height: 36px;
    padding: 7px 11px;
}

.builder-inline-collapse span {
    margin-left: 4px;
}

.builder-inline-exercise-body .exercise-modal-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin: 0;
}

.builder-inline-exercise-body .exercise-modal-form > .form-field:first-child,
.builder-inline-exercise-body .exercise-modal-form > .primary-button,
.builder-inline-exercise-body .exercise-modal-form > .inline-feedback {
    grid-column: 1 / -1;
}

#builder-search-modal .primary-button {
    border-color: #f6c900;
    background: #f6c900;
}

#builder-search-modal .primary-button:hover,
#builder-search-modal .primary-button:focus-visible {
    background: #e4b900;
}

#builder-search-modal .primary-button:disabled,
#builder-search-modal .primary-button:disabled:hover {
    background: #f6c900;
}

.builder-inline-exercise-body .exercise-modal-form > .primary-button {
    margin-top: 2px;
}

@keyframes builder-inline-create-rise {
    from {
        opacity: 0;
        transform: translateY(18px) scaleY(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scaleY(1);
    }
}

@media (prefers-reduced-motion: reduce) {
    .builder-inline-exercise-create {
        animation: none;
    }

}

@media (max-width: 640px) {
    #builder-search-modal {
        place-items: center;
        padding: 8px;
    }

    .modal-card.builder-search-modal-card,
    .modal-card.builder-search-modal-card.has-inline-create {
        width: 100%;
        height: calc(100dvh - 16px);
        max-height: calc(100dvh - 16px);
    }

    .builder-inline-exercise-create {
        padding: 13px;
    }

    .builder-inline-exercise-head {
        gap: 10px;
    }

    .builder-inline-exercise-head p {
        display: none;
    }

    .builder-search-modal-card.has-inline-create .builder-search-results {
        flex: 1 1 0;
        height: auto;
        min-height: 72px;
        max-height: none;
    }
}

/* ─── Athlete picker ─── */

.athlete-picker-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    min-height: 40px;
    padding: 6px 12px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    background: var(--surface-3);
    color: var(--text);
    cursor: pointer;
    text-align: left;
}

.athlete-picker-trigger:hover,
.athlete-picker-trigger:focus-visible {
    border-color: rgba(246, 201, 0, 0.45);
    box-shadow: 0 0 0 3px rgba(246, 201, 0, 0.1);
    outline: none;
}

.athlete-picker-value {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--muted);
    font-weight: 600;
}

.athlete-picker-value.has-athlete {
    display: flex;
    align-items: center;
    gap: 9px;
    color: var(--text);
}

.athlete-picker-trigger-copy {
    display: grid;
    gap: 1px;
    min-width: 0;
    line-height: 1.2;
}

.athlete-picker-trigger-copy strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.92rem;
}

.athlete-picker-trigger-copy span {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 600;
}

.athlete-picker-trigger-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
    font-size: 0.92rem;
}

.athlete-picker-caret {
    flex: 0 0 auto;
    color: var(--muted);
}

.avatar-sm {
    width: 28px;
    height: 28px;
    font-size: 0.72rem;
}

.athlete-picker-card {
    width: min(100%, 460px);
}

/* ─── Athlete day detail modal ─── */

.athlete-day-card {
    width: min(100%, 520px);
}

#workout-detail-modal .athlete-day-card,
#chat-workout-modal .athlete-day-card {
    width: min(100%, 680px);
}

.athlete-day-body {
    display: grid;
    gap: 10px;
    margin-top: 12px;
}

.push-detail-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 4px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
}

.day-session-card {
    display: grid;
    gap: 10px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
}

.day-session-top {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
}

.day-session-top strong {
    font-size: 1.02rem;
}

.day-session-top span {
    color: var(--muted);
    font-size: 0.85rem;
    flex: 0 0 auto;
}

.day-session-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.day-pill {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 0 11px;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.03);
    color: var(--text);
    font-size: 0.82rem;
    font-weight: 700;
}

.day-note {
    margin: 0;
    color: var(--muted-2);
    font-size: 0.82rem;
}

.day-loading {
    display: grid;
    place-items: center;
    gap: 12px;
    padding: 40px 16px;
    color: var(--muted);
}

.day-exercises {
    display: grid;
    gap: 10px;
    margin-top: 2px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
}

/* ─── Ordered workout preview ─── */

.workout-preview-overview {
    display: grid;
    gap: 12px;
    padding: 15px 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background:
        radial-gradient(circle at 100% 0, rgba(246, 201, 0, 0.1), transparent 42%),
        var(--surface-2);
}

.workout-preview-overview > p {
    margin: 0;
    color: var(--muted-2);
    font-size: 0.88rem;
    line-height: 1.55;
}

.workout-preview-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.workout-preview-summary span {
    display: inline-flex;
    align-items: baseline;
    gap: 5px;
    padding: 5px 9px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.025);
    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 650;
}

.workout-preview-summary strong {
    color: var(--text);
    font-size: 0.8rem;
}

.workout-preview-flow {
    display: grid;
    gap: 10px;
}

.workout-preview-block {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface-2);
}

.workout-preview-group {
    border-color: rgba(246, 201, 0, 0.3);
    background: linear-gradient(145deg, rgba(246, 201, 0, 0.055), var(--surface-2) 48%);
}

.workout-preview-group.is-superset {
    border-color: rgba(167, 139, 250, 0.32);
    background: linear-gradient(145deg, rgba(167, 139, 250, 0.065), var(--surface-2) 48%);
}

.workout-preview-group-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 14px;
    border-bottom: 1px solid rgba(246, 201, 0, 0.22);
    background: rgba(246, 201, 0, 0.045);
}

.workout-preview-group.is-superset .workout-preview-group-head {
    border-bottom-color: rgba(167, 139, 250, 0.23);
    background: rgba(167, 139, 250, 0.05);
}

.workout-preview-group-head > div {
    display: grid;
    gap: 2px;
}

.workout-preview-group-head strong {
    font-size: 0.86rem;
}

.workout-preview-group-head > span {
    color: var(--muted);
    font-size: 0.73rem;
    font-weight: 650;
    text-align: right;
}

.workout-preview-group-kicker {
    color: var(--azure-strong);
    font-size: 0.69rem;
    font-weight: 850;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.workout-preview-group.is-superset .workout-preview-group-kicker {
    color: #a78bfa;
}

.workout-preview-group-list {
    display: grid;
}

.workout-preview-group-list .workout-preview-exercise + .workout-preview-exercise {
    border-top: 1px solid var(--line);
}

.workout-preview-exercise {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr);
    align-items: start;
    gap: 11px;
    padding: 13px 14px;
}

.workout-preview-order {
    display: grid;
    place-items: center;
    min-width: 32px;
    height: 32px;
    padding: 0 5px;
    border: 1px solid rgba(246, 201, 0, 0.25);
    border-radius: 9px;
    background: rgba(246, 201, 0, 0.1);
    color: var(--azure-soft);
    font-size: 0.72rem;
    font-weight: 850;
}

.workout-preview-group.is-superset .workout-preview-order {
    border-color: rgba(167, 139, 250, 0.27);
    background: rgba(167, 139, 250, 0.1);
    color: #c4b5fd;
}

.workout-preview-exercise-main {
    min-width: 0;
    display: grid;
    gap: 7px;
}

.workout-preview-exercise-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
}

.workout-preview-exercise-head strong {
    font-size: 0.93rem;
    line-height: 1.35;
}

.workout-preview-exercise-head > span {
    flex: 0 0 auto;
    color: var(--muted);
    font-size: 0.67rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.workout-preview-prescription {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.workout-preview-prescription span {
    padding: 3px 7px;
    border-radius: 6px;
    background: var(--surface-3);
    color: var(--muted-2);
    font-size: 0.71rem;
    font-weight: 700;
}

.workout-preview-note {
    margin: 0;
    color: var(--muted);
    font-size: 0.76rem;
    line-height: 1.45;
}

.day-exercise {
    display: grid;
    gap: 8px;
}

.day-exercise-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
}

.day-exercise-head strong {
    font-size: 0.95rem;
}

.day-exercise-head span {
    color: var(--muted-2);
    font-size: 0.74rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    flex: 0 0 auto;
}

.day-set-list {
    display: grid;
    gap: 4px;
}

.day-set-row {
    display: grid;
    grid-template-columns: 28px 1fr auto;
    align-items: center;
    gap: 10px;
    padding: 6px 10px;
    border-radius: 6px;
    background: var(--surface-3);
    font-size: 0.9rem;
}

.day-set-row.is-warmup {
    background: rgba(255, 255, 255, 0.02);
    color: var(--muted);
}

.day-set-index {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    border-radius: 6px;
    background: rgba(246, 201, 0, 0.12);
    color: var(--azure-soft);
    font-size: 0.76rem;
    font-weight: 800;
}

.day-set-row.is-warmup .day-set-index {
    background: rgba(255, 255, 255, 0.05);
    color: var(--muted);
}

.day-set-main {
    font-weight: 600;
    color: var(--text);
}

.day-set-row.is-warmup .day-set-main {
    color: var(--muted);
    font-weight: 500;
}

.day-set-tags {
    display: inline-flex;
    gap: 6px;
}

.day-tag {
    display: inline-flex;
    align-items: center;
    height: 20px;
    padding: 0 7px;
    border-radius: 999px;
    border: 1px solid var(--line-strong);
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 700;
}

.athlete-picker-list {
    display: grid;
    gap: 6px;
    margin-top: 12px;
    max-height: 56vh;
    overflow: auto;
    padding-right: 2px;
    scrollbar-width: thin;
    scrollbar-color: var(--surface-4) transparent;
}

.athlete-picker-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    color: var(--text);
    cursor: pointer;
    text-align: left;
}

.athlete-picker-item:hover,
.athlete-picker-item:focus-visible {
    border-color: rgba(246, 201, 0, 0.35);
    background: rgba(246, 201, 0, 0.06);
    outline: none;
}

.athlete-picker-item.is-selected {
    border-color: rgba(246, 201, 0, 0.5);
    background: rgba(246, 201, 0, 0.12);
}

.athlete-picker-item .athlete-name {
    flex: 1 1 auto;
}

.athlete-picker-item .athlete-name strong {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.athlete-picker-item .athlete-name span {
    color: var(--muted);
    font-size: 0.84rem;
}

.athlete-picker-check {
    flex: 0 0 auto;
    color: var(--azure-strong);
}

.builder-result-card,
.builder-exercise-row {
    display: grid;
    gap: 12px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface);
    transition: border-color 160ms ease, background 160ms ease;
}

.builder-result-card:hover {
    border-color: var(--line-strong);
    background: var(--surface-3);
}

.builder-result-card {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
}

.builder-result-copy,
.builder-exercise-copy {
    display: grid;
    gap: 4px;
    min-width: 0;
}

.builder-result-copy strong,
.builder-exercise-copy strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.builder-result-copy span,
.builder-exercise-copy span {
    color: var(--muted);
    font-size: 0.88rem;
}

.builder-row-top {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
}

.builder-row-controls {
    display: grid;
    grid-template-columns: repeat(3, minmax(110px, 0.85fr)) minmax(180px, 1.45fr);
    gap: 10px;
}

.builder-row-controls .form-field input {
    min-height: 40px;
}

.builder-row-controls .form-field {
    min-width: 0;
}

.builder-inline-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.builder-pill {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 0 10px;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.02);
}

/* ─── Create team form ─── */

.create-team-form {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) auto;
    gap: 12px;
    align-items: end;
}

/* ─── Form fields ─── */

.form-field {
    display: grid;
    gap: 7px;
}

.form-field.grow {
    min-width: 0;
}

/* Keep every standard dashboard field on the same blue surface. Unstyled URL,
   invite-code, and media inputs otherwise inherit a brown-tinted native dark
   appearance from some browsers. */
.form-field input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
.form-field select,
.form-field textarea {
    width: 100%;
    min-height: 40px;
    padding: 9px 12px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    background: var(--surface-3);
    color: var(--text);
    caret-color: var(--azure-soft);
}

.form-field input:not([type="checkbox"]):not([type="radio"]):not([type="file"])::placeholder,
.form-field textarea::placeholder {
    color: var(--muted-2);
    opacity: 1;
}

.form-field input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):focus,
.form-field select:focus,
.form-field textarea:focus {
    outline: none;
    border-color: rgba(246, 201, 0, 0.52);
    background: #1a1204;
    box-shadow: 0 0 0 3px rgba(246, 201, 0, 0.11);
}

.form-field input:-webkit-autofill,
.form-field input:-webkit-autofill:hover,
.form-field input:-webkit-autofill:focus,
.form-field textarea:-webkit-autofill,
.form-field select:-webkit-autofill {
    -webkit-text-fill-color: var(--text);
    caret-color: var(--azure-soft);
    box-shadow: 0 0 0 1000px var(--surface-3) inset;
    transition: background-color 9999s ease-out 0s;
}

/* ─── Workout library ─── */

.workout-library,
.push-list {
    align-content: start;
}

.workout-card {
    align-items: flex-start;
    display: grid;
    /* Details stack on the left; the action buttons sit in a column on the right. */
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    cursor: pointer;
    transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.workout-card:hover,
.workout-card:focus-visible {
    border-color: rgba(246, 201, 0, 0.35);
    background: rgba(246, 201, 0, 0.05);
    outline: none;
}

.workout-card-main {
    grid-column: 1;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    min-width: 0;
}

.workout-card .workout-library-preview {
    grid-column: 1;
}

.workout-card-actions {
    grid-column: 2;
    grid-row: 1 / -1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-self: center;
}

.workout-card-actions button {
    white-space: nowrap;
    justify-content: center;
}

@media (max-width: 720px) {
    .workout-card {
        grid-template-columns: minmax(0, 1fr);
    }

    .workout-card-actions {
        grid-column: 1;
        grid-row: auto;
        flex-direction: row;
    }
}

/* ── Edit Workout popup: hosts the real Build-a-Workout UI ── */
.workout-edit-card {
    width: min(1180px, 96vw);
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.workout-edit-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 2px;
}


.workout-library-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding-left: 24px;
}

.library-actions {
    display: flex;
    justify-content: center;
    margin-top: 14px;
}

.workout-swatch {
    width: 12px;
    height: 12px;
    border-radius: 999px;
    flex: 0 0 auto;
    margin-top: 5px;
}

.push-card {
    display: grid;
    gap: 12px;
}

.push-card-button {
    width: 100%;
    font: inherit;
    color: inherit;
    text-align: left;
    cursor: pointer;
    transition: border-color 160ms ease, background 160ms ease;
}

.push-card-button:hover,
.push-card-button:focus-visible {
    border-color: rgba(246, 201, 0, 0.35);
    background: rgba(246, 201, 0, 0.05);
    outline: none;
}

.completion-controls {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 150px 150px auto;
    column-gap: 20px;
    row-gap: 10px;
    align-items: end;
    margin-bottom: 14px;
}

.completion-controls input {
    width: 100%;
    min-height: 40px;
    padding: 0 12px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    background: var(--surface-3);
    color: var(--text);
}

.completion-controls input:focus {
    outline: none;
    border-color: rgba(246, 201, 0, 0.45);
    box-shadow: 0 0 0 3px rgba(246, 201, 0, 0.1);
}

@media (max-width: 780px) {
    .completion-controls {
        grid-template-columns: 1fr 1fr;
    }
    .completion-controls .grow {
        grid-column: 1 / -1;
    }
}

.progress-track {
    height: 8px;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.05);
}

.progress-fill {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, rgba(246, 201, 0, 0.8), var(--azure-strong));
}

/* ─── Podium ─── */

.podium-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    align-items: end;
    min-height: 260px;
}

.podium-grid.compact {
    min-height: 230px;
}

.podium-card {
    display: grid;
    gap: 10px;
    align-items: end;
    justify-items: center;
    min-width: 0;
    grid-row: 1;
}

/* Keep each place anchored to its third even when fewer than three entries exist. */
.podium-card.place-1 {
    grid-column: 2;
}

.podium-card.place-2 {
    grid-column: 1;
}

.podium-card.place-3 {
    grid-column: 3;
}

.podium-copy,
.podium-metric {
    display: grid;
    gap: 4px;
    justify-items: center;
    text-align: center;
    min-width: 0;
}

.podium-copy strong,
.podium-copy span,
.podium-metric span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

.podium-avatar {
    width: 54px;
    height: 54px;
}

.podium-metric strong {
    font-size: 1.15rem;
    color: #f7f7f4;
}

.podium-metric span {
    color: var(--muted);
    font-size: 0.82rem;
}

.podium-base {
    width: 100%;
    height: var(--podium-height, 120px);
    border: 1px solid var(--line);
    border-radius: var(--radius) var(--radius) 0 0;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02));
}

.podium-card.place-1 .podium-base {
    background: linear-gradient(180deg, rgba(245, 197, 24, 0.28), rgba(245, 197, 24, 0.06));
    border-color: rgba(245, 197, 24, 0.3);
    box-shadow: 0 0 30px rgba(245, 197, 24, 0.1) inset;
}

.podium-card.place-2 .podium-base {
    background: linear-gradient(180deg, rgba(192, 204, 218, 0.22), rgba(192, 204, 218, 0.06));
    border-color: rgba(192, 204, 218, 0.2);
}

.podium-card.place-3 .podium-base {
    background: linear-gradient(180deg, rgba(205, 127, 50, 0.2), rgba(205, 127, 50, 0.06));
    border-color: rgba(205, 127, 50, 0.2);
}

.push-meta-row {
    justify-content: space-between;
    align-items: flex-start;
}

.push-completions {
    display: grid;
    gap: 8px;
}

.empty-inline {
    grid-column: 1 / -1;
    padding: 14px;
    border: 1px dashed var(--line-strong);
    border-radius: var(--radius-sm);
    color: var(--muted);
    text-align: center;
}

.empty-inline-text {
    display: inline-block;
    max-width: clamp(240px, 33%, 420px);
}

.podium-grid .empty-inline {
    align-self: stretch;
    display: grid;
    place-items: center;
}

.inline-feedback {
    min-height: 20px;
}

/* ─── Settings ─── */
.coach-program-panel {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-top: 18px;
}

.coach-program-config { margin-top: 16px; }
.coach-program-config select { width: 100%; }
.coach-program-actions { margin-top: 16px; flex-wrap: wrap; }
.coach-program-actions .ghost-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

/* ─── Plans page ───
   Plans drops the panel card entirely: the slate that used to be the panel
   background becomes the page background, and the sections are separated by a
   rule instead of by card edges. The divider lives on each section's top border
   so a hidden section takes its divider with it. */

/* The slate is the main column itself, not a block inside it. Dropping the
   max-width and padding lets it run the full width of the content area and all
   the way down past the last section, instead of stopping at a card edge. */
body.plans-surface .dash-main {
    max-width: none;
    padding: 0;
    background: var(--surface);
    min-height: calc(100vh - var(--topbar-h));
}

.plans-page {
    grid-column: 1 / -1;
    padding: 28px clamp(16px, 2.4vw, 34px) 44px;
}

/* Subscriptions and one-time programs stack on the Programs page instead of
   sitting behind a sub-tab, so the second one carries the rule that separates
   them. Matched on [data-section] so the designer — also a .plans-page, and a
   sibling of both — never picks up a stray border. */
#page-programs > [data-section] {
    padding-bottom: 12px;
}

#page-programs > [data-section] + [data-section] {
    padding-top: 34px;
    padding-bottom: 44px;
    border-top: 1px solid var(--line-strong);
}

.plans-section + .plans-section {
    margin-top: 26px;
    padding-top: 24px;
    border-top: 1px solid var(--line-strong);
}

.plans-section > .panel-head {
    border-bottom: 1px solid var(--line);
    padding-bottom: 14px;
}


.coach-products-head h3 { margin: 0 0 6px; font-size: 1.15rem; }
.coach-products-head p { margin: 0; color: var(--muted); }

.coach-product-create {
    display: grid;
    grid-template-columns: minmax(180px, 1.4fr) minmax(130px, .7fr) minmax(120px, .65fr) minmax(160px, 1fr);
    gap: 12px;
    align-items: end;
    margin-top: 18px;
}

.coach-product-description-field { grid-column: 1 / -2; }
.coach-product-description-field label span { color: var(--muted); font-weight: 400; }
.coach-product-create .primary-button { min-height: 44px; }
.coach-product-create input,
.coach-product-create select,
.coach-product-create textarea,
.coach-product-card-controls select {
    width: 100%;
    min-height: 42px;
    padding: 9px 11px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    background: var(--surface-3);
    color: var(--text);
}
.coach-product-create textarea { resize: vertical; }
.coach-product-create input:focus,
.coach-product-create select:focus,
.coach-product-create textarea:focus,
.coach-product-card-controls select:focus {
    outline: none;
    border-color: rgba(246, 201, 0, .45);
    box-shadow: 0 0 0 3px rgba(246, 201, 0, .1);
}

.money-input {
    display: flex;
    align-items: center;
    border: 1px solid var(--line-strong);
    border-radius: 10px;
    background: var(--surface-3);
    overflow: hidden;
}
.money-input:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(246, 201, 0, .12); }
.money-input span { padding-left: 12px; color: var(--muted); }
.coach-product-create .money-input input {
    border: none;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
    outline: none;
    padding-left: 6px;
}
.coach-product-create .money-input input:focus {
    border: none;
    box-shadow: none;
    outline: none;
}
/* The generic ".form-field input" rule is more specific than the wrapper rule
   above, so it re-adds a border/background inside the $ wrapper. Scope by id to
   keep the input itself borderless — the .money-input wrapper owns the border. */
#coach-product-price,
#coach-product-price:focus,
#coach-oneoff-price,
#coach-oneoff-price:focus,
#coach-oneoff-days,
#coach-oneoff-days:focus,
#oneoff-detail-price,
#oneoff-detail-price:focus,
#oneoff-detail-days,
#oneoff-detail-days:focus {
    border: none;
    background: transparent;
    box-shadow: none;
    outline: none;
}

.coach-product-list { display: grid; gap: 10px; margin-top: 14px; }

/* ─── One-off plans ─── */

.coach-oneoff-list { display: grid; gap: 10px; margin-top: 14px; }

/* One field fewer than the subscription form (no group — a one-off purchase
   grants no team access), so the row is three columns, not four. */
.coach-oneoff-create {
    grid-template-columns: minmax(180px, 1.6fr) minmax(130px, .7fr) minmax(120px, .7fr);
}

/* Length field reuses the .money-input shell, but its unit trails the number
   ("45 days") rather than leading it, so the padding flips to the right. */
.coach-product-create .days-input span { padding-left: 4px; padding-right: 12px; }
.coach-product-create .days-input input { padding-left: 11px; }

.coach-oneoff-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    align-items: start;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
}

/* ─── One-off program designer ───
   A full page, not a modal. The program has no real dates — everyone starts at
   Day 1 — so the calendar is laid out in program-weeks of seven, not a month. */

/* The designer takes the whole Programs page while it is open. */
.is-designer-hidden {
    display: none !important;
}

.oneoff-designer-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 16px;
    flex-wrap: wrap;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--line);
}

.oneoff-designer-title h2 { margin: 8px 0 4px; }
.oneoff-designer-title .helper { margin: 0; }
.oneoff-designer-title .ghost-button { padding-inline: 0; background: none; border: none; color: var(--muted); }
.oneoff-designer-title .ghost-button:hover { color: var(--text); }
.oneoff-designer-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Plan details sit above the calendar and save with it. Same three-column shell
   as the create form, so the two read as the same object in two places. */
.oneoff-detail-fields {
    grid-template-columns: minmax(180px, 1.6fr) minmax(130px, .7fr) minmax(120px, .7fr);
    margin-top: 18px;
}

.oneoff-detail-fields .coach-product-description-field { grid-column: 1 / -1; }

.oneoff-calendar-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(240px, 320px);
    gap: 16px;
    margin-top: 14px;
}

.oneoff-calendar-main {
    display: grid;
    align-content: start;
    gap: 12px;
    min-width: 0;
}

/* No max-height: the designer owns the page, so the calendar scrolls with it. */
.oneoff-calendar-weeks {
    display: grid;
    gap: 14px;
}

.oneoff-week-title {
    margin: 0 0 8px;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
}

.oneoff-week-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 6px;
}

/* Holds the day button plus its remove control, which has to be a sibling
   rather than a child so the two buttons do not nest. */
.oneoff-cell-wrap {
    position: relative;
    display: grid;
    min-width: 0;
}

.oneoff-cell-wrap .oneoff-cell { height: 100%; }

.oneoff-cell-remove {
    position: absolute;
    top: 3px;
    right: 3px;
    display: grid;
    place-items: center;
    width: 18px;
    height: 18px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--muted-2);
    font-size: 0.85rem;
    line-height: 1;
    cursor: pointer;
    opacity: 0;
}

/* Revealed on hover or keyboard focus so 45 cells are not 45 permanent ×s. */
.oneoff-cell-wrap:hover .oneoff-cell-remove,
.oneoff-cell-remove:focus-visible {
    opacity: 1;
}

.oneoff-cell-remove:hover {
    background: rgba(251, 113, 133, 0.14);
    color: var(--rose);
}

.oneoff-cell {
    display: grid;
    align-content: start;
    gap: 4px;
    min-height: 74px;
    padding: 7px 8px;
    text-align: left;
    cursor: pointer;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    color: var(--text);
}

.oneoff-cell.is-empty { border-style: dashed; background: transparent; }
.oneoff-cell.is-rest { background: var(--surface); color: var(--muted); }
.oneoff-cell.is-void { visibility: hidden; cursor: default; }

/* Adding a day is the next cell in the calendar, so growing the program reads
   as simply writing on the following day. */
/* The add cell carries only the plus, centered on both axes — no day label. */
.oneoff-cell.is-add {
    border-style: dashed;
    border-color: var(--line-strong);
    background: transparent;
    place-content: center;
    place-items: center;
}

.oneoff-cell.is-add:hover {
    border-color: var(--focus-border);
    background: var(--accent-hover-bg);
}

.oneoff-cell-plus {
    font-size: 2.2rem;
    font-weight: 300;
    line-height: 1;
    color: var(--muted);
}

.oneoff-cell.is-add:hover .oneoff-cell-plus { color: var(--azure-strong); }

.oneoff-cell:hover:not(.is-void) {
    border-color: var(--accent-hover-border);
    background: var(--accent-hover-bg);
}

.oneoff-cell.is-selected {
    border-color: var(--focus-border);
    box-shadow: 0 0 0 2px var(--focus-ring);
}

.oneoff-cell-day {
    font-size: 0.7rem;
    letter-spacing: 0.03em;
    color: var(--muted);
    /* Leaves room for the × so a revealed control never sits on the label. */
    padding-right: 18px;
}

.oneoff-cell-label {
    font-size: 0.8rem;
    line-height: 1.25;
    /* Long workout names must not stretch a seven-across grid. */
    overflow-wrap: anywhere;
}

/* Sticky so the library stays reachable while scrolling a long program. */
.oneoff-calendar-side {
    display: grid;
    align-content: start;
    gap: 10px;
    padding-left: 16px;
    border-left: 1px solid var(--line);
    position: sticky;
    top: calc(var(--topbar-h) + 12px);
    align-self: start;
}

.oneoff-assign-actions { display: grid; gap: 8px; }
.oneoff-assign-actions .ghost-button { width: 100%; justify-content: center; }

.oneoff-library-list {
    display: grid;
    align-content: start;
    gap: 6px;
    max-height: 42vh;
    overflow-y: auto;
}

.oneoff-library-item {
    display: grid;
    gap: 2px;
    padding: 8px 10px;
    text-align: left;
    cursor: pointer;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    color: var(--text);
}

.oneoff-library-item:hover:not(:disabled) {
    border-color: var(--accent-hover-border);
    background: var(--accent-hover-bg);
}

.oneoff-library-item:disabled { opacity: 0.5; cursor: default; }
.oneoff-library-item span { font-size: 0.76rem; color: var(--muted); }

/* Reads as an action rather than a library entry, wherever it sits in the list. */
.oneoff-library-new {
    border-style: dashed;
    border-color: var(--line-strong);
    background: transparent;
}

.oneoff-library-new strong { color: var(--azure-soft); }

/* The builder pops out on top of the scheduler, so it needs to sit above it. */
#oneoff-workout-modal { z-index: 70; }
.oneoff-workout-card { width: min(100%, 1180px); }

.oneoff-workout-host { margin-top: 14px; min-width: 0; }

@media (max-width: 900px) {
    .oneoff-calendar-layout { grid-template-columns: minmax(0, 1fr); }
    .oneoff-calendar-side { padding-left: 0; border-left: none; padding-top: 14px; border-top: 1px solid var(--line); }
    .oneoff-week-grid { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); }
}
.coach-product-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 18px;
    align-items: center;
    padding: 15px 16px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(255, 255, 255, .018);
}
.coach-product-card-main > span { display: block; margin-top: 5px; color: var(--muted); font-size: .88rem; }
.coach-product-title-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.coach-product-card-controls { display: flex; align-items: end; gap: 16px; }
.coach-product-card-controls > label:first-child { display: grid; gap: 6px; min-width: 180px; }
.coach-product-card-controls > label:first-child > span { color: var(--muted); font-size: .78rem; font-weight: 700; }
.coach-product-card-controls select { min-height: 38px; }
.coach-product-delete { min-height: 38px; white-space: nowrap; }

body.migration-route .shell { width: 100%; }
body.migration-route .dash-main { max-width: 1760px; }
body.migration-route .dash-shell { grid-template-columns: minmax(0, 1fr); }
body.migration-route .side-rail,
body.migration-route .page-heading { display: none; }

.migration-dashboard-page { min-width: 0; }
.migration-page-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    padding: 22px 24px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    background: linear-gradient(135deg, rgba(246, 201, 0, 0.09), rgba(255, 255, 255, 0.018) 48%);
}
.migration-page-head h2 { margin: 5px 0 8px; font-size: clamp(2rem, 4vw, 3.2rem); color: #f7f7f4; }
.migration-page-head p:last-child { margin: 0; color: var(--muted); }
.migration-page-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.migration-page-actions .ghost-button { display: inline-flex; align-items: center; text-decoration: none; }

.migration-summary {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 10px;
    margin: 16px 0;
}

.migration-stat {
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.025);
}

.migration-stat span,
.migration-stat small { display: block; color: var(--muted); }
.migration-stat strong { display: block; margin: 5px 0 2px; font-size: 1.35rem; }

.migration-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.8fr);
    gap: 14px;
    align-items: start;
}

.migration-page-layout {
    grid-template-columns: minmax(440px, 0.95fr) minmax(520px, 1.05fr);
    gap: 18px;
    margin-top: 14px;
}

.migration-list-panel,
.migration-page-layout .migration-client-detail {
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.migration-page-layout .migration-client-list {
    min-height: 480px;
    max-height: calc(100vh - 350px);
}

.migration-page-layout .migration-client-detail {
    position: sticky;
    top: 88px;
    min-height: 480px;
}

.migration-list-head { display: grid; gap: 14px; margin-bottom: 14px; }
.migration-list-head h3 { margin: 0 0 3px; }

.migration-list-tools { display: grid; gap: 10px; }
.migration-list-tools input[type="search"],
.migration-paid-through-editor input[type="date"] {
    min-height: 42px;
    padding: 0 12px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    background-color: var(--surface-2);
    color: var(--text);
    color-scheme: dark;
}
.migration-list-tools input[type="search"] { width: 100%; }
.migration-list-tools input[type="search"]::placeholder { color: var(--muted); opacity: 1; }
.migration-list-tools input[type="search"]:focus,
.migration-paid-through-editor input[type="date"]:focus {
    outline: none;
    border-color: rgba(246, 201, 0, 0.48);
    box-shadow: 0 0 0 3px rgba(246, 201, 0, 0.1);
}
.migration-filter-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.migration-stage-filters { display: flex; flex-wrap: wrap; gap: 7px; }
.migration-filter-button,
.migration-filter-reset {
    min-height: 34px;
    padding: 7px 11px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.025);
    color: var(--muted);
    font: inherit;
    font-size: 0.78rem;
    font-weight: 800;
    cursor: pointer;
}
.migration-filter-button { display: inline-flex; align-items: center; gap: 7px; }
.migration-filter-button span {
    display: inline-grid;
    place-items: center;
    min-width: 21px;
    height: 21px;
    padding: 0 6px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.07);
    color: var(--text);
    font-size: 0.7rem;
}
.migration-filter-button:hover,
.migration-filter-button.is-active {
    border-color: rgba(246, 201, 0, 0.58);
    background: rgba(246, 201, 0, 0.11);
    color: var(--azure-soft);
}
.migration-filter-button.is-active span { background: rgba(246, 201, 0, 0.2); }
.migration-filter-reset { border-color: transparent; background: transparent; color: var(--azure-soft); }
.migration-filter-reset:hover { text-decoration: underline; }
.migration-filter-reset[hidden] { display: none; }
.migration-empty .ghost-button { margin-top: 10px; }

.migration-client-list {
    display: grid;
    grid-auto-rows: max-content;
    align-content: start;
    gap: 8px;
    max-height: 56vh;
    overflow: auto;
    padding-right: 3px;
}

.migration-client-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    width: 100%;
    min-height: 66px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.02);
    color: var(--text);
    text-align: left;
    cursor: pointer;
}

.migration-client-row:hover,
.migration-client-row.is-selected {
    border-color: rgba(246, 201, 0, 0.58);
    background: rgba(246, 201, 0, 0.08);
}

.migration-client-copy { min-width: 0; }
.migration-client-copy strong,
.migration-client-copy span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.migration-client-copy span { margin-top: 3px; color: var(--muted); font-size: 0.82rem; }
.migration-client-copy .migration-plan-chip {
    display: inline-block;
    max-width: 100%;
    margin-top: 5px;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--surface-3);
    color: var(--text);
    font-size: 0.72rem;
    font-weight: 700;
}
.migration-client-copy .migration-plan-chip.is-missing { background: rgba(244, 158, 76, 0.16); color: #f49e4c; }

.migration-avatar {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--surface-3);
    color: var(--text);
    font-weight: 800;
    background-position: center;
    background-size: cover;
}

.migration-stage {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 0 9px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 800;
    white-space: nowrap;
}

.migration-stage.is-joined { background: rgba(159, 216, 255, 0.12); color: var(--azure-soft); }
.migration-stage.is-subscribed { background: rgba(100, 214, 210, 0.13); color: #d98a00; }

.migration-client-detail {
    min-height: 250px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.025);
}

.migration-client-detail h3 { margin: 0 0 4px; }
.migration-detail-email { margin: 0 0 16px; color: var(--muted); overflow-wrap: anywhere; }
.migration-detail-grid { display: grid; gap: 10px; }
.migration-detail-row { display: flex; justify-content: space-between; gap: 12px; padding-bottom: 9px; border-bottom: 1px solid var(--line); }
.migration-detail-row span { color: var(--muted); }
.migration-detail-row strong { text-align: right; }
.migration-paid-through-row { align-items: center; }
.migration-paid-through-editor { display: inline-flex; align-items: center; gap: 7px; }
.migration-paid-through-editor input { min-width: 132px; padding: 7px 9px; }
.migration-paid-through-editor .ghost-button { min-height: 34px; padding: 6px 10px; }
.migration-plan-row { align-items: center; }
.migration-plan-row select { min-width: 190px; max-width: 100%; padding: 7px 9px; }
.migration-plan-note { margin: 12px 0 0; color: var(--muted); font-size: 0.78rem; line-height: 1.45; }
.migration-date-note { margin: 10px 0 0; color: var(--muted); font-size: 0.78rem; line-height: 1.45; }
.migration-detail-actions { display: grid; gap: 8px; margin-top: 16px; }
.migration-detail-actions .ghost-button {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    text-decoration: none;
}
.migration-empty { padding: 28px 16px; text-align: center; color: var(--muted); }

@media (max-width: 980px) {
    .migration-page-layout { grid-template-columns: 1fr; }
    .migration-page-layout .migration-client-list { min-height: 420px; max-height: 52vh; }
    .migration-page-layout .migration-client-detail { position: static; min-height: 0; }
    .migration-filter-row { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 760px) {
    .migration-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .migration-layout { grid-template-columns: 1fr; }
    .migration-client-list { max-height: 38vh; }
    .migration-paid-through-row { align-items: flex-start; flex-direction: column; }
    .migration-page-head { flex-direction: column; padding: 18px; }
    .migration-page-actions { width: 100%; justify-content: stretch; }
    .migration-page-actions > * { flex: 1; justify-content: center; text-align: center; }
    .migration-page-layout { grid-template-columns: 1fr; }
    .migration-page-layout .migration-client-list { min-height: 360px; max-height: 52vh; }
    .migration-page-layout .migration-client-detail { position: static; min-height: 0; }
}

@media (max-width: 760px) {
    .coach-program-panel { grid-template-columns: 1fr; }
    .coach-product-create { grid-template-columns: 1fr; }
    .coach-product-description-field { grid-column: auto; }
    .coach-product-card { grid-template-columns: 1fr; }
    .coach-product-card-controls { align-items: stretch; flex-direction: column; }
    .coach-product-card-controls > label:first-child { min-width: 0; }
}

.settings-form {
    display: grid;
    grid-template-columns: minmax(240px, 1fr) auto;
    gap: 12px;
    align-items: end;
}

.settings-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.settings-seat-card {
    display: grid;
    gap: 8px;
    min-height: 128px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
}

.settings-seat-card strong {
    font-size: 1.8rem;
    line-height: 1;
    color: #f7f7f4;
}

.settings-seat-card span {
    color: var(--muted);
}

.billing-panel {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}

.billing-summary-card {
    display: grid;
    gap: 8px;
    min-height: 128px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
}

.billing-summary-card span,
.billing-summary-card small {
    color: var(--muted);
}

.billing-summary-card strong {
    font-size: 1.45rem;
    line-height: 1.1;
    color: #f7f7f4;
}

.billing-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: end;
    margin-top: 12px;
}

.billing-seat-field {
    max-width: 260px;
}

.billing-actions {
    justify-content: flex-start;
}

.billing-actions .ghost-button,
.billing-actions .primary-button {
    min-width: 160px;
}

.settings-ok {
    color: var(--azure-soft);
}

/* ─── Member list ─── */

.member-list {
    display: grid;
    gap: 10px;
}

.member-row {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(240px, 0.9fr) auto;
    gap: 12px;
    align-items: center;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    transition: border-color 160ms ease;
}

.member-row:hover {
    border-color: var(--line-strong);
}

.member-copy {
    display: grid;
    gap: 4px;
    min-width: 0;
}

.member-copy strong,
.member-copy span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.member-meta {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
}

/* ─── Pager ─── */

.pager {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    margin-top: 14px;
}

.pager-status {
    font-size: 0.78rem;
    color: var(--muted);
}

.pager-controls {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
    margin-left: auto;
}

.pager-button {
    min-height: 32px;
    min-width: 32px;
    padding: 0 10px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text);
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    transition: border-color 160ms ease, background 160ms ease;
}

.pager-button:hover:not(:disabled),
.pager-button:focus-visible:not(:disabled) {
    border-color: var(--accent-hover-border);
    background: var(--accent-hover-bg);
}

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

.pager-button.is-active {
    border-color: var(--button-border);
    background: linear-gradient(90deg, rgba(246, 201, 0, 0.22), rgba(246, 201, 0, 0.08));
    color: #f7f7f4;
}

.pager-gap {
    padding: 0 2px;
    font-size: 0.78rem;
    color: var(--muted);
}

/* ─── Groups ─── */

.group-grid-layout > .panel:nth-child(2) {
    grid-column: span 4;
}

.group-create-form {
    display: grid;
    gap: 12px;
}

.group-form-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 160px;
    gap: 12px;
}

.group-create-form textarea {
    width: 100%;
    min-height: 92px;
    padding: 10px 12px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    background: var(--surface-3);
    color: var(--text);
    font: inherit;
    line-height: 1.5;
    resize: vertical;
}

.group-create-form textarea::placeholder {
    color: var(--muted-2);
}

.group-create-form textarea:focus {
    outline: none;
    border-color: rgba(246, 201, 0, 0.45);
    box-shadow: 0 0 0 3px rgba(246, 201, 0, 0.1);
}

.group-create-submit {
    width: 100%;
}

.primary-button.is-loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.primary-button.is-loading::after {
    content: '';
    position: absolute;
    inset: 0;
    margin: auto;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.45);
    border-top-color: #fff;
    animation: spin 700ms linear infinite;
}

.group-summary,
.group-card-grid,
.member-checklist {
    display: grid;
    gap: 10px;
}

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

.group-summary-card,
.group-card {
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
}

.group-summary-card {
    display: grid;
    gap: 6px;
    min-height: 108px;
}

.group-summary-card strong {
    font-size: 1.4rem;
    line-height: 1;
    color: #f7f7f4;
}

.group-card-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.group-card {
    display: grid;
    gap: 12px;
    text-align: left;
    cursor: pointer;
    transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.group-card:hover,
.group-card:focus-visible {
    border-color: rgba(246, 201, 0, 0.3);
    background: rgba(246, 201, 0, 0.06);
    transform: translateY(-1px);
}

.group-card-top,
.group-member-row,
.modal-actions,
.modal-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
}

.modal-head {
    padding-bottom: 14px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 4px;
}

.group-card-copy,
.group-card-copy span,
.group-member-copy,
.group-member-copy span {
    min-width: 0;
}

.group-card-copy {
    display: grid;
    gap: 4px;
}

.group-card-copy span,
.group-modal-meta,
.group-pill-row,
.group-subtle {
    color: var(--muted);
    font-size: 0.88rem;
}

.group-member-preview,
.group-pill-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.mini-pill {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 0 10px;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.03);
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 700;
}

.group-swatch {
    width: 12px;
    height: 12px;
    border-radius: 999px;
    flex: 0 0 auto;
    margin-top: 4px;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.06);
}

/* ─── Modal ─── */

.modal {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: grid;
    place-items: center;
    padding: 18px;
}

.modal.hidden {
    display: none !important;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(4, 8, 18, 0.78);
    backdrop-filter: blur(12px);
}

.modal-card {
    position: relative;
    z-index: 1;
    width: min(100%, 1080px);
    max-height: min(88vh, 920px);
    overflow: auto;
    padding: 20px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.group-modal-grid {
    display: grid;
    grid-template-columns: minmax(280px, 0.9fr) minmax(0, 1.1fr);
    gap: 14px;
}

.group-modal-footer {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 12px;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
}

.member-checklist {
    max-height: 62vh;
    overflow: auto;
    padding-right: 2px;
    scrollbar-width: thin;
    scrollbar-color: var(--surface-4) transparent;
}

.group-member-search {
    margin: 10px 0;
}

.group-member-row {
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-3);
    align-items: center;
    transition: border-color 160ms ease;
}

.group-member-row:hover {
    border-color: var(--line-strong);
}

.group-member-row input {
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: var(--azure-strong);
    flex: 0 0 auto;
}

.group-member-copy {
    display: grid;
    gap: 3px;
}

/* ─── Danger ─── */

.danger-button {
    border-color: rgba(251, 113, 133, 0.3);
    color: #ffd7db;
}

.danger-button:hover,
.danger-button:focus-visible {
    background: rgba(251, 113, 133, 0.1);
    border-color: rgba(251, 113, 133, 0.5);
}

.is-hidden {
    display: none !important;
}

/* ─── Responsive: 1100px ─── */

@media (max-width: 1100px) {
    .dash-shell {
        grid-template-columns: 1fr;
        gap: 0;
    }

    /* The rail becomes a full-width strip sitting directly under the topbar,
       still edge-to-edge rather than an inset card. */
    .side-rail {
        position: sticky;
        top: var(--topbar-h);
        z-index: 20;
        height: auto;
        overflow: visible;
        padding: 6px clamp(10px, 2vw, 18px);
        border-right: none;
        border-bottom: 1px solid var(--line-strong);
        background: var(--chrome);
        backdrop-filter: blur(18px) saturate(1.4);
    }

    .dash-main {
        padding-top: 18px;
    }

    .rail-label {
        display: none;
    }

    /* The rail is a horizontal strip here, so groups flatten back into plain
       tabs and every section on a page stays visible. */
    .nav-group {
        display: contents;
    }

    .page-subnav,
    .page-tab-caret {
        display: none !important;
    }

    .panel.is-section-hidden,
    .dashboard-grid.is-section-hidden {
        display: grid;
    }

    .page-nav {
        flex-direction: row;
        overflow-x: auto;
        gap: 3px;
        scrollbar-width: none;
    }

    .page-tab {
        width: auto;
        white-space: nowrap;
        min-height: 40px;
        padding: 0 14px;
        justify-content: center;
    }

    .page-tab.is-active {
        background: var(--surface-3);
        box-shadow: 0 0 0 1px rgba(246, 201, 0, 0.18) inset;
    }

    .page-tab.is-active::before {
        display: none;
    }

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

    .panel.wide,
    .athlete-grid > .panel:nth-child(2),
    .group-grid-layout > .panel:nth-child(2) {
        grid-column: 1 / -1;
    }

    .leaderboard-layout,
    .detail-grid,
    .detail-duo,
    .detail-trio {
        grid-template-columns: 1fr;
    }


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

    .push-field-workout,
    .push-field-date {
        grid-column: span 1;
    }

    .push-audience-row,
    .push-field-note,
    .push-submit-button {
        grid-column: 1 / -1;
    }

    .builder-top-grid {
        grid-template-columns: 1fr 1fr;
    }

    .builder-create-grid {
        grid-template-columns: 1fr 1fr;
    }

    .builder-create-actions {
        grid-column: 1 / -1;
    }

    .builder-top-grid .grow,
    .push-field-note {
        grid-column: 1 / -1;
    }

    .builder-row-controls {
        grid-template-columns: 1fr 1fr;
    }

    .create-team-form {
        grid-template-columns: 1fr;
    }

    .settings-form {
        grid-template-columns: 1fr;
    }

    .settings-actions {
        grid-column: 1 / -1;
        justify-content: flex-start;
    }

    .billing-panel,
    .billing-controls {
        grid-template-columns: 1fr 1fr;
    }

    .billing-seat-field,
    .billing-actions {
        grid-column: 1 / -1;
    }

    .podium-grid {
        grid-template-columns: 1fr;
        min-height: 0;
    }

    .podium-grid .podium-card {
        grid-column: auto;
        grid-row: auto;
    }

    .group-card-grid,
    .group-modal-grid {
        grid-template-columns: 1fr;
    }
}

/* ─── Responsive: 780px ─── */

@media (max-width: 780px) {
    .shell {
        width: 100%;
        padding: 0 0 92px; /* leave room for the fixed bottom nav */
    }

    .dash-main {
        padding: 14px 14px 24px;
    }

    /* Team calendar is too wide to be useful on phones — hide it on overview. */
    .overview-calendar-panel {
        display: none;
    }

    /* ── Compact topbar: brand + account on a single row ── */
    .topbar {
        top: 0;
        grid-template-columns: auto 1fr;
        gap: 8px 10px;
        min-height: 0;
        padding: 8px 12px;
    }

    .brand img { width: 106px; }
    .account { justify-content: flex-end; }

    /* ── Bottom tab bar navigation ── */
    .dash-shell {
        display: block;
        margin-top: 0;
    }

    .side-rail {
        position: fixed;
        top: auto;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 50;
        display: block;
        padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px));
        border: none;
        border-top: 1px solid var(--line-strong);
        border-radius: 0;
        background: rgba(13, 13, 13, 0.97);
        backdrop-filter: blur(18px) saturate(1.4);
        box-shadow: 0 -6px 24px rgba(0, 0, 0, 0.5);
    }

    .rail-label { display: none; }

    .page-nav {
        flex-direction: row;
        justify-content: space-between;
        gap: 0;
        overflow: visible;
    }

    .page-tab {
        flex: 1 1 0;
        min-width: 0;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        min-height: 50px;
        padding: 5px 2px;
        border-radius: 9px;
        font-size: 0.6rem;
        font-weight: 700;
        text-align: center;
        color: var(--muted);
        background: transparent;
    }

    .page-tab svg { width: 21px; height: 21px; opacity: 0.7; }

    .page-tab span {
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .page-tab.is-active {
        color: var(--azure-strong);
        background: rgba(246, 201, 0, 0.11);
    }

    .page-tab.is-active svg { opacity: 1; color: var(--azure-strong); }
    .page-tab.is-active::before { display: none; }

    /* ── Spacing / stacking ── */
    .panel { padding: 14px; }
    .dashboard-grid { gap: 12px; }
    .page-heading { padding: 6px 0 12px; }

    .page-heading,
    .panel-head,
    .detail-hero {
        flex-direction: column;
        align-items: stretch;
    }

    .invite-card { flex: 1 1 140px; min-width: 0; }

    .kpi-grid,
    .detail-stats,
    .activity-stat-grid {
        grid-template-columns: 1fr 1fr;
    }

    .kpi { min-height: 100px; padding: 14px; }
    .kpi strong { font-size: 1.7rem; }

    .bar-chart {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .calendar-grid { gap: 5px; }

    .calendar-cell {
        min-height: 62px;
        padding: 6px;
    }

    .calendar-cell-team {
        min-height: 128px;
        grid-template-rows: auto 68px minmax(0, 1fr);
    }

    .calendar-cell-volume { gap: 3px; }

    th, td { padding: 10px 8px; }

    .push-form {
        grid-template-columns: 1fr;
    }

    .push-field-workout,
    .push-field-date,
    .push-submit-button,
    .push-field-note,
    .push-audience-row {
        grid-column: 1 / -1;
    }

    .push-audience-row {
        padding: 16px;
    }

    .push-audience-heading {
        display: grid;
        gap: 10px;
    }

    .push-audience-heading strong {
        justify-self: start;
    }

    .push-audience-card {
        flex-basis: 142px;
        min-height: 132px;
    }

    .builder-top-grid,
    .builder-row-controls,
    .builder-result-card,
    .builder-create-grid {
        grid-template-columns: 1fr;
    }

    .builder-search-row,
    .builder-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .workout-library-preview {
        padding-left: 0;
    }

    .create-team-form,
    .group-summary,
    .billing-panel,
    .billing-controls {
        grid-template-columns: 1fr;
    }

    .group-form-row {
        grid-template-columns: 1fr;
    }

    .settings-form,
    .member-row {
        grid-template-columns: 1fr;
    }

    .member-meta {
        justify-content: flex-start;
    }

    .line-chart-card {
        overflow-x: auto;
    }

    .line-chart-card svg {
        min-width: 640px;
    }

    /* ── Modals: near full-screen sheets ── */
    .modal { padding: 10px; }

    .modal-card {
        padding: 16px;
        max-height: 94vh;
        width: 100%;
    }
}

@media (max-width: 480px) {
    .kpi-grid { grid-template-columns: 1fr 1fr; }

    /* Keep day cells legible — color + date carry the meaning, drop the cramped text */
    .calendar-cell-volume .calendar-stat { display: none; }
    .calendar-cell { min-height: 52px; }

    .page-tab span { font-size: 0.56rem; }

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

    .muscle-figure svg { height: 300px; }
}

/* ── Gym Branding ─────────────────────────────────────── */
.branding-switch {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
}

.branding-switch input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.branding-switch-track {
    position: relative;
    width: 46px;
    height: 26px;
    border-radius: 999px;
    background: var(--surface-4);
    border: 1px solid var(--line-strong);
    transition: background 0.18s ease;
    flex: none;
}

.branding-switch-thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--text);
    transition: transform 0.18s ease;
}

.branding-switch input:checked + .branding-switch-track {
    background: var(--green);
    border-color: var(--green);
}

.branding-switch input:checked + .branding-switch-track .branding-switch-thumb {
    transform: translateX(20px);
    background: #04140d;
}

.branding-switch-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
}

.branding-panel {
    display: flex;
    flex-direction: column;
    gap: 18px;
    margin-top: 6px;
}

.branding-panel.is-disabled {
    opacity: 0.5;
    pointer-events: none;
}

.branding-logo-field {
    display: flex;
    gap: 16px;
    align-items: center;
    flex-wrap: wrap;
}

.branding-logo-preview {
    width: 84px;
    height: 84px;
    border-radius: var(--radius-sm);
    border: 1px dashed var(--line-strong);
    background: var(--surface-3);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex: none;
}

.branding-logo-preview img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.branding-logo-empty {
    font-size: 11px;
    color: var(--muted-2);
}

.branding-logo-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
}

/* Buttons rendered as <label> need explicit flex centering (labels are
   inline by default, so min-height / text-centering don't apply otherwise). */
.branding-logo-actions .ghost-button {
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.branding-link-field {
    max-width: 420px;
}

.app-theme-options-title {
    margin: 0 0 10px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .12em;
    text-align: center;
    text-transform: uppercase;
}

.app-theme-options {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

/* Rows are laid out on a shared grid so the hex values line up across both
   cards, making the two default schemes directly comparable. */
.app-theme-card {
    display: grid;
    grid-template-rows: auto 1fr;
    gap: 14px;
    padding: 14px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
}

.app-theme-card-head {
    display: flex;
    align-items: center;
    gap: 14px;
}

.app-theme-hexes {
    display: grid;
    gap: 6px;
    margin: 0;
    align-content: start;
}

.app-theme-hex-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 5px 9px;
    border-radius: 8px;
    background: var(--surface-3);
}

.app-theme-hex-row dt {
    display: flex;
    align-items: center;
    gap: 7px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
}

.app-theme-hex-row dd {
    margin: 0;
    color: var(--text);
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .02em;
}

.app-theme-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,.18);
    flex: none;
}

.app-theme-dot.is-blue-primary { background: #F5F5F2; }
.app-theme-dot.is-blue-secondary { background: #C8C8C2; }
.app-theme-dot.is-blue-accent { background: #FFFFFF; }
.app-theme-dot.is-pink-primary { background: #111111; }
.app-theme-dot.is-pink-secondary { background: #3A3A38; }
.app-theme-dot.is-pink-accent { background: #1A1A19; }
.app-theme-dot.is-blue-background { background: #080808; }
.app-theme-dot.is-pink-background { background: #F4F3EF; }

.app-theme-card strong {
    display: block;
    font-size: 14px;
    color: var(--text);
}

.app-theme-card p {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 12px;
}

.app-theme-phone,
.app-color-phone {
    width: 52px;
    height: 82px;
    border-radius: 14px;
    border: 1px solid rgba(255,255,255,.16);
    padding: 9px 7px;
    display: grid;
    gap: 7px;
    align-content: start;
    flex: none;
}

.app-theme-phone span,
.app-theme-phone strong,
.app-theme-phone small,
.app-color-phone span,
.app-color-phone strong,
.app-color-phone small {
    display: block;
    border-radius: 999px;
}

.app-theme-phone span,
.app-color-phone span {
    width: 18px;
    height: 18px;
}

.app-theme-phone strong,
.app-color-phone strong {
    width: 34px;
    height: 7px;
}

.app-theme-phone small,
.app-color-phone small {
    width: 28px;
    height: 22px;
    border-radius: 7px;
}

.app-theme-phone.is-blue {
    background: #0A0B0E;
}

.app-theme-phone.is-blue span { background: #F5F5F2; }
.app-theme-phone.is-blue strong { background: #C8C8C2; }
.app-theme-phone.is-blue small { background: #202020; }

.app-theme-phone.is-pink {
    background: #FFF6FA;
    border-color: #EBC7D5;
}

.app-theme-phone.is-pink span { background: #111111; }
.app-theme-phone.is-pink strong { background: #3A3A38; }
.app-theme-phone.is-pink small { background: #E8E7E2; }

.app-color-panel {
    display: grid;
    gap: 18px;
}

.app-color-panel.is-disabled {
    opacity: 0.5;
    pointer-events: none;
}

/* Mirrors the app's profile screen. Neutrals are computed in coach.js by
   deriveAppPalette(), which is a direct port of TeamAppColorScheme's derivation
   in Models.swift — keep the two in step or this preview will lie. */
.app-color-preview {
    --preview-primary: #F5F5F2;
    --preview-secondary: #C8C8C2;
    --preview-accent: #FFFFFF;
    /* These are placeholders only. coach.js overwrites all seven from
       deriveAppPalette() on every render, mirroring the app's own derivation. */
    --app-bg: #0B0D12;
    --app-surface: #141720;
    --app-surface-light: #1F2430;
    --app-border: #2A303D;
    --app-text: #FFFFFF;
    --app-text-2: #B8C0CC;
    --app-text-3: #87909F;
    display: flex;
    /* Top-aligned so the legend starts level with the top of the phone. */
    align-items: flex-start;
    gap: 22px;
    flex-wrap: wrap;
}

.app-phone-preview {
    width: 208px;
    flex: none;
    padding: 7px;
    border-radius: 26px;
    background: #1a1d24;
    border: 1px solid var(--line-strong);
    box-shadow: 0 12px 28px rgba(0,0,0,.34);
}

.app-phone-screen {
    display: grid;
    gap: 8px;
    padding: 7px 9px 9px;
    border-radius: 20px;
    background: var(--app-bg);
    color: var(--app-text);
}

.app-phone-statusbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 8px;
    font-weight: 700;
    color: var(--app-text);
}

.app-phone-statusbar-icons {
    display: inline-flex;
    gap: 2px;
}

.app-phone-statusbar-icons i {
    width: 8px;
    height: 5px;
    border-radius: 1.5px;
    background: var(--app-text-3);
}

.app-phone-navbar {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    font-size: 10px;
    font-weight: 700;
}

.app-phone-gear {
    position: absolute;
    right: 0;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    border: 1.5px solid var(--app-text-2);
}

.app-phone-identity {
    display: grid;
    justify-items: center;
    gap: 2px;
}

.app-phone-avatar {
    position: relative;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--app-surface-light);
    /* Avatar ring carries the secondary color. */
    box-shadow: 0 0 0 2px var(--preview-secondary);
    margin-bottom: 3px;
}

.app-phone-verified {
    position: absolute;
    right: -1px;
    bottom: -1px;
    width: 13px;
    height: 13px;
    border-radius: 50%;
    background: var(--preview-primary);
    border: 2px solid var(--app-bg);
}

.app-phone-identity strong { font-size: 11px; font-weight: 700; }
.app-phone-identity small { font-size: 8.5px; color: var(--app-text-3); }

.app-phone-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    padding: 7px 4px;
    border-radius: 10px;
    background: var(--app-surface);
}

.app-phone-stats div {
    display: grid;
    justify-items: center;
    gap: 1px;
}

.app-phone-stats b { font-size: 10px; font-weight: 800; }
.app-phone-stats span { font-size: 7px; color: var(--app-text-3); }

.app-phone-cta {
    padding: 6px;
    border-radius: 9px;
    background: var(--app-surface-light);
    border: 1px solid var(--app-border);
    font-size: 9px;
    font-weight: 700;
    text-align: center;
}

.app-phone-segments {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    padding-bottom: 5px;
    border-bottom: 1px solid var(--app-border);
}

.app-phone-segments span {
    height: 3px;
    border-radius: 2px;
    background: var(--app-text-3);
    opacity: .5;
}

/* Selected content tab picks up the primary color, as in the app. */
.app-phone-segments span.is-active {
    background: var(--preview-primary);
    opacity: 1;
    box-shadow: 0 6px 0 -4px var(--preview-primary);
}

.app-phone-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2px;
}

.app-phone-grid i {
    aspect-ratio: 1;
    border-radius: 3px;
}

.app-phone-grid i.is-primary { background: color-mix(in srgb, var(--preview-primary) 78%, var(--app-bg)); }
.app-phone-grid i.is-secondary { background: color-mix(in srgb, var(--preview-secondary) 62%, var(--app-bg)); }
.app-phone-grid i.is-accent { background: color-mix(in srgb, var(--preview-accent) 48%, var(--app-bg)); }

.app-phone-tabbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 6px 2px;
    border-top: 1px solid var(--app-border);
}

.app-phone-tabbar span {
    width: 9px;
    height: 9px;
    border-radius: 2.5px;
    background: var(--app-text-3);
    opacity: .55;
}

.app-phone-tabbar span.is-active {
    background: var(--preview-primary);
    opacity: 1;
}

.app-phone-fab {
    width: 20px !important;
    height: 20px !important;
    border-radius: 50% !important;
    background: var(--preview-primary) !important;
    opacity: 1 !important;
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--preview-accent) 55%, transparent);
}

.app-color-contrast {
    margin: 10px 0 0;
    font-size: 12px;
    line-height: 1.5;
}

.app-color-legend {
    min-width: 210px;
    flex: 1;
}

.app-color-legend-title {
    margin: 0 0 4px;
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
}

.app-color-legend-note {
    margin: 0 0 12px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.5;
}

.app-color-legend-list {
    display: grid;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.app-color-legend-list li {
    display: grid;
    grid-template-columns: auto auto 1fr;
    align-items: center;
    gap: 9px;
}

.app-color-legend-list span {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 1px solid var(--line-strong);
}

.app-color-legend-list b {
    font-size: 12px;
    font-weight: 700;
    color: var(--text);
}

.app-color-legend-list em {
    font-style: normal;
    font-size: 11px;
    color: var(--muted);
}

.app-color-fields {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 160px));
    gap: 14px;
}

.app-color-fields input[type="color"] {
    width: 100%;
    min-height: 44px;
    padding: 4px;
    cursor: pointer;
}

/* ─── Messages - Instagram Style Layout ─── */

.messages-container {
    display: grid;
    grid-template-columns: minmax(260px, 25%) 1fr;
    gap: 0;
    height: calc(100vh - 190px);
    min-height: 480px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--surface);
}

.messages-sidebar {
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border-right: 1px solid var(--line-strong);
    min-width: 0;
    min-height: 0;
}

.messages-chat {
    display: flex;
    flex-direction: column;
    background: var(--surface);
    min-width: 0;
    min-height: 0;
}

.sidebar-header {
    padding: 18px 16px 10px;
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.sidebar-header h3 {
    margin: 0;
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.sidebar-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 16px 12px;
    flex-shrink: 0;
}

.conversation-search-input {
    flex: 1;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    padding: 7px 11px;
    background: var(--surface-3);
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--text);
    font-size: 12.5px;
}

.conversation-search-input::placeholder {
    color: var(--muted);
}

.conversation-search-input:focus {
    outline: none;
    border-color: var(--azure);
    box-shadow: 0 0 0 3px rgba(246, 201, 0, 0.16);
}

.filter-select {
    padding: 5px 8px;
    background: var(--surface-3);
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--muted);
    font-size: 12px;
    cursor: pointer;
}

.filter-select:hover {
    border-color: var(--line-strong);
    color: var(--text);
}

.conversations-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 4px 8px 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.conversations-empty {
    padding: 32px 16px;
    color: var(--muted);
    text-align: center;
    font-size: 13px;
}

.conversation-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 10px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background-color 140ms ease;
    min-width: 0;
}

.conversation-item:hover {
    background: var(--surface-2);
}

.conversation-item.active {
    background: var(--surface-3);
}

.convo-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    font-weight: 700;
    color: var(--bg);
    background: linear-gradient(135deg, var(--azure-strong), #d98a00);
    overflow: hidden;
    user-select: none;
}

.convo-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.convo-avatar.group {
    background: linear-gradient(135deg, #34d399, var(--azure-strong));
}

.conversation-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.conversation-top {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
}

.conversation-title {
    font-weight: 600;
    font-size: 13.5px;
    color: var(--text);
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.conversation-time {
    font-size: 11px;
    color: var(--muted);
    flex-shrink: 0;
}

.conversation-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.conversation-preview {
    font-size: 12.5px;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 0;
    min-width: 0;
}

.conversation-item.unread .conversation-title,
.conversation-item.unread .conversation-preview {
    color: var(--text);
    font-weight: 700;
}

.unread-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--azure-strong);
    flex-shrink: 0;
    display: none;
}

.conversation-item.unread .unread-dot {
    display: inline-block;
}

/* ─── Chat View ─── */

.chat-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--line-strong);
    background: var(--surface);
    flex-shrink: 0;
    min-height: 64px;
}

.chat-back-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 50%;
    color: var(--text);
    cursor: pointer;
    flex-shrink: 0;
}

.chat-back-btn:hover {
    background: var(--surface-3);
}

.chat-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    flex-shrink: 0;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    color: var(--bg);
    background: linear-gradient(135deg, var(--azure-strong), #d98a00);
    overflow: hidden;
    user-select: none;
}

.chat-avatar.visible {
    display: flex;
}

.chat-avatar.group {
    background: linear-gradient(135deg, #34d399, var(--azure-strong));
}

.chat-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

#chat-header-info {
    min-width: 0;
}

#chat-title {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-subtitle {
    margin: 1px 0 0 0;
    font-size: 12px;
    color: var(--muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-messages-area {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 16px 16px 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.chat-messages-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    height: 100%;
    color: var(--muted);
    text-align: center;
    padding: 24px;
}

.chat-messages-empty .empty-icon {
    width: 76px;
    height: 76px;
    border-radius: 50%;
    border: 2px solid var(--line-strong);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
}

.chat-messages-empty h3 {
    margin: 4px 0 0;
    font-size: 17px;
    font-weight: 600;
    color: var(--text);
}

.chat-messages-empty p {
    margin: 0;
    font-size: 13px;
}

.chat-time-divider {
    text-align: center;
    font-size: 11px;
    color: var(--muted);
    margin: 14px 0 6px;
    user-select: none;
}

.chat-message {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    max-width: 68%;
}

.chat-message.sent {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.chat-message.received {
    align-self: flex-start;
}

.chat-message + .chat-message {
    margin-top: 2px;
}

.chat-msg-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    color: var(--bg);
    background: linear-gradient(135deg, var(--azure-strong), #d98a00);
    overflow: hidden;
    user-select: none;
}

.chat-msg-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.chat-msg-avatar.spacer {
    visibility: hidden;
}

.chat-sender-name {
    font-size: 11px;
    color: var(--muted);
    margin: 8px 0 2px 48px;
    align-self: flex-start;
}

.chat-message-content {
    padding: 8px 13px;
    border-radius: 18px;
    font-size: 13.5px;
    line-height: 1.45;
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: pre-wrap;
    min-width: 0;
}

.chat-message.sent .chat-message-content {
    background: var(--azure-strong);
    color: var(--bg);
    border-bottom-right-radius: 5px;
}

.chat-message.received .chat-message-content {
    background: var(--surface-3);
    color: var(--text);
    border-bottom-left-radius: 5px;
}

.chat-workout-card {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 11px 13px;
    border-radius: 16px;
    border: 1px solid var(--line-strong);
    background: var(--surface-2);
    color: var(--text);
    font-size: 13px;
    min-width: 240px;
    max-width: 320px;
    text-align: left;
    transition: border-color 140ms ease, background-color 140ms ease, transform 140ms ease;
}

.chat-workout-card[role="button"] {
    cursor: pointer;
}

.chat-workout-card[role="button"]:hover {
    border-color: var(--azure-strong);
    background: var(--surface-3);
}

.chat-workout-card[role="button"]:active {
    transform: scale(0.99);
}

.chat-workout-card[role="button"]:focus-visible {
    outline: 2px solid var(--azure-strong);
    outline-offset: 2px;
}

.chat-workout-card .workout-icon {
    color: var(--azure-strong);
    flex-shrink: 0;
    display: flex;
    width: 38px;
    height: 38px;
    align-items: center;
    justify-content: center;
    border-radius: 11px;
    background: rgba(246, 201, 0, 0.12);
}

.chat-workout-card .workout-card-copy {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
    flex: 1;
}

.chat-workout-card .workout-card-name {
    font-weight: 600;
    font-size: 13.5px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-workout-card .workout-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11.5px;
    color: var(--muted);
}

.workout-status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
    background: var(--muted);
}

.workout-status-dot.is-complete {
    background: #34d399;
}

.workout-status-dot.is-pending {
    background: var(--azure-strong);
}

.workout-status-dot.is-cancelled {
    background: #f87171;
}

.chat-workout-card .workout-card-chevron {
    color: var(--muted);
    flex-shrink: 0;
    display: flex;
}

.chat-message.sent .chat-workout-card {
    background: var(--surface-2);
}

/* ─── Workout picker modal ─── */

.workout-picker-card {
    width: min(100%, 520px);
}

.helper-inline {
    color: var(--muted);
    font-weight: 400;
}

.workout-picker-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
    max-height: 52vh;
    overflow-y: auto;
    padding-right: 2px;
}

.workout-picker-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface-3);
    color: var(--text);
    cursor: pointer;
    text-align: left;
    transition: border-color 140ms ease, background-color 140ms ease;
}

.workout-picker-item:hover {
    border-color: var(--azure-strong);
    background: var(--surface-4);
}

.workout-picker-item:disabled {
    opacity: 0.5;
    cursor: default;
}

.workout-picker-item.is-sending {
    border-color: var(--azure-strong);
}

.workout-picker-icon {
    width: 40px;
    height: 40px;
    border-radius: 11px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--wk-color, var(--azure-strong));
    background: color-mix(in srgb, var(--wk-color, var(--azure-strong)) 15%, transparent);
}

.workout-picker-copy {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1;
}

.workout-picker-name {
    font-weight: 600;
    font-size: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.workout-picker-desc {
    font-size: 12px;
    color: var(--muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.workout-picker-meta {
    font-size: 11px;
    color: var(--muted-2);
}

.workout-picker-action {
    flex-shrink: 0;
    font-size: 12.5px;
    font-weight: 700;
    color: var(--azure-strong);
}

.day-exercises-head {
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 4px;
}

/* ─── Quick Import ─── */

.quick-import {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.quick-import-dropzone {
    border: 1.5px dashed var(--line-strong);
    border-radius: var(--radius);
    background: var(--surface-2);
    padding: 28px 20px;
    cursor: pointer;
    transition: border-color 140ms ease, background-color 140ms ease;
}

.quick-import-dropzone:hover {
    border-color: var(--azure-strong);
    background: var(--surface-3);
}

.quick-import-dropzone.is-dragging {
    border-color: var(--azure-strong);
    background: rgba(246, 201, 0, 0.08);
}

.quick-import-drop-inner {
    display: flex;
    align-items: center;
    gap: 16px;
    justify-content: center;
}

.quick-import-drop-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--azure-strong);
    background: rgba(246, 201, 0, 0.12);
}

.quick-import-drop-copy {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.quick-import-drop-copy strong {
    font-size: 14.5px;
    font-weight: 600;
}

.quick-import-drop-copy span {
    font-size: 12.5px;
    color: var(--muted);
}

.quick-import-browse {
    color: var(--azure-strong);
    text-decoration: underline;
}

.quick-import-selected {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    background: var(--surface-2);
}

.quick-import-file-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--azure-strong);
    background: rgba(246, 201, 0, 0.12);
}

.quick-import-file-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
}

.quick-import-file-meta strong {
    font-size: 13.5px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.quick-import-file-meta span {
    font-size: 12px;
    color: var(--muted);
}

.quick-import-file-remove {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: var(--muted);
    cursor: pointer;
    transition: color 140ms ease, background-color 140ms ease;
}

.quick-import-file-remove:hover {
    color: var(--text);
    background: var(--surface-4);
}

.quick-import-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

#quick-import-feedback.is-error {
    color: #f87171;
}

/* Time-based progress bar shown while the document is parsed with AI. */
.quick-import-progress {
    height: 8px;
    width: 100%;
    margin: 4px 0 6px;
    border-radius: 999px;
    background: var(--surface-3);
    overflow: hidden;
}
.quick-import-progress.hidden { display: none; }
.quick-import-progress-fill {
    position: relative;
    height: 100%;
    width: 0;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--accent, #f6c900), #d98a00, var(--accent, #f6c900));
    background-size: 200% 100%;
    overflow: hidden;
    /* Each stepped jump glides in rather than snapping. */
    transition: width 0.6s cubic-bezier(0.22, 0.61, 0.36, 1);
    /* Constant motion even while the width holds between jumps. */
    animation: qi-progress-flow 2.6s linear infinite;
}
.quick-import-progress-fill::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.5) 50%, transparent 100%);
    transform: translateX(-60%);
    animation: qi-progress-sheen 1.6s ease-in-out infinite;
}
@keyframes qi-progress-flow {
    0% { background-position: 0% 50%; }
    100% { background-position: -200% 50%; }
}
@keyframes qi-progress-sheen {
    0% { transform: translateX(-60%); opacity: 0; }
    30% { opacity: 1; }
    100% { transform: translateX(260%); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
    .quick-import-progress-fill { animation: none; transition: width 0.3s ease; }
    .quick-import-progress-fill::after { animation: none; opacity: 0; }
}

.quick-import-results {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.quick-import-results:empty {
    display: none;
}

.qi-workout {
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    background: var(--surface-2);
    /* Must stay visible so an exercise's "Superset With" dropdown can extend
       past the card edge instead of being clipped. The card keeps its rounded
       look via its own border-radius (backgrounds respect it) and the head
       rounding below. */
    overflow: visible;
}

.qi-workout.is-open {
    border-color: var(--azure-strong);
}

.qi-workout-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    cursor: pointer;
    /* Keep the hover background within the card's rounded corners now that the
       card no longer clips its children. */
    border-radius: var(--radius);
}

.qi-workout.is-open .qi-workout-head {
    border-radius: var(--radius) var(--radius) 0 0;
}

.qi-workout-head:hover {
    background: var(--surface-3);
}

.qi-workout-swatch {
    width: 12px;
    height: 12px;
    border-radius: 4px;
    flex-shrink: 0;
}

.qi-workout-title {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
}

.qi-workout-title strong {
    font-size: 14px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.qi-workout-title span {
    font-size: 12px;
    color: var(--muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.qi-workout-remove {
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: var(--muted);
    cursor: pointer;
    transition: color 140ms ease, background-color 140ms ease;
}

.qi-workout-remove:hover {
    color: #f87171;
    background: rgba(248, 113, 113, 0.1);
}

.qi-workout-caret {
    flex-shrink: 0;
    display: flex;
    color: var(--muted);
    transition: transform 160ms ease;
}

.qi-workout.is-open .qi-workout-caret {
    transform: rotate(180deg);
}

.qi-workout-body {
    padding: 4px 14px 16px;
    border-top: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.qi-field-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
    gap: 10px;
    margin-top: 10px;
}

.qi-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.qi-field > span {
    font-size: 11.5px;
    color: var(--muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.qi-field input {
    padding: 8px 10px;
    background: var(--surface-3);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: inherit;
    font-size: 13px;
}

.qi-field input:focus {
    border-color: var(--azure-strong);
    outline: none;
}

.qi-exercises {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.qi-exercise {
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-3);
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.qi-exercise-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
}

.qi-exercise-name {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.qi-exercise-name strong {
    font-size: 13px;
    font-weight: 600;
}

.qi-exercise-tags {
    font-size: 11px;
    color: var(--muted);
    text-transform: capitalize;
}

.qi-exercise-tags em {
    font-style: normal;
    color: var(--azure-strong);
    text-transform: uppercase;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.qi-exercise-remove {
    flex-shrink: 0;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 7px;
    color: var(--muted);
    cursor: pointer;
    transition: color 140ms ease, background-color 140ms ease;
}

.qi-exercise-remove:hover {
    color: #f87171;
    background: rgba(248, 113, 113, 0.1);
}

.qi-exercise-fields {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.qi-programming-section {
    margin-top: 2px;
    padding: 8px;
    background: var(--surface-2);
}

.qi-programming-section .programming-inline-row {
    grid-template-columns: minmax(140px, 0.7fr) minmax(220px, 1.3fr);
}

.qi-mini-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 70px;
}

.qi-mini-field.grow {
    flex: 1;
    width: auto;
    min-width: 118px;
}

/* Give the Advanced control room so its icon + label read on one line instead
   of being squished into the default 70px mini-field width. It keeps a fixed
   footprint and never shrinks; Notes (the flexible field above) gives way. */
.qi-advanced-field {
    width: 132px;
    flex: 0 0 auto;
}

.qi-mini-field > span {
    font-size: 10.5px;
    color: var(--muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.qi-mini-field input,
.qi-mini-field select {
    padding: 7px 9px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: inherit;
    font-size: 13px;
    width: 100%;
}

.qi-mini-field input:focus,
.qi-mini-field select:focus {
    border-color: var(--azure-strong);
    outline: none;
}

.qi-empty {
    font-size: 12.5px;
    color: var(--muted);
    margin: 0;
}

.quick-import-confirm-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    background: var(--surface-2);
    position: sticky;
    bottom: 0;
}

.quick-import-confirm-summary {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text);
}

@media (max-width: 640px) {
    .qi-field-row {
        grid-template-columns: 1fr;
    }
    .qi-mini-field {
        width: calc(50% - 4px);
    }
    .qi-mini-field.grow {
        width: 100%;
    }
    .qi-advanced-field {
        width: 100%;
    }
}

/* ─── Team calendar audience + day detail ─── */

.calendar-audience {
    max-width: 220px;
}

.calendar-audience-combobox {
    width: min(340px, 34vw);
}

.calendar-month-nav {
    display: flex;
    align-items: center;
    gap: 10px;
}

.mini-spinner {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid var(--line-strong);
    border-top-color: var(--azure-strong);
    display: inline-block;
    animation: spin 640ms linear infinite;
}

.team-day-section {
    padding: 16px 0;
    border-top: 1px solid var(--line);
}

.team-day-section:first-child {
    padding-top: 4px;
    border-top: none;
}

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

.team-day-section-head h4 {
    margin: 0;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
}

.team-day-count {
    font-size: 12px;
    color: var(--muted-2);
    background: var(--surface-3);
    border-radius: 999px;
    padding: 2px 9px;
}

.team-day-empty {
    margin: 0;
    font-size: 13px;
    color: var(--muted);
}

.team-day-push {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    cursor: pointer;
    transition: border-color 140ms ease, background-color 140ms ease;
}

.team-day-push-wrap + .team-day-push-wrap {
    margin-top: 8px;
}

.team-day-push-wrap {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    transition: border-color 140ms ease, box-shadow 140ms ease;
}

.team-day-push-wrap.is-expanded {
    border-color: rgba(246, 201, 0, 0.34);
    box-shadow: 0 10px 30px rgba(2, 12, 27, 0.2);
}

.team-day-push-wrap .team-day-push {
    border: 0;
    border-radius: 0;
    background: transparent;
}

.team-day-push:hover {
    border-color: var(--line-strong);
    background: var(--surface-3);
}

.team-day-push:focus-visible {
    outline: 2px solid rgba(246, 201, 0, 0.55);
    outline-offset: -2px;
}

.team-day-push-swatch {
    width: 10px;
    height: 38px;
    border-radius: 5px;
    flex-shrink: 0;
}

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

.team-day-push-body strong {
    font-size: 13.5px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.team-day-push-meta {
    font-size: 12px;
    color: var(--muted);
}

.team-day-progress {
    margin-top: 4px;
    max-width: 220px;
}

.team-day-push-remove {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: var(--muted);
    cursor: pointer;
    transition: color 140ms ease, background-color 140ms ease;
}

.team-day-push-remove:hover {
    color: #f87171;
    background: rgba(248, 113, 113, 0.1);
}

.team-day-push-caret {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    color: var(--muted);
    transition: transform 160ms ease, color 160ms ease;
}

.team-day-push-wrap.is-expanded .team-day-push-caret {
    transform: rotate(180deg);
    color: var(--azure-strong);
}

.team-day-push-dropdown {
    padding: 14px;
    border-top: 1px solid var(--line);
    background: color-mix(in srgb, var(--surface-3) 72%, transparent);
}

.team-day-push-dropdown-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 12px;
}

.team-day-push-dropdown-head > div {
    display: grid;
    gap: 2px;
}

.team-day-push-dropdown-head strong {
    font-size: 13px;
}

.team-day-push-dropdown-head span,
.team-day-push-dropdown-head p {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
}

.team-day-push-dropdown-head p {
    max-width: 230px;
    text-align: right;
}

.team-day-completion-list {
    display: grid;
    gap: 6px;
}

.team-day-completion-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 9px 10px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: var(--surface-2);
}

.team-day-activity {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.team-day-activity-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
}

.team-day-scheduler-target {
    margin: 0 0 12px;
    font-size: 13px;
    color: var(--muted);
}

.team-day-scheduler-target strong {
    color: var(--text);
}

.team-day-scheduler-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
    gap: 10px;
    margin-bottom: 12px;
}

.team-day-audience-field {
    margin-bottom: 8px;
}

.team-day-scheduler .qi-field select,
.team-day-scheduler .qi-field input {
    padding: 8px 10px;
    background: var(--surface-3);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: inherit;
    font-size: 13px;
}

.team-day-scheduler .qi-field select:focus,
.team-day-scheduler .qi-field input:focus {
    border-color: var(--azure-strong);
    outline: none;
}

.team-day-recurring-toggle {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 13.5px;
    color: var(--text);
    cursor: pointer;
    padding: 4px 0;
}

.team-day-recurring-toggle input {
    width: 17px;
    height: 17px;
    accent-color: var(--azure-strong);
    cursor: pointer;
}

.team-day-weeks-field {
    margin-top: 10px;
    max-width: 160px;
}

.team-day-recurring-note {
    margin: 8px 0 0;
    font-size: 12px;
    color: var(--muted);
}

.team-day-scheduler-actions {
    margin-top: 14px;
}

.team-day-scheduler-actions .primary-button {
    height: 40px;
}

.team-day-feedback {
    margin: 10px 0 0;
    min-height: 18px;
    font-size: 12.5px;
    color: var(--muted);
}

.team-day-feedback.is-error {
    color: #f87171;
}

@media (max-width: 640px) {
    .calendar-controls {
        flex-wrap: wrap;
    }
    .calendar-audience,
    .calendar-audience-combobox {
        max-width: none;
        width: 100%;
        flex: 1 1 100%;
    }
    .team-day-scheduler-grid {
        grid-template-columns: 1fr;
    }
}

.chat-loading,
.chat-error {
    text-align: center;
    font-size: 13px;
    color: var(--muted);
    padding: 24px 16px;
}

.chat-error {
    color: #f87171;
}

.chat-footer {
    padding: 12px 16px 16px;
    background: var(--surface);
    flex-shrink: 0;
    display: none;
}

.chat-input-form {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    border: 1px solid var(--line-strong);
    border-radius: 22px;
    background: var(--surface-2);
    padding: 5px 6px 5px 6px;
    transition: border-color 140ms ease;
}

.chat-input-form:focus-within {
    border-color: var(--azure-strong);
}

.chat-workout-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    flex-shrink: 0;
    background: transparent;
    border: none;
    border-radius: 50%;
    color: var(--muted);
    cursor: pointer;
    transition: color 140ms ease, background-color 140ms ease;
}

.chat-workout-btn:hover {
    color: var(--azure-strong);
    background: var(--surface-3);
}

#chat-input {
    flex: 1;
    padding: 8px 6px;
    background: transparent;
    border: none;
    color: var(--text);
    font-family: inherit;
    font-size: 13.5px;
    line-height: 1.4;
    resize: none;
    max-height: 110px;
    min-width: 0;
}

#chat-input:focus {
    outline: none;
}

#chat-input::placeholder {
    color: var(--muted);
}

.chat-send-btn {
    flex-shrink: 0;
    padding: 8px 14px;
    background: transparent;
    border: none;
    color: var(--azure-strong);
    font-size: 13.5px;
    font-weight: 700;
    cursor: pointer;
    border-radius: 16px;
    transition: color 140ms ease;
}

.chat-send-btn:hover {
    color: var(--azure-soft);
}

.chat-send-btn:disabled {
    color: var(--muted-2);
    cursor: default;
}

@media (max-width: 780px) {
    .messages-container {
        grid-template-columns: 1fr;
        height: calc(100vh - 370px);
        min-height: 420px;
    }

    .messages-sidebar {
        border-right: none;
    }

    .messages-chat {
        display: none;
    }

    .sidebar-controls {
        padding-bottom: 12px;
    }

    .conversation-search-input {
        width: 100%;
    }

    .messages-container.chat-open .messages-sidebar {
        display: none;
    }

    .messages-container.chat-open .messages-chat {
        display: flex;
    }

    .messages-container.chat-open .chat-back-btn {
        display: flex;
    }

    .chat-message {
        max-width: 80%;
    }
}

/* ─── Workout Builder Modal ─── */

.builder-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 20px;
    overflow: auto;
}

.builder-modal.hidden {
    display: none;
}

.builder-modal-content {
    background: var(--bg);
    border-radius: var(--radius);
    border: 1px solid var(--line-strong);
    width: 100%;
    max-width: 1200px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow);
}

.builder-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--line);
    background: var(--surface);
}

.builder-modal-header h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
}

.builder-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.builder-form-section {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.builder-modal-grid {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 20px;
}


.builder-search-row {
    margin-bottom: 12px;
}

.builder-search-results {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 400px;
    overflow-y: auto;
}

.builder-result-card {
    padding: 8px;
    background: var(--surface-3);
    border-radius: var(--radius-sm);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid var(--line);
}

.builder-result-copy {
    flex: 1;
    min-width: 0;
}

.builder-result-copy strong {
    display: block;
    font-size: 13px;
    margin-bottom: 4px;
}

.builder-result-copy span {
    display: block;
    font-size: 11px;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.builder-selected-card {
    padding: 16px;
    background: var(--surface-2);
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
}

.builder-selected-card .panel-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.builder-selected-card h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
}

.builder-selected-card p {
    margin: 4px 0 0;
    font-size: 12px;
    color: var(--muted);
}

.builder-exercise-row.is-circuit-member { border-color: color-mix(in srgb, var(--azure-strong) 55%, var(--line)); box-shadow: inset 3px 0 0 var(--azure-strong); }
.builder-pill-circuit { color: var(--azure-strong) !important; border-color: color-mix(in srgb, var(--azure-strong) 45%, var(--line)) !important; background: color-mix(in srgb, var(--azure-strong) 10%, transparent) !important; }
.circuit-detail-pill { color: var(--azure-strong) !important; border-color: color-mix(in srgb, var(--azure-strong) 45%, var(--line)) !important; }

/* ── Circuit field sizing (shared by the inline circuit blocks) ── */
.builder-circuit-fields { display: flex; gap: 8px; margin-top: 8px; }
.builder-circuit-fields .form-field { flex: 1; min-width: 0; }
.builder-circuit-fields .form-field label { font-size: 0.68rem; }
.builder-circuit-fields .form-field input { padding: 5px 8px; font-size: 0.82rem; }
.builder-circuit-warning { margin: 6px 0 0; color: var(--amber, #f5b74e); font-size: 0.74rem; }

/* ── Per-exercise "Advanced" trigger (replaces the inline notes field) ── */
.builder-advanced-field { display: flex; flex-direction: column; }
.builder-advanced-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    height: 38px;
    padding: 0 10px;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    background: var(--surface-2);
    color: var(--text);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
}
.builder-advanced-trigger:hover,
.builder-advanced-trigger:focus-visible { border-color: var(--azure-strong); color: var(--azure-soft); outline: none; }
.builder-advanced-trigger.has-settings {
    border-color: color-mix(in srgb, var(--azure-strong) 55%, var(--line));
    color: var(--azure-soft);
    background: color-mix(in srgb, var(--azure-strong) 10%, transparent);
}
.builder-advanced-trigger svg { flex: 0 0 auto; }

/* ── Advanced settings modal ── */
.builder-advanced-card { width: min(880px, 96vw); }
.builder-advanced-body { display: grid; gap: 14px; padding: 4px 2px 2px; }

/* Grouped, two-column layout so settings don't read as one long vertical stack. */
.advanced-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    align-items: stretch;
}
.advanced-group {
    display: grid;
    gap: 12px;
    align-content: start;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface-2);
}
.advanced-group--full { grid-column: 1 / -1; }
.advanced-group-head { display: grid; gap: 2px; }
.advanced-group-title {
    margin: 0;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
}
.advanced-group-sub { margin: 0; color: var(--muted); font-size: 0.78rem; }

@media (max-width: 640px) {
    .advanced-grid { grid-template-columns: 1fr; }
    .advanced-set-control-row { grid-template-columns: 1fr 1fr; }
    .advanced-set-exertion-pill { justify-self: stretch; }
}

.advanced-section { display: grid; gap: 7px; }
.advanced-section.is-disabled { opacity: 0.75; }
.advanced-section-label { font-size: 0.74rem; font-weight: 700; letter-spacing: 0.03em; text-transform: uppercase; color: var(--muted); }
.advanced-notes,
.advanced-select {
    width: 100%;
    padding: 9px 11px;
    border: 1px solid var(--line-strong);
    border-radius: 9px;
    background: var(--surface);
    color: var(--text);
    font-size: 0.9rem;
    font-family: inherit;
}
.advanced-notes { resize: vertical; min-height: 46px; }
.advanced-hint { margin: 0; color: var(--muted); font-size: 0.78rem; }
.advanced-toggle {
    display: flex;
    align-items: flex-start;
    gap: 11px;
    padding: 11px 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
    cursor: pointer;
}
.advanced-toggle input { width: 18px; height: 18px; margin-top: 1px; accent-color: var(--azure-strong); flex: 0 0 auto; }
.advanced-toggle--center { align-items: center; }
.advanced-toggle--center input { margin-top: 0; }
.advanced-toggle span { display: grid; gap: 2px; }
.advanced-toggle strong { font-size: 0.9rem; }
.advanced-toggle em { font-style: normal; color: var(--muted); font-size: 0.79rem; }
.builder-advanced-body .superset-combobox { position: relative; }
.advanced-set-control-list {
    display: grid;
    gap: 8px;
}
.advanced-set-control-row {
    display: grid;
    grid-template-columns: minmax(112px, 1fr) auto auto auto auto;
    gap: 9px;
    align-items: center;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
}
.advanced-set-control-row.is-warmup {
    background: color-mix(in srgb, var(--surface) 80%, var(--muted) 20%);
}
.advanced-set-control-row.is-drop-set {
    background: color-mix(in srgb, var(--surface) 88%, var(--azure-strong) 12%);
}
.advanced-set-control-label { font-size: 0.85rem; font-weight: 700; }
.advanced-set-exertion-pill {
    display: flex;
    align-items: center;
    gap: 6px;
    justify-self: end;
    min-height: 34px;
    padding: 0 9px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface-2);
}
.advanced-set-exertion-pill span,
.advanced-set-exertion-pill em {
    color: var(--muted);
    font-size: 0.76rem;
    font-style: normal;
    font-weight: 700;
}
.advanced-set-exertion-pill input {
    width: 58px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--text);
    font-size: 0.9rem;
    font-family: inherit;
    text-align: right;
    outline: none;
}
.advanced-set-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 34px;
    padding: 0 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface-2);
    color: var(--text);
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
}
.advanced-set-chip.is-disabled {
    opacity: .42;
    cursor: not-allowed;
}
.advanced-set-chip input {
    width: 15px;
    height: 15px;
    accent-color: var(--azure-strong);
}
.advanced-set-delete {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface-2);
    color: var(--muted);
    cursor: pointer;
    transition: color .12s ease, border-color .12s ease, background .12s ease;
}
.advanced-set-delete svg { width: 16px; height: 16px; display: block; }
.advanced-set-delete:hover {
    color: var(--rose);
    border-color: color-mix(in srgb, var(--rose) 45%, var(--line));
    background: color-mix(in srgb, var(--rose) 12%, var(--surface-2));
}
.advanced-set-delete:disabled {
    opacity: .35;
    cursor: not-allowed;
}
.builder-advanced-footer {
    position: sticky;
    bottom: -22px;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    /* Bleed into the modal-card padding (20px) + body padding (2px) so the
       footer fill reaches the pop-out's bottom + side edges and rounded corners. */
    margin: 4px -22px -22px;
    padding: 14px 22px 22px;
    border-top: 1px solid var(--line);
    border-bottom-left-radius: var(--radius);
    border-bottom-right-radius: var(--radius);
    background: var(--surface);
}
.builder-advanced-footer .primary-button { min-width: 160px; }
.advanced-add-set-button {
    justify-content: center;
    width: 100%;
    min-height: 40px;
}
.advanced-add-set-button:disabled {
    opacity: .5;
    cursor: not-allowed;
}
.advanced-exertion-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
    gap: 8px;
}
.advanced-exertion-row {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 7px 11px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: var(--surface);
}
.advanced-exertion-label { flex: 1; font-size: 0.85rem; font-weight: 600; }
.advanced-exertion-row input {
    width: 56px;
    padding: 7px 9px;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    background: var(--surface-2);
    color: var(--text);
    font-size: 0.9rem;
    font-family: inherit;
    text-align: right;
}
.advanced-exertion-unit { color: var(--muted); font-size: 0.85rem; font-weight: 600; }

.qi-circuit-badge {
    display: inline-block;
    margin-top: 4px;
    padding: 2px 8px;
    border-radius: 999px;
    color: var(--azure-strong);
    background: color-mix(in srgb, var(--azure-strong) 14%, transparent);
    border: 1px solid color-mix(in srgb, var(--azure-strong) 40%, var(--line));
    font-size: 0.72rem;
    font-weight: 700;
}

.builder-selected-list-modal {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 500px;
    overflow-y: auto;
}

.builder-exercise-row {
    padding: 12px;
    background: var(--surface-3);
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
}

.builder-row-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.builder-exercise-copy {
    flex: 1;
}

.builder-exercise-copy strong {
    display: block;
    font-size: 13px;
    margin-bottom: 4px;
}

.builder-inline-meta {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.builder-pill {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 2px 6px;
    background: var(--surface-4);
    border-radius: 3px;
    font-size: 11px;
    line-height: 1;
    color: var(--muted);
}

.builder-row-controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 8px;
}

.builder-row-controls .form-field {
    margin: 0;
}

.builder-row-controls label {
    font-size: 12px;
}

.builder-row-controls input,
.builder-row-controls select {
    font-size: 13px;
    padding: 6px 8px;
}

.builder-advanced-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--line);
    margin-top: 8px;
}

.builder-checkbox-option {
    display: flex;
    align-items: center;
    gap: 6px;
}

.builder-checkbox-option input[type="checkbox"] {
    cursor: pointer;
    width: 16px;
    height: 16px;
}

.builder-checkbox-option label {
    font-size: 12px;
    cursor: pointer;
    margin: 0;
}

.builder-modal-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--line);
    background: var(--surface);
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.builder-modal-footer button {
    min-width: 120px;
}

.builder-top-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
}

/* ─── Programming Section ─── */

.builder-programming-section {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
}

.programming-title {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--muted);
    margin: 0 0 8px 0;
}

.programming-option {
    margin-bottom: 12px;
    padding: 8px;
    background: var(--surface-4);
    border-radius: var(--radius-sm);
}

.programming-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.programming-checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    flex-shrink: 0;
}

.programming-checkbox label {
    cursor: pointer;
    margin: 0;
    font-size: 13px;
    user-select: none;
}

.programming-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--line);
}

.programming-details .form-field {
    margin: 0;
}

.programming-details label {
    font-size: 11px;
}

.programming-details input {
    font-size: 12px;
    padding: 4px 6px;
}

.programming-hint {
    font-size: 11px;
    color: var(--muted-2);
    margin: 4px 0 0 24px;
    font-style: italic;
}

.programming-label {
    display: block;
    font-size: 13px;
    margin-bottom: 6px;
    cursor: default;
}

.programming-inline-row {
    display: grid;
    grid-template-columns: minmax(180px, 0.8fr) minmax(240px, 1.2fr);
    gap: 12px;
    align-items: start;
}

.programming-option-inline {
    min-width: 0;
}

.programming-option-grow {
    width: 100%;
}

.programming-option-inline .programming-hint {
    margin-left: 0;
}

.superset-combobox {
    width: 100%;
    max-width: none;
}

.superset-combobox input {
    min-height: 36px;
    font-size: 12px;
}

@media (max-width: 760px) {
    .programming-inline-row {
        grid-template-columns: 1fr;
    }
}

/* ─── Exercise Library (demo videos, explanations, cues) ─── */

.media-editor {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.media-exercise-field {
    max-width: 420px;
}

.media-editor-grid {
    display: grid;
    grid-template-columns: minmax(0, 380px) minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}

.media-column-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    margin-bottom: 6px;
}

.media-video-drop {
    border: 1.5px dashed var(--line-strong);
    border-radius: var(--radius);
    background: var(--surface-2);
    padding: 28px 20px;
    cursor: pointer;
    transition: border-color 140ms ease, background-color 140ms ease;
}

.media-video-drop:hover {
    border-color: var(--azure-strong);
    background: var(--surface-3);
}

.media-video-drop.is-dragging {
    border-color: var(--azure-strong);
    background: rgba(246, 201, 0, 0.08);
}

.media-video-preview {
    width: 100%;
    max-height: 320px;
    border-radius: var(--radius);
    background: #000;
    border: 1px solid var(--line-strong);
}

.media-video-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.media-text-column {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.media-text-column textarea {
    width: 100%;
    min-height: 108px;
    padding: 10px 12px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    background: var(--surface-3);
    color: var(--text);
    font: inherit;
    line-height: 1.5;
    resize: vertical;
}

.media-text-column textarea::placeholder {
    color: var(--muted-2);
}

.media-text-column textarea:focus {
    outline: none;
    border-color: rgba(246, 201, 0, 0.45);
    box-shadow: 0 0 0 3px rgba(246, 201, 0, 0.1);
}

.media-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.media-library-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.media-library-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding-top: 4px;
}

.media-library-count {
    color: var(--muted);
    font-size: 0.82rem;
}

.media-card {
    display: grid;
    grid-template-columns: minmax(0, 260px) minmax(0, 1fr);
    gap: 16px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface-2);
}

.media-card-video video {
    width: 100%;
    max-height: 220px;
    border-radius: var(--radius-sm);
    background: #000;
    border: 1px solid var(--line-strong);
}

.media-card-novideo {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 120px;
    border: 1px dashed var(--line-strong);
    border-radius: var(--radius-sm);
    color: var(--muted-2);
    font-size: 13px;
}

.media-card-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
}

.media-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.media-card-head strong {
    display: block;
    font-size: 15.5px;
}

.media-card-head span {
    display: block;
    font-size: 12.5px;
    color: var(--muted);
    text-transform: capitalize;
    margin-top: 2px;
}

.media-card-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.media-card-actions .ghost-button.danger {
    color: var(--rose);
    border-color: rgba(251, 113, 133, 0.35);
}

.media-card-description {
    margin: 0;
    font-size: 13.5px;
    line-height: 1.55;
    color: var(--muted);
    white-space: pre-wrap;
}

.media-card-cues {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.media-card-cues li {
    font-size: 12.5px;
    color: var(--azure-soft);
    background: rgba(246, 201, 0, 0.1);
    border: 1px solid rgba(246, 201, 0, 0.22);
    border-radius: 999px;
    padding: 4px 10px;
}

@media (max-width: 860px) {
    .media-editor-grid {
        grid-template-columns: 1fr;
    }

    .media-card {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .team-day-push-dropdown-head,
    .workout-preview-group-head {
        align-items: flex-start;
        flex-direction: column;
        gap: 6px;
    }

    .team-day-push-dropdown-head p,
    .workout-preview-group-head > span {
        max-width: none;
        text-align: left;
    }

    .team-day-completion-row {
        align-items: flex-start;
        flex-direction: column;
    }

    .team-day-completion-row .status-pill {
        margin-left: 40px;
    }

    .workout-preview-exercise {
        grid-template-columns: 32px minmax(0, 1fr);
        gap: 9px;
        padding: 12px;
    }

    .workout-preview-order {
        min-width: 28px;
        height: 28px;
    }

    .workout-preview-exercise-head {
        align-items: flex-start;
        flex-direction: column;
        gap: 3px;
    }
}

/* ─── Exercise Library: YouTube + bulk upload ─── */

.media-or-divider {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 14px 0 10px;
    color: var(--muted-2);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.media-or-divider::before,
.media-or-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--line);
}

.media-youtube-preview iframe,
.media-card-video iframe {
    width: 100%;
    aspect-ratio: 16 / 9;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    background: #000;
    display: block;
}

.media-youtube-preview {
    margin-top: 10px;
}

.media-bulk-import-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 14px;
    align-items: stretch;
}

.media-bulk-import-pane {
    min-width: 0;
}

.media-bulk-import-pane .media-video-drop {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 132px;
    height: 100%;
}

.media-bulk-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 14px;
}

.media-bulk-list:empty {
    margin-top: 0;
}

.media-bulk-row {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface-2);
}

.media-bulk-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.media-bulk-row.is-attached {
    border-color: rgba(52, 211, 153, 0.35);
}

.media-bulk-row.is-error {
    border-color: rgba(251, 113, 133, 0.4);
}

.media-bulk-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    flex: 1;
}

.media-bulk-info strong {
    font-size: 13.5px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.media-bulk-status {
    font-size: 12.5px;
    color: var(--muted);
}

.media-bulk-source {
    font-size: 12px;
    color: var(--muted-2);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.media-bulk-row.is-attached .media-bulk-status {
    color: var(--green);
}

.media-bulk-row.is-error .media-bulk-status {
    color: var(--rose);
}

.media-bulk-error {
    font-size: 12px;
    color: var(--rose);
}

.media-bulk-progress {
    width: 100%;
    max-width: 320px;
    height: 5px;
    border-radius: 999px;
    background: var(--surface-4);
    overflow: hidden;
}

.media-bulk-progress-fill {
    height: 100%;
    border-radius: 999px;
    background: var(--azure-strong);
    transition: width 200ms ease;
}

.media-bulk-attach {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.media-bulk-combobox {
    position: relative;
    width: 240px;
}

.media-bulk-attach .ghost-button.danger {
    color: var(--rose);
    border-color: rgba(251, 113, 133, 0.35);
}

.media-bulk-details {
    display: grid;
    gap: 10px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
}

.media-bulk-details textarea {
    min-height: 62px;
    resize: vertical;
}

@media (max-width: 860px) {
    .media-bulk-import-grid {
        grid-template-columns: 1fr;
    }

    .media-bulk-main {
        flex-direction: column;
        align-items: stretch;
    }

    .media-bulk-combobox {
        width: 100%;
        flex: 1;
    }
}

/* ─── Thrise split-surface dashboard ───────────────────────────────────────
   The product chrome stays dark and focused while the working surface moves
   to a warm, high-contrast light canvas. Local variables let every existing
   dashboard component inherit the new surface without changing its behavior. */

.topbar {
    background: rgba(8, 8, 8, 0.97);
    border-bottom-color: rgba(255, 255, 255, 0.14);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.035) inset;
}

.side-rail {
    background: #0d0d0d;
    border-right-color: rgba(255, 255, 255, 0.14);
}

.page-tab:hover,
.page-tab:focus-visible,
.page-subtab:hover,
.page-subtab:focus-visible {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.07);
}

.page-tab.is-active {
    color: var(--brand);
    background: rgba(246, 201, 0, 0.11);
}

.page-tab.is-active::before {
    background: var(--brand);
}

.page-tab.is-active svg,
.page-subtab.is-active {
    color: var(--brand);
}

.page-subtab.is-active {
    border-left-color: var(--brand);
    background: rgba(246, 201, 0, 0.09);
}

.dash-main {
    color-scheme: light;
    --bg: #f2f0eb;
    --surface: #ffffff;
    --surface-1: #fbfaf7;
    --surface-2: #f7f5f0;
    --surface-3: #efede7;
    --surface-4: #e5e2db;
    --line: rgba(12, 12, 12, 0.10);
    --line-strong: rgba(12, 12, 12, 0.19);
    --text: #111111;
    --muted: #66645f;
    --muted-2: #89867f;
    --azure-strong: var(--brand-deep);
    --azure-soft: var(--brand-deep);
    --teal: var(--brand-support);
    --violet: var(--celebrate);
    --gold: var(--brand-support);
    --focus-border: rgba(217, 138, 0, 0.72);
    --focus-ring: rgba(246, 201, 0, 0.14);
    --button-border: var(--brand);
    --button-bg: var(--brand);
    --button-bg-hover: #e4b900;
    --button-text: #0b0b0b;
    --button-shadow: rgba(138, 87, 0, 0.13);
    --button-shadow-hover: rgba(138, 87, 0, 0.22);
    --accent-hover-border: rgba(217, 138, 0, 0.42);
    --accent-hover-bg: rgba(246, 201, 0, 0.10);
    --shadow: 0 24px 56px rgba(18, 18, 18, 0.08), 0 3px 12px rgba(18, 18, 18, 0.05);
    --shadow-sm: 0 8px 24px rgba(18, 18, 18, 0.055);
    max-width: none;
    min-height: calc(100vh - var(--topbar-h));
    margin-inline: 0;
    background: #ffffff;
    color: var(--text);
}

body.plans-surface .dash-main {
    background: #ffffff;
}

body.plans-surface .dash-main .page-heading {
    margin: 0;
}

.dash-main .page-heading {
    justify-content: flex-end;
    margin: -22px clamp(-34px, -2.4vw, -16px) 22px;
    padding: 26px clamp(16px, 2.4vw, 34px) 24px;
    border-bottom: 1px solid var(--line-strong);
    background: #ffffff;
}

.dash-main .team-heading-identity {
    display: none;
}

.workout-grid > [data-section="push"] {
    min-height: 0;
    align-content: start;
    padding-inline: 0;
    padding-bottom: 8px;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

body.workouts-surface .dash-main {
    padding-bottom: 16px;
}

.dash-main .page-heading h1,
.dash-main .invite-card strong,
.dash-main .kpi strong,
.dash-main .activity-stat-card strong,
.dash-main .detail-score strong,
.dash-main .detail-stat strong,
.dash-main .podium-metric strong,
.dash-main .migration-page-head h2,
.dash-main .settings-seat-card strong,
.dash-main .billing-summary-card strong,
.dash-main .group-summary-card strong {
    color: var(--text);
}

.dash-main .eyebrow,
.dash-main .rail-label,
.dash-main .invite-card span,
.dash-main .kpi span,
.dash-main .detail-stat-label,
.dash-main .calendar-legend span,
.dash-main .workout-meta,
.dash-main .form-field label {
    color: var(--muted-2);
}

.dash-main .panel,
.dash-main .kpi,
.dash-main .activity-stat-card,
.dash-main .invite-card,
.dash-main .migration-page-head,
.dash-main .settings-seat-card,
.dash-main .billing-summary-card,
.dash-main .group-summary-card {
    border-color: var(--line);
    background-color: var(--surface);
}

.dash-main .panel,
.dash-main .sk-panel-box {
    box-shadow: var(--shadow-sm);
}

.dash-main .workout-grid > [data-section="push"] {
    background: transparent;
    box-shadow: none;
}

.dash-main .kpi {
    border-left-color: var(--brand-deep);
}

.dash-main .kpi:nth-child(2) { border-left-color: var(--brand-support); }
.dash-main .kpi:nth-child(3) { border-left-color: var(--celebrate); }
.dash-main .kpi:nth-child(4) { border-left-color: var(--brand); }

.dash-main .kpi::after {
    background: linear-gradient(180deg, rgba(12, 12, 12, 0.018), transparent 60%);
}

.dash-main .primary-button {
    border-color: var(--brand);
    background: var(--brand);
    color: #0b0b0b;
}

.dash-main .primary-button:hover,
.dash-main .primary-button:focus-visible {
    background: #e4b900;
}

.dash-main .eyebrow {
    color: var(--brand-deep);
    border-color: rgba(217, 138, 0, 0.34);
    background: rgba(246, 201, 0, 0.11);
}

.dash-main .ghost-button {
    border-color: var(--line-strong);
    color: var(--text);
    background: rgba(255, 255, 255, 0.65);
}

.dash-main .ghost-button:hover,
.dash-main .ghost-button:focus-visible {
    border-color: rgba(12, 12, 12, 0.36);
    background: rgba(12, 12, 12, 0.055);
}

.dash-main input,
.dash-main select,
.dash-main textarea {
    color: var(--text);
}

.dash-main .form-field input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):focus,
.dash-main .form-field select:focus,
.dash-main .form-field textarea:focus,
.dash-main .push-audience-search-wrap input:focus {
    border-color: var(--focus-border);
    background: #ffffff;
    color: #111111;
    caret-color: #111111;
    box-shadow: 0 0 0 3px var(--focus-ring);
}

.dash-main input::placeholder,
.dash-main textarea::placeholder {
    color: var(--muted-2);
}

.dash-main .pager-button.is-active,
.dash-main .builder-circuit-mode.is-active {
    border-color: #0b0b0b;
    background: #0b0b0b;
    color: #ffffff;
}

.dash-main .coach-product-card,
.dash-main .migration-stat {
    background: rgba(255, 255, 255, 0.72);
}

.dash-main .progress-track,
.dash-main .media-bulk-progress {
    background: rgba(12, 12, 12, 0.10);
}

.dash-main .progress-fill,
.dash-main .media-bulk-progress-fill {
    background: #111111;
}

@media (max-width: 1100px) {
    .side-rail {
        background: rgba(8, 8, 8, 0.97);
        border-bottom-color: rgba(255, 255, 255, 0.14);
    }

    .dash-main .page-heading {
        margin-top: -18px;
    }
}

@media (max-width: 780px) {
    .side-rail {
        background: rgba(8, 8, 8, 0.98);
        border-top-color: rgba(255, 255, 255, 0.14);
    }

    .dash-main {
        min-height: calc(100vh - 58px);
        background-size: 36px 36px;
    }

    .dash-main .page-heading {
        margin: -14px -14px 18px;
        padding: 20px 14px 18px;
    }
}

/* Messages owns the entire workspace below the persistent product chrome. */
body.messages-surface {
    overflow: hidden;
}

body.messages-surface .dash-shell {
    height: calc(100dvh - var(--topbar-h));
    min-height: 0;
    align-items: stretch;
}

body.messages-surface .dash-main {
    min-height: 0;
    padding: 0;
    overflow: hidden;
    background: var(--surface);
}

body.messages-surface #page-messages.is-active,
body.messages-surface .messages-container {
    height: 100%;
    min-height: 0;
}

body.messages-surface .messages-container {
    border: 0;
    border-radius: 0;
}

@media (max-width: 1100px) {
    body.messages-surface .dash-shell {
        grid-template-rows: auto minmax(0, 1fr);
    }
}

@media (max-width: 780px) {
    body.messages-surface {
        --bottom-nav-h: calc(63px + env(safe-area-inset-bottom, 0px));
    }

    body.messages-surface .shell {
        display: flex;
        flex-direction: column;
        height: 100dvh;
        padding-bottom: 0;
    }

    body.messages-surface .topbar {
        flex: 0 0 auto;
    }

    body.messages-surface #app {
        flex: 1 1 auto;
        min-height: 0;
    }

    body.messages-surface #dashboard-content {
        height: 100%;
        min-height: 0;
    }

    body.messages-surface .dash-shell {
        height: calc(100% - var(--bottom-nav-h));
    }

    body.messages-surface .dash-main {
        height: 100%;
    }

body.messages-surface .messages-container {
        height: 100%;
    }
}

/* ─── Unified light dashboard pop-outs ─── */

body:not(.auth-visible) .modal-card {
    color-scheme: light;
    --surface: #ffffff;
    --surface-1: #fbfaf7;
    --surface-2: #f7f5f0;
    --surface-3: #efede7;
    --surface-4: #e4e1d9;
    --line: rgba(17, 17, 17, 0.1);
    --line-strong: rgba(17, 17, 17, 0.2);
    --text: #111111;
    --muted: #66635c;
    --muted-2: #89857c;
    --azure-strong: #8a5700;
    --azure-soft: #8a5700;
    --focus-border: rgba(217, 138, 0, 0.72);
    --focus-ring: rgba(246, 201, 0, 0.14);
    border-color: rgba(17, 17, 17, 0.16);
    background: #ffffff;
    color: #111111;
    box-shadow: 0 28px 90px rgba(17, 17, 17, 0.2);
}

body:not(.auth-visible) .modal-backdrop {
    background: rgba(17, 17, 17, 0.42);
}

body:not(.auth-visible) .modal-card input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
body:not(.auth-visible) .modal-card select,
body:not(.auth-visible) .modal-card textarea {
    border-color: rgba(17, 17, 17, 0.18);
    background: #f7f5f0;
    color: #111111;
    caret-color: #111111;
}

body:not(.auth-visible) .modal-card input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):focus,
body:not(.auth-visible) .modal-card select:focus,
body:not(.auth-visible) .modal-card textarea:focus {
    border-color: var(--focus-border);
    background: #ffffff;
    color: #111111;
    box-shadow: 0 0 0 3px var(--focus-ring);
}

body:not(.auth-visible) .modal-card input::placeholder,
body:not(.auth-visible) .modal-card textarea::placeholder {
    color: #89857c;
}

body:not(.auth-visible) .modal-card .ghost-button,
body:not(.auth-visible) .modal-card .icon-button {
    border-color: rgba(17, 17, 17, 0.18);
    background: #ffffff;
    color: #111111;
}

body:not(.auth-visible) .modal-card .ghost-button:hover,
body:not(.auth-visible) .modal-card .ghost-button:focus-visible,
body:not(.auth-visible) .modal-card .icon-button:hover,
body:not(.auth-visible) .modal-card .icon-button:focus-visible {
    border-color: rgba(17, 17, 17, 0.38);
    background: #efede7;
}

body:not(.auth-visible) .modal-card .danger-button {
    color: #b42332;
}

body:not(.auth-visible) .profile-menu {
    color-scheme: light;
    border-color: rgba(17, 17, 17, 0.16);
    background: #ffffff;
    color: #111111;
    box-shadow: 0 20px 54px rgba(0, 0, 0, 0.22);
}

body:not(.auth-visible) .profile-menu-copy strong {
    color: #111111;
}

body:not(.auth-visible) .profile-menu-copy span {
    color: #716e67;
}

body:not(.auth-visible) .profile-menu-action {
    border-top-color: rgba(17, 17, 17, 0.11);
    color: #111111;
}

body:not(.auth-visible) .profile-menu-action:hover,
body:not(.auth-visible) .profile-menu-action:focus-visible {
    background: #f2f0eb;
}

body:not(.auth-visible) .dash-main .team-menu,
body:not(.auth-visible) .dash-main .combobox-options {
    border-color: rgba(17, 17, 17, 0.16);
    background: #ffffff;
    color: #111111;
    box-shadow: 0 16px 44px rgba(17, 17, 17, 0.14);
}

body:not(.auth-visible) .dash-main .team-menu-item:hover,
body:not(.auth-visible) .dash-main .team-menu-item:focus-visible,
body:not(.auth-visible) .dash-main .combobox-option:hover,
body:not(.auth-visible) .dash-main .combobox-option:focus-visible {
    background: #f2f0eb;
}

/* ─── Full-page workout-building workspace ─── */

.dash-main .workout-grid > .workout-build-workspace {
    min-height: calc(100dvh - var(--topbar-h) - 44px);
    align-content: start;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    overflow: visible;
}

.workout-build-workspace > * + * {
    margin-top: 0;
}

.workout-build-workspace-head {
    align-items: center;
    padding: 4px 0 20px;
    border-bottom-color: var(--line-strong);
}

.workout-build-workspace-head h2 {
    font-size: clamp(1.8rem, 3vw, 2.65rem);
}

.workout-build-workspace-head p {
    max-width: 720px;
    margin-top: 5px;
}

.workout-build-workspace-actions {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

.workout-build-workspace-actions button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    white-space: nowrap;
}

.workout-build-workspace-actions span {
    margin-left: 7px;
}

.workout-build-mode {
    min-width: 0;
    padding-top: 20px;
}

.workout-build-mode .workout-builder,
.workout-build-mode .quick-import {
    width: 100%;
}

.workout-build-workspace .quick-import-dropzone {
    display: grid;
    min-height: 300px;
    place-items: center;
    background: #f7f5f0;
}

.workout-build-workspace.is-quick-import .quick-import-results:not(:empty) {
    padding-bottom: 24px;
}

@media (max-width: 760px) {
    .dash-main .workout-grid > .workout-build-workspace {
        min-height: calc(100dvh - var(--topbar-h) - 24px);
    }

    .workout-build-workspace-head {
        align-items: stretch;
        flex-direction: column;
    }

    .workout-build-workspace-actions,
    .workout-build-workspace-actions button {
        width: 100%;
    }

    .workout-build-workspace-actions button {
        justify-content: center;
    }

    .workout-build-workspace .quick-import-dropzone {
        min-height: 230px;
    }
}
