/* ── Design Tokens ── */
:root {
  --surface:      #ffffff;
  --surface-2:    #f5f7fa;
  --surface-3:    #edf0f5;
  --border:       #e2e8f0;
  --border-strong:#cbd5e1;
  --text:         #0f172a;
  --text-muted:   #64748b;
  --text-soft:    #94a3b8;
  --accent:       #059669;
  --accent-soft:  #d1fae5;
  --accent-strong:#047857;
  --accent-ink:   #ffffff;
  --danger:       #dc2626;
  --danger-soft:  #fee2e2;
  --shadow-card:  0 4px 6px -1px rgba(0,0,0,.07), 0 2px 4px -2px rgba(0,0,0,.05);
  --shadow-lg:    0 20px 40px -8px rgba(0,0,0,.18), 0 8px 16px -4px rgba(0,0,0,.10);
  --radius-xl:    20px;
  --font:         'Cairo', system-ui, sans-serif;
}

*,*::before,*::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

/* ── Modern mesh background ── */
.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  position: relative;
  overflow: hidden;
  background-color: #0a1628;
  background-image:
    radial-gradient(ellipse 90% 70% at -5%  -5%,  rgba(5,150,105,.55)  0%, transparent 55%),
    radial-gradient(ellipse 70% 60% at 105% 105%, rgba(16,185,129,.40) 0%, transparent 55%),
    radial-gradient(ellipse 50% 50% at 60%  20%,  rgba(6,182,212,.20)  0%, transparent 50%),
    radial-gradient(ellipse 60% 40% at 20%  90%,  rgba(99,102,241,.18) 0%, transparent 50%);
}

/* dot-grid overlay */
.auth-shell::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, rgba(255,255,255,.12) 1px, transparent 1px);
  background-size: 28px 28px;
  pointer-events: none;
  z-index: 0;
}

.auth-shell > * { position: relative; z-index: 1; }

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

/* ── Header ── */
.auth-head {
  padding: 28px 28px 20px;
  border-bottom: 1px solid var(--border);
  text-align: center;
}

.auth-logo {
  width: 48px; height: 48px;
  border-radius: 12px;
  background: var(--accent);
  display: grid;
  place-items: center;
  margin: 0 auto 14px;
  color: var(--accent-ink);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.auth-head h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
}

.auth-head p {
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--text-muted);
}

/* ── Body ── */
.auth-body { padding: 24px 28px 28px; }

/* ── Field label ── */
.field-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 7px;
}

/* ── Input field ── */
.field {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  font-size: 13px;
  color: var(--text);
  transition: border-color .12s, box-shadow .12s;
  margin-bottom: 14px;
}

.field:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.field .fi {
  color: var(--text-soft);
  font-size: 13px;
  flex-shrink: 0;
  width: 14px;
  text-align: center;
}

.field input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  color: inherit;
  font-size: 13px;
  font-family: inherit;
  min-width: 0;
}

.field input::placeholder { color: var(--text-soft); }

/* ── Row ── */
.auth-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

/* ── Switch toggle ── */
.switch-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  font-size: 13px;
  color: var(--text-muted);
}

.switch {
  position: relative;
  width: 36px; height: 20px;
  background: var(--surface-3);
  border-radius: 999px;
  flex-shrink: 0;
  transition: background .15s;
  border: 1px solid var(--border-strong);
  cursor: pointer;
}

.switch::after {
  content: "";
  position: absolute;
  top: 2px;
  inset-inline-start: 2px;
  width: 14px; height: 14px;
  background: white;
  border-radius: 50%;
  box-shadow: 0 1px 2px rgba(0,0,0,.12);
  transition: transform .15s;
}

.switch.on { background: var(--accent); border-color: var(--accent); }
.switch.on::after { transform: translateX(16px); }
[dir="rtl"] .switch.on::after { transform: translateX(-16px); }

.switch input { display: none; }

/* ── Forgot link ── */
.forgot-link {
  font-size: 13px;
  font-weight: 500;
  color: var(--accent);
  text-decoration: none;
  transition: color .12s;
}
.forgot-link:hover { color: var(--accent-strong); }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background .12s, border-color .12s, transform .08s;
  text-decoration: none;
}

.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.btn-primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }

.btn-block { width: 100%; padding: 11px; }

/* ── Error alert ── */
.auth-error {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--danger-soft);
  color: var(--danger);
  border: 1px solid rgba(220,38,38,.25);
  border-radius: 10px;
  margin-bottom: 18px;
  font-size: 13px;
  font-weight: 500;
}

/* ── Footer ── */
.auth-footer {
  text-align: center;
  margin-top: 18px;
  font-size: 11.5px;
  color: rgba(255,255,255,.45);
}
