/* Coach auth + chat styles — members.php */
:root {
    --coach-surface: var(--secondary-bg);
    --coach-border: var(--border);
    --coach-radius: 0.75rem;
}

.coach-shell {
    max-width: var(--layout-max, 820px);
    margin: 2rem auto;
    padding: 0 var(--layout-gutter, 1rem);
}

/* Intro panel */
.coach-intro-panel {
    width: 100%;
    background: var(--coach-surface);
    border: 1px solid var(--coach-border);
    border-radius: var(--coach-radius);
    padding: 1.5rem 1.75rem;
    margin-bottom: 1.5rem;
}

.coach-intro-panel h2 {
    margin: 0 0 0.75rem;
    font-size: 1.3rem;
    font-weight: 700;
}

.coach-intro-text {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.6;
    margin: 0 0 1rem;
}

/* Subtitle under product name (issue #113) */
.coach-intro-subtitle {
    font-size: 0.85rem;
    color: var(--accent-light);
    font-style: italic;
    margin: 0 0 0.75rem;
}

.coach-intro-features {
    list-style: none;
    padding: 0;
    margin: 0;
}

.coach-intro-features li {
    font-size: 0.85rem;
    color: var(--text-muted);
    padding: 0.3rem 0 0.3rem 1.4rem;
    position: relative;
}

.coach-intro-features li::before {
    content: "\2713";
    position: absolute;
    left: 0;
    color: var(--accent);
    font-weight: 700;
}

.coach-card {
    background: var(--coach-surface);
    border: 1px solid var(--coach-border);
    border-radius: var(--coach-radius);
    padding: 2rem;
    margin-bottom: 1.5rem;
}

.coach-card h2 {
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
}

.coach-intro {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

.coach-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* Two-column registration form (issue: optional alias/username field)
   Left column = required fields, right column = optional fields.
   Collapses to a single column on narrow screens.
   The .coach-reg-rtl class (not yet implemented) will swap column order
   for RTL language/culture layouts via flex-direction: row-reverse. */
.coach-reg-columns {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}
.coach-reg-col {
    flex: 1 1 170px;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.coach-reg-col-heading {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin: 0 0 0.25rem 0;
    font-weight: 600;
}
.coach-reg-required .coach-reg-col-heading {
    color: var(--accent, #8b5cf6);
}
.coach-reg-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.4;
}
.coach-reg-send-code-btn {
    padding: 0.25rem 0;
    font-size: 0.8rem;
    margin-top: -0.25rem;
}
/* RTL toggle: swap columns (language/culture choice — not yet implemented) */
.coach-reg-rtl .coach-reg-columns {
    flex-direction: row-reverse;
}

/* Bottom row of the registration form: registration code + email confirmation
   code sit side by side, smaller and more compact than the main columns. */
.coach-reg-bottom-row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 0.5rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--coach-border, #334155);
}
.coach-reg-bottom-field {
    flex: 1 1 220px;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}
/* Compact email confirmation code: smaller label and tighter spacing. */
.coach-reg-email-validation--compact {
    font-size: 0.85rem;
}
.coach-reg-email-validation--compact .coach-label {
    font-size: 0.8rem;
}
.coach-reg-email-validation--compact .coach-reg-send-code-btn {
    font-size: 0.75rem;
    padding: 0.15rem 0;
    margin-top: -0.2rem;
}
.coach-reg-email-validation--compact .coach-otp-wrapper {
    margin: 0.25rem 0;
}

.coach-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.coach-input {
    background: var(--primary-bg);
    border: 1px solid var(--coach-border);
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    font: inherit;
    font-size: 0.95rem;
}

.coach-input:focus {
    outline: none;
    border-color: var(--accent);
}

.coach-input::placeholder {
    color: var(--text-muted);
}

/* Social login */
.coach-social {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin-bottom: 1rem;
}

.coach-social-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    width: 100%;
    border: 1px solid var(--coach-border);
    border-radius: 0.5rem;
    padding: 0.65rem 1rem;
    font: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    background: var(--primary-bg);
    color: var(--text-primary);
    transition: border-color 0.15s;
}

.coach-social-btn:hover,
.coach-social-btn:focus-visible {
    border-color: var(--accent);
}

.coach-social-btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.coach-social-icon {
    flex-shrink: 0;
}

.coach-divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 1rem 0;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.coach-divider::before,
.coach-divider::after {
    content: "";
    flex: 1;
    border-bottom: 1px solid var(--coach-border);
}

.coach-divider span {
    padding: 0 0.75rem;
}

/* coach-login.js toggles all of these with el.hidden, and every one of them
   sets `display` above — which silently beats the browser's [hidden] rule, so
   they stayed on screen while "hidden": the "or" divider with social login
   disabled, the registration OTP boxes before a code is sent, and the tab bar
   during the reset/confirm overlays.
   .coach-forgot-captcha has the same defect but is deliberately left out —
   Turnstile renders implicitly on load and a widget that starts in a
   display:none container can fail to run, which cannot be tested without a
   site key. */
.coach-social[hidden],
.coach-divider[hidden],
.coach-otp-wrapper[hidden],
.coach-auth-tab-bar[hidden] {
    display: none;
}

/* Status messages */
.coach-status {
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.85rem;
    margin-top: 0.75rem;
}

.coach-status.status-loading {
    background: rgba(139, 92, 246, 0.1);
    color: var(--accent-light);
}

.coach-status.status-success {
    background: rgba(46, 125, 50, 0.15);
    color: #81c784;
}

.coach-status.status-error {
    background: rgba(198, 40, 40, 0.15);
    color: #ef9a9a;
}

/* Choices */
.coach-choices {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 1rem;
}

.coach-back-btn {
    margin-top: 1rem;
    font-size: 0.85rem;
}

/* ── Auth Tabs (Sign In / Register) ── */
.coach-auth-tab-bar {
    display: flex;
    background: var(--primary-bg, #0f172a);
    padding: 0.25rem;
    border-radius: 0.6rem;
    border: 1px solid var(--coach-border, #334155);
    margin-bottom: 1.5rem;
    gap: 0.25rem;
}

.coach-auth-tab {
    flex: 1;
    padding: 0.6rem 1rem;
    border: none;
    background: transparent;
    color: var(--text-muted, #94a3b8);
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 0.45rem;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.coach-auth-tab:hover {
    color: var(--text-primary, #f1f5f9);
}

.coach-auth-tab.active,
.coach-auth-tab[aria-selected="true"] {
    background: var(--coach-surface, #1e293b);
    color: var(--accent-light, #a78bfa);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.coach-auth-tab:focus-visible {
    outline: 2px solid var(--accent, #8b5cf6);
    outline-offset: 1px;
}

/* Single auth window: .coach-auth-panel carries the card chrome and holds the
   tab bar plus both forms, so the switcher is the header row of one box
   instead of a separate window floating above the form. */
.coach-auth-panel {
    background: var(--coach-surface);
    border: 1px solid var(--coach-border);
    border-radius: var(--coach-radius);
    margin-bottom: 1.5rem;
}

/* Forms inside the panel drop their own chrome — the panel provides it.
   No display rule here: both cards are toggled with the hidden attribute. */
.coach-auth-panel > .coach-card {
    background: none;
    border: none;
    border-radius: 0;
    margin-bottom: 0;
}

/* Tab bar as the panel's header row: flush with the top edge, only the top
   corners rounded, and one divider line between it and the form body. */
.coach-auth-tab-bar--header {
    margin: 0;
    padding: 0.4rem;
    border: none;
    border-bottom: 1px solid var(--coach-border);
    border-radius: calc(var(--coach-radius) - 1px) calc(var(--coach-radius) - 1px) 0 0;
}

/* ── Password Reveal Wrapper ── */
.coach-password-wrap {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.coach-password-wrap .coach-input {
    width: 100%;
    padding-right: 2.75rem;
    box-sizing: border-box;
}

.coach-password-toggle {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: var(--text-muted, #94a3b8);
    padding: 0.35rem;
    border-radius: 0.375rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s ease;
}

.coach-password-toggle:hover {
    color: var(--text-primary, #f1f5f9);
}

.coach-password-toggle:focus-visible {
    outline: 2px solid var(--accent, #8b5cf6);
    outline-offset: 1px;
}

.coach-eye-icon {
    display: block;
    flex-shrink: 0;
}

.coach-eye-icon[hidden] {
    display: none;
}

/* ── Segmented OTP Component ── */
.coach-otp-wrapper {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin: 0.5rem 0;
}

.coach-otp-digits {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 0.5rem;
}

.coach-otp-digit {
    width: 100%;
    min-width: 0;
    max-width: 48px;
    height: 48px;
    text-align: center;
    font-size: 1.3rem;
    font-weight: 700;
    font-family: monospace;
    background: var(--primary-bg, #0f172a);
    border: 1px solid var(--coach-border, #334155);
    border-radius: 0.5rem;
    color: var(--text-primary, #f1f5f9);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.coach-otp-digit:focus {
    outline: none;
    border-color: var(--accent, #8b5cf6);
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.25);
}

/* Smaller OTP digits for compact placements (e.g. bottom row of the
   registration form, next to the registration code). */
.coach-otp-digits--sm {
    gap: 0.3rem;
}
.coach-otp-digits--sm .coach-otp-digit {
    max-width: none;
    height: 44px;
    font-size: 1rem;
    border-radius: 0.35rem;
}

/* ── Chat: Unified Top Action Toolbar ── */
.coach-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding-bottom: 0.85rem;
    margin-bottom: 0.85rem;
    border-bottom: 1px solid var(--coach-border, #334155);
    flex-wrap: wrap;
}

.coach-header-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.coach-header-left h2 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary, #f1f5f9);
}

.coach-header-status {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.75rem;
    font-weight: 500;
    background: rgba(34, 197, 94, 0.1);
    color: #4ade80;
    padding: 0.15rem 0.5rem;
    border-radius: 9999px;
    border: 1px solid rgba(74, 222, 128, 0.2);
}

.coach-status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #4ade80;
    display: inline-block;
    box-shadow: 0 0 6px #4ade80;
}

.coach-toolbar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-left: auto;
}

.coach-toolbar-item {
    position: relative;
    display: flex;
    align-items: center;
}

.coach-toolbar-btn,
.coach-toolbar-select {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--primary-bg, #0f172a);
    border: 1px solid var(--coach-border, #334155);
    color: var(--text-secondary, #cbd5e1);
    border-radius: 0.45rem;
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    line-height: 1.2;
    transition: all 0.15s ease;
}

.coach-toolbar-btn:hover,
.coach-toolbar-select:hover {
    border-color: var(--accent-light, #a78bfa);
    color: var(--text-primary, #f1f5f9);
}

.coach-toolbar-btn:focus-visible,
.coach-toolbar-select:focus-visible {
    outline: 2px solid var(--accent, #8b5cf6);
    outline-offset: 1px;
}

/* User profile avatar dropdown in top toolbar */
.coach-user-dropdown {
    position: relative;
}

.coach-user-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    background: var(--primary-bg, #0f172a);
    border: 1px solid var(--coach-border, #334155);
    border-radius: 0.45rem;
    padding: 0.25rem 0.6rem 0.25rem 0.35rem;
    color: var(--text-primary, #f1f5f9);
    cursor: pointer;
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 500;
    transition: all 0.15s ease;
}

.coach-user-btn:hover {
    border-color: var(--accent-light, #a78bfa);
}

.coach-user-btn:focus-visible {
    outline: 2px solid var(--accent, #8b5cf6);
    outline-offset: 1px;
}

.coach-user-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--accent, #8b5cf6);
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.75rem;
}

.coach-user-name {
    max-width: 110px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.coach-user-menu {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 0.35rem);
    background: var(--coach-surface, #1e293b);
    border: 1px solid var(--coach-border, #334155);
    border-radius: 0.5rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
    padding: 0.4rem;
    min-width: 200px;
    z-index: 30;
    flex-direction: column;
    gap: 0.2rem;
}

.coach-user-menu.is-open {
    display: flex;
}

.coach-menu-header {
    padding: 0.4rem 0.6rem;
    font-size: 0.75rem;
    color: var(--text-muted, #94a3b8);
    border-bottom: 1px solid var(--coach-border, #334155);
    margin-bottom: 0.25rem;
    word-break: break-all;
}

.coach-menu-item {
    display: flex;
    align-items: center;
    padding: 0.45rem 0.6rem;
    font-size: 0.82rem;
    color: var(--text-secondary, #cbd5e1);
    border-radius: 0.35rem;
    text-decoration: none;
    background: transparent;
    border: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.12s ease, color 0.12s ease;
}

.coach-menu-item:hover,
.coach-menu-item:focus-visible {
    background: var(--primary-bg, #0f172a);
    color: var(--text-primary, #f1f5f9);
    outline: none;
}

.coach-menu-divider {
    height: 1px;
    background: var(--coach-border, #334155);
    margin: 0.25rem 0;
}

/* Compact Dismissible Intro Panel */
.coach-intro-panel {
    position: relative;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.coach-intro-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.coach-intro-dismiss {
    background: transparent;
    border: none;
    color: var(--text-muted, #94a3b8);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 0.35rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s ease;
}

.coach-intro-dismiss:hover {
    color: var(--text-primary, #f1f5f9);
}

.coach-intro-panel.is-dismissed {
    display: none;
}

/* Handoff clarify form (AI-initiated handoff) — member-initiated prompt
   removed (issue #286); these styles remain for the clarify flow. */

.coach-messages {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid var(--coach-border);
    border-radius: 0.5rem;
    padding: 1rem;
    margin-bottom: 1rem;
    background: var(--primary-bg);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    /* position: relative so the scroll-to-bottom button can float inside */
    position: relative;
}

/* Scroll-to-bottom button: floats at the bottom-right of the messages area,
   shown only when the user has scrolled up. Standard mobile chat pattern. */
.coach-scroll-bottom-btn {
    position: absolute;
    right: 0.75rem;
    bottom: 0.75rem;
    z-index: 10;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: var(--secondary-bg, #1e293b);
    color: var(--text-secondary, #cbd5e1);
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    transition: opacity 0.2s, background 0.15s;
}
.coach-scroll-bottom-btn:hover,
.coach-scroll-bottom-btn:focus-visible {
    background: var(--accent, #4f7cff);
    color: #fff;
}

.coach-scroll-bottom-btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}
.coach-scroll-bottom-btn[hidden] {
    display: none;
}

.coach-msg {
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.9rem;
    line-height: 1.5;
    max-width: 85%;
    overflow-wrap: break-word;
    word-break: break-word;
}

.coach-msg-user {
    background: var(--accent);
    color: white;
    align-self: flex-end;
}

.coach-msg-ai {
    background: var(--secondary-bg);
    border: 1px solid var(--coach-border);
    align-self: flex-start;
}

/* Emphasis in welcome messages (rendered from **text** → <em>) */
.coach-msg-ai em {
    font-style: italic;
    font-weight: 600;
}

/* "Harmonizing..." indicator shown while the backend processes a message */
.coach-harmonizing {
    color: var(--text-muted, #888);
    font-style: italic;
    font-size: 0.85rem;
    opacity: 0.8;
}

.coach-harmonizing-dots::after {
    content: "";
    animation: coach-harmonizing-dots 1.4s steps(4, end) infinite;
}

@keyframes coach-harmonizing-dots {
    0%   { content: ""; }
    25%  { content: "."; }
    50%  { content: ".."; }
    75%  { content: "..."; }
    100% { content: ""; }
}

.coach-msg-ai .coach-sources {
    margin-top: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.coach-msg-ai .coach-sources a {
    color: var(--accent-light);
}

/* Handoff room URL (Jitsi) — issue #17 */
.coach-msg-ai .coach-handoff-notice {
    margin-top: 0.75rem;
    padding: 0.75rem;
    border: 1px solid var(--warn, #d29a22);
    border-radius: 0.5rem;
    background: rgba(210, 154, 34, 0.1);
}

.coach-msg-ai .coach-handoff-notice a {
    display: block;
    font-weight: 600;
    color: var(--accent-light);
    text-decoration: none;
    margin-bottom: 0.25rem;
}

.coach-msg-ai .coach-handoff-notice a:hover,
.coach-msg-ai .coach-handoff-notice a:focus-visible {
    text-decoration: underline;
}

.coach-msg-ai .coach-handoff-expiry {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.coach-msg-ai .coach-handoff-notified {
    font-weight: 600;
    color: var(--text-primary, #f1f5f9);
    margin-bottom: 0.5rem;
}

/* Handoff clarifying message form */
.coach-msg-ai .coach-handoff-clarify {
    margin-top: 0.75rem;
    padding: 0.75rem;
    border: 1px solid var(--border, #334155);
    border-radius: 0.5rem;
    background: var(--secondary-bg, #1e293b);
}

.coach-msg-ai .coach-handoff-clarify-prompt {
    font-weight: 500;
    color: var(--text-primary, #f1f5f9);
    margin-bottom: 0.5rem;
}

.coach-msg-ai .coach-handoff-clarify-input {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border, #334155);
    border-radius: 0.375rem;
    background: var(--primary-bg, #0f172a);
    color: var(--text-primary, #f1f5f9);
    font-family: inherit;
    font-size: 0.9rem;
    resize: vertical;
    margin-bottom: 0.5rem;
}

.coach-msg-ai .coach-handoff-clarify-input:focus {
    outline: 2px solid var(--accent-light, #a78bfa);
    outline-offset: 1px;
}

.coach-msg-ai .coach-handoff-clarify-btns {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.coach-msg-ai .coach-handoff-clarify-send {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

.coach-msg-ai .coach-handoff-clarify-skip {
    background: none;
    border: none;
    color: var(--text-muted, #94a3b8);
    font-size: 0.85rem;
    cursor: pointer;
    text-decoration: underline;
    padding: 0;
}

.coach-msg-ai .coach-handoff-clarify-skip:hover,
.coach-msg-ai .coach-handoff-clarify-skip:focus-visible {
    color: var(--text-secondary, #cbd5e1);
}

.coach-msg-ai .coach-handoff-clarify-skip:disabled,
.coach-msg-ai .coach-handoff-clarify-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* YouTube video embed (ticket #008 Phase 2, Option A) */
.coach-msg-ai .coach-video-embed {
    margin-top: 0.75rem;
    border-radius: 0.5rem;
    overflow: hidden;
    max-width: 560px;
}

.coach-msg-ai .coach-video-embed iframe {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    height: auto;
    border: 0;
    border-radius: 0.5rem;
}

/* "Jump to this moment" deep-link below embed (ticket #011 Phase 3) */
.coach-msg-ai .coach-video-jump-link {
    display: inline-block;
    margin-top: 0.4rem;
    font-size: 0.85rem;
    color: var(--accent, #8b5cf6);
    text-decoration: none;
}
.coach-msg-ai .coach-video-jump-link:hover,
.coach-msg-ai .coach-video-jump-link:focus-visible {
    text-decoration: underline;
}

/* "Play video" link for non-YouTube video URLs (issue #017) */
.coach-msg-ai .coach-video-link {
    margin-top: 0.75rem;
}
.coach-msg-ai .coach-video-play-link {
    display: inline-block;
    font-size: 0.9rem;
    color: var(--accent, #8b5cf6);
    text-decoration: none;
}
.coach-msg-ai .coach-video-play-link:hover,
.coach-msg-ai .coach-video-play-link:focus-visible {
    text-decoration: underline;
}

/* Rich link cards (issue #217) — OpenGraph metadata rendered as visual cards
   instead of raw, overflow-prone URLs. Falls back to a truncated clickable
   link when metadata is unavailable. */
.coach-msg-ai .coach-link-card {
    display: flex;
    gap: 0.75rem;
    padding: 0.75rem;
    border: 1px solid var(--coach-border, #334155);
    border-radius: 0.5rem;
    margin-top: 0.5rem;
    max-width: 400px;
    text-decoration: none;
    color: inherit;
    transition: border-color 0.15s ease;
}
.coach-msg-ai .coach-link-card:hover,
.coach-msg-ai .coach-link-card:focus-visible {
    border-color: var(--accent, #8b5cf6);
    outline: none;
}
.coach-msg-ai .coach-link-card-thumb {
    width: 80px;
    height: 80px;
    min-width: 80px;
    border-radius: 0.25rem;
    object-fit: cover;
    background: var(--secondary-bg, #1e293b);
}
.coach-msg-ai .coach-link-card-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}
.coach-msg-ai .coach-link-card-title {
    font-weight: 600;
    font-size: 0.85rem;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.coach-msg-ai .coach-link-card-desc {
    font-size: 0.75rem;
    color: var(--text-muted, #94a3b8);
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.coach-msg-ai .coach-link-card-site {
    font-size: 0.7rem;
    color: var(--text-muted, #94a3b8);
    margin-top: auto;
}
/* Fallback: truncated clickable link when no OG metadata */
.coach-msg-ai .coach-link-fallback {
    display: inline-block;
    margin-top: 0.25rem;
    font-size: 0.85rem;
    color: var(--accent, #8b5cf6);
    text-decoration: none;
    word-break: break-all;
}
.coach-msg-ai .coach-link-fallback:hover,
.coach-msg-ai .coach-link-fallback:focus-visible {
    text-decoration: underline;
}
/* Loading skeleton while fetching metadata */
.coach-msg-ai .coach-link-card-skeleton {
    display: flex;
    gap: 0.75rem;
    padding: 0.75rem;
    border: 1px solid var(--coach-border, #334155);
    border-radius: 0.5rem;
    margin-top: 0.5rem;
    max-width: 400px;
    min-height: 96px;
    background: var(--secondary-bg, #1e293b);
    opacity: 0.6;
}
.coach-msg-ai .coach-link-card-skeleton::after {
    content: "Fetching link preview\u2026";
    font-size: 0.75rem;
    color: var(--text-muted, #94a3b8);
    align-self: center;
}

/* Feedback controls (thumbs up/down) */
.coach-feedback-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.5rem;
    padding-top: 0.4rem;
}
.coach-fb-chip {
    background: none;
    border: 1px solid rgba(255,255,255,0.15);
    color: rgba(255,255,255,0.5);
    padding: 0.25rem 0.5rem;
    border-radius: 1rem;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    line-height: 1;
}
.coach-fb-chip:hover,
.coach-fb-chip:focus-visible { border-color: rgba(255,255,255,0.4); }

.coach-fb-chip:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}
.coach-fb-chip.coach-fb-selected {
    background: var(--coach-accent, #4fc3f7);
    border-color: var(--coach-accent, #4fc3f7);
}
.coach-fb-detail {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.4rem;
    width: 100%;
    align-items: center;
}
.coach-fb-detail-prompt {
    font-size: 0.8rem;
    color: rgba(255,255,255,0.6);
    font-style: italic;
    width: 100%;
}
.coach-fb-chip--comment {
    opacity: 0.6;
}
.coach-fb-chip--comment:hover,
.coach-fb-chip--comment:focus-visible { opacity: 1; }
.coach-fb-detail-input {
    flex: 1;
    min-width: 12rem;
    padding: 0.3rem 0.6rem;
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 0.3rem;
    font-size: 0.85rem;
    font-family: inherit;
    color: #fff;
    background: rgba(0,0,0,0.3);
}
.coach-fb-detail-input:focus { outline: none; border-color: var(--coach-accent, #4fc3f7); }
.coach-fb-detail-submit {
    padding: 0.3rem 0.8rem;
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 0.3rem;
    font-size: 0.85rem;
    cursor: pointer;
    font-family: inherit;
    background: rgba(0,0,0,0.3);
    color: #fff;
}
.coach-fb-detail-submit:hover,
.coach-fb-detail-submit:focus-visible { border-color: var(--coach-accent, #4fc3f7); }

.coach-fb-detail-submit:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.coach-queue-banner {
    background: rgba(245, 127, 23, 0.15);
    color: #ffb74d;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.85rem;
    margin-bottom: 0.75rem;
    text-align: center;
    animation: coach-pulse 2s ease-in-out infinite;
}

@keyframes coach-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.coach-chat-form {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.coach-input-row {
    display: flex;
    gap: 0.5rem;
    align-items: stretch;
}

.coach-chat-input {
    flex: 1;
    background: var(--primary-bg);
    border: 1px solid var(--coach-border);
    border-radius: 0.5rem;
    padding: 0.75rem;
    color: var(--text-primary);
    font: inherit;
    font-size: 16px; /* #152: ≥16px prevents iOS Safari auto-zoom on focus */
    resize: vertical;
    min-height: 60px;
}

.coach-chat-input:focus {
    outline: none;
    border-color: var(--accent);
}

/* Send button — compact icon button, not a large text button.
   Override .btn's large padding and the mobile .btn { width: 100% } rule. */
#coach-send-btn {
    padding: 0.5rem 0.75rem;
    font-size: 1rem;
    line-height: 1;
    white-space: nowrap;
    flex-shrink: 0;
    align-self: stretch;
    width: auto;
    min-width: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

@media (max-width: 768px) {
    /* Issue #150: On mobile the chat pane was capped at 400px and sat below
       a full screen of header/intro chrome. Hide the marketing intro panel
       (the chat header already labels the view) and turn the shell into a
       flex column that fills the viewport below the sticky nav. The chat
       card becomes a flex column whose messages area grows to fill the
       remaining space instead of being a 400px scroll box.
       Issue #151: 100dvh (dynamic viewport height) shrinks when the
       on-screen keyboard opens on iOS/Android, so the composer stays
       visible above the keyboard. A visualViewport listener in
       coach-chat.js provides an additional fallback for older browsers.
       Safe-area insets: env(safe-area-inset-*) adds padding for notched
       / home-indicator phones (iPhone X+) so the composer and send button
       aren't obscured. Requires viewport-fit=cover in the meta viewport. */
    .coach-intro-panel {
        display: none;
    }
    /* Scope mobile chat layout to pages that actually have #coach-chat
       (members.html). Without :has(#coach-chat), the flex/min-height/
       reduced-padding overrides would also apply to the login page,
       making the form wider than the header/footer. */
    .coach-shell:has(#coach-chat) {
        display: flex;
        flex-direction: column;
        /* 100dvh shrinks with the keyboard on modern browsers (#151).
           --vvh is set on :root by the visualViewport listener in
           coach-chat.js as a fallback for older browsers without dvh
           support. --nav-h is set by coach-chat.js measuring the actual
           sticky header; falls back to 70px. */
        min-height: calc(var(--vvh, 100dvh) - var(--nav-h, 70px));
        margin: 0.5rem auto;
        padding: 0 0.5rem;
        padding-bottom: env(safe-area-inset-bottom);
    }
    #coach-chat.coach-card {
        display: flex;
        flex-direction: column;
        flex: 1;
        min-height: 0;
        /* Issue #251: was 1rem all round — the chat window should use close
           to the full device width on mobile. Keep vertical padding (room
           for the header/footer rows) but trim the sides. */
        padding: 1rem 0.5rem;
        padding-bottom: calc(1rem + env(safe-area-inset-bottom));
        margin-bottom: 0;
    }
    .coach-messages {
        max-height: none;
        flex: 1;
        min-height: 0;
    }

    /* Issue #153: Keep chat header buttons inline on mobile — don't let
       them go full-width or stack into three separate rows. A more
       specific selector overrides any broad .btn { width: 100% } rule. */
    .coach-chat-header .btn {
        width: auto;
        flex-shrink: 0;
    }

    #coach-send-btn {
        width: auto;
    }

    /* Issue #154: composer ergonomics on touch devices.
       Textarea: drop the desktop resize handle, start at one row (JS sets
       rows=1 at this breakpoint), grow via autosize up to 8rem. min-height
       44px keeps the textarea ≥ the send button, which uses align-self:
       stretch to match it — so the send target stays ≥44px on its short
       axis too. Tap targets: min-height 44px (SC 2.5.5 AAA / Apple HIG);
       inline-flex vertically centers the label inside the taller box. */
    .coach-chat-input {
        resize: none;
        min-height: 44px;
    }
    #coach-send-btn {
        min-width: 44px;
        min-height: 44px;
    }
    .coach-logout-btn,
    .coach-clear-btn,
    .coach-profile-btn {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
}

/* Issue #251: landscape mobile has very little vertical room (phone on its
   side). Compact the header/footer chrome further so it doesn't crowd out
   the message list — the overflow menus above already do most of this
   work by moving secondary controls out of the flow; this trims what's
   left visible. */
@media (max-height: 500px) and (orientation: landscape) {
    .coach-chat-header {
        gap: 0.5rem;
        margin-bottom: 0.5rem;
    }
    .coach-env-label {
        display: none;
    }
    .coach-input-footer {
        gap: 0.35rem;
    }
    .coach-language-select {
        max-width: 140px;
    }
}

.coach-input-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    min-height: 1.2rem;
    flex-wrap: wrap;
}

/* Issue #184: Language selector in the chat composer footer */
.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;
}

.coach-lang-selector {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.coach-language-select {
    font-size: 0.75rem;
    color: var(--text-muted);
    background: transparent;
    border: 1px solid var(--border, rgba(255,255,255,0.1));
    border-radius: 4px;
    padding: 0.15rem 0.35rem;
    cursor: pointer;
    max-width: 160px;
    /* Allow shrinking on narrow screens — the char counter shares the
       footer row and both need to fit on a 320px screen. */
    min-width: 0;
    flex-shrink: 1;
    overflow: hidden;
    text-overflow: ellipsis;
}

.coach-language-select:hover,
.coach-language-select:focus-visible {
    border-color: var(--accent, #4fc3f7);
}

.coach-language-select:focus {
    outline: none;
    border-color: var(--accent, #4fc3f7);
}

/* ─── Toolbar confirmation messages — overlay rule (#267) ───────────────
   Any confirmation/status message triggered by a toolbar control MUST use
   position: absolute (overlay) positioning, never inline flow. Inline
   messages with width: 100% + flex-wrap: wrap displace sibling buttons
   when shown/hidden, causing layout shift. The old .coach-voice-warning
   was removed for this reason — the New Features popover below is the
   correct pattern: position: absolute, z-index: 1000.
   ──────────────────────────────────────────────────────────────────── */

/* ─── New Features popover (#557) ────────────────────────────────────── */

.coach-features-wrap {
    position: relative;
    margin-left: auto; /* push to far end of toolbar (LTR) */
}

[dir="rtl"] .coach-features-wrap {
    margin-left: 0;
    margin-right: auto;
}

.coach-features-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.coach-features-btn .coach-toolbar-icon {
    color: #ffc107;
}

.coach-features-popover {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    width: 340px;
    max-width: calc(100vw - 2rem);
    background: var(--bg-surface, #1e1e2e);
    border: 1px solid var(--border, rgba(255,255,255,0.15));
    border-radius: 12px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 193, 7, 0.1);
    z-index: 1000;
    animation: coach-features-fade-in 0.2s ease-out;
}

[dir="rtl"] .coach-features-popover {
    right: auto;
    left: 0;
}

@keyframes coach-features-fade-in {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.coach-features-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem 0.75rem;
    border-bottom: 1px solid var(--border, rgba(255,255,255,0.1));
}

.coach-features-header h3 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text, #e0e0e0);
}

.coach-features-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.15rem 0.35rem;
    border-radius: 4px;
    line-height: 1;
    transition: color 0.2s, background 0.2s;
}

.coach-features-close:hover,
.coach-features-close:focus {
    color: var(--text, #e0e0e0);
    background: rgba(255,255,255,0.08);
    outline: none;
}

.coach-features-intro {
    margin: 0;
    padding: 0.75rem 1.25rem 0.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.coach-features-list {
    list-style: none;
    margin: 0;
    padding: 0.25rem 0 0.75rem;
    max-height: 320px;
    overflow-y: auto;
}

.coach-feature-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.6rem 1.25rem;
    transition: background 0.15s;
}

.coach-feature-item:hover {
    background: rgba(255,255,255,0.03);
}

.coach-feature-toggle {
    position: relative;
    display: inline-flex;
    flex-shrink: 0;
    margin-top: 0.15rem;
    cursor: pointer;
}

.coach-feature-checkbox {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.coach-feature-toggle-switch {
    display: inline-block;
    width: 36px;
    height: 20px;
    border-radius: 10px;
    background: rgba(255,255,255,0.15);
    transition: background 0.2s ease;
    position: relative;
}

.coach-feature-toggle-switch::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    transition: transform 0.2s ease;
}

.coach-feature-checkbox:checked + .coach-feature-toggle-switch {
    background: #ffc107;
}

.coach-feature-checkbox:checked + .coach-feature-toggle-switch::after {
    transform: translateX(16px);
}

.coach-feature-checkbox:focus-visible + .coach-feature-toggle-switch {
    outline: 2px solid var(--accent, #4fc3f7);
    outline-offset: 2px;
}

.coach-feature-info {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.coach-feature-name {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text, #e0e0e0);
}

.coach-feature-desc {
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.35;
}

.coach-features-status {
    padding: 0.6rem 1.25rem 1rem;
    font-size: 0.8rem;
    color: #ffc107;
    border-top: 1px solid var(--border, rgba(255,255,255,0.1));
}

.coach-features-status-error {
    color: #f44336;
}

/* Mobile: popover anchors to the right edge of the toolbar */
@media (max-width: 768px) {
    .coach-features-popover {
        right: 0.5rem;
        width: calc(100vw - 1rem);
    }
    [dir="rtl"] .coach-features-popover {
        left: 0.5rem;
        right: auto;
    }
}

.coach-send-hint {
    font-size: 0.75rem;
    color: var(--accent, #4fc3f7);
    font-style: italic;
    animation: coach-hint-fade 0.2s ease-in;
    flex-basis: 100%;
    width: 100%;
    text-align: center;
}

@keyframes coach-hint-fade {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.coach-char-counter {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: right;
    margin-left: auto;
}

.coach-char-counter.over-limit #coach-char-count {
    color: #ef9a9a;
}

/* Toggle row (login ↔ register) */
.coach-toggle-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    margin-top: 1.25rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.btn-link {
    background: none;
    border: none;
    color: var(--accent-light);
    cursor: pointer;
    font: inherit;
    font-size: 0.85rem;
    padding: 0;
    text-decoration: underline;
}

.btn-link:hover,
.btn-link:focus-visible {
    color: var(--accent);
}

.btn-link:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Forgot password link */
.coach-forgot-link {
    align-self: flex-start;
    margin-top: 0.25rem;
    font-size: 0.8rem;
}

.coach-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 0.25rem 0 0;
}

/* Forgot password captcha */
.coach-forgot-captcha {
    margin-top: 0.75rem;
    display: flex;
    justify-content: center;
}

/* Login captcha (Turnstile) — matches .coach-forgot-captcha styling */
.coach-login-captcha {
    margin-top: 0.75rem;
    display: flex;
    justify-content: center;
}

/* Login-time activation panel — visual separation from the form above */
.coach-login-validation {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border, rgba(255,255,255,0.1));
}

/* Profile panel */
.coach-profile-btn {
    font-size: 0.8rem;
    padding: 0.4rem 0.8rem;
}

.coach-profile-info {
    margin-bottom: 1.5rem;
}

.coach-profile-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem 1.5rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

@media (max-width: 600px) {
    .coach-profile-grid {
        grid-template-columns: 1fr;
    }
}

.coach-profile-section {
    border-top: 1px solid var(--coach-border);
    padding-top: 1.5rem;
    margin-top: 1.5rem;
}

.coach-profile-section h3 {
    font-size: 1.1rem;
    margin: 0 0 0.75rem;
}

.coach-danger-zone {
    border-top-color: rgba(198, 40, 40, 0.3);
}

.coach-danger-zone h3 {
    color: #ef9a9a;
}

.btn-danger {
    background: rgba(198, 40, 40, 0.15);
    border: 1px solid rgba(198, 40, 40, 0.4);
    color: #ef9a9a;
    border-radius: 0.5rem;
    padding: 0.65rem 1rem;
    font: inherit;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.15s;
}

.btn-danger:hover,
.btn-danger:focus-visible {
    background: rgba(198, 40, 40, 0.25);
}

.btn-danger:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.status-info {
    background: rgba(139, 92, 246, 0.1);
    color: var(--accent-light);
}

/* ── Environment toggle + banner ──────────────────────────────────────────── */
.coach-env-controls {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-left: auto;
    margin-right: 0.5rem;
}

.coach-env-label {
    font-size: 0.75rem;
    color: var(--text-muted, #888);
    white-space: nowrap;
}

.coach-env-toggle {
    display: inline-flex;
    border: 1px solid var(--coach-border);
    border-radius: 2rem;
    padding: 2px;
    cursor: pointer;
    background: var(--coach-surface);
    transition: background 0.2s;
}

.coach-env-pill {
    font-size: 0.7rem;
    padding: 0.2rem 0.6rem;
    border-radius: 1.5rem;
    color: var(--text-muted, #888);
    transition: all 0.2s;
    white-space: nowrap;
}

html[data-locale="ja"] .coach-env-pill,
html[data-locale="zh"] .coach-env-pill,
html[data-locale="ko"] .coach-env-pill,
html[data-locale="ar"] .coach-env-pill,
html[data-locale="he"] .coach-env-pill,
html[data-locale="fa"] .coach-env-pill,
html[data-locale="hi"] .coach-env-pill {
    font-size: 1rem;
    padding: 0.45rem 1.05rem;
    line-height: 1.4;
    white-space: normal;
    letter-spacing: 0;
}

.coach-env-toggle[data-env="production"] .coach-env-prod {
    background: var(--accent, #4f7cff);
    color: #fff;
}

.coach-env-toggle[data-env="staging"] .coach-env-stg {
    background: #e65100;
    color: #fff;
}

.coach-env-banner {
    background: rgba(230, 81, 0, 0.1);
    border: 1px solid rgba(230, 81, 0, 0.3);
    border-radius: 0.5rem;
    padding: 0.6rem 1rem;
    margin-bottom: 0.75rem;
    font-size: 0.85rem;
    color: #e65100;
    line-height: 1.4;
}

.coach-env-banner a {
    color: inherit;
    text-decoration: underline;
    font-weight: 600;
}

/* Access notice (issue #113) */
.coach-access-notice {
    padding: 1rem 1.5rem;
    margin-bottom: 1.5rem;
}

.coach-access-label {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--accent-light);
    margin: 0 0 0.5rem;
}

/* Consent notice (issue #113) */
.coach-consent-notice {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-style: italic;
    margin: 0.75rem 0 0;
    line-height: 1.5;
}

.coach-login-forms {
    min-width: 0;
    width: 100%;
    max-width: 574px;
    margin-inline: auto;
}

.coach-login-forms .coach-card {
    padding: 1.4rem;
    margin-bottom: 1rem;
}

.coach-login-forms .coach-card h2 {
    font-size: 1.25rem;
    margin-bottom: 0.35rem;
}

.coach-login-forms .coach-intro {
    font-size: 0.8rem;
    margin-bottom: 1rem;
}

.coach-login-forms .coach-form,
.coach-login-forms .coach-reg-col {
    gap: 0.525rem;
}

.coach-login-forms .coach-reg-columns {
    gap: 1rem;
}

.coach-login-forms .coach-reg-bottom-row {
    gap: 0.7rem;
    margin-top: 0.35rem;
    padding-top: 0.525rem;
}

.coach-login-forms .coach-label,
.coach-login-forms .coach-reg-col-heading,
.coach-login-forms .coach-reg-hint,
.coach-login-forms .coach-consent-notice,
.coach-login-forms .coach-toggle-row,
.coach-login-forms .btn-link {
    font-size: 0.8rem;
}

.coach-login-forms .coach-input {
    min-height: 44px;
    padding: 0.45rem 0.7rem;
    font-size: 1rem;
}

.coach-login-forms .btn-primary,
.coach-login-forms .coach-social-btn,
.coach-login-forms .coach-auth-tab,
.coach-login-forms .coach-password-toggle {
    min-height: 44px;
}

.coach-login-forms .btn-primary,
.coach-login-forms .coach-social-btn {
    padding: 0.45rem 0.7rem;
    font-size: 0.875rem;
}

.coach-login-forms .coach-auth-tab-bar--header {
    padding: 0.28rem;
}

.coach-login-forms .coach-auth-tab {
    padding: 0.35rem 0.7rem;
    font-size: 0.85rem;
}

.coach-login-forms .coach-password-toggle {
    width: 44px;
    padding: 0;
    right: 0.15rem;
}

.coach-login-forms .coach-password-wrap .coach-input {
    padding-right: 3rem;
}

.coach-login-forms .coach-status {
    padding: 0.525rem 0.7rem;
    margin-top: 0.525rem;
    font-size: 0.8rem;
}

.coach-login-forms .coach-toggle-row {
    gap: 0.28rem;
    margin-top: 0.875rem;
}

.coach-login-forms .coach-login-captcha,
.coach-login-forms .coach-forgot-captcha,
.coach-login-forms .coach-login-validation {
    margin-top: 0.525rem;
}

/* The side-by-side login/registration grid (issue #213) is gone: the tab bar
   shows one form at a time, so the grid left the visible form at half the
   width of the tab bar above it. The panel is now a plain block that fills
   the shell, keeping the form the same width as the header and footer. */
@media (min-width: 900px) {
    /* The tab bar is wide enough to switch forms at this width, so the
       "switch form" links at the bottom of each card are redundant. */
    .coach-login-forms .coach-toggle-row {
        display: none;
    }
}

/* ── Sample questions (pre-sign-in) ──────────────────────────────────────
   Real exchanges from the coach, shown on the intro panel so a visitor can
   see the kind of answer they get before creating an account. */

.coach-samples {
    margin-top: 1rem;
    border-top: 1px solid var(--border, rgba(0, 0, 0, 0.1));
    padding-top: 0.9rem;
}

.coach-samples-title {
    font-size: 0.9rem;
    font-weight: 600;
    margin: 0 0 0.15rem;
}

.coach-samples-note {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 0 0 0.7rem;
}

/* Live demo-question chips (AIRichardMoon ticket #638). Hidden until the
   backend returns questions; the sample exchanges below are the fallback. */
.coach-demo-chips {
    margin: 0 0 0.9rem;
}

.coach-demo-chips-lead {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 0 0 0.5rem;
}

.coach-demo-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.coach-demo-chip {
    display: inline-block;
    padding: 0.35rem 0.7rem;
    border: 1px solid var(--border, rgba(0, 0, 0, 0.15));
    border-radius: 999px;
    font-size: 0.82rem;
    line-height: 1.3;
    text-decoration: none;
    color: inherit;
    background: transparent;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.coach-demo-chip:hover,
.coach-demo-chip:focus-visible {
    background: rgba(139, 92, 246, 0.1);
    border-color: rgba(139, 92, 246, 0.45);
}

.coach-sample {
    border: 1px solid var(--border, rgba(0, 0, 0, 0.1));
    border-radius: 6px;
    margin-bottom: 0.5rem;
    background: var(--surface, rgba(0, 0, 0, 0.02));
}

.coach-sample > summary {
    cursor: pointer;
    padding: 0.6rem 0.75rem;
    font-size: 0.85rem;
    font-weight: 600;
    line-height: 1.4;
    list-style: none;
}

.coach-sample > summary::-webkit-details-marker { display: none; }

.coach-sample > summary::before {
    content: "\203A";
    display: inline-block;
    width: 1em;
    color: var(--accent);
    font-weight: 700;
    transition: transform 0.15s ease;
}

.coach-sample[open] > summary::before { transform: rotate(90deg); }

.coach-sample-gloss {
    display: block;
    font-weight: 400;
    font-size: 0.8rem;
    color: var(--text-muted);
    padding-left: 1em;
}

.coach-sample-answer {
    font-size: 0.85rem;
    line-height: 1.6;
    color: var(--text-muted);
    margin: 0;
    padding: 0 0.75rem 0.75rem 1.75rem;
}
