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

html, body {
    min-height: 100%;
}

body {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
    background: #fff;
    color: #1a1a2e;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

.login-container {
    display: flex;
    min-height: 100vh;
    position: relative;
}

.login-panel-form {
    flex: 0 0 480px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 48px 40px;
    background: #fff;
    position: relative;
    z-index: 3;
}

.login-form-wrapper {
    width: 100%;
    max-width: 360px;
    position: relative;
    z-index: 3;
}

.login-logo-area {
    margin-bottom: 40px;
}

.login-logo-icon {
    width: 48px;
    height: 48px;
    margin-bottom: 24px;
    border-radius: 12px;
    background: linear-gradient(135deg, #2563eb, #3b82f6);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
    overflow: hidden;
}

.login-logo-icon img {
    max-width: 32px;
    max-height: 32px;
}

.login-logo-icon span {
    color: #fff;
    font-size: 18px;
    font-weight: 700;
}

.login-title {
    font-size: 26px;
    font-weight: 700;
    color: #0f172a;
    letter-spacing: -0.5px;
    line-height: 1.2;
}

.login-subtitle {
    font-size: 15px;
    color: #64748b;
    margin-top: 8px;
    font-weight: 400;
}

.login-form {
    margin-top: 32px;
}

.form-group {
    margin-bottom: 20px;
}

.login-form label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 6px;
    letter-spacing: 0.01em;
}

.input-wrapper {
    position: relative;
}

.login-form input[type="text"],
.login-form input[type="password"] {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    font-size: 15px;
    font-family: inherit;
    background: #fff;
    color: #0f172a;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
    position: relative;
    z-index: 1;
}

.login-form input:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.login-form input::placeholder {
    color: #94a3b8;
}

.password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: #94a3b8;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
    z-index: 2;
}

.password-toggle:hover {
    color: #64748b;
}

.password-toggle svg {
    width: 18px;
    height: 18px;
}

.alert-error {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 10px;
    margin-bottom: 20px;
    font-size: 13px;
    color: #991b1b;
    line-height: 1.5;
    animation: slideDown 0.3s ease;
}

.alert-error-icon {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    margin-top: 1px;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.btn-login {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px 20px;
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s, box-shadow 0.2s;
    margin-top: 4px;
}

.btn-login:hover {
    background: #1d4ed8;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn-login:active {
    transform: scale(0.98);
}

.btn-login:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.login-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: -8px;
    margin-bottom: 20px;
}

.link-forgot {
    font-size: 13px;
    color: #2563eb;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
    font-family: inherit;
}

.link-forgot:hover {
    color: #1d4ed8;
    text-decoration: underline;
}

.login-footer {
    margin-top: 48px;
    text-align: center;
    font-size: 12px;
    color: #94a3b8;
}

.login-panel-brand {
    flex: 1;
    position: relative;
    display: flex;
    align-items: flex-end;
    justify-content: flex-start;
    overflow: hidden;
    z-index: 1;
}

.brand-bg {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    z-index: 0;
    pointer-events: none;
}

.brand-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        160deg,
        rgba(15, 23, 42, 0.75) 0%,
        rgba(37, 99, 235, 0.55) 50%,
        rgba(15, 23, 42, 0.80) 100%
    );
    z-index: 1;
    pointer-events: none;
}

.brand-content {
    position: relative;
    z-index: 2;
    padding: 60px;
    max-width: 580px;
    color: #fff;
}

.brand-content h2 {
    font-size: 36px;
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.5px;
    margin-bottom: 16px;
}

.brand-content p {
    font-size: 16px;
    opacity: 0.85;
    line-height: 1.6;
    font-weight: 400;
}

.modal-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

.modal-backdrop.active {
    display: flex;
}

.modal-box {
    background: #fff;
    border-radius: 14px;
    padding: 32px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
    animation: modalIn 0.25s ease;
}

.modal-box h3 {
    font-size: 20px;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 4px;
}

.modal-box .modal-subtitle {
    font-size: 14px;
    color: #64748b;
    margin-bottom: 24px;
}

.modal-box .form-group {
    margin-bottom: 16px;
}

.modal-box label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 6px;
}

.modal-box input {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    font-size: 15px;
    font-family: inherit;
    background: #fff;
    color: #0f172a;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
}

.modal-box input:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 24px;
}

.btn-modal-cancel {
    flex: 1;
    padding: 11px;
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-modal-cancel:hover {
    background: #e2e8f0;
}

.btn-modal-save {
    flex: 1;
    padding: 11px;
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-modal-save:hover {
    background: #1d4ed8;
}

.modal-msg {
    margin-top: 16px;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 13px;
    display: none;
}

.modal-msg.success {
    display: block;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
}

.modal-msg.error {
    display: block;
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.95) translateY(10px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

@media (max-width: 960px) {
    .login-panel-brand {
        display: none;
    }

    .login-panel-form {
        flex: 1;
        padding: 32px 24px;
    }
}

@media (max-width: 480px) {
    .login-panel-form {
        padding: 24px 20px;
    }

    .login-form-wrapper {
        max-width: 100%;
    }

    .login-title {
        font-size: 22px;
    }
}