/* =========================================================================
   OneDzair — Auth stylesheet (v2 "Focal Stage")
   Centered card on brand-aware atmospheric background.
   To revert to v1 split-screen: cp public/css/auth.v1.css public/css/auth.css
   ========================================================================= */

/* -------------------------------------------------------------------------
   Reset
   ------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; }
button { font: inherit; color: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
img, svg { display: block; max-width: 100%; }

/* -------------------------------------------------------------------------
   Tokens
   ------------------------------------------------------------------------- */
:root {
  --brand-orange: #fb840c;
  --brand-orange-deep: oklch(64% 0.18 49);
  --brand-orange-soft: oklch(95% 0.04 50);
  --brand-navy: #092642;
  --brand-navy-deep: oklch(15% 0.04 252);

  /* Stage backgrounds — warm cream in light, deep navy in dark */
  --stage-bg-1: oklch(98% 0.006 80);
  --stage-bg-2: oklch(96% 0.012 65);
  --surface: #ffffff;
  --surface-2: oklch(98% 0.006 252);

  --ink-1: #092642; /* exact brand navy — strong text + wordmark */
  --ink-2: oklch(38% 0.022 252);
  --ink-3: oklch(52% 0.016 252);
  --ink-4: oklch(64% 0.014 252);

  --line-1: oklch(92% 0.008 252);
  --line-2: oklch(86% 0.012 252);
  --line-3: oklch(78% 0.016 252);

  --c-error: oklch(54% 0.22 25);
  --c-error-bg: oklch(96% 0.025 25);
  --c-success: oklch(52% 0.14 145);
  --c-success-bg: oklch(96% 0.04 145);
  --c-info: oklch(50% 0.10 230);
  --c-info-bg: oklch(96% 0.025 230);
  --c-warning: oklch(64% 0.15 75);
  --c-warning-bg: oklch(96% 0.04 75);

  --s-1: 4px;  --s-2: 8px;   --s-3: 12px;  --s-4: 16px;
  --s-5: 24px; --s-6: 32px;  --s-7: 48px;  --s-8: 64px;  --s-9: 96px;

  --r-1: 8px;
  --r-2: 12px;
  --r-3: 16px;
  --r-4: 20px;

  /* Refined multi-layer shadow, navy-tinted */
  --card-shadow:
    0 1px 1px oklch(20% 0.02 252 / 0.04),
    0 4px 8px oklch(20% 0.02 252 / 0.06),
    0 16px 40px oklch(20% 0.02 252 / 0.08),
    0 32px 80px oklch(20% 0.02 252 / 0.06);
  --sh-sm: 0 1px 2px oklch(20% 0.02 252 / 0.06);
  --sh-md: 0 2px 6px oklch(20% 0.02 252 / 0.08), 0 1px 2px oklch(20% 0.02 252 / 0.04);

  --font-sans: 'Readex Pro', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

  --t-fast: 150ms cubic-bezier(0.2, 0, 0.1, 1);
  --t-med:  220ms cubic-bezier(0.2, 0, 0.1, 1);
}

[data-theme="dark"] {
  --stage-bg-1: oklch(13% 0.025 252);
  --stage-bg-2: oklch(16% 0.030 252);
  --surface: oklch(19% 0.025 252);
  --surface-2: oklch(22% 0.028 252);

  --ink-1: oklch(96% 0.005 252);
  --ink-2: oklch(80% 0.012 252);
  --ink-3: oklch(64% 0.014 252);
  --ink-4: oklch(50% 0.016 252);

  --line-1: oklch(28% 0.025 252);
  --line-2: oklch(34% 0.028 252);
  --line-3: oklch(44% 0.030 252);

  --c-error-bg: oklch(28% 0.07 25);
  --c-success-bg: oklch(28% 0.06 145);
  --c-info-bg: oklch(28% 0.06 230);
  --c-warning-bg: oklch(28% 0.06 75);

  --card-shadow:
    0 1px 1px rgba(0,0,0,0.40),
    0 4px 12px rgba(0,0,0,0.36),
    0 24px 60px rgba(0,0,0,0.34),
    0 48px 100px rgba(0,0,0,0.30);
  --sh-sm: 0 1px 2px rgba(0,0,0,0.30);
  --sh-md: 0 2px 6px rgba(0,0,0,0.36), 0 1px 2px rgba(0,0,0,0.20);
}

/* -------------------------------------------------------------------------
   Body
   ------------------------------------------------------------------------- */
html, body { height: 100%; }
body.auth-body {
  background: var(--stage-bg-1);
  color: var(--ink-1);
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
:root[lang="ar"] body.auth-body { line-height: 1.7; }

/* -------------------------------------------------------------------------
   Stage — full viewport with atmospheric background
   ------------------------------------------------------------------------- */
.auth-stage {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  isolation: isolate;
  overflow: hidden;
  /* warm radial wash + base */
  background:
    radial-gradient(ellipse 80% 50% at 80% 0%, oklch(95% 0.04 50 / 0.40), transparent 60%),
    radial-gradient(ellipse 60% 40% at 0% 100%, oklch(94% 0.03 252 / 0.50), transparent 60%),
    var(--stage-bg-1);
}
[data-theme="dark"] .auth-stage {
  background:
    radial-gradient(ellipse 80% 50% at 80% 0%, oklch(28% 0.10 50 / 0.18), transparent 60%),
    radial-gradient(ellipse 60% 40% at 0% 100%, oklch(20% 0.05 252 / 0.50), transparent 60%),
    var(--stage-bg-1);
}

/* Giant hexagon watermark */
.auth-stage::before {
  content: "";
  position: absolute;
  inset: auto -10% -30% auto;
  width: clamp(420px, 60vw, 820px);
  aspect-ratio: 1 / 1;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 230'%3E%3Cpath d='M100,15 L185,63.75 L185,166.25 L100,215 L15,166.25 L15,63.75 Z' fill='none' stroke='%23fb840c' stroke-width='1.2'/%3E%3Cpath d='M100,55 L150,84 L150,141 L100,170 L50,141 L50,84 Z' fill='none' stroke='%23fb840c' stroke-width='1'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-size: contain;
  opacity: 0.06;
  pointer-events: none;
  z-index: 0;
  transform: rotate(-8deg);
}
[data-theme="dark"] .auth-stage::before { opacity: 0.10; }

/* -------------------------------------------------------------------------
   Top bar
   ------------------------------------------------------------------------- */
.auth-topbar {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  padding: clamp(var(--s-4), 3vw, var(--s-5)) clamp(var(--s-4), 4vw, var(--s-6));
}
.auth-topbar__brand {
  display: inline-flex;
  align-items: center;
  gap: var(--s-3);
  text-decoration: none;
  color: inherit;
  transition: opacity var(--t-fast);
}
.auth-topbar__brand:hover { opacity: 0.85; }
.auth-topbar__brand svg { width: 36px; height: 36px; }
.auth-topbar__name {
  font-weight: 700;
  font-size: 1.0625rem;
  letter-spacing: -0.01em;
  color: var(--ink-1);
}
@media (max-width: 479px) {
  .auth-topbar__name { display: none; }
}
.auth-topbar__actions {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
}

/* -------------------------------------------------------------------------
   Stage main (centers the card vertically + horizontally)
   ------------------------------------------------------------------------- */
.auth-stage__main {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--s-5) clamp(var(--s-4), 5vw, var(--s-6));
  padding-block-end: calc(var(--s-5) + env(safe-area-inset-bottom, 0px));
}

/* -------------------------------------------------------------------------
   Card
   ------------------------------------------------------------------------- */
.auth-card {
  position: relative;
  width: 100%;
  max-width: 480px;
  background: var(--surface);
  border: 1px solid color-mix(in oklab, var(--line-1), transparent 30%);
  border-radius: var(--r-3);
  box-shadow: var(--card-shadow);
  isolation: isolate;
  overflow: hidden;
}
.auth-card.auth-form__content--wide { max-width: 760px; }

/* Top orange ribbon — the only visible accent on the card edge */
.auth-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg,
    transparent 0%,
    var(--brand-orange) 20%,
    var(--brand-orange) 80%,
    transparent 100%);
  z-index: 1;
}

/* Subtle top-down warmth on the card surface */
.auth-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, oklch(99% 0.008 50 / 0.5), transparent 30%);
  pointer-events: none;
  z-index: 0;
}
[data-theme="dark"] .auth-card::after {
  background: linear-gradient(180deg, oklch(25% 0.04 252 / 0.5), transparent 40%);
}

.auth-card__inner {
  position: relative;
  z-index: 1;
  padding: clamp(var(--s-6), 4vw, var(--s-7));
}
.auth-card.auth-form__content--wide .auth-card__inner {
  padding: clamp(var(--s-6), 4vw, var(--s-7)) clamp(var(--s-6), 5vw, var(--s-8));
}

/* -------------------------------------------------------------------------
   Stage footer
   ------------------------------------------------------------------------- */
.auth-stage__footer {
  position: relative;
  z-index: 2;
  padding: var(--s-4) clamp(var(--s-4), 4vw, var(--s-6));
  text-align: center;
  font-size: 0.8125rem;
  color: var(--ink-3);
}
.auth-stage__footer a {
  color: var(--ink-2);
  text-decoration: none;
  font-weight: 500;
  border-block-end: 1px solid transparent;
  transition: color var(--t-fast), border-color var(--t-fast);
}
.auth-stage__footer a:hover {
  color: var(--brand-orange);
  border-block-end-color: currentColor;
}
.auth-stage__footer__sep {
  color: var(--ink-4);
  margin-inline: var(--s-2);
}

/* -------------------------------------------------------------------------
   Top-bar actions: language pill + theme toggle
   ------------------------------------------------------------------------- */
.auth-lang {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  padding: 6px var(--s-3);
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--ink-2);
  box-shadow: var(--sh-sm);
}
.auth-lang__icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  color: var(--ink-3);
}
.auth-lang__link {
  color: var(--ink-3);
  text-decoration: none;
  padding: 2px 4px;
  border-radius: 4px;
  letter-spacing: 0.04em;
  transition: color var(--t-fast);
}
.auth-lang__link:hover { color: var(--ink-1); }
.auth-lang__link.is-active { color: var(--brand-orange); font-weight: 600; }
.auth-lang__sep { color: var(--ink-4); font-weight: 400; }

.auth-icon-btn {
  width: 40px;
  height: 40px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  box-shadow: var(--sh-sm);
  transition: transform var(--t-fast), border-color var(--t-fast),
              color var(--t-fast), background-color var(--t-fast);
}
.auth-icon-btn:hover {
  transform: translateY(-1px);
  border-color: var(--brand-orange);
  color: var(--brand-orange);
}
.auth-icon-btn:focus-visible {
  outline: none;
  border-color: var(--brand-orange);
  box-shadow: var(--sh-sm), 0 0 0 3px oklch(72% 0.18 49 / 0.30);
}
.auth-icon-btn svg { width: 18px; height: 18px; }

/* WhatsApp variant — green tint on hover */
.auth-icon-btn--help:hover {
  border-color: oklch(60% 0.16 145);
  color: oklch(55% 0.16 145);
}
.auth-icon-btn--help:focus-visible {
  border-color: oklch(60% 0.16 145);
  box-shadow: var(--sh-sm), 0 0 0 3px oklch(60% 0.16 145 / 0.30);
}

/* Theme toggle uses the icon-btn chrome + adds icon-swap behavior */
.auth-theme-toggle__icon-sun { display: none; }
.auth-theme-toggle__icon-moon { display: block; }
[data-theme="dark"] .auth-theme-toggle__icon-sun { display: block; }
[data-theme="dark"] .auth-theme-toggle__icon-moon { display: none; }

/* -------------------------------------------------------------------------
   Title + subtitle
   ------------------------------------------------------------------------- */
.auth-title {
  margin: 0 0 var(--s-2);
  font-size: clamp(1.75rem, 1.4rem + 1.5vw, 2.125rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.15;
  color: var(--ink-1);
}
.auth-subtitle {
  margin: 0 0 var(--s-6);
  color: var(--ink-3);
  font-size: 0.9375rem;
  line-height: 1.55;
  max-width: 44ch;
}

/* Section header */
.auth-section-h {
  margin: var(--s-6) 0 var(--s-3);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.auth-section-h:first-child { margin-block-start: 0; }

/* -------------------------------------------------------------------------
   Form primitives
   ------------------------------------------------------------------------- */
.auth-form-row { margin-block-end: var(--s-4); }
.auth-form-grid { display: grid; gap: var(--s-4); grid-template-columns: 1fr; }
@media (min-width: 560px) {
  .auth-form-grid--2 { grid-template-columns: 1fr 1fr; }
}

.auth-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-2);
  margin-block-end: 6px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--ink-2);
}
.auth-label__req { color: var(--brand-orange); font-weight: 600; }
.auth-label__hint { font-weight: 400; color: var(--ink-4); }

.auth-input,
.auth-select,
.auth-textarea {
  width: 100%;
  height: 52px;
  padding-inline: var(--s-4);
  background: var(--surface-2);
  color: var(--ink-1);
  border: 1.5px solid var(--line-2);
  border-radius: var(--r-2);
  font-size: 0.9375rem;
  font-family: inherit;
  transition: border-color var(--t-fast), box-shadow var(--t-fast),
              background-color var(--t-fast);
  appearance: none;
  -webkit-appearance: none;
}
.auth-textarea {
  height: auto;
  min-height: 96px;
  padding-block: var(--s-3);
  line-height: 1.5;
  resize: vertical;
}
.auth-input::placeholder,
.auth-textarea::placeholder { color: var(--ink-4); }
.auth-input:hover,
.auth-select:hover,
.auth-textarea:hover {
  border-color: var(--line-3);
  background: var(--surface);
}
.auth-input:focus,
.auth-select:focus,
.auth-textarea:focus {
  outline: none;
  background: var(--surface);
  border-color: var(--brand-orange);
  box-shadow: 0 0 0 3px oklch(72% 0.18 49 / 0.20);
}
.auth-input[readonly] {
  background: var(--surface-2);
  color: var(--ink-3);
  cursor: not-allowed;
}
.auth-input[disabled],
.auth-select[disabled] { opacity: 0.6; cursor: not-allowed; }

.auth-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%23364759' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round' d='M1 1.5l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--s-4) center;
  padding-inline-end: calc(var(--s-4) + 16px);
}
:root[dir="rtl"] .auth-select {
  background-position: left var(--s-4) center;
  padding-inline-end: var(--s-4);
  padding-inline-start: calc(var(--s-4) + 16px);
}
[data-theme="dark"] .auth-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%23a8b3bf' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round' d='M1 1.5l5 5 5-5'/%3E%3C/svg%3E");
}

.auth-input.is-invalid,
.auth-select.is-invalid,
.auth-textarea.is-invalid {
  border-color: var(--c-error);
  background: var(--c-error-bg);
}
.auth-input.is-invalid:focus,
.auth-select.is-invalid:focus,
.auth-textarea.is-invalid:focus {
  box-shadow: 0 0 0 3px oklch(54% 0.22 25 / 0.22);
}

.auth-error {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin-block-start: 6px;
  font-size: 0.8125rem;
  color: var(--c-error);
}
.auth-error::before {
  content: "";
  flex-shrink: 0;
  width: 14px;
  height: 14px;
  margin-block-start: 2px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23c44a2a' stroke-width='1.6'%3E%3Ccircle cx='8' cy='8' r='6.5'/%3E%3Cpath d='M8 4.5v4M8 11v.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
}

.auth-input-group { position: relative; }
.auth-input-group .auth-input { padding-inline-end: 48px; }
:root[dir="rtl"] .auth-input-group .auth-input {
  padding-inline-end: var(--s-4);
  padding-inline-start: 48px;
}
.auth-input-group__btn {
  position: absolute;
  top: 50%;
  inset-inline-end: 6px;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 0;
  border-radius: var(--r-1);
  color: var(--ink-3);
  transition: color var(--t-fast), background-color var(--t-fast);
}
.auth-input-group__btn:hover {
  color: var(--brand-orange);
  background: var(--brand-orange-soft);
}
.auth-input-group__btn:focus-visible {
  outline: none;
  color: var(--brand-orange);
  box-shadow: 0 0 0 2px oklch(72% 0.18 49 / 0.30);
}
[data-theme="dark"] .auth-input-group__btn:hover { background: oklch(28% 0.05 49); }
.auth-input-group__btn svg { width: 18px; height: 18px; }
.auth-input-group__btn[data-show="true"] .auth-eye-on { display: none; }
.auth-input-group__btn[data-show="true"] .auth-eye-off { display: block; }
.auth-input-group__btn .auth-eye-off { display: none; }

/* Checkbox */
.auth-check {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--ink-2);
  user-select: none;
}
.auth-check input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--line-3);
  border-radius: 4px;
  background: var(--surface);
  display: inline-grid;
  place-items: center;
  transition: border-color var(--t-fast), background-color var(--t-fast);
  flex-shrink: 0;
}
.auth-check input[type="checkbox"]:hover { border-color: var(--brand-orange); }
.auth-check input[type="checkbox"]:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px oklch(72% 0.18 49 / 0.22);
}
.auth-check input[type="checkbox"]:checked {
  background: var(--brand-orange);
  border-color: var(--brand-orange);
}
.auth-check input[type="checkbox"]:checked::before {
  content: "";
  width: 10px;
  height: 10px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='white' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 8.5l3 3 7-7'/%3E%3C/svg%3E");
  background-size: contain;
}

/* Radio */
.auth-radio {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--ink-2);
  user-select: none;
  margin-inline-end: var(--s-4);
}
.auth-radio input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--line-3);
  border-radius: 50%;
  background: var(--surface);
  display: inline-grid;
  place-items: center;
  transition: border-color var(--t-fast);
  flex-shrink: 0;
}
.auth-radio input[type="radio"]:hover { border-color: var(--brand-orange); }
.auth-radio input[type="radio"]:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px oklch(72% 0.18 49 / 0.22);
}
.auth-radio input[type="radio"]:checked { border-color: var(--brand-orange); }
.auth-radio input[type="radio"]:checked::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--brand-orange);
}

/* -------------------------------------------------------------------------
   Buttons — tactile orange
   ------------------------------------------------------------------------- */
.auth-btn {
  --btn-bg: var(--brand-orange);
  --btn-bg-hover: var(--brand-orange-deep);
  --btn-fg: var(--brand-navy);

  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  height: 52px;
  padding-inline: var(--s-5);
  background: var(--btn-bg);
  color: var(--btn-fg);
  border: 1.5px solid var(--btn-bg);
  border-radius: var(--r-2);
  font-weight: 600;
  font-size: 0.9375rem;
  letter-spacing: 0.01em;
  text-decoration: none;
  cursor: pointer;
  transition: transform var(--t-fast), background-color var(--t-fast),
              border-color var(--t-fast), box-shadow var(--t-med);
  /* Inner top highlight gives tactile depth */
  box-shadow:
    inset 0 1px 0 oklch(95% 0.05 60 / 0.45),
    0 1px 2px oklch(58% 0.18 49 / 0.30),
    0 4px 12px oklch(58% 0.18 49 / 0.15);
  position: relative;
}
.auth-btn:hover {
  background: var(--btn-bg-hover);
  border-color: var(--btn-bg-hover);
  transform: translateY(-1px);
  box-shadow:
    inset 0 1px 0 oklch(95% 0.05 60 / 0.50),
    0 2px 4px oklch(58% 0.18 49 / 0.34),
    0 8px 24px oklch(58% 0.18 49 / 0.20);
}
.auth-btn:active {
  transform: translateY(0);
  box-shadow:
    inset 0 1px 1px oklch(50% 0.18 49 / 0.20),
    0 1px 2px oklch(58% 0.18 49 / 0.30);
}
.auth-btn:focus-visible {
  outline: none;
  box-shadow:
    inset 0 1px 0 oklch(95% 0.05 60 / 0.45),
    0 0 0 4px oklch(72% 0.18 49 / 0.32);
}
.auth-btn[disabled],
.auth-btn[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.6;
  transform: none;
}
.auth-btn--primary { width: 100%; }

.auth-btn__chevron {
  width: 14px; height: 14px;
  transition: transform var(--t-fast);
}
.auth-btn:hover .auth-btn__chevron { transform: translateX(2px); }
:root[dir="rtl"] .auth-btn:hover .auth-btn__chevron { transform: translateX(-2px) scaleX(-1); }
:root[dir="rtl"] .auth-btn__chevron { transform: scaleX(-1); }

.auth-btn[data-busy="true"] { cursor: progress; pointer-events: none; }
.auth-btn[data-busy="true"] .auth-btn__label { opacity: 0.6; }
.auth-btn[data-busy="true"] .auth-btn__chevron { display: none; }
.auth-btn[data-busy="true"]::after {
  content: "";
  width: 16px; height: 16px;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-top-color: transparent;
  animation: auth-spin 0.7s linear infinite;
}
@keyframes auth-spin { to { transform: rotate(360deg); } }

/* Ghost / secondary */
.auth-btn--ghost {
  background: transparent;
  border-color: var(--line-2);
  color: var(--ink-2);
  box-shadow: none;
}
.auth-btn--ghost:hover {
  background: var(--surface-2);
  border-color: var(--line-3);
  color: var(--ink-1);
  box-shadow: var(--sh-sm);
}

/* -------------------------------------------------------------------------
   Form actions / links / prompts
   ------------------------------------------------------------------------- */
.auth-form-actions {
  margin-block-start: var(--s-5);
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  align-items: stretch;
}
@media (min-width: 480px) {
  .auth-form-actions {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}
.auth-link {
  color: var(--ink-2);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  border-block-end: 1px solid transparent;
  transition: color var(--t-fast), border-color var(--t-fast);
}
.auth-link:hover {
  color: var(--brand-orange);
  border-block-end-color: currentColor;
}
.auth-link--muted { color: var(--ink-3); }

.auth-prompt {
  margin: var(--s-5) 0 0;
  text-align: center;
  font-size: 0.875rem;
  color: var(--ink-3);
}
.auth-prompt .auth-link { font-weight: 600; }

/* -------------------------------------------------------------------------
   Banners
   ------------------------------------------------------------------------- */
.auth-banner {
  display: flex;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  margin-block-end: var(--s-4);
  border: 1px solid var(--line-2);
  background: var(--surface-2);
  border-radius: var(--r-2);
  font-size: 0.875rem;
  color: var(--ink-2);
}
.auth-banner__icon { flex-shrink: 0; width: 18px; height: 18px; margin-block-start: 1px; }
.auth-banner__msg { flex: 1; }
.auth-banner--info {
  background: var(--c-info-bg);
  border-color: color-mix(in oklab, var(--c-info), transparent 70%);
  color: oklch(35% 0.10 230);
}
.auth-banner--success {
  background: var(--c-success-bg);
  border-color: color-mix(in oklab, var(--c-success), transparent 70%);
  color: oklch(35% 0.13 145);
}
.auth-banner--warning {
  background: var(--c-warning-bg);
  border-color: color-mix(in oklab, var(--c-warning), transparent 60%);
  color: oklch(40% 0.14 75);
}
.auth-banner--error {
  background: var(--c-error-bg);
  border-color: color-mix(in oklab, var(--c-error), transparent 60%);
  color: var(--c-error);
}
[data-theme="dark"] .auth-banner--info { color: oklch(82% 0.08 230); }
[data-theme="dark"] .auth-banner--success { color: oklch(82% 0.10 145); }
[data-theme="dark"] .auth-banner--warning { color: oklch(86% 0.10 75); }
[data-theme="dark"] .auth-banner--error { color: oklch(82% 0.16 25); }

/* -------------------------------------------------------------------------
   Toast region
   ------------------------------------------------------------------------- */
.auth-toast-region {
  position: fixed;
  top: var(--s-4);
  inset-inline-end: var(--s-4);
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  pointer-events: none;
  max-width: calc(100vw - var(--s-7));
}
.auth-toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  background: var(--surface);
  color: var(--ink-1);
  border: 1px solid var(--line-2);
  border-radius: var(--r-2);
  box-shadow: var(--card-shadow);
  font-size: 0.875rem;
  min-width: 240px;
  max-width: 380px;
  animation: auth-toast-in 220ms cubic-bezier(0.2, 0, 0.1, 1);
}
.auth-toast[data-leaving] {
  animation: auth-toast-out 200ms cubic-bezier(0.4, 0, 1, 1) forwards;
}
@keyframes auth-toast-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes auth-toast-out { to { opacity: 0; transform: translateY(-8px); } }
.auth-toast__icon {
  width: 24px; height: 24px;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  font-weight: 700;
  font-size: 0.875rem;
  flex-shrink: 0;
}
.auth-toast--success .auth-toast__icon { background: var(--c-success); color: white; }
.auth-toast--warning .auth-toast__icon { background: var(--c-warning); color: white; }
.auth-toast--error   .auth-toast__icon { background: var(--c-error);   color: white; }
.auth-toast__msg { flex: 1; line-height: 1.4; }

/* -------------------------------------------------------------------------
   Helpers
   ------------------------------------------------------------------------- */
.auth-hidden { display: none !important; }
.auth-sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.auth-stack { display: flex; flex-direction: column; gap: var(--s-4); }
.auth-input--num { font-variant-numeric: tabular-nums; letter-spacing: 0.02em; }

/* -------------------------------------------------------------------------
   Segmented PIN
   ------------------------------------------------------------------------- */
.auth-pin {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-3);
  margin-block: var(--s-3) var(--s-2);
}
.auth-pin__group { display: inline-flex; gap: var(--s-3); }
.auth-pin__cell {
  width: 64px;
  height: 72px;
  padding: 0;
  text-align: center;
  font-size: 1.625rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  background: var(--surface-2);
  border: 1.5px solid var(--line-2);
  border-radius: var(--r-2);
  color: var(--ink-1);
  font-family: inherit;
  transition: border-color var(--t-fast), box-shadow var(--t-fast),
              background-color var(--t-fast), transform var(--t-fast);
  appearance: none;
  -webkit-appearance: none;
}
.auth-pin__cell--obscured {
  -webkit-text-security: disc;
  -moz-text-security: disc;
  text-security: disc;
  font-size: 2rem;
  letter-spacing: 0;
}
.auth-pin__cell::-webkit-outer-spin-button,
.auth-pin__cell::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.auth-pin__cell:hover { border-color: var(--line-3); background: var(--surface); }
.auth-pin__cell:focus {
  outline: none;
  background: var(--surface);
  border-color: var(--brand-orange);
  box-shadow: 0 0 0 3px oklch(72% 0.18 49 / 0.22);
  transform: translateY(-1px);
}
.auth-pin__cell[data-filled="true"] {
  border-color: var(--brand-orange);
  background: color-mix(in oklab, var(--brand-orange-soft), var(--surface) 50%);
}
[data-theme="dark"] .auth-pin__cell[data-filled="true"] { background: oklch(28% 0.05 49); }
.auth-pin__cell.is-invalid { border-color: var(--c-error); background: var(--c-error-bg); }

@media (max-width: 480px) {
  .auth-pin__cell {
    width: clamp(52px, 14vw, 60px);
    height: clamp(60px, 16vw, 68px);
    font-size: 1.5rem;
  }
  .auth-pin { gap: var(--s-2); }
  .auth-pin__group { gap: var(--s-2); }
}

.auth-pin__toggle {
  width: 44px; height: 44px;
  border: 1.5px solid var(--line-2);
  background: var(--surface);
  border-radius: var(--r-2);
  color: var(--ink-3);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color var(--t-fast), border-color var(--t-fast),
              background-color var(--t-fast);
}
.auth-pin__toggle:hover {
  color: var(--brand-orange);
  border-color: var(--brand-orange);
  background: var(--brand-orange-soft);
}
[data-theme="dark"] .auth-pin__toggle:hover { background: oklch(28% 0.05 49); }
.auth-pin__toggle:focus-visible {
  outline: none;
  color: var(--brand-orange);
  border-color: var(--brand-orange);
  box-shadow: 0 0 0 3px oklch(72% 0.18 49 / 0.22);
}
.auth-pin__toggle svg { width: 18px; height: 18px; }
.auth-pin__toggle[data-show="true"] .auth-eye-on { display: none; }
.auth-pin__toggle[data-show="true"] .auth-eye-off { display: block; }
.auth-pin__toggle .auth-eye-off { display: none; }

/* -------------------------------------------------------------------------
   Reduced motion
   ------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
