/* مُستدام — Sign-in flow: tabs, Nafath, OTP, password, staff portal */
/* ===== auth flow ===== */
.auth__card .auth__alt {
  margin-top: var(--space-6);
}
.auth [dir='ltr'] {
  unicode-bidi: isolate;
}
.auth {
  flex-direction: column;
  align-items: center;
}
.auth__card {
  position: relative;
}
.auth__secure {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: var(--space-4) 0 0;
  font-size: 12px;
  color: var(--ink-subtle);
  text-align: center;
}
.auth__icon {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--brand-tint);
  color: var(--brand-ink);
  margin-bottom: var(--space-4);
}
.auth__icon svg {
  width: 28px;
  height: 28px;
}
.auth__hint {
  font-size: 12px;
  color: var(--ink-subtle);
  text-align: center;
  margin: var(--space-2) 0 0;
}
.auth__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  font-size: 14px;
  flex-wrap: wrap;
}
.auth__row a {
  color: var(--brand-ink);
  font-weight: 600;
}
.auth__nafath {
  gap: var(--space-2);
}
.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  background: var(--surface-muted);
  border-radius: var(--radius-md);
  margin-top: var(--space-6);
}
.auth-tabs a {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 8px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-muted);
  text-decoration: none;
  text-align: center;
}
.auth-tabs a:hover {
  color: var(--ink);
}
.auth-tabs a.is-active {
  background: var(--surface);
  color: var(--brand-ink);
  box-shadow: var(--shadow-sm);
}
.auth-tabs + .auth__nafath {
  margin-top: var(--space-4);
}
.auth-steps {
  display: flex;
  gap: 6px;
  list-style: none;
  padding: 0;
  margin: 0 0 var(--space-6);
  font-size: 12px;
  color: var(--ink-subtle);
}
.auth-steps li {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.auth-steps li::before {
  content: '';
  height: 3px;
  border-radius: 2px;
  background: var(--line);
}
.auth-steps li.is-done::before,
.auth-steps li.is-current::before {
  background: var(--brand);
}
.auth-steps li.is-current {
  color: var(--brand-ink);
  font-weight: 600;
}
.link-btn,
.otp__resend button {
  border: 0;
  background: none;
  padding: 0;
  font: 600 14px var(--font-sans);
  color: var(--brand-ink);
  cursor: pointer;
}
.otp__resend button:disabled {
  color: var(--ink-subtle);
  cursor: default;
  font-weight: 500;
}
.pw__toggle {
  flex: none;
  width: 32px;
  height: 32px;
  border: 0;
  background: transparent;
  border-radius: 8px;
  color: var(--ink-subtle);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.pw__toggle:hover,
.pw__toggle.is-on {
  color: var(--brand-ink);
  background: var(--brand-tint);
}
.pw-meter {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  margin-top: 6px;
}
.pw-meter i {
  height: 4px;
  border-radius: 2px;
  background: var(--line);
  transition: background 0.2s;
}
.pw-meter[data-s='1'] i:nth-child(-n + 1) {
  background: var(--danger);
}
.pw-meter[data-s='2'] i:nth-child(-n + 2) {
  background: var(--warning);
}
.pw-meter[data-s='3'] i:nth-child(-n + 3) {
  background: var(--brand);
}
.pw-meter[data-s='4'] i {
  background: var(--success);
}
.otp {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  margin: var(--space-4) 0 var(--space-3);
}
.otp input {
  width: 100%;
  height: 56px;
  text-align: center;
  font: 700 24px var(--font-sans);
  border: 1.5px solid var(--input-border);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--ink-strong);
  outline: none;
  transition:
    border-color 0.15s,
    box-shadow 0.15s,
    background 0.15s;
  padding: 0;
}
.otp input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-tint);
}
.otp input.has {
  border-color: var(--brand-ink);
}
.otp input.ok {
  border-color: var(--success);
  background: var(--success-soft);
}
.otp.shake {
  animation: otp-shake 0.4s;
}
@keyframes otp-shake {
  20%,
  60% {
    transform: translateX(-6px);
  }
  40%,
  80% {
    transform: translateX(6px);
  }
}
.otp__meta {
  display: flex;
  justify-content: center;
  font-size: 13px;
  color: var(--ink-muted);
  margin: 0 0 var(--space-4);
  min-height: 20px;
}
.otp__meta span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.otp__resend {
  text-align: center;
  margin-top: var(--space-4);
  font-size: 14px;
}
.nafath-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: var(--brand-tint);
  color: var(--brand-ink);
  margin-bottom: var(--space-6);
}
.nafath-head span {
  display: flex;
  flex-direction: column;
  line-height: 1.35;
}
.nafath-head small {
  font-size: 12px;
  color: var(--ink-muted);
}
.nafath-num {
  position: relative;
  width: 148px;
  height: 148px;
  margin: var(--space-6) auto var(--space-4);
  display: flex;
  align-items: center;
  justify-content: center;
}
.nafath-num .num {
  position: relative;
  font-size: 56px;
  font-weight: 700;
  color: var(--ink-strong);
  line-height: 1;
}
.nafath-num svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}
.nafath-num circle {
  fill: none;
  stroke-width: 6;
}
.nafath-num .bg {
  stroke: var(--line);
}
.nafath-num .fg {
  stroke: var(--brand);
  stroke-linecap: round;
  transition: stroke-dashoffset 1s linear;
}
.nafath-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 14px;
  color: var(--ink-muted);
  margin: 0;
}
.nafath-status .ms-spinner {
  width: 16px;
  height: 16px;
  border-width: 2px;
}
.nafath-status.is-ok {
  color: var(--success);
  font-weight: 600;
}
.nafath-how {
  margin: var(--space-6) 0 0;
  padding: var(--space-4);
  padding-inline-start: 36px;
  background: var(--surface-muted);
  border-radius: var(--radius-md);
  font-size: 14px;
  color: var(--ink-muted);
  display: grid;
  gap: 6px;
}
.demo-sim {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: var(--space-4);
  padding: 10px 12px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--surface-sand);
  font-size: 13px;
}
.demo-sim > span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--sand-ink);
  font-weight: 600;
  margin-inline-end: auto;
}
.demo-creds {
  margin-top: var(--space-6);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--surface-sand);
  font-size: 13px;
}
.demo-creds summary {
  cursor: pointer;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--sand-ink);
  font-weight: 600;
  list-style: none;
}
.demo-creds summary::-webkit-details-marker {
  display: none;
}
.demo-creds > div {
  padding: 0 12px 12px;
  display: grid;
  gap: 8px;
}
.demo-creds p {
  margin: 0;
  font-size: 13px;
}
.demo-creds button {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
  font: 600 13px var(--font-sans);
  color: var(--ink);
  text-align: start;
  flex-wrap: wrap;
}
.demo-creds button:hover {
  border-color: var(--brand);
  background: var(--brand-tint);
}
.demo-creds small {
  font-weight: 400;
  color: var(--ink-muted);
}
.staff-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--ink-strong);
  color: var(--ink-inverse);
  font-size: 12px;
  font-weight: 600;
  margin-bottom: var(--space-4);
}
.staff-badge svg {
  width: 14px;
  height: 14px;
}
.sms-sim {
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translate(-50%, -160%);
  z-index: 9999;
  width: min(360px, calc(100% - 24px));
  background: rgba(28, 34, 31, 0.95);
  color: #fff;
  border: 0;
  border-radius: 18px;
  padding: 12px 16px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.28);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  font: 400 14px/1.5 var(--font-sans);
  text-align: start;
  cursor: pointer;
  transition: transform 0.4s cubic-bezier(0.2, 0.9, 0.3, 1.15);
}
.sms-sim.in {
  transform: translate(-50%, 0);
}
.sms-sim__app {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  opacity: 0.7;
}
.sms-sim small {
  font-size: 11px;
  opacity: 0.6;
  margin-top: 4px;
}
@media (max-width: 640px) {
  .otp {
    gap: 6px;
  }
  .otp input {
    height: 50px;
    font-size: 22px;
  }
  .auth-tabs a {
    font-size: 13px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .otp.shake,
  .sms-sim {
    animation: none;
    transition: none;
  }
}
