*,
*::before,
*::after {
    box-sizing: border-box;
}

:root {
    --wl-blue: #2436d4;
    --wl-blue-strong: #1d2bc0;
    --wl-surface: #eef1f6;
    --wl-surface-soft: #ffffff;
    --wl-border: #c7cede;
    --wl-text: #191919;
    --wl-text-muted: #616979;
    --wl-error-bg: #fff3f2;
    --wl-error-border: #f1b4b3;
    --wl-error-text: #b42318;
    --wl-info-bg: #eef4ff;
    --wl-info-border: #bed4ff;
    --wl-info-text: #2144a6;
    --wl-neutral-bg: #f5f5f5;
    --wl-neutral-border: #d9d9d9;
}

body.login-screen {
    margin: 0;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    overflow: auto;
    font-family: "Open Sans", sans-serif;
    color: var(--wl-text);
    background: var(--wl-neutral-bg);
}

.login-shell {
    width: min(450px, 100%);
    padding: 48px 48px 24px;
    background: var(--wl-surface-soft);
    border: 1px solid var(--wl-neutral-border);
    border-radius: 12px;
    box-shadow: none;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

#header {
    margin-bottom: 6px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    position: relative;
}

.wordlift-brand {
    width: 140px;
    height: auto;
    margin-bottom: 32px;
}

.login-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    padding-top: 0;
}

.login-title {
    color: var(--wl-text);
    margin: 16px 0;
    text-align: left;
    font-size: 20px;
    line-height: 28px;
    font-weight: 600;
    letter-spacing: normal;
}

.message {
    margin: 0 0 14px;
    padding: 10px 12px;
    border-radius: 10px;
    font-size: 14px;
    line-height: 1.3;
}

.message-error {
    background: var(--wl-error-bg);
    border: 1px solid var(--wl-error-border);
    color: var(--wl-error-text);
}

.message-info {
    background: var(--wl-info-bg);
    border: 1px solid var(--wl-info-border);
    color: var(--wl-info-text);
}

.form-field {
    margin-bottom: 8px;
}

.field-label {
    display: flex;
    align-items: baseline;
    gap: 4px;
    flex-wrap: wrap;
    margin: 0;
    padding: 8px 0;
    font-size: 14px;
    font-weight: 400;
    line-height: 28px;
    color: rgba(0, 0, 0, 0.88);
}

.field-required {
    color: #de1515;
}

.input-container {
    position: relative;
}

.close {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: #8e95a3;
    font-size: 26px;
    line-height: 1;
    padding: 0;
    margin-top: 0;
    position: absolute;
    top: 0;
    right: 0;
    transition: background-color 0.3s ease;
    border-radius: 8px;
    display: none;
}

.close:hover {
    cursor: pointer;
    background-color: #eef0f1;
}

.input-icon,
.password-input {
    box-sizing: border-box;
    width: 100%;
    height: 40px;
    padding: 8px;
    border: 1px solid var(--wl-neutral-border);
    background: var(--wl-surface-soft);
    border-radius: 8px;
    font-family: "Open Sans", sans-serif;
    font-size: 16px;
    color: var(--wl-text);
}

.input-icon:focus,
.password-input:focus {
    outline: none;
    border-color: var(--wl-blue);
    box-shadow: 0 0 0 3px rgba(52, 82, 219, 0.15);
}

.password-toggle {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    border: none;
    background: transparent;
    color: #191919;
    font-size: 12px;
    font-weight: 400;
    padding: 4px 6px;
    cursor: pointer;
    border-radius: 6px;
}

.password-toggle:hover {
    background: #f4f4f4;
}

.hidden {
    display: none;
}

input::placeholder {
    color: var(--wl-text-muted);
    font-size: 16px;
    font-weight: 400;
    line-height: 1.3;
}

.submit-button {
    margin: 24px 0 0;
    width: 100%;
    height: 40px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #fff;
    text-align: center;
    font-family: "Open Sans", sans-serif;
    font-size: 16px;
    font-weight: 400;
    border-radius: 8px;
    border: none;
    background: var(--wl-blue);
    box-shadow: 0 2px 0 rgba(36, 54, 212, 0.1);
    transition: background-color 0.2s ease;
}

.submit-button:hover {
    background: var(--wl-blue-strong);
}

.remember-me {
    margin-top: 0;
    padding: 8px 0;
    font-size: 14px;
    line-height: 28px;
    color: rgba(0, 0, 0, 0.88);
    display: flex;
    align-items: center;
    gap: 8px;
}

.lost-password-link {
    margin: 12px 0 0;
    font-size: 12px;
    line-height: 20px;
}

.lost-password-link a,
.tos-note a {
    color: var(--wl-blue);
    text-decoration: none;
}

.lost-password-link a:hover,
.tos-note a:hover {
    text-decoration: underline;
}

.tos-note {
    margin: 32px 0 0;
    color: var(--wl-text-muted);
    font-size: 12px;
    line-height: 20px;
}

.remember-me input[type="checkbox"] {
    width: 14px;
    height: 14px;
    accent-color: var(--wl-blue);
}

.remember-me label {
    cursor: pointer;
}

@media (max-width: 768px) {
    body.login-screen {
        justify-content: center;
        padding: 12px;
    }

    .login-shell {
        width: 100%;
        border: 1px solid var(--wl-neutral-border);
        box-shadow: none;
        padding: 24px 20px 20px;
    }

    .login-title {
        font-size: 20px;
        line-height: 28px;
    }

    .field-label { font-size: 14px; }
}

body.login-screen.sidebar-mode {
    align-items: stretch;
    justify-content: flex-end;
    padding: 0;
    overflow: hidden;
    background: transparent;
}

body.login-screen.sidebar-mode .login-shell {
    width: 100%;
    max-width: 300px;
    min-height: 100dvh;
    padding: 16px 12px 14px;
    border-radius: 0;
    border-top: none;
    border-right: none;
    border-bottom: none;
}

.close.sidebar-close {
    color: #7c8497;
}

@media (max-width: 340px) {
    body.login-screen {
        padding: 0;
        background: var(--wl-surface-soft);
    }

    .login-shell {
        min-height: 100dvh;
        border-radius: 0;
        border: none;
        padding: 12px;
    }

    .wordlift-brand {
        width: 112px;
    }

    .login-title {
        font-size: 18px;
        line-height: 25px;
        margin: 10px 0 8px;
    }

    .field-label,
    .remember-me,
    .message {
        font-size: 13px;
    }

    .input-icon,
    .password-input,
    .submit-button {
        height: 38px;
        font-size: 15px;
    }

    .submit-button {
        width: 100%;
    }

    .tos-note { margin-top: 18px; }
}

@media (max-width: 300px) {
    .login-shell {
        padding: 8px 8px 12px;
    }

    #header {
        margin-bottom: 0;
    }

    .wordlift-brand {
        margin-bottom: 10px;
    }

    .login-title {
        margin: 6px 0 8px;
    }

    .form-field {
        margin-bottom: 6px;
    }

    .field-label {
        padding: 4px 0;
        line-height: 20px;
    }

    .remember-me {
        padding: 4px 0;
        line-height: 20px;
    }

    .submit-button {
        margin-top: 10px;
    }

    .close {
        display: inline-flex;
        transform: translateY(-3px);
    }
}

body.error-screen {
    justify-content: center;
    align-items: center;
    padding: 20px;
    overflow: auto;
}

.error-shell {
    width: min(560px, 100%);
}

.error-panel {
    background: var(--wl-surface-soft);
    border: 1px solid rgba(183, 188, 194, 0.45);
    border-radius: 20px;
    box-shadow: 0 16px 36px rgba(23, 28, 58, 0.12);
    padding: 28px;
}

.error-header {
    margin-bottom: 18px;
}

.error-code {
    margin: 0;
    color: var(--wl-text-muted);
    font-size: 14px;
    font-weight: 600;
}

.error-title {
    margin: 6px 0 0;
    color: var(--wl-text);
    font-size: 30px;
    line-height: 1.2;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.error-description {
    margin: 0 0 14px;
    color: var(--wl-text-muted);
    font-size: 15px;
    line-height: 1.45;
}

.error-meta {
    margin: 0 0 16px;
    padding: 12px;
    border-radius: 12px;
    background: #f7f9fc;
    border: 1px solid #dde3f0;
    color: var(--wl-text);
    font-size: 13px;
}

.error-meta p {
    margin: 0;
}

.error-meta p + p {
    margin-top: 8px;
}

.error-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.error-action {
    text-decoration: none;
    width: fit-content;
    min-width: 140px;
    height: 44px;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    border-radius: 12px;
    font-family: "Open Sauce", "Open Sans", sans-serif;
    font-size: 15px;
    font-weight: 600;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.error-action-primary {
    color: #fff;
    border: 1px solid var(--wl-blue);
    background: var(--wl-blue);
}

.error-action-primary:hover {
    background: var(--wl-blue-strong);
    border-color: var(--wl-blue-strong);
}

.error-action-secondary {
    color: var(--wl-blue);
    border: 1px solid #cad3ef;
    background: #fff;
}

.error-action-secondary:hover {
    border-color: var(--wl-blue);
    color: var(--wl-blue-strong);
}
