/* SANGGÁ Collect. Mobile-first: donors arrive from QR posters on phones.
   Palette: "Modern Navy" (PRODUCT.md brand commitment, 27 July 2026):
   #0A192F / #1E3A5F / #345B7D / #78909C / #CFD8DC, strong and modern.
   Navy is the primary; derived light neutrals (#ECEFF1 bg) and a darkened
   muted (#4C606D) keep every text pair at WCAG AA (verified, not eyeballed).
   Depth rules: elevation hierarchy, layered shadows, tinted surfaces,
   band overlap. No side-tab accent borders, no flat card stacks. */
:root {
  --navy-deep: #0a192f;
  --navy: #1e3a5f;
  --steel: #345b7d;
  --gray-blue: #78909c;
  --mist: #cfd8dc;
  --ink: var(--navy-deep);
  --muted: #4c606d;      /* darkened from --gray-blue for AA on light surfaces */
  --line: #c3cfd6;
  --bg: #eceff1;
  --card: #ffffff;
  --ok: #157a46;
  --ok-bg: #e9f4ee;
  --tok: #b3261e;
  --tok-bg: #fdeceb;
  --radius: 16px;
  /* elevation scale: raised (primary work surfaces) > rest > flat */
  --elev-1: 0 1px 2px rgba(10, 25, 47, 0.05), 0 2px 6px rgba(10, 25, 47, 0.05);
  --elev-2: 0 1px 2px rgba(10, 25, 47, 0.06), 0 6px 16px rgba(10, 25, 47, 0.08),
            0 16px 40px rgba(10, 25, 47, 0.07);
  --elev-3: 0 2px 4px rgba(10, 25, 47, 0.08), 0 10px 24px rgba(10, 25, 47, 0.15),
            0 28px 64px rgba(10, 25, 47, 0.13);
  --focus: 0 0 0 3px rgba(52, 91, 125, 0.45);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background:
    radial-gradient(900px 420px at 50% -80px, rgba(52, 91, 125, 0.10), transparent 70%),
    linear-gradient(180deg, #e5eaee 0%, var(--bg) 320px);
  color: var(--ink);
  line-height: 1.55;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

main, footer { max-width: 640px; margin: 0 auto; padding: 0 16px; }

/* ---------- Icons ---------- */
.icon {
  width: 20px;
  height: 20px;
  flex: none;
  vertical-align: -4px;
}
.icon-brand { width: 24px; height: 24px; color: var(--gray-blue); }
.icon-lock { width: 22px; height: 22px; color: var(--steel); }
.icon-check { width: 18px; height: 18px; color: var(--ok); margin-top: 3px; }
.icon-success { width: 52px; height: 52px; color: var(--ok); margin: 4px auto 0; display: block; }
.remove-btn .icon { width: 16px; height: 16px; }

/* ---------- Hero: full-bleed navy band with layered light ---------- */
.hero {
  background:
    radial-gradient(560px 300px at 18% -12%, rgba(207, 216, 220, 0.14), transparent 62%),
    radial-gradient(480px 260px at 88% 8%, rgba(120, 144, 156, 0.28), transparent 60%),
    linear-gradient(165deg, var(--navy) 0%, var(--navy-deep) 100%);
  color: #fff;
  padding: 40px 16px 56px;
  text-align: center;
  border-bottom-left-radius: 28px;
  border-bottom-right-radius: 28px;
  box-shadow: 0 16px 40px rgba(10, 25, 47, 0.35);
  position: relative;
  z-index: 1;
}
.site-head { max-width: 640px; margin: 0 auto; }
.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}
.brand span { color: var(--mist); font-weight: 600; }
.tagline {
  font-size: clamp(1.5rem, 5.5vw, 2rem);
  font-weight: 800;
  line-height: 1.2;
  margin: 16px 0 8px;
  text-shadow: 0 2px 12px rgba(10, 25, 47, 0.45);
  text-wrap: balance;
}
.sub {
  color: var(--mist);
  margin: 0 auto;
  max-width: 46ch;
  font-size: 1rem;
}
.counter {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: rgba(207, 216, 220, 0.12);
  border: 1px solid rgba(207, 216, 220, 0.3);
  border-radius: 16px;
  padding: 12px 32px;
  margin-top: 18px;
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 4px 12px rgba(10, 25, 47, 0.3);
}
.counter-num {
  font-size: clamp(2rem, 8vw, 2.75rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: 0.01em;
  font-variant-numeric: tabular-nums;
}
.counter-label {
  color: var(--mist);
  font-size: 0.92rem;
  font-weight: 600;
}
.counter-track {
  width: min(280px, 60vw);
  height: 8px;
  border-radius: 999px;
  background: rgba(207, 216, 220, 0.2);
  overflow: hidden;
  margin-top: 10px;
}
.counter-fill {
  height: 100%;
  width: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--gray-blue), var(--mist));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.9s cubic-bezier(0.16, 1, 0.3, 1);
}
.counter-goal {
  color: var(--mist);
  font-size: 0.8rem;
  margin-top: 4px;
  opacity: 0.85;
}

/* ---------- Sections: elevation hierarchy, not identical cards ---------- */
.box {
  background: linear-gradient(180deg, #ffffff 0%, #f9fafc 100%);
  border: 1px solid rgba(195, 207, 214, 0.8);
  border-radius: var(--radius);
  padding: 20px;
  margin: 20px 0;
  box-shadow: var(--elev-2);
  position: relative;
  z-index: 2;
}
.lead-note {
  text-align: center;
  color: var(--muted);
  font-size: 0.98rem;
  font-weight: 600;
  margin: 22px auto 4px;
  max-width: 44ch;
}
.box:first-of-type { margin-top: 12px; } /* sits under the lead note now */

/* secondary section: flatter, quieter */
#about-you {
  background: transparent;
  border: 1px dashed var(--gray-blue);
  box-shadow: none;
}

.box h2 {
  font-size: 1.1rem;
  margin: 0 0 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.step {
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(180deg, var(--steel), var(--navy));
  color: #fff;
  font-size: 0.95rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(30, 58, 95, 0.4);
}
.hint { color: var(--muted); font-size: 0.95rem; margin: -4px 0 12px; }
.opt { color: var(--muted); font-weight: 400; font-size: 0.85rem; }

/* ---------- Message cards: inset work surfaces inside the raised box ---------- */
.card {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 12px;
  background: linear-gradient(180deg, #f4f6f8 0%, #edf0f3 100%);
  box-shadow: inset 0 1px 3px rgba(10, 25, 47, 0.05);
}

.msg-text {
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  font: inherit;
  resize: vertical;
  min-height: 88px;
  background: #fff;
  box-shadow: inset 0 1px 3px rgba(10, 25, 47, 0.07);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.msg-text::placeholder { color: var(--muted); opacity: 1; }
.msg-text:focus {
  outline: none;
  border-color: var(--steel);
  box-shadow: inset 0 1px 3px rgba(10, 25, 47, 0.05), var(--focus);
}

.preview-wrap { margin-top: 10px; }
.preview-label { display: block; font-size: 0.82rem; color: var(--muted); }
.preview {
  border: 1px dashed var(--gray-blue);
  border-radius: 8px;
  padding: 10px 12px;
  margin-top: 6px;
  font-size: 0.95rem;
  background: #fff;
  word-break: break-word;
  white-space: pre-wrap;
}
.preview .tok {
  color: var(--tok);
  font-weight: 700;
  background: var(--tok-bg);
  border-radius: 4px;
  padding: 0 3px;
}
.preview .url { color: var(--steel); text-decoration: underline dotted; }

/* ---------- Chips: 44px minimum touch targets ---------- */
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 12px; }
.chip-label { font-size: 0.88rem; color: var(--muted); margin-right: 2px; width: 100%; }
.chip {
  border: 1.5px solid var(--line);
  background: linear-gradient(180deg, #ffffff, #f2f5f7);
  border-radius: 999px;
  padding: 10px 16px;
  font: inherit;
  font-size: 0.92rem;
  color: var(--ink);
  cursor: pointer;
  min-height: 44px;
  box-shadow: 0 1px 2px rgba(10, 25, 47, 0.06);
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.05s ease,
    box-shadow 0.15s ease;
}
.chip:active { transform: scale(0.96); }
.chip:hover { border-color: var(--steel); }
.chip:focus-visible { outline: none; box-shadow: var(--focus); }
.chip.sel {
  background: linear-gradient(180deg, #2a4a73, var(--navy));
  border-color: var(--navy);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(30, 58, 95, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.16);
}

/* lone optional toggle, visually quieter than the answer chips */
.chip-unsure { border-style: dashed; color: var(--muted); }
.chip-unsure.sel { border-style: solid; color: #fff; }

.add-btn {
  width: 100%;
  border: 2px dashed var(--gray-blue);
  background: transparent;
  color: var(--navy);
  border-radius: 12px;
  padding: 14px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  min-height: 48px;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.add-btn:hover { border-color: var(--steel); background: #eef2f5; }
.add-btn:focus-visible { outline: none; box-shadow: var(--focus); }

.remove-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.remove-btn:hover { background: #e2e8ec; color: var(--tok); }

.assist-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-top: 14px;
  font-size: 0.95rem;
  cursor: pointer;
}
.assist-row input { margin-top: 3px; width: 20px; height: 20px; accent-color: var(--navy); }

/* honeypot: visually gone, still in the DOM for bots */
.hp { position: absolute; left: -9999px; top: -9999px; height: 1px; overflow: hidden; }

/* ---------- Consent: tinted trust panel, distinct from work surfaces ---------- */
.consent {
  background: linear-gradient(180deg, #e2e8ec 0%, var(--mist) 100%);
  border: 1px solid #b4c2cb;
  border-radius: var(--radius);
  padding: 20px;
  margin: 20px 0;
  box-shadow: var(--elev-1), inset 0 1px 0 rgba(255, 255, 255, 0.65);
}
.consent-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.consent-head h2 { font-size: 1.1rem; margin: 0; }
.trust-list { list-style: none; margin: 0 0 12px; padding: 0; }
.trust-list li {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 6px 0;
  font-size: 0.98rem;
}
.consent-text {
  border-top: 1px solid #b4c2cb;
  padding-top: 12px;
  font-size: 0.88rem;
  color: var(--muted);
}
.consent-text p { margin: 0 0 10px; }

/* ---------- Submit: highest elevation on the page ---------- */
.submit-wrap { text-align: center; margin: 24px 0 8px; }
#submit-btn, .receipt-check button {
  background: linear-gradient(180deg, #2a4a73, var(--navy));
  color: #fff;
  border: none;
  border-radius: 999px;
  font: inherit;
  font-size: 1.15rem;
  font-weight: 700;
  padding: 16px 48px;
  cursor: pointer;
  min-height: 52px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--elev-3), inset 0 1px 0 rgba(255, 255, 255, 0.18);
  transition: background 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
}
#submit-btn:disabled {
  background: var(--gray-blue);
  cursor: not-allowed;
  box-shadow: var(--elev-1);
}
#submit-btn.loading {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--steel); /* stays clearly "active", not the dim disabled gray */
  cursor: progress;
  opacity: 1;
}
.spinner {
  width: 20px;
  height: 20px;
  flex: none;
  border: 2.5px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
#submit-btn:not(:disabled):hover {
  background: linear-gradient(180deg, #244166, var(--navy-deep));
  transform: translateY(-1px);
}
#submit-btn:not(:disabled):active { transform: translateY(0) scale(0.99); }
#submit-btn:focus-visible, .receipt-check button:focus-visible {
  outline: none;
  box-shadow: var(--elev-3), var(--focus);
}
.micro { color: var(--muted); font-size: 0.85rem; margin-top: 10px; }

/* ---------- Success state: the page's one authored motion moment ---------- */
.success {
  text-align: center;
  background: linear-gradient(180deg, #f2f8f4 0%, var(--ok-bg) 100%);
  border-color: #bcd9c8;
  box-shadow: var(--elev-2);
}
.success:not([hidden]) { animation: rise 0.5s cubic-bezier(0.16, 1, 0.3, 1); }
@keyframes rise {
  from { opacity: 0; transform: translateY(14px) scale(0.98); }
  to { opacity: 1; transform: none; }
}
.receipt {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 2rem;
  letter-spacing: 0.2em;
  font-weight: 800;
  color: var(--ok);
  background: #fff;
  border: 1.5px dashed var(--ok);
  border-radius: 12px;
  padding: 16px;
  margin: 16px 0;
  user-select: all;
  box-shadow: inset 0 1px 3px rgba(10, 25, 47, 0.05);
}
.success button {
  border: 1.5px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 12px 24px;
  font: inherit;
  cursor: pointer;
  margin: 4px;
  min-height: 44px;
  box-shadow: 0 1px 3px rgba(10, 25, 47, 0.08);
  transition: border-color 0.15s ease, background 0.15s ease;
}
.success button:hover { border-color: var(--steel); background: #eef2f5; }
.success button.copied {
  border-color: var(--ok);
  color: var(--ok);
  background: #fff;
}

.err { color: var(--tok); font-size: 0.95rem; margin-top: 10px; }

.alert {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  text-align: left;
  background: var(--tok-bg);
  border: 1px solid #e5b5b1;
  border-radius: 12px;
  padding: 12px 14px;
  margin: 14px auto 0;
  max-width: 400px;
  font-size: 0.95rem;
  color: #7c1a14;
  box-shadow: var(--elev-1);
}
.alert .icon { color: var(--tok); margin-top: 2px; }
.alert strong { color: var(--tok); }

footer { color: var(--muted); font-size: 0.85rem; text-align: center; padding-bottom: 40px; margin-top: 28px; }
footer a, .consent a { color: var(--navy); }

/* ---------- Delete page ---------- */
.result-box {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  text-align: left;
  border-radius: 12px;
  padding: 12px 14px;
  margin-top: 14px;
  font-size: 0.95rem;
  box-shadow: var(--elev-1);
}
.result-box .icon { flex: none; margin-top: 2px; }
.result-box.ok {
  background: var(--ok-bg);
  border: 1px solid #bcd9c8;
  color: #14532d;
}
.result-box.ok .icon, .result-box.ok strong { color: var(--ok); }
.result-box.warn {
  background: var(--tok-bg);
  border: 1px solid #e5b5b1;
  color: #7c1a14;
}
.result-box.warn .icon, .result-box.warn strong { color: var(--tok); }

#del-btn.loading {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--steel);
  cursor: progress;
}

.field-label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 8px;
  text-align: left;
}
.receipt-check input {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 1.4rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  text-align: center;
  margin-bottom: 14px;
  box-shadow: inset 0 1px 3px rgba(10, 25, 47, 0.07);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.receipt-check input:focus {
  outline: none;
  border-color: var(--steel);
  box-shadow: inset 0 1px 3px rgba(10, 25, 47, 0.05), var(--focus);
}

/* ---------- Wider screens ---------- */
@media (min-width: 480px) {
  .chip-label { width: auto; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
