:root {
    --menu-auth-navy: #0f3151;
    --menu-auth-blue: #0369a1;
    --menu-auth-cyan: #0891b2;
    --menu-auth-danger: #b91c1c;
}

.menu-auth-button {
    color: #7c3aed !important;
    border-color: rgba(124, 58, 237, .25) !important;
    background: linear-gradient(180deg, #fff, #f5f3ff) !important;
}

.menu-auth-button.is-authenticated {
    color: #fff !important;
    border-color: transparent !important;
    background: linear-gradient(135deg, #047857, #0d9488) !important;
    box-shadow: 0 9px 20px rgba(4, 120, 87, .25) !important;
}

.menu-auth-locked {
    filter: saturate(.58);
    opacity: .76;
}

.menu-auth-locked::after {
    content: "🔒";
    position: absolute;
    right: 2px;
    top: 2px;
    display: grid;
    place-items: center;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    color: #fff;
    background: #f59e0b;
    box-shadow: 0 2px 5px rgba(15, 23, 42, .25);
    font: 8px/1 system-ui, sans-serif;
    pointer-events: none;
}

.menu-analysis-authenticated .menu-auth-locked::after { content: none; }

.bws-menu-items button.menu-auth-denied,
.bws-menu-items button[hidden] {
    display: none !important;
}

.bws-menu-items button.bws-menu-logout {
    color: #b91c1c;
    border-color: rgba(185, 28, 28, .28);
    background: rgba(255, 255, 255, .97);
}

.bws-menu-items button.bws-menu-logout:hover,
.bws-menu-items button.bws-menu-logout:focus-visible {
    color: #fff;
    border-color: #b91c1c;
    background: #b91c1c;
}

.bws-menu-items button.bws-menu-logout svg {
    width: 21px;
    height: 21px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.menu-auth-modal[hidden],
.menu-auth-dialog [hidden] {
    display: none !important;
}

.menu-auth-modal {
    position: fixed;
    z-index: 280000;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 18px;
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.menu-auth-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(2, 16, 29, .62);
    backdrop-filter: blur(7px);
    -webkit-backdrop-filter: blur(7px);
}

.menu-auth-dialog {
    position: relative;
    width: min(390px, calc(100vw - 28px));
    max-height: calc(100dvh - 28px);
    overflow: auto;
    padding: 30px;
    border: 1px solid rgba(255, 255, 255, .62);
    border-radius: 24px;
    color: #0f172a;
    background: rgba(255, 255, 255, .985);
    box-shadow: 0 30px 80px rgba(2, 16, 29, .38);
    animation: menu-auth-enter .2s ease-out both;
}

@keyframes menu-auth-enter {
    from { opacity: 0; transform: translateY(12px) scale(.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.menu-auth-close {
    position: absolute;
    right: 14px;
    top: 14px;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 11px;
    color: #475569;
    background: #eef2f7;
    font: 800 21px/1 system-ui, sans-serif;
    cursor: pointer;
}

.menu-auth-brand {
    display: grid;
    place-items: center;
    width: 100%;
    height: 96px;
    margin: 2px auto 28px;
    background: transparent;
}

.menu-auth-brand img {
    display: block;
    width: 96px;
    height: 96px;
    max-width: 96px;
    max-height: 96px;
    object-fit: contain;
}

.menu-auth-dialog h2 {
    margin: 0;
    color: var(--menu-auth-navy);
    font-size: clamp(21px, 5vw, 27px);
    line-height: 1.15;
    text-align: center;
}

.menu-auth-field {
    display: grid;
    gap: 7px;
    margin-top: 14px;
    color: #334155;
    font-size: 12px;
    font-weight: 800;
}

.menu-auth-field input {
    box-sizing: border-box;
    width: 100%;
    height: 46px;
    padding: 0 13px;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    outline: none;
    color: #0f172a;
    background: #fff;
    font: 650 14px/1 Inter, sans-serif;
    transition: border-color .16s ease, box-shadow .16s ease;
}

.menu-auth-field input:focus {
    border-color: #0ea5e9;
    box-shadow: 0 0 0 4px rgba(14, 165, 233, .14);
}

.menu-auth-password-wrap { position: relative; }
.menu-auth-password-wrap input { padding-right: 66px; }

.menu-auth-password-toggle {
    position: absolute;
    right: 7px;
    top: 50%;
    transform: translateY(-50%);
    height: 32px;
    padding: 0 10px;
    border: 0;
    border-radius: 8px;
    color: #0369a1;
    background: #e0f2fe;
    font-size: 10px;
    font-weight: 850;
    cursor: pointer;
}

.menu-auth-status {
    min-height: 18px;
    margin: 12px 0 2px;
    color: #64748b;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.4;
}
.menu-auth-status:empty { display: none; }

.menu-auth-status.is-error { color: var(--menu-auth-danger); }
.menu-auth-status.is-loading { color: #0369a1; }

.menu-auth-submit,
.menu-auth-logout {
    width: 100%;
    min-height: 46px;
    margin-top: 7px;
    border: 0;
    border-radius: 13px;
    color: #fff;
    background: linear-gradient(135deg, var(--menu-auth-blue), var(--menu-auth-cyan));
    box-shadow: 0 10px 22px rgba(3, 105, 161, .22);
    font: 850 13px/1 Inter, sans-serif;
    cursor: pointer;
}

.menu-auth-logout { background: linear-gradient(135deg, #b91c1c, #dc2626); }
.menu-auth-submit:disabled,
.menu-auth-logout:disabled { opacity: .58; cursor: wait; }

body.menu-auth-open { overflow: hidden; }

#bwsUnifiedMenuToggle.menu-auth-locked {
    position: relative;
}

@media (max-width: 1024px) {
    .responsive-menu-dock {
        grid-template-columns: repeat(8, minmax(0, 1fr)) !important;
    }
    .menu-auth-responsive-button {
        grid-row: 2 !important;
    }
}

@media (max-width: 480px) {
    .menu-auth-dialog {
        padding: 24px 20px;
        border-radius: 19px;
    }
    .menu-auth-locked::after {
        width: 13px;
        height: 13px;
        font-size: 7px;
    }
    .menu-auth-brand {
        height: 88px;
        margin-bottom: 24px;
    }
    .menu-auth-brand img {
        width: 88px;
        height: 88px;
        max-width: 88px;
        max-height: 88px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .menu-auth-dialog { animation: none; }
}
