:root {
    color-scheme: light;
    --page-bg: #f5f8fb;
    --panel-bg: #ffffff;
    --text: #142033;
    --muted: #62718a;
    --line: #dbe4ef;
    --primary: #006dff;
    --primary-dark: #0054c7;
    --focus: rgba(0, 109, 255, 0.2);
    --error: #b42318;
}

* {
    box-sizing: border-box;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0;
    color: var(--text);
    background:
        linear-gradient(180deg, rgba(0, 109, 255, 0.08), rgba(255, 255, 255, 0) 42%),
        var(--page-bg);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.language-switcher {
    position: fixed;
    z-index: 10;
    top: max(16px, env(safe-area-inset-top));
    right: max(16px, env(safe-area-inset-right));
    display: grid;
    grid-template-columns: repeat(2, minmax(44px, 1fr));
    gap: 3px;
    padding: 4px;
    border: 1px solid rgba(20, 32, 51, 0.12);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 10px 30px rgba(20, 32, 51, 0.14);
    backdrop-filter: blur(10px);
}

.language-switcher-option {
    min-height: 44px;
    padding: 0 12px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font: inherit;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.04em;
    transition: background-color 150ms ease, color 150ms ease, box-shadow 150ms ease;
}

.language-switcher-option:hover:not(.is-active) {
    background: var(--page-bg);
    color: var(--text);
}

.language-switcher-option.is-active {
    background: var(--primary);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(0, 109, 255, 0.28);
}

.language-switcher-option:focus-visible {
    outline: 3px solid var(--focus);
    outline-offset: 2px;
}

.auth-shell {
    display: grid;
    flex: 1;
    width: 100%;
    min-height: 0;
    place-items: center;
    padding: 32px 18px;
}

.auth-legal-footer {
    flex: none;
    width: 100%;
    padding: 15px max(18px, env(safe-area-inset-right)) max(15px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
    border-top: 1px solid rgba(20, 32, 51, 0.09);
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
}

.auth-legal-links {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px 24px;
    max-width: 900px;
    margin: 0 auto;
}

.auth-legal-links a {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    font-size: 13px;
    font-weight: 650;
    line-height: 1.4;
    text-decoration: none;
}

.auth-legal-links a:hover {
    color: var(--primary);
    text-decoration: underline;
}

.auth-legal-links a:focus-visible {
    border-radius: 3px;
    outline: 3px solid var(--focus);
    outline-offset: 3px;
}

.cookie-banner {
    position: fixed;
    z-index: 20;
    right: max(18px, env(safe-area-inset-right));
    bottom: calc(64px + env(safe-area-inset-bottom));
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 16px;
    align-items: center;
    width: min(680px, calc(100% - 36px));
    padding: 16px;
    border: 1px solid rgba(20, 32, 51, 0.1);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 22px 70px rgba(20, 32, 51, 0.18);
    backdrop-filter: blur(14px);
}

.cookie-banner[hidden] {
    display: none;
}

.cookie-banner-copy {
    display: grid;
    gap: 4px;
}

.cookie-banner-copy strong {
    font-size: 14px;
    font-weight: 800;
}

.cookie-banner-copy p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.45;
}

.cookie-banner-copy a {
    color: var(--primary);
    font-weight: 700;
    text-decoration: none;
}

.cookie-banner-copy a:hover {
    text-decoration: underline;
}

.cookie-banner-copy a:focus-visible,
.cookie-banner-button:focus-visible {
    outline: 3px solid var(--focus);
    outline-offset: 3px;
}

.cookie-banner-button {
    min-height: 44px;
    padding: 0 16px;
    border: 0;
    border-radius: 12px;
    background: var(--primary);
    color: #ffffff;
    cursor: pointer;
    font: inherit;
    font-size: 13px;
    font-weight: 800;
    box-shadow: 0 8px 18px rgba(0, 109, 255, .2);
    transition: background-color 150ms ease, box-shadow 150ms ease, transform 150ms ease;
    white-space: nowrap;
}

.cookie-banner-button:hover {
    background: var(--primary-dark);
    box-shadow: 0 10px 22px rgba(0, 84, 199, .24);
}

.auth-panel {
    width: min(100%, 420px);
    padding: 34px;
    border: 1px solid var(--line);
    border-radius: 24px;
    background: var(--panel-bg);
    box-shadow: 0 24px 70px rgba(20, 32, 51, 0.1);
}

.auth-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 28px;
}

.auth-logo {
    width: 44px;
    height: 44px;
    object-fit: contain;
}

.auth-brand-text {
    display: grid;
    gap: 2px;
}

.auth-brand-name {
    font-size: 20px;
    font-weight: 700;
}

.auth-brand-subtitle {
    color: var(--muted);
    font-size: 13px;
}

.auth-title {
    margin: 0 0 8px;
    font-size: 24px;
    font-weight: 700;
}

.auth-copy {
    margin: 0 0 24px;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.55;
}

.auth-form {
    display: grid;
    gap: 16px;
}

.field {
    display: grid;
    gap: 7px;
}

.field label {
    font-size: 13px;
    font-weight: 650;
}

.field input,
.field select {
    width: 100%;
    min-height: 46px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #ffffff;
    color: var(--text);
    font: inherit;
    transition: border-color 150ms ease, box-shadow 150ms ease;
}

.login-panel {
    width: min(100%, 390px);
    padding: 30px;
}

.login-brand {
    justify-content: center;
    margin-bottom: 24px;
}

.login-brand .auth-logo {
    width: 48px;
    height: 48px;
}

.login-brand .auth-brand-name {
    font-size: 1.35rem;
    font-weight: 780;
}

.login-panel .auth-title {
    margin-bottom: 24px;
    text-align: center;
}

.login-forgot-link {
    width: max-content;
    max-width: 100%;
    justify-self: end;
    color: var(--primary);
    font-size: 13px;
    font-weight: 650;
    text-decoration: none;
}

.login-forgot-link:hover {
    text-decoration: underline;
}

.login-forgot-link:focus-visible {
    border-radius: 3px;
    outline: 3px solid var(--focus);
    outline-offset: 3px;
}

.login-registration-link {
    margin-top: 14px;
}

.field select {
    appearance: none;
    background-image:
        linear-gradient(45deg, transparent 50%, var(--muted) 50%),
        linear-gradient(135deg, var(--muted) 50%, transparent 50%);
    background-position:
        calc(100% - 18px) 19px,
        calc(100% - 13px) 19px;
    background-repeat: no-repeat;
    background-size: 5px 5px;
}

.field input:focus,
.field select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--focus);
    outline: none;
}

.errorlist,
.auth-errors {
    margin: 0;
    padding: 0;
    color: var(--error);
    font-size: 13px;
    list-style: none;
}

.auth-button {
    display: inline-flex;
    width: 100%;
    min-height: 48px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--primary);
    border-radius: 12px;
    background: var(--primary);
    color: #ffffff;
    cursor: pointer;
    font: inherit;
    font-weight: 800;
    box-shadow: 0 10px 24px rgba(0, 109, 255, .22);
    padding: 0 18px;
    text-decoration: none;
    transition: background-color 150ms ease, border-color 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}

.password-control {
    position: relative;
    display: block;
}

.password-control input {
    padding-right: 52px;
}

.password-visibility-button {
    position: absolute;
    top: 50%;
    right: 5px;
    display: grid;
    width: 40px;
    height: 40px;
    place-items: center;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    transform: translateY(-50%);
}

.password-visibility-button:hover {
    background: var(--page-bg);
    color: var(--primary);
}

.password-visibility-button:focus-visible {
    outline: 3px solid var(--focus);
    outline-offset: 1px;
}

.password-visibility-button svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
}

.password-visibility-button svg[hidden] {
    display: none;
}

.auth-button:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    box-shadow: 0 12px 28px rgba(0, 84, 199, .26);
}

.auth-button:active,
.cookie-banner-button:active {
    box-shadow: 0 5px 12px rgba(0, 84, 199, .2);
    transform: translateY(1px);
}

.auth-button:focus-visible {
    outline: 3px solid var(--focus);
    outline-offset: 3px;
}

.auth-button:disabled {
    cursor: not-allowed;
    opacity: .58;
    box-shadow: none;
}

.auth-button-secondary {
    border-color: rgba(0, 109, 255, .2);
    background: #edf5ff;
    color: var(--primary-dark);
    box-shadow: none;
}

.auth-button-secondary:hover {
    border-color: rgba(0, 109, 255, .32);
    background: #e1efff;
    color: var(--primary-dark);
    box-shadow: 0 8px 18px rgba(0, 109, 255, .1);
}

.auth-secondary-form {
    margin-top: 12px;
}

.auth-footer {
    margin: 22px 0 0;
    color: var(--muted);
    font-size: 14px;
    text-align: center;
}

.auth-footer a {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    color: var(--primary);
    font-weight: 650;
    text-decoration: none;
}

.auth-footer a:hover {
    text-decoration: underline;
}

.auth-eyebrow {
    margin: 0 0 8px;
    color: var(--primary);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.field-hint {
    margin: -4px 0 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.45;
}

.invitation-shell {
    padding-top: 72px;
}

.invitation-panel {
    width: min(100%, 470px);
    border-radius: 24px;
    box-shadow: 0 28px 80px rgba(20, 32, 51, 0.12);
}

.invitation-summary {
    display: flex;
    align-items: center;
    gap: 13px;
    margin: 22px 0;
    padding: 14px;
    border: 1px solid rgba(0, 109, 255, .12);
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(0, 109, 255, .08), rgba(255, 255, 255, .86));
}

.invitation-summary-stack {
    display: grid;
    gap: 12px;
}

.invitation-summary small,
.invitation-summary strong {
    display: block;
}

.invitation-summary small {
    margin-bottom: 3px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.invitation-summary strong {
    overflow-wrap: anywhere;
    font-size: 15px;
}

.invitation-summary-icon,
.invitation-state-icon {
    display: inline-grid;
    flex: 0 0 auto;
    width: 44px;
    height: 44px;
    place-items: center;
    border-radius: 14px;
    background: rgba(0, 109, 255, .1);
}

.invitation-state-panel {
    text-align: center;
}

.invitation-state-panel .auth-copy {
    margin-bottom: 10px;
}

.invitation-state-icon {
    margin-bottom: 18px;
    font-size: 24px;
    font-weight: 900;
}

.invitation-state-warning {
    background: #fff7ed;
    color: #c2410c;
}

.invitation-state-danger {
    background: #fef2f2;
    color: #b42318;
}

@media (max-width: 480px) {
    .language-switcher {
        top: max(10px, env(safe-area-inset-top));
        right: max(10px, env(safe-area-inset-right));
        grid-template-columns: repeat(2, minmax(44px, 1fr));
    }

    .language-switcher-option {
        min-height: 44px;
        padding: 0 10px;
    }

    .auth-shell {
        align-items: stretch;
        padding: 72px 14px 18px;
    }

    .auth-legal-footer {
        padding-top: 13px;
    }

    .auth-legal-links {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px 14px;
        text-align: center;
    }

    .auth-legal-links a {
        font-size: 12px;
    }

    .cookie-banner {
        right: max(10px, env(safe-area-inset-right));
        bottom: calc(76px + env(safe-area-inset-bottom));
        grid-template-columns: 1fr;
        gap: 12px;
        width: min(100% - 20px, 460px);
        padding: 14px;
        border-radius: 18px;
    }

    .cookie-banner-button {
        width: 100%;
    }

    .auth-panel {
        align-self: center;
        padding: 26px 20px;
    }

    .login-panel {
        padding: 26px 20px;
    }

    .invitation-shell {
        padding-top: 74px;
    }

    .invitation-panel {
        border-radius: 20px;
    }
}
