/* Mobile first: the panel and the QR page are used from a phone. */
:root {
  --bg: #f7f1ec;
  --surface: #ffffff;
  --text: #2b2320;
  --muted: #6f625c;
  --accent: #8a5a44;
  --accent-text: #ffffff;
  --error: #a3312b;
  --success: #2e6b3f;
  --radius: 12px;
  --space: 1rem;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
}

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

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh; /* the on-screen keyboard must not make the page jump */
  line-height: 1.5;
  font-size: 1rem;
  -webkit-text-size-adjust: 100%;
}

.site-header {
  padding: var(--space);
  padding-top: max(var(--space), env(safe-area-inset-top));
  text-align: center;
}

.brand { font-weight: 600; letter-spacing: 0.04em; color: var(--accent); }

.container {
  width: 100%;
  max-width: 28rem;
  margin: 0 auto;
  padding: 0 var(--space) calc(var(--space) * 2);
}

.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: calc(var(--space) * 1.25);
  box-shadow: 0 1px 3px rgb(0 0 0 / 8%);
}

h1 { font-size: 1.375rem; margin: 0 0 var(--space); }

label { display: block; font-weight: 500; margin-bottom: 0.25rem; }

input, select, textarea {
  width: 100%;
  font: inherit;
  font-size: 1rem; /* 16px avoids iOS zoom on focus */
  padding: 0.75rem;
  border: 1px solid #d6cbc4;
  border-radius: 8px;
  background: var(--surface);
}

.field { margin-bottom: var(--space); }

.button {
  display: block;
  width: 100%;
  min-height: 48px; /* comfortable touch target */
  padding: 0.75rem var(--space);
  font: inherit;
  font-weight: 600;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-text);
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

.button:focus-visible, input:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.message { padding: 0.75rem var(--space); border-radius: 8px; margin: var(--space) 0; }
.message--info { background: #efe7e1; }
.message--success { background: #e3f1e6; color: var(--success); }
.message--error { background: #f8e3e1; color: var(--error); }

.muted { color: var(--muted); }

.htmx-request .button { opacity: 0.6; pointer-events: none; }

/* htmx's own indicator styles are off (CSP forbids inline styles); these replace them. */
.htmx-indicator { opacity: 0; transition: opacity 200ms ease-in; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { opacity: 1; }

.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; }
.small { font-size: 0.875rem; }
.field-error { color: var(--error); font-size: 0.9375rem; font-weight: 500; margin: 0.375rem 0 0; }
/* The red ring is a box-shadow, not a thicker border: the field does not change size. */
input[aria-invalid="true"] { border-color: var(--error); box-shadow: 0 0 0 1px var(--error); }
.error-summary { border: 2px solid var(--error); background: #f8e3e1; border-radius: 8px; padding: 0.75rem var(--space); margin: 0 0 var(--space); scroll-margin-top: var(--space); }
.error-summary:focus { outline: 3px solid var(--accent); outline-offset: 2px; }
.error-summary__title { margin: 0 0 0.25rem; font-weight: 600; color: var(--error); }
.error-summary ul { margin: 0; padding-left: 1.25rem; }
.error-summary a { display: inline-block; padding: 0.25rem 0; color: var(--error); }
.suggestion { display: grid; gap: 0.5rem; margin-top: 0.75rem; }
.button--secondary { background: transparent; color: var(--accent); border: 2px solid var(--accent); }
.link-block { display: inline-block; padding: 0.75rem 0; min-height: 48px; }
.consent--invalid { border-left: 3px solid var(--error); padding-left: 0.5rem; }
.phone-input { display: flex; align-items: stretch; }
.phone-input .prefix { display: flex; align-items: center; padding: 0 0.75rem; border: 1px solid #d6cbc4; border-right: 0; border-radius: 8px 0 0 8px; background: #efe7e1; color: var(--muted); }
.phone-input input { border-radius: 0 8px 8px 0; }
.consent { border: 0; padding: 0; margin: 0 0 var(--space); }
.check { display: flex; gap: 0.75rem; align-items: flex-start; font-weight: 400; min-height: 48px; padding: 0.375rem 0; }
.check input { width: 1.5rem; height: 1.5rem; flex: none; margin: 0.125rem 0 0; padding: 0; }
a { color: var(--accent); }
.stamps { font-size: 1.125rem; margin: 0 0 0.25rem; }
.document p { margin: 0 0 0.75rem; }
.button--wallet { background: #000; color: #fff; margin-top: var(--space); }
