* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: Arial, sans-serif;
    background: linear-gradient(-45deg, #eff6ff, #f5f3ff, #fdf2f8, #fff7ed);
    background-size: 400% 400%;
    animation: animatedBg 18s ease infinite;
    color: #111827;
}

body.auth-modal-open {
    animation-play-state: paused;
}

@keyframes animatedBg {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.public-header {
    position: fixed;
    top: 16px;
    left: 24px;
    right: 24px;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.public-header > * {
    position: relative;
    z-index: 2;
}

.public-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: #5b4ee8;
    font-size: 13px;
    font-weight: 900;
    letter-spacing: .08em;
    text-decoration: none;
}

.public-logo-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 76px;
    height: 30px;
    border-radius: 9px;
    background: #5b4ee8;
    color: #fff;
    padding: 0 13px;
    font-size: 14px;
    font-weight: 900;
    letter-spacing: .04em;
}

.public-menu-toggle {
    display: none;
    width: 42px;
    height: 42px;
    border: 1px solid #d8d4ff;
    border-radius: 12px;
    background: rgba(255,255,255,.92);
    color: #5b4ee8;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 5px;
    box-shadow: 0 10px 26px rgba(15,23,42,.08);
}

.public-menu-toggle span {
    width: 18px;
    height: 2px;
    border-radius: 2px;
    background: currentColor;
    display: block;
}

.public-backdrop {
    display: none;
}

.public-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 28px;
    padding: 0 18px;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1;
}

.public-nav a {
    color: #1a1730;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
}

.public-nav a:hover {
    color: #5b4ee8;
}

.public-nav-brand,
.public-nav-actions {
    display: none;
}

.public-auth {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    min-width: 285px;
}

.pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #d8d4ff;
    border-radius: 999px;
    background: rgba(255,255,255,.9);
    color: #3c3489;
    padding: 11px 16px;
    font-size: 14px;
    font-weight: 800;
    text-decoration: none;
    box-shadow: 0 10px 26px rgba(15,23,42,.08);
    cursor: pointer;
    font-family: inherit;
}

.pill.primary {
    border-color: #5b4ee8;
    background: #5b4ee8;
    color: #fff;
}

.user-box {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255,255,255,.92);
    border: 1px solid #e5e3f5;
    border-radius: 999px;
    padding: 6px 8px 6px 14px;
    box-shadow: 0 10px 26px rgba(15,23,42,.08);
}

.user-name {
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #1a1730;
    font-size: 14px;
    font-weight: 500;
}

.public-footer {
    position: static;
    display: block;
    text-align: center;
    color: #6b6a8a;
    font-size: 12px;
    line-height: 1.45;
    padding: 34px 24px 34px;
    margin-top: 0;
}

.public-footer a {
    color: #4f46e5;
    font-size: 12px;
    font-weight: 500;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.public-footer a:hover {
    color: #5b4ee8;
}

.auth-modal {
    position: fixed;
    inset: 0;
    z-index: 300;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 22px;
    background: rgba(26,23,48,.56);
}

.auth-modal.is-open {
    display: flex;
}

.auth-dialog {
    width: min(430px, 100%);
    background: #fff;
    border: 1px solid #e5e3f5;
    border-radius: 24px;
    padding: 28px;
    box-shadow: 0 28px 90px rgba(15,23,42,.24);
    text-align: left;
}

.auth-dialog-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 22px;
}

.auth-eyebrow {
    color: #5b4ee8;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .12em;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.auth-title {
    margin: 0;
    color: #1a1730;
    font-size: 24px;
    line-height: 1.15;
}

.auth-close {
    width: 36px;
    height: 36px;
    border: 1px solid #e5e3f5;
    border-radius: 50%;
    background: #f8f7fe;
    color: #6b6a8a;
    cursor: pointer;
    font-size: 22px;
    line-height: 1;
}

.auth-field {
    margin-bottom: 14px;
}

.google-auth-btn {
    width: 100%;
    min-height: 48px;
    border: 1px solid #e5e3f5;
    border-radius: 999px;
    background: #fff;
    color: #1a1730;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    text-decoration: none;
    font-size: 15px;
    font-weight: 900;
    box-shadow: 0 10px 24px rgba(15,23,42,.08);
}

.google-auth-btn img {
    width: 24px;
    height: 24px;
    display: block;
    flex-shrink: 0;
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 16px 0;
    color: #9a99b5;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .08em;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    height: 1px;
    flex: 1;
    background: #e5e3f5;
}

.auth-field label {
    display: block;
    margin-bottom: 7px;
    color: #9a99b5;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.auth-field input {
    width: 100%;
    border: 1px solid #e5e3f5;
    border-radius: 14px;
    padding: 14px 15px;
    color: #1a1730;
    font-size: 16px;
    outline: none;
}

.auth-field input:focus {
    border-color: #5b4ee8;
    box-shadow: 0 0 0 4px rgba(91,78,232,.12);
}

.auth-consent {
    display: grid;
    grid-template-columns: 20px 1fr;
    gap: 10px;
    align-items: start;
    margin: 2px 0 16px;
    color: #6b6a8a;
    font-size: 13px;
    line-height: 1.45;
}

.auth-consent input {
    width: 18px;
    height: 18px;
    margin: 1px 0 0;
    accent-color: #5b4ee8;
}

.auth-consent a {
    color: #4f46e5;
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.auth-recaptcha {
    display: flex;
    justify-content: center;
    min-height: 78px;
    margin: 4px 0 16px;
    overflow: hidden;
    transform-origin: top center;
}

.auth-submit {
    width: 100%;
    border: 1px solid #5b4ee8;
    border-radius: 999px;
    background: #5b4ee8;
    color: #fff;
    padding: 14px 18px;
    font-size: 16px;
    font-weight: 900;
    cursor: pointer;
}

.auth-submit:disabled {
    cursor: wait;
    opacity: .72;
}

.auth-message {
    display: none;
    margin-bottom: 14px;
    border-radius: 14px;
    padding: 12px 14px;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.45;
}

.auth-message.error {
    display: block;
    background: #faece7;
    color: #993c1d;
    border: 1px solid #f0c9bd;
}

.auth-message.success {
    display: block;
    background: #e1f5ee;
    color: #1d9e75;
    border: 1px solid #bfe7d8;
}

.auth-switch {
    margin-top: 16px;
    text-align: center;
    color: #6b6a8a;
    font-size: 14px;
}

.auth-switch button {
    border: 0;
    background: transparent;
    color: #5b4ee8;
    font: inherit;
    font-weight: 900;
    cursor: pointer;
}

@media(max-width: 900px) {
    body.public-menu-open {
        overflow: hidden;
    }

    .public-header {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 160;
        align-items: center;
        justify-content: space-between;
        background: rgba(255,255,255,.96);
        border-bottom: 1px solid #e5e3f5;
        border-radius: 0;
        padding: 12px 14px;
        box-shadow: none;
        gap: 12px;
    }

    .public-menu-toggle {
        display: flex;
        width: 42px;
        height: 42px;
        border: 1px solid #d8d4ff;
        border-radius: 12px;
        background: #fff;
        box-shadow: none;
        color: #5b4ee8;
        flex-shrink: 0;
    }

    .public-menu-toggle span {
        width: 18px;
        height: 2px;
    }

    .public-logo {
        flex: 1;
        justify-content: flex-start;
        font-size: 12px;
    }

    .public-logo-mark {
        min-width: auto;
        height: auto;
        border-radius: 10px;
        padding: 7px 12px;
        font-size: 12px;
    }

    .public-nav {
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        z-index: 150;
        width: min(320px, 86vw);
        flex: none;
        transform: translateX(-100%);
        transition: transform .22s ease;
        background: #fff;
        border-right: 1px solid #e5e3f5;
        box-shadow: 18px 0 60px rgba(15,23,42,.18);
        padding: 24px 18px;
        display: flex;
        align-items: stretch;
        justify-content: flex-start;
        flex-direction: column;
        gap: 8px;
    }

    .public-nav-brand {
        display: flex;
        align-items: center;
        gap: 8px;
        color: #5b4ee8;
        font-size: 13px;
        font-weight: 900;
        letter-spacing: .08em;
        margin-bottom: 10px;
    }

    .public-nav a {
        display: flex;
        align-items: center;
        min-height: 46px;
        border: 1px solid transparent;
        border-radius: 12px;
        padding: 12px 14px;
    }

    .public-nav a:hover {
        background: #eeedfe;
        border-color: #d8d4ff;
    }

    body.public-menu-open .public-nav {
        transform: translateX(0);
    }

    .public-backdrop {
        position: fixed;
        inset: 0;
        z-index: 140;
        background: rgba(26,23,48,.38);
    }

    body.public-menu-open .public-backdrop {
        display: block;
    }

    .public-nav-actions {
        display: flex;
        flex-direction: column;
        gap: 10px;
        margin-top: auto;
        padding-top: 18px;
    }

    .public-nav-actions .pill,
    .public-nav-actions .logout-mobile {
        width: 100%;
        text-align: center;
        justify-content: center;
        box-shadow: none;
    }

    .public-nav-actions .logout-mobile {
        border: 1px solid #f0c9bd;
        border-radius: 999px;
        background: #faece7;
        color: #993c1d;
        padding: 11px 14px;
        font-size: 14px;
        font-weight: 800;
        text-decoration: none;
    }

    .public-auth {
        min-width: 0;
        flex: 0 0 auto;
    }

    .pill.primary {
        border-color: #d8d4ff;
        background: #fff;
        color: #3c3489;
        box-shadow: none;
        padding: 8px 12px;
        font-size: 13px;
    }

    .user-box .pill.primary {
        border-color: #5b4ee8;
        background: #5b4ee8;
        color: #fff;
    }

    .public-auth > .pill:not(.primary) {
        display: none;
    }

    .user-box {
        padding: 0;
        border: 0;
        background: transparent;
        box-shadow: none;
    }

    .user-name {
        display: none;
    }

    .public-footer {
        position: static;
        width: 100%;
        padding: 34px 42px 34px;
        display: block;
        text-align: center;
    }

    .auth-dialog {
        width: min(430px, calc(100vw - 32px));
        padding: 24px;
    }

    .auth-recaptcha {
        width: 304px;
        min-height: 68px;
        margin-left: auto;
        margin-right: auto;
        transform: scale(.88);
    }
}

@media(max-width: 360px) {
    .auth-dialog {
        padding: 20px;
    }

    .auth-recaptcha {
        transform: scale(.82);
    }
}
