/* Auth screens (sign in, first login, OTP, forgot / reset / change password) */
.auth-body { background: #f3f6f4; min-height: 100vh; overflow-x: hidden; }
.auth-wrap { display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr); min-height: 100vh; }

.auth-hero { position: relative; overflow: hidden; color: #fff; background: #0c2016; }
.hero-mesh { position: absolute; inset: -20%; background:
  radial-gradient(40% 40% at 15% 20%, rgba(61,182,189,.55), transparent 70%),
  radial-gradient(35% 35% at 85% 25%, rgba(97,180,65,.45), transparent 70%),
  radial-gradient(45% 45% at 60% 90%, rgba(60,184,120,.45), transparent 70%),
  radial-gradient(30% 30% at 30% 75%, rgba(58,100,41,.7), transparent 70%);
  filter: blur(10px); animation: meshMove 18s ease-in-out infinite alternate; }
@keyframes meshMove { 0% { transform: translate3d(0,0,0) rotate(0deg); } 100% { transform: translate3d(-4%,3%,0) rotate(6deg); } }
.hero-grid { position: absolute; inset: 0; background-image: linear-gradient(rgba(255,255,255,.05) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.05) 1px, transparent 1px); background-size: 44px 44px; mask-image: radial-gradient(ellipse at 40% 40%, #000 30%, transparent 75%); }
.hero-inner { position: relative; z-index: 1; height: 100%; display: flex; flex-direction: column; padding: 2.6rem 3.4rem; }
.hero-brand .hb-logo { display: inline-flex; background: #fff; padding: .7rem 1rem; border-radius: 16px; box-shadow: 0 18px 40px -18px rgba(0,0,0,.5); }
.hero-brand img { height: 38px; }
.hero-copy { margin: auto 0; max-width: 560px; }
.hero-kicker { display: inline-flex; align-items: center; gap: .45rem; font-size: .74rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.18); padding: .42rem .85rem; border-radius: 999px; backdrop-filter: blur(6px); }
.hero-copy h1 { color: #fff; font-size: clamp(2rem, 3.4vw, 3.05rem); font-weight: 800; letter-spacing: -.035em; line-height: 1.08; margin: 1.2rem 0 1rem; }
.hero-copy p { color: rgba(255,255,255,.82); font-size: 1.02rem; line-height: 1.65; max-width: 520px; }
.hero-points { list-style: none; padding: 0; margin: 2rem 0 0; display: grid; gap: 1rem; }
.hero-points li { display: flex; gap: .9rem; align-items: flex-start; background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.11); border-radius: 16px; padding: .9rem 1rem; backdrop-filter: blur(8px); transition: transform .25s, background .25s; }
.hero-points li:hover { transform: translateX(4px); background: rgba(255,255,255,.1); }
.hero-points li > span { width: 40px; height: 40px; border-radius: 12px; flex-shrink: 0; display: grid; place-items: center; background: linear-gradient(135deg, #3db6bd, #61b441); font-size: 1.1rem; box-shadow: 0 10px 20px -10px rgba(0,0,0,.5); }
.hero-points strong { display: block; font-size: .92rem; }
.hero-points small { color: rgba(255,255,255,.7); font-size: .8rem; line-height: 1.45; }
.hero-foot { display: flex; gap: 2.2rem; padding-top: 1.5rem; border-top: 1px solid rgba(255,255,255,.12); }
.hf-stat strong { display: block; font-size: 1.5rem; font-weight: 800; letter-spacing: -.02em; }
.hf-stat span { font-size: .72rem; color: rgba(255,255,255,.65); text-transform: uppercase; letter-spacing: .1em; font-weight: 700; }

.auth-panel { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 2rem 1.2rem; background: radial-gradient(800px 400px at 90% 0%, rgba(61,182,189,.08), transparent 60%), #f7faf8; }
.auth-card { width: 100%; max-width: 440px; background: #fff; border: 1px solid #e4ebe7; border-radius: 24px; padding: 2.3rem 2.2rem; box-shadow: 0 30px 60px -30px rgba(16,36,26,.28), 0 2px 6px rgba(16,36,26,.04); position: relative; overflow: hidden; }
.auth-card::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 5px; background: var(--brand-gradient); }
.auth-card-logo { display: none; text-align: center; margin-bottom: 1.2rem; }
.auth-card-logo img { height: 42px; }
.auth-title { font-size: 1.6rem; font-weight: 800; letter-spacing: -.03em; margin: 0 0 .35rem; }
.auth-sub { color: var(--muted); font-size: .9rem; margin-bottom: 1.6rem; line-height: 1.55; }
.auth-sub strong { color: var(--text); }
.auth-card .form-control { height: 48px; border-radius: 12px; font-size: .93rem; background: #fbfcfb; }
.auth-card .form-control:focus { background: #fff; }
.auth-field { position: relative; }
.auth-field .form-control { padding-left: 2.8rem; }
.auth-field .form-control.has-toggle { padding-right: 3rem; }
.auth-field .form-control.is-invalid { background-image: none; padding-right: 3rem; }
.auth-field > i { position: absolute; left: 1rem; top: 50%; transform: translateY(-50%); color: var(--muted-2); font-size: 1.05rem; pointer-events: none; z-index: 3; }
.auth-field .form-control:focus ~ i, .auth-field:focus-within > i { color: var(--brand); }
.auth-field .toggle-pass { position: absolute; right: .5rem; top: 50%; transform: translateY(-50%); border: 0; background: transparent; color: var(--muted); width: 38px; height: 38px; border-radius: 10px; z-index: 3; }
.auth-field .toggle-pass:hover { background: var(--surface-3); color: var(--text); }
.auth-card .btn-brand { height: 50px; border-radius: 13px; font-size: .95rem; width: 100%; }
.auth-links { display: flex; justify-content: space-between; align-items: center; gap: .5rem; flex-wrap: wrap; font-size: .83rem; margin: .9rem 0 1.4rem; }
.auth-links a { font-weight: 600; }
.auth-divider { display: flex; align-items: center; gap: .8rem; color: var(--muted-2); font-size: .72rem; text-transform: uppercase; letter-spacing: .12em; font-weight: 700; margin: 1.4rem 0 1rem; }
.auth-divider::before, .auth-divider::after { content: ''; flex: 1; height: 1px; background: #e4ebe7; }
.auth-alt { display: flex; align-items: center; gap: .75rem; padding: .85rem 1rem; border: 1px dashed #d3ddd7; border-radius: 14px; font-size: .84rem; color: var(--text-2); transition: .2s; }
.auth-alt:hover { border-color: var(--brand); background: var(--brand-soft); color: var(--text); }
.auth-alt .icon-chip { width: 36px; height: 36px; }
.auth-legal { margin-top: 1.4rem; font-size: .76rem; color: var(--muted); display: flex; gap: .5rem; flex-wrap: wrap; justify-content: center; }
.auth-legal a { color: var(--muted); }
.invalid-feedback.lra { font-size: .78rem; font-weight: 500; margin-top: .35rem; }

/* card heading: icon badge + kicker */
.auth-head { display: flex; align-items: center; gap: .8rem; margin-bottom: 1.1rem; }
.auth-icon { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; font-size: 1.45rem; color: #fff; background: var(--brand-gradient-diag); box-shadow: 0 14px 26px -12px rgba(60,184,120,.9); flex-shrink: 0; position: relative; }
.auth-icon::after { content: ''; position: absolute; inset: -5px; border-radius: 20px; border: 1.5px solid rgba(var(--brand-rgb), .25); animation: iconPulse 2.6s ease-out infinite; }
@keyframes iconPulse { 0% { transform: scale(.94); opacity: 1; } 70% { transform: scale(1.12); opacity: 0; } 100% { opacity: 0; } }
.auth-icon.is-warning { background: linear-gradient(135deg, #f5c04e, #d08b0b); box-shadow: 0 14px 26px -12px rgba(208,139,11,.9); }
.auth-icon.is-warning::after { border-color: rgba(208,139,11,.3); }
.auth-kicker { font-size: .7rem; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; color: var(--brand-dark); }
.auth-kicker small { display: block; font-size: .76rem; letter-spacing: 0; text-transform: none; color: var(--muted); font-weight: 600; margin-top: .1rem; }

/* progress bar + labelled steps */
.auth-progress { margin-bottom: 1.5rem; }
.auth-steps { display: flex; gap: .4rem; margin-bottom: 1.4rem; }
.auth-progress .auth-steps { margin-bottom: .6rem; }
.auth-steps span { flex: 1; height: 5px; border-radius: 99px; background: #e4ebe7; position: relative; overflow: hidden; }
.auth-steps span::after { content: ''; position: absolute; inset: 0; background: var(--brand-gradient); transform: scaleX(0); transform-origin: left; transition: transform .5s var(--ease); }
.auth-steps span.on { background: #e4ebe7; }
.auth-steps span.on::after { transform: scaleX(1); }
.auth-step-labels { list-style: none; padding: 0; margin: 0; display: flex; justify-content: space-between; gap: .4rem; }
.auth-step-labels li { flex: 1; display: flex; align-items: center; gap: .4rem; font-size: .72rem; font-weight: 700; color: var(--muted-2); min-width: 0; }
.auth-step-labels li:not(:first-child) { justify-content: center; }
.auth-step-labels li:last-child { justify-content: flex-end; }
.auth-step-labels .asl-dot { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: .64rem; border: 1.5px solid #d3ddd7; background: #fff; flex-shrink: 0; transition: .3s; }
.auth-step-labels .asl-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.auth-step-labels li.current { color: var(--text); }
.auth-step-labels li.current .asl-dot { border-color: var(--brand); color: var(--brand-dark); box-shadow: 0 0 0 4px rgba(var(--brand-rgb), .14); }
.auth-step-labels li.done { color: var(--text-2); }
.auth-step-labels li.done .asl-dot { background: var(--brand); border-color: var(--brand); color: #fff; font-size: 0; }
.auth-step-labels li.done .asl-dot::before { content: '\F633'; font-family: 'bootstrap-icons'; font-size: .66rem; line-height: 1; }

/* animated panels inside one card */
.auth-stage { position: relative; }
.auth-step { display: none; }
.auth-step.is-active { display: block; animation: stepIn .42s var(--ease) both; }
.auth-step.is-active.from-left { animation-name: stepInLeft; }
@keyframes stepIn { from { opacity: 0; transform: translateX(26px); } to { opacity: 1; transform: none; } }
@keyframes stepInLeft { from { opacity: 0; transform: translateX(-26px); } to { opacity: 1; transform: none; } }

/* identity chip (masked e-mail) */
.auth-identity { display: flex; align-items: center; gap: .7rem; padding: .65rem .8rem; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); margin-bottom: 1.2rem; }
.auth-identity .avatar { width: 38px; height: 38px; border-radius: 12px; font-size: .8rem; }
.auth-identity .ai-text { min-width: 0; flex: 1; line-height: 1.25; }
.auth-identity .ai-name { font-weight: 700; font-size: .86rem; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.auth-identity .ai-mail { font-size: .78rem; color: var(--muted); font-family: 'Cascadia Code', Consolas, monospace; word-break: break-all; }
.auth-identity .ai-action { font-size: .76rem; font-weight: 700; white-space: nowrap; background: none; border: 0; padding: .25rem .4rem; color: var(--brand-dark); border-radius: 8px; }
.auth-identity .ai-action:hover { background: var(--brand-soft); }

/* inline alert */
.auth-alert { display: none; align-items: flex-start; gap: .6rem; padding: .75rem .9rem; border-radius: 12px; font-size: .83rem; line-height: 1.45; margin-bottom: 1.1rem; border: 1px solid transparent; }
.auth-alert.show { display: flex; animation: fadeUp .3s var(--ease) both; }
.auth-alert i { font-size: 1.05rem; line-height: 1.2; flex-shrink: 0; }
.auth-alert.is-danger { background: rgba(214,69,69,.08); border-color: rgba(214,69,69,.22); color: #9f2d2d; }
.auth-alert.is-warning { background: rgba(208,139,11,.09); border-color: rgba(208,139,11,.25); color: #8a5a04; }
.auth-alert.is-info { background: rgba(47,159,181,.08); border-color: rgba(47,159,181,.22); color: #1d6f80; }
.auth-alert.is-success { background: rgba(34,160,107,.09); border-color: rgba(34,160,107,.24); color: #16734d; }

/* security notice */
.auth-notice { display: flex; gap: .75rem; padding: .85rem .95rem; border-radius: 14px; background: rgba(208,139,11,.08); border: 1px solid rgba(208,139,11,.22); font-size: .82rem; color: var(--text-2); margin-bottom: 1.3rem; line-height: 1.5; }
.auth-notice > i { color: var(--warning); font-size: 1.15rem; line-height: 1.2; }
.auth-notice strong { color: var(--text); display: block; margin-bottom: .1rem; }
.auth-notice.is-info { background: rgba(47,159,181,.07); border-color: rgba(47,159,181,.2); }
.auth-notice.is-info > i { color: var(--info); }

/* OTP boxes */
.otp-inputs { display: flex; gap: .55rem; justify-content: space-between; margin: .4rem 0 .6rem; }
.otp-inputs input { width: 100%; min-width: 0; max-width: 54px; height: 58px; text-align: center; font-size: 1.45rem; font-weight: 800; border-radius: 14px; border: 1.5px solid #d3ddd7; background: #fbfcfb; color: var(--text); padding: 0 !important; font-family: 'Cascadia Code', Consolas, monospace; caret-color: var(--brand); transition: border-color .15s, box-shadow .15s, transform .15s, background .15s; }
.otp-inputs input:focus { border-color: var(--brand); box-shadow: var(--ring); outline: 0; background: #fff; transform: translateY(-1px); }
.otp-inputs input.filled { border-color: rgba(var(--brand-rgb), .55); background: rgba(var(--brand-rgb), .05); }
.otp-inputs.is-invalid input { border-color: rgba(214,69,69,.6); background: rgba(214,69,69,.04); }
.otp-inputs.is-invalid { animation: otpShake .42s ease both; }
.otp-inputs.is-valid input { border-color: var(--success); background: rgba(34,160,107,.08); color: var(--success); }
.otp-inputs.is-busy input { opacity: .6; pointer-events: none; }
@keyframes otpShake { 10%, 90% { transform: translateX(-1px); } 20%, 80% { transform: translateX(3px); } 30%, 50%, 70% { transform: translateX(-6px); } 40%, 60% { transform: translateX(6px); } }
.otp-feedback { font-size: .78rem; color: var(--danger); min-height: 1.1rem; margin-bottom: .6rem; font-weight: 500; }
.otp-meta { display: flex; justify-content: space-between; align-items: center; gap: .5rem; flex-wrap: wrap; font-size: .8rem; color: var(--muted); margin-bottom: 1.2rem; }
.otp-meta .om-timer { display: inline-flex; align-items: center; gap: .35rem; font-weight: 600; }
.otp-meta .om-timer b { font-family: 'Cascadia Code', Consolas, monospace; color: var(--text); font-weight: 700; }
.otp-meta .om-timer.is-expired, .otp-meta .om-timer.is-expired b { color: var(--danger); }
.btn-resend { border: 0; background: none; padding: .3rem .1rem; font-size: .8rem; font-weight: 700; color: var(--brand-dark); display: inline-flex; align-items: center; gap: .35rem; border-radius: 8px; }
.btn-resend:hover:not(:disabled) { color: var(--brand-4); text-decoration: underline; }
.btn-resend:disabled { color: var(--muted-2); cursor: not-allowed; }

/* password strength */
.pw-meter-row { display: flex; align-items: center; gap: .7rem; margin: .55rem 0 .2rem; }
.pw-meter { flex: 1; height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; margin: 0; }
.pw-meter > span { display: block; height: 100%; width: 0; border-radius: 99px; transition: width .3s, background .3s; }
.pw-label { font-size: .72rem; font-weight: 700; color: var(--muted-2); min-width: 92px; text-align: right; white-space: nowrap; }
.pw-rules { list-style: none; padding: 0; margin: .5rem 0 1.1rem; display: grid; grid-template-columns: 1fr 1fr; gap: .3rem .8rem; font-size: .76rem; color: var(--muted); }
.pw-rules li { display: flex; align-items: center; gap: .35rem; transition: color .2s; }
.pw-rules li i { font-size: .85rem; }
.pw-rules li.ok { color: var(--success); }
.pw-rules li.bad { color: var(--danger); }
.pw-match { font-size: .76rem; font-weight: 600; min-height: 1.1rem; margin-top: .35rem; display: flex; align-items: center; gap: .3rem; }
.pw-match.ok { color: var(--success); }
.pw-match.bad { color: var(--danger); }

/* success state */
.auth-success { text-align: center; padding: .6rem 0 .2rem; }
.auth-success .as-check { width: 86px; height: 86px; margin: 0 auto 1.1rem; border-radius: 50%; display: grid; place-items: center; background: rgba(34,160,107,.1); position: relative; }
.auth-success .as-check svg { width: 52px; height: 52px; }
.auth-success .as-check circle { stroke: var(--success); stroke-width: 3; fill: none; stroke-dasharray: 160; stroke-dashoffset: 160; animation: asDraw .7s var(--ease) forwards; }
.auth-success .as-check path { stroke: var(--success); stroke-width: 4; fill: none; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 48; stroke-dashoffset: 48; animation: asDraw .45s .55s var(--ease) forwards; }
@keyframes asDraw { to { stroke-dashoffset: 0; } }
.auth-success h2 { font-size: 1.35rem; font-weight: 800; letter-spacing: -.02em; margin-bottom: .4rem; }
.auth-success p { color: var(--muted); font-size: .88rem; margin-bottom: 1.3rem; }
.auth-success .as-redirect { font-size: .78rem; color: var(--muted); margin-top: .8rem; }

.auth-foot { margin-top: 1.4rem; padding-top: 1.1rem; border-top: 1px solid #e4ebe7; display: flex; justify-content: space-between; align-items: center; gap: .6rem; flex-wrap: wrap; font-size: .82rem; }
.auth-foot a { font-weight: 600; display: inline-flex; align-items: center; gap: .3rem; }
.auth-foot .text-muted { font-size: .78rem; }
.auth-help { font-size: .78rem; color: var(--muted); margin: .9rem 0 0; display: flex; gap: .45rem; line-height: 1.5; }
.auth-help i { color: var(--muted-2); }

/* ---------- change password inside the app shell ---------- */
.cp-card { overflow: hidden; }
.cp-card .cp-head { display: flex; align-items: center; gap: 1rem; padding: 1.35rem 1.4rem; border-bottom: 1px solid var(--border); background: linear-gradient(135deg, rgba(61,182,189,.07), rgba(97,180,65,.06)); position: relative; }
.cp-card .cp-head::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 4px; background: var(--brand-gradient); }
.cp-card .cp-head h2 { font-size: 1.12rem; font-weight: 800; margin: 0; }
.cp-card .cp-head p { margin: .15rem 0 0; font-size: .82rem; color: var(--muted); }
.cp-card .card-body { padding: 1.5rem 1.4rem; }
.cp-card .auth-field .form-control { height: 46px; }
.cp-card .cp-actions { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; justify-content: flex-end; padding-top: 1.1rem; border-top: 1px dashed var(--border); margin-top: .4rem; }
.cp-card .cp-actions .btn { min-height: 44px; }
.cp-card .cp-actions .cp-hint { margin-right: auto; font-size: .78rem; color: var(--muted); display: inline-flex; align-items: center; gap: .35rem; }
.cp-divider { display: flex; align-items: center; gap: .7rem; margin: 1.2rem 0 1rem; font-size: .7rem; text-transform: uppercase; letter-spacing: .1em; font-weight: 800; color: var(--muted-2); }
.cp-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.cp-tips { list-style: none; padding: 0; margin: 0; display: grid; gap: .85rem; }
.cp-tips li { display: flex; gap: .75rem; align-items: flex-start; font-size: .83rem; color: var(--text-2); line-height: 1.5; }
.cp-tips li strong { display: block; color: var(--text); font-size: .85rem; }
.cp-tips .icon-chip { width: 34px; height: 34px; border-radius: 10px; font-size: .95rem; }
.cp-status { display: flex; align-items: center; gap: .9rem; padding: 1rem 1.1rem; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); margin-bottom: 1rem; }
.cp-status .cps-ring { width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; font-size: 1.3rem; flex-shrink: 0; color: #fff; background: var(--brand-gradient-diag); box-shadow: 0 10px 22px -12px rgba(60,184,120,.9); }
.cp-status.is-stale .cps-ring { background: linear-gradient(135deg, #f5c04e, #d08b0b); box-shadow: 0 10px 22px -12px rgba(208,139,11,.9); }
.cp-status .cps-title { font-weight: 800; font-size: .92rem; }
.cp-status .cps-sub { font-size: .78rem; color: var(--muted); }

/* dark theme - applies to the in-app change password card (the split-screen auth pages always render light) */
[data-theme="dark"] .auth-alert.is-danger { background: rgba(214,69,69,.14); border-color: rgba(214,69,69,.32); color: #f3a3a3; }
[data-theme="dark"] .auth-alert.is-warning { background: rgba(208,139,11,.14); border-color: rgba(208,139,11,.34); color: #f3c66b; }
[data-theme="dark"] .auth-alert.is-info { background: rgba(47,159,181,.14); border-color: rgba(47,159,181,.32); color: #7fd3e3; }
[data-theme="dark"] .auth-alert.is-success { background: rgba(34,160,107,.14); border-color: rgba(34,160,107,.32); color: #6fdcaa; }
[data-theme="dark"] .auth-notice { background: rgba(208,139,11,.12); border-color: rgba(208,139,11,.3); }
[data-theme="dark"] .cp-card .cp-head { background: linear-gradient(135deg, rgba(61,182,189,.11), rgba(97,180,65,.08)); }
[data-theme="dark"] .btn-resend { color: #5fd49a; }

/* reduced motion: app.css disables every animation, so draw the success check statically */
@media (prefers-reduced-motion: reduce) {
  .auth-success .as-check circle, .auth-success .as-check path { stroke-dashoffset: 0; }
}

@media (max-width: 991.98px) {
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-hero { display: none; }
  .auth-card-logo { display: block; }
  .auth-panel { min-height: 100vh; }
}
@media (max-width: 575.98px) {
  .cp-card .cp-actions .btn { flex: 1 1 auto; }
  .cp-card .cp-actions .cp-hint { flex-basis: 100%; }
}
@media (max-width: 420px) {
  .auth-panel { padding: 1.2rem .9rem; }
  .auth-card { padding: 1.8rem 1.25rem; border-radius: 20px; }
  .auth-title { font-size: 1.4rem; }
  .auth-icon { width: 46px; height: 46px; font-size: 1.25rem; border-radius: 14px; }
  .otp-inputs { gap: .4rem; }
  .otp-inputs input { height: 50px; font-size: 1.2rem; border-radius: 12px; }
  .auth-step-labels .asl-text { font-size: .66rem; }
  .pw-label { min-width: 0; }
}
@media (max-width: 359.98px) {
  .pw-rules { grid-template-columns: 1fr; }
  .auth-step-labels .asl-text { display: none; }
}
