/* ==========================================================================
   Traffic Circle Consultation – styles
   Layout: dark "Metro line" rail + open white workspace.
   ========================================================================== */

:root {
  --paper: #f5f4ef;
  --white: #ffffff;
  --field: #f2f3f5;
  --field-hover: #eaecef;
  --line: #e7e7e2;
  --line-2: #d4d6d2;

  --ink: #0f1a2b;
  --ink-2: #172438;
  --ink-3: #26364f;

  --text: #121826;
  --text-2: #465065;
  --text-3: #6b7385;

  --primary: #0d7a6f;
  --primary-hover: #09635a;
  --primary-soft: #e3f2ef;
  --primary-ring: rgba(13, 122, 111, 0.28);

  --amber: #f5a524;
  --amber-deep: #e48a0b;
  --amber-soft: #fff3d9;

  --danger: #c3332f;
  --danger-soft: #fdeceb;
  --ok: #1c8a4f;
  --ok-soft: #e3f4ea;

  --rail-w: 300px;

  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 140px; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background: var(--white);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p { margin: 0; }
button { font: inherit; color: inherit; }

.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 16px; top: -60px; z-index: 200;
  background: #fff; color: var(--primary); padding: 10px 16px; border-radius: 8px; font-weight: 700;
}
.skip-link:focus { top: 12px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 22px;
  border: 1.5px solid transparent; border-radius: 12px;
  font-weight: 700; font-size: 15px; line-height: 1.2; white-space: nowrap;
  cursor: pointer; transition: background-color .15s, border-color .15s, box-shadow .15s, transform .05s;
}
.btn:active:not([disabled]) { transform: translateY(1px); }
.btn:focus-visible { outline: 3px solid var(--primary-ring); outline-offset: 2px; }
.btn[disabled] { opacity: .6; cursor: not-allowed; }
.btn-lg { min-height: 56px; padding: 0 30px; font-size: 16px; border-radius: 14px; }

.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 10px 22px -12px rgba(13, 122, 111, .9); }
.btn-primary:hover:not([disabled]) { background: var(--primary-hover); }
.btn-success { background: var(--amber); color: var(--ink); box-shadow: 0 10px 22px -12px rgba(228, 138, 11, .9); }
.btn-success:hover:not([disabled]) { background: var(--amber-deep); }
.btn-ghost { background: var(--white); color: var(--text); border-color: var(--line-2); }
.btn-ghost:hover:not([disabled]) { background: var(--field); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #a42925; }
.btn-link { min-height: 0; padding: 4px 0; background: none; border: 0; color: var(--primary); font-weight: 700; }
.btn-link:hover { text-decoration: underline; }
.btn.is-loading::before {
  content: ""; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid rgba(15, 26, 43, .3); border-top-color: var(--ink);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Brand ---------- */
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark {
  flex: none; width: 38px; height: 38px; border-radius: 11px;
  display: grid; place-items: center;
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.14);
}
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-kicker {
  font-size: 11.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: rgba(255,255,255,.55);
}
.brand-title { font-size: 15px; font-weight: 700; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ==========================================================================
   Intro
   ========================================================================== */
.intro { display: grid; grid-template-columns: minmax(380px, 5fr) 7fr; min-height: 100vh; }
.intro-panel {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column;
  padding: 44px 56px 40px;
  background: var(--ink); color: #fff;
}
.intro-panel::after {
  content: ""; position: absolute; right: -180px; bottom: -180px;
  width: 460px; height: 460px; border-radius: 50%;
  background: radial-gradient(circle, rgba(245, 165, 36, .18), rgba(245, 165, 36, 0) 68%);
  pointer-events: none;
}
.intro-title {
  margin-top: 56px;
  font-size: clamp(36px, 4.4vw, 56px); font-weight: 800; line-height: 1.02; letter-spacing: -.035em;
}
.intro-sub { margin-top: 16px; font-size: 16px; color: rgba(255,255,255,.66); }

.route { list-style: none; margin: 44px 0 36px; padding: 0; position: relative; z-index: 1; }
.route li {
  position: relative;
  display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; gap: 16px; align-items: center;
  padding: 9px 0;
}
.route li:not(:last-child)::before {
  content: ""; position: absolute; left: 13.5px; top: 50%; bottom: -50%;
  width: 3px; background: var(--amber); border-radius: 2px;
}
.route-dot {
  position: relative; z-index: 1;
  width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--ink); border: 3px solid var(--amber);
  font-size: 12px; font-weight: 800;
}
.route-name { font-size: 15.5px; font-weight: 600; }
.route-name em { font-style: normal; font-weight: 500; font-size: 13px; color: rgba(255,255,255,.5); margin-left: 6px; }
.route-time { font-family: var(--mono); font-size: 12.5px; color: rgba(255,255,255,.55); }
.route-total {
  position: relative; z-index: 1;
  display: flex; justify-content: space-between; align-items: baseline;
  margin-top: auto; padding-top: 22px;
  border-top: 1px solid rgba(255,255,255,.12);
  font-size: 14px; color: rgba(255,255,255,.7);
}
.route-total strong { font-size: 20px; color: var(--amber); font-weight: 800; }

.intro-main { display: grid; place-items: center; padding: 56px 48px; background: var(--paper); }
.intro-card { width: 100%; max-width: 580px; }
.kicker {
  display: inline-flex; align-items: center; gap: 10px;
  font-size: 12.5px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--primary);
}
.kicker::before { content: ""; width: 20px; height: 3px; border-radius: 2px; background: var(--amber); }
.intro-h { margin-top: 10px; font-size: 32px; font-weight: 800; letter-spacing: -.025em; line-height: 1.15; }
.intro-muted { margin-top: 8px; color: var(--text-2); }

.checklist { list-style: none; margin: 24px 0 0; padding: 0; display: grid; gap: 10px; }
.checklist li {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 14px 16px; border-radius: 16px;
  background: var(--white); border: 1px solid var(--line);
}
.check-ic {
  flex: none; width: 38px; height: 38px; border-radius: 11px;
  display: grid; place-items: center;
  background: var(--primary-soft); color: var(--primary);
}
.checklist strong { display: block; font-size: 15px; font-weight: 700; }
.checklist li > span:last-child > span { display: block; margin-top: 1px; font-size: 13.5px; color: var(--text-3); }

.facts { list-style: none; margin: 22px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 20px; }
.facts li { display: inline-flex; align-items: center; gap: 7px; font-size: 13.5px; font-weight: 500; color: var(--text-2); }
.facts svg { color: var(--primary); flex: none; }

.intro-actions { margin-top: 30px; }
.resume-card {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px;
  margin-top: 30px; padding: 18px 20px;
  background: var(--white); border: 1px solid var(--line); border-left: 4px solid var(--amber);
  border-radius: 16px;
}
.resume-title { font-weight: 800; }
.resume-meta { margin-top: 2px; font-size: 14px; color: var(--text-2); }
.resume-actions { display: flex; flex-wrap: wrap; gap: 10px; }

@media (max-width: 960px) {
  .intro { grid-template-columns: minmax(0, 1fr); min-height: 0; }
  .intro-panel { padding: 28px 20px 24px; }
  .intro-title { margin-top: 28px; font-size: 38px; }
  .route { margin: 28px 0 24px; }
  .intro-main { padding: 28px 16px 48px; place-items: start center; }
  .intro-h { font-size: 26px; }
}
@media (max-width: 520px) {
  .intro-actions .btn, .resume-actions, .resume-actions .btn { width: 100%; }
  .resume-actions .btn { flex: 1; }
  .route-name em { display: block; margin-left: 0; }
}

/* ==========================================================================
   Form shell
   ========================================================================== */
.rail {
  position: fixed; inset: 0 auto 0 0; z-index: 20;
  width: var(--rail-w);
  display: flex; flex-direction: column;
  padding: 24px 20px 20px;
  background: var(--ink); color: #fff;
  overflow-y: auto;
}
.rail-progress { margin: 28px 0 22px; padding: 14px 14px 16px; border-radius: 14px; background: var(--ink-2); }
.rail-progress-label {
  display: flex; justify-content: space-between;
  font-size: 12.5px; font-weight: 700; color: rgba(255,255,255,.7); margin-bottom: 10px;
}
.rail-progress-label span:last-child { color: var(--amber); font-family: var(--mono); }
.rail-bar { height: 6px; border-radius: 99px; background: var(--ink-3); overflow: hidden; }
.rail-bar > span { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--amber); transition: width .35s ease; }

.rail-foot {
  margin-top: auto; padding-top: 18px;
  border-top: 1px solid rgba(255,255,255,.1);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  font-size: 12.5px; color: rgba(255,255,255,.5);
}
.rail-link {
  flex: none; padding: 6px 10px; border-radius: 8px;
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.14);
  color: rgba(255,255,255,.85); font-size: 12.5px; font-weight: 700; cursor: pointer;
}
.rail-link:hover { background: rgba(255,255,255,.12); color: #fff; }

/* Metro-line stepper */
.metro { list-style: none; margin: 0; padding: 0; }
.st { position: relative; padding-bottom: 4px; }
.st:not(:last-child)::before {
  content: ""; position: absolute; left: 17px; top: 34px; bottom: -4px;
  width: 3px; border-radius: 2px; background: rgba(255,255,255,.12);
}
.st.is-done:not(:last-child)::before { background: var(--amber); }
.st-btn {
  display: flex; align-items: flex-start; gap: 14px;
  width: 100%; padding: 4px 6px 4px 2px;
  background: none; border: 0; border-radius: 10px;
  color: rgba(255,255,255,.55); text-align: left; cursor: pointer;
}
.st-btn:disabled { cursor: default; }
.st-btn:not(:disabled):hover { color: #fff; }
.st-btn:focus-visible, .st-subbtn:focus-visible, .rail-link:focus-visible { outline: 3px solid rgba(245,165,36,.5); outline-offset: 2px; }
.st-dot {
  position: relative; z-index: 1; flex: none;
  width: 33px; height: 33px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--ink); border: 3px solid rgba(255,255,255,.2);
  font-size: 12.5px; font-weight: 800; color: rgba(255,255,255,.6);
  transition: all .2s;
}
.is-done > .st-btn .st-dot { background: var(--amber); border-color: var(--amber); color: var(--ink); }
.is-visited > .st-btn .st-dot { border-color: rgba(245,165,36,.65); color: #fff; }
.is-current > .st-btn .st-dot {
  background: #fff; border-color: var(--amber); color: var(--ink);
  box-shadow: 0 0 0 6px rgba(245,165,36,.2);
}
.is-done > .st-btn, .is-visited > .st-btn { color: rgba(255,255,255,.85); }
.is-current > .st-btn { color: #fff; }
.st-text { display: flex; flex-direction: column; padding-top: 6px; min-width: 0; }
.st-title { font-size: 14.5px; font-weight: 700; line-height: 1.25; }
.st-meta { margin-top: 2px; font-size: 12px; color: rgba(255,255,255,.42); }
.st-sub { list-style: none; margin: 4px 0 8px 47px; padding: 0; display: grid; gap: 1px; }
.st-subbtn {
  display: flex; align-items: center; gap: 9px;
  width: 100%; padding: 5px 10px; border: 0; border-radius: 8px;
  background: none; color: rgba(255,255,255,.45); font-size: 13px; font-weight: 600; text-align: left; cursor: pointer;
}
.st-subbtn::before { content: ""; flex: none; width: 7px; height: 7px; border-radius: 50%; background: rgba(255,255,255,.25); }
.st-subbtn:disabled { cursor: default; }
.st-subbtn.is-visited { color: rgba(255,255,255,.75); }
.st-subbtn.is-visited::before { background: var(--amber); }
.st-subbtn.is-current { background: rgba(255,255,255,.08); color: #fff; }
.st-subbtn.is-current::before { background: #fff; box-shadow: 0 0 0 3px rgba(245,165,36,.5); }
.st-subbtn:not(:disabled):not(.is-current):hover { color: #fff; }

/* Mobile top bar (shown < 1024px) */
.mbar { display: none; }

.main { margin-left: var(--rail-w); min-height: 100vh; display: flex; flex-direction: column; background: var(--white); }
.main-inner { flex: 1; width: 100%; max-width: 860px; margin: 0 auto; padding: 52px 56px 40px; }

.actionbar {
  position: sticky; bottom: 0; z-index: 10;
  background: rgba(255,255,255,.94);
  backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-top: 1px solid var(--line);
}
.actionbar-inner {
  max-width: 860px; margin: 0 auto; padding: 14px 56px;
  display: flex; align-items: center; gap: 12px;
}
.actionbar #nextBtn { margin-left: auto; min-width: 150px; }
.save-status {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  font-size: 13px; color: var(--text-3);
}
.save-status[data-state="ok"]::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }
.save-status[data-state="warn"] { color: #9a5b00; }

@media (max-width: 1023px) {
  .rail { display: none; }
  .main { margin-left: 0; min-height: 0; }
  .mbar {
    display: block; position: sticky; top: 0; z-index: 20;
    padding: 12px 16px 14px; background: var(--ink); color: #fff;
  }
  .mbar-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
  .mbar-meta {
    display: flex; justify-content: space-between; gap: 12px;
    margin-top: 10px; font-size: 12.5px; font-weight: 600; color: rgba(255,255,255,.7);
  }
  .mbar-meta span:first-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .mbar-meta span:last-child { color: var(--amber); font-family: var(--mono); }
  .mdots { display: flex; gap: 4px; margin-top: 8px; }
  .md { flex: 1; height: 4px; border-radius: 3px; background: rgba(255,255,255,.14); }
  .md.is-done, .md.is-visited { background: var(--amber); }
  .md.is-current { background: #fff; }
  .main-inner { padding: 28px 20px 32px; }
  .actionbar-inner { padding: 12px 20px; }
}
@media (max-width: 520px) {
  .main-inner { padding: 22px 16px 28px; }
  .actionbar-inner { flex-wrap: wrap; gap: 6px 10px; padding: 10px 16px 12px; }
  .save-status { flex-basis: 100%; order: -1; font-size: 12px; }
  .actionbar .btn { flex: 1; padding: 0 14px; }
  .actionbar #nextBtn { min-width: 0; }
  .nav-hint { display: none; }
}

/* ==========================================================================
   Step content
   ========================================================================== */
.step-head { padding-bottom: 8px; }
.step-kicker { display: flex; align-items: center; gap: 12px; font-size: 13.5px; font-weight: 700; color: var(--text-3); }
.roundel {
  flex: none; width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--ink); color: var(--amber);
  font-size: 13.5px; font-weight: 800;
  box-shadow: 0 0 0 4px var(--amber-soft);
}
.step-title {
  margin-top: 18px;
  font-size: 36px; font-weight: 800; line-height: 1.1; letter-spacing: -.03em;
  outline: none;
}
.step-intro { margin-top: 12px; max-width: 62ch; font-size: 16.5px; color: var(--text-2); }

.step-alert {
  display: flex; align-items: center; gap: 10px;
  margin-top: 24px; padding: 12px 16px; border-radius: 12px;
  background: var(--danger-soft); color: #8e221f; font-weight: 600; font-size: 15px;
}
.step-alert::before {
  content: "!"; flex: none; display: grid; place-items: center;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--danger); color: #fff; font-weight: 800; font-size: 13px;
}

.group { padding: 36px 0 8px; }
.group + .group { margin-top: 20px; border-top: 1px solid var(--line); }
.group-head { margin-bottom: 26px; }
.group-title {
  display: flex; align-items: center; gap: 10px;
  font-size: 12.5px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--primary);
}
.group-title::before { content: ""; width: 20px; height: 3px; border-radius: 2px; background: var(--amber); }
.group-help { margin-top: 6px; font-size: 14px; color: var(--text-3); }

.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 34px 24px; }
.field { grid-column: 1 / -1; min-width: 0; margin: 0; padding: 0; border: 0; }
.field--half { grid-column: span 1; }

.field-label {
  display: flex; align-items: baseline; gap: 10px;
  width: 100%; margin-bottom: 12px; padding: 0;
  font-size: 16.5px; font-weight: 700; line-height: 1.35; color: var(--text);
}
.q-num { flex: none; min-width: 22px; font-family: var(--mono); font-size: 12px; font-weight: 600; color: var(--amber-deep); }
.req { color: var(--danger); margin-left: 3px; }
.field-help { margin: -6px 0 12px 32px; font-size: 14px; color: var(--text-3); }

.input {
  display: block; width: 100%; min-height: 52px; padding: 13px 16px;
  font: inherit; font-size: 16px; color: var(--text);
  background: var(--field); border: 1.5px solid transparent; border-radius: 12px;
  transition: background-color .15s, border-color .15s, box-shadow .15s;
}
.input::placeholder { color: #9298a8; }
.input:hover { background: var(--field-hover); }
.input:focus { outline: none; background: var(--white); border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-ring); }
.textarea { min-height: 110px; resize: vertical; line-height: 1.55; }
.has-error .input { background: var(--danger-soft); border-color: rgba(195, 51, 47, .55); }
.has-error .input:focus { background: var(--white); box-shadow: 0 0 0 4px rgba(195, 51, 47, .18); }

.field-error {
  display: flex; align-items: flex-start; gap: 7px;
  margin-top: 10px; font-size: 14px; font-weight: 600; color: var(--danger);
}
.field-error::before {
  content: "!"; flex: none; display: grid; place-items: center;
  width: 17px; height: 17px; margin-top: 1px; border-radius: 50%;
  background: var(--danger); color: #fff; font-size: 11px; font-weight: 800;
}

@media (max-width: 640px) {
  .fields { grid-template-columns: minmax(0, 1fr); gap: 30px; }
  .field--half { grid-column: 1 / -1; }
  .step-title { font-size: 27px; margin-top: 14px; }
  .field-label { font-size: 16px; }
  .field-help { margin-left: 0; }
  .group { padding-top: 28px; }
}

/* ---------- Chips (radio & checkbox) ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  position: relative;
  display: inline-flex; align-items: center; gap: 9px;
  min-height: 44px; padding: 9px 16px 9px 12px;
  background: var(--white); border: 1.5px solid var(--line-2); border-radius: 999px;
  font-size: 14.5px; font-weight: 600; line-height: 1.3; color: var(--text);
  cursor: pointer; user-select: none;
  transition: background-color .15s, border-color .15s, color .15s, box-shadow .15s;
}
.chip:hover { border-color: var(--primary); }
.chip > input, .tile > input, .gauge-seg > input, .heat-cell > input, .seg-opt > input {
  position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; pointer-events: none;
}
.chip-icon {
  flex: none; width: 20px; height: 20px; border-radius: 50%;
  display: grid; place-items: center;
  border: 1.5px solid var(--line-2); background: var(--white);
  transition: all .15s;
}
.chip-icon::before {
  content: ""; width: 8px; height: 8px; border-radius: 50%;
  background: var(--primary); transform: scale(0); transition: transform .15s;
}
.chip--multi .chip-icon::before {
  width: 10px; height: 10px; border-radius: 0; transform: none;
  background:
    linear-gradient(var(--text-3), var(--text-3)) center / 10px 1.8px no-repeat,
    linear-gradient(var(--text-3), var(--text-3)) center / 1.8px 10px no-repeat;
}
.chip:has(> input:checked) {
  background: var(--primary); border-color: var(--primary); color: #fff;
  box-shadow: 0 6px 14px -8px rgba(13, 122, 111, .8);
}
.chip:has(> input:checked) .chip-icon { background: #fff; border-color: #fff; }
.chip:has(> input:checked) .chip-icon::before { transform: scale(1); }
.chip--multi:has(> input:checked) .chip-icon::before {
  width: 9px; height: 5px; margin-top: -2px; background: none;
  border: solid var(--primary); border-width: 0 0 2px 2px;
  transform: rotate(-45deg);
}
.chip:has(> input:focus-visible) { outline: 3px solid var(--primary-ring); outline-offset: 2px; }
.has-error .chip { border-color: rgba(195, 51, 47, .45); }

.other-wrap { margin-top: 12px; max-width: 520px; }

.clear-btn {
  margin-top: 10px; padding: 2px 0; background: none; border: 0; cursor: pointer;
  font-size: 13.5px; font-weight: 600; color: var(--text-3);
}
.clear-btn:hover { color: var(--primary); text-decoration: underline; }

/* ---------- Choice tiles ("report another?") ---------- */
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.tile {
  position: relative;
  display: flex; align-items: center; gap: 16px;
  padding: 18px; border-radius: 16px;
  background: var(--white); border: 1.5px solid var(--line-2);
  cursor: pointer; transition: all .15s;
}
.tile:hover { border-color: var(--primary); }
.tile-icon {
  flex: none; width: 46px; height: 46px; border-radius: 13px;
  display: grid; place-items: center;
  background: var(--field); color: var(--text-2); transition: all .15s;
}
.tile-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tile-label { font-weight: 700; font-size: 15.5px; }
.tile-desc { font-size: 13.5px; color: var(--text-3); }
.tile:has(> input:checked) { border-color: var(--primary); background: var(--primary-soft); box-shadow: inset 0 0 0 1px var(--primary); }
.tile:has(> input:checked) .tile-icon { background: var(--primary); color: #fff; }
.tile:has(> input:focus-visible) { outline: 3px solid var(--primary-ring); outline-offset: 2px; }
.has-error .tile { border-color: rgba(195, 51, 47, .45); }
@media (max-width: 640px) { .tiles { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Severity gauge ---------- */
.gauge { max-width: 560px; }
.gauge-track { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 5px; }
.gauge-seg {
  --c: #1c8a4f; --soft: #e3f4ea; --on: #fff;
  position: relative; height: 60px;
  display: grid; place-items: center;
  background: var(--soft); color: var(--c);
  border-radius: 5px; cursor: pointer;
  font-size: 19px; font-weight: 800;
  transition: background-color .2s, color .2s, transform .15s, box-shadow .15s;
}
.gauge-seg:first-child { border-radius: 14px 5px 5px 14px; }
.gauge-seg:last-child { border-radius: 5px 14px 14px 5px; }
.gauge-seg[data-level="2"] { --c: #4f8f2a; --soft: #edf5e2; }
.gauge-seg[data-level="3"] { --c: #e09a0a; --soft: #fdf2d6; --on: #2b1d00; }
.gauge-seg[data-level="4"] { --c: #e0661f; --soft: #fde8db; }
.gauge-seg[data-level="5"] { --c: #c3332f; --soft: #fbe2e1; }
.gauge-seg:hover { box-shadow: inset 0 0 0 2px var(--c); }
.gauge-track:has(.gauge-seg:nth-child(1) input:checked) .gauge-seg:nth-child(-n+1),
.gauge-track:has(.gauge-seg:nth-child(2) input:checked) .gauge-seg:nth-child(-n+2),
.gauge-track:has(.gauge-seg:nth-child(3) input:checked) .gauge-seg:nth-child(-n+3),
.gauge-track:has(.gauge-seg:nth-child(4) input:checked) .gauge-seg:nth-child(-n+4),
.gauge-track:has(.gauge-seg:nth-child(5) input:checked) .gauge-seg:nth-child(-n+5) {
  background: var(--c); color: var(--on);
}
.gauge-seg:has(input:checked) { transform: translateY(-4px); box-shadow: 0 10px 18px -10px var(--c); }
.gauge-seg:has(input:focus-visible) { outline: 3px solid var(--primary-ring); outline-offset: 2px; }
.gauge-ends {
  display: flex; justify-content: space-between; gap: 12px;
  margin-top: 10px; font-size: 13px; font-weight: 600; color: var(--text-3);
}

/* ---------- Heat grid (matrix-checkbox) ---------- */
.heat { display: grid; gap: 6px; }
.heat-row {
  display: grid;
  grid-template-columns: minmax(118px, 1.35fr) repeat(var(--cols), minmax(0, 1fr));
  gap: 6px; align-items: center;
}
.heat-head span { padding-bottom: 2px; text-align: center; font-size: 12.5px; font-weight: 700; line-height: 1.25; color: var(--text-3); }
.heat-label { font-size: 14.5px; font-weight: 700; line-height: 1.2; }
.heat-label small { display: block; margin-top: 2px; font-size: 12.5px; font-weight: 500; color: var(--text-3); }
.heat-cell {
  position: relative; height: 48px; border-radius: 11px;
  display: grid; place-items: center;
  background: var(--field); cursor: pointer;
  transition: background-color .15s, box-shadow .15s;
}
.heat-cell:hover { background: #e4e6ea; }
.heat-mark {
  width: 13px; height: 7px; margin-top: -4px;
  border: solid #3b2500; border-width: 0 0 2.5px 2.5px;
  transform: rotate(-45deg) scale(0); transition: transform .15s;
}
.heat-cell:has(input:checked) { background: linear-gradient(140deg, #f8bb3a, var(--amber-deep)); box-shadow: 0 8px 16px -10px var(--amber-deep); }
.heat-cell:has(input:checked) .heat-mark { transform: rotate(-45deg) scale(1); }
.heat-cell:has(input:focus-visible) { outline: 3px solid var(--primary-ring); outline-offset: 2px; }
@media (max-width: 520px) {
  .heat-row { grid-template-columns: minmax(92px, 1.15fr) repeat(var(--cols), minmax(0, 1fr)); gap: 5px; }
  .heat-label { font-size: 13.5px; }
  .heat-head span { font-size: 11.5px; }
  .heat-cell { height: 44px; }
}

/* ---------- Level rows (matrix-radio) ---------- */
.levels { border-top: 1px solid var(--line); }
.level-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; align-items: center;
  padding: 12px 0; border-bottom: 1px solid var(--line);
}
.level-label { font-size: 15px; font-weight: 600; }
.seg { display: inline-grid; grid-template-columns: repeat(var(--cols), auto); gap: 2px; padding: 4px; border-radius: 999px; background: var(--field); }
.seg-opt {
  position: relative; padding: 8px 14px; border-radius: 999px;
  font-size: 13.5px; font-weight: 700; color: var(--text-2); text-align: center; white-space: nowrap;
  cursor: pointer; transition: background-color .15s, color .15s;
}
.seg-opt:hover { color: var(--text); background: rgba(255,255,255,.7); }
.seg-opt[data-level="0"]:has(input:checked) { background: var(--ok); color: #fff; }
.seg-opt[data-level="1"]:has(input:checked) { background: var(--amber); color: #2b1d00; }
.seg-opt[data-level="2"]:has(input:checked) { background: var(--danger); color: #fff; }
.seg-opt:has(input:focus-visible) { outline: 3px solid var(--primary-ring); outline-offset: 1px; }
@media (max-width: 640px) {
  .level-row { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .seg { display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); }
  .seg-opt { padding: 9px 6px; white-space: normal; }
}

/* ==========================================================================
   Review
   ========================================================================== */
.rv { margin-top: 14px; border: 1px solid var(--line); border-radius: 16px; background: var(--white); }
.step-alert + .rv { margin-top: 28px; }
.rv > summary {
  display: flex; align-items: center; gap: 14px;
  padding: 18px 22px; cursor: pointer; list-style: none; border-radius: 16px;
}
.rv > summary::-webkit-details-marker { display: none; }
.rv > summary:focus-visible { outline: 3px solid var(--primary-ring); outline-offset: 2px; }
.rv > summary::after {
  content: ""; flex: none; width: 9px; height: 9px;
  border: solid var(--text-3); border-width: 0 2px 2px 0;
  transform: rotate(45deg); transition: transform .2s;
}
.rv[open] > summary::after { transform: rotate(-135deg); }
.rv-head { display: flex; flex-direction: column; min-width: 0; margin-right: auto; }
.rv-eyebrow { font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--primary); }
.rv-title { font-size: 17px; font-weight: 700; }
.badge { flex: none; padding: 4px 11px; border-radius: 99px; font-size: 12px; font-weight: 700; }
.badge-warn { background: var(--danger-soft); color: var(--danger); }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.rv-body { padding: 0 22px 16px; }
.rv-list { margin: 0; }
.rv-row {
  display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: 18px;
  padding: 12px 0; border-top: 1px solid var(--line);
}
.rv-row dt { font-size: 14px; color: var(--text-3); }
.rv-row dd { margin: 0; font-size: 15px; font-weight: 600; white-space: pre-wrap; overflow-wrap: anywhere; }
.rv-empty { padding: 12px 0; border-top: 1px solid var(--line); font-size: 14px; color: var(--text-3); }
.rv-chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; white-space: normal; }
.rv-chips li { padding: 3px 11px; border-radius: 999px; background: var(--primary-soft); color: #08544c; font-size: 13.5px; font-weight: 600; }
.rv-muted { color: var(--text-3); font-weight: 500; font-size: 13.5px; }
.rv-mx { display: grid; gap: 4px; white-space: normal; }
.rv-mx span { color: var(--text-3); font-weight: 500; }
.rv-actions { padding-top: 12px; border-top: 1px solid var(--line); }
.review-note {
  margin-top: 18px; padding: 14px 16px; border-radius: 14px;
  background: var(--amber-soft); color: #5a3d00; font-size: 14px;
}
@media (max-width: 640px) {
  .rv > summary { padding: 16px; }
  .rv-body { padding: 0 16px 14px; }
  .rv-row { grid-template-columns: minmax(0, 1fr); gap: 3px; }
}

/* ==========================================================================
   Done
   ========================================================================== */
.done { min-height: 100vh; display: grid; place-items: center; padding: 40px 16px; background: var(--paper); }
.done-card {
  width: 100%; max-width: 600px; padding: 44px 32px; text-align: center;
  background: var(--white); border: 1px solid var(--line); border-radius: 24px;
  box-shadow: 0 30px 60px -40px rgba(15, 26, 43, .4);
}
.done-icon {
  width: 80px; height: 80px; margin: 0 auto 22px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--primary); color: #fff;
  box-shadow: 0 0 0 10px var(--primary-soft);
}
.done-title { font-size: 28px; font-weight: 800; letter-spacing: -.02em; outline: none; }
.done-text { margin-top: 10px; color: var(--text-2); }
.done-text.small { max-width: 46ch; margin: 14px auto 0; font-size: 14px; color: var(--text-3); }
.ref-box {
  display: inline-flex; flex-direction: column; gap: 2px;
  margin-top: 24px; padding: 14px 24px; border-radius: 14px;
  background: var(--ink); color: #fff;
}
.ref-label { font-size: 11.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: rgba(255,255,255,.55); }
.ref-id { font-family: var(--mono); font-size: 19px; font-weight: 600; color: var(--amber); }
.done-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 28px; }
@media (max-width: 520px) { .done-card { padding: 32px 20px; } .done-actions .btn { width: 100%; } }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 16px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(15, 26, 43, .55); }
.modal-card {
  position: relative; width: 100%; max-width: 420px; padding: 26px;
  background: var(--white); border-radius: 18px; box-shadow: 0 30px 70px -24px rgba(0,0,0,.5);
}
.modal-card h2 { font-size: 20px; font-weight: 800; }
.modal-card p { margin-top: 8px; font-size: 15px; color: var(--text-2); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ==========================================================================
   Place search (Google Places autocomplete)
   ========================================================================== */
.ac { position: relative; }
.ac-list {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 15;
  margin: 0; padding: 6px; list-style: none;
  background: var(--white); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 18px 40px -16px rgba(15, 26, 43, .35);
  max-height: 320px; overflow-y: auto;
}
.ac-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 12px; border-radius: 10px; cursor: pointer;
}
.ac-item:hover, .ac-item.is-active { background: var(--primary-soft); }
.ac-ic { flex: none; margin-top: 2px; color: var(--text-3); }
.ac-item.is-active .ac-ic, .ac-item:hover .ac-ic { color: var(--primary); }
.ac-text { display: flex; flex-direction: column; min-width: 0; }
.ac-main { font-size: 15px; font-weight: 600; }
.ac-sec { font-size: 13px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ac-foot { padding: 6px 12px 2px; text-align: right; font-size: 11.5px; color: var(--text-3); }

.place-pin {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px;
  margin-top: 10px; padding: 10px 12px; border-radius: 12px;
  background: var(--primary-soft); color: #08544c; font-size: 13.5px;
}
.pin-ic { display: inline-flex; color: var(--primary); }
.pin-text { flex: 1 1 220px; min-width: 0; }
.pin-text strong { font-weight: 700; }
.pin-coords { margin-left: 6px; font-family: var(--mono); font-size: 12px; color: var(--text-3); }
.pin-link { font-weight: 700; color: var(--primary); text-decoration: none; white-space: nowrap; }
.pin-link:hover { text-decoration: underline; }

/* ==========================================================================
   Photos
   ========================================================================== */
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.photo {
  position: relative; margin: 0; overflow: hidden;
  border-radius: 14px; border: 1px solid var(--line); background: var(--field);
}
.photo img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: var(--field); }
.photo figcaption {
  display: flex; justify-content: space-between; gap: 8px;
  padding: 8px 10px; background: var(--white);
  font-size: 12.5px; color: var(--text-3);
}
.photo-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; color: var(--text-2); }
.photo-size { flex: none; font-family: var(--mono); }
.photo-remove {
  position: absolute; top: 8px; right: 8px;
  width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(15, 26, 43, .72); color: #fff; border: 0; cursor: pointer;
  transition: background-color .15s;
}
.photo-remove:hover { background: var(--danger); }
.photo-remove:focus-visible { outline: 3px solid var(--primary-ring); outline-offset: 2px; }

.photo-add {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  min-height: 170px; padding: 16px; text-align: center;
  border: 2px dashed var(--line-2); border-radius: 14px; background: var(--white);
  cursor: pointer; transition: border-color .15s, background-color .15s;
}
.photo-add:hover, .photo-add.is-drag { border-color: var(--primary); background: var(--primary-soft); }
.photo-add:focus-within { outline: 3px solid var(--primary-ring); outline-offset: 2px; }
.photo-add > input {
  position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none;
}
.photo-add-ic {
  width: 46px; height: 46px; margin-bottom: 4px; border-radius: 13px;
  display: grid; place-items: center;
  background: var(--primary-soft); color: var(--primary);
}
.photo-add-label { font-size: 15px; font-weight: 700; }
.photo-add-hint { font-size: 12.5px; color: var(--text-3); }
.photo-add-count { margin-top: 4px; font-family: var(--mono); font-size: 11.5px; color: var(--text-3); }
.is-busy .photo-add { opacity: .6; pointer-events: none; }
.photo-status { margin-top: 10px; font-size: 13.5px; font-weight: 600; color: var(--text-2); }
.photo-status:empty { display: none; }
@media (max-width: 520px) { .photos { grid-template-columns: repeat(2, minmax(0, 1fr)); } .photo-add { min-height: 140px; } }

.rv-photos { display: flex; flex-wrap: wrap; gap: 8px; }
.rv-photos img { width: 96px; height: 72px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); }
.rv-pin {
  display: inline-flex; align-items: center; gap: 4px; margin-left: 6px;
  font-size: 13px; font-weight: 700; color: var(--primary); text-decoration: none; white-space: nowrap;
}
.rv-pin:hover { text-decoration: underline; }
