/*
 * Gisted payer page. Colour tokens follow apps/finance (GistedColors
 * light/dark). Fraunces carries the wordmark + hero; system sans does the
 * work. One warm brand moment; everything else quiet and legible — it's money.
 */
:root {
  --surface: #FFFBF8;
  --surface-low: #FFF3EC;
  --surface-raise: #FFFFFF;
  --ink: #2A1710;
  --muted: #8A5A1E;
  --primary: #A8412A;
  --primary-strong: #8E3320;
  --outline: #8C756B;
  --line: #E9D8CE;
  --danger: #8C3A26;
  --success: #2F7D4F;
  --success-tint: rgba(47, 125, 79, 0.12);
  --wash: rgba(168, 65, 42, 0.07);
  --on-primary: #FFFBF8;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(42, 23, 16, 0.05), 0 8px 24px -14px rgba(42, 23, 16, 0.20);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
  --serif: "Fraunces", "Iowan Old Style", Georgia, "Times New Roman", serif;
  --control-font: 16px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --surface: #17110F;
    --surface-low: #241B18;
    --surface-raise: #241B18;
    --ink: #F7EDE8;
    --muted: #F0C08A;
    --primary: #E8845F;
    --primary-strong: #F0A183;
    --outline: #A8938B;
    --line: #3A2E2A;
    --danger: #F3B5A2;
    --success: #7BD0A0;
    --success-tint: rgba(123, 208, 160, 0.14);
    --wash: rgba(232, 132, 95, 0.10);
    --on-primary: #17110F;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.30), 0 10px 26px -14px rgba(0, 0, 0, 0.55);
  }
}

[hidden] { display: none !important; }

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  overflow-x: hidden;
  background: var(--surface);
  color: var(--ink);
  font: 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}

.app {
  width: 100%;
  max-width: 30rem;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* ---- Branded header --------------------------------------------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.7rem 1rem;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  border-bottom: 1px solid var(--line);
  backdrop-filter: saturate(1.4) blur(8px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: var(--primary);
}

.brand-mark {
  display: inline-flex;
  width: 1.55rem;
  height: 1.55rem;
  color: var(--primary);
}
.brand-mark svg { width: 100%; height: 100%; }

.brand-word {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
  color: var(--primary);
}

.secure-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--success);
  background: var(--success-tint);
}
.secure-chip svg { color: var(--success); }

/* ---- Layout ----------------------------------------------------------- */
.main {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.1rem 1rem 1.5rem;
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-raise);
  padding: 1.15rem 1.15rem 1.25rem;
  box-shadow: var(--shadow);
}

.panel h2 {
  margin: 0 0 0.4rem;
  font-size: 1.12rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.panel-center { text-align: center; }
.panel-center .lede { margin-left: auto; margin-right: auto; max-width: 24rem; }

.lede { margin: 0 0 1rem; color: var(--outline); font-size: 0.95rem; }
.row-meta { margin: 0.6rem 0 0; color: var(--outline); font-size: 0.85rem; }

/* ---- Hero (what you're paying) --------------------------------------- */
.panel-hero {
  background:
    radial-gradient(120% 100% at 0% 0%, var(--wash), transparent 60%),
    var(--surface-raise);
}
.hero-eyebrow {
  margin: 0 0 0.35rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.hero-title {
  margin: 0 0 0.35rem;
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(1.7rem, 7vw, 2.15rem);
  line-height: 1.08;
  letter-spacing: -0.02em;
  text-wrap: balance;
}
.hero-org { margin: 0 0 0.15rem; color: var(--ink); font-size: 0.98rem; }
.hero-org span { font-weight: 700; }
.hero-meta { margin: 0 0 1.15rem; color: var(--outline); font-size: 0.88rem; }
.hero-meta:empty { display: none; }

.reassure {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0.85rem 0 0;
  font-size: 0.8rem;
  color: var(--outline);
}
.reassure svg { color: var(--success); flex: none; }

/* ---- How it works ----------------------------------------------------- */
.how {
  list-style: none;
  margin: 0;
  padding: 0.35rem 0.25rem;
  display: grid;
  gap: 0.85rem;
}
.how > li {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
}
.how-n {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.55rem;
  height: 1.55rem;
  border-radius: 999px;
  background: var(--wash);
  color: var(--primary);
  font-weight: 700;
  font-size: 0.82rem;
}
.how > li div { display: grid; gap: 0.1rem; }
.how b { font-size: 0.9rem; font-weight: 650; }
.how span:last-child { color: var(--outline); font-size: 0.82rem; }

/* ---- Forms ------------------------------------------------------------ */
.stack-form { display: grid; gap: 0.8rem; margin: 0.85rem 0 0; }
.stack-form label {
  display: grid;
  gap: 0.35rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--outline);
}
.stack-form input,
.stack-form select {
  width: 100%;
  font: 400 var(--control-font)/1.3 var(--font);
  color: var(--ink);
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.8rem 0.85rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.stack-form input::placeholder { color: var(--outline); opacity: 0.6; }
.stack-form input:focus,
.stack-form select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--wash);
}
.field-hint { margin: 0.15rem 0 0; font-size: 0.78rem; color: var(--muted); }

/* ---- Buttons ---------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 50px;
  border-radius: 12px;
  border: 1.5px solid transparent;
  padding: 0.75rem 1rem;
  font: 650 16px/1 var(--font);
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: filter 0.15s, transform 0.05s;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary {
  background: var(--primary);
  color: var(--on-primary);
  border-color: var(--primary);
  box-shadow: 0 8px 20px -12px var(--primary);
}
.btn-primary:hover:not(:disabled) { filter: brightness(1.05); }
.btn-ghost {
  margin-top: 0.55rem;
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
}
#what-continue, #who-submit, #amount-pay, #confirm-yes { margin-top: 1rem; }
#receipt-download { margin-top: 1rem; text-decoration: none; }

/* ---- Status + result badges ------------------------------------------ */
.status { margin: 0; font-size: 0.88rem; color: var(--muted); }
/* When the status sits directly in a panel (views without a form the grid gap
   would space) it needs its own top margin; inside .stack-form the grid gap
   already spaces it above the action button. */
.panel > .status.is-error { margin-top: 0.9rem; }
.status.is-error {
  color: var(--danger);
  border: 1px solid color-mix(in srgb, var(--danger) 40%, var(--line));
  background: color-mix(in srgb, var(--danger) 8%, var(--surface-raise));
  border-radius: var(--radius-sm);
  padding: 0.7rem 0.85rem;
}
.result-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3.6rem;
  height: 3.6rem;
  margin: 0.25rem auto 0.85rem;
  border-radius: 999px;
}
.result-badge--ok { background: var(--success-tint); color: var(--success); }
.result-badge--warn { background: var(--wash); color: var(--primary); }

/* ---- Dues list + bank details ---------------------------------------- */
.item-list { list-style: none; margin: 0 0 0.85rem; padding: 0; }
.item-list > li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.65rem 0;
  border-top: 1px solid var(--line);
  font-size: 0.9rem;
}
.item-list > li:first-child { border-top: none; }

.bank-details { margin: 0.25rem 0 0.9rem; display: grid; gap: 0.85rem; }
.bank-details > div {
  display: grid;
  gap: 0.2rem;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-low);
}
.bank-details dt { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.03em; text-transform: uppercase; color: var(--muted); }
.bank-details dd { margin: 0; font-size: 1.1rem; font-weight: 700; letter-spacing: -0.01em; }
.bank-account-row { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.bank-account-row .btn { width: auto; min-height: 38px; padding: 0.4rem 0.9rem; margin: 0; flex: none; font-size: 0.85rem; }
#bank-account-number { font-variant-numeric: tabular-nums; letter-spacing: 0.06em; }

/* ---- Enroll wizard: collection picker + obligation ack ---------------- */
.choice-list { list-style: none; margin: 0 0 1rem; padding: 0; display: grid; gap: 0.6rem; }
.choice-row {
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  transition: border-color 0.15s, box-shadow 0.15s;
}
/* Name over its terms, both beside the radio: a long terms line beside the
   name squeezed "Hall roof levy" to a letter a line (2026-10-20 review). */
.choice-row label {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  column-gap: 0.7rem;
  row-gap: 0.15rem;
  align-items: center;
  padding: 0.75rem 0.85rem;
  cursor: pointer;
}
.choice-row input[type="radio"] { grid-row: 1 / span 2; width: 1.1rem; height: 1.1rem; accent-color: var(--primary); }
.choice-row .choice-name { font-weight: 650; min-width: 0; }
.choice-row .choice-summary { font-size: 0.82rem; color: var(--outline); min-width: 0; }
.choice-row:has(input:checked) { border-color: var(--primary); box-shadow: 0 0 0 3px var(--wash); }

.check-row {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  margin: 0.2rem 0 1rem;
  font-size: 0.85rem;
  color: var(--ink);
  cursor: pointer;
}
.check-row input[type="checkbox"] { flex: none; width: 1.1rem; height: 1.1rem; margin-top: 0.1rem; accent-color: var(--primary); }

/* ---- Footer: get the app + badges ------------------------------------ */
.site-footer {
  margin-top: auto;
  padding-top: 0.5rem;
  display: grid;
  gap: 1rem;
}
.get-app {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    radial-gradient(120% 120% at 100% 0%, var(--wash), transparent 55%),
    var(--surface-low);
  padding: 1.1rem;
  text-align: center;
}
.get-app-title { margin: 0 0 0.2rem; font-family: var(--serif); font-weight: 600; font-size: 1.1rem; letter-spacing: -0.01em; }
.get-app-sub { margin: 0 0 0.85rem; color: var(--outline); font-size: 0.86rem; }
.stores { display: flex; flex-wrap: wrap; gap: 0.55rem; justify-content: center; }
.store-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.5rem 0.9rem;
  border-radius: 12px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--surface);
  text-decoration: none;
  transition: filter 0.15s;
}
.store-badge:hover { filter: brightness(1.12); }
.store-badge svg { flex: none; }
.store-badge span { display: grid; line-height: 1.05; text-align: left; }
.store-badge small { font-size: 0.6rem; letter-spacing: 0.02em; opacity: 0.85; }
.store-badge strong { font-size: 0.98rem; font-weight: 650; letter-spacing: -0.01em; }

.foot-meta { margin: 0; text-align: center; font-size: 0.78rem; color: var(--outline); }
.foot-meta a { color: var(--muted); font-weight: 650; text-decoration: none; }
.foot-meta a:hover { text-decoration: underline; }

/* Let flex children shrink so long lines wrap instead of forcing the page
   wider than a narrow phone. */
.brand, .reassure, .how > li, .how > li > div,
.item-list > li, .bank-account-row, .stores, .store-badge, .store-badge span,
.choice-row label, .check-row {
  min-width: 0;
}
.reassure { flex-wrap: wrap; }
/* Anywhere-break every text-bearing area so a long unbroken string — a server
   error's JSON, a pasted value — wraps instead of forcing the page wider than
   the phone. (The account number is short and stays whole.) */
.reassure, .hero-eyebrow, .hero-org, .hero-title, .hero-meta,
.get-app-title, .get-app-sub, .foot-meta, .how b, .how span:last-child,
.status, .lede, .row-meta, .field-hint, .panel h2, .item-list > li,
.choice-name, .choice-summary, .check-row span {
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* Secondary actions as one row of text buttons under the main one. */
.text-actions {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
}
.text-action {
  min-height: 44px;
  border: 0;
  background: none;
  padding: 0 0.25rem;
  font: inherit;
  font-weight: 600;
  color: var(--primary);
  cursor: pointer;
}

/* Track mode: the group's own account, with Copy beside it. */
.track-payto {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0.75rem 0 1rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
}
.track-payto-text {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  font-weight: 650;
  overflow-wrap: anywhere;
}
