.site-header {
    position: sticky;
    top: 0;
    z-index: 200;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    color: var(--text-main);
    padding: 14px clamp(16px, 4vw, 32px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    border-bottom: 1px solid var(--border-soft);
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.8) inset,
        0 4px 18px rgba(15, 23, 42, 0.06);
}

.site-brand {
    margin: 0;
    font-size: clamp(18px, 2.4vw, 22px);
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.site-brand a {
    color: #0f172a;
    text-decoration: none;
    transition: color 0.18s ease;
}

.site-brand a:hover {
    color: var(--primary);
}

.nav-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #fff;
    color: #334155;
    cursor: pointer;
    box-shadow:                         0 1px 3px rgba(15, 23, 42, 0.06);
    transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, color 0.15s ease;
}

.nav-toggle:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
    color: #0f172a;
}

.nav-toggle:focus-visible {
    outline: 3px solid rgba(25, 103, 210, 0.35);
    outline-offset: 2px;
}

.nav-toggle span {
    font-size: 20px;
    line-height: 1;
}

.nav-toggle-close {
    display: none;
}

.nav-toggle[aria-expanded="true"] {
    background: #e8f0fe;
    border-color: #a8c7fa;
    color: var(--primary);
}

.nav-toggle[aria-expanded="true"] .nav-toggle-open {
    display: none;
}

.nav-toggle[aria-expanded="true"] .nav-toggle-close {
    display: inline;
}

.site-nav {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 6px;
}

.site-nav a {
    color: #475569;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    padding: 9px 14px;
    border-radius: 10px;
    transition: color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.site-nav a:hover {
    color: var(--primary);
    background: #e8f0fe;
}

.site-nav a[href="#"]:hover {
    color: #b42318;
    background: #fef3f2;
}

.site-user {
    color: #64748b;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.01em;
    padding: 7px 12px;
    margin-right: 4px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 999px;
    overflow-wrap: anywhere;
    max-width: min(280px, 55vw);
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px;
}

@media (max-width: 768px) {
    .site-header {
        position: sticky;
        top: 0;
        z-index: 200;
        padding: 7px 12px;
        gap: 8px;
        align-items: center;
        flex-wrap: nowrap;
    }

    .site-brand {
        flex: 1;
        min-width: 0;
        font-size: 16px;
        line-height: 1.15;
    }

    .nav-toggle {
        display: inline-flex;
        flex-shrink: 0;
        width: 36px;
        height: 36px;
        border-radius: 10px;
    }

    .nav-toggle span {
        font-size: 18px;
    }

    /* Dropdown overlays the page instead of reflowing below the bar (no content jump). */
    .site-nav {
        position: absolute;
        top: calc(100% + 4px);
        left: max(12px, env(safe-area-inset-left, 0px));
        right: max(12px, env(safe-area-inset-right, 0px));
        width: auto;
        max-height: min(78vh, calc(100dvh - 52px));
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        margin-top: 0;
        display: none;
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-start;
        gap: 4px;
        padding: 10px 10px 8px;
        background: #fff;
        border: 1px solid #e2e8f0;
        border-radius: 12px;
        box-shadow:
            0 4px 6px rgba(15, 23, 42, 0.05),
            0 20px 48px rgba(15, 23, 42, 0.14);
        z-index: 201;
    }

    .site-nav.nav-open {
        display: flex;
    }

    .site-nav a {
        width: 100%;
        text-align: left;
        padding: 10px 12px;
        font-size: 13px;
        border-radius: 8px;
    }

    .site-user {
        width: 100%;
        max-width: none;
        margin-right: 0;
        margin-bottom: 4px;
        padding: 6px 10px;
        font-size: 11px;
        text-align: center;
        border-radius: 10px;
    }

    .container {
        padding: 16px;
    }
}
