/* ==========================================================================
   MetroFood OS — Auth Overlay (Tier 2a)
   Full-screen login / signup / verify / create-org card.
   ========================================================================== */

/* While the auth overlay is up, hide the rest of the page so the user
   never sees a flash of the app underneath. */
body.auth-pending > *:not(#authOverlay) {
  visibility: hidden;
}

#authOverlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: linear-gradient(135deg, var(--g3) 0%, var(--g2) 100%);
  align-items: center;
  justify-content: center;
  padding: 20px;
  font-family: 'Instrument Sans', sans-serif;
}
#authOverlay.open { display: flex; }

.auth-card {
  background: var(--cream);
  border-radius: 16px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 20px 60px rgba(0,0,0,.4);
  overflow: hidden;
}

.auth-header {
  background: var(--g);
  color: var(--cream);
  padding: 28px 32px 24px;
  text-align: center;
}
.auth-brand {
  font-family: 'DM Serif Display', serif;
  font-size: 28px;
  letter-spacing: .02em;
  margin: 0;
}
.auth-tagline {
  font-size: 11px;
  color: var(--gold);
  letter-spacing: .14em;
  text-transform: uppercase;
  margin: 8px 0 0;
}

.auth-body { padding: 28px 32px 32px; }

.auth-view-title {
  font-family: 'DM Serif Display', serif;
  font-size: 22px;
  color: var(--g3);
  margin: 0 0 6px;
}
.auth-view-subtitle {
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 18px;
  line-height: 1.45;
}

.auth-form { display: flex; flex-direction: column; gap: 12px; }
.auth-form label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--ink2);
  font-weight: 600;
  margin-bottom: 4px;
  display: block;
}
.auth-form input[type="email"],
.auth-form input[type="password"],
.auth-form input[type="text"] {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  background: white;
  transition: border-color .15s, box-shadow .15s;
  box-sizing: border-box;
}
.auth-form input:focus {
  outline: none;
  border-color: var(--g);
  box-shadow: 0 0 0 3px rgba(27,94,53,.12);
}
.auth-form button.auth-submit {
  background: var(--g);
  color: white;
  border: none;
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 8px;
  font-family: inherit;
  transition: background .15s, transform .05s;
}
.auth-form button.auth-submit:hover  { background: var(--g2); }
.auth-form button.auth-submit:active { transform: translateY(1px); }
.auth-form button:disabled { opacity: .55; cursor: wait; }

.auth-switch {
  text-align: center;
  margin-top: 18px;
  font-size: 13px;
  color: var(--muted);
}
.auth-switch button {
  background: none;
  border: none;
  color: var(--g);
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  font-size: inherit;
  font-family: inherit;
  text-decoration: underline;
}
.auth-switch button:hover { color: var(--g2); }

#authError {
  display: none;
  background: var(--redl);
  color: var(--red);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-top: 12px;
  border: 1px solid #f5c6c6;
}

.auth-verify-icon {
  font-size: 48px;
  text-align: center;
  margin-bottom: 12px;
}
.auth-verify-text {
  text-align: center;
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink2);
}
.auth-verify-text strong { color: var(--g2); word-break: break-all; }

.auth-help-note {
  margin-top: 20px;
  padding: 12px 14px;
  background: var(--gll);
  border: 1px solid var(--gl);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--g3);
  line-height: 1.4;
}

/* ── Topbar user chip (shown after login) ────────────────────────────── */
.topbar-user {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 4px 6px 4px 12px;
  background: var(--gll);
  border: 1px solid var(--gl);
  border-radius: 18px;
  font-size: 12px;
  color: var(--g3);
  margin-left: 12px;
}
.topbar-user-name { font-weight: 600; }
.topbar-user-org  { color: var(--muted); font-size: 11px; }
.topbar-user button {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
  padding: 3px 8px;
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.topbar-user button:hover { color: var(--red); background: var(--redl); }
