:root {
  --navy: #1b1a5e;
  --navy-hover: #2a2880;
  --green: #2f7a3a;
  --green-tint: #eaf4e4;
  --sky: #8ccde8;
  --lime: #a6c93a;
  --ink: #1d2233;
  --muted: #5c6475;
  --line: #d7dde5;
  --line-strong: #b9c2ce;
  --bg: #f3f5f8;
  --card: #ffffff;
  --field: #ffffff;
  --tint: #f6f8fb;
  --error: #b42318;
  --error-tint: #fdf0ee;
  --focus: #2f6fd0;
  --radius: 10px;
  --font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
h1, h2, h3 { line-height: 1.25; margin: 0; }
p { margin: 0 0 .6em; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* Prototype bar */
.proto-bar { background: #fff7d6; border-bottom: 1px solid #ecd98a; font-size: 13px; }
.proto-inner { max-width: 1160px; margin: 0 auto; padding: 8px 16px; display: flex; gap: 12px; justify-content: space-between; align-items: center; flex-wrap: wrap; }
.proto-actions { display: flex; gap: 16px; }

/* Header */
.site-header { background: var(--card); }
.header-inner { max-width: 1160px; margin: 0 auto; padding: 14px 16px; display: flex; align-items: center; gap: 16px; }
.logo { height: 64px; width: auto; }
.eyebrow { margin: 0; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--green); font-weight: 600; }
.site-header h1 { font-size: 22px; color: var(--navy); font-weight: 650; }
.brand-strip { height: 4px; background: linear-gradient(90deg, var(--sky), var(--lime)); }

/* Layout */
.layout { max-width: 1160px; margin: 0 auto; padding: 24px 16px 64px; display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 28px; align-items: start; }
main { min-width: 0; }

/* Section nav */
.section-nav { position: sticky; top: 16px; }
.section-nav ol { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.section-nav a {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px;
  color: var(--ink); text-decoration: none; font-size: 14px;
}
.section-nav a:hover { background: #e8ecf2; }
.section-nav a.active { background: var(--card); box-shadow: 0 0 0 1px var(--line); font-weight: 600; color: var(--navy); }
.nav-dot {
  flex: none; width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--line-strong);
  display: grid; place-items: center; font-size: 11px; color: var(--muted); background: var(--card);
}
.nav-dot.complete { background: var(--green); border-color: var(--green); color: #fff; }
.nav-dot.complete::after { content: ""; width: 8px; height: 4px; border: 2px solid #fff; border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px, -1px); }
.nav-dot.complete span { display: none; }
.draft-note { margin: 14px 10px 0; font-size: 12px; color: var(--muted); }

/* Cards & sections */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; margin-bottom: 20px; }
.intro h2 { font-size: 18px; color: var(--navy); margin-bottom: 8px; }
.intro-label { font-weight: 600; margin-top: 12px; margin-bottom: 4px; }
.ready-list { margin: 0 0 14px; padding-left: 20px; }
.ready-list li { margin: 2px 0; }

.form-section .section-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 18px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.section-num { flex: none; font-size: 13px; font-weight: 700; color: var(--green); }
.form-section h2 { font-size: 19px; color: var(--navy); }
.section-intro { color: var(--muted); margin: -6px 0 16px; }
.subhead { font-size: 15px; font-weight: 650; color: var(--navy); margin: 26px 0 10px; }

/* Fields */
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 18px; }
.field { grid-column: 1 / -1; min-width: 0; }
.field.half { grid-column: span 1; }
label, .label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 5px; }
.req { color: var(--error); font-weight: 700; }
input[type=text], input[type=email], input[type=tel], input[type=date], select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--field);
  border: 1px solid var(--line-strong); border-radius: 7px; padding: 9px 11px; min-height: 40px;
}
textarea { resize: vertical; min-height: 64px; }
input[readonly] { background: var(--tint); color: var(--muted); }
input:focus, select:focus, textarea:focus, button:focus-visible, .seg input:focus-visible + span {
  outline: 3px solid color-mix(in srgb, var(--focus) 35%, transparent); outline-offset: 1px; border-color: var(--focus);
}
.field.invalid input, .field.invalid select, .field.invalid textarea, .q.invalid textarea, .invalid .sig-box { border-color: var(--error); }
.error { color: var(--error); font-size: 13px; margin-top: 4px; }
.error:empty { display: none; }
.counter { font-size: 12px; color: var(--muted); text-align: right; margin-top: 3px; }
.counter.near { color: #a15c07; }
.hint { font-size: 13px; color: var(--muted); margin: 6px 0 0; }

/* Questions */
.questions { display: flex; flex-direction: column; }
.q { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 4px 10px; padding: 16px 0; border-top: 1px solid #eceff3; }
.q:first-child { border-top: 0; padding-top: 0; }
.q-num { font-weight: 700; color: var(--navy); font-size: 14px; padding-top: 1px; }
.q-text { font-weight: 550; margin-bottom: 10px; }
.q.invalid .seg { box-shadow: 0 0 0 1px var(--error); border-radius: 8px; }

.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 8px; overflow: hidden; margin-bottom: 10px; }
.seg label { margin: 0; font-weight: 500; position: relative; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; padding: 7px 18px; cursor: pointer; border-left: 1px solid var(--line-strong); font-size: 14px; user-select: none; }
.seg label:first-child span { border-left: 0; }
.seg span:hover { background: var(--tint); }
.seg input:checked + span { background: var(--navy); color: #fff; }

/* Row cards (certification / insurance / documents) */
.rows { display: flex; flex-direction: column; gap: 12px; }
.rowcard { border: 1px solid var(--line); border-radius: 9px; padding: 14px 16px; background: var(--tint); }
.rowcard-title { font-weight: 650; margin-bottom: 10px; color: var(--ink); }
.rowcard-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px 14px; }
.rowcard-grid label { font-size: 13px; font-weight: 550; color: var(--muted); margin-bottom: 4px; }
.rowcard .upload { margin-top: 12px; }

/* Upload */
.upload { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.upload-btn {
  display: inline-flex; align-items: center; gap: 7px; font: inherit; font-size: 14px; font-weight: 550;
  color: var(--navy); background: var(--card); border: 1px dashed var(--navy); border-radius: 7px; padding: 6px 12px; cursor: pointer;
}
.upload-btn:hover { background: #eeeefa; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--green-tint); color: #1f4d26; border-radius: 999px; padding: 4px 6px 4px 11px; font-size: 13px; max-width: 100%; }
.chip-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 260px; }
.chip button { border: 0; background: transparent; color: inherit; cursor: pointer; font-size: 16px; line-height: 1; padding: 0 4px; border-radius: 50%; }
.chip button:hover { background: rgba(0,0,0,.08); }
.q .upload { margin-top: 10px; }

/* Declaration */
.declaration-text { background: var(--tint); border-left: 4px solid var(--green); padding: 14px 16px; border-radius: 0 8px 8px 0; margin-bottom: 18px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 600; margin-bottom: 18px; cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 2px 0 0; flex: none; accent-color: var(--navy); }
.sig-wrap { margin-top: 16px; }
.sig-box { position: relative; border: 1px solid var(--line-strong); border-radius: 8px; background: #fff; height: 160px; max-width: 520px; }
.sig-box canvas { width: 100%; height: 100%; display: block; touch-action: none; cursor: crosshair; border-radius: 8px; }
.sig-line { position: absolute; left: 20px; right: 20px; bottom: 36px; border-bottom: 1px solid var(--line); pointer-events: none; }
.sig-placeholder { position: absolute; left: 22px; bottom: 12px; font-size: 12px; color: var(--muted); pointer-events: none; }
.sig-tools { display: flex; justify-content: space-between; max-width: 520px; margin-top: 6px; font-size: 13px; }

/* Buttons */
.btn { font: inherit; font-weight: 600; border-radius: 8px; padding: 11px 20px; cursor: pointer; border: 1px solid transparent; }
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-hover); }
.btn-primary:disabled { opacity: .6; cursor: progress; }
.btn-ghost { background: transparent; border-color: var(--line-strong); color: var(--ink); }
.btn-ghost:hover { background: var(--tint); }
.btn-link { font: inherit; background: none; border: 0; padding: 0; color: var(--navy); text-decoration: underline; cursor: pointer; font-weight: 600; }

.submit-row { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.error-summary { background: var(--error-tint); border: 1px solid #f1c3bd; color: var(--error); border-radius: 8px; padding: 12px 14px; margin-bottom: 16px; }
.error-summary ul { margin: 6px 0 0; padding-left: 20px; }
.error-summary a { color: var(--error); }

/* Done */
#done { grid-template-columns: minmax(0, 1fr); max-width: 720px; }
.done-card { text-align: center; padding: 40px 28px; }
.done-icon { width: 56px; height: 56px; border-radius: 50%; background: var(--green-tint); color: var(--green); display: grid; place-items: center; margin: 0 auto 14px; }
.done-card h2 { font-size: 22px; color: var(--navy); margin-bottom: 10px; }
.done-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin: 20px 0; }
#doneFiles { text-align: left; background: var(--tint); border-radius: 8px; padding: 12px 16px; margin: 0 0 20px; font-size: 14px; }
#doneFiles:empty { display: none; }
#doneFiles ul { margin: 6px 0 0; padding-left: 20px; }

/* Responsive */
@media (max-width: 900px) {
  .layout { grid-template-columns: minmax(0, 1fr); gap: 16px; padding-top: 12px; }
  .section-nav { position: sticky; top: 0; z-index: 5; background: var(--bg); margin: 0 -16px; padding: 8px 16px; border-bottom: 1px solid var(--line); }
  .section-nav ol { flex-direction: row; overflow-x: auto; gap: 6px; scrollbar-width: none; }
  .section-nav a { white-space: nowrap; padding: 6px 10px; }
  .draft-note { display: none; }
}
@media (max-width: 600px) {
  .card { padding: 18px 16px; }
  .fields { grid-template-columns: 1fr; }
  .field.half { grid-column: 1 / -1; }
  .logo { height: 48px; }
  .site-header h1 { font-size: 18px; }
  .q { grid-template-columns: 26px minmax(0, 1fr); }
  .seg span { padding: 7px 14px; }
  .submit-row .btn { flex: 1; }
}
