/* auth.css — login / register / forgot / reset. Matches Pelgo's landing aesthetic. */
:root {
  --natt: #1B3A4B;
  --fjord: #2D5F7A;
  --accent: #60A5FA;
  --bg: #FAFAF7;
  --text: #1C1917;
  --text-muted: #8C8780;
  --border: #E5E2DB;
  --danger: #B91C1C;
  --ok: #16A34A;
  --font: 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --display: 'Fraunces', Georgia, 'Times New Roman', serif;
}

* { box-sizing: border-box; }

/* Honour [hidden] even on elements that set display (.btn, .auth-divider) —
   used to gate the Google button + divider behind the feature flag. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

.auth-wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 20px calc(40px + env(safe-area-inset-bottom, 0px));
}

.auth-brand {
  font-family: var(--display);
  font-size: 28px;
  color: var(--natt);
  text-decoration: none;
  letter-spacing: 0.3px;
  margin-bottom: 22px;
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px 28px;
  box-shadow: 0 8px 30px rgba(27, 58, 75, 0.06);
}

.auth-card h1 {
  font-family: var(--display);
  font-weight: 500;
  font-size: 23px;
  margin: 0 0 6px;
  color: var(--natt);
}

.auth-sub {
  margin: 0 0 22px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-muted);
}

.auth-field { margin-bottom: 14px; }
.auth-field label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--natt);
}
.auth-field input {
  width: 100%;
  font-family: var(--font);
  font-size: 15px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
.auth-field input:focus {
  outline: none;
  border-color: var(--fjord);
  box-shadow: 0 0 0 3px rgba(45, 95, 122, 0.12);
}

.btn {
  display: block;
  width: 100%;
  font-family: var(--font);
  font-size: 15px;
  font-weight: 600;
  padding: 13px 18px;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  transition: background .15s, border-color .15s, opacity .15s;
}
.btn-primary { background: var(--natt); color: #fff; }
.btn-primary:hover { background: #16313f; }
.btn-primary:disabled { opacity: .55; cursor: default; }

.btn-google {
  background: #fff;
  color: var(--text);
  border-color: var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.btn-google:hover { background: #fafafa; border-color: #d8d4cb; }
.btn-google svg { width: 18px; height: 18px; flex: none; }

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0;
  color: var(--text-muted);
  font-size: 12px;
  text-transform: lowercase;
}
.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.auth-foot {
  margin-top: 20px;
  font-size: 13px;
  text-align: center;
  color: var(--text-muted);
}
.auth-foot a { color: var(--fjord); text-decoration: none; font-weight: 500; }
.auth-foot a:hover { text-decoration: underline; }
.auth-foot .dot { margin: 0 8px; opacity: .5; }

/* Site-wide legal line (foretaksnavn + org.nr) under the auth card. */
.auth-legal { margin-top: 22px; font-size: 12px; line-height: 1.6; color: var(--text-muted); text-align: center; }
.auth-legal a { color: var(--text-muted); text-decoration: underline; text-underline-offset: 2px; }

/* status / error banners */
.auth-msg {
  font-size: 13.5px;
  line-height: 1.5;
  padding: 11px 13px;
  border-radius: 10px;
  margin-bottom: 16px;
  display: none;
}
.auth-msg.show { display: block; }
.auth-msg.error { background: #FEF2F2; color: var(--danger); border: 1px solid #FECACA; }
.auth-msg.ok    { background: #F0FDF4; color: #15803D; border: 1px solid #BBF7D0; }
.auth-msg.info  { background: #F0F6FB; color: var(--natt); border: 1px solid #D6E6F2; }
.auth-msg a { color: inherit; font-weight: 600; }

.auth-success-panel { display: none; text-align: center; }
.auth-success-panel.show { display: block; }
.auth-success-panel .ico { font-size: 34px; margin-bottom: 10px; }
.auth-resend-q { margin: 0 0 10px; font-size: 13px; line-height: 1.5; color: var(--text-muted); }

/* Prominent "check your spam folder" reminder — emails to new domains
   (esp. Outlook/Hotmail) often land in junk until reputation builds. */
.auth-spam-note {
  display: flex; align-items: flex-start; gap: 9px; text-align: left;
  background: #FFF7ED; border: 1px solid #FED7AA; border-radius: 10px;
  padding: 11px 13px; margin: 0 0 16px;
  font-size: 13px; line-height: 1.5; color: #9A3412;
}
.auth-spam-note .spam-ico { flex: none; font-size: 16px; line-height: 1.3; }
.auth-spam-note[hidden] { display: none; }

/* ── Embedded in-app browser notice (INAPP_BROWSER_NOTICE_ENABLED) ────────────
   Sits directly above the Google button, which stays enabled — Google refuses
   OAuth in Meta's webview, but some builds still get through and that path is
   not taken away. Amber like .auth-spam-note: same job (a heads-up that saves a
   dead end), so it should read as the same kind of message.
   No parity rule is needed on this page: the e-mail form's submit is already a
   full-width primary button of the same size as .btn-google. */
.inapp-notice {
  background: #FFF7ED; border: 1px solid #FED7AA; border-radius: 10px;
  padding: 11px 13px; margin: 0 0 12px;
  font-size: 13px; line-height: 1.5; color: #9A3412; text-align: left;
}
.inapp-notice-text { margin: 0 0 9px; }
.inapp-notice-text strong { font-weight: 700; }
.inapp-notice-copy {
  display: block; width: 100%;
  font-family: var(--font); font-size: 13px; font-weight: 600;
  padding: 9px 12px; border-radius: 8px;
  border: 1px solid #FDBA74; background: #fff; color: #9A3412;
  cursor: pointer; transition: background .15s, border-color .15s;
}
.inapp-notice-copy:hover { background: #FFFBF5; }
.inapp-notice-copy.is-copied { background: #F0FDF4; border-color: #BBF7D0; color: #15803D; }
.inapp-notice-copy.is-failed { background: #fff; border-color: #FECACA; color: var(--danger); }

/* ── E-mail sign-in codes (OTP) ───────────────────────────────────────────────
   Only rendered when /api/auth/config reports email_otp_enabled; with the flag
   off none of these selectors match anything. */

/* The line under "Send meg en kode" is doing the persuasion, not decoration: it
   names the mechanism (a 6-digit code) and answers the objection the webview
   visitor actually has (being thrown into another browser and losing the page).
   Sized to read as reassurance rather than fine print. */
.auth-helper {
  margin: 10px 0 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-muted);
  text-align: center;
}

.auth-otp-h { margin: 0 0 6px; }

/* Big, wide-tracked, centred — a code is read in glances between the mail app
   and this field, so the digits have to survive being looked away from. */
.auth-code-input {
  width: 100%;
  text-align: center;
  font-size: 30px;
  font-weight: 600;
  letter-spacing: 12px;
  text-indent: 12px;          /* re-centres text that letter-spacing pushes left */
  padding: 14px 10px;
  font-variant-numeric: tabular-nums;
}

.auth-resend-row { margin-top: 14px; text-align: center; }

/* Quiet, but a real button: always visible, disabled with a live countdown for
   the first seconds. A resend control that only APPEARS after a delay reads as a
   glitch; one that is visibly counting down reads as a promise. */
.btn-quiet {
  background: transparent;
  color: var(--fjord);
  border: 1px solid #E5E2DB;
  font-weight: 600;
}
.btn-quiet:hover:not(:disabled) { background: #FAFAF7; }
.btn-quiet:disabled { opacity: .55; cursor: default; }

/* Screen-reader-only label for the code field (the heading carries the visible
   context, so a second visible label would be noise). */
.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;
}

/* ── Demoted Google (webview order only) ──────────────────────────────────────
   Applied ONLY when email_otp_reorder_enabled is on AND the request came from a
   Meta webview. Outline rather than filled, so e-mail reads as the primary
   action — but full width, full height and one tap, exactly as before. It is
   still the path that completes for 32% of these visitors. */
.btn-google-demoted {
  background: #fff;
  border-color: #E5E2DB;
  font-weight: 500;
  opacity: .92;
}
.btn-google-demoted:hover { opacity: 1; background: #fafafa; }

/* "Mente du …@outlook.com?" under the e-mail field (otp.js createTypoCheck). The
   suggestion is the tap target; the corrected domain is bold, being the part that
   changed. Same rules as the map's copy in style.css, in this page's colours. */
.auth-typo { margin: 8px 0 0; font-size: 14px; line-height: 1.45; }
.auth-typo[hidden] { display: none; }
.auth-typo-fix { background: none; border: 0; padding: 0; font: inherit; color: var(--fjord);
  text-decoration: underline; cursor: pointer; word-break: break-all; }
.auth-typo-keep { display: block; margin-top: 2px; font-size: 13px; color: var(--text-muted); }
