/* Login page — completely self-contained. Lives in web/public/ so Vite
   copies it verbatim into dist/ without bundling. No CSS variables shared
   with the SPA (the SPA imports app.css; this page does not). The palette
   below tracks the SPA's L/D tokens by hand. */

:root {
  --bg:           #f4f6fb;
  --surface:      #ffffff;
  --border:       #d8def0;
  --border-strong:#a4afca;
  --text:         #141a2b;
  --muted:        #5f6884;
  --accent:       #2a6bde;
  --accent-ink:   #ffffff;
  --accent-strong:#1f57c1;
  --error-bg:     #fdecec;
  --error-text:   #a72020;
  --success-bg:   #e6f4ee;
  --success-text: #146746;
  --info-bg:      #eaf1fb;
  --info-text:    #1f4cae;
  --radius:       12px;
  --shadow-card:  0 8px 28px rgba(20, 26, 43, 0.10);
  --field-bg:     #f7f9fd;
  --field-bg-focus:#ffffff;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:           #0f1320;
    --surface:      #181d2e;
    --border:       #2c3450;
    --border-strong:#41486a;
    --text:         #e6e9f3;
    --muted:        #94a0c0;
    --accent:       #5e8df0;
    --accent-ink:   #0b0f1c;
    --accent-strong:#4877dd;
    --error-bg:     #43202a;
    --error-text:   #ffb3b3;
    --success-bg:   #18352a;
    --success-text: #9bd9bb;
    --info-bg:      #1a2a4a;
    --info-text:    #b0c8f7;
    --field-bg:     #11162a;
    --field-bg-focus:#1d2340;
  }
}

* { box-sizing: border-box; }

/* The HTML hidden attribute is the source of truth for show/hide on this
   page. Without this, an author-level `display: flex` on .section / .form /
   .destinations would beat the UA stylesheet's `[hidden] { display: none }`
   and leave the PIN block + signup form visible on first paint. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background: var(--bg);
  color: var(--text);
}

body {
  display: grid;
  place-items: center;
  padding: 32px 16px;
}

.card {
  width: min(440px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 28px 28px 20px;
}

.card-head {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 22px;
}

.brand-logo {
  width: 56px;
  height: 56px;
  flex: 0 0 56px;
}

.card-head h1 {
  margin: 0;
  font-size: 20px;
  letter-spacing: 0.2px;
}

.subtitle {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.tab-row {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

.tab {
  flex: 1;
  padding: 10px 12px;
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  transition: color 120ms ease, border-color 120ms ease;
}

.tab:hover { color: var(--text); }

.tab.is-active {
  color: var(--text);
  border-bottom-color: var(--accent);
}

.status {
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 14px;
}

.status[data-kind="error"]   { background: var(--error-bg);   color: var(--error-text); }
.status[data-kind="success"] { background: var(--success-bg); color: var(--success-text); }
.status[data-kind="info"]    { background: var(--info-bg);    color: var(--info-text); }

.form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.label-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.label-text {
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
}

.hint {
  font-size: 12px;
  color: var(--muted);
  min-height: 14px;
}

.hint[data-kind="error"]   { color: var(--error-text); }
.hint[data-kind="success"] { color: var(--success-text); }

/* "Forgot password?" — link-styled button, right-aligned on the Password
   label row (the .label-row flex handles the right-alignment). */
.forgot-link {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  font-size: 12px;
  color: var(--accent);
  text-decoration: underline;
  cursor: pointer;
}
.forgot-link:hover { color: var(--accent-strong); }
.forgot-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }

input[type="email"],
input[type="password"],
input[type="text"],
select {
  appearance: none;
  width: 100%;
  font: inherit;
  padding: 10px 12px;
  background: var(--field-bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  transition: background 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
}

/* Custom chevron for <select>. `appearance: none` above strips the
   browser-native dropdown arrow; without this you'd see no chevron at
   all and the user wouldn't know they could pick a different city. */
select {
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
                    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 12px) 50%;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 32px;
  cursor: pointer;
}

input:focus, select:focus {
  outline: 0;
  background-color: var(--field-bg-focus);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(42, 107, 222, 0.18);
}

/* Show/hide password toggle. The .pw-wrap becomes the positioning
   context for the eye button; the input gains extra right padding so
   typed text doesn't slide under the icon. */
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 40px; }
.pw-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: transparent;
  padding: 4px 6px;
  cursor: pointer;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
}
.pw-toggle:hover  { color: var(--text); }
.pw-toggle:active { color: var(--accent); }
.pw-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.method {
  display: flex;
  align-items: center;
  /* space-between pushes the two .radio labels to the row's left and
     right edges; the .method-or token sits naturally in the middle. */
  justify-content: space-between;
  border: 0;
  padding: 0;
  margin: 2px 0;
}

.method-or {
  font-size: 13px;
  color: var(--muted);
  font-style: italic;
  user-select: none;
}

.radio {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  cursor: pointer;
  user-select: none;
}

.radio input {
  accent-color: var(--accent);
  margin: 0;
}

.section {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.destinations {
  border: 0;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.destinations legend { margin-bottom: 4px; }
.destinations .radio { padding: 4px 0; }

.masked {
  font-style: normal;
  color: var(--muted);
}

.btn {
  appearance: none;
  font: inherit;
  font-weight: 600;
  padding: 11px 14px;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease, transform 60ms ease;
}

.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
}

.btn-primary:hover  { background: var(--accent-strong); }

.btn-secondary {
  background: transparent;
  color: var(--text);
  border-color: var(--border-strong);
}

.btn-secondary:hover { background: var(--field-bg); }

.btn[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}

.card-foot {
  margin-top: 22px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  text-align: center;
}

.fine-print {
  font-size: 12px;
  color: var(--muted);
  margin: 0;
}

.fine-print a {
  color: var(--accent);
  text-decoration: none;
}

.fine-print a:hover { text-decoration: underline; }

/* Layout-only flex column for the city / state / county trio derived
   from the entered ZIP. Originally this had its own background +
   border, which made the children — also styled with --field-bg —
   look like one fused unlabelled box; now it's a transparent
   container so each field reads as its own input/select. */
.zip-derived {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Row 1 — city control + full state name. The city fills available
   width; the state stays narrow to the right. */
.zip-derived-row {
  display: flex;
  gap: 12px;
  align-items: flex-end;
}
.zip-derived .zip-city  { flex: 1 1 auto; }
.zip-derived .zip-state { flex: 0 0 160px; }

/* Override the global `input[readonly] { background: transparent;
   border-color: transparent }` rule for the State + single-city
   display fields. Without this override they render as flat text and
   the row looks like an unstructured chunk of words rather than two
   labeled fields. */
.zip-derived .zip-state input[readonly],
.zip-derived .zip-city  input[readonly] {
  background: var(--field-bg);
  border: 1px solid var(--border);
  color: var(--text);
}

/* Row 2 — county name, all caps, " COUNTY" suffix added in JS. The text
   sits right under the city/state row and is sized to match the labels. */
.zip-derived-county {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  min-height: 1.2em;
}

/* Inline (?) help button rendered next to a field label. Small,
   transparent, no underline; opens a help <dialog> on click. */
.help-q {
  background: transparent;
  border: 0;
  padding: 0 4px;
  margin: 0 2px;
  color: var(--muted);
  cursor: pointer;
  font-size: inherit;
  font-weight: inherit;
  font-family: inherit;
  line-height: 1;
}
.help-q:hover, .help-q:focus { color: var(--accent, #d4af37); outline: none; }

/* Native <dialog> styling — sit centered with a card-style chrome and a
   dim backdrop. Closeable via the explicit Close button, the backdrop
   click, or ESC. */
.help-dialog {
  max-width: 520px;
  width: calc(100% - 32px);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px 20px;
  /* --card-bg was an undefined var; the fallback was near-black so the
     dark `var(--text)` foreground rendered unreadable in light mode.
     Anchor to --surface (defined for both themes) and let --text supply
     the matching foreground. */
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 10px 30px rgba(0,0,0,0.25);
}
.help-dialog::backdrop { background: rgba(0,0,0,0.45); }
.help-dialog-title {
  margin: 0 0 10px;
  font-size: 18px;
  font-weight: 700;
}
.help-dialog p { margin: 0 0 10px; line-height: 1.45; font-size: 14px; }
.help-dialog-foot { margin-top: 12px; text-align: right; }

input[readonly], select[readonly] {
  background: transparent;
  border-color: transparent;
  cursor: default;
  color: var(--muted);
}

input[readonly]:focus, select[readonly]:focus {
  outline: none;
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* Referral-active marker — login.js reveals this (drops [hidden]) only when
   the page is handling a referral. Deliberately tiny and corner-pinned: an
   awareness cue, not UI. */
#refIndicator {
  position: fixed;
  left: 3px;
  bottom: 2px;
  font-size: 7px;
  line-height: 1;
  color: var(--accent);
  user-select: none;
  pointer-events: none;
  z-index: 10;
}
