:root {
  --ink: #1a1d23;
  --muted: #5b6470;
  --line: #d4d9e0;
  --line-strong: #b6bdc7;
  --bg: #ffffff;
  --bg-soft: #f5f7fa;
  --accent: #0b4f8a;
  --accent-ink: #ffffff;
  --error: #b3261e;
  --error-bg: #fdeceb;
  --ok: #1d7a46;
  --radius: 8px;
  --gap: 1rem;
}

* { box-sizing: border-box; }

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

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

.wrap { max-width: 920px; margin: 0 auto; padding: 1.25rem; }

/* ── Header ─────────────────────────────────────── */
.app-head {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1rem;
}
.app-head h1 { font-size: 1.4rem; margin: 0 0 .25rem; }
.app-head .dealer { font-weight: 700; color: var(--accent); }
.app-head .addr { color: var(--muted); font-size: .9rem; }
.eeo {
  font-size: .72rem; line-height: 1.45; color: var(--muted);
  margin-top: .9rem; padding-top: .9rem; border-top: 1px solid var(--line);
  text-transform: uppercase; letter-spacing: .01em;
}
.accommodation { font-size: .85rem; color: var(--ink); margin-top: .6rem; font-style: italic; }

/* ── Sections ───────────────────────────────────── */
fieldset {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem 1.35rem;
  margin: 0 0 1rem;
}
legend {
  font-weight: 700; font-size: 1.05rem; color: var(--accent);
  padding: 0 .4rem; margin-left: -.4rem;
}
.hint { color: var(--muted); font-size: .85rem; margin: .15rem 0 .9rem; }

/* ── Field grid ─────────────────────────────────── */
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--gap); }
.grid .col-2 { grid-column: span 2; }
.grid .col-1 { grid-column: span 1; }
@media (max-width: 620px) {
  .grid { grid-template-columns: 1fr; }
  .grid .col-2, .grid .col-1 { grid-column: span 1; }
}

.field { display: flex; flex-direction: column; gap: .3rem; }
.field > label { font-weight: 600; font-size: .9rem; }
.field .req { color: var(--error); }
.field .sub { font-weight: 400; color: var(--muted); font-size: .82rem; }

input[type=text], input[type=email], input[type=tel], input[type=date],
input[type=number], select, textarea {
  width: 100%; padding: .55rem .65rem;
  border: 1px solid var(--line-strong); border-radius: 6px;
  font: inherit; color: var(--ink); background: #fff;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent);
}
textarea { min-height: 4.5rem; resize: vertical; }

input[type=file] {
  width: 100%; padding: .5rem; font: inherit; color: var(--ink);
  background: #fff; border: 1px dashed var(--line-strong); border-radius: 6px; cursor: pointer;
}
input[type=file]::file-selector-button {
  font: inherit; font-weight: 600; margin-right: .75rem; padding: .45rem .9rem;
  border: 0; border-radius: 6px; background: var(--accent); color: var(--accent-ink); cursor: pointer;
}
input[aria-invalid=true], textarea[aria-invalid=true], select[aria-invalid=true] {
  border-color: var(--error); background: var(--error-bg);
}

/* ── Yes / No questions ─────────────────────────── */
.qa { padding: .7rem 0; border-bottom: 1px solid var(--line); }
.qa:last-child { border-bottom: 0; }
.qa .q { font-size: .92rem; margin-bottom: .45rem; }
.yn { display: inline-flex; gap: .4rem; }
.yn label {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .3rem .8rem; border: 1px solid var(--line-strong);
  border-radius: 999px; cursor: pointer; font-size: .88rem; user-select: none;
}
.yn input { accent-color: var(--accent); }
.yn input:checked + span { font-weight: 700; }
.yn label:has(input:checked) { border-color: var(--accent); background: #eaf2fb; }
.conditional { margin-top: .6rem; }
.conditional[hidden] { display: none; }

/* ── Checkbox grids ─────────────────────────────── */
.boxgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .35rem .9rem; }
@media (max-width: 720px) { .boxgrid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 440px) { .boxgrid { grid-template-columns: 1fr; } }
.boxgrid label { display: flex; align-items: flex-start; gap: .45rem; font-size: .86rem; padding: .15rem 0; }
.boxgrid input { margin-top: .15rem; accent-color: var(--accent); }
.other-row { margin-top: .8rem; display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.other-row label { font-size: .86rem; font-weight: 600; }
.other-row input { max-width: 280px; }

/* ── Tables (education / employment) ────────────── */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.grid-table { border-collapse: collapse; width: 100%; min-width: 640px; }
table.grid-table th, table.grid-table td { border: 1px solid var(--line); padding: .45rem .5rem; vertical-align: top; }
table.grid-table th { background: var(--bg-soft); font-size: .78rem; text-align: left; }
table.grid-table td label { font-weight: 600; font-size: .82rem; }
table.grid-table input, table.grid-table textarea { font-size: .85rem; padding: .4rem; }
table.grid-table .rowhead { background: var(--bg-soft); font-weight: 700; font-size: .82rem; white-space: nowrap; }

/* ── Waiver / signature ─────────────────────────── */
.waiver {
  max-height: 240px; overflow-y: auto; border: 1px solid var(--line-strong);
  border-radius: 6px; padding: .9rem 1rem; background: #fff;
  font-size: .8rem; line-height: 1.5; color: #2a2f37;
}
.agree {
  display: flex; gap: .6rem; align-items: flex-start;
  margin-top: 1rem; padding: .8rem; background: var(--bg-soft); border-radius: 6px;
}
.agree input { margin-top: .2rem; width: 1.15rem; height: 1.15rem; accent-color: var(--accent); }
.agree label { font-size: .9rem; }

/* ── Error summary ──────────────────────────────── */
.errors {
  background: var(--error-bg); border: 1px solid var(--error);
  border-radius: var(--radius); padding: 1rem 1.25rem; margin-bottom: 1rem;
}
.errors h2 { margin: 0 0 .5rem; font-size: 1rem; color: var(--error); }
.errors ul { margin: 0; padding-left: 1.2rem; }
.errors a { color: var(--error); }

/* ── Submit / footer ────────────────────────────── */
.actions { margin: 1.25rem 0 .5rem; }
button[type=submit] {
  background: var(--accent); color: var(--accent-ink); border: 0;
  padding: .85rem 1.8rem; font-size: 1rem; font-weight: 700;
  border-radius: 8px; cursor: pointer; width: 100%; max-width: 320px;
}
button[type=submit]:hover { filter: brightness(1.08); }
button[type=submit]:disabled { opacity: .6; cursor: not-allowed; }
.copyright { color: var(--muted); font-size: .72rem; text-align: center; margin: 1.2rem 0 .3rem; }

/* ── Thank-you ──────────────────────────────────── */
.thanks { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 2.5rem 1.5rem; text-align: center; }
.thanks .check { width: 56px; height: 56px; border-radius: 50%; background: var(--ok); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 2rem; margin-bottom: 1rem; }
.thanks h1 { font-size: 1.4rem; margin: 0 0 .5rem; }
.thanks p { color: var(--muted); max-width: 460px; margin: .4rem auto; }

/* visually-hidden but screen-reader available */
.vh { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
