:root {
  --ink: #1b1e22;
  --ink-muted: #5a6270;
  --line: #c9ced4;
  --surface: #ffffff;
  --surface-sunken: #eef0f2;
  --page-bg: #e3e6e9;
  --accent: #2f5d8a;
  --accent-dark: #22435f;
  --danger: #b3261e;
  --success: #2f6b4f;
  --success-bg: #eef4f0;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--page-bg);
  color: var(--ink);
  line-height: 1.45;
  font-size: 14px;
}

header {
  background: var(--accent-dark);
  color: #fff;
  border-bottom: 1px solid var(--ink);
}

.header-bar {
  max-width: 1000px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-badge {
  display: none;
}

.header-text h1 {
  font-size: 15px;
  font-weight: 600;
}

.header-text p {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.72);
}

.header-meta {
  margin-left: auto;
  text-align: right;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.72);
}

.header-meta strong {
  color: #fff;
  font-size: 12px;
  font-weight: 600;
}

.toolbar {
  background: var(--surface-sunken);
  border-bottom: 1px solid var(--line);
}

.toolbar-inner {
  max-width: 1000px;
  margin: 0 auto;
  padding: 6px 20px;
  display: flex;
  gap: 20px;
  font-size: 12px;
  color: var(--ink-muted);
}

.toolbar-inner span {
  display: flex;
  align-items: center;
  gap: 6px;
}

.toolbar-inner .dot {
  width: 6px;
  height: 6px;
  border-radius: 1px;
  background: #2f6b4f;
}

main {
  max-width: 1000px;
  margin: 0 auto;
  padding: 20px;
}

/* Multi-page layout uses the full page width so the nav can sit in the left
   margin while the form stays centered on the page. */
main.main-wide {
  max-width: none;
}

.form-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 2px;
  margin-bottom: 16px;
}

.section-header {
  background: var(--surface-sunken);
  color: var(--ink);
  padding: 8px 16px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.2px;
  text-transform: uppercase;
  display: flex;
  align-items: baseline;
  gap: 6px;
  border-bottom: 1px solid var(--line);
}

.section-header .section-num {
  font-weight: 800;
}

.section-header .section-num::after {
  content: '.';
}

.section-body {
  padding: 16px;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.field-grid-2 {
  grid-template-columns: 1fr 1fr;
}

.field-grid-3 {
  grid-template-columns: 1fr 1fr 1fr;
}

.field-grid-4 {
  grid-template-columns: 1fr 1fr 1fr 1fr;
}

.field-grid-12 {
  grid-template-columns: repeat(12, 1fr);
}

.field-span-3 {
  grid-column: span 3;
}

.field-span-4 {
  grid-column: span 4;
}

.field-span-8 {
  grid-column: span 8;
}

.field-span-12 {
  grid-column: span 12;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.field-full {
  grid-column: 1 / -1;
}

.field-half {
  grid-column: span 2;
}

label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--ink-muted);
  letter-spacing: 0.2px;
}

label .req {
  color: var(--danger);
  margin-left: 2px;
}

input,
select,
textarea {
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 6px 8px;
  font-size: 13px;
  font-family: inherit;
  background: var(--surface);
  color: var(--ink);
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 0;
  border-color: var(--accent);
}

textarea {
  resize: vertical;
  min-height: 70px;
}

.radio-group,
.checkbox-group {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  padding: 4px 0;
}

.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 6px 16px;
  padding: 4px 0;
}

.radio-group label,
.checkbox-group label,
.checkbox-grid label,
label.checkbox-inline {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  font-size: 12px;
  text-transform: none;
  font-weight: 400;
  color: var(--ink);
  cursor: pointer;
}

input[type='radio'],
input[type='checkbox'] {
  width: 15px;
  height: 15px;
  margin-top: 1px;
  accent-color: var(--accent);
  flex-shrink: 0;
}

.vehicle-block,
.person-block {
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 12px;
  margin-bottom: 12px;
  background: var(--surface-sunken);
}

.vehicle-block-header,
.person-block-header {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 8px;
}

.v-badge,
.p-badge {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  padding: 1px 6px;
  border-radius: 2px;
  font-size: 11px;
  font-weight: 700;
}

.subsection-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink);
  text-transform: uppercase;
  letter-spacing: 0.2px;
  margin: 14px 0 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--line);
}

.subsection-label:first-child {
  margin-top: 0;
}

.field-note {
  color: var(--ink-muted);
  font-size: 11px;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
}

/* Marks form items that only apply to a conditional case (e.g. K-12 school
   stops), echoing the red-italic conditional items on the source form. */
.cond-note {
  color: var(--danger);
  font-style: italic;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  font-size: 11px;
}

.inline-followup {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 6px 0 0 22px;
  font-size: 12px;
  color: var(--ink-muted);
}

.inline-followup .radio-group {
  padding: 0;
  gap: 12px;
}

/* A plain vertical list of radio/checkbox choices. Explicitly avoids the
   flex-wrap on .checkbox-group, which could reserve stray vertical space. */
.choice-stack {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
}

.choice-stack > label {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13px;
}

/* Light section navigation: a sticky nav pinned to the page's left margin,
   with the form column centered on the page. Intentionally understated — a nav
   aid, not an app shell. The two 1fr side tracks keep the form centered while
   the nav occupies the left track. */
.form-layout {
  display: grid;
  grid-template-columns: minmax(210px, 1fr) minmax(0, 1000px) minmax(210px, 1fr);
  align-items: start;
  column-gap: 20px;
}

.form-nav {
  grid-column: 1;
  justify-self: start;
  position: sticky;
  top: 16px;
  width: 210px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 6px;
}

.form-nav-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--ink-muted);
  padding: 8px 10px 6px;
}

.form-nav a {
  display: block;
  padding: 7px 10px;
  font-size: 13px;
  color: var(--ink);
  text-decoration: none;
  border-left: 2px solid transparent;
  border-radius: 2px;
}

.form-nav a:hover {
  background: var(--surface-sunken);
}

.form-nav a.active {
  background: var(--surface-sunken);
  border-left-color: var(--accent);
  font-weight: 600;
  color: var(--accent-dark);
}

.form-nav-main {
  grid-column: 2;
  min-width: 0;
}

/* Below this width there isn't room for a left-margin nav, so it stacks on
   top and the form spans the width. */
@media (max-width: 1080px) {
  .form-layout {
    grid-template-columns: 1fr;
  }

  .form-nav {
    grid-column: 1;
    position: static;
    width: 100%;
    justify-self: stretch;
    margin-bottom: 16px;
  }

  .form-nav-main {
    grid-column: 1;
  }
}

/* Paginated sections: only the active page is shown; the others stay in the
   DOM so entered values persist when navigating between pages. */
.form-page {
  display: none;
}

.form-page.active {
  display: block;
}

.actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 0 0;
}

.btn {
  padding: 8px 20px;
  border: 1px solid transparent;
  border-radius: 2px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.btn-secondary {
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink);
}

.btn-secondary:hover {
  background: var(--surface-sunken);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-dark);
}

.btn-submit {
  background: var(--accent-dark);
  color: #fff;
  padding: 9px 28px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.btn-submit:hover {
  background: var(--ink);
}

.add-vehicle-row {
  margin-top: 12px;
  padding-top: 8px;
}

.success-screen {
  display: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 24px;
}

.success-screen.visible {
  display: block;
}

.success-icon {
  width: 32px;
  height: 32px;
  background: var(--success-bg);
  border: 1px solid var(--success);
  border-radius: 2px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.success-icon svg {
  width: 18px;
  height: 18px;
  color: var(--success);
}

.success-screen h2 {
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 4px;
}

.success-screen p {
  color: var(--ink-muted);
  font-size: 13px;
  max-width: 480px;
}

.success-details {
  background: var(--surface-sunken);
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 16px;
  margin: 16px 0;
  max-width: 420px;
}

.success-details dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 16px;
  font-size: 13px;
}

.success-details dt {
  font-weight: 600;
  color: var(--ink-muted);
}

.success-details dd {
  color: var(--ink);
}

.success-screen .btn {
  margin-top: 4px;
}

footer {
  max-width: 1000px;
  margin: 0 auto;
  padding: 12px 20px 32px;
  font-size: 11px;
  color: var(--ink-muted);
}

@media (max-width: 640px) {
  .field-grid,
  .field-grid-2,
  .field-grid-3,
  .field-grid-4,
  .field-grid-12 {
    grid-template-columns: 1fr;
  }

  .field-half,
  .field-span-3,
  .field-span-4,
  .field-span-8,
  .field-span-12 {
    grid-column: span 1;
  }

  .header-meta {
    display: none;
  }
}
