:root {
    color-scheme: light;
    --page: #f4f7fb;
    --panel: #fff;
    --surface: #fff;
    --surface-soft: #f7f9fc;
    --text: #121a2b;
    --text-soft: #5e6b80;
    --text-muted: #8792a5;
    --line: #dfe5ee;
    --line-strong: #cbd5e1;
    --primary: #5364ee;
    --primary-dark: #4352d4;
    --primary-soft: #edf0ff;
    --violet: #8b5cf6;
    --danger: #dc3f55;
    --danger-soft: #fff0f2;
    --success: #12a276;
    --success-soft: #e9fbf5;
    --shadow: 0 24px 70px rgba(20, 32, 58, .12);
    --shadow-soft: 0 10px 30px rgba(20, 32, 58, .08);
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --page: #080d18;
    --panel: #0d1422;
    --surface: #111a2a;
    --surface-soft: #151f31;
    --text: #edf2ff;
    --text-soft: #aab6c9;
    --text-muted: #7f8ca2;
    --line: #263248;
    --line-strong: #344158;
    --primary: #7380ff;
    --primary-dark: #6572f4;
    --primary-soft: rgba(99, 112, 255, .13);
    --danger: #ff7185;
    --danger-soft: rgba(220, 63, 85, .12);
    --success: #43d4a7;
    --success-soft: rgba(18, 162, 118, .13);
    --shadow: 0 24px 70px rgba(0, 0, 0, .28);
    --shadow-soft: 0 10px 30px rgba(0, 0, 0, .2);
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--page); }
body, button, input, select, textarea { font-family: "Vazirmatn", Tahoma, "Segoe UI", Arial, sans-serif; }
body { margin: 0; color: var(--text); background: var(--page); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
button { cursor: pointer; }
svg {
    display: block;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
}

.auth-body { min-height: 100vh; overflow-x: hidden; }
.auth-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(410px, .92fr) minmax(500px, 1.08fr);
    direction: ltr;
}
.auth-showcase, .auth-panel { position: relative; min-height: 100vh; direction: rtl; }

.auth-showcase {
    grid-column: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 42px clamp(36px, 5vw, 78px);
    isolation: isolate;
    color: #f8faff;
    background:
        radial-gradient(circle at 12% 85%, rgba(139, 92, 246, .33), transparent 30%),
        radial-gradient(circle at 88% 10%, rgba(74, 112, 255, .32), transparent 28%),
        linear-gradient(145deg, #080f20 0%, #111d3b 48%, #21174b 100%);
}
.auth-showcase::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -2;
    background: linear-gradient(120deg, transparent 20%, rgba(255, 255, 255, .04) 50%, transparent 75%);
}
.auth-showcase__grid {
    position: absolute;
    inset: 0;
    z-index: -3;
    opacity: .35;
    background-image:
        linear-gradient(rgba(255, 255, 255, .035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, .035) 1px, transparent 1px);
    background-size: 48px 48px;
    mask-image: linear-gradient(to bottom, black, transparent 90%);
}
.auth-orb {
    position: absolute;
    z-index: -1;
    border-radius: 999px;
    opacity: .75;
    animation: float 8s ease-in-out infinite;
}
.auth-orb--one {
    width: 210px;
    height: 210px;
    top: 14%;
    left: -95px;
    border: 1px solid rgba(162, 139, 255, .28);
    box-shadow: inset 0 0 70px rgba(123, 97, 255, .1);
}
.auth-orb--two {
    width: 92px;
    height: 92px;
    right: 13%;
    bottom: 16%;
    background: linear-gradient(145deg, rgba(91, 115, 255, .22), rgba(170, 92, 246, .12));
    animation-delay: -3s;
}
@keyframes float {
    0%, 100% { transform: translate3d(0, 0, 0); }
    50% { transform: translate3d(0, -14px, 0); }
}

.brand { display: inline-flex; align-items: center; gap: 12px; width: fit-content; }
.brand__mark {
    width: 50px;
    height: 50px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    color: #fff;
    border: 1px solid rgba(255, 255, 255, .26);
    border-radius: 15px;
    background: linear-gradient(145deg, rgba(255, 255, 255, .2), rgba(255, 255, 255, .06));
    box-shadow: 0 12px 30px rgba(0, 0, 0, .18);
    backdrop-filter: blur(12px);
}
.brand__mark svg { width: 35px; height: 35px; }
.brand__mark--small {
    width: 42px;
    height: 42px;
    color: #fff;
    border: 0;
    border-radius: 13px;
    background: linear-gradient(145deg, var(--primary), var(--violet));
    box-shadow: 0 9px 22px rgba(83, 100, 238, .25);
}
.brand__mark--small svg { width: 29px; height: 29px; }
.brand__copy { display: grid; gap: 3px; line-height: 1; }
.brand__copy strong { font-size: 1.18rem; font-weight: 800; letter-spacing: -.02em; }
.brand__copy small { font-size: .63rem; font-weight: 700; letter-spacing: .15em; opacity: .66; }

.auth-showcase__content { max-width: 560px; margin-block: 60px; }
.auth-showcase__eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    margin-bottom: 24px;
    color: #dbe4ff;
    font-size: .76rem;
    font-weight: 700;
    border: 1px solid rgba(255, 255, 255, .15);
    border-radius: 999px;
    background: rgba(255, 255, 255, .07);
    backdrop-filter: blur(10px);
}
.auth-showcase__eyebrow .fa-icon { width: 17px; font-size: 15px; }
.auth-showcase h2 {
    max-width: 520px;
    margin: 0;
    font-size: clamp(2rem, 3.2vw, 3.15rem);
    font-weight: 900;
    line-height: 1.45;
    letter-spacing: -.045em;
}
.auth-showcase__content > p {
    max-width: 510px;
    margin: 18px 0 0;
    color: rgba(228, 235, 255, .72);
    font-size: .98rem;
    line-height: 2;
}
.auth-feature-list { display: grid; gap: 14px; padding: 0; margin: 34px 0 0; list-style: none; }
.auth-feature-list li {
    display: flex;
    align-items: center;
    gap: 11px;
    color: rgba(242, 245, 255, .9);
    font-size: .86rem;
}
.auth-feature-list li > span {
    width: 25px;
    height: 25px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    color: #9ef0d2;
    border: 1px solid rgba(158, 240, 210, .24);
    border-radius: 8px;
    background: rgba(78, 206, 160, .1);
}
.auth-feature-list .fa-icon { width: 14px; font-size: 12px; }
.auth-showcase__footer {
    display: flex;
    align-items: center;
    gap: 9px;
    color: rgba(220, 228, 250, .52);
    font-size: .73rem;
}
.live-dot {
    width: 8px;
    height: 8px;
    display: inline-block;
    flex: 0 0 auto;
    border-radius: 50%;
    background: #4bd6a6;
    box-shadow: 0 0 0 5px rgba(75, 214, 166, .12);
}

.auth-panel {
    grid-column: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 84px clamp(34px, 6vw, 90px) 66px;
    background: radial-gradient(circle at 90% 5%, var(--primary-soft), transparent 24%), var(--panel);
    transition: background-color .25s ease;
}
.theme-toggle {
    position: absolute;
    top: 30px;
    left: 32px;
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    padding: 0;
    color: var(--text-soft);
    border: 1px solid var(--line);
    border-radius: 13px;
    background: var(--surface);
    box-shadow: var(--shadow-soft);
    transition: color .2s ease, border-color .2s ease, transform .2s ease;
}
.theme-toggle:hover { color: var(--primary); border-color: var(--line-strong); transform: translateY(-1px); }
.theme-toggle .fa-icon { width: 20px; font-size: 18px; }
.theme-toggle__sun, :root[data-theme="dark"] .theme-toggle__moon { display: none; }
:root[data-theme="dark"] .theme-toggle__sun { display: block; }
.auth-panel__mobile-brand { display: none; }
.auth-card {
    width: min(100%, 450px);
    animation: card-in .55s cubic-bezier(.22, .8, .28, 1) both;
}
@keyframes card-in {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}
.auth-card__header { margin-bottom: 30px; }
.auth-card__eyebrow {
    display: inline-block;
    margin-bottom: 11px;
    color: var(--primary);
    font-size: .76rem;
    font-weight: 800;
}
.auth-card__header h1 {
    margin: 0;
    color: var(--text);
    font-size: clamp(1.8rem, 3vw, 2.25rem);
    font-weight: 900;
    line-height: 1.35;
    letter-spacing: -.035em;
}
.auth-card__header p { margin: 11px 0 0; color: var(--text-soft); font-size: .86rem; line-height: 1.9; }
.alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 13px 14px;
    margin-bottom: 20px;
    border: 1px solid transparent;
    border-radius: 13px;
    font-size: .78rem;
    line-height: 1.7;
}
.alert .fa-icon { width: 20px; flex: 0 0 auto; margin-top: 1px; font-size: 18px; }
.alert p { margin: 0; }
.alert--danger {
    color: var(--danger);
    border-color: color-mix(in srgb, var(--danger) 24%, transparent);
    background: var(--danger-soft);
}

.auth-form { display: grid; gap: 20px; }
.form-field { display: grid; gap: 8px; }
.form-field label { color: var(--text); font-size: .8rem; font-weight: 700; }
.input-shell {
    position: relative;
    display: flex;
    align-items: center;
    height: 54px;
    color: var(--text-muted);
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface-soft);
    transition: border-color .2s ease, background-color .2s ease, box-shadow .2s ease;
}
.input-shell:focus-within {
    color: var(--primary);
    border-color: color-mix(in srgb, var(--primary) 74%, white);
    background: var(--surface);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 11%, transparent);
}
.input-shell--invalid { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 60%, var(--line)); }
.input-shell__icon { width: 20px; flex: 0 0 20px; margin-inline: 16px 0; font-size: 17px; text-align: center; }
.input-shell input {
    width: 100%;
    height: 100%;
    padding: 0 13px;
    color: var(--text);
    font-size: .87rem;
    text-align: left;
    border: 0;
    outline: 0;
    background: transparent;
}
.input-shell input::placeholder { color: var(--text-muted); opacity: .82; }
.password-toggle {
    width: 43px;
    height: 43px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    padding: 0;
    margin-left: 5px;
    color: var(--text-muted);
    border: 0;
    border-radius: 10px;
    background: transparent;
}
.password-toggle:hover, .password-toggle:focus-visible {
    color: var(--primary);
    background: var(--primary-soft);
    outline: 0;
}
.password-toggle .fa-icon { width: 20px; font-size: 18px; }
.password-toggle__hide { display: none; }
.password-toggle[aria-pressed="true"] .password-toggle__show { display: none; }
.password-toggle[aria-pressed="true"] .password-toggle__hide { display: block; }

.remember-field {
    width: fit-content;
    display: inline-flex;
    align-items: center;
    gap: 9px;
    color: var(--text-soft);
    font-size: .78rem;
    cursor: pointer;
    user-select: none;
}
.remember-field input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.remember-field__box {
    width: 19px;
    height: 19px;
    display: grid;
    place-items: center;
    color: #fff;
    border: 1px solid var(--line-strong);
    border-radius: 6px;
    background: var(--surface);
}
.remember-field__box .fa-icon { width: 13px; font-size: 11px; opacity: 0; transform: scale(.7); }
.remember-field input:checked + .remember-field__box { border-color: var(--primary); background: var(--primary); }
.remember-field input:checked + .remember-field__box .fa-icon { opacity: 1; transform: scale(1); }
.remember-field input:focus-visible + .remember-field__box { box-shadow: 0 0 0 4px var(--primary-soft); }

.primary-button {
    height: 54px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 0 22px;
    margin-top: 2px;
    color: #fff;
    font-size: .88rem;
    font-weight: 800;
    border: 0;
    border-radius: 14px;
    background: linear-gradient(115deg, var(--primary-dark), var(--primary) 52%, var(--violet));
    box-shadow: 0 14px 30px rgba(83, 100, 238, .28);
    transition: transform .2s ease, box-shadow .2s ease, filter .2s ease;
}
.primary-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 18px 34px rgba(83, 100, 238, .34);
    filter: saturate(1.06);
}
.primary-button:focus-visible { outline: 3px solid var(--primary-soft); outline-offset: 3px; }
.primary-button:disabled { cursor: wait; transform: none; filter: saturate(.7); opacity: .82; }
.primary-button__icon { width: 19px; font-size: 18px; }
.button-loader {
    width: 18px;
    height: 18px;
    display: none;
    border: 2px solid rgba(255, 255, 255, .35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .7s linear infinite;
}
.primary-button.is-loading .button-loader { display: block; }
.primary-button.is-loading .primary-button__icon { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }

.security-note {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    margin-top: 24px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface-soft);
}
.security-note__icon {
    width: 37px;
    height: 37px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    color: var(--success);
    border-radius: 11px;
    background: var(--success-soft);
}
.security-note__icon .fa-icon { width: 19px; font-size: 17px; }
.security-note p { display: grid; gap: 4px; margin: 0; }
.security-note strong { color: var(--text); font-size: .76rem; }
.security-note p span { color: var(--text-muted); font-size: .69rem; line-height: 1.6; }
.auth-panel__footer {
    position: absolute;
    bottom: 24px;
    margin: 0;
    color: var(--text-muted);
    font-size: .67rem;
}

.dashboard-body {
    min-height: 100vh;
    background: radial-gradient(circle at 95% 0, var(--primary-soft), transparent 24rem), var(--page);
}
.dashboard-header {
    height: 76px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 0 clamp(24px, 5vw, 76px);
    border-bottom: 1px solid var(--line);
    background: color-mix(in srgb, var(--surface) 91%, transparent);
    backdrop-filter: blur(18px);
}
.brand--dark { color: var(--text); }
.dashboard-header__actions { display: flex; align-items: center; gap: 12px; }
.theme-toggle--inline { position: static; box-shadow: none; }
.account-chip {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 5px 7px 5px 13px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface-soft);
}
.account-chip__avatar {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    color: #fff;
    font-size: .78rem;
    font-weight: 800;
    border-radius: 10px;
    background: linear-gradient(145deg, var(--primary), var(--violet));
}
.account-chip__copy { display: grid; gap: 2px; }
.account-chip__copy strong { color: var(--text); font-size: .72rem; }
.account-chip__copy small { color: var(--text-muted); font-size: .63rem; text-align: right; }
.logout-button {
    height: 42px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 0 13px;
    color: var(--danger);
    font-size: .72rem;
    font-weight: 700;
    border: 1px solid color-mix(in srgb, var(--danger) 22%, var(--line));
    border-radius: 12px;
    background: var(--danger-soft);
}
.logout-button:hover { border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); }
.logout-button svg { width: 17px; height: 17px; }
.dashboard-main {
    width: min(1180px, calc(100% - 48px));
    margin: 0 auto;
    padding: clamp(36px, 6vw, 76px) 0;
}
.dashboard-welcome {
    position: relative;
    overflow: hidden;
    min-height: 280px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 230px;
    align-items: center;
    gap: 30px;
    padding: clamp(32px, 5vw, 64px);
    color: #f7f9ff;
    border-radius: 28px;
    background:
        radial-gradient(circle at 10% 120%, rgba(149, 92, 246, .48), transparent 38%),
        linear-gradient(125deg, #101b38, #1d2450 58%, #36206b);
    box-shadow: var(--shadow);
}
.dashboard-welcome::after {
    content: "";
    position: absolute;
    inset: 0;
    opacity: .25;
    background-image:
        linear-gradient(rgba(255, 255, 255, .06) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, .06) 1px, transparent 1px);
    background-size: 46px 46px;
    mask-image: linear-gradient(90deg, transparent, black);
    pointer-events: none;
}
.dashboard-welcome > div { position: relative; z-index: 1; }
.dashboard-welcome__eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: #d6def7;
    font-size: .74rem;
    font-weight: 700;
}
.dashboard-welcome h1 {
    margin: 17px 0 0;
    font-size: clamp(1.8rem, 4vw, 3rem);
    font-weight: 900;
    letter-spacing: -.04em;
}
.dashboard-welcome p {
    max-width: 650px;
    margin: 14px 0 0;
    color: rgba(228, 234, 252, .72);
    font-size: .88rem;
    line-height: 2;
}
.dashboard-welcome__art { display: grid; place-items: center; }
.ai-core {
    width: 172px;
    height: 172px;
    display: grid;
    place-items: center;
    color: #d9ddff;
    border: 1px solid rgba(255, 255, 255, .16);
    border-radius: 50%;
    background: radial-gradient(circle, rgba(118, 128, 255, .28), rgba(255, 255, 255, .04) 66%);
    box-shadow: inset 0 0 45px rgba(127, 101, 255, .2), 0 0 0 22px rgba(255, 255, 255, .025);
}
.ai-core svg { width: 94px; height: 94px; filter: drop-shadow(0 12px 25px rgba(80, 90, 245, .35)); }
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
    margin-top: 22px;
}
.dashboard-card {
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 104px;
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--surface);
    box-shadow: var(--shadow-soft);
}
.dashboard-card__icon {
    width: 47px;
    height: 47px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    border-radius: 14px;
}
.dashboard-card__icon svg { width: 23px; height: 23px; }
.dashboard-card__icon--success { color: var(--success); background: var(--success-soft); }
.dashboard-card__icon--primary { color: var(--primary); background: var(--primary-soft); }
.dashboard-card__icon--violet { color: var(--violet); background: color-mix(in srgb, var(--violet) 12%, transparent); }
.dashboard-card > div { display: grid; gap: 6px; }
.dashboard-card span { color: var(--text-muted); font-size: .69rem; }
.dashboard-card strong { color: var(--text); font-size: .78rem; }

@media (max-width: 1020px) {
    .auth-shell { grid-template-columns: minmax(360px, .82fr) minmax(450px, 1.18fr); }
    .auth-showcase { padding-inline: 36px; }
    .auth-showcase h2 { font-size: 2.15rem; }
    .dashboard-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 820px) {
    .auth-shell { display: block; }
    .auth-showcase { display: none; }
    .auth-panel { min-height: 100vh; padding: 108px 24px 66px; }
    .auth-panel__mobile-brand {
        position: absolute;
        top: 26px;
        right: 24px;
        display: flex;
        align-items: center;
        gap: 10px;
    }
    .auth-panel__mobile-brand > span:last-child { display: grid; gap: 2px; }
    .auth-panel__mobile-brand strong { font-size: .9rem; }
    .auth-panel__mobile-brand small { color: var(--text-muted); font-size: .55rem; letter-spacing: .12em; }
    .theme-toggle { top: 26px; left: 24px; }
    .dashboard-welcome { grid-template-columns: 1fr 150px; }
    .ai-core { width: 125px; height: 125px; }
    .ai-core svg { width: 70px; height: 70px; }
}
@media (max-width: 640px) {
    .dashboard-header { height: auto; min-height: 72px; padding: 13px 18px; }
    .dashboard-header .brand__copy, .account-chip__copy { display: none; }
    .account-chip { padding: 4px; border: 0; background: transparent; }
    .logout-button { width: 42px; padding: 0; justify-content: center; font-size: 0; }
    .dashboard-main { width: min(100% - 30px, 1180px); padding-block: 28px; }
    .dashboard-welcome { min-height: 0; grid-template-columns: 1fr; padding: 30px 24px; border-radius: 21px; }
    .dashboard-welcome__art { display: none; }
    .dashboard-grid { grid-template-columns: 1fr; gap: 12px; }
}
@media (max-width: 430px) {
    .auth-panel { align-items: flex-start; padding-inline: 19px; }
    .auth-card__header { margin-bottom: 25px; }
    .auth-card__header h1 { font-size: 1.72rem; }
    .input-shell, .primary-button { height: 52px; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        scroll-behavior: auto !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}
