:root {
  --brand: #1f6fb2;
  --brand-dark: #185a91;
  --text: #1f2933;
  --muted: #5b6875;
  --border: #c9d2db;
  --bg: #f3f6f9;
  --card: #ffffff;
  --error: #c62828;
  --error-bg: #fdecea;
  --success: #1b7a4b;
  --radius: 10px;
  color-scheme: light;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}

.page { max-width: 720px; margin: 0 auto; padding: 24px 16px 48px; }

.masthead { padding: 8px 4px 16px; }
.logo { height: 56px; width: auto; display: block; margin-bottom: 20px; }
@media (min-width: 600px) { .logo { height: 64px; } }
h1 { font-size: 1.6rem; line-height: 1.25; margin: 0 0 12px; color: #34404c; }
h2 { font-size: 1.2rem; margin: 0 0 16px; font-weight: 600; }
.intro { color: var(--muted); margin: 0 0 8px; font-size: .95rem; }
.required-note { font-size: .9rem; color: var(--muted); margin: 16px 0 0; }

.card {
  background: var(--card); border-radius: var(--radius); padding: 20px 16px;
  margin-bottom: 16px; box-shadow: 0 1px 3px rgba(16, 24, 40, .08);
}
@media (min-width: 600px) { .card { padding: 28px 32px; } }

.field { margin: 0 0 24px; border: 0; padding: 0; min-width: 0; }
.field:last-child { margin-bottom: 0; }
.field.nested { margin: 8px 0 0 34px; }

label, legend, .label { display: block; font-weight: 500; margin-bottom: 8px; padding: 0; }
.req { color: var(--error); }
.optional, .hint-inline { color: var(--muted); font-weight: 400; }
.hint { color: var(--muted); font-size: .9rem; margin: -4px 0 12px; }

input[type="text"], input[type="email"], input[type="tel"], textarea {
  width: 100%; font: inherit; font-size: 16px; /* 16px stops iOS zooming in on focus */
  color: var(--text); background: #fff;
  border: 1px solid var(--border); border-radius: 6px; padding: 10px 12px;
}
textarea { resize: vertical; min-height: 88px; }
input:focus, textarea:focus { outline: 3px solid rgba(31, 111, 178, .3); border-color: var(--brand); }

.choice {
  display: flex; gap: 12px; align-items: flex-start; font-weight: 400;
  padding: 10px 12px; margin: 0 0 6px; border-radius: 6px; cursor: pointer;
}
.choice:hover { background: #f1f5f9; }
.choice input { width: 22px; height: 22px; margin: 1px 0 0; flex: none; accent-color: var(--brand); }

.counter { font-size: .8rem; color: var(--muted); text-align: right; margin: 4px 0 0; }

.error-msg { display: none; color: var(--error); font-size: .9rem; margin: 6px 0 0; font-weight: 500; }
.field.has-error > .error-msg { display: block; }
.field.has-error > input, .field.has-error > textarea { border-color: var(--error); border-width: 2px; }
fieldset.field.has-error { border-left: 4px solid var(--error); padding-left: 12px; }

.alert { padding: 14px 16px; border-radius: var(--radius); margin-bottom: 16px; }
.alert-error { background: var(--error-bg); color: #7f1d1d; border: 1px solid #f5c2c0; }
.alert ul { margin: 8px 0 0; padding-left: 20px; }
.alert a { color: inherit; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 600; border-radius: 8px; padding: 12px 20px; min-height: 48px;
  cursor: pointer; border: 2px solid transparent; text-decoration: none;
}
.btn-primary { background: var(--brand); color: #fff; width: 100%; font-size: 1.05rem; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-primary:disabled { opacity: .6; cursor: progress; }
.btn-secondary { background: #fff; color: var(--brand); border-color: var(--brand); }
.btn-secondary:hover { background: #eef5fb; }
.btn-link { background: none; border: 0; color: var(--brand); padding: 4px 8px; min-height: 0; text-decoration: underline; }
@media (min-width: 600px) { .btn-primary { width: auto; min-width: 240px; } }
:focus-visible { outline: 3px solid rgba(31, 111, 178, .5); outline-offset: 2px; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
input.visually-hidden:focus-visible + label { outline: 3px solid rgba(31, 111, 178, .5); outline-offset: 2px; }

.photo-status { font-size: .9rem; color: var(--muted); margin: 8px 0 0; min-height: 1.2em; }
.thumbs {
  list-style: none; padding: 0; margin: 12px 0 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px;
}
.thumbs li {
  position: relative; aspect-ratio: 1; border-radius: 8px; overflow: hidden;
  background: #e5eaf0; border: 1px solid var(--border); display: flex; align-items: center; justify-content: center;
  font-size: .75rem; color: var(--muted); text-align: center; padding: 4px;
}
.thumbs img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.thumbs .remove {
  position: absolute; top: 4px; right: 4px; width: 32px; height: 32px; border-radius: 50%;
  border: 0; background: rgba(0, 0, 0, .65); color: #fff; font-size: 18px; line-height: 1; cursor: pointer;
}

.submit-row { margin-top: 8px; }
.progress { margin-top: 16px; }
.progress-bar { height: 8px; background: #dde4ea; border-radius: 4px; overflow: hidden; }
.progress-bar span { display: block; height: 100%; width: 0; background: var(--brand); transition: width .2s; }
.progress p { font-size: .9rem; color: var(--muted); margin: 8px 0 0; }

.success { text-align: center; color: var(--success); padding: 40px 20px; }
.success h2 { color: var(--text); margin-top: 12px; }
.success p { color: var(--text); }
.ref { font-size: 1.5rem; font-weight: 700; letter-spacing: .06em; color: var(--brand) !important; }

.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

.footer { text-align: center; color: var(--muted); font-size: .85rem; margin-top: 24px; }

[hidden] { display: none !important; }
