@font-face {
    font-family: Vazirmatn;
    src: url('./vazirmatn.woff2') format('woff2');
    font-weight: 100 900;
    font-display: swap;
}
:root {
    font-family: Vazirmatn, sans-serif;
    color: #24211e;
    background: #f5f0e8;
    --accent: #d97757;
    --ink-accent: #8c3c25;
    --muted: #625951;
    --border: #dfd1c5;
}
* { box-sizing: border-box; }
body { margin: 0; }
.auth-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    place-items: center;
    min-height: 100svh;
    padding: 8px clamp(12px, 2.2vw, 26px);
    background: radial-gradient(ellipse at center, #fff8f4, #faeee7);
}
.auth-card {
    width: min(100%, 440px);
    padding: clamp(22px, 3.2vw, 42px);
    border: 1px solid #fff;
    border-radius: 27px;
    background: #fffaf5f5;
    box-shadow: 0 16px 44px #562d1b13;
}
h1 { font-size: clamp(24px, 3vw, 32px); line-height: 1.45; margin: 0 0 8px; font-weight: 850; }
p { color: var(--muted); margin: 0 0 20px; }
form { display: grid; gap: 14px; }
label { display: block; font-weight: 650; font-size: 14px; margin-block-end: 5px; }
input, button { font: inherit; }
input {
    width: 100%;
    min-height: 46px;
    background: #fffdf9;
    border: 1px solid #cdbeb1;
    border-radius: 12px;
    padding: 8px 12px;
    color: inherit;
}
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .6; }
:focus-visible { outline: 3px solid var(--ink-accent); outline-offset: 3px; }
.primary {
    border: 1px solid #9e4c35;
    color: #24140f;
    background: var(--accent);
    border-radius: 12px;
    font-weight: 800;
    min-height: 48px;
    width: 100%;
}
.primary:hover:not(:disabled) { background: #e18a6e; }
.text-button, a { color: var(--ink-accent); text-underline-offset: 4px; }
.text-button { background: transparent; border: 0; padding: 5px 0; text-decoration: underline; text-underline-offset: 4px; }
.auth-actions { display: grid; gap: 5px; margin-top: 13px; justify-items: start; font-size: 14px; }
.back-home { display: inline-block; margin-top: 18px; font-size: 14px; }
.terms { font-size: 12px; margin: 16px 0 0; line-height: 1.8; }
.phone-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border); margin-bottom: 17px; padding-bottom: 9px; }
.verified { color: #226044; font-size: 13px; }
.field-shell { position: relative; }
.field-shell input { padding-inline: 62px 13px; }
.field-shell .text-button { position: absolute; inset: 0 9px 0 auto; font-size: 12px; }
.phone-icon { position: absolute; right: 14px; top: 13px; width: 12px; height: 19px; border: 1.5px solid #625951; border-radius: 3px; pointer-events: none; }
.phone-icon::after { content: ''; position: absolute; bottom: 2px; left: 3px; width: 3px; border-bottom: 1px solid; }
.error, .hint, .timer { font-size: 13px; margin: 5px 0 0; }
.error { color: #a02a1f; }
.error:empty { margin: 0; }
#form-error:empty { display: none; }
#auth-phone { padding: 8px 38px 8px 12px; }
input[aria-invalid=true] { border-color: #a02a1f; }
.login-password input {
    min-height: 58px;
    padding-inline: 64px 46px;
    border-radius: 14px;
    background: #fffaf7;
}
.login-password::after {
    content: '';
    position: absolute;
    inset-inline-start: 16px;
    inset-block-start: 50%;
    width: 23px;
    height: 23px;
    transform: translateY(-50%);
    background: var(--ink-accent);
    mask: url('./icons/lock.svg') center / contain no-repeat;
    pointer-events: none;
}
.login-password .text-button {
    inset: 8px auto 8px 6px;
    width: 45px;
    border-inline-start: 1px solid var(--login-divider);
}
.login-password .text-button::before {
    content: '';
    display: block;
    width: 26px;
    height: 26px;
    margin-inline: auto;
    background: currentColor;
    mask: url('./icons/eye.svg') center / contain no-repeat;
}
.login-password .text-button[aria-pressed="true"]::before { mask-image: url('./icons/eye-off.svg'); }
.login-password input[aria-invalid="true"] {
    border: 2px solid var(--login-error);
    background: #fff0ef;
}
.login-password:has(input[aria-invalid="true"])::after { background: var(--login-error); }
.login-password:has(input[aria-invalid="true"]) .text-button { color: var(--login-error); }
[data-view="password"] .error:not(:empty) {
    position: relative;
    padding: 8px 38px 8px 12px;
    margin-block-start: 10px;
    border-radius: 9px;
    color: var(--login-error);
    background: #fce8e7;
}
[data-view="password"] .error:not(:empty)::before {
    content: '';
    position: absolute;
    inset-inline-start: 11px;
    inset-block-start: 50%;
    width: 20px;
    height: 20px;
    transform: translateY(-50%);
    background: currentColor;
    mask: url('./icons/exclamation-circle-filled.svg') center / contain no-repeat;
}
meter { width: 100%; height: 10px; }
.enter-step { animation: enter-step .18s ease-out both; }
@keyframes enter-step { from { opacity: .4; transform: translateY(5px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .enter-step { animation: none; } }
@media (max-width: 680px) {
    .auth-header { inset: 22px 22px auto; }
}
.dashboard { margin: 8vh auto; max-width: calc(100vw - 32px); }

.auth-icon { width: 22px; height: 22px; flex: none; }
.auth-intro {
    display: flex;
    align-items: center;
    gap: clamp(12px, 4vw, 34px);
    margin-block-end: clamp(22px, 4vw, 39px);
    padding-inline: clamp(0px, 3vw, 30px);
}
.auth-intro > div { flex: 1; }
.auth-intro p { margin: 0; font-size: clamp(14px, 2.2vw, 20px); line-height: 1.65; }
.auth-emblem {
    display: grid;
    flex: none;
    place-items: center;
    width: clamp(48px, 10vw, 93px);
    aspect-ratio: 1;
    border: 1px solid #ffdfcc;
    border-radius: 27%;
    background: linear-gradient(145deg, #fff1e9, #ffdfca);
    color: #b7470b;
}
.auth-emblem .auth-icon { width: 56%; height: 56%; }
.auth-layout .auth-card {
    --ink-accent: #a94008;
    --login-divider: #e9ddd6;
    --login-error: #ac2434;
    width: min(100%, 720px);
    padding: clamp(24px, 6vw, 57px) clamp(18px, 4.5vw, 38px) clamp(24px, 5vw, 50px);
    border: 2px solid #fff;
    border-radius: clamp(23px, 5vw, 37px);
    background: linear-gradient(145deg, #fdfaf8, #faf6f3);
    box-shadow: 0 16px 32px #81370918;
}
#auth-step h1 { font-size: clamp(21px, 4.6vw, 38px); line-height: 1.25; margin-block-end: clamp(8px, 2vw, 18px); }
#auth-step form { gap: clamp(14px, 2.5vw, 25px); }
#auth-step label { font-size: clamp(15px, 2.4vw, 21px); font-weight: 500; margin-block-end: clamp(8px, 2vw, 15px); }
#auth-step .phone-row {
    min-height: clamp(49px, 8vw, 69px);
    margin-block-end: clamp(18px, 3.6vw, 28px);
    padding: 9px clamp(10px, 2.4vw, 20px);
    border: 1px solid #eae0d9;
    border-radius: 14px;
    background: #faf1eb;
}
.phone-number, #auth-step [data-action="cancel"] {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.phone-number { font-size: clamp(16px, 2.5vw, 23px); font-weight: 600; }
.phone-number::before {
    content: '';
    width: clamp(27px, 5vw, 40px);
    aspect-ratio: 1;
    border-radius: 8px;
    background: url('./icons/device-mobile.svg') center / 20px no-repeat #f2e5dc;
}
#auth-step [data-action="cancel"] {
    border-inline-start: 1px solid var(--login-divider);
    padding-inline-start: clamp(8px, 2vw, 17px);
    font-size: clamp(13px, 2vw, 19px);
}
#auth-step [data-action="cancel"] .auth-icon { width: 17px; height: 17px; }
.code-field { position: relative; }
.code-field input {
    min-height: clamp(49px, 8vw, 69px);
    padding-left: 48px;
    padding-right: 16px;
    border-color: #d65b12;
    border-radius: 16px;
    font-size: clamp(16px, 2.5vw, 22px);
    background: #fffcfa;
    text-align: right;
}
.code-field input:focus-visible { outline: 2px solid #d65b12; outline-offset: -2px; }
.code-field input[aria-invalid="true"] { border-color: var(--login-error); }
.code-field .auth-icon {
    position: absolute;
    inset-inline-end: 15px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
}
#auth-step .primary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: clamp(49px, 8vw, 69px);
    border: 0;
    border-radius: 14px;
    color: #fff;
    background: linear-gradient(110deg, #d86a2a, #ba4a13 68%, #be4910);
    box-shadow: 0 7px 14px #b74b092c;
    font-size: clamp(18px, 3vw, 24px);
}
#auth-step .primary:hover:not(:disabled) { filter: brightness(.94); }
.auth-divider { display: flex; align-items: center; gap: 15px; margin: clamp(14px, 3vw, 25px) 0 clamp(12px, 2.5vw, 20px); color: var(--muted); }
.auth-divider::before, .auth-divider::after { content: ''; flex: 1; border-top: 1px solid var(--login-divider); }
#auth-step .auth-actions { gap: clamp(8px, 1.75vw, 14px); margin: 0; }
#auth-step .auth-actions .text-button, .auth-layout .back-home {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: clamp(43px, 6.3vw, 54px);
    padding: 7px clamp(12px, 2vw, 23px);
    font-size: clamp(14px, 2.4vw, 22px);
    border: 1px solid #e8dfd9;
    border-radius: 12px;
    background: #faf2ed;
    color: #302925;
    text-align: start;
    text-decoration: none;
}
#auth-step .auth-actions .auth-icon { color: var(--ink-accent); }
#auth-step .auth-actions .text-button:hover:not(:disabled), .auth-layout .back-home:hover { background: #f5e6db; }
#auth-step .auth-actions .text-button::after, .auth-layout .back-home::after {
    content: '';
    width: 15px;
    height: 15px;
    margin-inline-start: auto;
    background: currentColor;
    mask: url('./icons/chevron-right.svg') center / contain no-repeat;
    transform: scaleX(-1);
}
#auth-step [data-action="password/reset/request"]::before, #auth-step [data-action="password-view"]::before {
    content: '';
    width: 22px;
    height: 22px;
    background: var(--ink-accent);
    mask: url('./icons/lock.svg') center / contain no-repeat;
}
.auth-layout .back-home { margin-top: clamp(8px, 1.75vw, 14px); }
.auth-actions .timer { margin: 0; font-size: clamp(11px, 1.8vw, 14px); }
.auth-card:has(#auth-step[data-view="initial"]) .back-home { margin-top: 18px; }
.timer:empty { display: none; }
@media (max-width: 380px) {
    .auth-layout { padding-inline: 12px; }
    .auth-layout .auth-card { padding-inline: 17px; }
    #auth-step [data-action="cancel"] { gap: 4px; }
}
