:root {
    --coach-primary: #0f766e;
    --coach-primary-deep: #115e59;
    --coach-focus: #14b8a6;
    --coach-ink: #1c1917;
    --coach-body: #44403c;
    --coach-muted: #57534e;
    --coach-border: #e7e5e4;
    --coach-border-strong: #d6d3d1;
    --coach-canvas: #fafaf9;
}

.coach-directory,
.coach-profile {
    min-height: 70vh;
    padding: clamp(2rem, 5vw, 4.5rem) max(1rem, env(safe-area-inset-left));
    color: var(--coach-body);
    background: var(--coach-canvas);
    font-family: 'Figtree', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
                         'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

.coach-directory > *,
.coach-profile > * {
    width: min(1120px, 100%);
    margin-inline: auto;
}

.coach-directory h1,
.coach-directory h2,
.coach-profile h1,
.coach-profile h2,
.coach-card__name {
    color: var(--coach-ink);
    font-family: 'Bricolage Grotesque', 'Noto Serif SC', Georgia, 'Songti SC', serif;
}

.coach-directory__header {
    margin-bottom: 1.5rem;
}

.coach-directory__header h1,
.coach-profile h1 {
    margin: 0 0 .5rem;
    font-size: clamp(2rem, 7vw, 3rem);
    line-height: 1.15;
}

.coach-directory__header p {
    max-width: 65ch;
    margin: 0;
    color: var(--coach-body);
}

.coach-filter-bar,
.coach-card,
.coach-empty-state,
.coach-profile__surface {
    border: 1px solid var(--coach-border);
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 1px 2px rgb(28 25 23 / 6%);
}

.coach-filter-bar {
    display: grid;
    grid-template-columns: minmax(14rem, 2fr) repeat(4, minmax(8rem, 1fr));
    gap: 1rem;
    padding: 1.25rem;
    margin-bottom: 1.5rem;
}

.coach-filter-field label {
    display: block;
    margin-bottom: .375rem;
    color: var(--coach-ink);
    font-size: .75rem;
    font-weight: 600;
}

.coach-filter-field {
    min-width: 0;
}

.coach-filter-field input,
.coach-filter-field select,
.coach-filter-field textarea {
    width: 100%;
    min-height: 44px;
    padding: .625rem .75rem;
    border: 1px solid var(--coach-border-strong);
    border-radius: 8px;
    color: var(--coach-ink);
    background: #fff;
}

.coach-filter-field textarea {
    font: inherit;
    resize: vertical;
}

/* Review step reuses the filter-bar grid; stack its two prompts full-width
   instead of inheriting the search/filter column ratio. */
.coach-booking-review .coach-filter-field {
    grid-column: 1 / -1;
}

.coach-filter-field select,
select.coach-button {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    padding-right: 2.25rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1L6 6L11 1' stroke='%2357534e' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right .75rem center;
    background-size: 12px 8px;
    text-align: left;
}

.coach-filter-actions {
    display: flex;
    flex-wrap: wrap;
    grid-column: 1 / -1;
    gap: .75rem;
}

.coach-booking-countdown {
    display: inline-block;
    color: var(--coach-muted);
    font-size: .875rem;
    font-variant-numeric: tabular-nums;
}

/* M4: sticky submit CTA so it stays reachable below a long day-grouped slot
   list -- a MODIFIER on top of .coach-filter-actions, never edits it. */
.coach-booking-actions {
    position: sticky;
    bottom: 0;
    padding: .75rem 0;
    background: #fff;
    z-index: 1;
}

.coach-button {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    padding: .625rem 1rem;
    border: 1px solid transparent;
    border-radius: 8px;
    font-family: 'Figtree', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
        'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    font-size: .875rem;
    font-weight: 600;
    text-decoration: none;
}

.coach-button--primary {
    color: #fff;
    background: var(--coach-primary);
}

.coach-button--primary:hover {
    background: var(--coach-primary-deep);
}

.coach-button--secondary {
    border-color: var(--coach-border-strong);
    color: var(--coach-body);
    background: #fff;
}

.coach-button--secondary:hover {
    background: var(--coach-canvas);
}

.coach-button:disabled {
    opacity: .55;
    cursor: not-allowed;
    pointer-events: none;
}

/* Selected slot chip: aria-pressed already flips in coach_booking.js; without
   this rule the selection was carried by label text alone. */
.coach-slot-day__chips .coach-button[aria-pressed="true"] {
    color: #fff;
    background: var(--coach-primary);
    border-color: var(--coach-primary);
}

.coach-slot-day__chips .coach-button[aria-pressed="true"]:hover {
    background: var(--coach-primary-deep);
}

.coach-button:focus-visible,
.coach-filter-field input:focus-visible,
.coach-filter-field select:focus-visible,
.coach-card__name a:focus-visible,
a.coach-card:focus-visible,
.coach-back-link:focus-visible {
    outline: 3px solid var(--coach-focus);
    outline-offset: 3px;
}

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

/* M4: day-grouped slot picker -- replaces the flat .coach-card-grid wall of
   chips on the booking page and reschedule panel. */
.coach-slot-days {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.coach-slot-day__label {
    font-size: .875rem;
    font-weight: 600;
    color: var(--coach-muted);
    margin: 0 0 .5rem;
}

.coach-slot-day__chips {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
}

.coach-card {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 1rem;
    padding: 1.25rem;
}

.coach-card__identity,
.coach-profile__header {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.coach-card__photo,
.coach-card__monogram,
.coach-profile__photo,
.coach-profile__monogram {
    flex: 0 0 auto;
    border-radius: 50%;
    object-fit: cover;
}

.coach-card__photo,
.coach-card__monogram {
    width: 56px;
    height: 56px;
}

.coach-card__monogram,
.coach-profile__monogram {
    display: inline-grid;
    place-items: center;
    color: var(--coach-primary-deep);
    background: #f0fdfa;
    font-family: 'Bricolage Grotesque', 'Noto Serif SC', Georgia, 'Songti SC', serif;
    font-weight: 700;
}

.coach-card__name {
    margin: 0;
    font-size: 1.25rem;
}

.coach-card__name a {
    color: inherit;
    text-decoration: none;
}

.coach-card__title,
.coach-card__headline,
.coach-card__detail {
    margin: 0;
}

.coach-card__title,
.coach-card__detail {
    color: var(--coach-muted);
    font-size: .875rem;
}

.coach-tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    padding: 0;
    margin: 0;
    list-style: none;
}

.coach-tag-list li {
    padding: .25rem .625rem;
    border-radius: 9999px;
    color: var(--coach-muted);
    background: var(--coach-canvas);
    font-size: .75rem;
    font-weight: 600;
}

.coach-card .coach-button {
    margin-top: auto;
}

.coach-empty-state {
    padding: clamp(2rem, 6vw, 4rem);
    text-align: center;
}

.coach-empty-state h2 {
    margin-top: 0;
}

.coach-empty-state p {
    margin: 0 auto 1.25rem;
    max-width: 55ch;
}

.coach-pagination {
    display: flex;
    gap: .75rem;
    margin-top: 1.5rem;
}

/* Auto margins instead of space-between so a lone Next still sits right. */
.coach-pagination__prev {
    margin-right: auto;
}

.coach-pagination__next {
    margin-left: auto;
}

/* Block wrapper so the parent width/margin-inline centering rule applies (auto
   inline margins are 0 on the inline-block link itself) and the link's hit
   area stays text-sized. */
.coach-back-row {
    /* margin-block only: the inline margins stay `auto` from the
       `.coach-profile > *` centering rule. */
    margin-block: 0 1rem;
}

.coach-back-link {
    color: var(--coach-primary-deep);
    font-weight: 600;
}

.coach-profile__surface {
    padding: clamp(1.25rem, 4vw, 2.5rem);
}

.coach-profile__photo,
.coach-profile__monogram {
    width: 96px;
    height: 96px;
    font-size: 2rem;
}

.coach-profile__title,
.coach-profile__headline {
    margin: .25rem 0 0;
}

.coach-profile__headline {
    max-width: 60ch;
}

.coach-profile__layout {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(16rem, 1fr);
    gap: 2rem;
    margin-top: 2rem;
}

.coach-profile__main h2 {
    margin: 1.5rem 0 .5rem;
    font-size: 1.35rem;
}

.coach-profile__main h2:first-child {
    margin-top: 0;
}

.coach-profile__bio {
    max-width: 70ch;
    white-space: pre-line;
}

.coach-detail-list {
    padding-left: 1.25rem;
}

.coach-profile__details {
    padding: 1.25rem;
    border-radius: 8px;
    background: var(--coach-canvas);
}

.coach-profile__details p {
    display: grid;
    gap: .25rem;
    margin: 0 0 1rem;
}

.coach-profile__details p:last-child {
    margin-bottom: 0;
}

.coach-profile__details strong {
    color: var(--coach-ink);
    font-size: .75rem;
}

.my-coaching {
    min-height: 70vh;
    padding: clamp(2rem, 5vw, 4.5rem) max(1rem, env(safe-area-inset-left));
    color: var(--coach-body);
    background: var(--coach-canvas);
    font-family: 'Figtree', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
        'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

.my-coaching > * {
    width: min(960px, 100%);
    margin-inline: auto;
}

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

.my-coaching__browse {
    flex: 0 0 auto;
}

.my-coaching__header h1,
.my-coaching__section h2,
.booking-card h3 {
    color: var(--coach-ink);
    font-family: 'Bricolage Grotesque', 'Noto Serif SC', Georgia, 'Songti SC', serif;
}

.my-coaching__header h1 {
    margin: 0 0 .5rem;
    font-size: clamp(2rem, 7vw, 3rem);
    line-height: 1.15;
}

.my-coaching__header p {
    max-width: 65ch;
    margin: 0;
}

@media (max-width: 640px) {
    .my-coaching__header {
        flex-direction: column;
    }
}

.my-coaching__section + .my-coaching__section {
    margin-top: 2rem;
}

.my-coaching__section h2 {
    margin: 0 0 .75rem;
    font-size: 1.35rem;
}

.my-coaching__list {
    display: grid;
    gap: .75rem;
}

.booking-card {
    display: grid;
    grid-template-columns: minmax(14rem, 1fr) minmax(18rem, 1.4fr);
    gap: 1.25rem;
    padding: 1.25rem;
    border: 1px solid var(--coach-border);
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 1px 2px rgb(28 25 23 / 6%);
}

.booking-card__eyebrow,
.booking-card__coach,
.booking-card h3 {
    margin: 0;
}

.booking-card__eyebrow {
    color: var(--coach-muted);
    font-size: .75rem;
    font-weight: 600;
}

.booking-card h3 {
    margin-top: .4rem;
    font-size: 1.125rem;
}

.booking-card__coach {
    margin-top: .4rem;
}

.booking-card__details {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .75rem 1rem;
    margin: 0;
}

.booking-card__details dt {
    color: var(--coach-muted);
    font-size: .75rem;
    font-weight: 600;
}

.booking-card__details dd {
    margin: .2rem 0 0;
    color: var(--coach-ink);
    font-size: .875rem;
}

.booking-card__reschedule {
    grid-column: 1 / -1;
    margin-top: .75rem;
    padding-top: .75rem;
    border-top: 1px solid var(--coach-border);
}

.booking-card__reschedule-status {
    margin: .5rem 0;
    font-size: .875rem;
    color: var(--coach-muted);
}

.booking-card__reschedule-actions {
    display: flex;
    gap: .5rem;
    margin-top: .5rem;
}

@media (max-width: 860px) {
    .coach-filter-bar {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .coach-filter-field--search {
        grid-column: 1 / -1;
    }

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

    .coach-profile__layout {
        grid-template-columns: minmax(0, 1fr);
    }

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

@media (max-width: 540px) {
    .coach-filter-bar,
    .coach-card-grid,
    .coach-profile__layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .coach-filter-field--search {
        grid-column: auto;
    }

    .coach-filter-actions,
    .coach-filter-actions .coach-button {
        width: 100%;
    }

    .coach-profile__header {
        align-items: flex-start;
        flex-direction: column;
    }

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

.coach-reason-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgb(28 25 23 / 45%);
}

.coach-reason-modal-panel {
    width: min(420px, 100%);
    padding: 1.5rem;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 20px 45px rgb(28 25 23 / 25%);
}

.coach-reason-modal-panel h2 {
    margin: 0 0 .5rem;
    font-size: 1.1rem;
    color: var(--coach-ink);
    font-family: 'Bricolage Grotesque', 'Noto Serif SC', Georgia, 'Songti SC', serif;
}

.coach-reason-modal-panel p {
    margin: 0 0 .75rem;
    color: var(--coach-body);
    font-size: .875rem;
}

.coach-reason-modal-panel textarea {
    width: 100%;
    min-height: 88px;
    padding: .625rem .75rem;
    border: 1px solid var(--coach-border-strong);
    border-radius: 8px;
    color: var(--coach-ink);
    font: inherit;
    resize: vertical;
}

.coach-reason-modal-error {
    margin: .5rem 0 0;
    color: #b91c1c;
    font-size: .8rem;
}

.coach-reason-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: .5rem;
    margin-top: 1rem;
}

/* Calendar-view toggle (#834): List/Calendar segmented control + month grid,
   shared by the Bookings and Availability coach pages. */
.coach-cal-page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.coach-cal-toggle {
    display: inline-flex;
    flex-shrink: 0;
    gap: .25rem;
    padding: .25rem;
    border: 1px solid var(--coach-border);
    border-radius: 10px;
    background: #fff;
}

.coach-cal-toggle__btn {
    min-height: 36px;
    padding: .375rem .875rem;
    border-color: transparent;
}

.coach-cal-toggle__btn[aria-pressed="true"] {
    color: #fff;
    background: var(--coach-primary);
}

.coach-cal-toggle__btn[aria-pressed="true"]:hover {
    background: var(--coach-primary-deep);
}

.coach-cal-calendar {
    margin-top: 1.5rem;
    padding: 1.25rem;
    border: 1px solid var(--coach-border);
    border-radius: 12px;
    background: #fff;
}

.coach-cal-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .75rem;
    margin-bottom: 1rem;
}

.coach-cal-nav__btn {
    min-height: 36px;
    padding: .375rem .75rem;
}

.coach-cal-title {
    flex: 1 1 auto;
    margin: 0;
    color: var(--coach-ink);
    font-family: 'Bricolage Grotesque', 'Noto Serif SC', Georgia, 'Songti SC', serif;
    font-size: 1.1rem;
    text-align: center;
}

.coach-cal-weekdays {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 1px;
    margin-bottom: .25rem;
}

.coach-cal-weekday {
    padding: .375rem 0;
    color: var(--coach-muted);
    font-size: .75rem;
    font-weight: 600;
    text-align: center;
    text-transform: uppercase;
}

.coach-cal-week {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 1px;
    background: var(--coach-border);
}

.coach-cal-week:first-of-type {
    border-top: 1px solid var(--coach-border);
}

.coach-cal-day {
    display: flex;
    flex-direction: column;
    gap: .375rem;
    min-height: 92px;
    padding: .5rem;
    background: #fff;
}

.coach-cal-day--outside .coach-cal-day__number {
    color: var(--coach-muted);
    opacity: .55;
}

.coach-cal-day--today {
    box-shadow: inset 0 0 0 2px var(--coach-focus);
}

.coach-cal-day--has-items {
    cursor: pointer;
}

.coach-cal-day--has-items:hover {
    background: var(--coach-canvas);
}

.coach-cal-day--has-items:focus-visible {
    outline: 2px solid var(--coach-focus);
    outline-offset: -2px;
}

.coach-cal-day__number {
    color: var(--coach-ink);
    font-size: .8125rem;
    font-weight: 600;
}

.coach-cal-day__chips {
    display: flex;
    flex-direction: column;
    gap: .25rem;
}

.coach-cal-chip {
    display: inline-block;
    padding: .125rem .5rem;
    border-radius: 999px;
    color: var(--coach-primary-deep);
    background: #f0fdfa;
    font-size: .6875rem;
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.coach-cal-chip--booked {
    color: #166534;
    background: #f0fdf4;
}

.coach-cal-chip--held {
    color: #92400e;
    background: #fffbeb;
}

.coach-cal-chip--more {
    color: var(--coach-muted);
    background: var(--coach-canvas);
}

.coach-cal-day__dots {
    display: none;
}

.coach-cal-dot {
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: var(--coach-primary);
}

.coach-cal-dot--booked {
    background: #16a34a;
}

.coach-cal-dot--held {
    background: #d97706;
}

.coach-cal-day__count {
    color: var(--coach-muted);
    font-size: .6875rem;
}

@media (max-width: 640px) {
    .coach-cal-day {
        min-height: 56px;
    }

    .coach-cal-day__chips {
        display: none;
    }

    .coach-cal-day__dots {
        display: flex;
        align-items: center;
        gap: .1875rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .coach-cal-toggle__btn,
    .coach-cal-nav__btn {
        transition: none;
    }
}

/* ── RTC session room (templates/session/room.html + static/js/session_room.js) ── */

.rtc-room {
    max-width: 60rem;
    margin: 0 auto;
    padding: clamp(1.5rem, 4vw, 3rem) max(1rem, env(safe-area-inset-left));
    color: var(--coach-body);
}

/* R1: tailwind.build.css's .hidden loses to later same-specificity RTC rules
   (.rtc-recording-badge, .rtc-controls) that also set display -- this scoped
   override always wins inside the room. */
.rtc-room .hidden {
    display: none;
}

.rtc-consent,
.rtc-declined {
    max-width: 32rem;
    margin: 3rem auto;
    padding: 2rem;
    text-align: center;
    background: #fff;
    border: 1px solid var(--coach-border);
    border-radius: 1rem;
}

.rtc-consent h1,
.rtc-declined h1 {
    color: var(--coach-ink);
    font-size: 1.25rem;
    margin: 0 0 .75rem;
}

.rtc-consent p,
.rtc-declined p {
    margin: 0 0 1.5rem;
    color: var(--coach-muted);
}

.rtc-consent__actions {
    display: flex;
    justify-content: center;
    gap: .75rem;
    flex-wrap: wrap;
}

.rtc-status {
    min-height: 1.25rem;
    margin: 0 0 .75rem;
    color: var(--coach-muted);
    font-size: .875rem;
}

.rtc-banner {
    padding: .625rem 1rem;
    margin: 0 0 .75rem;
    border-radius: .5rem;
    font-size: .875rem;
}

.rtc-banner--warning {
    color: #92400e;
    background: #fffbeb;
    border: 1px solid #fde68a;
}

.rtc-stage {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #1c1917;
    border-radius: .75rem;
    overflow: hidden;
}

.rtc-remote-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.rtc-local-video {
    position: absolute;
    right: .75rem;
    bottom: .75rem;
    width: clamp(96px, 20%, 160px);
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: .5rem;
    border: 2px solid #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .35);
}

.rtc-recording-badge {
    position: absolute;
    top: .75rem;
    left: .75rem;
    display: flex;
    align-items: center;
    gap: .375rem;
    padding: .25rem .625rem;
    color: #fff;
    background: rgba(220, 38, 38, .9);
    border-radius: 999px;
    font-size: .75rem;
    font-weight: 600;
}

.rtc-recording-badge::before {
    content: '';
    width: .5rem;
    height: .5rem;
    background: #fff;
    border-radius: 50%;
}

.rtc-elapsed {
    position: absolute;
    top: .75rem;
    right: .75rem;
    padding: .25rem .625rem;
    color: #fff;
    background: rgba(28, 25, 23, .6);
    border-radius: 999px;
    font-size: .75rem;
    font-variant-numeric: tabular-nums;
}

.rtc-tap-audio {
    position: absolute;
    left: 50%;
    bottom: 1rem;
    transform: translateX(-50%);
    padding: .5rem 1rem;
    color: #fff;
    background: rgba(28, 25, 23, .85);
    border: none;
    border-radius: 999px;
    cursor: pointer;
    font-size: .9375rem;
    font-weight: 600;
}

.rtc-controls {
    display: flex;
    justify-content: center;
    gap: .75rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}

.rtc-controls .coach-button[aria-pressed="true"] {
    color: #fff;
    background: var(--coach-primary-deep);
    border-color: var(--coach-primary-deep);
}

.rtc-hangup {
    color: #fff;
    background: #dc2626;
    border: 1px solid #dc2626;
}

.rtc-hangup:hover {
    background: #b91c1c;
    border-color: #b91c1c;
}
