:root {
  --navy: #123b75;
  --navy-dark: #062940;
  --teal: #2b6777;
  --amber: #ffb000;
  --ink: #17263a;
  --muted: #607086;
  --line: #dce5ef;
  --surface: #f4f7fa;
  --white: #fff;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  color: var(--ink);
  background: var(--surface);
  font-synthesis: none;
}

* { box-sizing: border-box; }
body { min-height: 100vh; margin: 0; background: var(--surface); font-weight: 400; }
button, input, textarea { font: inherit; }

.site-header { display: flex; align-items: center; min-height: 76px; padding: 10px clamp(18px, 4vw, 54px); border-bottom: 4px solid var(--amber); background: var(--navy); }
.brand { display: inline-flex; align-items: center; gap: 13px; color: #fff; text-decoration: none; }
.brand img { width: 56px; height: 56px; padding: 5px; object-fit: contain; border-radius: 8px; background: #fff; }
.brand strong, .brand small { display: block; }
.brand strong { font-weight: 700; }
.brand small { margin-top: 2px; color: #dbeafe; font-weight: 400; }

.survey-shell { width: min(1120px, calc(100% - 32px)); margin: 34px auto; }
.survey-intro { margin-bottom: 22px; }
.eyebrow { margin: 0 0 7px; color: var(--teal); font-size: 0.84rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
.survey-intro h1 { margin: 0 0 10px; color: var(--navy-dark); font-size: clamp(2rem, 4vw, 3.2rem); line-height: 1.08; letter-spacing: 0; }
.survey-intro > p:last-child { max-width: 780px; margin: 0; color: var(--muted); font-size: 1.04rem; line-height: 1.65; }

.survey-panel { overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: #fff; box-shadow: 0 18px 45px rgba(15, 23, 42, 0.08); }
.survey-progress { padding: 22px 28px 18px; border-bottom: 1px solid var(--line); background: #f8fbff; }
.progress-meta { display: flex; justify-content: space-between; margin-bottom: 10px; color: var(--navy); font-weight: 600; }
.progress-track { height: 9px; overflow: hidden; border-radius: 999px; background: #dbe7f4; }
.progress-fill { width: 0; height: 100%; background: linear-gradient(90deg, var(--teal), var(--amber)); transition: width 220ms ease; }

.survey-tabs { display: flex; overflow-x: auto; border-bottom: 1px solid var(--line); background: #fff; }
.survey-tabs button { flex: 1 0 auto; min-height: 52px; padding: 0 18px; border: 0; border-bottom: 3px solid transparent; background: transparent; color: #4d5d72; font-weight: 600; cursor: pointer; }
.survey-tabs button.active { border-bottom-color: var(--amber); color: var(--navy); }
.survey-tabs button.completed { color: var(--teal); }
.survey-tabs [hidden] { display: none; }

form { padding: clamp(22px, 4vw, 38px); }
.survey-step { display: none; }
.survey-step.active { display: block; }
.survey-step h2 { margin: 0 0 10px; color: var(--navy-dark); font-size: clamp(1.55rem, 3vw, 2.15rem); font-weight: 700; letter-spacing: 0; }
.survey-step > p { margin: 0 0 22px; color: var(--muted); line-height: 1.6; }
.form-grid, .rating-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }

label, legend { display: block; margin: 0 0 18px; color: var(--navy); font-weight: 600; line-height: 1.45; }
label > span, .required-label { color: var(--muted); font-size: 0.82rem; font-weight: 400; }
.required-label { color: #a33a26; }
input, textarea { width: 100%; margin-top: 7px; padding: 13px 14px; border: 1px solid #c7d3e0; border-radius: 7px; background: #fff; color: var(--ink); font-weight: 400; }
textarea { min-height: 110px; resize: vertical; }
input:focus, textarea:focus { border-color: var(--teal); outline: 3px solid rgba(43, 103, 119, 0.16); }
[aria-invalid="true"] { border-color: #c43f32 !important; }
.field-validation { display: block; min-height: 18px; margin-top: 5px; color: #b42318; font-size: 0.82rem; font-weight: 500; }
.field-validation.valid { color: #18794e; }

.address-finder-wrap { position: relative; display: block; color: inherit; font-size: inherit; font-weight: inherit; }
.address-suggestions { position: absolute; z-index: 30; top: calc(100% + 4px); right: 0; left: 0; display: none; max-height: 260px; overflow-y: auto; border: 1px solid var(--line); border-radius: 7px; background: #fff; box-shadow: 0 12px 30px rgba(15, 23, 42, 0.16); }
.address-suggestions.active { display: block; }
.address-suggestion { display: block; width: 100%; padding: 11px 14px; border: 0; border-bottom: 1px solid #eef2f7; background: #fff; color: var(--ink); text-align: left; cursor: pointer; }
.address-suggestion:hover, .address-suggestion:focus { background: #f3f7fb; outline: 0; }
.address-suggestion strong, .address-suggestion span { display: block; }
.address-suggestion strong { color: var(--navy); font-weight: 600; }
.address-suggestion span { margin-top: 2px; color: var(--muted); font-size: 0.84rem; }

.choice-group { margin: 20px 0; padding: 18px; border: 1px solid var(--line); border-radius: 8px; background: #f8fbff; }
.choice-group legend { margin-bottom: 10px; }
.choice-group label { display: inline-flex; align-items: center; gap: 8px; margin: 7px 24px 7px 0; color: var(--ink); font-weight: 500; }
.choice-group input { width: auto; margin: 0; }

.rating-grid { margin-bottom: 22px; }
.rating-field { padding: 18px; border: 1px solid var(--line); border-radius: 8px; background: #fbfdff; }
.rating-field label { min-height: 44px; margin-bottom: 4px; }
.rating-field output { display: block; margin-bottom: 4px; color: var(--teal); font-size: 0.9rem; font-weight: 600; }
.rating-field input[type="range"] { height: 26px; padding: 0; border: 0; accent-color: var(--teal); cursor: pointer; }
.rating-scale { display: grid; grid-template-columns: repeat(3, 1fr); margin-top: 2px; color: #526174; font-size: 0.8rem; line-height: 1.25; }
.rating-scale span:nth-child(2) { text-align: center; }
.rating-scale span:last-child { text-align: right; }
.rating-scale small { font-size: 0.72rem; }
.rating-field.unanswered { border-color: #e5a49b; }

.review-summary { display: grid; gap: 16px; }
.review-section { border: 1px solid var(--line); border-radius: 8px; background: #f8fbff; }
.review-section-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.review-section-header h3 { margin: 0; color: var(--navy); font-size: 1rem; }
.review-edit { padding: 7px 12px; border: 1px solid #b7c5d4; border-radius: 5px; background: #fff; color: var(--navy); font-weight: 600; cursor: pointer; }
.review-items { display: grid; gap: 10px; padding: 14px 16px; }
.review-item strong { display: block; margin-bottom: 2px; color: var(--muted); font-size: 0.76rem; font-weight: 600; text-transform: uppercase; }
.review-item span { color: var(--ink); white-space: pre-wrap; }

.submit-state { padding: 30px; border-radius: 8px; background: #f8fbff; text-align: left; }
.submit-state.success { background: #eefbf3; }
.submit-state p { margin-bottom: 0; }
.survey-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 28px; }
.actions-right { display: flex; gap: 12px; margin-left: auto; }
.button { display: inline-flex; min-width: 112px; min-height: 46px; align-items: center; justify-content: center; padding: 0 20px; border: 1px solid transparent; border-radius: 7px; font-weight: 600; line-height: 1; cursor: pointer; }
.button.primary { background: var(--navy); color: #fff; }
.button.primary:hover { background: #0d3265; }
.button.secondary { border-color: #d6e0ea; background: #eef3f8; color: var(--navy); }
.button:disabled { cursor: wait; opacity: 0.65; }
#submitBtn, #reviewReturnBtn { display: none; }
.feedback-status { min-height: 22px; margin: 14px 0 0; color: var(--navy); font-weight: 500; }

.site-footer { display: flex; flex-wrap: wrap; justify-content: center; gap: 16px 24px; padding: 28px 20px 36px; color: #526174; }
.site-footer a { color: var(--navy); text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }

@media (max-width: 720px) {
  .survey-shell { width: min(100% - 22px, 1120px); margin: 22px auto; }
  .form-grid, .rating-grid { grid-template-columns: 1fr; gap: 4px; }
  .survey-tabs button { min-width: 145px; }
  .survey-actions { align-items: stretch; flex-direction: column; }
  .actions-right { width: 100%; margin: 0; }
  .button { flex: 1; }
  #backBtn { width: 100%; }
  .choice-group label { display: flex; margin-right: 0; }
}

@media (max-width: 440px) {
  .site-header { padding-inline: 14px; }
  .brand img { width: 48px; height: 48px; }
  .survey-progress { padding-inline: 20px; }
  form { padding: 20px 16px; }
  .actions-right { flex-direction: column; }
}
