/* Coach profile container spacing (exclude hero) */
    #coach-profile [data-testid="tabs-menu"] {
        margin-top: 0 !important;
    }

    #coach-profile .profile-nav {
        /* Card-like nav consistent with site (do not shrink the menu itself) */
        padding: 0.5rem 1rem !important; /* restore comfortable menu size */
        margin: 0 auto !important;      /* no extra outer margins here */
        background: #ffffff;
        border: 1px solid var(--ui-border, var(--border-color));
        border-radius: 16px;
        box-shadow: 0 6px 18px rgba(0,0,0,0.06);
    }

    #coach-profile .tab-content {
        /* Keep tab panes flush with tabs menu width */
        padding: 0 0 var(--spacing-lg);
        margin: 0 auto;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    #coach-profile .content-card {
        /* Uniform spacing between cards */
        margin-bottom: var(--spacing-lg);
    }

    /* Reduce extra gap after last card slightly for balance */
    #coach-profile .tab-content .content-card:last-of-type {
        margin-bottom: var(--spacing-md);
    }

    /* Keep grids aligned with the same side padding */
    #coach-profile .overview-grid,
    #coach-profile .bio-grid,
    #coach-profile .performance-grid {
        padding-left: 0;
        padding-right: 0;
    }

    /* Coach page: keep cards stacked vertically (single column) */
    #coach-profile .overview-grid {
        grid-template-columns: 1fr !important;
    }

    /* Match team page rhythm: hero gap is controlled by the shared .home-sections grid gap */
    #coach-profile .hero-section + [data-testid="tabs-menu"] { margin-top: 0 !important; }
    #coach-profile [data-testid="tabs-menu"] + .tab-content { padding-top: 0 !important; margin-top: 0 !important; }

    /* Equal height cards on Overview grid + add bottom gap */
    #coach-profile #overview .overview-grid {
        align-items: stretch;
        margin-bottom: var(--spacing-lg) !important; /* more space below the first row */
    }
    /* Also add a clear top margin to the next card after the grid */
    #coach-profile #overview .overview-grid + .content-card {
        margin-top: var(--spacing-lg) !important;
    }
    #coach-profile #overview .overview-grid > .content-card {
        height: 100%;
        display: flex;
        flex-direction: column;
    }

    /* Career snapshot: 3 fields per row (desktop/tablet). */
    #coach-profile #overview .bio-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    /* Latest game context (opponent + venue) */
    #coach-profile .latest-game-header {
        display: flex;
        flex-direction: column;
        gap: 0.15rem;
        margin: var(--spacing-sm) 0 var(--spacing-md);
        padding: 0 var(--spacing-sm);
    }

    #coach-profile .latest-game-title {
        margin: 0;
        font-weight: 600;
        color: var(--text-primary);
        line-height: 1.25;
    }

    #coach-profile .latest-game-venue {
        margin: 0;
        color: var(--text-secondary);
        font-size: 0.9rem;
        line-height: 1.2;
    }

    /* View All button positioning under Recent Games table */
    #coach-profile .view-all-container {
        display: flex;
        justify-content: flex-end !important;
        width: 100%;
        padding-top: var(--spacing-sm);
    }
    #coach-profile .view-all-btn { margin-left: auto; }

    #coach-profile .filters-actions {
        display: flex;
        gap: 0.5rem;
        align-items: center;
    }

    /* Ensure Statistics tooltip overlays tables and sticky headers */
    #coach-profile #statistics .card-header { z-index: 1000; }
    #coach-profile #statistics .stat-guide-hover-tooltip { z-index: 10000 !important; }

    @media (max-width: 600px) {
        #coach-profile .hero-section {
            padding: var(--fs-top-banner-padding-top) var(--fs-top-banner-padding-x) 0;
            min-height: var(--fs-top-banner-total-height);
            height: var(--fs-top-banner-total-height);
            overflow: hidden;
        }

        #coach-profile .hero-content {
            min-height: 100%;
            height: 100%;
            flex-direction: column;
            align-items: flex-start;
            justify-content: space-between;
            gap: 0.5rem;
        }

        #coach-profile .player-header {
            width: 100%;
            flex-direction: column;
            align-items: flex-start;
            gap: 0.35rem;
        }

        #coach-profile .player-image-container {
            order: 2;
            align-self: flex-start;
            margin-top: auto;
            width: clamp(72px, 24.7vw, 111px);
            height: clamp(72px, 24.7vw, 111px);
        }

        #coach-profile .player-info-header {
            order: 1;
            width: 100%;
        }

        #coach-profile .player-info-header .player-name {
            font-size: clamp(1.2rem, 5vw, 1.55rem);
            line-height: 1.1;
        }

        #coach-profile .player-meta-info {
            gap: 0.5rem;
            font-size: 0.75rem;
        }

        #coach-profile .quick-stats {
            gap: 0.75rem;
            flex-wrap: wrap;
        }

        #coach-profile .stat-value {
            font-size: 1.2rem;
            line-height: 1.1;
        }

        #coach-profile .stat-label {
            font-size: 0.65rem;
        }
    }

    /* Coach page mobile parity with player profile layout. */
    @media (max-width: 820px) {
        #coach-profile .stat-guide-hover-tooltip {
            position: fixed;
            top: var(--gutter-mobile);
            left: 50%;
            right: auto;
            width: calc(100vw - (2 * var(--gutter-mobile)));
            max-width: calc(100vw - (2 * var(--gutter-mobile)));
            max-height: calc(100vh - (2 * var(--gutter-mobile)));
            min-width: unset;
            overflow-y: auto;
            transform: translateX(-50%) translateY(-10px);
        }

        #coach-profile .stat-tooltip-arrow {
            display: none;
        }

        #coach-profile .stat-guide-hover-container:hover .stat-guide-hover-tooltip,
        #coach-profile .stat-guide-hover-container:focus-within .stat-guide-hover-tooltip {
            transform: translateX(-50%) translateY(0);
        }

        #coach-profile .profile-nav {
            display: grid !important;
            grid-template-columns: repeat(3, minmax(0, 1fr));
            gap: 8px !important;
            width: 100%;
            overflow: visible !important;
            padding: 0.5rem 0.75rem !important;
            margin: 0 auto !important;
        }

        #coach-profile .profile-nav .nav-tab {
            width: 100%;
            min-width: 0;
            min-height: 36px;
            padding: 0.5rem 0.4rem !important;
            font-size: 0.8rem !important;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        #coach-profile .tab-content {
            padding: 0.5rem 0 0.85rem !important;
        }

        #coach-profile .content-card {
            padding: 1rem !important;
            border-radius: 14px;
            margin-bottom: 0.85rem !important;
        }

        #coach-profile .card-header {
            gap: 0.5rem;
            flex-wrap: wrap;
        }

        #coach-profile .bio-grid {
            grid-template-columns: repeat(2, minmax(0, 1fr));
            gap: 0.65rem;
        }

        #coach-profile .performance-grid {
            grid-template-columns: repeat(3, minmax(0, 1fr));
            gap: 0.5rem;
        }

        #coach-profile .filters-actions {
            width: 100%;
            justify-content: flex-start;
            flex-wrap: wrap;
        }
    }

    @media (max-width: 540px) {
        #coach-profile .bio-grid,
        #coach-profile .performance-grid {
            grid-template-columns: 1fr;
        }
    }

    @media (max-width: 820px) {
        #coach-profile #recentGamesTable.unified-stats-table th.col-round,
        #coach-profile #recentGamesTable.unified-stats-table td.col-round,
        #coach-profile #gameLogTable.unified-stats-table th.col-round,
        #coach-profile #gameLogTable.unified-stats-table td.col-round {
            width: 28px !important;
            min-width: 28px !important;
            max-width: 28px !important;
            padding-left: 0.1rem !important;
            padding-right: 0.1rem !important;
            text-align: center !important;
            white-space: nowrap !important;
        }
    }

    /* Shared table clipping/sticky/sort sizing rules now come from unified-stats-table.css. */

    /* Keep coach top banner/menu on the same visual system and sizing as player profile. */
    #coach-profile [data-testid="tabs-menu"] {
        position: relative;
        margin-top: 0 !important;
        margin-bottom: 0 !important;
        border: 1px solid #E5E7EB !important;
        border-radius: 16px !important;
        background: #ffffff !important;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08) !important;
        overflow: hidden !important;
    }

    #coach-profile [data-testid="tabs-menu"]::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        height: 4px;
        background: var(--primary-color, var(--team-primary, var(--brand-blue)));
        border-radius: 16px 16px 0 0;
        pointer-events: none;
        z-index: 1;
    }

    #coach-profile .profile-nav {
        position: relative !important;
        margin-top: 0 !important;
        margin-bottom: 0 !important;
        padding-top: calc(0.45rem + 4px) !important;
        padding-bottom: 0.35rem !important;
        background: transparent !important;
        border: 0 !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        overflow: visible !important;
    }

    #coach-profile .hero-section[data-testid="hero-banner"] .player-info-header {
        text-align: left !important;
        align-items: stretch !important;
    }

    @media (min-width: 821px) {
        #coach-profile .hero-section[data-testid="hero-banner"] .player-header {
            min-height: var(--fs-top-banner-content-height) !important;
            height: var(--fs-top-banner-content-height) !important;
            align-items: stretch !important;
        }

        #coach-profile .hero-section[data-testid="hero-banner"] .player-image-container {
            align-self: flex-end !important;
        }

        #coach-profile .hero-section[data-testid="hero-banner"] .player-info-header {
            align-self: center !important;
            justify-content: center !important;
            transform: none !important;
        }
    }

    #coach-profile .hero-section[data-testid="hero-banner"] .player-title-row {
        display: grid !important;
        grid-template-columns: 1fr auto !important;
        grid-auto-rows: auto !important;
        align-items: start !important;
        column-gap: 1.25rem !important;
        row-gap: 0 !important;
        width: 100% !important;
    }

    #coach-profile .hero-section[data-testid="hero-banner"] .player-name {
        text-align: left !important;
        width: auto !important;
    }

    #coach-profile .hero-section[data-testid="hero-banner"] .player-meta-info,
    #coach-profile .hero-section[data-testid="hero-banner"] .quick-stats {
        justify-content: flex-start !important;
    }

    /* Reduce coach silhouette by 25% while keeping banner text anchored. */
    #coach-profile .hero-section[data-testid="hero-banner"] .player-image-container {
        display: flex !important;
        align-items: flex-end !important;
        justify-content: flex-start !important;
    }

    #coach-profile .hero-section[data-testid="hero-banner"] .player-main-image {
        width: 75% !important;
        height: 75% !important;
        max-width: 75% !important;
        max-height: 75% !important;
        object-fit: contain !important;
    }

    @media (max-width: 820px) {
        #coach-profile .hero-section[data-testid="hero-banner"] {
            position: relative;
            --banner-inset: 12px;
            overflow: visible;
            padding: 0 !important;
        }

        #coach-profile .hero-section[data-testid="hero-banner"] .hero-content {
            position: relative !important;
            display: block !important;
            align-items: stretch !important;
            justify-content: center !important;
            min-height: 100% !important;
            height: 100% !important;
            padding: 0 !important;
            text-align: left !important;
        }

        #coach-profile .hero-section[data-testid="hero-banner"] .player-header {
            position: relative !important;
            width: 100%;
            min-height: 100% !important;
            height: 100% !important;
            display: block !important;
            text-align: left !important;
            gap: 0 !important;
        }

        #coach-profile .hero-section[data-testid="hero-banner"] .player-info-header {
            position: absolute !important;
            top: calc(var(--banner-inset) + 6px);
            left: var(--banner-inset);
            right: var(--banner-inset);
            transform: none !important;
            text-align: left !important;
            z-index: 5;
            width: auto !important;
            display: flex !important;
            flex-direction: column !important;
            align-items: flex-start !important;
            padding: 0 !important;
        }

        #coach-profile .hero-section[data-testid="hero-banner"] .player-title-row {
            display: flex !important;
            flex-direction: column !important;
            align-items: flex-start !important;
            gap: 0.35rem !important;
        }

        #coach-profile .hero-section[data-testid="hero-banner"] .player-name {
            margin: 0 !important;
            text-align: left !important;
            font-size: clamp(1.4rem, 5vw, 2rem) !important;
            line-height: 1.1 !important;
            width: auto !important;
        }

        #coach-profile .hero-section[data-testid="hero-banner"] .player-meta-info {
            display: flex !important;
            flex-wrap: nowrap !important;
            align-items: center !important;
            gap: 0 !important;
            margin-top: 0.2rem !important;
            text-align: left !important;
            justify-content: flex-start !important;
            white-space: nowrap !important;
            overflow: hidden !important;
            text-overflow: ellipsis !important;
            max-width: 100% !important;
        }

        #coach-profile .hero-section[data-testid="hero-banner"] .player-meta-info .meta-item {
            display: inline-flex !important;
            align-items: center !important;
            justify-content: flex-start !important;
            font-size: 0.9rem !important;
        }

        #coach-profile .hero-section[data-testid="hero-banner"] .player-meta-info .meta-item + .meta-item::before {
            content: " | ";
            margin: 0 0.4rem;
            opacity: 0.9;
        }

        #coach-profile .hero-section[data-testid="hero-banner"] .player-image-container {
            position: absolute !important;
            left: var(--banner-inset) !important;
            bottom: 0 !important;
            margin-left: 0 !important;
            width: auto !important;
            height: 70% !important;
            max-height: 70% !important;
            max-width: 55% !important;
            margin: 0 !important;
            display: flex !important;
            align-items: flex-end !important;
            justify-content: flex-start !important;
            z-index: 2;
        }

        #coach-profile .hero-section[data-testid="hero-banner"] .player-main-image {
            width: 75% !important;
            height: 75% !important;
            max-height: 75% !important;
            max-width: 75% !important;
            object-fit: contain !important;
            display: block !important;
        }

        #coach-profile .hero-section[data-testid="hero-banner"] .quick-stats {
            display: none !important;
        }

        #coach-profile .hero-section[data-testid="hero-banner"] {
            --coach-action-size: var(--bookmark-size-mobile, var(--bookmark-hit-area, 2rem));
        }

        #coach-profile .hero-section[data-testid="hero-banner"] [data-testid="bookmark-btn"] {
            display: flex !important;
        }

        #coach-profile .hero-section[data-testid="hero-banner"] [data-testid="bookmark-btn"] i {
            font-size: var(--bookmark-icon-mobile) !important;
        }

        #coach-profile .hero-section[data-testid="hero-banner"] .share-btn .share-icon {
            width: var(--bookmark-icon-mobile) !important;
            height: var(--bookmark-icon-mobile) !important;
        }
    }
