body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #ffffff;
    background-image: 
        radial-gradient(circle at 25px 25px, rgba(45, 135, 131, 0.03) 2px, transparent 0),
        radial-gradient(circle at 75px 75px, rgba(52, 168, 83, 0.03) 2px, transparent 0);
    background-size: 100px 100px;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 1rem;
    position: relative;
    overflow: hidden;
}

body::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        linear-gradient(90deg, transparent 0%, rgba(45, 135, 131, 0.02) 50%, transparent 100%),
        linear-gradient(0deg, transparent 0%, rgba(52, 168, 83, 0.02) 50%, transparent 100%);
    pointer-events: none;
}

.login-container {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 24px;
    box-shadow: 
        0 20px 40px rgba(0, 0, 0, 0.08),
        0 0 0 1px rgba(255, 255, 255, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    padding: 2rem 2.5rem;
    width: 100%;
    max-width: 420px;
    position: relative;
    z-index: 1;
    max-height: 95vh;
    overflow-y: auto;
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo {
    width: 80px;
    height: 80px;
    margin: 0 auto 1rem;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 8px 20px rgba(45, 135, 131, 0.2);
    position: relative;
}

.login-logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.login-logo-fallback {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #2d8783, #34a853);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 2.5rem;
    font-weight: 600;
}

.login-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: #202124;
    margin-bottom: 0.25rem;
    letter-spacing: -0.02em;
}

.login-subtitle {
    color: #5f6368;
    font-size: 0.9rem;
    font-weight: 400;
    line-height: 1.4;
}

.login-form {
    margin-bottom: 1.5rem;
}

.form-group {
    margin-bottom: 1.25rem;
    position: relative;
}

.form-control {
    border: 2px solid #e9ecef !important;
    border-radius: 14px;
    padding: 1rem 1rem 1rem 3rem;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.3s ease;
    background: rgba(248, 249, 250, 0.8);
    backdrop-filter: blur(10px);
    height: auto;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

input[type="text"].form-control,
input[type="password"].form-control,
input[type="email"].form-control {
    border: 2px solid #e9ecef !important;
}

.form-control:focus {
    border-color: #2d8783 !important;
    box-shadow: 0 0 0 0.25rem rgba(45, 135, 131, 0.15) !important;
    background: rgba(255, 255, 255, 0.95) !important;
    outline: none;
}

input[type="password"].form-control:focus {
    border-color: #2d8783 !important;
    box-shadow: 0 0 0 0.25rem rgba(45, 135, 131, 0.15) !important;
}

.form-control::placeholder {
    color: #9aa0a6;
    font-weight: 400;
}

.input-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #5f6368;
    font-size: 1rem;
    z-index: 2;
}

.form-control:focus + .input-icon {
    color: #2d8783;
}

.login-btn {
    background: linear-gradient(135deg, #2d8783, #34a853);
    border: none;
    border-radius: 14px;
    padding: 1rem 1.5rem;
    font-size: 1.05rem;
    font-weight: 600;
    color: white;
    width: 100%;
    transition: all 0.3s ease;
    margin-bottom: 1.25rem;
    box-shadow: 0 6px 16px rgba(45, 135, 131, 0.25);
    position: relative;
    overflow: hidden;
}

.login-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.login-btn:hover::before {
    left: 100%;
}

.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 30px rgba(45, 135, 131, 0.35);
    background: linear-gradient(135deg, #34a853, #2d8783);
}

.login-btn:active {
    transform: translateY(0);
}

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

.form-extras {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.remember-me {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.form-check-input {
    border-radius: 5px;
    border: 2px solid #e9ecef;
    width: 1.1rem;
    height: 1.1rem;
    margin: 0;
}

.form-check-input:checked {
    background-color: #2d8783;
    border-color: #2d8783;
}

.form-check-label {
    font-size: 0.9rem;
    color: #5f6368;
    font-weight: 500;
    cursor: pointer;
}

.forgot-password {
    color: #2d8783;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.forgot-password:hover {
    color: #34a853;
    text-decoration: underline;
}

.alert {
    border-radius: 12px;
    border: none;
    margin-bottom: 1.5rem;
    padding: 0.875rem 1rem;
    font-weight: 500;
}

.alert-danger {
    background: rgba(220, 53, 69, 0.1);
    color: #dc3545;
    border: 1px solid rgba(220, 53, 69, 0.2);
}

.loading-spinner {
    display: none;
    width: 20px;
    height: 20px;
    border: 2px solid transparent;
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 0.75rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.login-footer {
    text-align: center;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.system-info {
    color: #9aa0a6;
    font-size: 0.8rem;
    font-weight: 500;
}

.app-download {
    margin-top: 0.75rem;
}

.app-download-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: #9aa0a6;
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 500;
    transition: color 0.2s ease;
}

.app-download-link:hover {
    color: #2d8783;
}

.app-download-version {
    color: #9aa0a6;
    font-weight: 400;
}

.app-download--corner {
    display: none;
}

/* Below 577px the card (see .login-container mobile rules) nearly fills the
   screen, so the link stays flowed inside the footer to avoid overlapping
   it or the forgot-password modal. From 577px up there is room around the
   centered card, so the corner copy takes over and detaches to the actual
   bottom-right corner of the page (the inline footer copy hides).
   Two copies exist because .login-container has a permanent
   backdrop-filter, which creates a containing block for position:fixed
   descendants — a corner link nested inside the card would be trapped
   relative to the card instead of the viewport. */
@media (min-width: 577px) {
    .app-download--inline {
        display: none;
    }

    .app-download--corner {
        display: block;
        position: fixed;
        bottom: 1.5rem;
        right: 1.5rem;
        z-index: 2;
    }

    .app-download--corner .app-download-link {
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        padding: 0.5rem 0.9rem;
        border-radius: 999px;
        box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
    }
}

/* Subtle animations */
.login-container {
    animation: fadeInUp 0.6s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Mobile responsive */
@media (max-width: 576px) {
    body {
        padding: 0.5rem;
    }
    
    .login-container {
        padding: 1.5rem 1.5rem;
        margin: 0;
        border-radius: 16px;
        max-width: 100%;
        max-height: 100vh;
    }
    
    .login-header {
        margin-bottom: 1.5rem;
    }
    
    .login-logo {
        width: 60px;
        height: 60px;
        margin-bottom: 0.75rem;
    }
    
    .login-title {
        font-size: 1.5rem;
        margin-bottom: 0.25rem;
    }
    
    .login-subtitle {
        font-size: 0.85rem;
    }
    
    .login-form {
        margin-bottom: 1rem;
    }
    
    .form-group {
        margin-bottom: 1rem;
    }
    
    .form-control {
        padding: 0.875rem 0.875rem 0.875rem 2.75rem;
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .input-icon {
        left: 0.875rem;
        font-size: 0.9rem;
    }
    
    .login-btn {
        padding: 0.875rem 1.25rem;
        font-size: 1rem;
        margin-bottom: 1rem;
    }
    
    .form-extras {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
        gap: 0.75rem;
        margin-bottom: 1rem;
    }
    
    .remember-me {
        justify-content: center;
    }
    
    .login-footer {
        padding-top: 1rem;
    }
    
    .system-info {
        font-size: 0.75rem;
    }
}

/* Extra small devices */
@media (max-width: 375px) {
    .login-container {
        padding: 1.25rem 1.25rem;
    }
    
    .login-title {
        font-size: 1.375rem;
    }
    
    .login-logo {
        width: 50px;
        height: 50px;
    }
}

/* Landscape mobile */
@media (max-height: 600px) and (orientation: landscape) {
    body {
        padding: 0.5rem;
    }
    
    .login-container {
        padding: 1rem 1.5rem;
        max-height: 95vh;
    }
    
    .login-header {
        margin-bottom: 1rem;
    }
    
    .login-logo {
        width: 50px;
        height: 50px;
        margin-bottom: 0.5rem;
    }
    
    .login-title {
        font-size: 1.375rem;
        margin-bottom: 0.125rem;
    }
    
    .login-subtitle {
        font-size: 0.8rem;
    }
    
    .form-group {
        margin-bottom: 0.875rem;
    }
    
    .login-btn {
        padding: 0.75rem 1rem;
        margin-bottom: 0.75rem;
    }
    
    .form-extras {
        margin-bottom: 0.75rem;
    }
    
    .login-footer {
        padding-top: 0.75rem;
    }
}

/* Accessibility improvements */
.form-control:focus {
    outline: 2px solid transparent;
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
