*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
    --brand:    #3e4095;
    --brand-dk: #323489;
    --accent:   #f58634;
    --surface:  #f4f7fe;
    --card:     #ffffff;
    --border:   #e2e8f0;
    --text:     #1e293b;
    --muted:    #64748b;
    --danger:   #ef4444;
    --success:  #22c55e;
    --warning:  #f59e0b;
}
body { font-family: 'DM Sans', sans-serif; background: var(--surface); color: var(--text); min-height: 100vh; display: flex; flex-direction: column; }

/* ── Split layout ── */
.auth-wrap { display: flex; width: 100%; flex: 1; min-height: 100vh; }
.auth-left {
    flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 40px 60px;
    background: #edf2ff; position: relative; overflow: hidden; color: var(--text);
}
.auth-left::before {
    content: ''; position: absolute; width: 600px; height: 600px; border-radius: 50%;
    background: radial-gradient(circle, rgba(245,134,52,0.08) 0%, transparent 70%);
    top: -150px; right: -150px; pointer-events: none;
}
.auth-left::after {
    content: ''; position: absolute; width: 500px; height: 500px; border-radius: 50%;
    background: radial-gradient(circle, rgba(62,64,149,0.04) 0%, transparent 70%);
    bottom: -100px; left: -100px; pointer-events: none;
}
.brand { margin-bottom: 32px; display: flex; align-items: center; z-index: 2; position: relative; }
.brand img { max-height: 64px; }

.left-heading { font-size: 30px; font-weight: 600; line-height: 1.3; margin-bottom: 12px; z-index: 2; position: relative; color: var(--brand); letter-spacing: -0.5px; }
.left-sub { color: var(--muted); font-size: 16px; font-weight: 400; line-height: 1.5; margin-bottom: 32px; z-index: 2; position: relative; }
.perk { display: flex; align-items: center; gap: 10px; color: var(--text); font-size: 15px; font-weight: 500; margin-bottom: 12px; z-index: 2; position: relative; }
.perk::before { content: '✓'; color: var(--accent); font-weight: 800; font-size: 18px; }

/* Feature list (Login) */
.feature-list { list-style: none; display: flex; flex-direction: column; gap: 16px; z-index: 2; position: relative; }
.feature-list li { display: flex; align-items: center; gap: 14px; color: var(--text); font-size: 15px; font-weight: 500; }
.feat-icon { width: 32px; height: 32px; border-radius: 8px; background: rgba(245,134,52,0.15); border: 1px solid rgba(245,134,52,0.3); display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 16px; color: var(--accent); }

/* ── Right form panel ── */
.auth-right { flex: 0 0 500px; display: flex; flex-direction: column; padding: 40px 48px; background: var(--card); box-shadow: -10px 0 40px rgba(0,0,0,0.03); z-index: 10; overflow-y: auto; }
.auth-right-wide { flex: 0 0 560px; padding: 32px 48px; }

/* Inner container for vertical centering & max-width */
.auth-form-container { margin: auto 0; display: flex; flex-direction: column; width: 100%; max-width: 420px; align-self: center; }
.auth-form-container-wide { max-width: 460px; }

.mobile-brand { display: none; margin-bottom: 24px; text-align: center; }
.mobile-brand img { max-height: 48px; }
.form-header { margin-bottom: 28px; }
.form-header h1 { font-size: 26px; font-weight: 700; margin-bottom: 6px; color: var(--brand); letter-spacing: -0.5px; }
.form-header p { color: var(--muted); font-size: 14px; font-weight: 500; }
.form-header p a { color: var(--brand); text-decoration: underline; font-weight: 500; transition: color 0.2s; }
.form-header p a:hover { color: var(--accent); }

/* ── Form structure ── */
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.field-group { margin-bottom: 18px; }
.field-group label { display: block; font-size: 13.5px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.field-group input, .field-group select { width: 100%; padding: 12px 14px; background: #f8fafc; border: 1px solid var(--border); border-radius: 8px; color: var(--text); font-size: 14px; font-family: inherit; outline: none; transition: all .2s; }
.field-group input:focus, .field-group select:focus { border-color: var(--brand); background: #fff; box-shadow: 0 0 0 3px rgba(62,64,149,0.1); }
.field-group input.error, .field-group select.error { border-color: var(--danger); background: #fff0f0; }
.field-group select option { background: #fff; color: var(--text); }

.pass-wrap { position: relative; }
.pass-wrap input { padding-right: 40px; }
.pass-toggle { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); cursor: pointer; color: var(--muted); background: none; border: none; font-size: 15px; transition: color 0.2s; }
.pass-toggle:hover { color: var(--brand); }
.field-meta { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.field-meta label { margin-bottom: 0; }
.field-meta a { font-size: 13px; color: var(--brand); text-decoration: none; font-weight: 500; }
.field-meta a:hover { text-decoration: underline; }

/* ── Password strength ── */
.strength-bar-bg { height: 8px; background: var(--border); border-radius: 4px; margin-top: 10px; overflow: hidden; width: 100%; }
.strength-fill { height: 100%; border-radius: 4px; transition: width .4s ease-out, background .4s; width: 0%; }
.rules { margin-top: 12px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.rule { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 8px; font-weight: 500; transition: color 0.2s; }
.rule.ok { color: var(--success); }
.rule svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; opacity: 0.5; }
.rule.ok svg { opacity: 1; }

/* ── Alerts & Buttons ── */
.alert { padding: 12px 14px; border-radius: 8px; font-size: 13.5px; margin-bottom: 20px; font-weight: 500; display: flex; align-items: flex-start; gap: 8px; }
.alert-danger  { background: #fef2f2; border: 1px solid #fecaca; color: #dc2626; }
.alert-warning { background: #fffbeb; border: 1px solid #fde68a; color: #d97706; }
.alert-success { background: #f0fdf4; border: 1px solid #bbf7d0; color: #16a34a; }
.alert-info    { background: #eff6ff; border: 1px solid #bfdbfe; color: #1d4ed8; }
.validation-summary { color: #dc2626; font-size: 13px; margin-bottom: 12px; }
.validation-summary ul { padding-left: 20px; margin-top: 4px; }

.btn-primary { width: 100%; padding: 14px; background: var(--brand); color: #fff; font-size: 15px; font-weight: 600; border: none; border-radius: 8px; cursor: pointer; margin-top: 4px; transition: all .2s; letter-spacing: 0.2px; box-shadow: 0 4px 10px rgba(62,64,149,0.2); }
.btn-primary:hover { background: var(--brand-dk); box-shadow: 0 4px 10px rgba(62,64,149,0.3); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(1px); box-shadow: none; }
.btn-primary:disabled { opacity: .6; cursor: not-allowed; box-shadow: none; transform: none; }

.btn-secondary { width: 100%; padding: 12px; background: transparent; color: var(--brand); font-size: 14px; font-weight: 600; border: 2px solid var(--border); border-radius: 8px; cursor: pointer; transition: all .2s; margin-top: 12px; }
.btn-secondary:hover { background: #f8fafc; border-color: var(--brand); }

/* ── Utilities ── */
.credential-note { font-size: 13.5px; color: var(--muted); text-align: center; margin-bottom: 20px; font-weight: 500; line-height: 1.5; padding: 12px 16px; background: #f0f4ff; border: 1px solid #dce4f5; border-radius: 8px; }
.d-none { display: none !important; }
.match-error { color: var(--danger); font-size: 13px; margin-top: 6px; }
.back-link-wrapper { text-align: center; margin-top: 24px; }
.back-link { color: #1a56db; font-size: 14px; text-decoration: none; font-weight: 500; }
.back-link:hover { text-decoration: underline; color: var(--brand); }
.auth-alert-icon { font-size: 16px; }
.auth-alert-title { display: block; margin-bottom: 4px; font-weight: 700; }


/* ── OTP panel ── */
.otp-digits { display: flex; gap: 8px; justify-content: center; margin-bottom: 24px; }
.otp-digits input { width: 48px; height: 56px; text-align: center; font-size: 20px; font-weight: 700; background: #f8fafc; border: 1px solid var(--border); border-radius: 8px; color: var(--text); outline: none; transition: all .2s; }
.otp-digits input:focus { border-color: var(--brand); background: #fff; box-shadow: 0 0 0 3px rgba(62,64,149,0.1); }
.otp-meta { display: flex; justify-content: space-between; align-items: center; font-size: 14px; color: var(--muted); margin-bottom: 24px; }
.otp-meta #otpTimer { color: var(--warning); font-weight: 700; }
.otp-meta #otpAttempts { color: var(--danger); font-weight: 600; }
#resendBtn { background: none; border: none; color: var(--accent); font-size: 14px; font-weight: 600; cursor: pointer; padding: 0; transition: color 0.2s; }
#resendBtn:hover:not(:disabled) { color: #e0762b; text-decoration: underline; }
#resendBtn:disabled { color: var(--muted); cursor: not-allowed; text-decoration: none; }
.otp-attempts-msg { display: block; text-align: center; font-size: 13px; margin-bottom: 20px; }

/* ── Spinner ── */
.spinner { display: inline-block; width: 18px; height: 18px; border: 2px solid rgba(255,255,255,0.3); border-top-color: #fff; border-radius: 50%; animation: spin .8s linear infinite; vertical-align: middle; margin-right: 8px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Responsive Breakpoints */
@media (max-width: 900px) {
    .auth-wrap { flex-direction: column; }
    .auth-left { flex: none; padding: 40px 32px; align-items: center; text-align: center; }
    .auth-left::before, .auth-left::after { display: none; }
    .brand { justify-content: center; margin-bottom: 24px; }
    .perk, .feature-list { display: none; } /* Hide list on mobile to save vertical space */
    .left-sub { margin-bottom: 0; }
    
    .auth-right, .auth-right-wide { flex: 1; width: 100%; max-width: none; padding: 40px 32px; border-radius: 20px 20px 0 0; margin-top: -20px; box-shadow: 0 -10px 30px rgba(0,0,0,0.05); }
    .auth-form-container, .auth-form-container-wide { max-width: 480px; margin: 0 auto; align-self: center; }
    .mobile-brand { display: none; } /* Logo is already in left panel that is stacked above */
    
    .form-row { grid-template-columns: 1fr; gap: 0; }
}
