/* ═══════════════════════════════════════════════════════════════════════
   الدخول · التحقق بخطوتين · شاشة القفل (.auth-*)
   ───────────────────────────────────────────────────────────────────────
   المرجع: docs/DESIGN.md. يُبنى فوق css/ui.css (الحقول .input و.field-label،
   الأزرار .btn، المفتاح .switch، الحبوب .pill، القائمة .item) ولا يعيد تعريفها.
   الملفات: js/screens/login.js · mfa-verify.js · mfa-setup.js · signup.js · js/ui/lock-screen.js
   الحركة: transform وopacity وحدهما، ودخول بـfill-mode backwards (لا transform
   يبقى بعد الانتهاء). الحلقات اللانهائية (الدوّار ومؤشّر الكتابة) تُلغى كلياً
   مع تقليل الحركة: مدة 1ms لحلقة لا نهائية تعيد الرسم إلى الأبد.
   ═══════════════════════════════════════════════════════════════════════ */

/* ═══ ١. مشترك ═══════════════════════════════════════════════════════ */
.auth-screen { background: var(--bg); }

/* دوّار صغير بلون النص (داخل الأزرار) */
.auth-spin {
  display: inline-block; flex: none; width: 20px; height: 20px; border-radius: 50%;
  border: 2.5px solid currentColor; border-top-color: transparent; opacity: .9;
  animation: spin .7s linear infinite;
}
.auth-spin-sm { width: 16px; height: 16px; border-width: 2px; }

/* خطأ تحت النموذج — يهتزّ قليلاً حين يظهر (أو يتكرّر) */
.auth-error {
  display: flex; align-items: flex-start; gap: 8px; padding: 11px 14px;
  border-radius: var(--r-md); background: color-mix(in srgb, var(--danger) 10%, transparent);
  color: var(--danger); font-size: var(--fz-md); font-weight: 700; line-height: 1.5;
}
.auth-error .icon-svg { width: 19px; height: 19px; margin-top: 1px; }
.auth-error.is-in { animation: auth-nudge 360ms var(--ease) backwards; }

/* زر الإرسال: دوّار مضمّن وحال الانتظار */
.auth-submit { height: 52px; font-size: var(--fz-lg); }
.auth-submit .auth-spin { display: none; }
.auth-submit.is-loading .auth-spin { display: inline-block; }
.auth-submit.is-loading:disabled { opacity: .85; }
.auth-link { height: 44px; font-size: var(--fz-md); }

@keyframes auth-rise  { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes auth-pop   { from { opacity: 0; transform: scale(.72); } to { opacity: 1; transform: none; } }
@keyframes auth-fade  { from { opacity: 0; } to { opacity: 1; } }
@keyframes auth-nudge { 0%, 100% { transform: none; } 25% { transform: translateX(-6px); } 50% { transform: translateX(5px); } 75% { transform: translateX(-3px); } }
@keyframes auth-shake { 0%, 100% { transform: none; } 15% { transform: translateX(-12px); } 35% { transform: translateX(10px); } 55% { transform: translateX(-7px); } 75% { transform: translateX(4px); } }
@keyframes auth-tick  { 0% { transform: scale(.4); } 70% { transform: scale(1.18); } 100% { transform: none; } }
@keyframes auth-caret { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }
@keyframes auth-out   { to { opacity: 0; } }

/* ═══ ٢. شاشة الدخول (/login) ════════════════════════════════════════ */
.auth-login {
  display: flex; flex-direction: column;
  width: 100%; max-width: 440px; margin-inline: auto;
  padding: calc(var(--safe-t) + clamp(28px, 7vh, 72px)) 24px calc(var(--safe-b) + 28px);
}

.auth-brand { display: grid; justify-items: center; text-align: center; }
/* شارة أويس الشفافة (ui.css .brand-art: فاتحة/داكنة) — بلا بلاطة ولا ظلّ */
.auth-logo {
  width: 96px; height: 96px;
  animation: auth-pop 520ms var(--ease-spring) backwards;
}
.auth-logo img { width: 100%; height: 100%; }
.auth-title {
  margin-top: 20px; font-size: var(--fz-3xl); font-weight: 800; line-height: 1.2; letter-spacing: -.01em;
  animation: auth-rise var(--dur-3) var(--ease) 70ms backwards;
}
.auth-tagline {
  margin-top: 6px; max-width: 36ch; font-size: var(--fz-md); color: var(--fg-2); line-height: 1.6; text-wrap: balance;
  animation: auth-rise var(--dur-3) var(--ease) 110ms backwards;
}

.auth-form { display: grid; gap: 18px; margin-top: clamp(28px, 5vh, 40px); }
.auth-form > * { animation: auth-rise var(--dur-3) var(--ease) backwards; }
.auth-form > :nth-child(1) { animation-delay: 150ms; }
.auth-form > :nth-child(2) { animation-delay: 185ms; }
.auth-form > :nth-child(3) { animation-delay: 220ms; }
.auth-form > :nth-child(4) { animation-delay: 255ms; }
.auth-form > :nth-child(6) { animation-delay: 290ms; }
.auth-form > .auth-error { animation: none; }
.auth-form > .auth-error.is-in { animation: auth-nudge 360ms var(--ease) backwards; }

.auth-field { display: grid; gap: 6px; }

/* عنوان السرفر: حقل LTR وزر فحص مضمّن في آخره */
.auth-url {
  display: flex; align-items: center; gap: 6px; height: 50px; padding-inline: 14px 5px;
  border: 1.5px solid var(--sep); border-radius: var(--r-md); background: var(--bg-elev);
  transition: border-color var(--dur-1), box-shadow var(--dur-1);
}
.auth-url:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.auth-url-input {
  flex: 1; min-width: 0; height: 100%; padding: 0; border: 0; outline: none; background: none;
  color: var(--fg); font-size: var(--fz-base); font-variant-numeric: tabular-nums;
}
.auth-url-input::placeholder { color: var(--fg-3); }
.auth-url-input:focus-visible { outline: none; }
.auth-probe {
  flex: none; display: inline-flex; align-items: center; gap: 6px; height: 38px; padding-inline: 12px 10px;
  border: 0; border-radius: var(--r-sm); background: var(--accent-soft); color: var(--accent);
  font-size: var(--fz-sm); font-weight: 700; direction: rtl;
  transition: transform var(--dur-1) var(--ease), background-color var(--dur-2), color var(--dur-2);
}
.auth-probe:active:not(:disabled) { transform: scale(.95); }
.auth-probe:disabled { opacity: .8; }
.auth-probe-ic { display: inline-grid; place-items: center; width: 18px; height: 18px; }
.auth-probe-ic .icon-svg { width: 18px; height: 18px; animation: auth-tick var(--dur-2) var(--ease-spring) backwards; }
.auth-probe.is-ok   { background: color-mix(in srgb, var(--success) 14%, transparent); color: var(--success); }
.auth-probe.is-fail { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }

.auth-hint-row { display: flex; align-items: center; gap: 8px; min-height: 22px; }
.auth-hint { font-size: var(--fz-sm); color: var(--fg-3); line-height: 1.5; }
.auth-probe-pill { gap: 6px; animation: auth-pop var(--dur-2) var(--ease-spring) backwards; }
.auth-probe-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }

/* كلمة المرور + زر العين */
.auth-pass { position: relative; }
.auth-pass > .input { padding-inline-end: 52px; }
.auth-eye {
  position: absolute; inset-block: 0; margin-block: auto; inset-inline-end: 4px;
  color: var(--fg-3);
}
.auth-eye .icon-svg { width: 22px; height: 22px; animation: auth-fade var(--dur-1) var(--ease) backwards; }

/* «تذكّرني» صفّاً بمفتاح */
.auth-switch-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px;
  font-size: var(--fz-md); font-weight: 500; color: var(--fg); cursor: pointer;
  -webkit-user-select: none; user-select: none;
}

/* «جرّب بدون خادم» — وضع التجربة: إجراء ثانوي تحت زرّ الدخول (أكسنت خفيف، لا ممتلئ) */
.auth-demo { margin-top: 4px; animation: auth-rise var(--dur-3) var(--ease) 320ms backwards; }
.auth-demo .auth-or { margin: 16px 0 14px; }
.auth-demo-btn { height: 50px; }
.auth-demo-btn .icon-svg { width: 20px; height: 20px; }
.auth-demo-btn .auth-spin { display: none; }
.auth-demo-btn.is-loading .auth-spin { display: inline-block; }
.auth-demo-btn.is-loading .icon-svg { display: none; }
.auth-demo-btn.is-loading:disabled { opacity: .85; }
.auth-demo-hint { margin-top: 8px; text-align: center; font-size: var(--fz-sm); color: var(--fg-3); line-height: 1.6; text-wrap: balance; }
/* الباب نفسه رابطاً مضغوطاً تحت الشعار — حين لا تتّسع الشاشة للزرّ تحت النموذج
   (login.js يقيس مرة عند الرسم). حبة أكسنت خفيف بارتفاع لمسة كاملة. */
.auth-demo-chip {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  margin-top: 14px; min-height: 44px; padding-inline: 18px; border: 0; border-radius: 22px;
  background: var(--accent-soft); color: var(--accent); font-size: var(--fz-md); font-weight: 700;
  transition: transform var(--dur-1) var(--ease), background-color var(--dur-2);
  animation: auth-rise var(--dur-3) var(--ease) 140ms backwards;
}
.auth-demo-chip:active:not(:disabled) { transform: scale(.96); background: color-mix(in srgb, var(--accent) 20%, transparent); }
.auth-demo-chip .icon-svg { width: 18px; height: 18px; }
.auth-demo-chip .auth-spin { display: none; }
.auth-demo-chip.is-loading .auth-spin { display: inline-block; }
.auth-demo-chip.is-loading .icon-svg { display: none; }
.auth-demo-chip:disabled { opacity: .85; }

/* الجلسات المحفوظة */
.auth-saved { margin-top: 32px; animation: auth-rise var(--dur-3) var(--ease) 330ms backwards; }
.auth-saved-title { padding: 0 4px 8px; font-size: var(--fz-sm); font-weight: 700; color: var(--fg-3); }
.auth-saved-list { --sep-inset: 64px; border: 1px solid var(--sep); border-radius: var(--r-lg); overflow: hidden; }
/* الصف: زرّ رئيسي يملأه (التبديل) وزرّ الحذف بجانبه — زرّان شقيقان لا متداخلان */
.auth-saved-list .auth-session { padding: 0; padding-inline-end: 6px; gap: 0; min-height: 60px; }
.auth-session-main {
  flex: 1; min-width: 0; align-self: stretch; display: flex; align-items: center; gap: 12px;
  padding-block: var(--row-py); padding-inline: 16px 8px; border: 0; background: none;
  color: inherit; font: inherit; text-align: start; cursor: pointer;
  -webkit-tap-highlight-color: transparent; transition: background-color var(--dur-1);
}
.auth-session-main:active { background: var(--bg-2); }
.auth-session-main:focus-visible { outline-offset: -3px; }
.auth-session .item-title { font-size: var(--fz-md); }
.auth-session .item-sub { font-size: var(--fz-sm); color: var(--fg-3); }
.auth-session-now { flex: none; }
.auth-session-remove { width: 38px; height: 38px; color: var(--fg-3); }
.auth-session-remove .icon-svg { width: 19px; height: 19px; }

/* ═══ ٣. صفحات الخطوات (/mfa-verify · /mfa-setup) ═══════════════════ */
.auth-step {
  display: flex; flex-direction: column;
  width: 100%; max-width: 440px; margin-inline: auto;
  padding: 8px 24px calc(var(--safe-b) + 28px);
}
.auth-step-head { display: grid; justify-items: center; text-align: center; padding-top: clamp(8px, 4vh, 36px); }
.auth-step-head.is-compact { padding-top: 0; }
.auth-step-head > * { animation: auth-rise var(--dur-3) var(--ease) backwards; }
.auth-step-head > :nth-child(2) { animation-delay: 50ms; }
.auth-step-head > :nth-child(3) { animation-delay: 90ms; }
.auth-step-icon {
  width: 76px; height: 76px; margin-bottom: 18px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent);
}
.auth-step-head > .auth-step-icon { animation: auth-pop 460ms var(--ease-spring) backwards; }
.auth-step-icon .icon-svg { width: 36px; height: 36px; }
.auth-step-icon.is-success { background: color-mix(in srgb, var(--success) 14%, transparent); color: var(--success); }
.auth-step-icon.is-danger  { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }
.auth-step-title { font-size: var(--fz-2xl); font-weight: 800; line-height: 1.3; }
.auth-step-text { margin-top: 8px; max-width: 34ch; font-size: var(--fz-md); color: var(--fg-2); line-height: 1.7; text-wrap: balance; }
.auth-nowrap { white-space: nowrap; }

.auth-step-form { display: grid; gap: 16px; margin-top: 32px; }
.auth-step-form > * { animation: auth-rise var(--dur-3) var(--ease) 130ms backwards; }
.auth-step-form > .auth-error { animation: none; }
.auth-step-form > .auth-error.is-in { animation: auth-nudge 360ms var(--ease) backwards; }

.auth-countdown { text-align: center; font-size: var(--fz-sm); color: var(--fg-3); min-height: 20px; }
.auth-countdown.is-expired { color: var(--danger); font-weight: 700; }

.auth-recovery-input { text-align: center; letter-spacing: .08em; font-size: var(--fz-lg); font-weight: 700; font-variant-numeric: tabular-nums; }

/* ── إدخال الرمز: حقل واحد شفّاف فوق ستّ خانات ── */
.auth-code { position: relative; width: 100%; max-width: 352px; margin-inline: auto; }
.auth-code-input {
  position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; margin: 0; padding: 0;
  border: 0; background: none; opacity: 0; color: transparent; caret-color: transparent;
  font-size: 16px; /* لا تكبير تلقائي على iOS */
}
.auth-code-boxes { display: flex; justify-content: center; gap: 8px; }
.auth-code-box {
  flex: 1; max-width: 52px; height: 60px; border-radius: var(--r-md);
  border: 1.5px solid var(--sep); background: var(--bg-2); color: var(--fg);
  display: grid; place-items: center;
  font-size: 26px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums;
  transition: border-color var(--dur-1), background-color var(--dur-1), box-shadow var(--dur-1), color var(--dur-1);
}
/* فجوة أوسع بين الثلاثيتين: 123 456 */
.auth-code-box:nth-child(3) { margin-inline-end: 8px; }
.auth-code-box.is-filled { background: var(--bg-elev); border-color: color-mix(in srgb, var(--fg) 26%, transparent); animation: auth-tick 180ms var(--ease-spring); }
.auth-code-box.is-active { background: var(--bg-elev); border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.auth-code-box.is-active:empty::after {
  content: ""; width: 2px; height: 26px; border-radius: 1px; background: var(--accent);
  animation: auth-caret 1s steps(1) infinite;
}
.auth-code.is-error .auth-code-box { border-color: var(--danger); box-shadow: none; }
.auth-code.is-error .auth-code-box.is-active { box-shadow: 0 0 0 4px color-mix(in srgb, var(--danger) 14%, transparent); }
.auth-code.is-error .auth-code-boxes { animation: auth-shake 420ms var(--ease); }
.auth-code.is-ok .auth-code-box { border-color: var(--success); color: var(--success); }
.auth-code.is-busy .auth-code-box { opacity: .7; }

/* ── معالج التفعيل ── */
.auth-steps { display: flex; gap: 6px; margin: 6px auto 22px; width: 132px; }
.auth-steps > i { flex: 1; height: 4px; border-radius: 2px; background: var(--bg-3); transition: background-color var(--dur-3) var(--ease); }
.auth-steps > i.on { background: var(--accent); }
.auth-pane { display: flex; flex-direction: column; }
.auth-pane:not([hidden]) { animation: auth-fade var(--dur-2) var(--ease) backwards; }
.auth-pane > .auth-submit { margin-top: 24px; animation: auth-rise var(--dur-3) var(--ease) 170ms backwards; }

.auth-loading { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 72px 0; color: var(--fg-3); font-weight: 500; }
.auth-loading .auth-spin { color: var(--accent); width: 24px; height: 24px; }
.auth-fail .auth-step-icon { margin-bottom: 8px; }
.auth-fail .btn .icon-svg { width: 20px; height: 20px; }

.auth-card {
  margin-top: 24px; padding: 20px 16px 14px; border-radius: var(--r-lg);
  background: var(--bg-elev); border: 1px solid var(--sep);
  animation: auth-rise var(--dur-3) var(--ease) 130ms backwards;
}
/* QR على أبيض دائماً — الماسح يحتاج التباين حتى في الداكن */
.auth-qr {
  width: 212px; height: 212px; margin-inline: auto; padding: 12px; border-radius: var(--r-md);
  background: #fff; display: grid; place-items: center; overflow: hidden;
  box-shadow: 0 0 0 1px var(--sep);
}
.auth-qr > canvas, .auth-qr > img { width: 188px; height: 188px; display: block; image-rendering: pixelated; }
/* حتى يصل الرمز: دوّار خافت في الخانة البيضاء؛ وإن فشل: جملة بدل الصورة */
.auth-qr { position: relative; }
.auth-qr:not(.is-ready):not(.is-failed)::before {
  content: ""; position: absolute; width: 26px; height: 26px; border-radius: 50%;
  border: 2.5px solid var(--accent); border-top-color: transparent; opacity: .55; animation: spin .8s linear infinite;
}
.auth-qr > img { opacity: 0; transition: opacity var(--dur-2) var(--ease); }
.auth-qr.is-ready > img { opacity: 1; }
.auth-qr.is-failed > img { display: none; }
/* بلا رمز لا حاجة إلى الأبيض: الخانة تعود إلى ألوان السمة فتُقرأ الجملة في الوضعين */
.auth-qr.is-failed { background: var(--bg-2); box-shadow: none; }
.auth-qr-msg { padding: 0 12px; text-align: center; color: var(--fg-2); font-size: var(--fz-sm); font-weight: 500; line-height: 1.6; }
.auth-or { display: flex; align-items: center; gap: 10px; margin: 18px 0 10px; color: var(--fg-3); font-size: var(--fz-sm); font-weight: 500; }
.auth-or::before, .auth-or::after { content: ""; flex: 1; height: 1px; background: var(--sep); }
.auth-secret {
  display: flex; align-items: center; gap: 6px; padding-block: 4px; padding-inline: 14px 4px;
  border-radius: var(--r-md); background: var(--bg-2);
}
.auth-secret code {
  flex: 1; min-width: 0; padding-block: 6px; overflow-wrap: anywhere; text-align: center; line-height: 1.6;
  font-family: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace; font-size: var(--fz-md); font-weight: 700;
  letter-spacing: .04em; color: var(--fg); -webkit-user-select: all; user-select: all;
}

.auth-note {
  display: flex; align-items: flex-start; gap: 10px; margin-top: 24px; padding: 12px 14px;
  border-radius: var(--r-md); background: color-mix(in srgb, var(--warning) 13%, transparent);
  color: var(--fg); font-size: var(--fz-md); line-height: 1.65;
  animation: auth-rise var(--dur-3) var(--ease) 130ms backwards;
}
.auth-note .icon-svg { width: 20px; height: 20px; margin-top: 2px; color: var(--warning); }
.auth-note b { font-weight: 800; }
.auth-recovery-list {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 16px;
  animation: auth-rise var(--dur-3) var(--ease) 170ms backwards;
}
.auth-recovery-list code {
  padding: 10px 6px; border-radius: var(--r-sm); background: var(--bg-2); color: var(--fg); text-align: center;
  font-family: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace; font-size: var(--fz-md); font-weight: 700;
  letter-spacing: .03em; -webkit-user-select: all; user-select: all;
}
.auth-actions { display: grid; gap: 10px; margin-top: 24px; animation: auth-rise var(--dur-3) var(--ease) 210ms backwards; }

/* ═══ ٤. شاشة القفل (js/ui/lock-screen.js) ══════════════════════════
   معتمة من أول إطار (لا تلاشي للطبقة نفسها — لا يظهر ما خلفها لحظةً)، والحركة
   لمحتواها وحده. الطبقة 9999: المكالمة (10000/10001 في call.css) تُرسم فوقها
   عمداً. لوحة الأرقام LTR كأي هاتف: 1 في أعلى اليسار، والصف الأخير بصمة · 0 · حذف. */
.auth-lock {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; justify-content: center; overflow-y: auto; overscroll-behavior: contain;
  background: var(--bg); color: var(--fg);
  -webkit-user-select: none; user-select: none;
}
.auth-lock.auth-lock-leaving { animation: auth-out 220ms var(--ease-in) forwards; pointer-events: none; }
.auth-lock-inner {
  display: flex; flex-direction: column; align-items: center;
  width: 100%; max-width: 420px; min-height: 100%;
  padding: calc(var(--safe-t) + clamp(20px, 7vh, 72px)) 24px calc(var(--safe-b) + 12px);
  outline: none;
}
.auth-lock-head { display: grid; justify-items: center; text-align: center; }
.auth-lock-logo {
  width: 72px; height: 72px;
  animation: auth-pop 440ms var(--ease-spring) backwards;
}
.auth-lock-logo img { width: 100%; height: 100%; }
.auth-lock-title { margin-top: 16px; font-size: var(--fz-xl); font-weight: 800; animation: auth-rise var(--dur-3) var(--ease) 50ms backwards; }
.auth-lock-msg {
  margin-top: 4px; min-height: 24px; max-width: 32ch; font-size: var(--fz-md); color: var(--fg-2);
  transition: color var(--dur-2); animation: auth-rise var(--dur-3) var(--ease) 80ms backwards;
}
.auth-lock-msg.is-error { color: var(--danger); font-weight: 700; }

.auth-lock-body {
  flex: 1; width: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding-block: clamp(16px, 3vh, 32px);
}
.auth-lock-pin {
  --key: clamp(62px, min(20vw, 9.4vh), 80px);
  display: flex; flex-direction: column; align-items: center; gap: clamp(24px, 5vh, 48px); width: 100%;
}
.auth-lock-dots { display: flex; align-items: center; justify-content: center; gap: 18px; height: 18px; }
.auth-lock-dot {
  width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--fg-3); flex: none;
  transition: background-color var(--dur-1), border-color var(--dur-1);
}
.auth-lock-dot.on { background: var(--accent); border-color: var(--accent); animation: auth-tick 180ms var(--ease-spring); }
.auth-lock-dots.is-error { animation: auth-shake 440ms var(--ease); }
.auth-lock-dots.is-error .auth-lock-dot { border-color: var(--danger); }
.auth-lock-dots.is-error .auth-lock-dot.on { background: var(--danger); }
.auth-lock-dots.is-ok .auth-lock-dot.on { background: var(--success); border-color: var(--success); }

.auth-lock-pad {
  display: grid; grid-template-columns: repeat(3, var(--key)); justify-content: center;
  gap: clamp(12px, 2.2vh, 20px) clamp(22px, 7vw, 34px);
}
.auth-lock-key {
  width: var(--key); height: var(--key); padding: 0; border: 0; border-radius: 50%;
  background: var(--bg-2); color: var(--fg);
  display: grid; place-items: center;
  font-size: calc(var(--key) * .4); font-weight: 500; line-height: 1; font-variant-numeric: tabular-nums;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
  transition: background-color var(--dur-2) var(--ease), transform var(--dur-2) var(--ease);
  animation: auth-rise var(--dur-3) var(--ease) backwards;
}
.auth-lock-key:nth-child(n+4)  { animation-delay: 30ms; }
.auth-lock-key:nth-child(n+7)  { animation-delay: 60ms; }
.auth-lock-key:nth-child(n+10) { animation-delay: 90ms; }
.auth-lock-key.is-pressed, .auth-lock-key:active { background: var(--bg-3); transform: scale(.92); transition-duration: 60ms; }
.auth-lock-key:focus-visible { outline-offset: 3px; }
.auth-lock-key .icon-svg { width: calc(var(--key) * .38); height: calc(var(--key) * .38); }
.auth-lock-key-fn { background: transparent; color: var(--fg-2); }
.auth-lock-key-fn.is-pressed, .auth-lock-key-fn:active { background: var(--bg-2); }
.auth-lock-key-bio { color: var(--accent); }
.auth-lock-key-bio:not(.is-on) { visibility: hidden; }

/* خانة أسفل اليسار: البصمة، أو ✓ حين لا يُعرف طول الرمز وقد كُتبت 4 أرقام */
.auth-lock-slot { display: grid; width: var(--key); height: var(--key); }
.auth-lock-slot > .auth-lock-key { grid-area: 1 / 1; animation-delay: 90ms; }
.auth-lock-key-ok { background: var(--accent); color: var(--accent-fg); }
.auth-lock-key-ok.is-pressed, .auth-lock-key-ok:active { background: var(--accent-press); }
.auth-lock-key-ok .icon-svg { width: calc(var(--key) * .38); height: calc(var(--key) * .38); }
.auth-lock-slot:not(.is-confirm) > .auth-lock-key-ok,
.auth-lock-slot.is-confirm > .auth-lock-key-bio { visibility: hidden; }
.auth-lock-slot.is-confirm > .auth-lock-key-ok { animation: auth-pop var(--dur-2) var(--ease-spring) backwards; }

/* أثناء التحقق (PBKDF2 قد يأخذ لحظة على هاتف بطيء): النقاط تخفت بعد تأخير قصير */
.auth-lock-dots.is-busy .auth-lock-dot.on { opacity: .5; transition: opacity var(--dur-2) var(--ease) 150ms; }

/* بصمة فقط (بلا رمز): زر كبير في الوسط */
.auth-lock-bio {
  display: grid; justify-items: center; gap: 14px; padding: 8px; border: 0; background: none;
  color: var(--accent); font-size: var(--fz-md); font-weight: 700;
  animation: auth-rise var(--dur-3) var(--ease) 100ms backwards;
}
.auth-lock-bio-ring {
  width: 92px; height: 92px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent-soft); transition: transform var(--dur-1) var(--ease), background-color var(--dur-1);
}
.auth-lock-bio:active .auth-lock-bio-ring { transform: scale(.93); background: color-mix(in srgb, var(--accent) 20%, transparent); }
.auth-lock-bio-ring .icon-svg { width: 46px; height: 46px; }

.auth-lock-logout { height: 44px; color: var(--fg-2); font-size: var(--fz-md); }
.auth-lock-logout:active:not(:disabled) { background: var(--bg-2); }

/* ═══ ٥. طلب الانضمام (/signup · سطر «اطلب الانضمام» في /login) ═══════
   js/screens/signup.js: ثلاثة ألواح .auth-pane داخل .auth-step (النموذج · الرمز · الحالة)،
   والخانات الستّ من ٣ (.auth-code). login.js: سطر .auth-join تحت زرّ الدخول، ارتفاعه 48px
   مع هامشه (JOIN_ROW_H في login.js — يُحسب مكانه قبل أن يظهر). */
.auth-join {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 2px 6px;
  min-height: 44px; margin-top: 4px;
  font-size: var(--fz-md); color: var(--fg-2); text-align: center;
}
.auth-login > .auth-join:not([hidden]) { animation: auth-rise var(--dur-3) var(--ease) backwards; }
.auth-join-btn {
  min-height: 44px; padding-inline: 8px; border: 0; border-radius: var(--r-sm); background: none;
  color: var(--accent); font: inherit; font-weight: 800; cursor: pointer;
  -webkit-tap-highlight-color: transparent; transition: background-color var(--dur-1);
}
.auth-join-btn:active { background: var(--accent-soft); }

.auth-signup .auth-step-head.is-compact { padding-top: 0; }
.auth-su-server { margin-top: 12px; gap: 6px; max-width: 100%; }
.auth-su-server .ltr { overflow: hidden; text-overflow: ellipsis; }
.auth-su-form { margin-top: 24px; }
.auth-field-hint { font-size: var(--fz-sm); color: var(--fg-3); line-height: 1.5; }
.auth-optional { font-weight: 500; color: var(--fg-3); }
.auth-su-note { min-height: 88px; }
.auth-su-count { justify-self: end; }
.auth-signup .input[aria-invalid="true"] { border-color: var(--danger); }
.auth-signup .input[aria-invalid="true"]:focus { box-shadow: 0 0 0 4px color-mix(in srgb, var(--danger) 14%, transparent); }
/* حقل الطُّعم: خارج الشاشة لا display:none (بعض الروبوتات تتخطّى المخفيّ)، ولا يصله التنقّل بالمفاتيح */
.auth-hp {
  position: absolute !important; inset-inline-start: -10000px; top: auto;
  width: 1px; height: 1px; overflow: hidden; opacity: 0; pointer-events: none;
}
.auth-su-foot { margin-top: 12px; animation: auth-rise var(--dur-3) var(--ease) 170ms backwards; }

/* الرمز: البريد LTR داخل الجملة العربية، و«إعادة الإرسال» بعدّاد */
.auth-su-email { font-weight: 800; color: var(--fg); overflow-wrap: anywhere; }
.auth-su-resend .auth-spin { display: none; }
.auth-su-resend.is-loading .auth-spin { display: inline-block; }
.auth-su-resend:disabled { opacity: 1; color: var(--fg-3); }

/* الحالة: بطاقة الاسم والبريد، والسبب، وزرّ التحديث */
.auth-su-card { display: grid; gap: 10px; padding: 14px 16px; }
.auth-su-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; min-width: 0; font-size: var(--fz-md); }
.auth-su-row > span { flex: none; color: var(--fg-3); }
.auth-su-row > b { min-width: 0; font-weight: 700; overflow-wrap: anywhere; text-align: end; }
.auth-su-reason .icon-svg { color: var(--danger); }
.auth-su-reason { background: color-mix(in srgb, var(--danger) 9%, transparent); }
.auth-su-refresh .icon-svg { width: 20px; height: 20px; }
.auth-su-refresh.is-loading .icon-svg { display: none; }
.auth-signup .auth-actions .auth-countdown { margin-top: -2px; }

/* ═══ ٦. تقليل الحركة: الحلقات اللانهائية تتوقف كلياً ═════════════════ */
body.reduce-motion .auth-spin,
body.reduce-motion .auth-qr::before,
body.reduce-motion .auth-code-box.is-active:empty::after { animation: none; }
@media (prefers-reduced-motion: reduce) {
  .auth-spin, .auth-qr::before, .auth-code-box.is-active:empty::after { animation: none; }
}

/* ═══ ٧. تاريخ الميلاد (1.14، القدرة age_gate — js/ui/age-gate.js) ═══════
   خانتا الشهر والسنة في «طلب الانضمام» وفي ورقة «أكّد تاريخ ميلادك»، وصفّ الإعدادات. */
.age-pick { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 10px; }
.age-pick-f { display: block; min-width: 0; }
.age-sel { appearance: auto; -webkit-appearance: auto; padding-inline: 12px; min-width: 0; cursor: pointer; }
.age-sel[aria-invalid="true"] { border-color: var(--danger); }
.age-sel[aria-invalid="true"]:focus { box-shadow: 0 0 0 4px color-mix(in srgb, var(--danger) 18%, transparent); }

/* الرفض تحت الخانتين («دون 15 سنة» لحظة الاختيار) */
.auth-birth-err {
  display: flex; align-items: flex-start; gap: 7px;
  color: var(--danger); font-size: var(--fz-sm); font-weight: 700; line-height: 1.5;
}
.auth-birth-err .icon-svg { width: 17px; height: 17px; flex: none; margin-top: 1px; }
.auth-birth-err.is-in { animation: auth-nudge 360ms var(--ease) backwards; }
.auth-su-birth[hidden] { display: none; }

/* الورقة */
.age-sheet { display: grid; padding-bottom: 4px; }
.age-sheet-ic {
  justify-self: center; display: grid; place-items: center; width: 56px; height: 56px; margin: 4px 0 10px;
  border-radius: 18px; background: color-mix(in srgb, #DE4479 14%, transparent); color: #DE4479;
}
.age-sheet-ic .icon-svg { width: 28px; height: 28px; }
.age-sheet .age-sheet-title { text-align: center; margin-bottom: 8px; }
.age-sheet .age-sheet-sub { text-align: center; margin: 0 4px 16px; line-height: 1.6; }
.age-sheet .age-err { margin-top: 12px; }
.age-sheet-foot { margin: 10px 4px 0; text-align: center; font-size: var(--fz-sm); color: var(--fg-3); line-height: 1.5; }

/* صفّ الإعدادات: «مطلوب» بلون التنبيه */
.age-row-list { margin-top: 12px; }
.age-row-need { color: #DE4479; font-weight: 700; }

/* «طلبات الانضمام» للمدير (screens/signups-admin.js): العمر في الصفّ والطلب، و15–17 بلون التنبيه */
.set-su-age { font-variant-numeric: tabular-nums; }
.set-su-young { color: var(--warning); font-weight: 700; }

/* ═══ ٨. أمان الحساب (1.14 — «ثقة الأعضاء وسلامتهم») ══════════════════
   login.js: «نسيت كلمة المرور؟» تحت الحقل، و/suspended «حسابك موقوف». screens/password-reset.js: .auth-pr (ألواح
   signup نفسها). screens/password-change.js: .acct-* («تغيير كلمة المرور» و«تنبيهات الأمان»، على .set-* من settings.css). */
.auth-forgot {
  justify-self: end; margin-top: 2px; padding: 4px 2px; border: 0; background: none;
  color: var(--accent); font: inherit; font-size: var(--fz-sm); font-weight: 700; cursor: pointer;
}
.auth-forgot:active { opacity: .7; }

.auth-pr .auth-step-text b.ltr { unicode-bidi: isolate; }
.auth-pr-demo { margin-top: 16px; }
.auth-pr-demo .icon-svg { color: var(--accent); }
.auth-pr-demo b { letter-spacing: .12em; }
.auth-pr-off { margin-top: 16px; }

.auth-suspended .auth-step-head { padding-top: clamp(16px, 8vh, 64px); }
.auth-sus-card { display: grid; gap: 12px; }
.auth-sus-reason { display: grid; gap: 4px; padding-top: 10px; border-top: 1px solid var(--sep); }
.auth-sus-reason > span { color: var(--fg-3); font-size: var(--fz-sm); }
.auth-sus-reason > p { margin: 0; font-size: var(--fz-md); font-weight: 600; line-height: 1.65; overflow-wrap: anywhere; }
.auth-sus-note .icon-svg { color: var(--fg-3); }

/* 1.18.1 — الاعتراض أثناء الإيقاف (screens/login.js · renderSuspended): حاله تحت البطاقة، وورقته */
#sus-card:empty, #sus-appeal:empty { display: none; }
.auth-ap-state {
  display: flex; align-items: flex-start; gap: 10px; margin-top: 16px; padding: 12px 14px; border-radius: var(--r-md);
  background: var(--bg-2); line-height: 1.55; animation: auth-rise var(--dur-3) var(--ease) 150ms backwards;
}
.auth-ap-state > .icon-svg { flex: none; width: 20px; height: 20px; margin-top: 2px; }
.auth-ap-state b { display: block; font-weight: 800; font-size: var(--fz-md); }
.auth-ap-state small { display: block; margin-top: 2px; color: var(--fg-2); font-size: var(--fz-sm); overflow-wrap: anywhere; white-space: pre-line; }
.auth-ap-state.wait { background: var(--accent-soft); }
.auth-ap-state.wait > .icon-svg { color: var(--accent); }
.auth-ap-state.ok { background: color-mix(in srgb, var(--success) 12%, transparent); }
.auth-ap-state.ok > .icon-svg { color: var(--success); }
.auth-ap-state.bad { background: color-mix(in srgb, var(--danger) 10%, transparent); }
.auth-ap-state.bad > .icon-svg { color: var(--danger); }
.auth-actions .btn .icon-svg { width: 20px; height: 20px; }
.auth-actions .auth-submit.is-loading > .icon-svg { display: none; }
.auth-ap-hint { margin: -2px 0 0; text-align: center; color: var(--fg-3); font-size: var(--fz-sm); line-height: 1.55; }
.auth-ap-sheet { display: grid; gap: 10px; }
.auth-ap-sheet .sheet-title { margin-bottom: 0; }
.auth-ap-reason {
  display: grid; gap: 2px; padding: 8px 12px; border-radius: var(--r-md); background: var(--bg-2); color: var(--fg-2);
  font-size: var(--fz-sm); line-height: 1.5; overflow-wrap: anywhere; max-height: 7.5em; overflow: hidden;
}
.auth-ap-reason > span { font-size: 11px; font-weight: 800; color: var(--fg-3); }
.auth-ap-text { width: 100%; min-height: 112px; resize: vertical; }
.auth-ap-count { justify-self: end; margin-top: -4px; color: var(--fg-3); font-size: var(--fz-xs); direction: ltr; }
.auth-ap-count.is-near { color: var(--warning); font-weight: 700; }

.acct-hero { padding-bottom: 4px; }
.acct-hero-ic {
  display: grid; place-items: center; width: 72px; height: 72px; border-radius: 22px;
  background: color-mix(in srgb, #F08C00 14%, transparent); color: #F08C00;
}
.acct-hero-ic .icon-svg { width: 34px; height: 34px; }
.acct-hero .set-hero-sub { max-width: 32ch; text-align: center; line-height: 1.6; white-space: normal; overflow: visible; text-overflow: clip; }
.set-screen .list-inset.acct-near { margin-top: 16px; }
.acct-links { display: flex; justify-content: center; padding: 18px 16px 0; }
.set-screen .list-note.acct-intro { display: flex; align-items: flex-start; gap: 8px; padding-top: 6px; }
.set-screen .list-note.acct-intro .icon-svg { flex: none; width: 18px; height: 18px; margin-top: 2px; color: var(--accent); }
.acct-ev { min-height: 70px; }
.acct-ev .item-sub { white-space: normal; overflow: visible; text-overflow: clip; line-height: 1.5; }
.acct-ev-t { display: flex; align-items: center; gap: 8px; min-width: 0; }
.acct-ev-t > bdi { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-ev-t .pill { flex: none; }
.acct-notme { white-space: nowrap; color: var(--danger); }
.acct-alert {
  display: flex; align-items: flex-start; gap: 12px; margin: 14px 16px 0; padding: 14px 16px; border-radius: var(--r-lg);
  background: color-mix(in srgb, var(--warning) 13%, var(--bg-elev)); line-height: 1.6;
}
.acct-alert-ic { flex: none; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--bg-elev); color: var(--warning); }
.acct-alert-ic .icon-svg { width: 20px; height: 20px; }
.acct-alert-b { display: grid; gap: 4px; min-width: 0; font-size: var(--fz-md); }
.acct-alert-b b { font-weight: 800; }
.acct-alert-b .btn { justify-self: start; margin-top: 6px; }

/* ═══ ٩. أدوات المدير للثقة (1.14) ═══════════════════════════════════
   الأنماط هنا لأن هذه الشاشات من حزمة «أمان الحساب»؛ تُبنى فوق .set-* في settings.css.
   reports-admin.js: أزرار العقوبات .set-rp-pen وورقة مدة الإيقاف .set-rp-days. team.js: «العقوبات» .set-tm-pen*.
   legal-admin.js: .lg-*. domains-admin.js: .dm-*. */
.set-rp-pen { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 14px 16px 0; }
.set-rp-pen-b { height: 46px; gap: 6px; font-size: var(--fz-sm); }
.set-rp-pen-b .icon-svg { width: 18px; height: 18px; }
.set-rp-pen-b.is-danger { color: var(--danger); background: color-mix(in srgb, var(--danger) 11%, transparent); }
.set-rp-days { display: grid; gap: 14px; padding-bottom: 6px; }
.set-rp-days .sheet-title { text-align: center; }
.set-rp-days-sub { margin: -6px 4px 0; text-align: center; color: var(--fg-2); font-size: var(--fz-sm); line-height: 1.6; }
.set-rp-days-seg button { font-size: var(--fz-sm); }
.set-rp-days-acts { display: grid; gap: 8px; margin-top: 4px; }

.set-tm-sus { margin-top: 18px; }
.set-tm-sus b { font-weight: 800; }
.set-tm-pen { min-height: 66px; }
.set-tm-pen .item-sub { white-space: normal; overflow: visible; text-overflow: clip; line-height: 1.5; }
.set-tm-pen:not(.on) .tile { opacity: .55; }
.set-tm-pen-r { color: var(--fg-2); }
.set-tm-lift { white-space: nowrap; }
.set-tm-lift[aria-busy="true"] { opacity: .6; pointer-events: none; }

.lg-trail { gap: 6px; }
.lg-due { font-size: var(--fz-sm); font-weight: 700; color: var(--fg-2); white-space: nowrap; }
.lg-due.late { color: var(--danger); }
.lg-row.late .item-title { color: var(--danger); }
.set-screen .set-submit.lg-add { padding-top: 16px; }
.lg-stats { padding: 14px 16px; display: grid; gap: 14px; }
.lg-tot { display: grid; grid-template-columns: repeat(auto-fit, minmax(84px, 1fr)); gap: 8px; }
.lg-tot > div { display: grid; gap: 2px; padding: 10px 8px; border-radius: var(--r-md); background: var(--bg-2); text-align: center; }
.lg-tot b { font-size: var(--fz-lg); font-weight: 800; font-variant-numeric: tabular-nums; }
.lg-tot small { color: var(--fg-3); font-size: var(--fz-xs); line-height: 1.4; }
.lg-months { display: grid; gap: 8px; }
.lg-month { display: grid; grid-template-columns: minmax(84px, 7.5em) 1fr auto; align-items: center; gap: 4px 10px; font-size: var(--fz-sm); }
.lg-month.none { color: var(--fg-3); }
.lg-month-n { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lg-bar { height: 8px; border-radius: 4px; background: var(--bg-2); overflow: hidden; }
.lg-bar > i { display: block; height: 100%; border-radius: 4px; background: var(--accent); }
.lg-month-t { font-variant-numeric: tabular-nums; min-width: 2ch; text-align: end; }
.lg-month-d { grid-column: 2 / -1; color: var(--fg-3); font-size: var(--fz-xs); line-height: 1.5; }
.lg-sheet { display: grid; gap: 12px; padding-bottom: 8px; }
.lg-sheet .sheet-title { text-align: center; overflow-wrap: anywhere; }
.lg-form { display: grid; gap: 14px; }
.lg-form small { font-weight: 500; color: var(--fg-3); }
.lg-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.lg-2 > .field { min-width: 0; }
.lg-seg button { font-size: var(--fz-sm); padding: 0 4px; }
.lg-kvs { margin: 0; }
.lg-sum { white-space: pre-wrap; }

.set-screen .list-note.dm-intro { display: flex; align-items: flex-start; gap: 8px; padding-top: 6px; }
.set-screen .list-note.dm-intro .icon-svg { flex: none; width: 18px; height: 18px; margin-top: 2px; color: var(--danger); }
.dm-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 12px; margin-top: 14px; }
.dm-stats > div { display: grid; gap: 2px; padding: 8px 4px; text-align: center; }
.dm-stats b { font-size: var(--fz-lg); font-weight: 800; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.dm-stats small { color: var(--fg-3); font-size: var(--fz-xs); line-height: 1.4; }
.dm-add { padding: 12px; gap: 8px; }
.dm-add-row { display: flex; gap: 8px; }
.dm-add-row > .input { flex: 1; min-width: 0; text-align: left; }
.dm-add-row > .input:placeholder-shown { direction: rtl; text-align: start; }
.dm-add-row > .btn { flex: none; gap: 4px; padding-inline: 14px; }
.dm-add .input.bad { border-color: var(--danger); }
.dm-head { display: grid; gap: 10px; }
.dm-head .dm-search { margin: 0; }
.dm-name { unicode-bidi: isolate; overflow-wrap: anywhere; font-family: ui-monospace, 'SFMono-Regular', Consolas, monospace; font-size: var(--fz-md); }
.dm-del { color: var(--fg-3); }
.dm-del:disabled { opacity: .4; }

@media (max-width: 360px) {
  .set-rp-pen { grid-template-columns: 1fr; }
  .lg-2 { grid-template-columns: 1fr; }
}
