body {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow-x: hidden;
    overflow-y: auto;
}

.background-image {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #5a8f7b 0%, #7ba891 100%);
    z-index: -2;
}

.background-image::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: linear-gradient(rgba(90, 143, 123, 0.7), rgba(90, 143, 123, 0.7));
    background-size: cover;
    background-position: center;
}

.top-left-logo {
    position: fixed;
    top: 28px;
    right: 36px;
    left: auto;
    z-index: 1;
    width: 140px;
    height: 140px;
}

.top-left-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.3));
}

.seal-watermark {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 500px;
    height: 500px;
    opacity: 0.15;
    z-index: -1;
    pointer-events: none;
}

.seal-circle {
    width: 100%;
    height: 100%;
    border: 20px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.seal-text {
    position: absolute;
    color: rgba(255, 255, 255, 0.4);
    font-size: 32px;
    font-weight: bold;
    text-align: center;
    letter-spacing: 8px;
}

.seal-text.top {
    top: 40px;
    font-size: 28px;
}

.seal-text.bottom {
    bottom: 40px;
    font-size: 24px;
}

.login-container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 520px;
    margin: 0 auto;
    padding: 16px;
    box-sizing: border-box;
}

.login-card {
    background: rgba(255, 255, 255, 0.98);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    padding: 50px 60px;
    width: 100%;
    max-width: 520px;
}

.logo-container {
    display: flex;
    align-items: center;
    margin-bottom: 25px;
    gap: 20px;
}

.logo-img {
    width: 80px;
    height: 80px;
    background: #ffffff;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.logo-icon {
    width: 50px;
    height: 50px;
    color: #fff;
}

.system-title {
    color: #2d6a52;
    font-size: 26px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 0;
    line-height: 1.3;
    text-align: left;
}

/* Alert Container */
.alert-container {
    margin-bottom: 20px;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s ease;
}

.alert-container.show {
    opacity: 1;
    transform: translateY(0);
}

.alert-box {
    padding: 16px 20px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.alert-success {
    background: #2d6a52;
    color: white;
    border: 2px solid #1e4d3b;
}

.alert-error {
    background: #dc3545;
    color: white;
    border: 2px solid #c82333;
}

.alert-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.alert-message {
    flex: 1;
    font-size: 15px;
    font-weight: 500;
}

/* Form Styles */
.form-label {
    color: #333;
    font-weight: 500;
    margin-bottom: 8px;
    font-size: 15px;
}

/* Input Wrapper for Icons */
.input-wrapper {
    position: relative;
}

.input-icon {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    color: #6c757d;
    font-size: 18px;
    pointer-events: none;
    z-index: 1;
}

.form-control {
    border: 2px solid #d1d1d1;
    border-radius: 8px;
    padding: 14px 18px;
    font-size: 15px;
    transition: all 0.3s ease;
    background: #f5f5f5;
}

.input-with-icon {
    padding-left: 50px;
}

.form-control:focus {
    border-color: #2d6a52;
    box-shadow: 0 0 0 0.2rem rgba(45, 106, 82, 0.15);
    background: #fff;
    outline: none;
}

.form-control:focus ~ .input-icon,
.form-control:focus + .input-icon {
    color: #2d6a52;
}

.input-wrapper:focus-within .input-icon {
    color: #2d6a52;
}

.btn-login {
    background: #2d6a52;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 14px;
    font-size: 17px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    width: 100%;
    margin-top: 25px;
    transition: all 0.3s ease;
    position: relative;
}

.btn-login:hover:not(:disabled) {
    background: #1e4d3b;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(45, 106, 82, 0.3);
}

.btn-login:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.auth-back-link {
    text-align: center;
    margin-top: 14px;
}
.auth-back-link a {
    color: #6c7a74;
    font-size: 13px;
    text-decoration: none;
}
.auth-back-link a:hover {
    color: #2d6a52;
    text-decoration: underline;
}
.system-subtitle {
    text-align: center;
    color: #6c7a74;
    font-size: 13px;
    margin: -8px 0 18px;
}

.spinner-border-sm {
    width: 1rem;
    height: 1rem;
    border-width: 0.2em;
}

.mb-3 {
    margin-bottom: 20px;
}

/* ============================================
   CAPS LOCK WARNING - NEW FEATURE
   ============================================ */
.caps-lock-warning {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 15px;
    margin-top: 10px;
    background: #fff3cd;
    border: 2px solid #ffc107;
    border-radius: 8px;
    color: #856404;
    font-size: 14px;
    font-weight: 600;
    animation: warningSlide 0.3s ease;
}

.caps-lock-warning i {
    font-size: 16px;
    color: #ffc107;
}

@keyframes warningSlide {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
/* ============================================ */

/* Responsive */
@media (max-width: 768px) {
    .login-card {
        padding: 40px 30px;
        max-width: 100%;
    }
    
    .system-title {
        font-size: 20px;
    }
    
    .top-left-logo {
        width: 96px;
        height: 96px;
        top: 16px;
        right: 16px;
        left: auto;
    }
    
    .seal-watermark {
        width: 300px;
        height: 300px;
    }
    
    .seal-text.top {
        font-size: 18px;
        top: 30px;
    }
    
    .seal-text.bottom {
        font-size: 16px;
        bottom: 30px;
    }
}

@media (max-width: 480px) {
    .login-card {
        padding: 30px 20px;
    }
    
    .logo-container {
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }
    
    .system-title {
        font-size: 18px;
        text-align: center;
    }
}

/* ── Sign-in feedback (v24) ───────────────────────────────── */
/* Failed sign-in: both fields are marked together so nothing hints at which one was wrong. */
.form-control.is-invalid-login,
.form-control.is-invalid-login:focus {
    border-color: #dc3545;
    background: #fff6f6;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.12);
}
.input-wrapper:has(.is-invalid-login) .input-icon { color: #dc3545; }

.login-card.login-shake { animation: loginShake 0.42s cubic-bezier(.36, .07, .19, .97) both; }
@keyframes loginShake {
    10%, 90% { transform: translateX(-1px); }
    20%, 80% { transform: translateX(2px); }
    30%, 50%, 70% { transform: translateX(-4px); }
    40%, 60% { transform: translateX(4px); }
}

/* Loading + success states of the button */
.btn-login .spinner-border { margin-right: 8px; vertical-align: -2px; }
.btn-login.is-success,
.btn-login.is-success:disabled { background: #1e4d3b; opacity: 1; cursor: default; }
.btn-login .login-check { display: inline-block; margin-right: 8px; animation: loginCheckPop 0.4s ease both; }
@keyframes loginCheckPop {
    0%   { transform: scale(0.4); opacity: 0; }
    60%  { transform: scale(1.25); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}

/* Smooth hand-off to the next page */
.login-container { transition: opacity 0.3s ease, transform 0.3s ease; }
body.login-leaving .login-container { opacity: 0; transform: translateY(-8px) scale(0.99); }

/* Phones: comfortable tap targets, and 16px text so iOS does not zoom into the field */
@media (max-width: 480px) {
    .form-control { min-height: 48px; font-size: 16px; }
    .btn-login { min-height: 48px; }
    .alert-box { padding: 14px 16px; }
    .alert-message { font-size: 14px; }
}

@media (prefers-reduced-motion: reduce) {
    .login-card.login-shake,
    .btn-login .login-check { animation: none; }
    .login-container { transition: none; }
}

/* Forgot password */
.forgot-link-row { text-align: right; margin: -4px 0 0; }
.forgot-link-row a { color: #2d6a52; font-size: 13px; font-weight: 600; text-decoration: none; }
.forgot-link-row a:hover { text-decoration: underline; }
.reset-help { color: #5b6b64; font-size: 14px; line-height: 1.55; margin: 0 0 18px; }
.code-input { letter-spacing: 8px; font-weight: 700; font-size: 20px; }
form[hidden] { display: none !important; }
.auth-back-link a i { margin-right: 4px; }
