/* ── 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;
}

/* ── Photo background ── */
.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  position: relative;
  overflow: hidden;
  background-color: #0a1628;
}

.auth-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
}

.auth-bg-overlay {
  position: absolute;
  inset: 0;
  background: rgba(8, 20, 18, .62);
  pointer-events: none;
  z-index: 0;
}

.auth-shell > .auth-brand,
.auth-shell > .auth-card,
.auth-shell > .auth-footer { position: relative; z-index: 1; }

.d-none { display: none !important; }

/* ── Brand row ── */
.auth-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 22px;
}
.auth-brand-logo {
  width: 38px; height: 38px;
  border-radius: 8px;
  object-fit: cover;
}
.auth-brand-mark {
  width: 38px; height: 38px;
  border-radius: 8px;
  background: var(--surface);
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 800;
  color: var(--accent-strong);
}
.auth-brand-name {
  font-size: 14.5px;
  font-weight: 700;
  color: #fff;
}

.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;
}

.field-label-row { margin-bottom: 7px; }
.field-label-row .field-label { margin-bottom: 0; }

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

.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;
}

/* ── Help line ── */
.auth-help {
  text-align: center;
  margin-top: 16px;
  font-size: 12.5px;
  color: var(--text-muted);
}
.auth-help a,
.auth-help-static { font-weight: 700; margin-inline-start: 4px; }
.auth-help-static { color: var(--text); }

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

/* ── Fit within short viewports without page scroll ── */
@media (max-height: 760px) {
  .auth-shell { padding: 14px; }
  .auth-brand { margin-bottom: 12px; }
  .auth-head { padding: 18px 28px 14px; }
  .auth-body { padding: 16px 28px 20px; }
  .field { margin-bottom: 10px; }
  .field-label { margin-bottom: 5px; }
  .auth-row,
  .field-label-row { margin-bottom: 5px; }
  .switch-wrap { margin-bottom: 12px; }
  .auth-help { margin-top: 10px; }
  .auth-footer { margin-top: 10px; }
}
@media (max-height: 620px) {
  .auth-brand,
  .auth-footer { display: none; }
}
