/* ============================================================================
   DEFAULT DOCUMENTS SECTION
   ============================================================================ */

.default-docs-section {
    margin-top: var(--space-8);
    background: var(--card-bg, #1a1f2e);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: var(--space-5) var(--space-6);
}

.default-docs-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-4);
    gap: var(--space-4);
}

.default-docs-header h3 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary, #fff);
}

.default-docs-subtitle {
    margin: var(--space-1) 0 0;
    font-size: 0.8rem;
    color: var(--text-muted, #888);
}

.default-docs-empty {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin: 0;
}

.default-docs-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.default-doc-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-2-5) var(--space-3);
    border-bottom: 1px solid var(--border-color);
    transition: background var(--motion-fast);
    border-radius: var(--radius-sm);
}

.default-doc-item:last-child {
    border-bottom: none;
}

.default-doc-item:hover {
    background: var(--raise-3);
}

.default-doc-info {
    display: flex;
    align-items: center;
    gap: var(--space-2-5);
    flex: 1;
    min-width: 0;
}

.default-doc-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

.default-doc-icon svg {
    display: block;
}

.default-doc-name {
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.default-doc-size {
    font-size: 0.75rem;
    color: var(--text-muted, #888);
    flex-shrink: 0;
}

.default-doc-actions {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    flex-shrink: 0;
    margin-left: var(--space-4);
}

.default-doc-view {
    color: var(--primary-light, #60a5fa);
    text-decoration: none;
    display: flex;
    align-items: center;
    padding: var(--space-1);
    border-radius: var(--radius-xs);
    transition: background var(--motion-fast);
}

.default-doc-view:hover {
    background: var(--info-wash);
}

.default-doc-delete {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    padding: var(--space-1);
    border-radius: var(--radius-xs);
    transition: all var(--motion-fast);
}

.default-doc-delete:hover {
    color: var(--danger-ink);
    background: var(--danger-wash);
}

[data-theme="light"] .default-docs-section {
    background: var(--surface-solid);
    border-color: var(--gray);
}

/* Director Settings Cards */
.director-settings-card {
    margin-top: var(--space-6);
    background: var(--card-bg, #1a1f2e);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: var(--space-5) var(--space-6);
}

.director-settings-card:first-child {
    margin-top: 0;
}

[data-theme="light"] .director-settings-card {
    background: var(--surface-solid);
    border-color: var(--gray);
}

[data-theme="light"] .default-doc-item {
    border-bottom-color: var(--hairline-faint);
}

[data-theme="light"] .default-doc-item:hover {
    background: var(--raise-1);
}

[data-theme="light"] .default-doc-name {
    color: var(--text-primary);
}

[data-theme="light"] .default-doc-size {
    color: var(--text-muted);
}

[data-theme="light"] .default-doc-delete {
    color: var(--text-muted);
}

[data-theme="light"] .default-doc-delete:hover {
    color: var(--danger-ink);
}

/* ============================================================================
   VISIBILITY & ACCESS LINKS
   ============================================================================ */

/* Toggle label with checkbox */
.toggle-label {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    cursor: pointer;
    padding: var(--space-3-5) var(--space-4);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    transition: background var(--motion-fast), border-color var(--motion-fast), box-shadow var(--motion-fast);
    background: var(--raise-2);
}

.toggle-label:hover {
    background: var(--raise-2);
    border-color: var(--border-color);
}

.toggle-label input[type="checkbox"] {
    margin-top: var(--space-0-5);
    width: 18px;
    height: 18px;
    accent-color: var(--info);
    flex-shrink: 0;
    cursor: pointer;
}

.toggle-label input[type="checkbox"]:checked~.toggle-text strong {
    color: var(--info-ink);
}

.toggle-label:has(input:checked) {
    border-color: var(--info-wash-border);
    background: var(--info-wash);
}

.toggle-text {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.toggle-text strong {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: 0.01em;
}

.toggle-text small {
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.4;
}

/* Link panel */
.link-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-3);
    padding-bottom: var(--space-2);
    border-bottom: 1px solid var(--border-color);
}

.link-panel-header h4 {
    margin: 0;
    font-size: 0.95rem;
}

.link-panel-actions {
    display: flex;
    gap: var(--space-2);
}

#familyLinksPanel+#teamLinksPanel {
    margin-top: var(--space-6);
    padding-top: var(--space-4);
    border-top: 1px solid var(--border-subtle);
}

/* Link items */
.links-list {
    display: flex;
    flex-direction: column;
    gap: 0;
    max-height: 400px;
    overflow-y: auto;
}

.link-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-2) var(--space-1-5);
    border-bottom: 1px solid var(--border-subtle);
    transition: background var(--motion-instant);
}

.link-item:last-child {
    border-bottom: none;
}

.link-item:hover {
    background: var(--raise-2);
    border-radius: var(--radius-sm);
}

.link-item-info {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex: 1;
    min-width: 0;
}

.link-item-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
}

.link-item-label {
    font-size: 0.85rem;
    color: var(--text-primary, #fff);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.link-item-code {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    background: var(--info-wash);
    color: var(--info-ink);
    padding: var(--space-0-5) var(--space-1-5);
    border-radius: var(--radius-xs);
    flex-shrink: 0;
    letter-spacing: 0.5px;
}

.link-item-actions {
    display: flex;
    align-items: center;
    gap: var(--space-1-5);
    flex-shrink: 0;
    margin-left: var(--space-2);
}

.btn-xs {
    font-size: 0.72rem;
    min-height: 1.6rem;
    padding: 0 var(--space-1-5);
    border-radius: var(--radius-md);
    min-width: auto;
}

/* Player status buttons (DQ / DNF / Clear) */
.btn-dq {
    background: var(--danger);
    color: var(--on-danger);
    font-size: 0.78rem;
    padding: 0 var(--space-3);
    border: none;
    border-radius: var(--gsx-control-radius);
    cursor: pointer;
    font-weight: 600;
    transition: background var(--motion-base);
}

.btn-dq:hover {
    background: var(--danger-dark);
}

.btn-dnf {
    background: var(--warning);
    color: var(--on-warning);
    font-size: 0.78rem;
    padding: 0 var(--space-3);
    border: none;
    border-radius: var(--gsx-control-radius);
    cursor: pointer;
    font-weight: 600;
    transition: background var(--motion-base);
}

.btn-dnf:hover {
    background: var(--warning-dark);
}

.btn-scratch {
    background: var(--purple);
    color: var(--on-danger);
    font-size: 0.78rem;
    padding: 0 var(--space-3);
    border: none;
    border-radius: var(--gsx-control-radius);
    cursor: pointer;
    font-weight: 600;
    transition: background var(--motion-base);
}

.btn-scratch:hover {
    background: #6d28d9; /* tokens-allow: purple SCR button hover, no --purple-dark token */
}

.btn-clear-status {
    background: var(--success);
    color: var(--on-success);
    font-size: 0.75rem;
    padding: var(--space-1) var(--space-3);
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 600;
    transition: background var(--motion-base);
}

.btn-clear-status:hover {
    background: var(--success-dark);
}

@media (max-width: 768px) {

    .btn-dq,
    .btn-dnf,
    .btn-scratch,
    .btn-clear-status {
        min-height: 36px;
        padding: var(--space-1-5) var(--space-3-5);
        font-size: 0.8rem;
    }

    .verifier-remove-btn {
        min-height: 36px;
    }
}

/* Copy toast */
.copy-toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    background: var(--success);
    color: var(--on-success);
    padding: var(--space-2) var(--space-5);
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    font-weight: 600;
    box-shadow: var(--shadow-lg);
    z-index: var(--z-toast);
    animation: toastSlide 2s ease forwards;
}

@keyframes toastSlide {
    0% {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }

    15% {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }

    85% {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }

    100% {
        opacity: 0;
        transform: translateX(-50%) translateY(-10px);
    }
}

[data-theme="light"] .toggle-label {
    border-color: var(--gray);
    background: var(--raise-1);
}

[data-theme="light"] .toggle-label:hover {
    background: var(--raise-2);
    border-color: var(--gray);
}

[data-theme="light"] .toggle-label:has(input:checked) {
    border-color: var(--info-wash-border);
    background: var(--info-wash);
}

[data-theme="light"] .toggle-text strong {
    color: var(--text-primary);
}

[data-theme="light"] .toggle-text small {
    color: var(--text-muted);
}

[data-theme="light"] .toggle-label input[type="checkbox"]:checked~.toggle-text strong {
    color: var(--info-ink);
}

[data-theme="light"] .link-item:hover {
    background: var(--raise-2);
}

[data-theme="light"] .link-item-code {
    background: var(--info-wash);
    color: var(--info-ink);
}

/* ===== Create Tournament Page ===== */
#createTournamentScreen .container {
    max-width: 800px;
    padding-bottom: 6rem;
}

#createTournamentScreen .dashboard-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--space-3);
    margin-bottom: var(--space-6);
}

#createTournamentScreen .dashboard-header h1 {
    font-size: 1.5rem;
    margin: 0;
}

/* ── Create Tournament Mode Tabs (Hosted / External) ── */
.create-tournament-mode-tabs {
    display: flex;
    gap: 0;
    margin-bottom: var(--space-1);
    border-bottom: 2px solid var(--border-color);
}

.ct-mode-tab {
    padding: var(--space-2-5) var(--space-5);
    font-size: 0.9rem;
    font-weight: 600;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: color var(--motion-base), border-color var(--motion-base);
    margin-bottom: -2px;
}

.ct-mode-tab:hover {
    color: var(--text-primary);
}

.ct-mode-tab.active {
    color: var(--brand-ink);
    border-bottom-color: var(--primary-color);
}

.ct-mode-tab[data-mode="external"].active {
    color: #a855f7; /* tokens-allow: external-mode purple, no token */
    border-bottom-color: #a855f7; /* tokens-allow: external-mode purple, no token */
}

.ct-mode-hint {
    font-size: 0.85rem;
    color: #a855f7; /* tokens-allow: external-mode purple, no token */
    margin: 0 0 var(--space-4);
    padding: var(--space-2-5) var(--space-4);
    background: rgba(168, 85, 247, 0.08); /* tokens-allow: external-mode purple wash */
    border-radius: var(--radius-md);
    border: 1px solid rgba(168, 85, 247, 0.2); /* tokens-allow: external-mode purple wash */
}

[data-theme="light"] .ct-mode-hint {
    background: rgba(168, 85, 247, 0.06); /* tokens-allow: external-mode purple wash */
    border-color: rgba(168, 85, 247, 0.15); /* tokens-allow: external-mode purple wash */
    color: #7c3aed; /* tokens-allow: external-mode purple, no token */
}

@media (max-width: 768px) {
    .ct-mode-tab {
        flex: 1;
        text-align: center;
        padding: var(--space-2) var(--space-2);
        font-size: 0.82rem;
    }
}

.create-tournament-actions {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-3);
    padding: var(--space-6) 0 var(--space-8);
}


@media (max-width: 768px) {
    #createTournamentScreen .settings-card .settings-section-body .form-row {
        grid-template-columns: 1fr;
    }

    .create-tournament-actions {
        flex-direction: column-reverse;
    }

    .create-tournament-actions .btn,
    .create-tournament-actions .gsx-btn {
        width: 100%;
        text-align: center;
    }
}

/* ===== Edit Player Page ===== */
#editRosterPlayerScreen .dashboard-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--space-3);
    margin-bottom: var(--space-6);
}

#editRosterPlayerScreen .dashboard-header h1 {
    font-size: 1.5rem;
    margin: 0;
}

#editRosterPlayerScreen .container {
    padding-bottom: 6rem;
}

.edit-player-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-6) 0 var(--space-8);
}

/* Destructive "Remove from Roster" floats to the far left; the primary actions
   (Cancel / Add & Add Another / Save) stay right-justified — and in add mode,
   where Remove is hidden, the actions remain on the right. */
.edit-player-actions #epRemoveBtn {
    margin-right: auto;
}

/* Linked accounts cards */
.linked-account-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    padding: var(--space-3-5) var(--space-4);
    background: var(--surface-sunken);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-2-5);
}

.linked-account-info {
    flex: 1;
    min-width: 0;
}

.linked-account-label {
    font-size: 0.78rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    margin-bottom: var(--space-0-5);
}

.linked-account-detail {
    font-size: 0.88rem;
    color: var(--card-text);
    word-break: break-all;
}

.linked-account-code {
    font-family: var(--font-mono);
    font-size: 0.95rem;
    letter-spacing: 2px;
    color: var(--primary-light);
    user-select: all;
    padding: var(--space-1) var(--space-2);
    background: rgba(var(--gsx-brand-rgb), 0.08);
    border-radius: var(--radius-xs);
    border: 1px solid rgba(var(--gsx-brand-rgb), 0.15);
}

/* .linked-account-status* removed — now uses the canonical .gsx-pill
   (success/warning) primitive (W4 unification). */

.linked-account-actions {
    display: flex;
    gap: var(--space-1-5);
    flex-shrink: 0;
}

.linked-account-edit-row {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2-5) var(--space-4);
    background: rgba(var(--gsx-brand-rgb), 0.06);
    border: 1px solid rgba(var(--gsx-brand-rgb), 0.2);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-2-5);
}

.linked-account-edit-row .form-input {
    padding: var(--space-1-5) var(--space-2-5);
    border-radius: var(--radius-sm);
}

.linked-account-actions-bar {
    display: flex;
    gap: var(--space-2);
    flex-wrap: wrap;
    margin-bottom: var(--space-2-5);
    padding: 0 var(--space-1);
}

.linked-account-actions-bar .btn {
    font-size: 0.78rem;
    min-height: var(--gsx-control-height-sm);
    padding: 0 var(--space-2-5);
}

.linked-account-temp-pw {
    padding: var(--space-3) var(--space-4);
    background: var(--success-wash);
    border: 1px solid var(--success-wash-border);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-2-5);
}

.btn-warning {
    background: var(--warning-wash);
    color: var(--warning-ink);
    border: 1px solid var(--warning-wash-border);
}

.btn-warning:hover {
    background: var(--warning-wash);
    filter: brightness(1.1);
}

.btn-xs {
    font-size: 0.72rem;
    min-height: 1.6rem;
    padding: 0 var(--space-2);
    border-radius: var(--radius-md);
}

.linked-account-divider {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
    margin: var(--space-4) 0 var(--space-2) 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

[data-theme="light"] .linked-account-row {
    background: var(--raise-2);
}

[data-theme="light"] .linked-account-code {
    background: rgba(var(--gsx-brand-rgb), 0.06);
}

[data-theme="light"] .linked-account-edit-row {
    background: rgba(var(--gsx-brand-rgb), 0.04);
    border-color: rgba(var(--gsx-brand-rgb), 0.15);
}

[data-theme="light"] .linked-account-temp-pw {
    background: var(--success-wash);
    border-color: var(--success-wash-border);
}

[data-theme="light"] .btn-warning {
    background: var(--warning-wash);
    color: var(--warning-ink);
    border-color: var(--warning-wash-border);
}

[data-theme="light"] .btn-warning:hover {
    background: var(--warning-wash);
    filter: brightness(0.92);
}

@media (max-width: 768px) {
    #editRosterPlayerScreen .settings-card .settings-section-body .form-row {
        grid-template-columns: 1fr;
    }

    .edit-player-actions {
        flex-direction: column;
        gap: var(--space-4);
    }

    .edit-player-actions>div {
        display: flex;
        width: 100%;
        gap: var(--space-3);
    }

    .edit-player-actions .btn {
        flex: 1;
        text-align: center;
    }

    .linked-account-row {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-2);
    }

    .linked-account-edit-row {
        flex-direction: column;
        align-items: stretch;
    }

    .linked-account-actions-bar {
        flex-direction: column;
    }

    .linked-account-actions-bar .btn {
        width: 100%;
        text-align: center;
    }
}

/* ── Data Tables Mobile ── */
@media (max-width: 768px) {
    .dt-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .dt-toolbar-left,
    .dt-toolbar-right {
        width: 100%;
    }

    .dt-toolbar-right {
        overflow-x: auto;
        padding-bottom: var(--space-1);
    }

    .dt-search {
        width: 100%;
    }

    .dt-table {
        font-size: 0.78rem;
    }

    .dt-table th,
    .dt-table td {
        padding: var(--space-2) var(--space-2);
    }

    .dt-filters {
        overflow-x: auto;
        padding-bottom: var(--space-1);
        flex-wrap: nowrap !important;
    }

    .page-title-block h1 {
        font-size: 1.2rem;
    }
}

@media (max-width: 480px) {
    .dt-btn span {
        display: none;
    }

    .code-value {
        letter-spacing: 1px;
        font-size: 0.75rem;
    }

    .status-summary-row {
        grid-template-columns: 1fr 1fr;
    }
}

/* ── Profile Page ── */
.profile-hero {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: var(--space-3-5);
    background: var(--charcoal-light);
    border: 1px solid var(--charcoal-lighter);
    border-radius: var(--radius-3xl);
    padding: 0 var(--space-8) var(--space-7);
    margin-bottom: var(--space-6);
    overflow: hidden;
}

/* Cover banner behind the avatar (Squabbit-style). Deep gradient — the
   whitened accent gradient read "lime" on casual green (user report). */
.profile-hero-banner {
    position: absolute; inset: 0 0 auto 0; height: 96px;
    background: var(--gradient-accent-deep);
    background-size: 200% 200%;
    animation: profileHeroPan 14s var(--ease-standard) infinite alternate;
}
/* A player-uploaded cover photo replaces the gradient entirely. */
.profile-hero-banner.has-cover {
    background-size: cover;
    background-position: center;
    animation: none;
}
.profile-hero-banner.has-cover::after {
    /* Scrim so the QR/cover buttons and avatar ring stay legible on any photo. */
    content: ''; position: absolute; inset: 0;
    background: var(--scrim-soft);
}
@keyframes profileHeroPan {
    from { background-position: 0% 40%; }
    to { background-position: 100% 60%; }
}
@media (prefers-reduced-motion: reduce) {
    .profile-hero-banner { animation: none; }
}

.profile-avatar-wrap {
    position: relative;
    width: 104px;   /* exactly the avatar — keeps it centered + anchors the camera btn */
    margin-top: var(--space-10);
    z-index: 1;
}

.profile-avatar {
    width: 104px;
    height: 104px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    border: 4px solid var(--charcoal-light);
    box-shadow: var(--shadow-md);
}

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

.profile-avatar-letter {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--gsx-on-brand);
}

/* Camera button to change player photo */
.profile-photo-btn {
    position: absolute;
    right: -4px;
    bottom: 0;
    width: 40px;   /* match the cover/QR hero circles (was 34px — audit) */
    height: 40px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 3px solid var(--charcoal-light);
    background: var(--primary-color);
    color: var(--gsx-on-brand);
    cursor: pointer;
    transition: transform var(--motion-fast), background var(--motion-fast);
}

.profile-photo-btn:hover {
    transform: scale(1.08);
    background: var(--primary-light);
}

.profile-hero-info {
    width: 100%;
    min-width: 0;
    z-index: 1;
}

.profile-hero-info h1 {
    margin: 0 0 var(--space-2);
    font-size: 1.5rem;
    font-weight: 700;
}

.profile-hero-meta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-3);
    flex-wrap: wrap;
    margin-bottom: var(--space-1-5);
}

.profile-meta-item {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.profile-school-meta {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1-5);
}

.profile-school-meta img,
.profile-school-meta span > img {
    flex-shrink: 0;
}

.profile-auth-note-row {
    display: flex;
    align-items: center;
    gap: var(--space-2-5);
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.profile-auth-note-row svg {
    flex-shrink: 0;
}

.profile-auth-note-row strong {
    color: var(--text-primary);
    margin-right: var(--space-1-5);
}

.profile-hero-details {
    display: flex;
    justify-content: center;
    gap: var(--space-4);
    flex-wrap: wrap;
}

/* Player stat boxes (Best Round / Rounds Played) */
.profile-hero-stats {
    display: flex;
    gap: var(--space-3);
    width: 100%;
    max-width: 360px;
    margin-top: var(--space-1-5);
    z-index: 1;
}

.profile-stat-box {
    flex: 1;
    background: var(--raise-2);
    border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.12));
    border-radius: var(--radius-xl);
    padding: var(--space-3) var(--space-2);
}

.profile-stat-value {
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: 700;
    /* Theme-aware: the hero surface (--charcoal-light) flips light/dark, so the
       numerals must too. --on-scrim (always white) went invisible in light
       mode; reserve it for elements overlaid on the banner/scrim. */
    color: var(--gsx-text);
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
}

.profile-stat-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    margin-top: var(--space-1);
}

/* Home course row */
.profile-hero-course {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-0-5);
    z-index: 1;
}

.profile-hero-course-label {
    font-size: 0.66rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.profile-hero-course-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* Small QR share button — top-right corner of the profile hero (Squabbit-style) */
.profile-qr-btn {
    position: absolute;
    top: 0.85rem;
    right: 0.85rem;
    z-index: 2;
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-medium);
    background: var(--scrim-soft);
    color: var(--on-scrim);
    cursor: pointer;
    backdrop-filter: blur(4px);
    transition: transform var(--motion-fast), border-color var(--motion-fast), background var(--motion-fast);
}

.profile-cover-btn {
    position: absolute; top: 0.85rem; left: 0.85rem; z-index: 2;
    width: 40px; height: 40px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-medium);
    background: var(--scrim-soft);
    color: var(--on-scrim);
    cursor: pointer;
    backdrop-filter: blur(4px);
    transition: transform var(--motion-fast), border-color var(--motion-fast), background var(--motion-fast);
}
.profile-cover-btn:hover {
    transform: translateY(-1px);
    border-color: var(--on-scrim);
    background: var(--scrim);
}

.profile-qr-btn:hover {
    transform: translateY(-1px);
    border-color: var(--on-scrim);
    background: var(--scrim);
}

/* ── Coach Messages (player inbox items) ── */
.cmsg-item {
    padding: var(--space-3) var(--space-3-5);
    border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.1));
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-2-5);
    background: var(--raise-1);
}

.cmsg-item:last-child {
    margin-bottom: 0;
}

.cmsg-item.cmsg-unread {
    border-color: rgba(var(--gsx-brand-rgb), 0.45);
    background: rgba(var(--gsx-brand-rgb), 0.07);
}

.cmsg-head {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-1-5);
}

.cmsg-from {
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--text-primary);
}

.cmsg-tag {
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0 var(--space-1-5);
    border-radius: var(--radius-xs);
}

.cmsg-tag-team {
    background: var(--info-wash);
    color: var(--info-ink);
}

.cmsg-tag-direct {
    background: rgba(var(--gsx-brand-rgb), 0.2);
    color: var(--primary-light);
}

.cmsg-time {
    margin-left: auto;
    font-size: 0.72rem;
    color: var(--text-muted);
}

.cmsg-body {
    font-size: 0.88rem;
    line-height: 1.45;
    color: var(--text-secondary);
    white-space: pre-wrap;
    word-break: break-word;
}

.cmsg-radio {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1-5);
    font-size: 0.86rem;
    cursor: pointer;
}

.profile-card {
    background: var(--charcoal-light);
    border: 1px solid var(--charcoal-lighter);
    border-radius: var(--radius-xl);
    padding: var(--space-6) var(--space-8);
    margin-bottom: var(--space-6);
}

.profile-section-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0 0 var(--space-4);
    color: var(--gsx-brand);
}

.profile-section-subtitle {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: -0.5rem 0 1rem;
}

.profile-section-divider {
    border-top: 1px solid var(--charcoal-lighter);
    margin: var(--space-6) 0;
}

.form-row-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-4);
}

.form-readonly {
    background: var(--raise-2) !important;
    cursor: not-allowed;
    opacity: 0.65;
}

.profile-form-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-2);
    justify-content: flex-end;
    margin-top: var(--space-4);
    padding-top: var(--space-4);
    border-top: 1px solid var(--border-subtle);
}

@media (max-width: 600px) {
    .profile-hero {
        flex-direction: column;
        text-align: center;
        padding: var(--space-5);
    }

    .profile-hero-meta,
    .profile-hero-details {
        justify-content: center;
    }

    .profile-card {
        padding: var(--space-5);
    }

    .form-row-2col {
        grid-template-columns: 1fr;
    }
}

/* ============================================================================
   SCHOOL PICKER (Registration)
   ============================================================================ */
.school-picker-divider {
    text-align: center;
    margin: var(--space-4) 0 var(--space-3);
    border-top: 1px solid var(--charcoal-lighter);
    position: relative;
}

.school-picker-divider span {
    background: var(--bg-primary);
    padding: 0 var(--space-3);
    position: relative;
    top: -0.65rem;
    font-size: 0.8rem;
    color: var(--primary-light);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

#registerSchoolSearchGroup {
    position: relative;
}

.school-search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--charcoal-lighter);
    border-radius: var(--radius-md);
    max-height: 200px;
    overflow-y: auto;
    z-index: var(--z-sticky-bar);
    box-shadow: var(--shadow-md);
    display: none;
}

.school-result-item {
    padding: var(--space-2-5) var(--space-3);
    cursor: pointer;
    border-bottom: 1px solid var(--charcoal-lighter);
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: var(--space-1-5);
    font-size: 0.85rem;
}

.school-result-item:last-child {
    border-bottom: none;
}

.school-result-item:hover {
    background: rgba(var(--gsx-brand-rgb), 0.1);
}

.school-result-city {
    color: var(--text-muted);
    font-size: 0.78rem;
}

.school-result-conf {
    color: var(--primary-light);
    font-size: 0.72rem;
    background: rgba(var(--gsx-brand-rgb), 0.15);
    padding: 0 var(--space-1-5);
    border-radius: var(--radius-xs);
}

.school-selected {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    background: rgba(var(--gsx-brand-rgb), 0.12);
    border: 1px solid rgba(var(--gsx-brand-rgb), 0.3);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-md);
    margin-top: var(--space-2);
}

.school-selected-name {
    font-weight: 600;
    color: var(--primary-light);
}

.school-selected-city {
    color: var(--text-muted);
    font-size: 0.82rem;
}

.school-selected-clear {
    margin-left: auto;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0 var(--space-1);
    line-height: 1;
}

.school-selected-clear:hover {
    color: var(--danger-ink);
}

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

.btn-link:hover {
    color: var(--brand-ink);
}

/* ============================================================================
   USER MANAGEMENT — Google Admin Console Style
   ============================================================================ */
.um-shell {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    min-height: calc(100vh - 60px);
    transition: grid-template-columns var(--motion-base) var(--ease-standard);
}

.um-shell.sidebar-collapsed {
    grid-template-columns: 0px minmax(0, 1fr);
}

.um-shell.sidebar-collapsed .um-sidebar {
    transform: translateX(-260px);
    opacity: 0;
    pointer-events: none;
}

/* ── Sidebar ── */
.um-sidebar {
    background: var(--card-bg);
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
    transition: transform var(--motion-base) var(--ease-standard), opacity var(--motion-base) var(--ease-standard);
    position: sticky;
    top: 0;
    height: calc(100vh - 60px);
}

.um-sidebar-header {
    padding: var(--space-5) var(--space-5) var(--space-3);
}

.um-sidebar-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.um-nav {
    padding: 0 var(--space-2) var(--space-4);
}

.um-nav-item {
    display: flex;
    align-items: center;
    gap: var(--space-2-5);
    width: 100%;
    padding: var(--space-2) var(--space-3);
    border: none;
    background: none;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
    border-radius: 0 24px 24px 0;
    cursor: pointer;
    transition: background var(--motion-fast), color var(--motion-fast);
    text-align: left;
    position: relative;
}

.um-nav-item svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.um-nav-item:hover {
    background: var(--hover-bg);
    color: var(--text-primary);
}

.um-nav-item.active {
    background: rgba(var(--gsx-brand-rgb), 0.15);
    color: var(--primary-light);
    font-weight: 600;
}

.um-nav-item.active svg {
    stroke: var(--primary-light);
}

.um-nav-count {
    margin-left: auto;
    font-size: 0.75rem;
    font-weight: 600;
    background: var(--hover-bg);
    padding: 0 var(--space-2);
    border-radius: var(--radius-lg);
    color: var(--text-muted);
    min-width: 1.5rem;
    text-align: center;
}

.um-nav-item.active .um-nav-count {
    background: rgba(var(--gsx-brand-rgb), 0.25);
    color: var(--primary-light);
}

.um-nav-divider {
    height: 1px;
    background: var(--border-color);
    margin: var(--space-2) var(--space-3);
}

.um-nav-section-label {
    padding: var(--space-2) var(--space-3) var(--space-1);
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}

/* ── Main Content ── */
.um-content {
    padding: 0;
    display: flex;
    flex-direction: column;
    height: calc(100vh - 60px);
    overflow: hidden;
}

.um-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-3) var(--space-6);
    border-bottom: 1px solid var(--border-color);
    background: var(--card-bg);
    flex-shrink: 0;
    z-index: var(--z-sticky);
}

.um-toolbar-left {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.um-sidebar-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    padding: var(--space-1);
}

.um-sidebar-toggle svg {
    width: 20px;
    height: 20px;
}

.um-page-title {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
}

.um-total-count {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 400;
}

.um-toolbar-right {
    display: flex;
    gap: var(--space-2);
    align-items: center;
}

/* ── Bulk Action Bar ── */
.um-bulk-bar {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-2-5) var(--space-6);
    background: var(--primary-light);
    color: var(--gsx-on-brand);
    font-size: 0.85rem;
    font-weight: 600;
    flex-shrink: 0;
}

.um-bulk-count {
    white-space: nowrap;
}

.um-bulk-actions {
    display: flex;
    gap: var(--space-1-5);
}

.um-bulk-actions .btn {
    background: var(--scrim-soft);
    border-color: var(--surface-sunken);
    color: var(--gsx-on-brand);
    font-weight: 600;
}

.um-bulk-actions .btn:hover {
    background: var(--scrim-soft);
    filter: brightness(1.1);
}

.um-bulk-actions .btn-danger {
    background: var(--danger);
    color: var(--on-danger);
    border-color: var(--danger);
}

.um-bulk-close {
    margin-left: auto;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    color: var(--gsx-on-brand);
    opacity: 0.7;
    padding: 0 var(--space-1);
}

.um-bulk-close:hover {
    opacity: 1;
}

/* ── Search & Filters ── */
.um-filters {
    display: flex;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-6);
    flex-wrap: wrap;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.um-filter-actions {
    display: flex;
    gap: var(--space-2);
    align-items: center;
    margin-left: auto;
    flex-shrink: 0;
}

#umAddUserBtn {
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
    flex-shrink: 0;
    background: var(--primary-dark);
}

.um-search-box {
    position: relative;
    flex: 1;
    min-width: 200px;
    max-width: 360px;
}

.um-search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--text-muted);
    pointer-events: none;
}

.um-search-box input {
    width: 100%;
    padding: var(--space-2) var(--space-8) var(--space-2) var(--space-8);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.85rem;
    box-sizing: border-box;
}

.um-search-box input:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 2px rgba(var(--gsx-brand-rgb), 0.15);
}

.um-search-clear {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    color: var(--text-muted);
    padding: 0 var(--space-1);
    line-height: 1;
}

.um-filter-select {
    padding: var(--space-2) var(--space-2-5);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.82rem;
    cursor: pointer;
    min-width: 130px;
}

/* ── Typeable Organization Filter ── */
.um-org-filter-wrap {
    position: relative;
    min-width: 170px;
    max-width: 260px;
}

.um-org-filter-wrap input {
    width: 100%;
    box-sizing: border-box;
    padding-right: var(--space-7);
}

.um-org-filter-clear {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    color: var(--text-muted);
    padding: 0 var(--space-0-5);
    line-height: 1;
    z-index: 2;
}

.um-org-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    max-height: 260px;
    overflow-y: auto;
    z-index: var(--z-sticky-bar);
    box-shadow: var(--shadow-md);
}

.um-org-dropdown-item {
    padding: var(--space-2) var(--space-3);
    font-size: 0.82rem;
    cursor: pointer;
    color: var(--text-primary);
    transition: background var(--motion-instant);
}

.um-org-dropdown-item.um-org-option:hover,
.um-org-dropdown-item.um-org-option.active {
    background: rgba(var(--gsx-brand-rgb), 0.12);
}

.um-org-dropdown-item.um-org-empty {
    color: var(--text-muted);
    font-style: italic;
    cursor: default;
}

/* ── School Drill-down ── */
.um-school-detail-header {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-4) var(--space-6);
    border-bottom: 1px solid var(--border-color);
    background: var(--card-bg);
}

.um-school-detail-back {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: var(--space-1);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    transition: background var(--motion-fast), color var(--motion-fast);
}

.um-school-detail-back:hover {
    background: rgba(var(--gsx-brand-rgb), 0.1);
    color: var(--primary-light);
}

.um-school-detail-logo {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    object-fit: contain;
    background: var(--bg-secondary);
    padding: var(--space-1);
    flex-shrink: 0;
}

.um-school-detail-logo-placeholder {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-muted);
    flex-shrink: 0;
}

.um-school-detail-info {
    flex: 1;
    min-width: 0;
}

.um-school-detail-name {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.um-school-detail-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: var(--space-0-5);
}

.um-school-detail-actions {
    display: flex;
    gap: var(--space-2);
    flex-shrink: 0;
}

.um-school-detail-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border-color);
    padding: 0 var(--space-6);
    background: var(--card-bg);
}

.um-school-detail-tab {
    padding: var(--space-2-5) var(--space-5);
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: color var(--motion-fast), border-color var(--motion-fast);
}

.um-school-detail-tab:hover {
    color: var(--text-primary);
}

.um-school-detail-tab.active {
    color: var(--primary-light);
    border-bottom-color: var(--primary-light);
}

.um-school-edit-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: var(--space-3);
    padding: var(--space-4) var(--space-6);
}

.um-school-edit-field {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.um-school-edit-field label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.um-school-edit-field input,
.um-school-edit-field select {
    padding: var(--space-2) var(--space-2-5);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.85rem;
}

.um-school-edit-field input:focus,
.um-school-edit-field select:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 2px rgba(var(--gsx-brand-rgb), 0.15);
}

/* ── Table ── */
.um-table-wrap {
    flex: 1;
    overflow-y: auto;
    overflow-x: auto;
    padding-bottom: 110px;
}

.um-table-container {
    min-width: 700px;
}

.um-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.um-table thead th {
    padding: var(--space-1-5) var(--space-3);
    text-align: left;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
    background: var(--bg-primary);
    position: sticky;
    top: 0;
}

.um-table thead th:hover {
    color: var(--primary-light);
}

.um-table thead th.sort-active {
    color: var(--primary-light);
}

.um-table tbody td {
    padding: var(--space-1) var(--space-3);
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
    font-size: 0.82rem;
    line-height: 1.2;
}

.um-table tbody tr {
    transition: background var(--motion-instant);
}

.um-table tbody tr:hover {
    background: var(--hover-bg);
}

.um-table tbody tr.um-row-selected {
    background: rgba(var(--gsx-brand-rgb), 0.08);
}

.um-table .um-col-check {
    width: 40px;
    text-align: center;
}

.um-table .um-col-check input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--primary-light);
}

/* User cell with avatar */
.um-user-cell {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.um-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--on-success); /* white text on any colored fill avatar */
    flex-shrink: 0;
    text-transform: uppercase;
}

.um-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.um-user-name {
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.2;
    display: flex;
    align-items: center;
    gap: var(--space-1-5);
    flex-wrap: wrap;
}

.um-user-name .um-username-tag {
    font-weight: 400;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.roster-login-email {
    font-size: 0.72rem;
    color: var(--text-muted);
    line-height: 1.2;
    margin-top: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 220px;
}

.roster-login-email.none {
    color: var(--text-muted);
    opacity: 0.5;
    font-style: italic;
}

/* Compact mobile summary line (grade · team · avg) — desktop hides it, the
   full columns show instead. */
.roster-m-sub {
    display: none;
    font-size: 0.76rem;
    color: var(--text-muted);
    line-height: 1.3;
    margin-top: 1px;
}

/* ── Alumni list (graduated players archived by rollover) ── */
.alumni-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}
.alumni-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    flex-wrap: wrap;
    padding: var(--space-3) var(--space-3-5);
    background: var(--gsx-surface);
    border: 1px solid var(--gsx-border);
    border-radius: var(--gsx-radius-md);
}
.alumni-sub {
    font-size: 0.76rem;
    font-weight: 700;
    color: var(--brand-ink);
    letter-spacing: 0.02em;
}
.alumni-row-right {
    display: flex;
    align-items: center;
    gap: var(--space-2-5);
    flex-shrink: 0;
}

/* ── Roster on MOBILE: a dense, scannable list, not a stacked card. Each row =
   avatar + name + a 'grade · team · avg' line; tap the row → full player detail
   (which carries the stats, team, edit/remove). No horizontal scroll, ~12 per
   screen. Stat/team/action columns are hidden here — they live in the detail. */
@media (max-width: 768px) {
    .roster-table {
        display: block;
        width: 100%;
    }
    .roster-table thead {
        display: none;
    }
    .roster-table tbody {
        display: block;
    }
    .roster-table tbody tr {
        display: flex;
        align-items: center;
        gap: var(--space-3);
        padding: var(--space-2-5) var(--space-1);
        border-bottom: 1px solid var(--gsx-border);
    }
    .roster-table tbody td {
        border: 0;
        padding: 0;
    }
    /* only the name/avatar cell shows on mobile */
    .roster-table tbody td:not(.gsx-cell-head) {
        display: none;
    }
    .roster-table tbody td.gsx-cell-head {
        flex: 1 1 auto;
        min-width: 0;
    }
    /* email hidden on mobile to keep rows to two tight lines (name + summary) */
    .roster-table tbody .roster-login-email {
        display: none;
    }
    .roster-m-sub {
        display: block;
    }
    /* tap-affordance chevron */
    .roster-table tbody tr::after {
        content: '›';
        flex: 0 0 auto;
        color: var(--gsx-text-muted);
        font-size: 1.4rem;
        line-height: 1;
        padding-right: var(--space-1);
    }
}

/* ──────────────────────────────────────────────────
   Parent Code Max Uses
   ────────────────────────────────────────────────── */
.ac-max-uses-badge {
    display: inline-block;
    padding: var(--space-0-5) var(--space-2);
    border-radius: var(--radius-lg);
    font-size: 0.75rem;
    font-weight: 600;
    background: var(--bg-secondary, #1a1f2e);
    color: var(--text-secondary, #8892a4);
    border: 1px solid var(--border-color, #2a3040);
    white-space: nowrap;
}

.ac-max-uses-badge.ac-max-uses-full {
    background: var(--danger-wash);
    color: var(--danger-ink);
    border-color: var(--danger-wash-border);
}

.pd-max-uses-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-2) var(--space-3);
    border-top: 1px solid var(--border-color, #2a3040);
    gap: var(--space-3);
}

.pd-max-uses-control {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.pd-max-uses-select {
    padding: var(--space-0-5) var(--space-2);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color, #2a3040);
    background: var(--bg-secondary, #1a1f2e);
    color: var(--text-color, #e2e8f0);
    font-size: 0.8rem;
    cursor: pointer;
}

.pd-max-uses-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px var(--info-wash);
}

/* Light mode overrides */
body.light-mode .ac-max-uses-badge {
    background: var(--gray-light);
    color: var(--text-secondary);
    border-color: var(--gray);
}

body.light-mode .ac-max-uses-badge.ac-max-uses-full {
    background: var(--danger-wash);
    color: var(--danger-ink);
    border-color: var(--danger-wash-border);
}

body.light-mode .pd-max-uses-select {
    background: var(--surface-solid);
    color: var(--card-text);
    border-color: var(--gray);
}

body.light-mode .pd-max-uses-row {
    border-top-color: var(--gray);
}

/* Role badges */
.um-role-badge {
    display: inline-block;
    padding: var(--space-0-5) var(--space-2);
    border-radius: var(--radius-lg);
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: capitalize;
}

.um-role-admin {
    background: var(--danger-wash);
    color: var(--danger-ink);
}

.um-role-coach {
    background: var(--info-wash);
    color: var(--info-ink);
}

.um-role-tournament_director {
    background: rgba(168, 85, 247, 0.12); /* tokens-allow: tournament-director purple, no token */
    color: #a855f7; /* tokens-allow: tournament-director purple, no token */
}

.um-role-player {
    background: var(--success-wash);
    color: var(--success-ink);
}

.um-role-parent {
    background: var(--warning-wash);
    color: var(--warning-ink);
}

.um-role-pending {
    background: rgba(156, 163, 175, 0.12); /* tokens-allow: neutral gray badge */
    color: var(--text-muted);
}

.um-role-unassigned {
    background: rgba(249, 115, 22, 0.12); /* tokens-allow: orange unassigned, no token */
    color: #f97316; /* tokens-allow: orange unassigned, no token */
}

.um-role-viewer {
    background: rgba(107, 114, 128, 0.12); /* tokens-allow: gray viewer, no token */
    color: var(--text-secondary);
}

/* Status badges */
.um-status-active {
    color: var(--success-ink);
}

.um-status-disabled {
    color: var(--danger-ink);
}

/* 3-dot row actions */
.um-row-actions {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    justify-content: flex-end;
}

.um-action-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    transition: background var(--motion-fast);
}

.um-action-trigger:hover {
    background: var(--hover-bg);
    color: var(--text-primary);
}

.um-action-trigger svg {
    width: 18px;
    height: 18px;
}

/* Google badge */
.um-google-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #4285f4; /* tokens-allow: Google brand blue, not a design-system color */
    color: var(--on-info);
    font-size: 0.6rem;
    font-weight: 700;
    margin-left: var(--space-1);
    vertical-align: middle;
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .um-shell {
        grid-template-columns: 1fr;
    }

    .um-sidebar {
        display: none;
        position: fixed;
        top: 60px;
        left: 0;
        width: 260px;
        height: calc(100vh - 60px);
        z-index: var(--z-sidebar);
        box-shadow: var(--shadow-lg);
    }

    .um-shell.sidebar-open .um-sidebar {
        display: block;
    }

    .um-sidebar-toggle {
        display: flex;
    }

    .um-content {
        height: calc(100vh - 60px);
        min-height: auto;
    }

    .um-toolbar {
        position: relative;
    }

    .um-filters {
        flex-direction: column;
        align-items: stretch;
    }

    .um-filter-actions {
        margin-left: 0;
        justify-content: flex-end;
    }

    .um-search-box {
        max-width: none;
    }
}

/* ============================================================================
   ALL USERS TABLE - Tabs, Filters, Actions
   ============================================================================ */
.users-tabs {
    display: flex;
    gap: 0;
    margin-bottom: var(--space-4);
    border-bottom: 2px solid var(--charcoal-lighter);
}

.users-tab {
    padding: var(--space-2-5) var(--space-5);
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all var(--motion-base);
}

.users-tab:hover {
    color: var(--text-primary);
}

.users-tab.active {
    color: var(--primary-light);
    border-bottom-color: var(--primary-light);
}

.users-tab .tab-count {
    background: rgba(var(--gsx-brand-rgb), 0.15);
    color: var(--primary-light);
    padding: 0 var(--space-1-5);
    border-radius: var(--radius-lg);
    font-size: 0.72rem;
    margin-left: var(--space-1-5);
}

.users-filters {
    display: flex;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
    flex-wrap: wrap;
    align-items: center;
}

.users-filters input,
.users-filters select {
    padding: var(--space-2) var(--space-2-5);
    border: 1px solid var(--charcoal-lighter);
    border-radius: var(--radius-sm);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.82rem;
    height: 2.2rem;
    box-sizing: border-box;
}

.users-filters input {
    flex: 1;
    min-width: 180px;
    max-width: 280px;
}

.users-filters select {
    min-width: 120px;
    max-width: 200px;
    cursor: pointer;
    flex-shrink: 0;
}

.users-sort-header th {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

.users-sort-header th:hover {
    color: var(--primary-light);
}

.users-sort-header .sort-arrow {
    font-size: 0.7rem;
    margin-left: var(--space-0-5);
    opacity: 0.4;
}

.users-sort-header .sort-active .sort-arrow {
    opacity: 1;
    color: var(--primary-light);
}

/* User action buttons — consistent sizing */
.user-actions {
    display: flex;
    gap: var(--space-1-5);
    flex-wrap: nowrap;
    align-items: center;
}

.user-actions .btn {
    min-height: var(--gsx-control-height-sm);
    padding: 0 var(--space-2-5);
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
    min-width: auto;
}

/* ── 3-dot Overflow Menu (Google Admin Style) ── */
.overflow-menu-wrapper {
    position: relative;
    display: inline-block;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-1) var(--space-1-5);
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--text-secondary);
    transition: background var(--motion-fast), color var(--motion-fast);
}

.btn-icon:hover {
    background: var(--hover-bg);
    color: var(--text-primary);
}

.overflow-menu {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    z-index: var(--z-context-menu);
    min-width: 180px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    padding: var(--space-1) 0;
    margin-top: var(--space-1);
}

.overflow-menu.active {
    display: block;
}

.overflow-menu-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    width: 100%;
    padding: var(--space-2) var(--space-3-5);
    border: none;
    background: none;
    color: var(--text-primary);
    font-size: 0.82rem;
    cursor: pointer;
    text-align: left;
    transition: background var(--motion-instant);
    white-space: nowrap;
}

.overflow-menu-item:hover {
    background: var(--hover-bg);
}

.overflow-menu-item svg {
    flex-shrink: 0;
    opacity: 0.7;
}

.overflow-menu-danger {
    color: var(--danger-ink);
}

.overflow-menu-danger:hover {
    background: var(--danger-wash);
}

.overflow-menu-divider {
    height: 1px;
    background: var(--border-color);
    margin: var(--space-1) 0;
}

/* ============================================================================
   LOGIN TABS
   ============================================================================ */

.login-tabs {
    display: flex;
    gap: 0;
    margin: 0 0 var(--space-5);
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1.5px solid var(--border-color, #ddd);
}

.login-tab {
    flex: 1;
    padding: var(--space-2) var(--space-2);
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary, #777);
    transition: all var(--motion-base);
    position: relative;
}

.login-tab.active {
    background: var(--accent-color, var(--primary-color));
    color: var(--gsx-on-brand);
}

.login-tab:not(.active):hover {
    background: var(--hover-bg, rgba(0, 0, 0, 0.04));
}

.login-tab-content {
    display: none;
}

.login-tab-content.active {
    display: block;
}

/* ============================================================================
   PLAYER DASHBOARD STYLES
   ============================================================================ */

.player-scoring-summary {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.player-scoring-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-2) 0;
    border-bottom: 1px solid var(--border-color, #eee);
    font-size: 0.9rem;
}

.player-scoring-row:last-child {
    border-bottom: none;
}

.player-scoring-row span {
    color: var(--text-secondary, #777);
}

.player-scoring-row strong {
    font-size: 1.05rem;
    color: var(--text-primary);
}

/* Mini bar chart for score history */
.player-score-chart {
    display: flex;
    align-items: flex-end;
    gap: var(--space-1);
    height: 80px;
    margin-top: var(--space-4);
    padding-top: var(--space-2);
    border-top: 1px solid var(--border-color, #eee);
}

.player-score-bar {
    flex: 1;
    min-width: 20px;
    max-width: 40px;
    background: var(--accent-color, var(--primary-color));
    border-radius: var(--radius-xs) var(--radius-xs) 0 0;
    position: relative;
    opacity: 0.75;
    transition: opacity var(--motion-base);
}

.player-score-bar:hover {
    opacity: 1;
}

.player-score-bar:last-child {
    opacity: 1;
    background: var(--primary-color, #1a5632);
}

.player-score-bar span {
    position: absolute;
    top: -18px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--text-secondary);
    white-space: nowrap;
}

/* Practice round delete button */
.btn-icon-sm {
    background: none;
    border: none;
    cursor: pointer;
    padding: var(--space-1);
    border-radius: var(--radius-sm);
    color: var(--text-muted, #aaa);
    transition: color var(--motion-base), background var(--motion-base);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-icon-sm:hover {
    color: var(--danger-ink);
    background: var(--danger-wash);
}

/* Success message */
.success-message {
    color: var(--success-ink);
    font-size: 0.85rem;
    margin-top: var(--space-2);
    display: none;
}

.success-message.active {
    display: block;
}

/* ============================================================================
   PLAYER LOCK MODAL
   ============================================================================ */

.player-lock-modal {
    z-index: var(--z-modal);
}

.player-lock-content {
    max-width: 420px !important;
    text-align: center;
    padding: var(--space-8) var(--space-6) !important;
    border-radius: var(--radius-3xl) !important;
    animation: playerLockSlideUp 0.4s ease-out;
}

@keyframes playerLockSlideUp {
    from {
        transform: translateY(40px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.player-lock-icon {
    margin-bottom: var(--space-4);
    animation: playerLockPulse 2s ease-in-out infinite;
}

@keyframes playerLockPulse {

    0%,
    100% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.08);
        opacity: 0.85;
    }
}

.player-lock-title {
    font-size: 1.6rem;
    font-weight: 800;
    margin: 0 0 var(--space-1) 0;
    color: var(--text-primary);
}

.player-lock-subtitle {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin: 0 0 var(--space-6) 0;
}

.player-lock-details {
    background: var(--card-bg, #1a1a2e);
    border: 1px solid var(--border-color, #333);
    border-radius: var(--radius-xl);
    padding: var(--space-5);
    margin-bottom: var(--space-6);
}

.player-lock-tournament-name {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--space-1);
}

.player-lock-course {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: var(--space-2);
}

.player-lock-score {
    font-size: 0.95rem;
    color: var(--text-primary);
    margin-top: var(--space-2);
    padding-top: var(--space-2);
    border-top: 1px solid var(--border-color, #333);
}

.player-lock-go-btn {
    width: 100%;
    padding: var(--space-4) !important;
    font-size: 1.1rem !important;
    font-weight: 700;
    border-radius: var(--radius-xl) !important;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-1-5);
    animation: playerLockGlow 2s ease-in-out infinite;
}

@keyframes playerLockGlow {

    0%,
    100% {
        box-shadow: 0 2px 8px rgba(var(--gsx-success-rgb), 0.3);
    }

    50% {
        box-shadow: 0 4px 20px rgba(var(--gsx-success-rgb), 0.6);
    }
}

/* Multi-tournament picker */
.player-lock-tournament-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    margin-top: var(--space-4);
}

.player-lock-tournament-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4) var(--space-5);
    background: var(--card-bg, #1a1a2e);
    border: 1px solid var(--border-color, #333);
    border-radius: var(--radius-xl);
    cursor: pointer;
    transition: all var(--motion-base) var(--ease-standard);
    text-align: left;
    color: var(--text-primary);
    font-family: inherit;
    font-size: inherit;
}

.player-lock-tournament-option:hover {
    border-color: var(--primary-color);
    background: var(--hover-bg, #222244);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* ── Login page PWA install link ── */
.login-pwa-install {
    text-align: center;
    margin-top: var(--space-4);
}

.login-pwa-install a {
    color: var(--text-secondary);
    font-size: 0.82rem;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: var(--space-1-5);
    opacity: 0.75;
    transition: opacity var(--motion-base), color var(--motion-base);
}

.login-pwa-install a:hover {
    opacity: 1;
    color: var(--brand-ink);
}

.login-pwa-install a svg {
    stroke: currentColor;
    flex-shrink: 0;
}

/* ============================================================================
   PWA INSTALL BANNER
   ============================================================================ */

.pwa-install-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--charcoal-light);
    border-top: 2px solid var(--accent-color, var(--primary-color));
    padding: var(--space-3) var(--space-4);
    padding-bottom: calc(0.75rem + env(safe-area-inset-bottom, 0px));
    z-index: var(--z-context-menu);
    transform: translateY(100%);
    transition: transform var(--motion-slow) var(--ease-standard);
}

.pwa-install-banner.visible {
    transform: translateY(0);
}

.pwa-install-content {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    max-width: 600px;
    margin: 0 auto;
}

.pwa-install-icon {
    flex-shrink: 0;
}

.pwa-install-text {
    flex: 1;
    font-size: 0.82rem;
    line-height: 1.4;
}

.pwa-install-text strong {
    display: block;
    color: var(--brand-ink);
    font-size: 0.9rem;
}

.pwa-install-text span {
    color: var(--text-muted, #888);
}

.pwa-install-actions {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-shrink: 0;
}

.pwa-install-btn {
    white-space: nowrap;
    border-radius: var(--radius-md) !important;
    padding: var(--space-2) var(--space-4) !important;
    font-size: 0.82rem !important;
}

.pwa-install-dismiss {
    background: none;
    border: none;
    color: var(--text-muted, #888);
    font-size: 1.4rem;
    cursor: pointer;
    padding: 0 var(--space-1);
    line-height: 1;
    transition: color var(--motion-base);
}

.pwa-install-dismiss:hover {
    color: var(--text-primary, #e8e8e8);
}

[data-theme="light"] .pwa-install-banner {
    background: var(--surface-solid);
    border-top-color: var(--primary-color);
    box-shadow: var(--shadow-sm);
}

/* ============================================================
   LIVE DASHBOARD (Director/Manager Live Monitoring)
   Ported from scorecard.html for Dashboard Unification (v104)
   ============================================================ */

/* Live tab button pulsing dot */
.live-dot-indicator {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--gray-dark);
    display: inline-block;
    box-shadow: none;
    animation: none;
}

.live-dot-indicator.is-live {
    background: var(--birdie);
    animation: pulse-dot 2s infinite;
    box-shadow: 0 0 6px rgba(var(--gsx-success-rgb), 0.5);
}

@keyframes pulse-dot {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.3;
    }
}

/* ── Rulings Tab ── */
.rulings-section {
    margin-bottom: var(--space-5);
}

.rulings-section-title {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 var(--space-3);
    padding-bottom: var(--space-2);
    border-bottom: 1px solid var(--border-color);
}

.rulings-count {
    background: var(--primary);
    color: var(--gsx-on-brand);
    font-size: 0.65rem;
    font-weight: 700;
    padding: 0 var(--space-1-5);
    border-radius: var(--radius-lg);
    min-width: 18px;
    text-align: center;
}

.rulings-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.rulings-empty {
    text-align: center;
    padding: var(--space-6);
    color: var(--text-muted);
    font-size: 0.8rem;
    font-style: italic;
}

/* Ruling cards */
.ruling-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--space-3) var(--space-3-5);
    transition: border-color var(--motion-base);
}

.ruling-card:hover {
    border-color: var(--primary);
}

.ruling-card-help {
    border-left: 3px solid var(--gold);
}

.ruling-card-penalty {
    border-left: 3px solid var(--double);
}

.ruling-card-warning {
    border-left: 3px solid var(--gold);
}

.ruling-card-ruling {
    border-left: 3px solid var(--primary);
}

.ruling-card-relief {
    border-left: 3px solid var(--success);
}

.ruling-card-disqualification {
    border-left: 3px solid var(--double);
}

.ruling-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-1-5);
}

.ruling-card-badges {
    display: flex;
    gap: var(--space-1);
    flex-wrap: wrap;
}

.ruling-badge {
    font-size: 0.65rem;
    font-weight: 600;
    padding: var(--space-0-5) var(--space-2);
    border-radius: var(--radius-sm);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ruling-badge-help {
    background: rgba(var(--gsx-brand-rgb), 0.15);
    color: var(--brand-ink);
    border: 1px solid rgba(var(--gsx-brand-rgb), 0.3);
}

.ruling-badge-target {
    background: var(--raise-2);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
}

.ruling-badge-penalty {
    background: var(--danger-wash);
    color: var(--double-ink);
    border: 1px solid var(--danger-wash-border);
}

.ruling-badge-revoked {
    background: var(--raise-2);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
    text-decoration: line-through;
}

.ruling-badge-resolved {
    background: var(--success-wash);
    color: var(--success-ink);
    border: 1px solid var(--success-wash-border);
}

.ruling-card-time {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.ruling-card-player {
    display: flex;
    align-items: baseline;
    gap: var(--space-1-5);
    margin-bottom: var(--space-1);
}

.ruling-card-player strong {
    font-size: 0.82rem;
}

.ruling-card-school {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.ruling-card-detail {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: var(--space-1);
}

.ruling-card-description {
    font-size: 0.78rem;
    color: var(--text-secondary, var(--text-primary));
    line-height: 1.4;
    margin-bottom: var(--space-1-5);
}

.ruling-card-issuer {
    font-size: 0.68rem;
    color: var(--text-muted);
    font-style: italic;
    margin-bottom: var(--space-1-5);
}

.ruling-card-actions {
    display: flex;
    gap: var(--space-1-5);
    margin-top: var(--space-1);
}

.ruling-card-actions .btn {
    font-size: 0.78rem;
    min-height: var(--gsx-control-height-sm);
    padding: 0 var(--space-2-5);
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
}

/* Create Ruling Modal */
#createRulingModal {
    position: fixed;
    inset: 0;
    z-index: var(--z-modal);
    background: var(--scrim);
    display: flex;
    align-items: center;
    justify-content: center;
}

#createRulingModal .modal-content {
    background: var(--bg-primary);
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-xl);
    width: 90%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
}

#createRulingModal .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
}

#createRulingModal .modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-2);
    border-top: 1px solid var(--border-color);
}

.live-tab-wrapper {
    padding: 0 var(--space-2) var(--space-4);
    font-size: 0.78rem;
    position: relative;
    --eagle: #3498db;   /* tokens-allow: local score-chip blue, brighter than --eagle */
}

/* Live refresh indicator */
.live-refresh-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-1-5) var(--space-1);
    margin-bottom: var(--space-1);
    font-size: 0.72rem;
    color: var(--text-muted);
}

.live-refresh-bar .live-refresh-indicator {
    font-size: 0.72rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: var(--space-1);
}

.live-refresh-btn {
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    padding: var(--space-1) var(--space-2-5);
    border-radius: var(--radius-sm);
    font-size: 0.72rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: var(--space-1);
    transition: all var(--motion-fast);
}

.live-refresh-btn:hover {
    border-color: var(--primary-color);
    color: var(--brand-ink);
}

/* Admin SSE Panel */
.admin-sse-panel {
    background: var(--card-bg);
    border: 1px solid var(--gold);
    border-radius: var(--radius-md);
    margin: 0 var(--space-1) var(--space-2);
    overflow: hidden;
    animation: slideDown 0.2s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
        transform: translateY(-8px);
    }

    to {
        opacity: 1;
        max-height: 400px;
        transform: translateY(0);
    }
}

.admin-sse-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-2) var(--space-3);
    background: var(--gold);
    color: var(--gsx-on-brand);
    font-size: 0.8rem;
    gap: var(--space-2);
}

.admin-sse-panel-header span {
    color: var(--on-neutral);
}

.admin-sse-panel-header button {
    color: var(--on-neutral);
}

.admin-sse-panel-body {
    padding: var(--space-2-5) var(--space-3);
}

.admin-sse-targets {
    display: flex;
    gap: var(--space-1-5);
    flex-wrap: wrap;
}

.admin-sse-target-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-1-5) var(--space-3);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg);
    color: var(--text);
    font-size: 0.75rem;
    cursor: pointer;
    transition: all var(--motion-fast);
}

.admin-sse-target-btn:hover {
    border-color: var(--primary);
    background: var(--primary);
    color: var(--gsx-on-brand);
}

.admin-sse-target-btn:active {
    transform: scale(0.97);
}

.admin-sse-target-btn.sending {
    opacity: 0.6;
    pointer-events: none;
}

/* Header bar (tournament info sub-bar) */
.live-dash-header {
    display: flex;
    align-items: center;
    padding: var(--space-2) var(--space-3);
    gap: var(--space-2);
    border-bottom: 1px solid var(--border-color);
    margin-bottom: var(--space-2);
}

.live-dash-title {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--brand-ink);
    letter-spacing: -0.3px;
}

.live-dash-subtitle {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: var(--space-0-5);
}

/* Alert strip — scrollable horizontal pills */
.live-alert-strip {
    display: flex;
    gap: var(--space-1-5);
    padding: 0 var(--space-0-5) var(--space-2);
    overflow-x: auto;
    margin-top: var(--space-1-5);
    -webkit-overflow-scrolling: touch;
}

.live-alert-badge {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-1-5) var(--space-3);
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 700;
    white-space: nowrap;
    flex-shrink: 0;
    cursor: pointer;
    transition: transform var(--motion-instant);
}

.live-alert-badge:active {
    transform: scale(0.95);
}

.live-alert-badge.alert-danger {
    background: var(--danger-wash);
    color: var(--danger-ink);
    border: 1px solid var(--danger-wash-border);
}

.live-alert-badge.alert-warning {
    background: var(--warning-wash);
    color: var(--warning-ink);
    border: 1px solid var(--warning-wash-border);
}

.live-alert-badge.alert-info {
    background: var(--info-wash);
    color: var(--info-ink);
    border: 1px solid var(--info-wash-border);
}

.live-alert-badge.alert-ok {
    background: var(--success-wash);
    color: var(--birdie-ink);
    border: 1px solid var(--success-wash-border);
}

.live-alert-badge svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.live-alert-badge .count {
    font-size: 0.9rem;
    font-weight: 800;
}

/* Stats row — 5 compact cards */
.live-stats-row {
    display: grid;
    /* Column count is set by JS (--stat-count) to match the actual number of
       cards, so the row fills evenly with no orphaned card. minmax(0, 1fr)
       lets cards shrink to fit instead of overflowing/clipping the row. */
    grid-template-columns: repeat(var(--stat-count, 5), minmax(0, 1fr));
    gap: var(--space-2);
    padding: 0 var(--space-0-5) var(--space-2-5);
}

.live-stat-card {
    background: var(--charcoal-light);
    border-radius: var(--radius-lg);
    padding: var(--space-2-5) var(--space-1-5);
    text-align: center;
    border: 1px solid var(--border-subtle);
    cursor: pointer;
    transition: all var(--motion-fast);
    user-select: none;
}

.live-stat-card:active {
    transform: scale(0.96);
}

.live-stat-card.active-filter {
    border-color: var(--primary-color);
    background: rgba(var(--gsx-brand-rgb), 0.15);
    box-shadow: 0 0 8px rgba(var(--gsx-brand-rgb), 0.2);
}

/* Alert stat cards — behind-pace (amber) and DQ/DNF (red) read distinctly so a
   director can spot trouble at a glance. */
.live-stat-card.pace .live-stat-val {
    color: var(--warning-ink);
}

.live-stat-card.pace.active-filter {
    border-color: var(--warning);
    background: var(--warning-wash);
    box-shadow: 0 0 8px rgba(var(--gsx-warning-rgb), 0.18);
}

.live-stat-card.inactive .live-stat-val {
    color: var(--danger-ink);
}

.live-stat-card.inactive.active-filter {
    border-color: var(--danger);
    background: var(--danger-wash);
    box-shadow: 0 0 8px rgba(var(--gsx-danger-rgb), 0.18);
}

.live-stat-val {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--brand-ink);
    line-height: 1;
}

.live-stat-label {
    font-size: 0.58rem;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-muted);
    margin-top: var(--space-1);
    font-weight: 600;
}

/* Tab bar */
.live-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border-color);
    margin: 0 var(--space-0-5) var(--space-1-5);
    overflow-x: auto;
    background: var(--charcoal-light);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.live-tabs::-webkit-scrollbar {
    display: none;
}

.live-tab {
    padding: var(--space-2-5) var(--space-4);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    color: var(--text-muted);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color var(--motion-fast), border-color var(--motion-fast);
}

.live-tab:hover {
    color: var(--text);
    background: var(--raise-2);
}

.live-tab.active {
    color: var(--brand-ink);
    border-bottom-color: var(--primary-color);
    background: rgba(var(--gsx-brand-rgb), 0.1);
}

[data-theme="light"] .live-tabs {
    background: var(--gray-light);
}

[data-theme="light"] .live-tab:hover {
    background: var(--raise-2);
}

[data-theme="light"] .live-tab.active {
    background: rgba(var(--gsx-brand-rgb), 0.12);
}

.live-tab .tab-count,
.tab-btn .tab-count {
    background: var(--danger);
    color: var(--on-danger);
    font-size: 0.6rem;
    padding: var(--space-0-5) var(--space-1-5);
    border-radius: var(--radius-lg);
    margin-left: var(--space-1);
    font-weight: 700;
    display: inline-block;
    min-width: 18px;
    text-align: center;
}

/* ── Leaderboard — Spectator-style (mobile compact + desktop full) ── */

/* Filter bar */
.live-filter-bar {
    display: flex;
    gap: var(--space-2);
    padding: 0 var(--space-0-5) var(--space-2);
    align-items: center;
}

.live-filter-bar input {
    flex: 1;
    background: var(--charcoal-lighter);
    color: var(--text);
    border: 1px solid var(--border-color);
    padding: var(--space-1-5) var(--space-2-5);
    border-radius: var(--radius-md);
    font-size: 0.8rem;
}

.live-filter-bar input::placeholder {
    color: var(--text-muted);
}

.live-filter-bar select {
    background: var(--charcoal-lighter);
    color: var(--text);
    border: 1px solid var(--border-color);
    padding: var(--space-1-5) var(--space-2-5);
    border-radius: var(--radius-md);
    font-size: 0.8rem;
    min-width: 120px;
}

[data-theme="light"] .live-filter-bar input,
[data-theme="light"] .live-filter-bar select {
    background: var(--surface-solid);
    color: var(--text-primary);
    border-color: var(--surface-sunken);
}

/* Legend */
.live-legend {
    display: flex;
    justify-content: center;
    gap: var(--space-2-5);
    padding: 0 var(--space-0-5) var(--space-2);
    flex-wrap: wrap;
}

.live-legend-item {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    font-size: 0.65rem;
    color: var(--text-muted);
}

.live-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

/* Score chip — colored circle (desktop) */
.live-sc-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    font-weight: 700;
    font-size: 0.75rem;
    line-height: 1;
    cursor: pointer;
    transition: transform var(--motion-instant);
}

.live-sc-chip:hover {
    transform: scale(1.2);
}

.live-sc-chip:active {
    transform: scale(0.95);
}

.live-sc-chip.eagle {
    background: var(--eagle);
    color: var(--on-info);
}

.live-sc-chip.birdie {
    background: var(--birdie);
    color: var(--on-success);
}

.live-sc-chip.par {
    background: transparent;
    color: var(--text);
}

.live-sc-chip.bogey {
    background: var(--bogey);
    color: var(--on-warning);
}

.live-sc-chip.double {
    background: var(--double);
    color: var(--on-danger);
}

.live-sc-chip.empty {
    color: var(--text-muted);
    background: transparent;
    cursor: pointer;
}

.live-sc-chip.locked {
    box-shadow: 0 0 0 2px var(--gold);
}

/* Direct message icon on player row */
.live-msg-icon {
    cursor: pointer;
    opacity: 0.4;
    font-size: 0.7rem;
    margin-left: var(--space-1);
    transition: opacity var(--motion-fast);
}

.live-msg-icon:hover {
    opacity: 1;
}

/* Nine-hole subtotal */
.live-nine-total {
    font-weight: 800;
    color: var(--brand-ink);
    font-size: 0.82rem;
}

/* ── Desktop Full Scorecard Table ── */
.live-desktop-scorecard {
    display: none;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    background: var(--card-bg);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-subtle);
    padding: var(--space-0-5);
}

[data-theme="light"] .live-desktop-scorecard {
    background: var(--card-bg);
}

/* Shared leaderboard wrapper (js/shared/leaderboard-view.js) — renders both the
   desktop full scorecard and the mobile compact table into one container and
   toggles which shows by breakpoint. Reuses the .live-full-sc / .live-compact-lb
   styling below so Host looks identical to School's tournament dashboard. */
.gsx-lb-desktop { display: block; overflow-x: auto; }
.gsx-lb-compact { display: none; }
.gsx-lb-empty { padding: 20px; text-align: center; color: var(--text-muted); }
@media (max-width: 768px) {
    .gsx-lb-desktop { display: none; }
    .gsx-lb-compact { display: block; }
}

.live-full-sc {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.78rem;
    table-layout: fixed;
}

.live-full-sc th,
.live-full-sc td {
    padding: var(--space-1-5) var(--space-1);
    text-align: center;
    border-bottom: 1px solid var(--border-subtle);
    white-space: nowrap;
}

.live-full-sc .col-pos {
    width: 32px;
}

.live-full-sc .col-name {
    width: 160px;
    text-align: left;
}

.live-full-sc .col-hole {
    width: 30px;
    min-width: 28px;
}

.live-full-sc .col-out,
.live-full-sc .col-in {
    width: 34px;
}

.live-full-sc .col-tot {
    width: 38px;
}

.live-full-sc .col-topar {
    width: 42px;
}

.live-full-sc .col-thru {
    width: 36px;
}

.live-full-sc thead {
    position: sticky;
    top: 0;
    z-index: var(--z-sticky-nav);
}

.live-full-sc thead th {
    background: var(--charcoal-light);
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--text-muted);
    font-weight: 600;
}

.live-full-sc .par-header-row th {
    background: var(--charcoal-lighter);
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 500;
    border-bottom: 2px solid var(--gold);
}

.live-full-sc tbody tr {
    transition: background var(--motion-fast);
}

.live-full-sc tbody tr:hover {
    background: rgba(var(--gsx-brand-rgb), 0.08);
}

.live-full-sc tbody tr:nth-child(even) {
    background: var(--raise-1);
}

.live-full-sc tbody tr:nth-child(even):hover {
    background: rgba(var(--gsx-brand-rgb), 0.08);
}

.live-full-sc .player-cell {
    text-align: left;
    padding-left: var(--space-1-5);
}

.live-full-sc .player-cell .p-name {
    font-weight: 600;
    font-size: 0.8rem;
    overflow: hidden;
    text-overflow: ellipsis;
}

.live-full-sc .player-cell .p-school {
    font-size: 0.6rem;
    color: var(--text-muted);
}

.live-full-sc .rank-cell {
    font-weight: 700;
    color: var(--brand-ink);
    text-align: center;
}

.live-full-sc .total-cell {
    font-weight: 800;
    font-size: 0.88rem;
}

.live-full-sc .topar-cell {
    font-weight: 700;
    font-size: 0.85rem;
}

.live-full-sc .topar-cell.over {
    color: var(--bogey-ink);
}

.live-full-sc .topar-cell.under {
    color: var(--birdie-ink);
}

.live-full-sc .topar-cell.even {
    color: var(--text);
}

/* School logo badges (director) */
.live-school-badge {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.55rem;
    color: var(--gsx-on-brand);
    text-transform: uppercase;
}

.live-player-info {
    display: flex;
    align-items: center;
    gap: var(--space-1-5);
}

.live-player-info img.live-school-badge {
    object-fit: contain;
    background: var(--hover-bg);
    padding: var(--space-0-5);
}

[data-theme="light"] .live-full-sc thead th {
    background: var(--gray-light);
}

[data-theme="light"] .live-full-sc .par-header-row th {
    background: var(--gray);
}

[data-theme="light"] .live-full-sc tbody tr:nth-child(even) {
    background: var(--raise-1);
}

[data-theme="light"] .live-full-sc tbody tr:hover {
    background: rgba(var(--gsx-brand-rgb), 0.08);
}

/* ── Mobile Compact Leaderboard ── */
.live-mobile-leaderboard {
    display: block;
    background: var(--card-bg);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-subtle);
    overflow: hidden;
}

[data-theme="light"] .live-mobile-leaderboard {
    background: var(--card-bg);
}

.live-compact-lb {
    width: 100%;
    border-collapse: collapse;
}

.live-compact-lb th {
    background: var(--charcoal-light);
    padding: var(--space-2-5) var(--space-2);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    font-weight: 600;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.live-compact-lb th.center {
    text-align: center;
}

.live-compact-lb td {
    padding: var(--space-2-5) var(--space-2);
    font-size: 0.85rem;
    border-bottom: 1px solid var(--border-subtle);
    vertical-align: middle;
}

.live-compact-lb tbody tr {
    transition: background var(--motion-fast);
    cursor: pointer;
}

.live-compact-lb tbody tr:hover {
    background: rgba(var(--gsx-brand-rgb), 0.08);
}

.live-compact-lb tbody tr:nth-child(even) {
    background: var(--raise-1);
}

.live-compact-lb .rank-cell {
    font-weight: 700;
    color: var(--brand-ink);
    width: 35px;
    text-align: center;
}

/* ─── Sortable Headers (live-compact-lb) ─── */
.live-compact-lb th.sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
    padding-right: var(--space-4);
    transition: color var(--motion-fast);
}

.live-compact-lb th.sortable:hover {
    color: var(--brand-ink);
}

.live-compact-lb th.sortable::after {
    content: '⇅';
    position: absolute;
    right: 0.2rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.6rem;
    opacity: 0.35;
    transition: opacity var(--motion-fast);
}

.live-compact-lb th.sortable.sort-active::after {
    opacity: 0.9;
    color: var(--brand-ink);
}

.live-compact-lb th.sortable.sort-asc::after {
    content: '▲';
}

.live-compact-lb th.sortable.sort-desc::after {
    content: '▼';
}

.live-compact-lb .to-par {
    font-weight: 700;
    font-size: 0.95rem;
    text-align: center;
}

.live-compact-lb .to-par.under {
    color: var(--birdie-ink);
}

.live-compact-lb .to-par.over {
    color: var(--bogey-ink);
}

.live-compact-lb .to-par.even {
    color: var(--text);
}

.live-compact-lb .thru-cell {
    color: var(--text-muted);
    font-size: 0.8rem;
    text-align: center;
}

.live-compact-lb .score-cell {
    font-weight: 600;
    text-align: center;
}

.live-compact-lb .live-player-info .p-name {
    font-weight: 600;
}

.live-compact-lb .live-player-info .p-school {
    font-size: 0.7rem;
    color: var(--text-muted);
}

[data-theme="light"] .live-compact-lb th {
    background: var(--gray-light);
}

[data-theme="light"] .live-compact-lb tbody tr:nth-child(even) {
    background: var(--raise-1);
}

/* Compact row expand (mobile hole scores) */
.live-compact-expand {
    display: none;
}

.live-compact-expand.open {
    display: table-row;
}

.live-compact-expand td {
    padding: var(--space-1) var(--space-2) var(--space-2-5);
    background: rgba(var(--gsx-brand-rgb), 0.05);
    border-bottom: 2px solid var(--gold);
}

.live-compact-holes {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-0-5);
    align-items: center;
    justify-content: center;
}

.live-compact-break {
    flex-basis: 100%;
    height: 2px;
}

.live-compact-holes .hole-label {
    font-size: 0.55rem;
    color: var(--text-muted);
    text-align: center;
    min-width: 26px;
}

.live-compact-holes .hole-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
}

.live-compact-holes .live-sc-chip {
    width: 26px;
    height: 26px;
    font-size: 0.72rem;
}

.live-compact-nine-label {
    font-size: 0.6rem;
    font-weight: 700;
    color: var(--text-muted);
    padding: 0 var(--space-1);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
}

.live-compact-nine-label .nine-val {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text);
}

.live-compact-summary {
    margin-top: var(--space-1);
}

[data-theme="light"] .live-compact-expand td {
    background: rgba(var(--gsx-brand-rgb), 0.08);
}

.live-compact-lb tbody tr.expanded {
    background: rgba(var(--gsx-brand-rgb), 0.1);
}

/* ── Director Action Bar (visible on all sizes) ── */
.live-action-bar {
    display: flex;
    position: fixed;
    bottom: 36px;
    left: 0;
    right: 0;
    background: var(--charcoal-light);
    border-top: 2px solid var(--gold);
    padding: var(--space-2) var(--space-2-5);
    z-index: var(--z-context-menu);
    gap: var(--space-1-5);
    justify-content: center;
    align-items: center;
}

.live-action-bar .live-act-btn {
    flex: 1;
    max-width: 140px;
    padding: var(--space-2-5) var(--space-1-5);
    border-radius: var(--radius-lg);
    font-size: 0.72rem;
    font-weight: 700;
    text-align: center;
    border: 2px solid var(--border-color);
    background: var(--charcoal);
    color: var(--text);
    cursor: pointer;
    transition: all var(--motion-fast);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-0-5);
    -webkit-tap-highlight-color: transparent;
}

.live-act-btn:active {
    transform: scale(0.95);
    opacity: 0.8;
}

.live-act-btn .act-icon {
    font-size: 1.1rem;
    line-height: 1;
}

.live-act-btn.act-live {
    border-color: var(--birdie);
    background: var(--success-wash);
    color: var(--birdie-ink);
}

.live-act-btn.act-live.is-live {
    border-color: var(--double);
    background: var(--danger-wash);
    color: var(--double-ink);
}

.live-act-btn.act-suspend {
    border-color: var(--warning);
    background: var(--warning-wash);
    color: var(--warning-ink);
}

.live-act-btn.act-complete {
    border-color: var(--primary-color);
    background: rgba(var(--gsx-brand-rgb), 0.08);
    color: var(--brand-ink);
}

[data-theme="light"] .live-act-btn {
    background: var(--surface-solid);
}

[data-theme="light"] .live-action-bar {
    background: var(--gray-light);
}

/* Add bottom padding when action bar visible */
.live-tab-wrapper {
    padding-bottom: 130px;
}

/* Responsive: >=768px → desktop, <768px → mobile */
@media (min-width: 768px) {
    .live-desktop-scorecard {
        display: block;
    }

    .live-mobile-leaderboard {
        display: none;
    }
}

@media (max-width: 767px) {
    .live-desktop-scorecard {
        display: none !important;
    }

    .live-mobile-leaderboard {
        display: block;
    }
}

/* Pace indicator dots */
.pace-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: var(--space-0-5);
    vertical-align: middle;
}

.pace-ok {
    background: var(--birdie);
    box-shadow: 0 0 4px rgba(var(--gsx-success-rgb), 0.4);
}

.pace-slow {
    background: var(--bogey);
    box-shadow: 0 0 4px rgba(var(--gsx-warning-rgb), 0.4);
}

.pace-behind {
    background: var(--double);
    box-shadow: 0 0 4px rgba(var(--gsx-danger-rgb), 0.4);
}

/* ── Director Dashboard Mobile Responsive ── */
@media (max-width: 600px) {
    .live-dash-header {
        gap: var(--space-1);
        padding: var(--space-1-5) var(--space-2);
    }

    .live-dash-title {
        font-size: 0.95rem;
    }

    .live-dash-subtitle {
        font-size: 0.62rem;
    }

    .live-stats-row {
        /* On narrow screens, wrap into balanced rows instead of cramming every
           card onto one line (overrides the JS-set --stat-count count). */
        grid-template-columns: repeat(auto-fit, minmax(68px, 1fr));
        gap: var(--space-1);
        padding: 0 0 var(--space-2);
    }

    .live-stat-card {
        padding: var(--space-1-5) var(--space-0-5);
        border-radius: var(--radius-md);
    }

    .live-stat-val {
        font-size: 1.05rem;
    }

    .live-stat-label {
        font-size: 0.48rem;
        letter-spacing: 0.3px;
        margin-top: var(--space-0-5);
    }

    .live-alert-strip {
        gap: var(--space-1);
        padding: 0 0 var(--space-1-5);
    }

    .live-alert-badge {
        font-size: 0.62rem;
        padding: var(--space-1) var(--space-2);
    }

    .live-tabs {
        margin: 0 0 var(--space-1-5);
    }

    .live-tab {
        padding: var(--space-1-5) var(--space-2-5);
        font-size: 0.7rem;
    }

    .live-filter-bar {
        gap: var(--space-1);
        padding: 0 0 var(--space-1-5);
    }

    .live-filter-bar input {
        padding: var(--space-1) var(--space-2);
        font-size: 0.72rem;
    }

    .live-filter-bar select {
        padding: var(--space-1) var(--space-1-5);
        font-size: 0.72rem;
        min-width: 90px;
    }

    .live-legend {
        gap: var(--space-1-5);
        padding: 0 0 var(--space-1-5);
    }

    .live-legend-item {
        font-size: 0.55rem;
    }

    .live-legend-dot {
        width: 8px;
        height: 8px;
    }

    .live-compact-lb td {
        padding: var(--space-2) var(--space-1);
        font-size: 0.78rem;
    }

    .live-compact-lb .rank-cell {
        width: 28px;
    }

    /* Score edit modal */
    .live-score-modal {
        max-width: 300px;
    }

    .live-score-input {
        width: 70px;
        height: 48px;
        font-size: 1.5rem;
    }

    /* Teams & pairings grids */
    .live-teams-grid {
        grid-template-columns: 1fr;
        gap: var(--space-1-5);
    }

    .live-pairings-grid {
        grid-template-columns: 1fr;
        gap: var(--space-1-5);
    }
}

/* ── Team standings cards ── */
.live-teams-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: var(--space-2);
    padding: 0 var(--space-0-5);
}

.live-team-card {
    background: var(--charcoal-light);
    border-radius: var(--radius-lg);
    padding: var(--space-3);
    border-left: 3px solid var(--gold);
    border: 1px solid var(--border-subtle);
    border-left: 3px solid var(--gold);
}

.live-team-rank {
    font-size: 0.65rem;
    color: var(--text-muted);
    font-weight: 600;
}

.live-team-name {
    font-weight: 700;
    font-size: 0.88rem;
    margin: var(--space-0-5) 0;
    color: var(--text);
}

.live-team-score {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--brand-ink);
}

.live-team-par {
    font-size: 0.75rem;
    margin-left: var(--space-1-5);
    font-weight: 700;
}

.live-team-counting {
    font-size: 0.62rem;
    color: var(--text-muted);
    margin-top: var(--space-1);
}

/* ── Alerts panel ── */
.live-alerts-panel {
    padding: 0 var(--space-0-5);
}

.live-alert-card {
    background: var(--charcoal-light);
    border-radius: var(--radius-lg);
    padding: var(--space-3) var(--space-3-5);
    margin-bottom: var(--space-2);
    border-left: 3px solid var(--double);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid var(--border-subtle);
    border-left: 3px solid var(--double);
}

.live-alert-card.alert-type-conflict {
    border-left-color: var(--warning);
}

.live-alert-card.alert-type-help {
    border-left-color: var(--double);
}

.live-alert-card.alert-type-provisional {
    border-left-color: var(--purple);
}

.live-alert-info {
    flex: 1;
}

.live-alert-type {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 800;
}

.live-alert-type.type-alert {
    color: var(--danger-ink);
}

.live-alert-type.type-conflict {
    color: var(--warning-ink);
}

.live-alert-type.type-help {
    color: var(--danger-ink);
}

.live-alert-type.type-provisional {
    color: var(--purple-ink);
}

.live-alert-detail {
    font-size: 0.8rem;
    font-weight: 600;
    margin-top: var(--space-0-5);
    color: var(--text);
}

.live-alert-meta {
    font-size: 0.66rem;
    color: var(--text-muted);
    margin-top: var(--space-0-5);
}

.live-alert-action {
    padding: var(--space-1-5) var(--space-3-5);
    border-radius: var(--radius-md);
    font-size: 0.7rem;
    font-weight: 700;
    border: none;
    cursor: pointer;
    background: var(--gold);
    color: var(--gsx-on-brand);
    transition: transform var(--motion-instant);
}

.live-alert-action:active {
    transform: scale(0.95);
}

/* ── Pairings tab cards ── */
.live-pairings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: var(--space-2);
    padding: 0 var(--space-0-5);
}

.live-pairing-card {
    background: var(--charcoal-light);
    border-radius: var(--radius-lg);
    padding: var(--space-2-5) var(--space-3);
    border: 1px solid var(--border-subtle);
}

.live-pairing-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-1-5);
    padding-bottom: var(--space-1);
    border-bottom: 1px solid var(--border-color);
}

.live-pairing-group {
    font-weight: 700;
    font-size: 0.8rem;
    color: var(--text);
}

.live-pairing-hole {
    font-size: 0.68rem;
    color: var(--text-muted);
}

.live-pairing-player {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-0-5) 0;
    font-size: 0.74rem;
}

.live-pairing-player .pp-score {
    font-weight: 700;
    color: var(--brand-ink);
}

/* Auto-refresh indicator */
.live-refresh-indicator {
    font-size: 0.62rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: var(--space-1);
}

.live-refresh-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--birdie);
    animation: pulse-dot 2s infinite;
    box-shadow: 0 0 6px rgba(var(--gsx-success-rgb), 0.5);
}

@keyframes pulse-dot {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.3;
    }
}

/* Tab content sections */
.live-tab-content {
    display: none;
}

.live-tab-content.active {
    display: block;
}

/* Sign out link in dashboard */

/* ── Light theme overrides for dashboard ── */
[data-theme="light"] .live-stat-card {
    background: var(--surface-solid);
    border-color: var(--border-subtle);
}

[data-theme="light"] .live-team-card,
[data-theme="light"] .live-alert-card,
[data-theme="light"] .live-pairing-card {
    background: var(--surface-solid);
    border-color: var(--border-subtle);
}

[data-theme="light"] .live-dash-header {
    border-bottom-color: var(--border-subtle);
}

[data-theme="light"] .live-alert-badge.alert-danger {
    background: var(--danger-wash);
    border-color: var(--danger-wash-border);
}

[data-theme="light"] .live-alert-badge.alert-warning {
    background: var(--warning-wash);
    border-color: var(--warning-wash-border);
}

[data-theme="light"] .live-alert-badge.alert-info {
    background: var(--info-wash);
    border-color: var(--info-wash-border);
}

[data-theme="light"] .live-alert-badge.alert-ok {
    background: var(--success-wash);
    border-color: var(--success-wash-border);
}

[data-theme="light"] .live-stat-card.active-filter {
    border-color: var(--primary-color);
    background: rgba(var(--gsx-brand-rgb), 0.12);
}

/* ── Director Score Edit Modal ── */
.live-score-overlay {
    position: fixed;
    inset: 0;
    z-index: var(--z-modal);
    background: var(--scrim-strong);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-4);
    animation: mnOverlayIn 0.25s ease;
}

.live-score-modal {
    background: var(--charcoal-light);
    border-radius: var(--radius-3xl);
    width: 100%;
    max-width: 340px;
    overflow: hidden;
    animation: mnModalIn 0.3s ease;
    border: 1px solid var(--border-subtle);
}

.live-score-modal-header {
    background: rgba(var(--gsx-brand-rgb), 0.1);
    padding: var(--space-4) var(--space-5);
    text-align: center;
    border-bottom: 1px solid var(--border-subtle);
}

.live-score-modal-header h3 {
    color: var(--brand-ink);
    font-size: 1rem;
    margin: 0 0 var(--space-1);
}

.live-score-modal-header p {
    color: var(--text-muted);
    font-size: 0.75rem;
    margin: 0;
}

.live-score-modal-body {
    padding: var(--space-5);
    text-align: center;
}

.live-score-info-row {
    display: flex;
    justify-content: center;
    gap: var(--space-4);
    margin-bottom: var(--space-4);
    font-size: 0.8rem;
    color: var(--text-muted);
}

.live-score-info-row span {
    font-weight: 600;
    color: var(--text);
}

.live-score-input-wrap {
    margin-bottom: var(--space-3-5);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-3);
}

.live-score-step {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid var(--gold);
    background: rgba(var(--gsx-brand-rgb), 0.1);
    color: var(--brand-ink);
    font-size: 1.5rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--motion-fast), transform var(--motion-instant);
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.live-score-step:hover {
    background: rgba(var(--gsx-brand-rgb), 0.2);
}

.live-score-step:active {
    transform: scale(0.9);
    background: rgba(var(--gsx-brand-rgb), 0.3);
}

[data-theme="light"] .live-score-step {
    background: rgba(var(--gsx-brand-rgb), 0.08);
}

.live-score-input {
    width: 80px;
    height: 56px;
    font-size: 1.8rem;
    font-weight: 800;
    text-align: center;
    border: 2px solid var(--gold);
    border-radius: var(--radius-xl);
    background: var(--raise-2);
    color: var(--text);
    outline: none;
    -moz-appearance: textfield;
}

.live-score-input::-webkit-outer-spin-button,
.live-score-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.live-score-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 12px rgba(var(--gsx-brand-rgb), 0.3);
}

.live-score-btns {
    display: flex;
    gap: var(--space-2);
}

.live-score-btns button {
    flex: 1;
    padding: var(--space-3);
    border-radius: var(--radius-lg);
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    border: none;
}

.live-score-save {
    background: var(--gold);
    color: var(--gsx-on-brand);
}

.live-score-save:active {
    opacity: 0.85;
}

.live-score-delete {
    background: var(--double);
    color: var(--on-danger);
}

.live-score-delete:active {
    opacity: 0.85;
}

.live-score-cancel {
    background: transparent;
    border: 1px solid var(--border-color) !important;
    color: var(--text);
}

.live-score-cancel:active {
    opacity: 0.7;
}

.live-score-lock-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-1-5);
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: var(--space-2-5);
    cursor: pointer;
}

.live-score-lock-label input {
    accent-color: var(--primary-color);
}

[data-theme="light"] .live-score-modal {
    background: var(--surface-solid);
    border-color: var(--surface-sunken);
}

[data-theme="light"] .live-score-modal-header {
    background: rgba(var(--gsx-brand-rgb), 0.06);
}

[data-theme="light"] .live-score-input {
    background: var(--gray-light);
    color: var(--text-primary);
}

/* ── Resolve Modal Overlay ── */
.resolve-overlay {
    position: fixed;
    inset: 0;
    z-index: var(--z-modal);
    background: var(--scrim-strong);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-4);
    animation: resolveOverlayIn 0.2s ease;
}

@keyframes resolveOverlayIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.resolve-modal {
    background: var(--charcoal);
    border: 1.5px solid var(--border-strong);
    border-radius: var(--radius-3xl);
    width: 100%;
    max-width: 380px;
    overflow: hidden;
    animation: resolveSlideUp 0.25s ease;
    box-shadow: var(--shadow-2xl);
}

@keyframes resolveSlideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.resolve-header {
    padding: var(--space-4) var(--space-4) var(--space-3);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.resolve-header-info {
    flex: 1;
}

.resolve-type-badge {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-0-5) var(--space-2);
    border-radius: var(--radius-xs);
    margin-bottom: var(--space-1-5);
}

.resolve-type-badge.badge-help {
    background: var(--danger-wash);
    color: var(--danger-ink);
}

.resolve-type-badge.badge-alert {
    background: var(--danger-wash);
    color: var(--danger-ink);
}

.resolve-type-badge.badge-conflict {
    background: var(--warning-wash);
    color: var(--warning-ink);
}

.resolve-type-badge.badge-provisional {
    background: var(--purple-wash);
    color: var(--purple-ink);
}

.resolve-player-name {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
}

.resolve-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: var(--space-0-5);
}

.resolve-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0 0 0 var(--space-3);
    line-height: 1;
}

.resolve-close:hover {
    color: var(--text);
}

.resolve-body {
    padding: 0 var(--space-4) var(--space-4);
}

.resolve-prompt {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: var(--space-3);
}

.resolve-message {
    background: var(--charcoal-light);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: var(--space-2-5) var(--space-3);
    font-size: 0.8rem;
    color: var(--text);
    margin-bottom: var(--space-3-5);
    font-style: italic;
}

/* Score choice buttons (two side-by-side) */
.resolve-choices {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-2-5);
    margin-bottom: var(--space-3-5);
}

.resolve-choice-btn {
    background: var(--charcoal-light);
    border: 2px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    padding: var(--space-3-5) var(--space-2-5);
    cursor: pointer;
    text-align: center;
    transition: all var(--motion-fast);
}

.resolve-choice-btn:hover {
    border-color: var(--primary-color);
    background: rgba(var(--gsx-brand-rgb), 0.08);
}

.resolve-choice-btn:active {
    transform: scale(0.97);
}

.resolve-choice-btn.selected {
    border-color: var(--primary-color);
    background: rgba(var(--gsx-brand-rgb), 0.12);
}

.resolve-choice-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: var(--space-1);
}

.resolve-choice-score {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--text);
    line-height: 1;
}

/* Custom score input row */
.resolve-custom-row {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-3-5);
}

.resolve-custom-divider {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: center;
    margin-bottom: var(--space-2-5);
}

.resolve-custom-input {
    flex: 1;
    background: var(--charcoal-light);
    border: 2px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: var(--space-2-5) var(--space-3-5);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
    text-align: center;
    outline: none;
    -moz-appearance: textfield;
}

.resolve-custom-input::-webkit-inner-spin-button,
.resolve-custom-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.resolve-custom-input:focus {
    border-color: var(--primary-color);
}

.resolve-custom-apply {
    background: var(--gold);
    color: var(--gsx-on-brand);
    border: none;
    border-radius: var(--radius-lg);
    padding: var(--space-2-5) var(--space-4);
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
}

.resolve-custom-apply:active {
    opacity: 0.85;
}

/* Textarea for notes */
.resolve-textarea {
    width: 100%;
    background: var(--charcoal-light);
    border: 2px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: var(--space-2-5) var(--space-3);
    font-size: 0.82rem;
    color: var(--text);
    resize: vertical;
    min-height: 60px;
    outline: none;
    font-family: inherit;
    margin-bottom: var(--space-3-5);
    box-sizing: border-box;
}

.resolve-textarea:focus {
    border-color: var(--primary-color);
}

.resolve-textarea::placeholder {
    color: var(--text-muted);
}

/* Button row */
.resolve-actions {
    display: flex;
    gap: var(--space-2-5);
}

.resolve-btn {
    flex: 1;
    padding: var(--space-3);
    border-radius: var(--radius-lg);
    font-size: 0.82rem;
    font-weight: 700;
    border: none;
    cursor: pointer;
    transition: all var(--motion-instant);
}

.resolve-btn:active {
    transform: scale(0.97);
}

.resolve-btn-cancel {
    background: transparent;
    border: 1px solid var(--border-color) !important;
    color: var(--text);
}

.resolve-btn-confirm {
    background: var(--gold);
    color: var(--gsx-on-brand);
}

.resolve-btn-confirm:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ── Help Request Alert Banner (SSE) ── */
.sos-alert-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: var(--z-toast);
    background: linear-gradient(135deg, var(--danger-dark), var(--double));
    color: var(--on-danger);
    padding: var(--space-3-5) var(--space-4);
    display: flex;
    align-items: center;
    gap: var(--space-3);
    box-shadow: 0 4px 20px rgba(var(--gsx-danger-rgb), 0.5);
    animation: sosBannerSlide 0.3s ease, sosPulse 1.5s ease-in-out 3;
    cursor: pointer;
}

@keyframes sosBannerSlide {
    from {
        transform: translateY(-100%);
    }

    to {
        transform: translateY(0);
    }
}

@keyframes sosPulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

.sos-alert-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.sos-alert-body {
    flex: 1;
}

.sos-alert-title {
    font-weight: 800;
    font-size: 0.85rem;
}

.sos-alert-detail {
    font-size: 0.75rem;
    opacity: 0.9;
    margin-top: var(--space-0-5);
}

.sos-alert-dismiss {
    background: var(--raise-5);
    border: none;
    color: var(--on-danger);
    border-radius: var(--radius-sm);
    padding: var(--space-1-5) var(--space-3);
    font-size: 0.72rem;
    font-weight: 700;
    cursor: pointer;
    flex-shrink: 0;
}

.sos-alert-dismiss:active {
    background: var(--raise-5);
    filter: brightness(1.2);
}

/* Light theme overrides for resolve modals */
[data-theme="light"] .resolve-modal {
    background: var(--surface-solid);
    border-color: var(--surface-sunken);
}

[data-theme="light"] .resolve-choice-btn {
    background: var(--gray-light);
    border-color: var(--surface-sunken);
}

[data-theme="light"] .resolve-choice-btn:hover {
    background: rgba(var(--gsx-brand-rgb), 0.06);
}

[data-theme="light"] .resolve-custom-input {
    background: var(--gray-light);
    color: var(--text-primary);
}

[data-theme="light"] .resolve-textarea {
    background: var(--gray-light);
    color: var(--text-primary);
}

[data-theme="light"] .resolve-message {
    background: var(--gray-light);
}

/* ============================================
   TOURNAMENT PERSONNEL SECTION
   ============================================ */
.personnel-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    margin-top: var(--space-3);
}

.personnel-card {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    background: var(--raise-2);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: var(--space-2-5) var(--space-3-5);
}

.personnel-card .personnel-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--gsx-on-brand);
    flex-shrink: 0;
}

.personnel-info {
    flex: 1;
    min-width: 0;
}

.personnel-info .personnel-name {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-primary);
}

.personnel-info .personnel-school {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 0;
}

.personnel-info .personnel-linked {
    font-size: 0.68rem;
    color: rgba(var(--gsx-brand-rgb), 0.7);
    margin-top: 0;
}

.personnel-role-badge {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    padding: var(--space-0-5) var(--space-2);
    border-radius: var(--radius-sm);
    white-space: nowrap;
}

.personnel-actions {
    flex-shrink: 0;
}

.personnel-actions button {
    background: none;
    border: none;
    color: var(--danger-ink);
    cursor: pointer;
    font-size: 1rem;
    padding: var(--space-1);
    border-radius: var(--radius-sm);
}

.personnel-actions button:hover {
    background: var(--danger-wash);
}

/* Head Director card - special treatment */
.personnel-head-card {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    background: linear-gradient(135deg, rgba(var(--gsx-brand-rgb), 0.1), rgba(var(--gsx-brand-rgb), 0.04));
    border: 1px solid rgba(var(--gsx-brand-rgb), 0.25);
    border-radius: var(--radius-lg);
    padding: var(--space-2-5) var(--space-3-5);
    margin-top: var(--space-2);
}

.personnel-head-card .personnel-avatar {
    background: var(--gold) !important;
}

.personnel-head-card .personnel-name {
    color: var(--brand-ink);
}

/* Staff search dropdown */
.staff-search-container {
    position: relative;
}

.staff-search-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: var(--z-dropdown);
    background: var(--bg-secondary, #1e1e1e);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    max-height: 200px;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    margin-top: var(--space-1);
}

.staff-search-item {
    display: flex;
    align-items: center;
    gap: var(--space-2-5);
    padding: var(--space-2) var(--space-3);
    cursor: pointer;
    border-bottom: 1px solid var(--hairline-faint);
}

.staff-search-item:hover {
    background: rgba(var(--gsx-brand-rgb), 0.1);
}

.staff-search-item:last-child {
    border-bottom: none;
}

.staff-search-item .search-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--charcoal-lighter);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--gsx-on-brand);
    flex-shrink: 0;
}

.staff-search-item .search-name {
    font-size: 0.82rem;
    font-weight: 500;
}

.staff-search-item .search-school {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.staff-search-no-results {
    padding: var(--space-4);
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Add staff row */
.add-staff-row {
    display: flex;
    gap: var(--space-2);
    align-items: center;
    margin-bottom: var(--space-3);
}

.add-staff-row select {
    flex: 0 0 auto;
    min-width: 150px;
}

.add-staff-row .btn {
    flex-shrink: 0;
    min-height: var(--gsx-control-height-sm);
    padding: 0 var(--space-3);
    font-size: 0.8rem;
}

/* ============================================
   TEE TIME PAIRINGS - DUAL COLUMN LAYOUT
   ============================================ */
.tee-time-dual-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-4);
}

.tee-time-column {
    min-width: 0;
}

.tee-time-col-header {
    text-align: center;
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--brand-ink);
    padding: var(--space-2);
    margin-bottom: var(--space-2);
    border-bottom: 2px solid rgba(var(--gsx-brand-rgb), 0.3);
}

.tee-time-groups {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

/* Override the grid layout inside tee-time columns — stack groups vertically */
.tee-time-groups .pairing-group {
    width: 100%;
}

/* Tee time group headers need the label to not wrap */
.tee-time-groups .group-header strong {
    white-space: nowrap;
    font-size: 0.82rem;
}

.tee-time-groups .group-header {
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
}

/* Ensure tee-time columns don't collapse too narrow */
.tee-time-dual-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-4);
    min-width: 0;
    /* Override parent .pairing-groups grid — take full width */
    grid-column: 1 / -1;
}

.tee-time-column {
    min-width: 0;
    overflow: hidden;
}

/* When pairing-groups contains a tee-time layout, disable the auto-fill grid */
.pairing-groups:has(.tee-time-dual-columns) {
    display: block;
}

@media (max-width: 600px) {
    .tee-time-dual-columns {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   START FORMAT CARD (Tournament Creation/Settings)
   ============================================ */
.sf-option-cards {
    display: flex;
    gap: var(--space-3);
    margin-bottom: var(--space-3);
}

.sf-option-card {
    flex: 1;
    padding: var(--space-4);
    border: 2px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    cursor: pointer;
    text-align: center;
    transition: all var(--motion-base) var(--ease-standard);
    background: var(--raise-1);
}

.sf-option-card:hover {
    border-color: rgba(var(--gsx-brand-rgb), 0.4);
    background: rgba(var(--gsx-brand-rgb), 0.05);
}

.sf-option-card.selected {
    border-color: var(--primary-color);
    background: rgba(var(--gsx-brand-rgb), 0.1);
}

.sf-option-card .sf-icon {
    font-size: 1.5rem;
    margin-bottom: var(--space-1-5);
}

.sf-option-card .sf-label {
    font-weight: 600;
    font-size: 0.85rem;
}

.sf-option-card .sf-desc {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: var(--space-1);
}

.tee-time-options {
    background: var(--raise-1);
    border: 1px solid var(--hairline-faint);
    border-radius: var(--radius-lg);
    padding: var(--space-3-5);
    margin-top: var(--space-2);
}

.tee-time-options .form-group {
    margin-bottom: var(--space-2-5);
}

.tee-time-options .form-group:last-child {
    margin-bottom: 0;
}

/* ============================================
   LIVE ROUND WARNING MODAL
   ============================================ */
.live-warn-overlay {
    position: fixed;
    inset: 0;
    z-index: var(--z-modal);
    background: var(--scrim);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity var(--motion-base) var(--ease-standard);
}

.live-warn-overlay.visible {
    opacity: 1;
}

.live-warn-modal {
    background: var(--bg-secondary, #1e1e1e);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-3xl);
    padding: var(--space-8) var(--space-8) var(--space-6);
    max-width: 400px;
    width: 90%;
    text-align: center;
    box-shadow: var(--shadow-2xl);
    transform: scale(0.95);
    transition: transform var(--motion-base) var(--ease-standard);
}

.live-warn-overlay.visible .live-warn-modal {
    transform: scale(1);
}

.live-warn-icon {
    margin-bottom: var(--space-3);
}

.live-warn-badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 1.5px;
    padding: var(--space-0-5) var(--space-3);
    border-radius: 20px;
    color: var(--on-danger);
    margin-bottom: var(--space-3);
}

.live-warn-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary, #fff);
    margin: 0 0 var(--space-2);
}

.live-warn-desc {
    font-size: 0.85rem;
    color: var(--text-secondary, #ccc);
    margin: 0 0 var(--space-1-5);
    line-height: 1.4;
}

.live-warn-detail {
    font-size: 0.78rem;
    color: var(--text-muted, #888);
    margin: 0 0 var(--space-5);
    line-height: 1.4;
}

.live-warn-actions {
    display: flex;
    gap: var(--space-3);
}

.live-warn-cancel {
    flex: 1;
    padding: var(--space-2-5);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-lg);
    background: transparent;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background var(--motion-fast);
}

.live-warn-cancel:hover {
    background: var(--raise-3);
}

.live-warn-proceed {
    flex: 1;
    padding: var(--space-2-5);
    border: none;
    border-radius: var(--radius-lg);
    background: var(--danger);
    color: var(--on-danger);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background var(--motion-fast);
}

.live-warn-proceed:hover {
    background: var(--danger-dark);
}

/* Light theme */
[data-theme="light"] .live-warn-modal {
    background: var(--surface-solid);
    border-color: var(--border-subtle);
    box-shadow: var(--shadow-2xl);
}

[data-theme="light"] .live-warn-cancel {
    border-color: var(--surface-sunken);
    color: var(--text-primary);
}

[data-theme="light"] .live-warn-cancel:hover {
    background: var(--raise-2);
}

/* Light theme overrides */
[data-theme="light"] .personnel-card {
    background: var(--raise-1);
    border-color: var(--border-subtle);
}

[data-theme="light"] .personnel-head-card {
    background: linear-gradient(135deg, rgba(var(--gsx-brand-rgb), 0.08), rgba(var(--gsx-brand-rgb), 0.02));
    border-color: rgba(var(--gsx-brand-rgb), 0.2);
}

[data-theme="light"] .staff-search-dropdown {
    background: var(--surface-solid);
    border-color: var(--surface-sunken);
    box-shadow: var(--shadow-lg);
}

[data-theme="light"] .staff-search-item:hover {
    background: rgba(var(--gsx-brand-rgb), 0.06);
}

[data-theme="light"] .sf-option-card {
    background: var(--raise-1);
    border-color: var(--surface-sunken);
}

[data-theme="light"] .sf-option-card:hover {
    background: rgba(var(--gsx-brand-rgb), 0.04);
}

[data-theme="light"] .sf-option-card.selected {
    background: rgba(var(--gsx-brand-rgb), 0.08);
}

[data-theme="light"] .tee-time-options {
    background: var(--raise-1);
    border-color: var(--hairline-faint);
}


/* ═══════════════════════════════════════════════════════════════════════════
   ANALYTICS PAGE
   ═══════════════════════════════════════════════════════════════════════════ */

.analytics-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-4);
    margin-bottom: var(--space-6);
    flex-wrap: wrap;
}

.analytics-header-left {
    flex: 1;
    min-width: 0;
}

.analytics-header-right {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    flex-wrap: wrap;
}

/* Tab Switcher */
.analytics-tab-switcher {
    display: flex;
    background: var(--raise-2);
    border-radius: var(--radius-md);
    padding: var(--space-0-5);
    border: 1px solid var(--border-subtle);
}

.analytics-tab {
    padding: var(--space-1-5) var(--space-4);
    font-size: 0.82rem;
    font-weight: 600;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--motion-base);
}

.analytics-tab.active {
    background: var(--primary-color);
    color: var(--gsx-on-brand);
}

.analytics-tab:hover:not(.active) {
    background: var(--raise-3);
}

/* ── Hero Stats Row ── */
.an-hero-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: var(--space-3);
    margin-bottom: var(--space-7);
}

.an-hero-card {
    background: var(--raise-2);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    text-align: center;
    transition: transform var(--motion-fast), box-shadow var(--motion-fast);
}

.an-hero-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.an-hero-card.an-hero-primary {
    border-color: rgba(var(--gsx-brand-rgb), 0.35);
    background: linear-gradient(135deg, rgba(var(--gsx-brand-rgb), 0.12), rgba(var(--gsx-brand-rgb), 0.04));
}

.an-hero-card.an-hero-good {
    border-color: var(--success-wash-border);
    background: linear-gradient(135deg, var(--success-wash), transparent);
}

.an-hero-value {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
    margin-bottom: var(--space-1);
}

.an-hero-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    font-weight: 600;
}

.an-hero-sub {
    font-size: 0.68rem;
    color: var(--text-muted);
    margin-top: var(--space-0-5);
}

/* ── Section Cards ── */
.an-section {
    background: var(--raise-1);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    padding: var(--space-5);
    margin-bottom: var(--space-5);
}

/* Tabbed analytics layout — keeps the deep-dive sections horizontal
   instead of one long vertical scroll. */
.an-tabs-wrap {
    margin-top: var(--space-5);
}

.an-tabs {
    position: sticky;
    top: 0;
    z-index: 5;
    background: var(--card-bg, var(--bg-secondary));
    margin-bottom: var(--space-5);
}

.an-tab-panel {
    animation: anTabFade 0.2s ease;
}

.an-tab-panel>.an-section:last-child,
.an-tab-panel>.an-rounds-grid:last-child {
    margin-bottom: 0;
}

@keyframes anTabFade {
    from {
        opacity: 0;
        transform: translateY(4px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.an-section-title {
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--space-4);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.an-section-title svg {
    color: var(--brand-ink);
    flex-shrink: 0;
}

/* ── SVG Charts ── */
.an-chart-container {
    width: 100%;
    position: relative;
}

.an-chart-container svg {
    width: 100%;
    height: auto;
    display: block;
}

.an-chart-tooltip {
    position: absolute;
    background: var(--scrim);
    color: var(--on-scrim);
    font-size: 0.75rem;
    padding: var(--space-1-5) var(--space-2-5);
    border-radius: var(--radius-sm);
    pointer-events: none;
    white-space: nowrap;
    z-index: var(--z-sticky-bar);
    opacity: 0;
    transition: opacity var(--motion-fast);
    box-shadow: var(--shadow-md);
}

.an-chart-tooltip.visible {
    opacity: 1;
}

/* ── Scoring Trend Line Chart ── */
.an-trend-line {
    fill: none;
    stroke: var(--primary-color);
    stroke-width: 2.5;
}

.an-trend-area {
    fill: url(#trendGradient);
    opacity: 0.3;
}

.an-trend-dot {
    fill: var(--primary-color);
    stroke: var(--bg-primary);
    stroke-width: 2;
    cursor: pointer;
    transition: r var(--motion-fast);
}

.an-trend-dot:hover {
    r: 6;
}

.an-par-line {
    stroke: var(--border-medium);
    stroke-width: 1;
    stroke-dasharray: 6 4;
}

.an-grid-line {
    stroke: var(--border-subtle);
    stroke-width: 1;
}

.an-axis-label {
    fill: var(--text-secondary);
    font-size: 10px;
    font-family: inherit;
}

/* ── Scoring Distribution Donut ── */
.an-donut-container {
    display: flex;
    align-items: center;
    gap: var(--space-8);
    flex-wrap: wrap;
}

.an-donut-chart {
    flex-shrink: 0;
}

.an-donut-legend {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    flex: 1;
    min-width: 160px;
}

.an-legend-item {
    display: flex;
    align-items: center;
    gap: var(--space-2-5);
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.an-legend-swatch {
    width: 12px;
    height: 12px;
    border-radius: var(--radius-xs);
    flex-shrink: 0;
}

.an-legend-count {
    margin-left: auto;
    font-weight: 600;
    color: var(--text-primary);
}

.an-legend-pct {
    font-size: 0.72rem;
    color: var(--text-muted);
    width: 36px;
    text-align: right;
}

/* ── Par Performance Bars ── */
.an-par-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-3);
}

.an-par-card {
    background: var(--raise-2);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    text-align: center;
}

.an-par-title {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: var(--space-2);
}

.an-par-avg {
    font-size: 1.4rem;
    font-weight: 700;
    line-height: 1;
    margin-bottom: var(--space-1);
}

.an-par-avg.under-par {
    color: var(--birdie-ink);
}

.an-par-avg.over-par {
    color: var(--double-ink);
}

.an-par-avg.at-par {
    color: var(--brand-ink);
}

.an-par-detail {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: var(--space-0-5);
}

.an-par-bar-track {
    height: 6px;
    background: var(--raise-3);
    border-radius: var(--radius-xs);
    margin-top: var(--space-2-5);
    overflow: hidden;
}

.an-par-bar-fill {
    height: 100%;
    border-radius: var(--radius-xs);
    transition: width var(--motion-slower) var(--ease-standard);
}

/* ── Front 9 vs Back 9 ── */
.an-nine-compare {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-3);
}

.an-nine-card {
    background: var(--raise-2);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
}

.an-nine-label {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: var(--space-2);
}

.an-nine-row {
    display: flex;
    justify-content: space-between;
    padding: var(--space-1) 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.an-nine-val {
    font-weight: 600;
    color: var(--text-primary);
}

/* ── Hole-by-Hole Heatmap ── */
.an-holes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: var(--space-2);
}

/* ── Hole Heatmap (Front 9 / Back 9 strip) ── */
.an-heatmap {
    margin-bottom: var(--space-4);
}

.an-hm-band {
    display: flex;
    align-items: stretch;
    gap: var(--space-2);
    margin-bottom: var(--space-1-5);
}

.an-hm-band-label {
    flex: 0 0 3.4rem;
    display: flex;
    align-items: center;
    font-size: 0.66rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-muted);
}

.an-hm-row {
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    gap: var(--space-1);
    flex: 1;
    min-width: 0;
}

.an-hm-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0;
    aspect-ratio: 1 / 1;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
    cursor: default;
    transition: transform var(--motion-instant);
    overflow: hidden;
}

.an-hm-cell:hover {
    transform: scale(1.08);
    border-color: var(--text-muted);
}

.an-hm-hole {
    font-size: 0.6rem;
    font-weight: 700;
    color: var(--text-primary);
    opacity: 0.75;
    line-height: 1;
}

.an-hm-avg {
    font-size: 0.82rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1;
}

.an-hm-vs {
    font-size: 0.58rem;
    font-weight: 600;
    color: var(--text-primary);
    opacity: 0.8;
    line-height: 1;
}

.an-hm-legend {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    margin-top: var(--space-2);
    font-size: 0.66rem;
    color: var(--text-muted);
}

.an-hm-scale {
    width: 120px;
    height: 8px;
    border-radius: var(--radius-xs);
    background: linear-gradient(90deg,
            rgba(var(--gsx-success-rgb), 0.8),
            rgba(var(--gsx-brand-rgb), 0.5),
            rgba(var(--gsx-danger-rgb), 0.8));
}

@media (max-width: 600px) {
    .an-hm-band-label {
        flex-basis: 2.6rem;
        font-size: 0.58rem;
    }

    .an-hm-avg {
        font-size: 0.7rem;
    }

    .an-hm-vs {
        font-size: 0.52rem;
    }
}

.an-hole-cell {
    background: var(--raise-2);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: var(--space-2-5);
    text-align: center;
    transition: transform var(--motion-fast);
}

.an-hole-cell:hover {
    transform: translateY(-2px);
}

.an-hole-cell.an-hole-under {
    border-color: var(--success-wash-border);
    background: var(--success-wash);
}

.an-hole-cell.an-hole-over {
    border-color: var(--danger-wash-border);
    background: var(--danger-wash);
}

.an-hole-cell.an-hole-even {
    border-color: rgba(var(--gsx-brand-rgb), 0.25);
    background: rgba(var(--gsx-brand-rgb), 0.06);
}

.an-hole-num {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.an-hole-par {
    font-size: 0.62rem;
    color: var(--text-muted);
    margin-bottom: var(--space-1);
}

.an-hole-avg {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.an-hole-vs {
    font-size: 0.72rem;
    font-weight: 600;
    margin-top: var(--space-0-5);
}

.an-hole-under .an-hole-vs {
    color: var(--birdie-ink);
}

.an-hole-over .an-hole-vs {
    color: var(--double-ink);
}

.an-hole-even .an-hole-vs {
    color: var(--brand-ink);
}

.an-hole-range {
    font-size: 0.6rem;
    color: var(--text-muted);
    margin-top: var(--space-0-5);
}

/* ── Top 5 / Last 5 Tables ── */
.an-rounds-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-3);
}

.an-round-card {
    background: var(--raise-1);
    border: 1px solid var(--hairline-faint);
    border-radius: var(--radius-md);
    padding: var(--space-3);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.an-round-info {
    flex: 1;
    min-width: 0;
}

.an-round-tournament {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.an-round-meta {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.an-round-score {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-left: var(--space-3);
}

.an-round-vs {
    font-size: 0.72rem;
    font-weight: 600;
}

/* ── Tournament History Table ── */
.an-history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}

.an-history-table th {
    text-align: left;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    padding: var(--space-2) var(--space-2-5);
    border-bottom: 1px solid var(--border-subtle);
    font-weight: 600;
}

.an-history-table td {
    padding: var(--space-2) var(--space-2-5);
    color: var(--text-secondary);
    border-bottom: 1px solid var(--hairline-faint);
}

.an-history-table tr:hover td {
    background: var(--raise-1);
}

.an-rank-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: var(--radius-sm);
    font-size: 0.72rem;
    font-weight: 700;
}

.an-rank-1 {
    background: rgba(255, 215, 0, 0.15); /* tokens-allow: trophy gold */
    color: #FFD700; /* tokens-allow: trophy gold */
}

.an-rank-2 {
    background: rgba(192, 192, 192, 0.15); /* tokens-allow: trophy silver */
    color: #C0C0C0; /* tokens-allow: trophy silver */
}

.an-rank-3 {
    background: rgba(205, 127, 50, 0.15); /* tokens-allow: trophy bronze */
    color: #CD7F32; /* tokens-allow: trophy bronze */
}

/* ── Team Analytics ── */
.an-team-leaderboard {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.an-lb-row {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2-5) var(--space-3);
    background: var(--raise-1);
    border: 1px solid var(--hairline-faint);
    border-radius: var(--radius-md);
    transition: background var(--motion-fast);
    cursor: pointer;
}

.an-lb-row:hover {
    background: var(--raise-2);
}

.an-lb-rank {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    background: var(--raise-3);
    color: var(--text-secondary);
    flex-shrink: 0;
}

.an-lb-rank.rank-1 {
    background: rgba(255, 215, 0, 0.2); /* tokens-allow: trophy gold */
    color: #FFD700; /* tokens-allow: trophy gold */
}

.an-lb-rank.rank-2 {
    background: rgba(192, 192, 192, 0.2); /* tokens-allow: trophy silver */
    color: #C0C0C0; /* tokens-allow: trophy silver */
}

.an-lb-rank.rank-3 {
    background: rgba(205, 127, 50, 0.2); /* tokens-allow: trophy bronze */
    color: #CD7F32; /* tokens-allow: trophy bronze */
}

.an-lb-name {
    flex: 1;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-primary);
}

.an-lb-detail {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.an-lb-stats {
    display: flex;
    gap: var(--space-5);
    align-items: center;
}

.an-lb-stat {
    text-align: center;
}

.an-lb-stat-val {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
}

.an-lb-stat-label {
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
}

/* ── Sparkline (mini trend) ── */
.an-sparkline {
    display: inline-block;
    vertical-align: middle;
}

.an-sparkline line {
    stroke: var(--primary-color);
    stroke-width: 1.5;
    stroke-linecap: round;
}

/* ── Scoring by Tournament Type ── */
.an-type-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: var(--space-2-5);
}

.an-type-card {
    background: var(--raise-2);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: var(--space-3);
    text-align: center;
}

.an-type-name {
    font-size: 0.7rem;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    margin-bottom: var(--space-1-5);
}

.an-type-avg {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
}

.an-type-detail {
    font-size: 0.68rem;
    color: var(--text-muted);
    margin-top: var(--space-0-5);
}

/* ── No Data State ── */
.an-empty {
    text-align: center;
    padding: var(--space-12) var(--space-4);
    color: var(--text-muted);
}

.an-empty svg {
    opacity: 0.3;
    margin-bottom: var(--space-4);
}

.an-empty-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: var(--space-2);
}

.an-empty-desc {
    font-size: 0.85rem;
}

/* ── Light Theme ── */
[data-theme="light"] .an-hero-card {
    background: var(--raise-1);
    border-color: var(--border-subtle);
}

[data-theme="light"] .an-hero-card:hover {
    box-shadow: var(--shadow-lg);
}

[data-theme="light"] .an-hero-card.an-hero-primary {
    background: linear-gradient(135deg, rgba(var(--gsx-brand-rgb), 0.08), transparent);
    border-color: rgba(var(--gsx-brand-rgb), 0.2);
}

[data-theme="light"] .an-hero-card.an-hero-good {
    background: linear-gradient(135deg, var(--success-wash), transparent);
    border-color: var(--success-wash-border);
}

[data-theme="light"] .an-section {
    background: var(--raise-1);
    border-color: var(--hairline-faint);
}

[data-theme="light"] .analytics-tab-switcher {
    background: var(--raise-2);
    border-color: var(--border-subtle);
}

[data-theme="light"] .analytics-tab:hover:not(.active) {
    background: var(--raise-3);
}

[data-theme="light"] .an-par-card {
    background: var(--raise-1);
    border-color: var(--border-subtle);
}

[data-theme="light"] .an-nine-card {
    background: var(--raise-1);
    border-color: var(--border-subtle);
}

[data-theme="light"] .an-hole-cell {
    background: var(--raise-1);
    border-color: var(--border-subtle);
}

[data-theme="light"] .an-hole-cell.an-hole-under {
    background: var(--success-wash);
    border-color: var(--success-wash-border);
}

[data-theme="light"] .an-hole-cell.an-hole-over {
    background: var(--danger-wash);
    border-color: var(--danger-wash-border);
}

[data-theme="light"] .an-hole-cell.an-hole-even {
    background: rgba(var(--gsx-brand-rgb), 0.04);
    border-color: rgba(var(--gsx-brand-rgb), 0.2);
}

[data-theme="light"] .an-round-card {
    background: var(--raise-1);
    border-color: var(--hairline-faint);
}

[data-theme="light"] .an-history-table th {
    border-bottom-color: var(--border-subtle);
}

[data-theme="light"] .an-history-table td {
    border-bottom-color: var(--hairline-faint);
}

[data-theme="light"] .an-history-table tr:hover td {
    background: var(--raise-1);
}

[data-theme="light"] .an-lb-row {
    background: var(--raise-1);
    border-color: var(--hairline-faint);
}

[data-theme="light"] .an-lb-row:hover {
    background: var(--raise-2);
}

[data-theme="light"] .an-lb-rank {
    background: var(--raise-3);
}

[data-theme="light"] .an-type-card {
    background: var(--raise-1);
    border-color: var(--border-subtle);
}

[data-theme="light"] .an-par-bar-track {
    background: var(--raise-3);
}

[data-theme="light"] .an-par-line {
    stroke: var(--surface-sunken);
}

[data-theme="light"] .an-grid-line {
    stroke: var(--border-subtle);
}

[data-theme="light"] .an-axis-label {
    fill: var(--text-muted);
}

/* ── Mobile ── */
@media (max-width: 768px) {
    .analytics-header {
        flex-direction: column;
    }

    .analytics-header-right {
        width: 100%;
    }

    .an-hero-row {
        grid-template-columns: repeat(2, 1fr);
    }

    .an-par-grid {
        grid-template-columns: 1fr;
    }

    .an-nine-compare {
        grid-template-columns: 1fr;
    }

    .an-rounds-grid {
        grid-template-columns: 1fr;
    }

    .an-donut-container {
        flex-direction: column;
        align-items: center;
    }

    .an-holes-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .an-lb-stats {
        gap: var(--space-3);
    }

    .an-lb-row {
        flex-wrap: wrap;
    }

    .an-type-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .an-hero-row {
        grid-template-columns: 1fr 1fr;
    }

    .an-holes-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .an-history-table {
        font-size: 0.72rem;
    }

    .an-history-table th,
    .an-history-table td {
        padding: var(--space-1-5);
    }
}

/* ═══════════════════════════════════════════════════════════════
   Player Analytics Page
   ═══════════════════════════════════════════════════════════════ */
.analytics-page-header {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-5);
    flex-wrap: wrap;
}

.analytics-page-header .btn-back {
    white-space: nowrap;
    flex-shrink: 0;
}

.analytics-player-picker {
    flex: 1;
    min-width: 180px;
}

.analytics-player-picker select {
    width: 100%;
    padding: var(--space-2) var(--space-3);
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    background: var(--raise-2);
    color: var(--text-primary);
    cursor: pointer;
    appearance: auto;
    transition: border-color var(--motion-base);
}

.analytics-player-picker select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(var(--gsx-brand-rgb), 0.2);
}

.analytics-player-picker select optgroup {
    font-weight: 700;
    color: var(--text-secondary);
}

.analytics-player-picker select option {
    font-weight: 400;
    color: var(--text-primary);
    background: var(--bg-primary);
}

/* ── Team Performance Snippet on Coach Dashboard ── */
.dash-team-snippet {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.dash-team-row {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-1-5) 0;
    border-bottom: 1px solid var(--hairline-faint);
}

.dash-team-row:last-child {
    border-bottom: none;
}

.dash-team-label {
    font-weight: 700;
    font-size: 0.82rem;
    min-width: 40px;
    color: var(--text-primary);
}

.dash-team-val {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}

.dash-team-top {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    align-items: center;
    padding-top: var(--space-1-5);
    border-top: 1px solid var(--hairline-faint);
}

.dash-team-top-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
}

.dash-team-top-player {
    font-size: 0.78rem;
    color: var(--text-secondary);
    background: var(--raise-2);
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background var(--motion-fast);
}

.dash-team-top-player:hover {
    background: rgba(var(--gsx-brand-rgb), 0.18);
    color: var(--text-primary);
}

.dash-team-top-player strong {
    color: var(--brand-ink);
    font-weight: 700;
}

.dash-team-analytics-expand {
    white-space: nowrap;
}

/* Light theme overrides */
[data-theme="light"] .analytics-player-picker select {
    background: var(--raise-2);
    border-color: var(--surface-sunken);
    color: var(--text-primary);
}

[data-theme="light"] .analytics-player-picker select option {
    background: var(--surface-solid);
}

[data-theme="light"] .dash-team-row {
    border-color: var(--hairline-faint);
}

[data-theme="light"] .dash-team-top {
    border-color: var(--hairline-faint);
}

[data-theme="light"] .dash-team-top-player {
    background: var(--raise-2);
}

[data-theme="light"] .dash-team-top-player:hover {
    background: rgba(var(--gsx-brand-rgb), 0.12);
}

/* ============================================================================
   SYSTEM HEALTH DASHBOARD
   ============================================================================ */

.health-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--space-3);
    margin-bottom: var(--space-6);
}

.health-header .page-title {
    margin-bottom: 0;
}

.health-header-actions {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.health-overall-badge {
    display: inline-flex;
    align-items: center;
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-pill);
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.health-badge-ok {
    background: var(--success-wash);
    color: var(--success-ink);
}

.health-badge-warn {
    background: var(--warning-wash);
    color: var(--warning-ink);
}

.health-badge-crit {
    background: var(--danger-wash);
    color: var(--danger-ink);
}

.health-last-updated {
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.health-dashboard {
    min-height: 200px;
}

.health-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-12);
    color: var(--text-secondary);
}

.health-error {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-6);
    background: var(--danger-wash);
    border: 1px solid var(--danger-wash-border);
    border-radius: var(--radius-lg);
    color: var(--danger-ink);
}

.health-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--space-4);
}

.health-card {
    background: var(--card-bg, rgba(255, 255, 255, 0.04));
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: border-color var(--motion-base);
}

.health-card:hover {
    border-color: var(--primary-color);
}

.health-card-sm {
    grid-column: span 1;
}

.health-card-header {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-4);
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
    background: var(--raise-1);
    border-bottom: 1px solid var(--border-color, rgba(255, 255, 255, 0.06));
}

.health-card-header svg {
    opacity: 0.7;
}

.health-card-body {
    padding: var(--space-4);
}

.health-metric-main {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.1;
    color: var(--text-primary);
}

.health-metric-sub {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-top: var(--space-0-5);
}

.health-val-warn {
    color: var(--warning-ink) !important;
}

.health-val-crit {
    color: var(--danger-ink) !important;
}

.health-ok {
    color: var(--success-ink);
}

.health-err {
    color: var(--danger-ink);
}

.health-metric-details {
    display: flex;
    justify-content: space-between;
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-top: var(--space-2);
    gap: var(--space-2);
}

.health-metric-row {
    display: flex;
    gap: var(--space-6);
}

.health-metric-block {
    flex: 1;
}

.health-progress-bar {
    height: 6px;
    background: var(--raise-3);
    border-radius: var(--radius-xs);
    margin-top: var(--space-2-5);
    overflow: hidden;
}

.health-progress-fill {
    height: 100%;
    border-radius: var(--radius-xs);
    background: var(--accent-primary, var(--primary-color));
    transition: width var(--motion-slower) var(--ease-standard);
}

.health-progress-fill.fill-warn {
    background: var(--warning);
}

.health-progress-fill.fill-crit {
    background: var(--danger);
}

.health-sse-channels {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1-5);
    margin-top: var(--space-2);
}

.health-sse-ch {
    display: inline-block;
    padding: var(--space-0-5) var(--space-2);
    font-size: 0.7rem;
    background: var(--raise-2);
    border-radius: var(--radius-xs);
    color: var(--text-secondary);
    font-family: var(--font-mono);
}

/* Light theme overrides for health dashboard */
[data-theme="light"] .health-card {
    background: var(--surface-solid);
    border-color: var(--border-subtle);
}

[data-theme="light"] .health-card:hover {
    border-color: var(--primary-color);
}

[data-theme="light"] .health-card-header {
    background: var(--raise-1);
    border-bottom-color: var(--hairline-faint);
}

[data-theme="light"] .health-progress-bar {
    background: var(--raise-3);
}

[data-theme="light"] .health-sse-ch {
    background: var(--raise-3);
}

[data-theme="light"] .health-error {
    background: var(--danger-wash);
}

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

    .health-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .health-metric-main {
        font-size: 1.6rem;
    }
}

/* ============================================================================
   DUAL COST CHECKBOXES & INVOICE PANEL
   ============================================================================ */

/* Cost checkbox labels in settings */
.cost-check-label {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--card-text);
    padding: var(--space-1-5) 0;
}

.cost-check-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary-color);
    cursor: pointer;
}

/* Invoice actions bar in settings */
.invoice-actions-bar {
    padding: var(--space-1) 0;
}

/* btn-gold */
.btn-gold {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: var(--gsx-on-brand);
    border: none;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: var(--space-1-5);
}

.btn-gold:hover {
    opacity: 0.9;
}

.btn-gold:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Invoice page header */
.invoice-page-header {
    margin-bottom: var(--space-6);
}

.invoice-page-header .btn-back {
    margin-bottom: var(--space-4);
}

.invoice-page-title {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.invoice-page-title svg {
    color: var(--brand-ink);
    flex-shrink: 0;
}

.invoice-page-title h2 {
    font-size: 1.5rem;
    font-weight: 800;
    margin: 0;
    color: var(--card-text);
}

.invoice-page-title .section-subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: var(--space-0-5);
}

/* Invoice summary bar */
.invoice-summary-bar {
    display: flex;
    gap: 0;
    background: var(--border-subtle);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

/* Invoice page actions */
.invoice-page-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: var(--space-5);
    padding: var(--space-4) 0;
}

.invoice-page-actions-info {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 600;
}

.invoice-page-actions-buttons {
    display: flex;
    gap: var(--space-2);
}

.inv-summary-item {
    flex: 1;
    text-align: center;
    padding: var(--space-4) var(--space-3);
    background: var(--charcoal-light);
}

.inv-summary-val {
    display: block;
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--card-text);
}

.inv-summary-val.draft {
    color: var(--text-muted);
}

.inv-summary-val.sent {
    color: var(--bogey-ink);
}

.inv-summary-val.paid {
    color: var(--success-ink);
}

.inv-summary-label {
    display: block;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-top: var(--space-0-5);
}

/* Invoice table */
.invoice-list {
    overflow-x: auto;
}

.invoice-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}

.invoice-table th {
    position: sticky;
    top: 0;
    background: var(--charcoal);
    color: var(--brand-ink);
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: var(--space-2-5) var(--space-2);
    text-align: left;
    border-bottom: 2px solid var(--border-strong);
    z-index: 1;
}

.invoice-table td {
    padding: var(--space-2-5) var(--space-2);
    border-bottom: 1px solid var(--border-subtle);
    vertical-align: middle;
    color: var(--card-text);
}

.invoice-table tr:hover td {
    background: var(--raise-1);
}

.inv-row-clickable {
    cursor: pointer;
}

.inv-row-clickable:hover td {
    background: rgba(var(--gsx-brand-rgb), 0.08) !important;
}

.inv-school {
    font-weight: 700;
}

.inv-coach {
    font-size: 0.78rem;
}

.inv-email {
    font-size: 0.68rem;
    color: var(--text-muted);
}

.inv-num {
    text-align: center;
    font-weight: 600;
}

.inv-money {
    text-align: right;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.inv-total {
    font-weight: 800;
    color: var(--brand-ink);
}

.inv-adj {
    color: var(--text-muted);
}

/* Status badges */
.inv-status-badge {
    display: inline-block;
    padding: var(--space-0-5) var(--space-2);
    border-radius: var(--radius-lg);
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.inv-status-badge.inv-draft {
    background: var(--raise-3);
    color: var(--text-muted);
}

.inv-status-badge.inv-sent {
    background: var(--warning-wash);
    color: var(--bogey-ink);
}

.inv-status-badge.inv-paid {
    background: var(--success-wash);
    color: var(--success-ink);
}

.inv-status-badge.inv-waived {
    background: var(--info-wash);
    color: var(--info-ink);
}

.inv-status-badge.inv-void {
    background: var(--danger-wash);
    color: var(--double-ink);
}

/* Paid row subtle green tint */
tr.inv-paid td {
    background: var(--success-wash);
}

tr.inv-waived td {
    background: var(--info-wash);
}

/* Action buttons */
.inv-actions {
    display: flex;
    gap: var(--space-1);
    min-width: 90px;
    justify-content: flex-end;
}

.btn-icon-sm {
    background: none;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: var(--space-1) var(--space-1-5);
    cursor: pointer;
    color: var(--text-muted);
    transition: all var(--motion-fast);
}

.btn-icon-sm:hover {
    color: var(--brand-ink);
    border-color: var(--primary-color);
    background: rgba(var(--gsx-brand-rgb), 0.08);
}

.btn-icon-sm.inv-btn-paid:hover {
    color: var(--success-ink);
    border-color: var(--success);
    background: var(--success-wash);
}

.btn-icon-sm.inv-btn-send:hover {
    color: var(--info-ink);
    border-color: var(--info);
    background: var(--info-wash);
}

/* Light theme */
[data-theme="light"] .invoice-summary-bar {
    background: var(--gray);
}

[data-theme="light"] .inv-summary-item {
    background: var(--surface-solid);
}

[data-theme="light"] .invoice-table th {
    background: var(--gray-light);
    border-bottom-color: var(--gray);
}

[data-theme="light"] .invoice-table td {
    border-bottom-color: var(--gray-light);
}

[data-theme="light"] .invoice-table tr:hover td {
    background: var(--raise-1);
}

[data-theme="light"] .inv-row-clickable:hover td {
    background: rgba(var(--gsx-brand-rgb), 0.06) !important;
}

[data-theme="light"] .inv-status-badge.inv-draft {
    background: var(--gray-light);
    color: var(--text-muted);
}

[data-theme="light"] .btn-icon-sm {
    border-color: var(--gray);
}

[data-theme="light"] .btn-icon-sm:hover {
    background: rgba(var(--gsx-brand-rgb), 0.06);
}

@media (max-width: 600px) {
    .invoice-table {
        font-size: 0.72rem;
    }

    .invoice-table th,
    .invoice-table td {
        padding: var(--space-2) var(--space-1);
    }

    .inv-summary-val {
        font-size: 1.1rem;
    }

    .invoice-summary-bar {
        flex-wrap: wrap;
    }

    .invoice-page-title h2 {
        font-size: 1.2rem;
    }

    .invoice-page-actions {
        flex-direction: column;
        gap: var(--space-3);
        align-items: stretch;
    }

    .invoice-page-actions-buttons {
        justify-content: flex-end;
    }
}

/* ══════════════════════════════════════════════════════
   Help Guide Slide-Out Drawer
   ══════════════════════════════════════════════════════ */

/* Half-circle tab — tucked into right edge of screen */
.guide-help-fab {
    position: fixed;
    top: 50%;
    right: 0;
    transform: translateY(-50%);
    z-index: var(--z-floating-btn);
    width: 28px;
    height: 48px;
    border-radius: 24px 0 0 24px;
    border: none;
    background: var(--primary-color);
    color: var(--gsx-on-brand);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-left: var(--space-0-5);
    padding-right: 0;
    box-shadow: var(--shadow-md);
    transition: width var(--motion-fast), box-shadow var(--motion-fast);
    opacity: 0.75;
}

.guide-help-fab svg {
    width: 18px;
    height: 18px;
}

.guide-help-fab:hover {
    width: 34px;
    box-shadow: var(--shadow-lg);
    opacity: 1;
}

.guide-help-fab:active {
    width: 26px;
}

body.login-active .guide-help-fab {
    display: none;
}

/* Mobile: hide — the info-drawer-tab serves this role */
@media (max-width: 768px) {
    .guide-help-fab {
        display: none !important;
    }
}

/* Overlay behind drawer */
.guide-overlay {
    position: fixed;
    inset: 0;
    z-index: var(--z-modal-backdrop);
    background: var(--scrim-soft);
    backdrop-filter: blur(2px);
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--motion-base), visibility var(--motion-base);
}

.guide-overlay.open {
    opacity: 1;
    visibility: visible;
}

/* The drawer panel */
.guide-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: var(--z-modal);
    width: 380px;
    max-width: 92vw;
    background: var(--bg-primary);
    border-left: 1px solid var(--border-color);
    box-shadow: -4px 0 24px var(--shadow-color);
    transform: translateX(100%);
    transition: transform var(--motion-slow) var(--ease-standard);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.guide-drawer.open {
    transform: translateX(0);
}

/* Drawer header */
.guide-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
    flex-shrink: 0;
}

.guide-drawer-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--brand-ink);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.guide-drawer-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.6rem;
    cursor: pointer;
    line-height: 1;
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-sm);
    transition: background var(--motion-fast), color var(--motion-fast);
}

.guide-drawer-close:hover {
    background: var(--hover-bg);
    color: var(--text-primary);
}

/* Drawer body — scrollable content */
.guide-drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-5);
    font-size: 0.88rem;
    line-height: 1.65;
    color: var(--text-primary);
}

/* Guide content styling */
.guide-section {
    margin-bottom: var(--space-6);
}

.guide-section:last-child {
    margin-bottom: 0;
}

.guide-section-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--brand-ink);
    margin-bottom: var(--space-2);
    display: flex;
    align-items: center;
    gap: var(--space-1-5);
}

.guide-section p {
    margin: 0 0 var(--space-2);
    color: var(--text-primary);
}

.guide-section ul {
    margin: 0 0 var(--space-2);
    padding-left: var(--space-4);
}

.guide-section ul li {
    margin-bottom: var(--space-1-5);
    color: var(--text-primary);
}

.guide-section ul li strong {
    color: var(--brand-ink);
}

.guide-tip {
    background: rgba(var(--gsx-brand-rgb), 0.08);
    border-left: 3px solid var(--primary-color);
    padding: var(--space-2-5) var(--space-3-5);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    margin: var(--space-2-5) 0;
    font-size: 0.84rem;
    color: var(--text-primary);
}

.guide-tip strong {
    color: var(--brand-ink);
}

.guide-divider {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: var(--space-4) 0;
}

.guide-kbd {
    display: inline-block;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xs);
    padding: 0 var(--space-1-5);
    font-size: 0.78rem;
    font-family: var(--font-mono);
    color: var(--text-secondary);
}

/* Accordion within guide */
.guide-accordion {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-bottom: var(--space-2-5);
}

.guide-accordion-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-2-5) var(--space-3-5);
    background: var(--bg-secondary);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.86rem;
    color: var(--text-primary);
    border: none;
    width: 100%;
    text-align: left;
    transition: background var(--motion-fast);
}

.guide-accordion-header:hover {
    background: var(--hover-bg);
}

.guide-accordion-header .guide-chevron {
    transition: transform var(--motion-base);
    color: var(--text-secondary);
    font-size: 0.75rem;
}

.guide-accordion.open .guide-accordion-header .guide-chevron {
    transform: rotate(90deg);
}

.guide-accordion-body {
    display: none;
    padding: var(--space-3) var(--space-3-5);
    font-size: 0.84rem;
    line-height: 1.6;
}

.guide-accordion.open .guide-accordion-body {
    display: block;
}

/* Mobile adjustments */
@media (max-width: 600px) {
    .guide-drawer {
        width: 100vw;
        max-width: 100vw;
    }

    .guide-drawer-body {
        padding: var(--space-4);
    }
}

/* ======================================================================
   ENGAGEMENT: Follow button, engagement badges, check-in roster
   ====================================================================== */

/* Follow tournament button */
.action-btn-follow {
    background: rgba(var(--gsx-brand-rgb), 0.12);
    color: var(--brand-ink);
    border: 1px solid rgba(var(--gsx-brand-rgb), 0.3);
    transition: all var(--motion-base);
}

.action-btn-follow:hover {
    background: rgba(var(--gsx-brand-rgb), 0.25);
}

.action-btn-follow.following {
    background: var(--danger-wash);
    color: var(--danger-ink);
    border-color: var(--danger-wash-border);
}

.action-btn-follow.following svg {
    fill: var(--danger-ink);
}

.action-btn-follow.following:hover {
    background: var(--danger-wash);
    filter: brightness(1.12);
}

/* Engagement badges in tournament header */
.engagement-badges {
    display: flex;
    align-items: center;
    gap: var(--space-2-5);
    margin-left: var(--space-1);
}

.engagement-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
    padding: var(--space-0-5) var(--space-2);
    border-radius: var(--radius-xl);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
}

.engagement-badge svg {
    opacity: 0.7;
}

#engagementFollowers svg {
    stroke: var(--danger-ink);
}

#engagementCheckins svg {
    stroke: var(--green);
}

/* Check-ins sub-tab panel */
.live-checkins-panel {
    padding: 0;
}

.checkins-summary {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
    padding: var(--space-3) 0;
}

.checkins-summary-card {
    flex: 1;
    min-width: 100px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--space-2-5) var(--space-3-5);
    text-align: center;
}

.checkins-summary-val {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

.checkins-summary-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-top: var(--space-1);
}

.checkins-summary-card.green .checkins-summary-val {
    color: var(--success-ink);
}

.checkins-summary-card.red .checkins-summary-val {
    color: var(--danger-ink);
}

.checkins-filter-bar {
    display: flex;
    gap: var(--space-2);
    padding: var(--space-2) 0;
    flex-wrap: wrap;
}

.checkins-roster {
    display: flex;
    flex-direction: column;
    gap: var(--space-0-5);
}

.checkin-row {
    display: flex;
    align-items: center;
    gap: var(--space-2-5);
    padding: var(--space-2) var(--space-2-5);
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    font-size: 0.82rem;
    transition: background var(--motion-fast);
}

.checkin-row:hover {
    background: var(--bg-tertiary, var(--bg-secondary));
}

.checkin-row .checkin-status-icon {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    flex-shrink: 0;
}

.checkin-row .checkin-status-icon.checked {
    background: var(--success-wash);
    color: var(--success-ink);
}

.checkin-row .checkin-status-icon.not-checked {
    background: var(--danger-wash);
    color: var(--danger-ink);
}

.checkin-row .checkin-player-info {
    flex: 1;
    min-width: 0;
}

.checkin-row .checkin-player-name {
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.checkin-row .checkin-player-school {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.checkin-row .checkin-time {
    font-size: 0.72rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.checkin-row .checkin-action {
    flex-shrink: 0;
}

/* Aligned to the unified button system (01-foundation .btn-sm is canonical);
   this later-cascade duplicate must carry the SAME metrics or it wins. */
.btn-sm {
    min-height: var(--gsx-control-height-sm);
    padding: 0 var(--space-2-5);
    font-size: 0.82rem;
    border-radius: var(--gsx-control-radius);
    border: 1px solid transparent;
    cursor: pointer;
    font-weight: 700;
}

.btn-gold {
    background: var(--gold);
    color: var(--gsx-on-brand);
}

.btn-gold:hover {
    opacity: 0.85;
}

.btn-sm-checkin {
    background: var(--success-wash);
    color: var(--success-ink);
    min-height: 1.6rem;
    padding: 0 var(--space-2-5);
    font-size: 0.72rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--success-wash-border);
    cursor: pointer;
    font-weight: 600;
}

.btn-sm-checkin:hover {
    background: var(--success-wash);
    filter: brightness(1.12);
}

/* Engagement stat cards in live stats row */
.live-stat-card.engagement {
    border-color: rgba(var(--gsx-brand-rgb), 0.3);
    cursor: default;
}

.live-stat-card.engagement .live-stat-val {
    color: var(--brand-ink);
}

@media (max-width: 600px) {
    .engagement-badges {
        gap: var(--space-1-5);
        margin-left: 0;
    }

    .checkins-summary {
        gap: var(--space-2);
    }

    .checkins-summary-card {
        min-width: 70px;
        padding: var(--space-2) var(--space-2-5);
    }

    .checkins-summary-val {
        font-size: 1.2rem;
    }
}

/* ── Pairing Status Menu (dropdown for SCR/DQ/DNF) ── */
.pairing-status-menu {
    position: fixed;
    z-index: var(--z-modal);
    background: var(--card-bg, #1a1a2e);
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.1));
    border-radius: var(--radius-md);
    padding: var(--space-1);
    display: flex;
    gap: var(--space-0-5);
    box-shadow: var(--shadow-md);
}

.pairing-status-menu button {
    background: transparent;
    border: none;
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-sm);
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--motion-fast);
}

.pairing-status-menu button:hover {
    background: var(--raise-3);
}

/* ── Live Dashboard Status/Settings Icon ── */
.live-status-icon {
    cursor: pointer;
    font-size: 0.72rem;
    opacity: 0.5;
    margin-left: var(--space-0-5);
    transition: opacity var(--motion-fast);
}

.live-status-icon:hover {
    opacity: 1;
}

/* ═══════════════════════════════════════════════════════════════════════
   BILLING & FINANCE
   ═══════════════════════════════════════════════════════════════════════ */

/* Summary Cards Row */
.billing-summary-cards {
    display: flex;
    gap: 0;
    background: var(--border-subtle);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: var(--space-5);
}

.billing-card {
    flex: 1;
    text-align: center;
    padding: var(--space-4) var(--space-3);
    background: var(--charcoal-light);
}

.billing-card-label {
    display: block;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-top: var(--space-0-5);
}

.billing-card-value {
    display: block;
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--card-text);
}

.billing-val-invoiced {
    color: var(--bogey-ink);
}

.billing-val-paid {
    color: var(--success-ink);
}

.billing-val-outstanding {
    color: var(--double-ink);
}

/* Billing Table */
.billing-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.billing-table th,
.billing-table td {
    padding: var(--space-2-5) var(--space-3);
    text-align: left;
    border-bottom: 1px solid var(--border-subtle);
}

.billing-table th {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    font-weight: 700;
    color: var(--text-muted);
    background: var(--charcoal-light);
}

.billing-table th.num,
.billing-table td.num {
    text-align: right;
}

.billing-table tbody tr {
    transition: background var(--motion-instant);
}

.billing-table tbody tr:hover {
    background: var(--charcoal-light);
}

.billing-tourn-name {
    font-weight: 700;
    color: var(--card-text);
    cursor: pointer;
}

.billing-tourn-name:hover {
    text-decoration: underline;
    color: var(--brand-ink);
}

.billing-date {
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* Status Badges */
.billing-status-badge {
    display: inline-block;
    padding: var(--space-0-5) var(--space-2-5);
    border-radius: var(--radius-xl);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.billing-status-complete {
    background: var(--success-wash);
    color: var(--success-ink);
}

.billing-status-partial {
    background: var(--warning-wash);
    color: var(--bogey-ink);
}

.billing-status-open {
    background: var(--danger-wash);
    color: var(--double-ink);
}

/* Period Selector */
.billing-period-selector {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-5);
    flex-wrap: wrap;
}

.billing-period-tabs {
    display: flex;
    gap: 0;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border-subtle);
}

.billing-tab {
    padding: var(--space-2) var(--space-4);
    font-size: 0.8rem;
    font-weight: 600;
    border: none;
    background: transparent;
    color: var(--card-text);
    cursor: pointer;
    transition: all var(--motion-fast);
}

.billing-tab:hover {
    background: var(--charcoal-light);
}

.billing-tab.active {
    background: var(--primary-color);
    color: var(--gsx-on-brand);
    font-weight: 700;
}

.billing-year-select {
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    background: var(--charcoal-light);
    color: var(--card-text);
    font-size: 0.85rem;
    font-weight: 600;
}

/* Responsive: Stack cards on mobile */
@media (max-width: 600px) {
    .billing-summary-cards {
        flex-direction: column;
    }

    .billing-card-value {
        font-size: 1.15rem;
    }

    .billing-period-selector {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* ═══════════════════════════════════════════════════════════════════════
   SUBSCRIPTION BILLING (Superadmin)
   ═══════════════════════════════════════════════════════════════════════ */

/* Tab navigation — matches billing-tab pattern */
.sub-billing-tabs {
    display: flex;
    gap: 0;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border-color);
    margin-bottom: var(--space-5);
    width: fit-content;
}

.sub-billing-tab {
    padding: var(--space-2) var(--space-4);
    font-size: 0.8rem;
    font-weight: 600;
    border: none;
    background: transparent;
    color: var(--card-text);
    cursor: pointer;
    transition: all var(--motion-fast);
    border-right: 1px solid var(--border-color);
}

.sub-billing-tab:last-child {
    border-right: none;
}

.sub-billing-tab:hover {
    background: var(--charcoal-light);
}

.sub-billing-tab.active {
    background: var(--primary-color);
    color: var(--gsx-on-brand);
    font-weight: 700;
}

/* KPI Cards — matches billing-summary-cards pattern */
.sub-billing-cards {
    display: flex;
    gap: 0;
    background: var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: var(--space-5);
}

.sub-billing-card {
    flex: 1;
    text-align: center;
    padding: var(--space-4) var(--space-3);
    background: var(--card-bg);
}

.sub-billing-card-value {
    display: block;
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--card-text);
}

.sub-billing-card-label {
    display: block;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-top: var(--space-0-5);
}

.sub-val-revenue {
    color: var(--success-ink);
}

.sub-val-warn {
    color: var(--double-ink);
}

/* Status chips */
.sub-billing-status-strip {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-bottom: var(--space-5);
}

.sub-status-chip {
    display: inline-block;
    padding: var(--space-0-5) var(--space-2-5);
    border-radius: var(--radius-xl);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.sub-status-active {
    background: var(--success-wash);
    color: var(--success-ink);
}

.sub-status-trial {
    background: var(--info-wash);
    color: var(--info-ink);
}

.sub-status-pastdue {
    background: var(--danger-wash);
    color: var(--double-ink);
}

.sub-status-cancelled {
    background: rgba(149, 165, 166, 0.15); /* tokens-allow: neutral legacy gray */
    color: var(--text-secondary);
}

.sub-status-expired {
    background: rgba(149, 165, 166, 0.15); /* tokens-allow: neutral legacy gray */
    color: var(--text-secondary);
}

.sub-status-comped {
    background: rgba(142, 68, 173, 0.12); /* tokens-allow: comped purple, no token */
    color: #8e44ad; /* tokens-allow: comped purple, no token */
}

/* Table — matches billing-table pattern */
.sub-billing-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.sub-billing-table th,
.sub-billing-table td {
    padding: var(--space-2-5) var(--space-3);
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.sub-billing-table th {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    font-weight: 700;
    color: var(--text-muted);
    background: var(--charcoal-light);
}

.sub-billing-table th.num,
.sub-billing-table td.num {
    text-align: right;
}

.sub-billing-table tbody tr {
    transition: background var(--motion-instant);
}

.sub-billing-table tbody tr:hover {
    background: var(--charcoal-light);
}

/* Filters bar */
.sub-billing-filters {
    display: flex;
    align-items: center;
    gap: var(--space-2-5);
    flex-wrap: wrap;
    margin-bottom: var(--space-4);
}

.sub-billing-filters .form-input {
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    color: var(--card-text);
    font-size: 0.85rem;
}

/* Pagination */
.sub-billing-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-3);
    margin-top: var(--space-4);
    padding: var(--space-3) 0;
}

/* Subscriber detail labels */
.sub-detail-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: var(--space-0-5);
}

.sub-detail-value {
    color: var(--card-text);
    font-weight: 600;
}

/* Responsive */
@media (max-width: 600px) {
    .sub-billing-cards {
        flex-direction: column;
    }

    .sub-billing-card-value {
        font-size: 1.15rem;
    }

    .sub-billing-tabs {
        flex-wrap: wrap;
    }

    .sub-billing-filters {
        flex-direction: column;
        align-items: stretch;
    }

    .sub-billing-filters .form-input {
        max-width: none !important;
    }
}


/* ============================================================================
   SIMULATIONS
   ============================================================================ */

.sim-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    padding: var(--space-4);
}

.sim-card {
    background: var(--card-bg, #1a1f2e);
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
    border-radius: var(--radius-xl);
    padding: var(--space-4) var(--space-5);
    transition: border-color var(--motion-base);
}

.sim-card.sim-active {
    border-color: var(--success-wash-border);
}

.sim-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-2);
}

.sim-card-header .badge {
    font-size: 0.7rem;
    padding: var(--space-1) var(--space-2-5);
    border-radius: var(--radius-sm);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.badge-live {
    background: var(--success-wash);
    color: var(--birdie-ink);
    border: 1px solid var(--success-wash-border);
}

.badge-completed {
    background: rgba(149, 165, 166, 0.15); /* tokens-allow: neutral gray badge */
    color: var(--text-muted);
    border: 1px solid rgba(149, 165, 166, 0.3); /* tokens-allow: neutral gray badge */
}

.sim-time-left {
    font-size: 0.8rem;
    color: var(--birdie-ink);
    margin-left: var(--space-2);
    font-weight: 500;
}

.sim-card-actions {
    display: flex;
    gap: var(--space-2);
}

.sim-card-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: var(--space-1-5);
    color: var(--text-primary, #fff);
}

.sim-card-meta {
    display: flex;
    gap: var(--space-4);
    font-size: 0.8rem;
    color: var(--text-muted, #888);
}

.sim-player-list {
    max-height: 280px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--space-1);
    background: var(--surface-sunken);
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    align-content: start;
}

.sim-player-row {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-0-5) var(--space-1-5);
    border-radius: var(--radius-xs);
    cursor: pointer;
    transition: background var(--motion-fast);
    font-size: 0.78rem;
    line-height: 1.2;
    min-width: 0;
}

.sim-player-row:hover {
    background: var(--raise-2);
}

.sim-player-row input[type="checkbox"] {
    accent-color: var(--primary-color);
    width: 13px;
    height: 13px;
    flex-shrink: 0;
    margin: 0;
}

.sim-player-name {
    font-weight: 500;
    flex: 1;
    color: var(--card-text, #e0e0e0);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.sim-player-info {
    font-size: 0.72rem;
    color: var(--text-muted, #888);
    flex-shrink: 0;
}

.sim-player-gender-tag {
    font-size: 0.6rem;
    font-weight: 700;
    padding: var(--space-0-5) var(--space-1);
    border-radius: var(--radius-xs);
    text-transform: uppercase;
    flex-shrink: 0;
    line-height: 1;
}

.sim-player-gender-tag.boys {
    color: var(--gender-boys);
    background: var(--gender-boys-wash);
}

.sim-player-gender-tag.girls {
    color: var(--gender-girls);
    background: var(--gender-girls-wash);
}

.sim-player-count {
    font-size: 0.72rem;
    color: var(--text-muted, #888);
    text-align: right;
    padding: var(--space-1) var(--space-1) 0;
}

/* Sim bulk select/deselect buttons */
.sim-bulk-btn {
    padding: var(--space-0-5) var(--space-2);
    font-size: 0.7rem;
    font-weight: 600;
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.12));
    border-radius: var(--radius-xs);
    background: transparent;
    color: var(--text-muted, #888);
    cursor: pointer;
    transition: all var(--motion-fast);
    white-space: nowrap;
}

.sim-bulk-btn:hover {
    background: var(--raise-3);
    color: var(--card-text);
    border-color: var(--border-medium);
}

[data-theme="light"] .sim-bulk-btn {
    color: var(--text-secondary);
    border-color: var(--gray);
}

[data-theme="light"] .sim-bulk-btn:hover {
    background: var(--raise-2);
    color: var(--text-primary);
}

/* Fall back to single column on very narrow screens */
@media (max-width: 480px) {
    .sim-player-list {
        grid-template-columns: 1fr;
    }
}

/* Sim modal form controls */
.sim-form-label {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted, #aaa);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-bottom: var(--space-1);
}

.sim-form-input {
    display: block;
    width: 100%;
    padding: var(--space-2) var(--space-2-5);
    font-size: 0.88rem;
    color: var(--card-text, #e0e0e0);
    background: var(--raise-3);
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.15));
    border-radius: var(--radius-sm);
    outline: none;
    transition: border-color var(--motion-fast);
    box-sizing: border-box;
}

.sim-form-input:focus {
    border-color: var(--primary-color);
}

select.sim-form-input {
    appearance: auto;
}

/* Sim gender filter tabs — matches gender-toggle-bar pattern */
.sim-gender-tabs {
    display: inline-flex;
    background: var(--raise-2);
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.12));
}

.sim-gender-tab {
    padding: var(--space-1) var(--space-2-5);
    font-size: 0.72rem;
    font-weight: 600;
    border: none;
    background: transparent;
    color: var(--text-muted, #888);
    cursor: pointer;
    transition: all var(--motion-fast);
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.sim-gender-tab:not(:last-child) {
    border-right: 1px solid var(--border-color, rgba(255, 255, 255, 0.1));
}

.sim-gender-tab.active {
    background: var(--primary-color);
    color: var(--gsx-on-brand);
    font-weight: 700;
}

.sim-gender-tab:hover:not(.active) {
    background: var(--raise-3);
    color: var(--card-text, #e0e0e0);
}

/* Light mode overrides for sim modal */
[data-theme="light"] .sim-player-list {
    background: var(--raise-1);
}

[data-theme="light"] .sim-player-row:hover {
    background: var(--raise-2);
}

[data-theme="light"] .sim-form-input {
    background: var(--surface-solid);
    color: var(--text-primary);
    border-color: var(--gray);
}

[data-theme="light"] .sim-gender-tabs {
    background: var(--raise-2);
    border-color: var(--gray);
}

[data-theme="light"] .sim-gender-tab {
    color: var(--text-secondary);
}

[data-theme="light"] .sim-gender-tab:not(:last-child) {
    border-right-color: var(--gray);
}

[data-theme="light"] .sim-gender-tab.active {
    background: var(--primary-color);
    color: var(--gsx-on-brand);
}

[data-theme="light"] .sim-player-name {
    color: var(--text-primary);
}

/* .btn-danger-outline now canonical in 01-foundation.css. */

.btn-xs {
    padding: 0 var(--space-2);
    font-size: 0.72rem;
    min-height: 1.6rem;
    border-radius: var(--radius-md);
}

/* ===================================================================
   COACH RESULTS — VIEW TOGGLE, FILTERS, GROUPS, HOLE CHIPS
   =================================================================== */

/* View toggle (Your School / Overall Tournament) */
.cr-view-toggle {
    display: flex;
    gap: 0;
    padding: var(--space-3) var(--space-4) 0;
    background: var(--bg-secondary, #1a1a2e);
}

.cr-view-btn {
    padding: var(--space-1-5) var(--space-5);
    font-size: 0.82rem;
    font-weight: 600;
    border: 1px solid var(--border-color, #333);
    background: transparent;
    color: var(--text-secondary, #aaa);
    cursor: pointer;
    transition: all var(--motion-fast);
}

.cr-view-btn:first-child {
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}

.cr-view-btn:last-child {
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    border-left: none;
}

.cr-view-btn.active {
    background: var(--primary-color);
    color: var(--gsx-on-brand);
    border-color: var(--primary-color);
}

.cr-view-btn:not(.active):hover {
    background: var(--hover-bg, rgba(255, 255, 255, 0.08));
}

.cr-filters {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-4);
    background: var(--bg-secondary, #1a1a2e);
    border-bottom: 1px solid var(--border-color, #333);
    align-items: center;
}

.cr-filter-input,
.cr-filter-select {
    background: var(--bg-tertiary, #16213e);
    border: 1px solid var(--border-color, #333);
    color: var(--text-primary, #e0e0e0);
    border-radius: var(--radius-sm);
    padding: var(--space-1-5) var(--space-2-5);
    font-size: 0.8rem;
    min-width: 0;
}

.cr-filter-input {
    flex: 1 1 140px;
    max-width: 200px;
}

.cr-filter-select {
    flex: 0 1 150px;
}

.cr-filter-input:focus,
.cr-filter-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px var(--info-wash);
}

.cr-toggle-label {
    display: flex;
    align-items: center;
    gap: var(--space-1-5);
    font-size: 0.8rem;
    color: var(--text-secondary, #aaa);
    white-space: nowrap;
    cursor: pointer;
    margin-left: auto;
}

.cr-toggle-label input[type="checkbox"] {
    accent-color: var(--primary-color);
}

/* Results table */
.cr-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.cr-table thead tr {
    border-bottom: 2px solid var(--border-color, #333);
}

.cr-table th {
    padding: var(--space-1-5) var(--space-2);
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary, #aaa);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.cr-table td {
    padding: var(--space-1-5) var(--space-2);
}

.cr-table tbody tr {
    border-bottom: 1px solid var(--border-color, #333);
}

.cr-table tbody tr:hover {
    background: var(--bg-hover, rgba(255, 255, 255, 0.03));
}

.cr-rank {
    color: var(--text-muted, #666);
}

.cr-player {
    font-weight: 500;
}

.cr-school {
    color: var(--text-muted, #888);
}

.cr-team-tag {
    font-size: 0.7rem;
    color: var(--text-muted, #888);
}

.cr-par {
    text-align: right;
    font-weight: 600;
}

.cr-over {
    color: var(--danger-ink);
}

.cr-under {
    color: var(--success-ink);
}

/* DNF tag inside player name column */
.cr-dnf-tag {
    display: inline-block;
    font-size: 0.6rem;
    font-weight: 700;
    padding: var(--space-0-5) var(--space-1-5);
    border-radius: var(--radius-xs);
    background: var(--warning);
    color: var(--on-warning);
    vertical-align: middle;
    margin-left: var(--space-1);
    letter-spacing: 0.04em;
}

/* DNF table group wrapper */
.cr-status-dnf-table {
    margin: var(--space-3) 0 var(--space-2);
    padding: var(--space-2) 0;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color, #333);
    border-left: 3px solid var(--warning-color, #f39c12);
    background: var(--bg-secondary, rgba(255, 255, 255, 0.03));
}

.cr-status-dnf-table .cr-status-label {
    padding: 0 var(--space-3) var(--space-1);
}

.cr-status-dnf-table .cr-table {
    opacity: 0.85;
}

.cr-table-dnf tbody tr {
    background: transparent;
}

/* Team standings expandable cards */
.cr-team-card {
    border: 1px solid var(--border-color, #333);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-2);
    overflow: hidden;
    background: var(--card-bg, rgba(58, 58, 58, 0.92));
}

.cr-team-header {
    display: flex;
    align-items: center;
    gap: var(--space-2-5);
    padding: var(--space-2-5) var(--space-3);
    transition: background var(--motion-fast);
}

.cr-team-header:hover {
    background: var(--hover-bg, rgba(255, 255, 255, 0.05));
}

.cr-team-rank {
    font-size: 1rem;
    font-weight: 700;
    color: var(--brand-ink);
    min-width: 1.6rem;
    text-align: center;
}

.cr-team-name {
    flex: 1;
    font-weight: 600;
    font-size: 0.88rem;
}

.cr-team-score {
    font-weight: 700;
    font-size: 0.95rem;
    min-width: 3rem;
    text-align: right;
}

.cr-team-chevron {
    color: var(--text-muted, #666);
    transition: transform var(--motion-base);
    display: flex;
}

.cr-expanded+.cr-team-chevron,
.cr-team-players.cr-expanded~.cr-team-chevron {
    transform: rotate(180deg);
}

/* Chevron rotates when sibling has cr-expanded — use JS toggle on parent */
.cr-team-card:has(.cr-expanded) .cr-team-chevron {
    transform: rotate(180deg);
}

.cr-team-players {
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--motion-base) var(--ease-standard);
}

.cr-team-players.cr-expanded {
    max-height: 500px;
}

.cr-team-player {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-1-5) var(--space-3) var(--space-1-5) var(--space-10);
    font-size: 0.82rem;
    border-top: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.08));
}

.cr-team-player-name {
    flex: 1;
    font-weight: 500;
}

.cr-team-player-score {
    font-weight: 700;
    min-width: 3rem;
    text-align: right;
}

.cr-team-player.cr-not-counting {
    opacity: 0.45;
}

.cr-team-nc-label {
    font-size: 0.65rem;
    color: var(--text-muted, #666);
    font-style: italic;
    white-space: nowrap;
}

/* Status groups (DNF / DNS) */
.cr-status-group {
    margin: var(--space-3) 0 var(--space-2);
    padding: var(--space-2-5) var(--space-3);
    border-radius: var(--radius-md);
    background: var(--bg-secondary, rgba(255, 255, 255, 0.03));
    border: 1px solid var(--border-color, #333);
}

.cr-status-dnf {
    border-left: 3px solid var(--danger-color, var(--double));
}

.cr-status-dns {
    border-left: 3px solid var(--warning-color, #f39c12);
}

.cr-status-label {
    display: flex;
    align-items: center;
    gap: var(--space-1-5);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary, #aaa);
    margin-bottom: var(--space-1-5);
}

.cr-status-count {
    font-weight: 400;
    color: var(--text-muted, #666);
}

.cr-status-players {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1-5);
}

.cr-status-player {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    font-size: 0.78rem;
    color: var(--text-primary);
    background: var(--surface-sunken);
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-xs);
}

.cr-status-tag {
    font-size: 0.65rem;
    font-weight: 700;
    padding: var(--space-0-5) var(--space-1);
    border-radius: var(--radius-xs);
    background: var(--danger-color, var(--double));
    color: var(--on-danger);
}

.cr-status-dns .cr-status-tag {
    background: var(--warning-color, var(--warning));
    color: var(--on-warning);
}

/* Hole-by-hole chips */
.cr-holes-row td {
    padding: var(--space-0-5) var(--space-2) var(--space-2) !important;
    border-bottom: 2px solid var(--border-color, #333) !important;
}

.cr-holes-chips {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-0-5);
    align-items: center;
}

.cr-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: var(--radius-xs);
    font-size: 0.7rem;
    font-weight: 700;
    line-height: 1;
}

.cr-chip-sep {
    color: var(--text-muted, #555);
    font-size: 0.85rem;
    margin: 0 var(--space-0-5);
}

.cr-eagle {
    background: var(--eagle);
    color: var(--on-info);
}

.cr-birdie {
    background: var(--birdie);
    color: var(--on-success);
}

.cr-par {
    background: var(--raise-3);
    color: var(--text-secondary);
}

.cr-bogey {
    background: var(--bogey);
    color: var(--on-warning);
}

.cr-dbl {
    background: var(--double);
    color: var(--on-danger);
}

.cr-empty {
    background: var(--raise-2);
    color: var(--text-muted);
}

/* Mobile tweaks */
@media (max-width: 600px) {
    .cr-filters {
        padding: var(--space-2);
        gap: var(--space-1-5);
    }

    .cr-filter-input {
        max-width: none;
        flex: 1 1 100%;
    }

    .cr-filter-select {
        flex: 1 1 calc(50% - 0.2rem);
    }

    .cr-chip {
        width: 20px;
        height: 20px;
        font-size: 0.6rem;
    }
}

/* ── Light theme overrides for Coach Results ── */
[data-theme="light"] .cr-view-toggle {
    background: var(--bg-secondary);
}

[data-theme="light"] .cr-view-btn {
    border-color: var(--border-color);
    color: var(--text-secondary);
}

[data-theme="light"] .cr-view-btn.active {
    background: var(--primary-color);
    color: var(--gsx-on-brand);
    border-color: var(--primary-color);
}

[data-theme="light"] .cr-view-btn:not(.active):hover {
    background: var(--hover-bg);
}

[data-theme="light"] .cr-filters {
    background: var(--bg-secondary);
    border-bottom-color: var(--border-color);
}

[data-theme="light"] .cr-filter-input,
[data-theme="light"] .cr-filter-select {
    background: var(--surface-solid);
    border-color: var(--border-color);
    color: var(--text-primary);
}

[data-theme="light"] .cr-filter-input:focus,
[data-theme="light"] .cr-filter-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px var(--info-wash);
}

[data-theme="light"] .cr-toggle-label {
    color: var(--text-secondary);
}

[data-theme="light"] .cr-table th {
    color: var(--text-secondary);
    border-bottom-color: var(--border-color);
}

[data-theme="light"] .cr-table thead tr {
    border-bottom-color: var(--border-color);
}

[data-theme="light"] .cr-table tbody tr {
    border-bottom-color: var(--border-color);
}

[data-theme="light"] .cr-table tbody tr:hover {
    background: var(--hover-bg);
}

[data-theme="light"] .cr-rank {
    color: var(--text-muted);
}

[data-theme="light"] .cr-school {
    color: var(--text-muted);
}

[data-theme="light"] .cr-team-tag {
    color: var(--text-muted);
}

[data-theme="light"] .cr-over {
    color: var(--danger-ink);
}

[data-theme="light"] .cr-under {
    color: var(--success-ink);
}

[data-theme="light"] .cr-status-group {
    background: var(--bg-secondary);
    border-color: var(--border-color);
}

[data-theme="light"] .cr-status-dnf-table {
    background: var(--bg-secondary);
    border-color: var(--border-color);
    border-left-color: var(--warning);
}

[data-theme="light"] .cr-team-card {
    background: var(--surface-solid);
    border-color: var(--border-color);
}

[data-theme="light"] .cr-team-header:hover {
    background: var(--hover-bg);
}

[data-theme="light"] .cr-team-player {
    border-top-color: var(--border-subtle);
}

[data-theme="light"] .cr-team-nc-label {
    color: var(--text-muted);
}

[data-theme="light"] .cr-status-label {
    color: var(--text-secondary);
}

[data-theme="light"] .cr-status-count {
    color: var(--text-muted);
}

[data-theme="light"] .cr-status-player {
    background: var(--surface-solid);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

[data-theme="light"] .cr-status-tag {
    background: var(--double);
    color: var(--on-danger);
}

[data-theme="light"] .cr-status-dns .cr-status-tag {
    background: var(--warning);
    color: var(--on-warning);
}

[data-theme="light"] .cr-dnf-tag {
    background: var(--warning);
    color: var(--on-warning);
}

[data-theme="light"] .cr-holes-row td {
    border-bottom-color: var(--border-color) !important;
}

[data-theme="light"] .cr-chip-sep {
    color: var(--text-muted);
}

[data-theme="light"] .cr-eagle {
    background: var(--eagle);
    color: var(--on-info);
}

[data-theme="light"] .cr-birdie {
    background: var(--birdie);
    color: var(--on-success);
}

[data-theme="light"] .cr-par {
    background: var(--raise-2);
    color: var(--text-secondary);
}

[data-theme="light"] .cr-bogey {
    background: var(--bogey);
    color: var(--on-warning);
}

[data-theme="light"] .cr-dbl {
    background: var(--double);
    color: var(--on-danger);
}

[data-theme="light"] .cr-empty {
    background: var(--raise-2);
    color: var(--text-muted);
}

/* ============================================================================
   SCHOOL ENTRY MANAGEMENT (Registered Tab — collapsible)
   ============================================================================ */

.school-entries-config {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--space-5);
    margin-top: var(--space-4);
    backdrop-filter: blur(10px);
}

.school-entries-config.collapsed .positions-body {
    max-height: 0;
    opacity: 0;
    pointer-events: none;
}

.school-entries-config.collapsed .positions-chevron {
    transform: rotate(-90deg);
}

.school-entries-config.collapsed .positions-header {
    margin-bottom: 0;
}

.school-entries-config .positions-count-badge {
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 400;
}

.school-entries-config.collapsed .positions-count-badge {
    display: inline;
}

.school-entries-config:not(.collapsed) .positions-count-badge {
    display: none;
}

.school-entries-table {
    width: 100%;
    overflow-x: auto;
}

.school-entries-table table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.school-entries-table th {
    text-align: left;
    padding: var(--space-2) var(--space-3);
    border-bottom: 2px solid var(--border-color);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.school-entries-table td {
    padding: var(--space-2-5) var(--space-3);
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.school-entries-table tr {
    cursor: pointer;
    transition: background var(--motion-fast) var(--ease-standard);
}

.school-entries-table tbody tr:hover {
    background: var(--raise-2);
}

.se-school-cell {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.se-cap-badge {
    display: inline-block;
    padding: var(--space-0-5) var(--space-2);
    border-radius: var(--radius-xs);
    font-size: 0.75rem;
    font-weight: 600;
}

.se-cap-ok {
    background: var(--success-wash);
    color: var(--birdie-ink);
}

.se-cap-warn {
    background: var(--warning-wash);
    color: var(--warning-ink);
}

.se-cap-over {
    background: var(--danger-wash);
    color: var(--double-ink);
}

.se-cap-none {
    color: var(--text-muted);
    font-style: italic;
}

.se-status-badge {
    display: inline-block;
    padding: var(--space-0-5) var(--space-2);
    border-radius: var(--radius-xs);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.se-status-draft {
    background: var(--raise-3);
    color: var(--text-muted);
}

.se-status-submitted {
    background: var(--info-wash);
    color: var(--info-ink);
}

.se-status-pending_approval {
    background: var(--warning-wash);
    color: var(--warning-ink);
}

.se-status-approved {
    background: var(--success-wash);
    color: var(--birdie-ink);
}

.se-status-revision_requested {
    background: var(--danger-wash);
    color: var(--double-ink);
}

.se-edit-icon {
    opacity: 0.4;
    transition: opacity var(--motion-fast);
}

.school-entries-table tbody tr:hover .se-edit-icon {
    opacity: 1;
}

/* Approval status banner in coach view */
.reg-approval-banner {
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-4);
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.reg-approval-banner.pending {
    background: var(--warning-wash);
    border: 1px solid var(--warning-wash-border);
    color: var(--warning-ink);
}

.reg-approval-banner.approved {
    background: var(--success-wash);
    border: 1px solid var(--success-wash-border);
    color: var(--birdie-ink);
}

.reg-approval-banner.revision {
    background: var(--danger-wash);
    border: 1px solid var(--danger-wash-border);
    color: var(--double-ink);
}

.reg-cap-info {
    display: flex;
    gap: var(--space-4);
    padding: var(--space-2) var(--space-3);
    background: var(--raise-1);
    border-radius: var(--radius-sm);
    margin-bottom: var(--space-3);
    font-size: 0.8rem;
    color: var(--text-muted);
}

.reg-cap-info .cap-item {
    display: flex;
    align-items: center;
    gap: var(--space-1-5);
}

.reg-cap-info .cap-count {
    font-weight: 600;
    color: var(--text-primary);
}

/* ── My Rounds header buttons (New Round / Simulator) ── */
.my-rounds-actions {
    display: flex;
    gap: var(--space-1-5);
    flex-wrap: nowrap;
    /* keep buttons on one line, top-right of the header */
    flex-shrink: 0;
    align-items: center;
}

/* Keep the title left (like the Practice Assignments card) with the action
   pills inline on the right, even on mobile where .gsx-card-header otherwise
   stacks to a column. */
#playerRoundsCard .dash-card-header,
#playerRoundsCard .gsx-card-header {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
}

#playerRoundsCard .gsx-card-title {
    text-align: left;
}

.round-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-1-5);
    padding: var(--space-1-5) var(--space-3);
    border-radius: var(--radius-pill);
    font-size: 0.78rem;
    font-weight: 550;
    line-height: 1;
    cursor: pointer;
    border: 1px solid transparent;
    white-space: nowrap;
    transition: transform var(--motion-instant) var(--ease-standard), filter var(--motion-fast) var(--ease-standard), background var(--motion-fast) var(--ease-standard), border-color var(--motion-fast) var(--ease-standard);
}

.round-btn-label {
    display: inline-block;
    line-height: 1;
    /* optically center the cap-height text against the icon box */
    transform: translateY(0.5px);
}

.round-btn svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    display: block;
}

/* On narrow screens keep the labels but tighten the pills so they read as
   clear, worded actions without wrapping under the title. */
@media (max-width: 460px) {
    .round-btn {
        gap: var(--space-1);
        padding: var(--space-1-5) var(--space-2);
        font-size: 0.74rem;
    }
}

.round-btn:active {
    transform: scale(0.96);
}

.round-btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark, #8a6f25));
    color: var(--gsx-on-brand);
    box-shadow: 0 2px 8px rgba(var(--gsx-brand-rgb), 0.3);
}

.round-btn-primary:hover {
    filter: brightness(1.07);
}

.round-btn-ghost {
    background: var(--gsx-input-bg, rgba(255, 255, 255, 0.05));
    color: var(--text-primary, #e8e8e8);
    border-color: var(--border-subtle, rgba(255, 255, 255, 0.16));
}

[data-theme="light"] .round-btn-ghost {
    background: var(--surface-solid);
    color: var(--text-primary);
    border-color: var(--surface-sunken);
}

.round-btn-ghost:hover {
    background: var(--hover-bg, rgba(255, 255, 255, 0.09));
    border-color: var(--primary-color);
    color: var(--primary-light);
}

[data-theme="light"] .round-btn-ghost:hover {
    color: var(--brand-ink);
    background: rgba(var(--gsx-brand-rgb), 0.06);
}

/* ════════════════════════════════════════════════════════════
   APP PAGES — full-screen Squabbit-style slide-in pages
   (New Round, Course Select, Course Detail) + bottom sheets
   ════════════════════════════════════════════════════════════ */
.app-page {
    position: fixed;
    inset: 0;
    z-index: 10040;
    display: flex;
    flex-direction: column;
    background: var(--bg-primary, #14141a);
    transform: translateX(100%);
    transition: transform var(--motion-slow) var(--ease-decelerate);
    overscroll-behavior: contain;
    padding-top: env(safe-area-inset-top, 0px);
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

[data-theme="light"] .app-page {
    background: var(--gray-light);
}

.app-page.app-page-in {
    transform: translateX(0);
}

.app-page-header {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-3-5);
    background: linear-gradient(135deg, var(--primary-dark, #8a6f25), var(--primary-color));
    color: var(--gsx-on-brand);
    flex-shrink: 0;
    box-shadow: var(--shadow-sm);
}

.app-page-back {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    border: none;
    background: var(--raise-5);
    color: var(--gsx-on-brand);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: background var(--motion-fast);
}

.app-page-back:hover {
    background: var(--raise-5);
    filter: brightness(1.2);
}

.app-page-title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 600;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-1-5);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-page-title svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.app-page-body {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: var(--space-3-5);
}

.app-page-footer {
    flex-shrink: 0;
    padding: 0.75rem 0.85rem calc(0.75rem + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.1));
    background: var(--bg-primary, #14141a);
    display: flex;
    gap: var(--space-2-5);
}

[data-theme="light"] .app-page-footer {
    background: var(--surface-solid);
    border-top-color: var(--border-subtle);
}

/* ── New Round list rows ── */
.nr-list {
    background: var(--card-bg, #1c1c22);
    border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.08));
    border-radius: var(--radius-2xl);
    overflow: hidden;
    margin-bottom: var(--space-4);
}

[data-theme="light"] .nr-list {
    background: var(--surface-solid);
    border-color: var(--border-subtle);
}

.nr-row,
.nr-toggle-row {
    display: flex;
    align-items: center;
    gap: var(--space-3-5);
    width: 100%;
    padding: var(--space-3-5) var(--space-4);
    background: none;
    border: none;
    border-bottom: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.06));
    cursor: pointer;
    text-align: left;
    color: var(--text-primary, #e8e8e8);
    -webkit-tap-highlight-color: transparent;
    transition: background var(--motion-fast), transform var(--motion-instant);
}

[data-theme="light"] .nr-row,
[data-theme="light"] .nr-toggle-row {
    border-bottom-color: var(--hairline-faint);
    color: var(--text-primary);
}

.nr-list>.nr-row:last-child,
.nr-toggle-list>.nr-toggle-row:last-child {
    border-bottom: none;
}

.nr-row:hover,
.nr-toggle-row:hover {
    background: var(--hover-bg, rgba(255, 255, 255, 0.04));
}

.nr-row:active,
.nr-toggle-row:active {
    transform: scale(0.99);
    background: rgba(var(--gsx-brand-rgb), 0.09);
}

.nr-row[disabled] {
    opacity: 1;
    cursor: default;
}

.nr-row-icon {
    width: 30px;
    height: 30px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--brand-ink);
}

.nr-row-icon svg {
    width: 20px;
    height: 20px;
}

.nr-row-main {
    display: flex;
    flex-direction: column;
    gap: var(--space-0-5);
    flex: 1;
    min-width: 0;
}

.nr-row-label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted, #888);
}

.nr-toggle-row .nr-row-label {
    font-size: 0.92rem;
    font-weight: 600;
    text-transform: none;
    letter-spacing: 0;
    color: var(--text-primary, #e8e8e8);
}

[data-theme="light"] .nr-toggle-row .nr-row-label {
    color: var(--text-primary);
}

.nr-row-value {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary, #e8e8e8);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

[data-theme="light"] .nr-row-value {
    color: var(--text-primary);
}

.nr-toggle-row .nr-row-value {
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-muted, #888);
}

.nr-row-value-muted {
    color: var(--text-muted, #888);
    font-weight: 500;
}

.nr-row-chevron {
    color: var(--text-muted, #888);
    flex-shrink: 0;
}

/* Press-flash pulse (reuses srRowFlash keyframes from 02-dashboard) */
.nr-toggle-row.sr-flash {
    animation: srRowFlash 0.32s ease;
}

.nr-notes {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    background: var(--card-bg, #1c1c22);
    border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.08));
    border-radius: var(--radius-xl);
    color: var(--text-primary, #e8e8e8);
    font-size: 0.95rem;
    outline: none;
    transition: border-color var(--motion-fast);
}

[data-theme="light"] .nr-notes {
    background: var(--surface-solid);
    border-color: var(--border-subtle);
    color: var(--text-primary);
}

.nr-notes:focus {
    border-color: var(--primary-color);
}

/* ── Bottom action buttons ── */
.nr-btn {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-4) var(--space-4);
    border-radius: var(--radius-xl);
    border: none;
    font-size: 0.98rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform var(--motion-instant), filter var(--motion-fast), background var(--motion-fast);
}

.nr-btn:active {
    transform: scale(0.97);
}

.nr-btn-primary {
    flex: 1.6;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark, #8a6f25));
    color: var(--gsx-on-brand);
    box-shadow: 0 4px 14px rgba(var(--gsx-brand-rgb), 0.35);
}

.nr-btn-primary:hover {
    filter: brightness(1.06);
}

.nr-btn-ghost {
    background: var(--card-bg, #26262e);
    color: var(--text-primary, #e8e8e8);
    border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.14));
}

[data-theme="light"] .nr-btn-ghost {
    background: var(--surface-solid);
    color: var(--text-primary);
    border-color: var(--surface-sunken);
}

.nr-btn-ghost:hover {
    background: var(--hover-bg, rgba(255, 255, 255, 0.06));
}

/* ── Bottom sheet (date / holes / tee / quick-log pickers) ── */
.nr-sheet-overlay {
    position: fixed;
    inset: 0;
    z-index: 10060;
    background: var(--scrim);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    opacity: 0;
    transition: opacity var(--motion-base) var(--ease-standard);
}

.nr-sheet-overlay.nr-sheet-in {
    opacity: 1;
}

.nr-sheet {
    width: 100%;
    max-width: 480px;
    background: var(--card-bg, #1c1c22);
    border-radius: 18px 18px 0 0;
    padding: 1rem 1rem calc(1rem + env(safe-area-inset-bottom, 0px));
    transform: translateY(100%);
    transition: transform var(--motion-slow) var(--ease-decelerate);
    box-shadow: var(--shadow-2xl);
    max-height: 80vh;
    overflow-y: auto;
}

[data-theme="light"] .nr-sheet {
    background: var(--surface-solid);
}

.nr-sheet-overlay.nr-sheet-in .nr-sheet {
    transform: translateY(0);
}

.nr-sheet-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary, #e8e8e8);
    text-align: center;
    margin-bottom: var(--space-3-5);
}

[data-theme="light"] .nr-sheet-title {
    color: var(--text-primary);
}

.nr-sheet-body {
    margin-bottom: var(--space-3-5);
}

.nr-sheet-label {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted, #888);
    margin-bottom: var(--space-1);
}

.nr-sheet-input {
    width: 100%;
    padding: var(--space-3) var(--space-3-5);
    background: var(--gsx-input-bg, rgba(255, 255, 255, 0.06));
    border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.14));
    border-radius: var(--radius-lg);
    color: var(--text-primary, #e8e8e8);
    font-size: 1rem;
    outline: none;
}

[data-theme="light"] .nr-sheet-input {
    background: var(--gray-light);
    border-color: var(--surface-sunken);
    color: var(--text-primary);
}

.nr-sheet-input:focus {
    border-color: var(--primary-color);
}

.nr-sheet-actions {
    display: flex;
    gap: var(--space-2-5);
}

.nr-sheet-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    margin-bottom: var(--space-2);
}

.nr-choice {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: var(--space-3-5) var(--space-3-5);
    background: none;
    border: 1px solid transparent;
    border-radius: var(--radius-lg);
    color: var(--text-primary, #e8e8e8);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    text-align: left;
    transition: background var(--motion-fast);
}

[data-theme="light"] .nr-choice {
    color: var(--text-primary);
}

.nr-choice:hover {
    background: var(--hover-bg, rgba(255, 255, 255, 0.05));
}

.nr-choice-active {
    background: rgba(var(--gsx-brand-rgb), 0.12);
    border-color: rgba(var(--gsx-brand-rgb), 0.35);
    color: var(--primary-light);
}

/* ── Course Select page ── */
.cs-header {
    gap: var(--space-2-5);
}

.cs-search-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    gap: var(--space-2);
    background: rgba(var(--gsx-brand-rgb), 0.10);
    border-radius: var(--radius-lg);
    padding: 0 var(--space-3);
}

.cs-search-icon {
    color: var(--text-muted);
    flex-shrink: 0;
}

.cs-search-input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 0.95rem;
    padding: var(--space-2-5) 0;
}

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

.cs-body {
    padding: 0;
}

.cs-section-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted, #888);
    padding: var(--space-3-5) var(--space-4) var(--space-1-5);
}

.cs-course-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    width: 100%;
    padding: var(--space-3-5) var(--space-4);
    background: none;
    border: none;
    border-bottom: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.06));
    cursor: pointer;
    text-align: left;
    -webkit-tap-highlight-color: transparent;
    transition: background var(--motion-fast);
}

[data-theme="light"] .cs-course-row {
    border-bottom-color: var(--hairline-faint);
}

.cs-course-row:hover {
    background: var(--hover-bg, rgba(255, 255, 255, 0.04));
}

.cs-course-row:active {
    background: rgba(var(--gsx-brand-rgb), 0.1);
}

.cs-course-main {
    display: flex;
    flex-direction: column;
    gap: var(--space-0-5);
    min-width: 0;
}

.cs-course-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary, #e8e8e8);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

[data-theme="light"] .cs-course-name {
    color: var(--text-primary);
}

.cs-course-loc {
    font-size: 0.8rem;
    color: var(--text-muted, #888);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cs-dist {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--brand-ink);
    flex-shrink: 0;
    white-space: nowrap;
}

.cs-course-badge {
    display: inline-block;
    margin-left: var(--space-2);
    padding: 0 var(--space-1-5);
    border-radius: var(--radius-pill);
    font-size: 0.66rem;
    font-weight: 700;
    color: var(--brand-ink);
    background: rgba(var(--gsx-brand-rgb), 0.14);
    vertical-align: middle;
}

.cs-status {
    padding: var(--space-4);
    color: var(--text-muted, #888);
    font-size: 0.9rem;
}

.cs-loading {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4) var(--space-4);
    color: var(--text-muted, #888);
    font-size: 0.9rem;
}

.cs-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid var(--border-subtle, rgba(255, 255, 255, 0.2));
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: csSpin 0.7s linear infinite;
    flex-shrink: 0;
}

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

/* ── Course Detail / tee list ── */
.cd-course-head {
    padding: var(--space-1-5) var(--space-1) var(--space-4);
}

.cd-course-name {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text-primary, #e8e8e8);
}

[data-theme="light"] .cd-course-name {
    color: var(--text-primary);
}

.cd-course-loc {
    font-size: 0.85rem;
    color: var(--text-muted, #888);
    margin-top: var(--space-0-5);
}

.cd-tee-list {
    background: var(--card-bg, #1c1c22);
    border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.08));
    border-radius: var(--radius-2xl);
    overflow: hidden;
}

[data-theme="light"] .cd-tee-list {
    background: var(--surface-solid);
    border-color: var(--border-subtle);
}

.cd-tee-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    width: 100%;
    padding: var(--space-3-5) var(--space-4);
    background: none;
    border: none;
    border-bottom: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.06));
    cursor: pointer;
    text-align: left;
    -webkit-tap-highlight-color: transparent;
    transition: background var(--motion-fast);
}

[data-theme="light"] .cd-tee-row {
    border-bottom-color: var(--hairline-faint);
}

.cd-tee-row:last-child {
    border-bottom: none;
}

.cd-tee-row:hover {
    background: var(--hover-bg, rgba(255, 255, 255, 0.04));
}

.cd-tee-row:active {
    background: rgba(var(--gsx-brand-rgb), 0.1);
}

.cd-tee-main {
    display: flex;
    flex-direction: column;
    gap: var(--space-0-5);
    min-width: 0;
}

.cd-tee-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary, #e8e8e8);
}

[data-theme="light"] .cd-tee-name {
    color: var(--text-primary);
}

.cd-tee-detail {
    font-size: 0.82rem;
    color: var(--text-muted, #888);
}

/* On wider screens, present the slide-in pages as a centered modal card that
   hugs its content — instead of a full-height phone-width column that left a
   tall empty gap above the footer on desktop. Mobile keeps the full-screen
   slide-in (this only applies >=769px). */
@media (min-width: 769px) {
    .app-page {
        inset: auto;
        top: 50%;
        left: 50%;
        right: auto;
        bottom: auto;
        width: min(620px, 94vw);
        max-width: none;
        height: auto;
        max-height: 88vh;
        border-radius: var(--radius-3xl);
        overflow: hidden;
        opacity: 0;
        transform: translate(-50%, -46%);
        transition: opacity var(--motion-base) var(--ease-standard),
            transform var(--motion-base) var(--ease-decelerate);
        /* card shadow + a full-viewport dim that reads as a modal backdrop */
        box-shadow: var(--shadow-2xl),
            0 0 0 100vmax var(--scrim);
    }

    .app-page.app-page-in {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

@media (prefers-reduced-motion: reduce) {

    .app-page,
    .nr-sheet,
    .nr-sheet-overlay {
        transition: none;
    }

    .nr-toggle-row.sr-flash {
        animation: none;
    }
}

/* ── Solo / Casual play: scorecard stepper & hole strip ── */
.solo-hole-strip {
    display: flex;
    gap: var(--space-1-5);
    overflow-x: auto;
    padding: var(--space-1) 0 var(--space-2);
    -webkit-overflow-scrolling: touch;
}

.solo-hole-chip {
    flex: 0 0 auto;
    min-width: 2.25rem;
    height: 2.25rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border, #333);
    background: var(--card-bg, #1e1e22);
    color: var(--text-secondary, #aaa);
    font-weight: 700;
    cursor: pointer;
}

.solo-hole-chip.done {
    border-color: var(--primary-color);
    color: var(--text-primary, #fff);
}

.solo-hole-chip.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: var(--gsx-on-brand);
}

.solo-step {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 1px solid var(--border, #333);
    background: var(--card-bg, #1e1e22);
    color: var(--text-primary, #fff);
    font-size: 1.8rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.solo-step:active {
    background: var(--primary-color);
    color: var(--gsx-on-brand);
}

/* M3 — practice review overlay (coach feedback on a player's submitted round) */
.pa-review-overlay {
    position: fixed; inset: 0; background: var(--scrim-strong);
    display: flex; align-items: center; justify-content: center; z-index: 9999; padding: var(--space-4);
}
.pa-review-card {
    background: var(--card-bg); color: var(--text-primary);
    border: 1px solid var(--border-color); border-radius: var(--radius-xl);
    padding: var(--space-4); width: min(560px, 100%); max-height: 88vh; overflow:auto;
    box-shadow: var(--shadow-2xl);
}
.pa-review-head { display:flex; flex-direction:column; gap:var(--space-0-5); margin-bottom:var(--space-2-5); }
.pa-review-grid { width:100%; border-collapse:collapse; font-size:0.78rem; margin:var(--space-1-5) 0 var(--space-3); }
.pa-review-grid th, .pa-review-grid td { border:1px solid var(--border-color,#333); padding:var(--space-0-5) var(--space-1); text-align:center; }
.pa-review-grid td.under { color:var(--success-ink); font-weight:700; }
.pa-review-grid td.over { color:var(--danger-ink); }
.pa-review-label { display:block; font-size:0.72rem; text-transform:uppercase; letter-spacing:0.03em; color:var(--text-muted,#999); margin:var(--space-2) 0 var(--space-1); }
.pa-review-card textarea, .pa-review-card input { width:100%; padding:var(--space-2); border-radius:var(--radius-md); border:1px solid var(--border-color,#333); background:var(--input-bg,#111); color:inherit; box-sizing:border-box; }
.pa-review-actions { display:flex; gap:var(--space-2); justify-content:flex-end; margin-top:var(--space-3-5); flex-wrap:wrap; }
.pa-reviewed-dot { color: var(--success-ink, #22c55e); font-size:0.7em; }

/* ── End-of-season rollover modal ── */
.tm-roll-list { display: flex; flex-direction: column; gap: var(--space-0-5); margin: var(--space-2) 0; max-height: 46vh; overflow-y: auto; }
.tm-roll-row { display: flex; align-items: center; gap: var(--space-2-5); padding: var(--space-2) var(--space-1-5); border-radius: var(--radius-md); cursor: pointer; }
.tm-roll-row:hover { background: var(--row-hover, var(--surface-sunken)); }
.tm-roll-name { flex: 1; font-weight: 600; color: var(--gsx-text); font-size: 0.9rem; }
.tm-roll-badge { font-size: 0.66rem; font-weight: 700; padding: var(--space-0-5) var(--space-2); border-radius: var(--radius-pill); white-space: nowrap; }
.tm-roll-emailck { display: inline-flex; align-items: center; gap: var(--space-1); font-size: 0.76rem; color: var(--gsx-text-muted); white-space: nowrap; }
.tm-roll-fold { margin-top: var(--space-3); border-top: 1px solid var(--gsx-border); padding-top: var(--space-2-5); }
.tm-roll-fold > summary { cursor: pointer; font-size: 0.82rem; font-weight: 600; color: var(--gsx-text-muted); }
.tm-roll-retlist { padding: var(--space-2) 0 0 var(--space-2); font-size: 0.85rem; color: var(--gsx-text); display: flex; flex-direction: column; gap: var(--space-1); }
.tm-roll-domain-wrap { display: flex; flex-wrap: wrap; gap: var(--space-1-5); margin-top: var(--space-1); }
.tm-roll-domain { font-size: 0.74rem; font-weight: 600; padding: var(--space-0-5) var(--space-2); border-radius: var(--radius-pill); background: rgba(var(--gsx-brand-rgb),0.12); color: var(--brand-ink); }

/* ── 4-bucket profile: visibility hints, public-profile + notification cards,
      two-way coach-message threads ── */
.profile-vis-hint {
    display: inline-block; margin-left: var(--space-2); padding: 0 var(--space-2);
    border-radius: var(--radius-pill); font-size: 0.62rem; font-weight: 800;
    text-transform: uppercase; letter-spacing: 0.06em; vertical-align: middle;
    background: color-mix(in srgb, var(--gsx-brand) 12%, transparent);
    color: var(--brand-ink);
}
/* Handle field: a bordered wrapper that LOOKS like a normal input, with a static
   "@" flex-prefix and a borderless input inside. The @ can never overlap the text
   because both are real flex children (the old absolute-@ + padding-left hack
   mis-measured the glyph width and overlapped the first character). */
.pf-handle-wrap {
    display: flex;
    align-items: center;
    min-height: var(--gsx-control-height);
    border: 1px solid var(--gsx-border);
    border-radius: var(--gsx-control-radius);
    background: var(--gsx-input-bg);
    padding-left: var(--space-3);
    transition: border-color var(--motion-base), box-shadow var(--motion-base);
}
.pf-handle-wrap:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(var(--gsx-brand-rgb), 0.15);
}
.pf-handle-wrap .pf-handle-at {
    flex: 0 0 auto; font-weight: 700; color: var(--text-muted);
    pointer-events: none; user-select: none; line-height: 1;
}
/* Override the base .form-group input box so it sits transparent inside the wrap. */
.pf-handle-wrap input {
    flex: 1 1 auto; min-width: 0;
    border: none; background: transparent; box-shadow: none;
    min-height: auto; padding: var(--space-2-5) var(--space-3) var(--space-2-5) var(--space-1-5);
    margin: 0;
}
.pf-handle-wrap input:focus { outline: none; border: none; box-shadow: none; }
.pf-handle-hint { margin-top: var(--space-1); font-size: 0.74rem; color: var(--text-muted); }
.pf-handle-status {
    min-height: 1.1rem; margin-top: var(--space-1); font-size: 0.78rem; font-weight: 600;
}
.pf-handle-status.is-checking { color: var(--text-muted); font-weight: 500; }
.pf-handle-status.is-ok { color: var(--success, #16a34a); }
.pf-handle-status.is-bad { color: var(--danger, #d33); }
.pf-toggle-row {
    display: flex; align-items: center; gap: 0.75rem; cursor: pointer;
    font-weight: 600; padding: var(--space-2) 0;
}
.pf-toggle-sub { font-weight: 400; font-size: 0.78rem; color: var(--text-muted); }
.pf-notif-master { border-bottom: 1px solid var(--border-subtle); margin-bottom: var(--space-1); }
.pf-notif-plat {
    display: inline-block; margin-left: var(--space-1); padding: 0 var(--space-1-5);
    border-radius: var(--radius-pill); font-size: 0.6rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.05em;
    background: var(--raise-2); color: var(--text-muted);
}
.pf-coach-actions { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
.pf-badge {
    display: inline-block; min-width: 18px; padding: 0 var(--space-1-5);
    border-radius: var(--radius-pill); background: var(--danger, #d33); color: var(--on-danger, #fff);
    font-size: 0.68rem; font-weight: 700; line-height: 18px; text-align: center;
}
.cmsg-reply {
    display: flex; align-items: baseline; gap: var(--space-1-5);
    margin: var(--space-1-5) 0 0 var(--space-3); padding-left: var(--space-2-5);
    border-left: 2px solid var(--border-subtle); font-size: 0.84rem;
}
.cmsg-reply-you { font-weight: 700; color: var(--brand-ink); flex: 0 0 auto; }
.cmsg-reply-body { color: var(--text-primary); }
.cmsg-reply-row { display: flex; align-items: center; gap: var(--space-2); margin-top: var(--space-1-5); }
.cmsg-reply-btn {
    background: none; border: none; cursor: pointer; padding: 0;
    font-size: 0.78rem; font-weight: 700; color: var(--brand-ink);
}
.cmsg-reply-btn:hover { text-decoration: underline; }
.cmsg-reply-box { display: flex; gap: var(--space-2); margin-top: var(--space-2); }
.cmsg-reply-input {
    flex: 1; padding: var(--space-2) var(--space-2-5); font-size: 0.86rem;
    border: 1px solid var(--border-subtle); border-radius: var(--radius-md);
    background: var(--bg-primary); color: var(--text-primary);
}
.cmsg-item-btn { display: block; width: 100%; text-align: left; cursor: pointer; }
.cmsg-item-btn:hover { background: var(--raise-2); }

/* ── My Golf Bag (profile card) ── */
.pf-bag-intro { margin: 0 0 0.75rem; font-size: 0.86rem; }
.pf-bag-actions { margin-top: 0.75rem; }
.pf-bag-summary {
    display: flex; align-items: center; justify-content: space-between;
    gap: var(--space-2); padding: var(--space-1) 0;
}
.pf-bag-rows { display: flex; flex-direction: column; gap: var(--space-1-5); }
.pf-bag-row { display: flex; align-items: center; gap: var(--space-2); }
.pf-bag-club { flex: 1; min-width: 0; }
.pf-bag-yds { width: 84px; }
.pf-bag-row input {
    padding: var(--space-2) var(--space-2-5); font-size: 0.9rem;
    border: 1px solid var(--border-subtle); border-radius: var(--radius-md);
    background: var(--bg-primary); color: var(--text-primary);
}
.pf-bag-unit { font-size: 0.78rem; flex: 0 0 auto; }
.pf-bag-x {
    flex: 0 0 auto; background: none; border: none; cursor: pointer;
    font-size: 1.15rem; line-height: 1; padding: 0 var(--space-1);
    color: var(--text-muted); border-radius: var(--radius-sm);
}
.pf-bag-x:hover { color: var(--danger-ink, #c62828); }

/* WOW: profile display name gets the display face; hero stats get big numerals. */
#profileDisplayName { font-family: var(--font-display); font-size: 1.9rem; font-weight: 700; letter-spacing: 0.01em; }
/* Hero @handle — the identity block by the avatar/name (like every social site),
   with an inline click-to-edit and an "add a @handle" affordance when unset. */
.profile-handle-line { margin: -0.35rem 0 0.35rem; display: flex; justify-content: center; }
.pf-hero-handle {
    display: inline-flex; align-items: center; gap: 0.1rem;
    background: none; border: none; margin: 0; padding: 2px 8px;
    font-family: inherit; font-size: 0.98rem; font-weight: 600; line-height: 1.2;
    color: var(--text-muted); border-radius: var(--radius-pill); cursor: default;
    transition: background var(--motion-base), color var(--motion-base);
}
.pf-hero-handle-at { opacity: 0.65; }
.pf-hero-handle.is-editable { cursor: pointer; }
.pf-hero-handle.is-editable:hover { background: var(--raise-2, rgba(127,127,127,0.12)); color: var(--text-primary); }
.pf-hero-handle-pencil { margin-left: 0.25rem; opacity: 0; transition: opacity var(--motion-base); }
.pf-hero-handle.is-editable:hover .pf-hero-handle-pencil { opacity: 0.65; }
.pf-hero-handle-add {
    color: var(--brand-ink, var(--primary-color)); font-weight: 700; cursor: pointer;
    border: 1px dashed var(--gsx-border);
    background: color-mix(in srgb, var(--gsx-brand) 6%, transparent);
}
.pf-hero-handle-add:hover { background: color-mix(in srgb, var(--gsx-brand) 14%, transparent); }
.pf-hero-handle-edit {
    display: flex; align-items: center; justify-content: center;
    gap: var(--space-2); flex-wrap: wrap;
}
.pf-handle-wrap-sm { width: min(240px, 62vw); }
.pf-handle-wrap-sm input { padding-top: var(--space-1-5); padding-bottom: var(--space-1-5); }
.profile-handle-line .pf-handle-status { text-align: center; }
.profile-handle-line .pf-handle-hint { text-align: center; }
/* When the hero handle is in edit mode, the line becomes a small column. */
.profile-handle-line:has(.pf-hero-handle-edit) { flex-direction: column; align-items: center; gap: var(--space-1); }
.profile-stat-value { font-family: var(--font-display); font-size: 1.8rem; font-weight: 700; font-variant-numeric: tabular-nums; }

/* "Use my Google photo" pill under the avatar (Google-linked, no photo yet) */
.profile-gphoto-btn {
    /* sibling of the avatar wrap → centered by the hero's align-items:center */
    margin: calc(-1 * var(--space-2)) 0 0;
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-full);
    border: 1px solid var(--border-medium);
    background: var(--scrim-soft); color: var(--on-scrim);
    font-size: 0.72rem; font-weight: 700; cursor: pointer;
    backdrop-filter: blur(4px);
    position: relative; z-index: 1;
}
.profile-gphoto-btn:hover { border-color: var(--on-scrim); background: var(--scrim); }

/* ── School-email migration nudge on the profile (renderProfileEmailNudge) ── */
.pf-email-nudge {
    display: flex;
    gap: var(--space-3);
    align-items: flex-start;
    padding: var(--space-4);
    margin-bottom: var(--space-4);
    background: rgba(var(--gsx-info-rgb), 0.10);
    border: 1px solid rgba(var(--gsx-info-rgb), 0.30);
    border-radius: var(--gsx-radius-md);
}
.pf-nudge-icon { font-size: 1.5rem; line-height: 1; flex-shrink: 0; }
.pf-nudge-body { flex: 1; min-width: 0; }
.pf-nudge-title { font-weight: 800; color: var(--text-primary); margin-bottom: var(--space-1); }
.pf-nudge-text { font-size: 0.88rem; color: var(--text-secondary); line-height: 1.5; margin: 0 0 var(--space-3); }
