/* Desktop header rules remain in the existing stylesheets. */
@media (max-width: 768px) {
    .header {
        position: sticky;
        top: 0;
        z-index: 1030;
        background: #fff;
    }

    .header .header-inner,
    .header.sticky .header-inner {
        position: static;
        padding: 0;
        animation: none;
        transition: none;
        border-bottom: 1px solid #e2e8f0;
        box-shadow: 0 3px 14px rgba(15, 23, 42, 0.06);
    }

    .header .header-inner > .container {
        width: 100%;
        max-width: none;
        padding: 0 14px;
    }

    .header .inner > .row {
        min-height: 72px;
        margin: 0;
        flex-wrap: nowrap;
        gap: 12px;
    }

    .header .header-brand {
        flex: 1 1 auto;
        width: auto;
        /* Home also loads Bootstrap 4, whose col-6 sets max-width: 50%. */
        max-width: none;
        min-width: 0;
        padding: 0;
    }

    .header .logo,
    .header .logo a {
        display: flex;
        align-items: center;
        margin: 0;
        min-width: 0;
    }

    .header .logo img {
        width: clamp(138px, 42vw, 190px);
        max-width: 100%;
        height: auto;
    }

    .header .header-actions {
        flex: 0 0 auto;
        width: auto;
        max-width: none;
        margin-left: auto;
        padding: 0;
    }

    .header .header-desktop-nav,
    .header .header-button-area {
        display: none !important;
    }

    .header .mobile-header-controls {
        align-items: center;
        gap: 10px;
    }

    .header .status-mobile {
        display: inline-flex;
        align-items: center;
        width: 58px;
        margin: 0 !important;
    }

    .header .status-mobile img {
        width: 100%;
        height: auto;
        max-height: 44px;
        object-fit: contain;
    }

    .header #hamburgerMenu {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        padding: 0;
        border: 1px solid #dbe5f0;
        border-radius: 12px;
        background: #f8fafc;
        color: #1a76d1;
        box-shadow: none;
    }

    .header #hamburgerMenu[aria-expanded="true"] {
        background: #eaf3ff;
        border-color: #a8cff5;
    }

    .header #hamburgerMenu .navbar-toggler-icon,
    .header #hamburgerMenu .navbar-toggler-icon::before,
    .header #hamburgerMenu .navbar-toggler-icon::after {
        width: 20px;
        height: 2px;
        border-radius: 2px;
        background: currentColor;
        transition: transform 150ms ease, background-color 150ms ease;
    }

    .header #hamburgerMenu .navbar-toggler-icon { top: 0; }
    .header #hamburgerMenu .navbar-toggler-icon::before { top: -6px; }
    .header #hamburgerMenu .navbar-toggler-icon::after { top: 6px; }
    .header #hamburgerMenu.active .navbar-toggler-icon { background: transparent; }
    .header #hamburgerMenu.active .navbar-toggler-icon::before { top: 0; transform: rotate(45deg); }
    .header #hamburgerMenu.active .navbar-toggler-icon::after { top: 0; transform: rotate(-45deg); }

    .header #mobileMenu[hidden] { display: none !important; }

    .header #mobileMenu {
        position: absolute;
        top: calc(100% + 8px);
        right: 12px;
        left: 12px;
        width: auto;
        height: auto;
        max-height: calc(100vh - 96px);
        max-height: calc(100dvh - 96px);
        overflow-y: auto;
        overscroll-behavior: contain;
        padding: 16px;
        padding-bottom: max(16px, env(safe-area-inset-bottom));
        border: 1px solid #e2e8f0;
        border-radius: 16px;
        background: #fff;
        box-shadow: 0 12px 36px rgba(15, 23, 42, 0.18);
        transition: none;
    }

    .header #mobileMenu .mobile-menu-heading {
        padding: 0 12px 12px;
        color: #64748b;
        font-size: 0.75rem;
        font-weight: 600;
        border-bottom: 1px solid #edf2f7;
        margin-bottom: 8px;
    }

    .header #mobileMenu .nav.menu {
        display: flex;
        flex-direction: column;
        gap: 4px;
        width: 100%;
        margin: 0;
        padding: 0;
    }

    .header #mobileMenu .nav.menu > li,
    .header #mobileMenu .nav.menu > li:last-child {
        display: block;
        float: none;
        width: 100%;
        margin: 0 !important;
        padding: 0;
        border: 0;
        text-align: left;
    }

    .header #mobileMenu .nav.menu > li > a,
    .header #mobileMenu .nav.menu > li > button,
    .header #mobileMenu .nav.menu > li > form > button {
        display: flex;
        align-items: center;
        justify-content: flex-start;
        gap: 8px;
        width: 100%;
        min-height: 46px;
        margin: 0;
        padding: 12px;
        border-radius: 10px !important;
        font-size: 0.9rem;
        font-weight: 500;
        line-height: 1.5;
        white-space: normal;
        text-decoration: none;
    }

    .header #mobileMenu .nav.menu > li > a {
        color: #334155;
        background: transparent;
    }

    .header #mobileMenu .nav.menu > li > a::before,
    .header #mobileMenu .nav.menu > li > button::before,
    .header #mobileMenu .nav.menu > li > form > button::before {
        display: none;
    }

    .header #mobileMenu .nav.menu > li > a:hover,
    .header #mobileMenu .nav.menu > li > a[aria-current="page"] {
        color: #155fa8;
        background: #eaf3ff;
    }

    .header #mobileMenu .nav.menu > li > a.mobile-login-link {
        justify-content: center;
        background: #1a76d1;
        color: #fff;
        margin-top: 8px;
    }

    .header #mobileMenu .nav.menu > li > form > .mobile-logout {
        background: #fff1f2;
        color: #b91c1c;
        border: 1px solid #fecdd3;
        margin-top: 8px;
        box-shadow: none;
    }

    .header #mobileMenu .btn-invite {
        margin-top: 8px !important;
        box-shadow: none;
    }

    .header #hamburgerMenu:focus-visible,
    .header #mobileMenu a:focus-visible,
    .header #mobileMenu button:focus-visible {
        outline: 2px solid #1a76d1;
        outline-offset: 2px;
    }
}

@media (max-width: 768px) and (prefers-reduced-motion: reduce) {
    .header #hamburgerMenu .navbar-toggler-icon,
    .header #hamburgerMenu .navbar-toggler-icon::before,
    .header #hamburgerMenu .navbar-toggler-icon::after { transition: none; }
}
