/* ── Forgot password popup ── */
.forgot-overlay {
    position: fixed; inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(4px);
    display: none; align-items: center; justify-content: center;
    z-index: 9999;
    opacity: 0; transition: opacity .25s ease;
}
.forgot-overlay.visible { opacity: 1; }

.forgot-popup {
    background: #fff; border-radius: 20px;
    width: 100%; max-width: 400px; margin: 16px;
    box-shadow: 0 24px 64px rgba(0,0,0,.18), 0 4px 16px rgba(99,102,241,.12);
    border: 1px solid #e8eaf6;
    transform: scale(.94) translateY(10px);
    transition: transform .25s cubic-bezier(.34,1.56,.64,1), opacity .25s ease;
    opacity: 0;
    overflow: hidden;
}
.forgot-popup.visible { transform: scale(1) translateY(0); opacity: 1; }

.forgot-popup-header {
    display: flex; align-items: center; gap: 14px;
    padding: 22px 22px 18px;
    border-bottom: 1px solid #f1f5f9;
}
.forgot-popup-icon {
    width: 44px; height: 44px; border-radius: 12px; flex-shrink: 0;
    background: linear-gradient(135deg, #ede9fe, #ddd6fe);
    color: #6366f1; display: flex; align-items: center; justify-content: center;
    font-size: 1.1rem;
}
.forgot-popup-title { font-size: .95rem; font-weight: 700; color: #1e293b; }
.forgot-popup-sub   { font-size: .78rem; color: #64748b; margin-top: 2px; }
.forgot-close {
    margin-left: auto; width: 30px; height: 30px; border-radius: 8px;
    border: 1px solid #e2e8f0; background: #f8fafc;
    color: #94a3b8; cursor: pointer; font-size: .8rem;
    display: flex; align-items: center; justify-content: center;
    transition: all .2s; flex-shrink: 0;
}
.forgot-close:hover { background: #fee2e2; border-color: #fca5a5; color: #ef4444; }

.forgot-popup-body { padding: 20px 22px; }
.forgot-label {
    display: block; font-size: .78rem; font-weight: 600; color: #334155;
    text-transform: uppercase; letter-spacing: .5px; margin-bottom: 8px;
}
.forgot-input-wrap {
    display: flex; align-items: center;
    border: 1.5px solid #e2e8f0; border-radius: 12px;
    background: #f8fafc; overflow: hidden;
    transition: all .2s;
}
.forgot-input-wrap:focus-within {
    border-color: #6366f1; background: #fff;
    box-shadow: 0 0 0 3px rgba(99,102,241,.1);
}
.forgot-input-icon {
    width: 42px; height: 42px; display: flex; align-items: center; justify-content: center;
    color: #94a3b8; font-size: .85rem; flex-shrink: 0;
    border-right: 1px solid #e2e8f0; background: #fff;
}
.forgot-input-wrap input {
    flex: 1; height: 42px; padding: 0 14px; border: none; background: transparent;
    font-size: .9rem; color: #1e293b; outline: none; font-family: 'Inter', sans-serif;
}
.forgot-input-wrap input::placeholder { color: #94a3b8; }

.forgot-msg {
    margin-top: 12px; padding: 10px 14px; border-radius: 10px;
    font-size: .82rem; font-weight: 500; display: none; align-items: flex-start; gap: 8px;
}
.forgot-msg-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.forgot-msg-error   { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }

.forgot-submit-btn {
    margin-top: 16px; width: 100%; height: 44px; border-radius: 12px; border: none;
    background: linear-gradient(135deg, #6366f1, #8b5cf6); color: #fff;
    font-size: .9rem; font-weight: 600; cursor: pointer;
    display: flex; align-items: center; justify-content: center; gap: 8px;
    box-shadow: 0 4px 14px rgba(99,102,241,.3); transition: all .2s;
}
.forgot-submit-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    box-shadow: 0 6px 20px rgba(99,102,241,.4); transform: translateY(-1px);
}
.forgot-submit-btn:disabled { opacity: .7; cursor: not-allowed; transform: none; }

.forgot-popup-footer {
    padding: 14px 22px; text-align: center; background: #f8fafc;
    border-top: 1px solid #f1f5f9;
    font-size: .82rem; color: #64748b;
}
.forgot-popup-footer a {
    color: #6366f1; font-weight: 600; text-decoration: none;
}
.forgot-popup-footer a:hover { text-decoration: underline; }
.forgot-label .required { color: #ef4444; }

/* ===================================================================
   Login page layout
   =================================================================== */
body {
    background:
        radial-gradient(900px 500px at 15% -10%, rgba(99,102,241,.10), transparent 60%),
        radial-gradient(800px 500px at 110% 110%, rgba(139,92,246,.08), transparent 60%),
        #f6f7fb;
    color: #0f172a;
}

.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 16px;
}
.auth-shell { width: 100%; max-width: 420px; }

/* Brand */
.auth-brand {
    display: flex; align-items: center; justify-content: center; gap: 10px;
    margin-bottom: 24px; text-decoration: none;
}
.auth-brand-icon {
    width: 40px; height: 40px; border-radius: 11px;
    background: var(--accent-color); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.05rem; box-shadow: 0 6px 16px rgba(99,102,241,.28);
}
.auth-brand-text { font-size: 1.35rem; font-weight: 700; color: #0f172a; letter-spacing: -.4px; }
.auth-brand-text span { color: var(--accent-color); }

/* Card */
.auth-card {
    background: #fff;
    border: 1px solid #e6e8f0;
    border-radius: 16px;
    padding: 32px;
    box-shadow: 0 1px 2px rgba(15,23,42,.04), 0 12px 32px rgba(15,23,42,.06);
}
.auth-head { margin-bottom: 24px; }
.auth-head h1 { font-size: 1.35rem; font-weight: 700; color: #0f172a; margin: 0 0 6px; letter-spacing: -.3px; }
.auth-head p  { font-size: .9rem; color: #64748b; margin: 0; }

.auth-card .alert-container { max-width: none; margin-bottom: 0; }
.auth-card .alert-container:not(:empty) .crm-alert,
.auth-card .alert-container .failed-attempts { margin-bottom: 18px; }

/* Fields */
.auth-field { margin-bottom: 18px; }
.auth-label { display: block; font-size: .85rem; font-weight: 600; color: #334155; margin-bottom: 7px; }

.auth-input {
    position: relative; display: flex; align-items: center;
    border: 1px solid #d8dce6; border-radius: 10px; background: #fff;
    transition: border-color .15s, box-shadow .15s;
}
.auth-input:focus-within { border-color: var(--accent-color); box-shadow: 0 0 0 3px rgba(99,102,241,.15); }
.auth-input.error   { border-color: #ef4444; box-shadow: 0 0 0 3px rgba(239,68,68,.12); }
.auth-input.success { border-color: #10b981; }

.auth-input-icon { position: absolute; left: 14px; color: #94a3b8; font-size: .85rem; pointer-events: none; }
.auth-input:focus-within .auth-input-icon { color: var(--accent-color); }
.auth-input input {
    flex: 1; min-width: 0; height: 46px; padding: 0 14px 0 40px;
    border: none; background: transparent; border-radius: 10px;
    font: inherit; font-size: .92rem; color: #0f172a; outline: none;
}
.auth-input input::placeholder { color: #a0aec0; }
.auth-input-toggle {
    width: 42px; height: 46px; border: none; background: none;
    color: #94a3b8; cursor: pointer; font-size: .85rem; flex-shrink: 0;
}
.auth-input-toggle:hover, .auth-input-toggle:focus-visible { color: var(--accent-color); outline: none; }

/* Remember / forgot row */
.auth-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 4px 0 22px; }
.auth-remember { display: flex; align-items: center; gap: 8px; cursor: pointer; margin: 0; font-size: .86rem; color: #475569; }
.auth-remember input { width: 16px; height: 16px; accent-color: var(--accent-color); cursor: pointer; }
.auth-link { font-size: .86rem; font-weight: 600; color: var(--accent-color); text-decoration: none; }
.auth-link:hover { color: var(--accent-hover); text-decoration: underline; }

/* Submit */
.auth-submit {
    width: 100%; height: 46px; border: none; border-radius: 10px;
    background: var(--accent-color); color: #fff;
    font: inherit; font-size: .95rem; font-weight: 600;
    display: flex; align-items: center; justify-content: center; gap: 8px;
    cursor: pointer; transition: background .15s, box-shadow .15s, transform .05s;
    box-shadow: 0 4px 12px rgba(99,102,241,.25);
}
.auth-submit:hover { background: var(--accent-hover); }
.auth-submit:active { transform: translateY(1px); }
.auth-submit:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(99,102,241,.35); }
.auth-submit:disabled { opacity: .75; cursor: progress; }
.auth-submit .fa-arrow-right { font-size: .8rem; transition: transform .15s; }
.auth-submit:hover .fa-arrow-right { transform: translateX(2px); }

/* Footer */
.auth-footer { text-align: center; font-size: .78rem; color: #94a3b8; margin-top: 22px; }

/* Small screens */
@media (max-width: 480px) {
    .auth-page { align-items: flex-start; padding-top: 32px; }
    .auth-card { padding: 24px 20px; border-radius: 14px; }
    .auth-row  { flex-wrap: wrap; }
}

/* Forgot-password popup: match the sign-in card */
.forgot-label { text-transform: none; letter-spacing: 0; font-size: .85rem; color: #334155; }
.forgot-input-wrap { background: #fff; border: 1px solid #d8dce6; border-radius: 10px; }
.forgot-input-wrap:focus-within { box-shadow: 0 0 0 3px rgba(99,102,241,.15); }
.forgot-input-icon { border-right: none; background: transparent; width: 40px; height: 46px; }
.forgot-input-wrap input { height: 46px; padding-left: 2px; }
.forgot-submit-btn { height: 46px; border-radius: 10px; background: var(--accent-color); box-shadow: 0 4px 12px rgba(99,102,241,.25); }
.forgot-submit-btn:hover:not(:disabled) { background: var(--accent-hover); transform: none; box-shadow: 0 4px 12px rgba(99,102,241,.3); }
.forgot-popup { border-radius: 16px; border-color: #e6e8f0; }
