/* ------------------------------------------------------------------------------------ */
/* Harmony — guest pages: sign-in, second factor, password reset, guest error.           */
/* Light, on top of harmony-app.css (the .svc-* language): one card, plain fields, clear */
/* states. Tokens mirror harmony-product-ui.css so the app components render identically. */
/* ------------------------------------------------------------------------------------ */

:root {
    color-scheme: light;
    --hy-primary: #075fe4;
    --hy-primary-hover: #064fc1;
    --hy-primary-soft: #eff5ff;
    --hy-primary-line: #cfe0fb;
    --hy-ink: #0f2044;
    --hy-text: #34435f;
    --hy-muted: #697792;
    --hy-subtle: #94a0b3;
    --hy-canvas: #f4f7fb;
    --hy-surface: #ffffff;
    --hy-surface-soft: #fbfcfe;
    --hy-line: #e1e7ef;
    --hy-line-strong: #cad4e1;
    --hy-success: #087b59;
    --hy-success-soft: #eaf8f2;
    --hy-warning: #a86508;
    --hy-warning-soft: #fff7e7;
    --hy-danger: #c93445;
    --hy-danger-soft: #fff1f3;
    --hy-info: #1167cf;
    --hy-radius-sm: 8px;
    --hy-radius: 11px;
    --hy-radius-lg: 14px;
    --hy-shadow-float: 0 22px 55px rgba(15, 32, 68, .16);
}

html { background: var(--hy-canvas); }
body.harmony-auth-body { margin: 0; min-height: 100vh; min-height: 100dvh; color: var(--hy-text); background: radial-gradient(circle at 14% 10%, rgba(7, 95, 228, .09), transparent 26rem), radial-gradient(circle at 90% 100%, rgba(14, 165, 233, .07), transparent 24rem), var(--hy-canvas); font-family: 'Vazirmatn', 'IRANSans', 'Segoe UI', sans-serif; font-size: 14px; line-height: 1.65; overflow-x: hidden; }
.harmony-auth-body *, .harmony-auth-body *::before, .harmony-auth-body *::after { box-sizing: border-box; }
.harmony-auth-body :focus-visible { outline: 3px solid rgba(7, 95, 228, .22); outline-offset: 2px; }
.harmony-auth-body a { color: var(--hy-primary); text-decoration: none; }
.harmony-auth-body a:hover { text-decoration: underline; }
.harmony-auth-body h1, .harmony-auth-body h2, .harmony-auth-body h3, .harmony-auth-body p { margin: 0; }
.fa-num { font-variant-numeric: lining-nums; }

/* ---- page + card ---- */
.auth-page { display: grid; place-items: center; min-height: 100vh; min-height: 100dvh; padding: 24px 16px; }
.auth-card { width: min(440px, 100%); padding: 28px 28px 24px; border: 1px solid var(--hy-line); border-radius: 22px; background: #fff; box-shadow: 0 30px 70px -40px rgba(7, 87, 200, .45), 0 14px 34px -28px rgba(15, 23, 42, .22); }
.auth-card--wide { width: min(520px, 100%); }
.auth-brand { display: flex; align-items: center; gap: 12px; padding-bottom: 18px; margin-bottom: 18px; border-bottom: 1px solid var(--hy-line); }
.auth-brand__mark { display: grid; place-items: center; flex: none; width: 52px; height: 52px; border: 1px solid var(--hy-primary-line); border-radius: 16px; background: var(--hy-primary-soft); }
.auth-brand__mark img { display: block; width: 34px; height: 34px; }
.auth-brand__kicker { color: var(--hy-primary); font-size: 11.5px; font-weight: 850; }
.auth-brand h1 { color: var(--hy-ink); font-size: 22px; font-weight: 950; line-height: 1.3; }
.auth-brand__copy { color: var(--hy-muted); font-size: 12px; font-weight: 650; }
.auth-head { display: grid; gap: 4px; margin-bottom: 16px; }
.auth-head h2 { color: var(--hy-ink); font-size: 17px; font-weight: 900; }
.auth-head p { color: var(--hy-muted); font-size: 12.5px; font-weight: 650; line-height: 1.7; }

/* ---- tabs ---- */
.auth-tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; padding: 4px; margin-bottom: 18px; border: 1px solid var(--hy-line); border-radius: 12px; background: var(--hy-surface-soft); }
.auth-tabs button { min-height: 38px; border: 0; border-radius: 9px; background: transparent; color: var(--hy-muted); font: inherit; font-size: 12.5px; font-weight: 800; cursor: pointer; transition: background .12s ease, color .12s ease; }
.auth-tabs button[aria-selected="true"] { background: #fff; color: var(--hy-ink); box-shadow: 0 2px 8px rgba(15, 32, 68, .08); }
.auth-panel[hidden], .auth-step[hidden] { display: none !important; }

/* ---- fields ---- */
.auth-form { display: grid; gap: 14px; }
.auth-field { display: grid; gap: 6px; }
.auth-field__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.auth-field label { color: var(--hy-text); font-size: 12.5px; font-weight: 800; }
.auth-field__control { position: relative; }
.auth-field__control input { width: 100%; min-height: 50px; padding: 10px 14px; padding-inline-end: 46px; border: 1px solid var(--hy-line-strong); border-radius: 13px; background: #fff; color: var(--hy-ink); font: inherit; font-size: 15px; font-weight: 700; transition: border-color .12s ease, box-shadow .12s ease; }
.auth-field__control input::placeholder { color: var(--hy-subtle); font-weight: 600; }
.auth-field__control input:focus { border-color: var(--hy-primary); box-shadow: 0 0 0 4px rgba(7, 95, 228, .12); outline: 0; }
.auth-field__icon { position: absolute; top: 50%; inset-inline-end: 14px; display: grid; place-items: center; color: var(--hy-subtle); font-size: 16px; transform: translateY(-50%); pointer-events: none; transition: color .12s ease; }
.auth-field__control input:focus ~ .auth-field__icon { color: var(--hy-primary); }
.auth-field__button { position: absolute; top: 50%; inset-inline-end: 8px; display: grid; place-items: center; width: 36px; height: 36px; border: 0; border-radius: 9px; background: transparent; color: var(--hy-muted); font-size: 15px; cursor: pointer; transform: translateY(-50%); }
.auth-field__button:hover { background: var(--hy-surface-soft); color: var(--hy-ink); }
.auth-field__control.has-button input { padding-inline-end: 50px; }
.auth-field__hint { min-height: 0; color: var(--hy-muted); font-size: 11.5px; font-weight: 650; line-height: 1.6; }
.auth-field__hint:empty { display: none; }
.auth-field__hint[data-tone="warning"] { color: var(--hy-warning); }
.auth-field__error { color: var(--hy-danger); font-size: 11.5px; font-weight: 750; line-height: 1.6; }
.auth-field__error:empty { display: none; }
.auth-field.is-invalid input { border-color: var(--hy-danger); }
.auth-field.is-invalid input:focus { box-shadow: 0 0 0 4px rgba(201, 52, 69, .12); }
.auth-field .help-block, .auth-field .invalid-feedback { color: var(--hy-danger); font-size: 11.5px; font-weight: 750; margin: 0; }
.auth-field .help-block:empty { display: none; }
.auth-link { color: var(--hy-primary); font-size: 12px; font-weight: 800; background: none; border: 0; padding: 0; font-family: inherit; cursor: pointer; }
.auth-link:hover { text-decoration: underline; }

/* ---- remember / choice rows ---- */
.auth-check { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 40px; cursor: pointer; user-select: none; }
.auth-check > span:first-child { display: flex; align-items: center; gap: 10px; color: var(--hy-text); font-size: 13px; font-weight: 750; }
.auth-check input { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); opacity: 0; }
.auth-check__switch { position: relative; flex: none; width: 42px; height: 26px; border-radius: 999px; background: #cfd8e3; transition: background .15s ease; }
.auth-check__switch::after { content: ''; position: absolute; top: 3px; inset-inline-start: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(15, 32, 68, .25); transition: transform .15s ease; }
.auth-check input:checked + .auth-check__switch { background: var(--hy-primary); }
.auth-check input:checked + .auth-check__switch::after { transform: translateX(-16px); }
html[dir="ltr"] .auth-check input:checked + .auth-check__switch::after { transform: translateX(16px); }
.auth-check input:focus-visible + .auth-check__switch { box-shadow: 0 0 0 4px rgba(7, 95, 228, .18); }
.auth-check small { color: var(--hy-subtle); font-size: 11px; font-weight: 700; }
.auth-seg { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.auth-seg label { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 6px 12px; border: 1px solid var(--hy-line-strong); border-radius: 12px; background: #fff; color: var(--hy-text); font-size: 13px; font-weight: 800; cursor: pointer; transition: border-color .12s ease, background .12s ease, color .12s ease; }
.auth-seg input { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); opacity: 0; }
.auth-seg label:has(input:checked) { border-color: var(--hy-primary); background: var(--hy-primary-soft); color: var(--hy-primary); }
.auth-seg label:has(input:focus-visible) { box-shadow: 0 0 0 4px rgba(7, 95, 228, .14); }

/* ---- buttons ---- */
.auth-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 50px; padding: 10px 18px; border: 1px solid var(--hy-primary); border-radius: 13px; background: var(--hy-primary); color: #fff; font: inherit; font-size: 14.5px; font-weight: 900; cursor: pointer; box-shadow: 0 10px 24px rgba(7, 95, 228, .22); transition: background .12s ease, transform .1s ease, box-shadow .12s ease; }
.auth-btn:hover { background: var(--hy-primary-hover); border-color: var(--hy-primary-hover); }
.auth-btn:active { transform: translateY(1px); }
.auth-btn:disabled, .auth-btn[aria-busy="true"] { opacity: .65; cursor: progress; }
.auth-btn--secondary { border-color: var(--hy-line-strong); background: #fff; color: var(--hy-ink); box-shadow: none; }
.auth-btn--secondary:hover { border-color: #9fb3cc; background: var(--hy-surface-soft); }
.auth-btn--ghost { border-color: transparent; background: transparent; color: var(--hy-text); box-shadow: none; min-height: 40px; }
.auth-btn--ghost:hover { background: var(--hy-surface-soft); border-color: transparent; }
.auth-btn i { font-size: 16px; }
.auth-btn__spinner { display: none; }
.auth-btn[aria-busy="true"] .auth-btn__spinner { display: inline-block; width: 17px; height: 17px; font-size: 0; }
.auth-btn[aria-busy="true"] .auth-btn__icon { display: none; }
.auth-actions { display: grid; gap: 10px; }
.auth-actions--row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.auth-foot { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--hy-line); color: var(--hy-subtle); font-size: 11.5px; font-weight: 700; text-align: center; }
.auth-foot a, .auth-foot button { font-size: inherit; }

/* ---- alerts ---- */
.auth-alert { display: flex; align-items: flex-start; gap: 9px; padding: 10px 14px; margin-bottom: 14px; border: 1px solid var(--hy-primary-line); border-radius: 13px; background: var(--hy-primary-soft); color: #1f4f9a; font-size: 12.5px; font-weight: 700; line-height: 1.7; }
.auth-alert[hidden] { display: none !important; }
.auth-alert i { flex: none; margin-top: 3px; font-size: 14px; }
.auth-alert[data-tone="danger"] { border-color: #f1c3c9; background: var(--hy-danger-soft); color: #a92838; }
.auth-alert[data-tone="success"] { border-color: #bfe3d2; background: var(--hy-success-soft); color: #0f6b4a; }
.auth-alert[data-tone="warning"] { border-color: #f2d8a4; background: var(--hy-warning-soft); color: #8a4f06; }
.auth-alert p { margin: 0; }
.auth-alert ul { margin: 0; padding-inline-start: 18px; }

/* ---- one-time code step ---- */
.auth-otp { display: grid; gap: 14px; }
.auth-otp__sent { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border: 1px solid var(--hy-line); border-radius: 13px; background: var(--hy-surface-soft); color: var(--hy-text); font-size: 12.5px; font-weight: 650; line-height: 1.7; }
.auth-otp__sent i { flex: none; margin-top: 2px; color: var(--hy-primary); font-size: 16px; }
.auth-otp__sent b { color: var(--hy-ink); font-weight: 850; }
.auth-otp__meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--hy-muted); font-size: 12px; font-weight: 700; }
.auth-otp__meta [data-countdown] { color: var(--hy-ink); font-weight: 900; }
.auth-otp__meta button:disabled { color: var(--hy-subtle); cursor: default; text-decoration: none; }
.auth-otp .svc-otp input { width: 48px; height: 58px; font-size: 24px; }

/* ---- password strength ---- */
.auth-strength { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; }
.auth-strength span { height: 4px; border-radius: 999px; background: var(--hy-line); transition: background .15s ease; }
.auth-strength[data-level="1"] span:nth-child(-n+1) { background: var(--hy-danger); }
.auth-strength[data-level="2"] span:nth-child(-n+2) { background: var(--hy-warning); }
.auth-strength[data-level="3"] span:nth-child(-n+3) { background: #2e9d5c; }
.auth-strength[data-level="4"] span { background: var(--hy-success); }

/* ---- guest error page ---- */
.auth-error { width: min(560px, 100%); text-align: center; }
.auth-error__icon { display: grid; place-items: center; width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 20px; background: var(--hy-primary-soft); color: var(--hy-primary); font-size: 28px; }
.auth-error__icon[data-tone="danger"] { background: var(--hy-danger-soft); color: var(--hy-danger); }
.auth-error__icon[data-tone="warning"] { background: var(--hy-warning-soft); color: var(--hy-warning); }
.auth-error h1 { color: var(--hy-ink); font-size: 21px; font-weight: 950; }
.auth-error p { margin: 8px auto 0; max-width: 46ch; color: var(--hy-muted); font-size: 13px; font-weight: 650; line-height: 1.8; }
.auth-error .auth-actions { margin-top: 20px; }
.auth-incident { display: inline-flex; align-items: center; gap: 8px; margin-top: 14px; padding: 6px 12px; border: 1px dashed var(--hy-line-strong); border-radius: 999px; color: var(--hy-muted); font-size: 11.5px; font-weight: 750; }
.auth-incident code { font-family: inherit; color: var(--hy-ink); font-weight: 900; letter-spacing: .06em; }
.auth-incident button { border: 0; background: transparent; color: var(--hy-primary); font: inherit; font-size: 11.5px; font-weight: 800; cursor: pointer; }
.auth-offline { display: none; margin-top: 12px; color: var(--hy-warning); font-size: 12px; font-weight: 750; }
.auth-offline.is-visible { display: block; }
.auth-details { margin-top: 16px; text-align: start; }
.auth-details summary { cursor: pointer; color: var(--hy-muted); font-size: 12px; font-weight: 800; }
.auth-details pre { margin: 8px 0 0; padding: 10px 12px; border: 1px solid var(--hy-line); border-radius: 10px; background: var(--hy-surface-soft); color: var(--hy-text); font-size: 11px; line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; }
.auth-actions--full { width: 100%; }
.auth-details--inset { padding: 0 16px 16px; }

/* ==================================================================================== */
@media (max-width: 480px) {
    .auth-page { padding: 0; align-items: stretch; }
    .auth-card, .auth-card--wide { width: 100%; min-height: 100dvh; padding: max(24px, env(safe-area-inset-top)) 20px max(20px, env(safe-area-inset-bottom)); border: 0; border-radius: 0; box-shadow: none; }
    .auth-field__control input, .auth-btn { min-height: 52px; }
    .auth-field__control input { font-size: 16px; }
    .auth-otp .svc-otp input { width: 44px; height: 54px; }
}
@media (prefers-reduced-motion: reduce) {
    .harmony-auth-body *, .harmony-auth-body *::before, .harmony-auth-body *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
