/* NMO Auth — polished card layout, two-column on desktop, single-column on mobile.
   Default language: Arabic. RTL-aware. Best-practice UX. */
:root {
  --ink: #0f2a23;
  --ink-soft: #1f3a33;
  --muted: #5f706b;
  --line: #d7e8e2;
  --line-strong: #bcd7cd;
  --surface: #ffffff;
  --soft: #f2faf7;
  --brand: #36c58d;
  --brand-dark: #08724d;
  --brand-darker: #0a5b3d;
  --warn: #9f6200;
  --danger: #b4233f;
  --success: #08724d;
  --shadow-sm: 0 4px 14px rgba(16, 35, 31, 0.06);
  --shadow: 0 22px 60px rgba(16, 35, 31, 0.10);
  --radius: 18px;
  --radius-sm: 12px;
  font-family:
    "Tajawal",
    "Noto Kufi Arabic",
    "Noto Sans Arabic",
    "Segoe UI",
    Tahoma,
    Arial,
    sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  color: var(--ink);
  background: #f6fbf8;
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
  min-height: 100%;
}

body {
  background:
    radial-gradient(1100px 540px at 8% -8%, rgba(54, 197, 141, 0.20), transparent 60%),
    radial-gradient(900px 600px at 110% 110%, rgba(8, 114, 77, 0.18), transparent 60%),
    #f6fbf8;
}

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

a { color: var(--brand-dark); text-decoration: none; }
a:hover, a:focus-visible { text-decoration: underline; }

/* Layout */
.auth-gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding:
    calc(24px + env(safe-area-inset-top, 0px))
    16px
    calc(24px + env(safe-area-inset-bottom, 0px));
}

.auth-shell {
  width: min(1040px, 100%);
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  align-items: stretch;
}

@media (min-width: 880px) {
  .auth-shell {
    grid-template-columns: 1fr 1.05fr;
    gap: 0;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--surface);
    box-shadow: var(--shadow);
  }
}

/* Hero (desktop only) */
.auth-hero {
  display: none;
  position: relative;
  padding: 36px 32px;
  color: #eafff5;
  background:
    radial-gradient(640px 360px at 0% 0%, rgba(54, 197, 141, 0.35), transparent 70%),
    radial-gradient(540px 320px at 100% 100%, rgba(54, 197, 141, 0.20), transparent 70%),
    linear-gradient(165deg, #0c2a23 0%, #114a3a 100%);
  flex-direction: column;
  justify-content: space-between;
  gap: 24px;
  min-height: 100%;
  overflow: hidden;
}

@media (min-width: 880px) {
  .auth-hero { display: flex; }
}

.auth-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(135deg, rgba(255,255,255,0.04) 0 1px, transparent 1px 18px);
  pointer-events: none;
}

.auth-hero-top {
  display: flex;
  align-items: center;
  gap: 14px;
  position: relative;
  z-index: 1;
}

.auth-hero-top img {
  width: 64px;
  height: 64px;
  border-radius: 14px;
  background: #ffffff;
  padding: 6px;
  object-fit: contain;
}

.auth-hero-top .eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: #a5e3c8;
  font-size: 11px;
  font-weight: 800;
}
.auth-hero-top h2 {
  margin: 4px 0 0;
  font-size: 20px;
  color: #fff;
  font-weight: 800;
}

.auth-hero-body {
  position: relative;
  z-index: 1;
}

.auth-hero-body h1 {
  font-size: 34px;
  line-height: 1.2;
  margin: 0 0 14px;
  color: #ffffff;
  letter-spacing: -0.01em;
  font-weight: 800;
}

.auth-hero-body p {
  color: #cfeede;
  line-height: 1.7;
  margin: 0 0 18px;
  font-size: 15px;
  max-width: 38ch;
}

.auth-hero-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 10px;
  position: relative;
  z-index: 1;
}
.auth-hero-list li {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  color: #cfeede;
  font-size: 14px;
  line-height: 1.55;
}
.auth-hero-list li::before {
  content: "";
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 0 0 4px rgba(54, 197, 141, 0.20);
  margin-top: 2px;
  position: relative;
}

.auth-hero-foot {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 12px;
  color: #b9e0cc;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  padding-top: 14px;
  line-height: 1.5;
}
.auth-hero-foot .lock {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: rgba(54, 197, 141, 0.18);
  color: var(--brand);
  display: grid;
  place-items: center;
  font-size: 11px;
  flex: 0 0 22px;
}

/* Card */
.auth-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 22px 18px;
  display: grid;
  gap: 16px;
  width: 100%;
  align-self: stretch;
}

@media (min-width: 880px) {
  .auth-card {
    padding: 38px 36px;
  }
}

.auth-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.brand-mini {
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand-mini img {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: #fff;
  padding: 4px;
  object-fit: contain;
}
.brand-mini strong {
  font-size: 14px;
  color: var(--ink);
}

.lang-toggle {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px;
  background: var(--soft);
}

.lang-btn {
  border: 0;
  background: transparent;
  padding: 6px 12px;
  border-radius: 999px;
  font-weight: 700;
  cursor: pointer;
  color: var(--muted);
  font-size: 13px;
}

.lang-btn.is-active {
  background: var(--brand-dark);
  color: #fff;
  box-shadow: 0 6px 14px rgba(8, 114, 77, 0.18);
}

.auth-card h1 {
  font-size: 26px;
  line-height: 1.25;
  margin: 4px 0 6px;
  letter-spacing: -0.01em;
}
.auth-card h2 {
  font-size: 17px;
  margin: 0;
  letter-spacing: -0.005em;
}
.auth-card .lead {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--brand-dark);
  font-size: 11px;
  font-weight: 800;
  margin: 0;
}

.muted { color: var(--muted); }
.muted.mini { font-size: 12px; }

.status {
  display: flex;
  gap: 10px;
  align-items: center;
  border-radius: 12px;
  padding: 12px 14px;
  font-weight: 700;
  font-size: 14px;
  margin: 0;
  line-height: 1.4;
}
.status::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex: 0 0 10px;
}
.status.success {
  background: #e8f8f1;
  color: var(--success);
  border: 1px solid #b6e6cf;
}
.status.success::before { background: var(--success); }
.status.danger {
  background: #fdecef;
  color: var(--danger);
  border: 1px solid #f3c0c8;
}
.status.danger::before { background: var(--danger); }
.status.warn {
  background: #fff4e0;
  color: var(--warn);
  border: 1px solid #f3d8a3;
}
.status.warn::before { background: var(--warn); }

.panel {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  padding: 18px;
}

.row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}
.row.space-between { justify-content: space-between; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 18px;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  font-weight: 800;
  cursor: pointer;
  text-decoration: none;
  transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease, border-color 120ms ease;
}
.btn:hover, .btn:focus-visible {
  border-color: var(--brand);
  outline: none;
  box-shadow: var(--shadow-sm);
}
.btn:active { transform: translateY(1px); }
.btn.primary {
  background: linear-gradient(180deg, #0a6a47, #08724d);
  border-color: var(--brand-dark);
  color: #fff;
}
.btn.primary:hover, .btn.primary:focus-visible {
  background: linear-gradient(180deg, #0a6a47, #0a5b3d);
  border-color: #0a5b3d;
}
.btn.ghost { background: transparent; }

.google-wrap {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  min-height: 46px;
  margin-top: 4px;
}

/* Tiers */
.tier-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
@media (min-width: 560px) {
  .tier-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.tier-option {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  background: #ffffff;
  padding: 14px;
  cursor: pointer;
  transition: border-color 140ms ease, box-shadow 140ms ease, background 140ms ease, transform 140ms ease;
  position: relative;
}
.tier-option:hover {
  border-color: var(--brand);
  background: #fbfefd;
}
.tier-option input {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: var(--brand-dark);
}
.tier-option span { display: grid; gap: 4px; min-width: 0; }
.tier-option strong {
  color: var(--brand-dark);
  font-weight: 800;
  font-size: 16px;
}
.tier-option em {
  font-style: normal;
  color: var(--brand-darker);
  font-size: 13px;
  font-weight: 700;
  background: #e8f8f1;
  border-radius: 999px;
  padding: 2px 8px;
  align-self: start;
  display: inline-block;
  width: max-content;
}
.tier-option small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}
.tier-option:has(input:checked) {
  border-color: var(--brand);
  background: #f1faf5;
  box-shadow: 0 0 0 4px rgba(54, 197, 141, 0.16);
}
.tier-option:has(input:checked)::after {
  content: "✓";
  position: absolute;
  top: 10px;
  inset-inline-end: 12px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 800;
}

/* Terms */
.terms-block {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fbfefd;
  padding: 14px;
  margin: 0;
  display: grid;
  gap: 10px;
}
.terms-block legend {
  padding: 0 6px;
  font-weight: 800;
  color: var(--brand-dark);
  font-size: 15px;
}
.terms-help {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}
.terms-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}
@media (min-width: 560px) {
  .terms-grid { grid-template-columns: 1fr 1fr; }
}
.terms-check {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ffffff;
  padding: 10px 12px;
  cursor: pointer;
  transition: border-color 120ms ease, background 120ms ease;
}
.terms-check:hover { border-color: var(--brand); }
.terms-check input {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: var(--brand-dark);
}
.terms-check span {
  color: var(--ink);
  line-height: 1.55;
  font-size: 13.5px;
}
.terms-check:has(input:checked) {
  border-color: var(--brand);
  background: #f1faf5;
}
.terms-progress {
  height: 6px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
  margin-top: 4px;
}
.terms-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--brand) 0%, var(--brand-dark) 100%);
  width: 0%;
  transition: width 200ms ease;
}
.terms-progress-label {
  font-size: 12px;
  color: var(--muted);
  margin: 0;
}

/* Onboarding */
.onboarding-box {
  border: 1px solid rgba(54, 197, 141, 0.36);
  border-radius: 14px;
  background: linear-gradient(180deg, #e8f8f1, #d8f1e3);
  padding: 16px;
  display: grid;
  gap: 10px;
}
.onboarding-box h2 { margin: 0; font-size: 16px; color: var(--brand-darker); }
.onboarding-box ol {
  margin: 0;
  padding-inline-start: 20px;
  color: var(--ink);
  line-height: 1.7;
  font-size: 14px;
}

/* Signed-in card */
.avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #eafff5;
}
.avatar-fallback {
  display: grid;
  place-items: center;
  background: var(--brand-dark);
  color: #fff;
  font-weight: 800;
  font-size: 22px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
@media (min-width: 520px) {
  .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
.card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  background: var(--soft);
  display: grid;
  gap: 4px;
}
.card h3 { margin: 0; font-size: 15px; }

/* Toast */
.toast {
  position: fixed;
  inset-inline-start: 16px;
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  background: var(--ink);
  color: #fff;
  padding: 10px 14px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 13px;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 160ms ease, transform 160ms ease;
  pointer-events: none;
  z-index: 50;
}
.toast.is-show { opacity: 1; transform: translateY(0); }

/* Auth-required banner shown on dashboard when Google login fails */
.auth-required-banner {
  position: fixed;
  inset-inline-start: 12px;
  inset-inline-end: 12px;
  top: calc(12px + env(safe-area-inset-top, 0px));
  z-index: 60;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 12px;
  background: #fff4e0;
  color: #5a3a00;
  border: 1px solid #f3d8a3;
  box-shadow: var(--shadow);
  font-size: 14px;
}
.auth-required-banner .btn {
  min-height: 36px;
  padding: 0 12px;
  font-size: 13px;
}

@media (max-width: 480px) {
  .auth-card { padding: 20px 16px; }
  .auth-card h1 { font-size: 24px; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .row .btn { width: 100%; }
}
