body.login-body {
    min-height: 100vh;
    background: var(--theme-bg);
}

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 16px;
}

.login-box {
    position: relative;
    overflow: hidden;
    width: min(100%, 400px);
    padding: 30px 28px 28px;
    border-radius: var(--erp-control-radius);
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(21, 32, 51, 0.1);
    box-shadow: none;
    backdrop-filter: none;
}

.login-box::before {
    content: none;
    position: absolute;
    inset: 0 0 auto;
    height: 4px;
    background: var(--theme-surface-strong);
}

.login-page-theme-control {
    --login-theme-switcher-width: 220px;
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 1060;
}

.login-page-theme-control .app-theme-switcher {
    width: var(--login-theme-switcher-width);
}

.login-page-theme-control .app-theme-toggle {
    width: 100%;
    min-height: 38px;
    padding: 7px 10px;
    border-radius: var(--erp-control-radius);
    box-shadow: none;
}

.login-page-theme-control .app-theme-toggle-icon {
    width: 24px;
    height: 24px;
    font-size: var(--app-font-size-12);
}

.login-page-theme-control .app-theme-toggle-label {
    font-size: var(--app-font-size-10);
}

.login-page-theme-control .app-theme-toggle-copy strong {
    font-size: var(--app-font-size-11);
}

.login-page-theme-control .app-theme-toggle.dropdown-toggle::after {
    margin-left: auto;
}

.login-page-theme-control .app-theme-menu {
    box-sizing: border-box;
    width: var(--login-theme-switcher-width) !important;
    min-width: var(--login-theme-switcher-width) !important;
    max-width: var(--login-theme-switcher-width) !important;
    padding: 8px;
    animation: none;
}

.login-page-theme-control .app-theme-choice {
    gap: 10px;
    padding: 9px 10px;
}

.login-page-theme-control .app-theme-choice-preview {
    width: 28px;
    height: 28px;
    flex: 0 0 28px;
    padding: 4px;
    border-radius: 8px;
}

.login-page-theme-control .app-theme-choice-copy strong {
    font-size: var(--app-font-size-12);
}

.login-page-theme-control .app-theme-choice-copy small {
    font-size: var(--app-font-size-10);
    line-height: 1.25;
}

.login-page-theme-control .app-theme-choice-status {
    display: none;
}

.login-box-brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 22px;
}

.login-box-brand--centered {
    display: flex;
    width: 100%;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-bottom: 22px;
    text-align: center;
}

.login-box-brand--centered .login-brand-mark {
    display: block;
    flex: 0 0 auto;
    width: 58px;
    height: 58px;
    border-radius: 0;
    object-fit: contain;
    background: transparent !important;
}

.login-box-brand--centered .login-brand-copy {
    align-items: center;
    gap: 0;
}

.login-box-brand--centered .login-brand-title {
    font-size: var(--app-font-size-18);
    letter-spacing: 0;
}

.login-brand-mark {
    display: block;
    flex: 0 0 auto;
    width: 56px;
    height: 56px;
    border-radius: 0;
    object-fit: contain;
    background: transparent;
}

.login-brand-copy {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.login-brand-title {
    color: #152033;
    font-family: var(--app-font-display);
    font-size: var(--app-font-size-16);
    font-weight: var(--app-font-weight-bold);
    letter-spacing: 0;
}

.login-brand-subtitle {
    color: #64748b;
    font-size: var(--app-font-size-11);
    font-weight: var(--app-font-weight-bold);
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.login-box-header {
    margin-bottom: 20px;
}

.login-box-header h1 {
    margin: 0;
    color: #152033;
    font-family: var(--app-font-display);
    font-size: var(--app-font-size-30);
    font-weight: var(--app-font-weight-bold);
    line-height: 1.1;
    letter-spacing: 0;
}

.login-box-header p {
    margin: 12px 0 0;
    color: #526176;
    font-size: var(--app-font-size-14);
    line-height: 1.55;
}

.login-messages {
    display: grid;
    gap: 8px;
    margin-bottom: 22px;
}

body.login-popup-open {
    overflow: hidden;
}

.login-popup-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    background: rgba(10, 18, 32, 0.48);
    backdrop-filter: none;
}

.login-popup-card {
    position: relative;
    width: min(100%, 420px);
    padding: 24px 22px 20px;
    border-radius: var(--erp-control-radius);
    border: 1px solid rgba(196, 57, 57, 0.18);
    background: var(--theme-surface-strong);
    box-shadow: none;
}

.login-popup-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: #7a4751;
    font-size: var(--app-font-size-24);
    line-height: 1;
}

.login-popup-kicker {
    display: inline-block;
    margin-bottom: 8px;
    color: #8c2323;
    font-size: var(--app-font-size-11);
    font-weight: var(--app-font-weight-extrabold);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.login-popup-title {
    margin: 0 0 10px;
    color: #8c2323;
    font-family: var(--app-font-display);
    font-size: var(--app-font-size-22);
    font-weight: var(--app-font-weight-bold);
    letter-spacing: 0;
}

.login-popup-message {
    margin: 0 0 10px;
    color: #8c2323;
    font-size: var(--app-font-size-14);
    font-weight: var(--app-font-weight-bold);
    line-height: 1.55;
    text-transform: lowercase;
}

.login-popup-note {
    margin: 0;
    color: #526176;
    font-size: var(--app-font-size-13);
    line-height: 1.65;
}

.login-popup-actions {
    display: flex;
    gap: 10px;
    margin-top: 18px;
}

.login-popup-link,
.login-popup-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 10px 16px;
    border-radius: var(--erp-control-radius);
    font-size: var(--app-font-size-12);
    font-weight: var(--app-font-weight-bold);
    text-decoration: none;
}

.login-popup-link {
    background: rgba(15, 108, 123, 0.1);
    color: #0f6c7b;
}

.login-popup-button {
    border: 0;
    background: var(--theme-surface-strong);
    color: #ffffff;
}

html[data-theme="dark"] body.login-body {
    background: var(--theme-bg);
}

html[data-theme="dark"] .login-box {
    background: rgba(15, 23, 42, 0.92);
    border-color: rgba(148, 163, 184, 0.18);
    box-shadow: none;
}

html[data-theme="dark"] .login-brand-mark {
    background: transparent;
}

html[data-theme="dark"] .login-brand-title,
html[data-theme="dark"] .login-box-header h1,
html[data-theme="dark"] .form-row label {
    color: #e2e8f0;
}

html[data-theme="dark"] .login-brand-subtitle,
html[data-theme="dark"] .login-box-header p,
html[data-theme="dark"] .login-form-help,
html[data-theme="dark"] .login-note,
html[data-theme="dark"] .login-popup-note {
    color: #94a3b8;
}

html[data-theme="dark"] .form-row input {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(148, 163, 184, 0.2);
    color: #e2e8f0;
}

html[data-theme="dark"] .form-row input::placeholder {
    color: #94a3b8;
}

html[data-theme="dark"] .form-row input:focus {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(45, 212, 191, 0.4);
    box-shadow: none;
}

html[data-theme="dark"] .toggle-pw {
    color: #94a3b8;
}

html[data-theme="dark"] .toggle-pw:hover {
    color: #5eead4;
}

html[data-theme="dark"] .login-btn {
    background: var(--theme-surface-strong);
    box-shadow: none;
}

html[data-theme="dark"] .login-link-btn {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(148, 163, 184, 0.2);
    color: #e2e8f0;
}

html[data-theme="dark"] .login-link-btn:hover {
    box-shadow: none;
    border-color: rgba(45, 212, 191, 0.26);
}

html[data-theme="dark"] .login-card-note {
    background: rgba(20, 184, 166, 0.1);
    border-color: rgba(20, 184, 166, 0.16);
}

html[data-theme="dark"] .login-note-title {
    color: #5eead4;
}

html[data-theme="dark"] .login-popup-backdrop {
    background: rgba(2, 6, 23, 0.66);
}

html[data-theme="dark"] .login-popup-card {
    background: var(--theme-surface-strong);
    border-color: rgba(248, 113, 113, 0.18);
    box-shadow: none;
}

html[data-theme="dark"] .login-popup-close,
html[data-theme="dark"] .login-popup-title,
html[data-theme="dark"] .login-popup-message {
    color: #fda4af;
}

html[data-theme="dark"] .login-popup-link {
    background: rgba(45, 212, 191, 0.12);
    color: #99f6e4;
}

html[data-theme="dark"] .login-popup-button {
    background: var(--theme-surface-strong);
    color: #ecfeff;
}

.login-alert {
    padding: 12px 14px;
    border-radius: var(--erp-control-radius);
    font-size: var(--app-font-size-13);
    font-weight: var(--app-font-weight-semibold);
    line-height: 1.5;
}

.login-alert-danger,
.login-alert-error {
    background: rgba(196, 57, 57, 0.1);
    border: 1px solid rgba(196, 57, 57, 0.16);
    color: #8c2323;
}

.login-alert-success {
    background: rgba(33, 127, 91, 0.1);
    border: 1px solid rgba(33, 127, 91, 0.16);
    color: #0f5c3d;
}

.login-alert-warning {
    background: rgba(213, 145, 31, 0.1);
    border: 1px solid rgba(213, 145, 31, 0.16);
    color: #7d4f00;
}

.login-form {
    display: grid;
    gap: 15px;
}

.form-row {
    display: grid;
    gap: 7px;
}

.form-row label {
    color: #334155;
    font-size: var(--app-font-size-12);
    font-weight: var(--app-font-weight-bold);
}

.form-row input {
    width: 100%;
    min-height: 46px;
    padding: 12px 14px;
    border-radius: var(--erp-control-radius);
    border: 1px solid rgba(21, 32, 51, 0.12);
    background: rgba(255, 255, 255, 0.96);
    color: #152033;
    font-size: var(--app-font-size-14);
    transition: border-color 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

.form-row input::placeholder {
    color: #94a3b8;
}

.form-row input:focus {
    outline: none;
    border-color: rgba(15, 108, 123, 0.4);
    box-shadow: none;
    background: #ffffff;
}

.input-wrap {
    position: relative;
}

.input-wrap input {
    padding-right: 48px;
}

.toggle-pw {
    position: absolute;
    top: 50%;
    right: 6px;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 0;
    border-radius: var(--erp-control-radius);
    background: transparent;
    color: #64748b;
    cursor: pointer;
    transition: color 0.16s ease;
}

.toggle-pw:hover {
    color: #0f6c7b;
}

.login-btn {
    width: 100%;
    min-height: 48px;
    margin-top: 2px;
    border: 0;
    border-radius: var(--erp-control-radius);
    background: var(--theme-surface-strong);
    color: #ffffff;
    font-size: var(--app-font-size-14);
    font-weight: var(--app-font-weight-bold);
    letter-spacing: 0;
    box-shadow: none;
    transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.login-btn:hover {
    transform: none;
    box-shadow: none;
}

.login-action-row {
    margin-top: 16px;
    display: grid;
    gap: 10px;
}

.login-link-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 46px;
    padding: 12px 14px;
    border-radius: var(--erp-control-radius);
    border: 1px solid rgba(21, 32, 51, 0.12);
    background: rgba(255, 255, 255, 0.88);
    color: #152033;
    font-size: var(--app-font-size-14);
    font-weight: var(--app-font-weight-bold);
    text-decoration: none;
    transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.login-link-btn:hover {
    transform: none;
    box-shadow: none;
    border-color: rgba(15, 108, 123, 0.24);
}

.login-form-help {
    margin: 0;
    color: #64748b;
    font-size: var(--app-font-size-12);
    line-height: 1.6;
    text-align: center;
}

.login-card-note {
    margin-top: 18px;
    padding: 14px 16px;
    border-radius: var(--erp-control-radius);
    background: rgba(15, 108, 123, 0.08);
    border: 1px solid rgba(15, 108, 123, 0.12);
}

.login-note-title {
    display: block;
    color: #0f6c7b;
    font-size: var(--app-font-size-12);
    font-weight: var(--app-font-weight-extrabold);
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.login-card-note p {
    margin: 8px 0 0;
    color: #445569;
    font-size: var(--app-font-size-13);
    line-height: 1.65;
}

.login-note {
    margin: 16px 0 0;
    color: #64748b;
    font-size: var(--app-font-size-12);
    line-height: 1.6;
    text-align: center;
}

@media (max-width: 575.98px) {
    .login-page {
        padding: 20px 12px;
    }

    .login-box {
        padding: 28px 18px 24px;
        border-radius: var(--erp-control-radius);
    }

    .login-page-theme-control {
        --login-theme-switcher-width: 200px;
        top: 14px;
        right: 12px;
    }

    .login-box-header h1 {
        font-size: var(--app-font-size-28);
    }

    .login-popup-actions {
        flex-direction: column;
    }

    .login-popup-link,
    .login-popup-button {
        width: 100%;
    }
}
