/* Authentication screens: sign in, forgot password, reset password.
   Standalone (no app shell). Split layout: a brand panel on one side, the form on the other.
   Tokens mirror the app design system (style.css) so the two feel like one product. */

@font-face { font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap; src: url("../fonts/inter-latin-var.woff2") format("woff2"); }

:root {
    --font-sans: "Inter", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
    --surface: #ffffff;
    --surface-2: #f4f6fa;
    --ink: #0f172a;
    --muted: #5b6b80;
    --line: #dfe5ee;
    --line-strong: #c5cfdd;
    --accent: #2957e6;
    --accent-600: #1f45c4;
    --accent-ring: rgb(41 87 230 / 22%);
    --danger-soft: #fdeae8;  --danger-ink: #b02318;
    --success-soft: #e4f6ec; --success-ink: #0b6b3a;
    --warn-soft: #fff3d4;    --warn-ink: #7d5200;
    --shadow-btn: 0 1px 2px rgb(15 23 42 / 18%), 0 8px 18px rgb(41 87 230 / 26%);
    color-scheme: light;
}
html.dark {
    --surface: #0f1522;
    --surface-2: #0a0e16;
    --ink: #e6eaf2;
    --muted: #9aa7bb;
    --line: rgb(148 163 184 / 18%);
    --line-strong: rgb(148 163 184 / 32%);
    --accent: #7ba2ff;
    --accent-600: #9db9ff;
    --accent-ring: rgb(96 140 255 / 34%);
    --danger-soft: rgb(248 113 113 / 14%);  --danger-ink: #fca5a5;
    --success-soft: rgb(34 197 94 / 14%);   --success-ink: #6ee7a3;
    --warn-soft: rgb(251 191 36 / 14%);     --warn-ink: #fcd34d;
    --shadow-btn: 0 1px 2px rgb(0 0 0 / 45%), 0 8px 20px rgb(59 111 240 / 30%);
    color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100dvh; background: var(--surface); color: var(--ink); font-family: var(--font-sans); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
:where(a, button, input, select):focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- shell ---------- */
.auth-shell { min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr); }
@media (min-width: 1280px) { .auth-shell { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); } }

/* ---------- brand panel ---------- */
.auth-visual {
    position: relative; isolation: isolate; overflow: hidden; color: #fff;
    display: flex; flex-direction: column; justify-content: space-between; gap: 32px;
    padding: clamp(28px, 4.2vw, 60px);
    background:
        radial-gradient(60% 50% at 88% 6%, rgb(90 190 255 / 42%), transparent 62%),
        radial-gradient(55% 50% at 6% 96%, rgb(139 92 246 / 46%), transparent 62%),
        linear-gradient(155deg, #081033 0%, #13237a 46%, #2a3bd0 100%);
}
/* fine dot grid, fading out toward the bottom */
.auth-visual::before {
    content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
    background: radial-gradient(rgb(255 255 255 / 20%) 1px, transparent 1.4px) 0 0 / 24px 24px;
    -webkit-mask-image: linear-gradient(180deg, #000 0%, rgb(0 0 0 / 35%) 60%, transparent 100%);
    mask-image: linear-gradient(180deg, #000 0%, rgb(0 0 0 / 35%) 60%, transparent 100%);
}
/* soft ring */
.auth-visual::after {
    content: ""; position: absolute; z-index: -1; pointer-events: none;
    width: 640px; height: 640px; border-radius: 50%; inset-inline-end: -220px; bottom: -280px;
    border: 1px solid rgb(255 255 255 / 14%);
    box-shadow: inset 0 0 0 60px rgb(255 255 255 / 3%), inset 0 0 0 61px rgb(255 255 255 / 9%);
}

.auth-brand { display: inline-flex; align-items: center; gap: 12px; color: inherit; font-weight: 700; font-size: 1.05rem; letter-spacing: -.01em; }
.auth-mark {
    display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; font-size: 1.05rem; color: #fff;
    background: linear-gradient(140deg, #3d6bff, #6a4ff0);
    box-shadow: 0 1px 2px rgb(0 0 0 / 30%), 0 10px 24px rgb(30 50 200 / 45%), inset 0 1px 0 rgb(255 255 255 / 30%);
}

.auth-pitch { max-width: 40rem; }
.auth-pitch h2 { margin: 0 0 14px; font-size: clamp(1.7rem, 2.6vw, 2.5rem); line-height: 1.12; letter-spacing: -.03em; font-weight: 700; text-wrap: balance; }
.auth-pitch p { margin: 0; color: rgb(226 232 255 / 82%); font-size: 1.02rem; max-width: 27rem; }

/* what the software offers: a two-column grid of icon + title + one line */
.auth-offers { list-style: none; margin: 26px 0 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.auth-offers li {
    display: flex; align-items: flex-start; gap: 12px; padding: 13px 14px; border-radius: 14px;
    background: rgb(255 255 255 / 8%); border: 1px solid rgb(255 255 255 / 15%); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.offer-icon { flex: 0 0 auto; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; font-size: .95rem; color: #fff; background: linear-gradient(140deg, rgb(94 200 255 / 45%), rgb(122 108 255 / 55%)); box-shadow: inset 0 1px 0 rgb(255 255 255 / 30%); }
.offer-copy { min-width: 0; display: grid; gap: 2px; }
.offer-copy strong { font-size: .9rem; font-weight: 700; letter-spacing: -.01em; }
.offer-copy span { font-size: .78rem; line-height: 1.4; color: rgb(226 232 255 / 74%); }
.auth-features { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.auth-features li {
    display: inline-flex; align-items: center; gap: 9px; padding: 8px 14px 8px 11px; border-radius: 999px; font-size: .84rem; font-weight: 600;
    background: rgb(255 255 255 / 10%); border: 1px solid rgb(255 255 255 / 18%); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.auth-features i { width: 16px; text-align: center; color: #9fd4ff; }


.auth-foot-note { color: rgb(226 232 255 / 62%); font-size: .8rem; }

/* ---------- form side ---------- */
.auth-main { display: flex; flex-direction: column; min-width: 0; padding: clamp(18px, 3vw, 32px) clamp(20px, 4.5vw, 64px); background: var(--surface); }
.auth-topbar { display: flex; justify-content: flex-end; align-items: center; gap: 10px; }
.auth-panel { width: min(100%, 25rem); margin: auto; padding-block: 28px; animation: auth-rise .45s cubic-bezier(.2, .7, .2, 1) both; }
@keyframes auth-rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }


.auth-panel h1 { margin: 0 0 8px; font-size: 1.9rem; line-height: 1.15; letter-spacing: -.03em; font-weight: 700; text-wrap: balance; }
.auth-lead { margin: 0 0 26px; color: var(--muted); }

.auth-form { display: grid; gap: 18px; }
.field { display: grid; gap: 7px; }
.field-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.field label, .field .label { font-size: .84rem; font-weight: 650; }
.field-link { font-size: .8125rem; }

.input-wrap { position: relative; }
.input-wrap > .lead-icon { position: absolute; inset-inline-start: 15px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: .95rem; pointer-events: none; transition: color .15s; }
.input-wrap:focus-within > .lead-icon { color: var(--accent); }
.input {
    width: 100%; height: 50px; padding-block: 0; padding-inline: 44px 14px; border-radius: 12px;
    border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); font: inherit; font-size: 16px;
    transition: border-color .15s, box-shadow .15s, background-color .15s;
}
.input::placeholder { color: color-mix(in srgb, var(--muted) 70%, transparent); }
.input:hover { border-color: color-mix(in srgb, var(--accent) 35%, var(--line-strong)); }
.input:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-ring); }
.input.has-toggle { padding-inline-end: 50px; }
html.dark .input { background: rgb(6 10 18 / 55%); }
.input:-webkit-autofill { -webkit-box-shadow: 0 0 0 40px var(--surface) inset; -webkit-text-fill-color: var(--ink); }

.toggle-eye {
    position: absolute; inset-inline-end: 6px; top: 50%; transform: translateY(-50%); width: 38px; height: 38px; display: grid; place-items: center;
    border: 0; border-radius: 9px; background: transparent; color: var(--muted); cursor: pointer; transition: background-color .15s, color .15s;
}
.toggle-eye:hover { background: var(--surface-2); color: var(--ink); }

.hint { min-height: 1.1em; margin: 0; font-size: .78rem; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.hint:empty { display: none; }
.hint.is-warn { color: var(--warn-ink); }
.hint.is-bad { color: var(--danger-ink); }
.hint.is-good { color: var(--success-ink); }

.btn-auth {
    position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 10px; width: 100%; height: 50px; padding: 0 20px;
    border: 0; border-radius: 12px; cursor: pointer; font: inherit; font-size: 1rem; font-weight: 650; letter-spacing: -.005em; color: #fff;
    background: linear-gradient(180deg, #3767f2, var(--accent-btn, #2957e6)); box-shadow: var(--shadow-btn), inset 0 1px 0 rgb(255 255 255 / 22%);
    transition: transform .12s, filter .15s, box-shadow .15s;
}
html.dark .btn-auth { --accent-btn: #3b6ff0; }
.btn-auth:active { transform: translateY(1px); }
.btn-auth[disabled] { cursor: progress; filter: saturate(.7); opacity: .85; }
.btn-auth .spin { width: 17px; height: 17px; border-radius: 50%; border: 2px solid rgb(255 255 255 / 40%); border-top-color: #fff; animation: auth-spin .7s linear infinite; display: none; }
.btn-auth.is-loading .spin { display: inline-block; }
@keyframes auth-spin { to { transform: rotate(360deg); } }
.btn-auth.btn-ghost { background: var(--surface); color: var(--ink); border: 1px solid var(--line-strong); box-shadow: none; }
.btn-auth.btn-ghost:hover { background: var(--surface-2); filter: none; color: var(--ink); }
.auth-stack { display: grid; gap: 10px; }

.auth-back { display: inline-flex; align-items: center; gap: 8px; margin-top: 22px; font-size: .9rem; }
.auth-back i { font-size: .8rem; transition: transform .15s; }
.auth-back:hover i { transform: translateX(-3px); }
[dir="rtl"] .auth-back i { transform: scaleX(-1); }
[dir="rtl"] .auth-back:hover i { transform: scaleX(-1) translateX(-3px); }

/* alerts */
.notice { display: flex; gap: 12px; align-items: flex-start; margin: 0 0 20px; padding: 12px 14px; border-radius: 12px; font-size: .875rem; line-height: 1.45; }
.notice i { margin-top: 2px; }
.notice.error { background: var(--danger-soft); color: var(--danger-ink); }
.notice.success { background: var(--success-soft); color: var(--success-ink); }

/* status badge shown on the success / invalid states */
.state-icon { display: grid; place-items: center; width: 56px; height: 56px; margin-bottom: 18px; border-radius: 16px; font-size: 1.35rem; }
.state-icon.ok { background: var(--success-soft); color: var(--success-ink); }
.state-icon.bad { background: var(--danger-soft); color: var(--danger-ink); }
.state-icon.info { background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); }

/* password strength */
.meter { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; }
.meter span { height: 5px; border-radius: 4px; background: var(--line); transition: background-color .2s; }
.meter[data-level="1"] span:nth-child(-n+1) { background: #e5484d; }
.meter[data-level="2"] span:nth-child(-n+2) { background: #f5a524; }
.meter[data-level="3"] span:nth-child(-n+3) { background: #4bb56a; }
.meter[data-level="4"] span:nth-child(-n+4) { background: #17a34a; }

/* toolbar controls */
.chip-select, .chip-btn {
    height: 36px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-size: .8125rem; font-weight: 550; cursor: pointer;
    transition: background-color .15s, border-color .15s;
}
.chip-select { padding: 0 30px 0 14px; appearance: none; -webkit-appearance: none;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%2364748b' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m3 6 5 5 5-5'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 11px center; }
[dir="rtl"] .chip-select { padding: 0 14px 0 30px; background-position: left 11px center; }
.chip-btn { width: 36px; display: grid; place-items: center; padding: 0; color: var(--muted); }
.chip-select:hover, .chip-btn:hover { background: var(--surface-2); border-color: var(--line-strong); }
.lang-form { margin: 0; }

.auth-footer { padding-top: 12px; text-align: center; color: var(--muted); font-size: .78rem; }
.auth-footer .clock { display: block; margin-top: 3px; font-variant-numeric: tabular-nums; opacity: .85; }

/* ---------- motion (only when html.m-on) ---------- */
@keyframes auth-drift  { 0% { transform: translate3d(0, 0, 0) scale(1); } 50% { transform: translate3d(-40px, 30px, 0) scale(1.12); } 100% { transform: translate3d(30px, -24px, 0) scale(1); } }
@keyframes auth-bob    { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-9px); } }
@keyframes auth-draw   { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes auth-ping   { 0% { transform: scale(1); opacity: .6; } 80%, 100% { transform: scale(3.4); opacity: 0; } }
@keyframes auth-pop    { from { opacity: 0; transform: translateY(12px) scale(.94); } to { opacity: 1; transform: none; } }
@keyframes auth-glow   { 0%, 100% { box-shadow: 0 1px 2px rgb(0 0 0 / 30%), 0 10px 24px rgb(30 50 200 / 45%), inset 0 1px 0 rgb(255 255 255 / 30%); } 50% { box-shadow: 0 1px 2px rgb(0 0 0 / 30%), 0 12px 34px rgb(90 110 255 / 75%), inset 0 1px 0 rgb(255 255 255 / 30%); } }
@keyframes auth-shine  { from { transform: translateX(-130%) skewX(-20deg); } to { transform: translateX(300%) skewX(-20deg); } }
@keyframes auth-icon   { 0% { transform: scale(.4) rotate(-14deg); opacity: 0; } 60% { transform: scale(1.12) rotate(4deg); opacity: 1; } 100% { transform: none; } }
@keyframes auth-blink  { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

.aurora { position: absolute; z-index: -1; border-radius: 50%; filter: blur(46px); pointer-events: none; opacity: .55; }
.aurora.a { width: 360px; height: 360px; inset-inline-start: -90px; top: 28%; background: rgb(96 165 250 / 55%); }
.aurora.b { width: 320px; height: 320px; inset-inline-end: -60px; bottom: 6%; background: rgb(167 139 250 / 50%); }

.m-on .aurora.a { animation: auth-drift 19s ease-in-out infinite alternate; }
.m-on .aurora.b { animation: auth-drift 23s ease-in-out infinite alternate-reverse; }
.m-on .auth-mark { animation: auth-glow 3.6s ease-in-out infinite; }
.m-on .auth-brand, .m-on .auth-pitch h2, .m-on .auth-pitch p { animation: auth-pop .7s cubic-bezier(.2, .7, .2, 1) backwards; }
.m-on .auth-pitch h2 { animation-delay: .12s; }
.m-on .auth-pitch p  { animation-delay: .22s; }
.m-on .auth-offers li, .m-on .auth-features li { animation: auth-pop .6s cubic-bezier(.2, .7, .2, 1) backwards; }
.m-on .auth-offers li:nth-child(1) { animation-delay: .30s; }
.m-on .auth-offers li:nth-child(2) { animation-delay: .36s; }
.m-on .auth-offers li:nth-child(3) { animation-delay: .42s; }
.m-on .auth-offers li:nth-child(4) { animation-delay: .48s; }
.m-on .auth-offers li:nth-child(5) { animation-delay: .54s; }
.m-on .auth-offers li:nth-child(6) { animation-delay: .60s; }
.m-on .auth-features li:nth-child(1) { animation-delay: .34s; }
.m-on .auth-features li:nth-child(2) { animation-delay: .42s; }
.m-on .auth-features li:nth-child(3) { animation-delay: .50s; }
.m-on .auth-features li:nth-child(4) { animation-delay: .58s; }


/* form side */
.m-on .auth-panel h1, .m-on .auth-lead, .m-on .auth-form > *, .m-on .auth-back, .m-on .state-icon, .m-on .notice {
    animation: auth-pop .55s cubic-bezier(.2, .7, .2, 1) backwards;
}
.m-on .auth-panel > :nth-child(1) { animation-delay: .06s; }
.m-on .auth-panel > :nth-child(2) { animation-delay: .12s; }
.m-on .auth-panel > :nth-child(3) { animation-delay: .18s; }
.m-on .auth-form > div:nth-of-type(1) { animation-delay: .22s; }
.m-on .auth-form > div:nth-of-type(2) { animation-delay: .30s; }
.m-on .auth-form > .btn-auth { animation-delay: .40s; }
.m-on .state-icon { animation: auth-icon .7s cubic-bezier(.2, .9, .3, 1.2) .1s backwards; }
.m-on .notice.error { animation: auth-pop .45s cubic-bezier(.2, .7, .2, 1) backwards, auth-shake .4s ease .15s; }
@keyframes auth-shake { 0%, 100% { transform: none; } 20% { transform: translateX(-6px); } 40% { transform: translateX(5px); } 60% { transform: translateX(-3px); } 80% { transform: translateX(2px); } }

.btn-auth { overflow: hidden; }
.m-on .btn-auth::after {
    content: ""; position: absolute; inset-block: 0; inset-inline-start: 0; width: 38%; pointer-events: none;
    background: linear-gradient(90deg, transparent, rgb(255 255 255 / 34%), transparent); transform: translateX(-130%) skewX(-20deg);
}
.m-on .btn-auth:hover::after { animation: auth-shine .8s ease; }
.m-on .toggle-eye i { transition: transform .2s cubic-bezier(.2, .7, .2, 1); }
.m-on .toggle-eye:active i { transform: scale(.8); }
.m-on .input-wrap:focus-within > .lead-icon { transform: translateY(-50%) scale(1.15); }
.m-on .input-wrap > .lead-icon { transition: color .15s, transform .2s cubic-bezier(.2, .7, .2, 1); }

/* ---------- responsive ---------- */
@media (max-width: 991.98px) {
    .auth-shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
    /* the brand panel becomes a slim banner so the form is the first thing on a phone */
    .auth-visual { padding: 18px 20px; gap: 0; flex-direction: row; align-items: center; }
    .auth-visual .auth-pitch, .auth-visual .auth-foot-note { display: none; }
    .auth-visual::after { display: none; }
    .auth-main { padding: 16px 20px 24px; }
    .auth-panel { padding-block: 20px 8px; margin-block: 0 auto; }
    .auth-panel h1 { font-size: 1.65rem; }
}
@media (max-width: 420px) { .auth-panel { width: 100%; } }
@media (max-width: 1279.98px) and (min-width: 992px) { .auth-offers { grid-template-columns: minmax(0, 1fr); } }
/* short laptop screens: tighten the brand panel so it still fits without scrolling */
@media (max-height: 800px) and (min-width: 992px) {
    .auth-visual { padding-block: 28px; gap: 18px; }
    .auth-pitch h2 { font-size: clamp(1.5rem, 2.2vw, 2rem); margin-bottom: 8px; }
    .auth-offers { margin-top: 16px; gap: 8px; }
    .auth-offers li { padding: 9px 12px; gap: 10px; }
    .offer-icon { width: 32px; height: 32px; }
    .offer-copy span { font-size: .74rem; line-height: 1.32; }
    .auth-features { margin-top: 10px; gap: 8px; }
    .auth-features li { padding: 6px 12px 6px 9px; font-size: .78rem; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
