:root {
  --bg: #000000;
  --cream: #f5f4ee;
  --ink: #272923;
  --muted: #9a978c;
  --orange: #ed5736;
  --orange-soft: rgba(237, 87, 54, 0.28);
  --panel: rgba(8, 8, 8, 0.92);
  --line: rgba(245, 244, 238, 0.16);
  --radius: 18px;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --fast: 120ms;
  --medium: 200ms;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
}
* { box-sizing: border-box; }
html, body { height: 100%; height: 100dvh; margin: 0; }
html {
  background: var(--bg);
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
}
body {
  background: var(--bg);
  color: var(--cream);
  font: 13px/1.45 Arial, Helvetica, sans-serif;
  overflow: hidden;
  overscroll-behavior: none;
}
#map { position: fixed; inset: 0; background: #000; filter: none; }
#dust {
  position: fixed;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  overflow: hidden;
}
.dust-bit {
  position: absolute;
  opacity: 0;
  animation: dust-fly 700ms var(--ease-out) forwards;
}
.dust-spark {
  width: 9px;
  height: 9px;
  background: var(--orange);
  clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
}
.dust-stamp {
  width: 16px;
  height: 12px;
  border: 2px solid var(--orange);
  border-radius: 3px;
  background: var(--ink);
}
.dust-mail {
  width: 18px;
  height: 12px;
  border: 2px solid var(--cream);
  border-radius: 3px;
  background: #111;
}
.chrome {
  position: fixed;
  top: calc(10px + var(--safe-top));
  left: calc(12px + var(--safe-left));
  right: calc(12px + var(--safe-right));
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
  z-index: 6;
}
.wordmark {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 12px 0 6px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--cream);
  text-decoration: none;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 18px;
  font-weight: 500;
  white-space: nowrap;
  transition: transform var(--fast) var(--ease-out), background-color var(--fast) ease;
}
.wordmark em { font-style: italic; color: var(--orange); }
.brand-mark {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: var(--orange);
  color: var(--ink);
}
#menu-btn, #filter-btn, #audience button, .ghost, .primary, #go-btn, #census-toggle, .chip {
  font: inherit;
  color: inherit;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
#menu-btn, #filter-btn {
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--cream);
  display: grid;
  place-items: center;
  transition: transform var(--fast) var(--ease-out), border-color var(--fast) ease, color var(--fast) ease;
}
#menu-btn { pointer-events: auto; }
.burger, .burger:before, .burger:after {
  display: block;
  width: 16px;
  height: 1.5px;
  background: currentColor;
  position: relative;
  border-radius: 2px;
}
.burger:before, .burger:after {
  content: "";
  position: absolute;
  left: 0;
}
.burger:before { top: -5px; }
.burger:after { top: 5px; }
#wizard {
  position: fixed;
  top: calc(10px + var(--safe-top));
  left: 50%;
  transform: translateX(-50%);
  z-index: 7;
  width: min(340px, calc(100vw - 128px));
  padding: 12px 14px 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-align: center;
}
.wizard-kicker {
  margin: 0 0 2px;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}
.wizard-title {
  margin: 0 0 10px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 18px;
  font-weight: 500;
  letter-spacing: -0.02em;
}
#quote {
  margin: 0 0 10px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 20px;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.fetch-steps {
  list-style: none;
  margin: 0 0 10px;
  padding: 0;
  display: grid;
  gap: 4px;
  text-align: left;
}
.fetch-steps li {
  color: var(--muted);
  font-size: 12px;
  padding-left: 22px;
  position: relative;
}
.fetch-steps li:before {
  content: "";
  width: 12px;
  height: 9px;
  border: 1.5px solid var(--line);
  border-radius: 2px;
  position: absolute;
  left: 0;
  top: 4px;
  background: #111;
}
body[data-find="collecting"] li[data-stage="collecting"],
body[data-find="counting"] li[data-stage="collecting"],
body[data-find="counting"] li[data-stage="counting"],
body[data-find="sorting"] li[data-stage="collecting"],
body[data-find="sorting"] li[data-stage="counting"],
body[data-find="sorting"] li[data-stage="sorting"],
body[data-find="ready"] .fetch-steps li {
  color: var(--cream);
}
body[data-find="collecting"] li[data-stage="collecting"]:before,
body[data-find="counting"] li[data-stage="collecting"]:before,
body[data-find="counting"] li[data-stage="counting"]:before,
body[data-find="sorting"] li[data-stage="collecting"]:before,
body[data-find="sorting"] li[data-stage="counting"]:before,
body[data-find="sorting"] li[data-stage="sorting"]:before,
body[data-find="ready"] .fetch-steps li:before {
  border-color: var(--orange);
  background: #3a1a12;
  transform: rotate(-8deg);
}
#dock {
  position: fixed;
  left: 50%;
  bottom: calc(12px + var(--safe-bottom));
  transform: translateX(-50%);
  z-index: 5;
  width: min(420px, calc(100% - 24px));
  max-height: calc(100dvh - 168px);
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: auto;
  overscroll-behavior: contain;
}
#census {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  min-height: 0;
}
.census-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--panel);
}
.census-title {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
}
#census-toggle {
  flex: 0 0 auto;
  min-width: 44px;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #111;
  color: var(--cream);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  transition: transform var(--fast) var(--ease-out), border-color var(--fast) ease;
}
#census-toggle[aria-expanded="false"] { color: var(--muted); }
.census-body {
  margin-top: 6px;
}
.census-body > .census-inner { min-height: 0; }
body[data-census="min"] .census-body {
  display: none;
}
.census-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 10px;
  margin: 0;
}
.census-grid div { margin: 0; }
.census-grid dt {
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 700;
}
.census-grid dd {
  margin: 2px 0 0;
  font-variant-numeric: tabular-nums;
}
#filter-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  max-height: min(42vh, 360px);
  display: none;
  overflow: hidden;
}
body[data-filter="open"] #filter-panel {
  display: flex;
  flex-direction: column;
}
body[data-filter="open"] #filter-btn {
  border-color: var(--orange);
  color: var(--orange);
}
.filter-scroll {
  overflow: auto;
  overscroll-behavior: contain;
  padding: 14px 14px 12px;
  min-height: 0;
}
.dock-bar {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
}
#audience {
  position: relative;
  display: flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
}
#audience .thumb {
  position: absolute;
  left: 3px;
  top: 3px;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  background: #171717;
  box-shadow: inset 0 0 0 1px var(--line);
  transform: translateX(0);
  transition: transform var(--medium) var(--ease-out);
  pointer-events: none;
}
body[data-audience="residential"] #audience .thumb { transform: translateX(44px); }
#audience button {
  position: relative;
  z-index: 1;
  width: 44px;
  height: 44px;
  border: 0;
  background: transparent;
  color: var(--muted);
  display: grid;
  place-items: center;
  transition: color var(--fast) ease, transform var(--fast) var(--ease-out);
}
#audience button[aria-checked="true"] { color: var(--cream); }
#results {
  position: fixed;
  top: calc(96px + var(--safe-top));
  right: calc(12px + var(--safe-right));
  bottom: calc(12px + var(--safe-bottom));
  z-index: 4;
  width: min(280px, calc(100vw - 24px));
  overflow: auto;
  overscroll-behavior: contain;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
}
#result-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
#result-list li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
  will-change: transform, opacity;
}
#result-list .meta {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
[hidden] { display: none !important; }
.panel-kicker {
  margin: 0 0 8px;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}
.field {
  display: block;
  margin: 0 0 12px;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
}
.field input, .field select, .demo-row input {
  display: block;
  width: 100%;
  margin-top: 5px;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #111;
  color: var(--cream);
  font: inherit;
  font-size: 16px;
}
.field input:focus, .field select:focus, .demo-row input:focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px var(--orange-soft);
  outline: none;
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 10px;
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 2px 0 8px;
  background: #0a0a0a;
}
.chip {
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #111;
  color: var(--cream);
  font: inherit;
  cursor: pointer;
}
.chip[aria-pressed="true"] {
  border-color: var(--orange);
  color: var(--orange);
}
.industry-summary { margin: 0 0 8px; font-size: 12px; }
.industry-list { max-height: min(200px, 26dvh); overflow: auto; overscroll-behavior: contain; }
.industry-cat-row, .industry-leaf { display: flex; align-items: center; min-height: 44px; gap: 4px; }
.industry-cat-head {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 2px;
  min-height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.industry-cat-toggle {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  pointer-events: none;
}
.industry-cat-toggle:before {
  content: "";
  width: 7px;
  height: 7px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  transition: transform var(--fast) var(--ease-out);
}
.industry-cat-head[aria-expanded="true"] .industry-cat-toggle:before { transform: rotate(45deg); }
.industry-cat-body { padding-left: 22px; }
.industry-cat-check, .industry-leaf label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  margin: 0;
  font-weight: 500;
}
.industry-cat-check { width: 44px; justify-content: center; }
input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--orange); }
.demo-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}
.demo-row .field { margin: 0; }
.hint { margin: 6px 0 0; color: var(--muted); font-size: 11px; font-weight: 400; }
.estimate .est-count {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.estimate .est-range { margin: 2px 0 0; font-size: 16px; font-variant-numeric: tabular-nums; }
.primary, .ghost, #go-btn {
  min-height: 44px;
  width: 100%;
  border-radius: 999px;
  border: 1px solid var(--orange);
  background: var(--orange);
  color: var(--ink);
  font-weight: 700;
  transition: transform var(--fast) var(--ease-out), filter var(--fast) ease;
}
.ghost { background: transparent; color: var(--cream); border-color: var(--line); }
.primary:disabled, #go-btn:disabled {
  opacity: 1;
  background: #2a2a2a;
  border-color: #3a3a3a;
  color: #6a6760;
  cursor: not-allowed;
}
#go-btn:not(:disabled) {
  background: var(--orange);
  border-color: var(--cream);
  color: #171b14;
  box-shadow: inset 0 0 0 1px #000;
  filter: none;
}
.pdf-preview {
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: 10px;
  margin: 0 0 10px;
  font-size: 12px;
}
#pdf-block { margin-top: 10px; }
#menu-backdrop {
  position: fixed;
  inset: 0;
  background: #0008;
  z-index: 7;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity var(--medium) var(--ease-out), visibility var(--medium);
}
body[data-menu="open"] #menu-backdrop {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}
#menu {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(280px, 86vw);
  background: #0a0a0a;
  border-left: 1px solid var(--line);
  z-index: 8;
  padding: calc(24px + var(--safe-top)) 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transform: translateX(100%);
  visibility: hidden;
  pointer-events: none;
  transition: transform 280ms var(--ease-out), visibility 280ms;
}
body[data-menu="open"] #menu {
  transform: none;
  visibility: visible;
  pointer-events: auto;
}
body[data-menu="closed"] #menu { transition-duration: 120ms; }
.menu-title { margin: 0 0 18px; }
#menu a {
  color: inherit;
  text-decoration: none;
  min-height: 44px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--line);
}
dialog {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #0a0a0a;
  color: var(--cream);
  padding: 28px;
  width: min(420px, calc(100vw - 32px));
}
dialog::backdrop { background: #000a; }
dialog h2 {
  margin: 0 0 8px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 26px;
  font-weight: 500;
}
#pay-amount { font-size: 28px; font-variant-numeric: tabular-nums; margin: 8px 0; }
.dialog-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 16px; }
.maplibregl-ctrl-bottom-right { right: 8px; bottom: 8px; }
.maplibregl-ctrl-attrib { font-size: 10px; }
.maplibregl-ctrl-group {
  border: 1px solid var(--line) !important;
  border-radius: 14px !important;
  overflow: hidden;
  background: var(--panel) !important;
}
.maplibregl-ctrl-group button { filter: invert(1); }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible {
  outline: 3px solid var(--orange);
  outline-offset: 3px;
}
@keyframes dust-fly {
  from { opacity: 1; transform: translate(0, 0) scale(0.92) rotate(0deg); }
  to { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(1.05) rotate(28deg); }
}
@media (hover: hover) and (pointer: fine) {
  .wordmark:hover, #menu-btn:hover, #filter-btn:hover { background: #141414; }
  .primary:hover, #go-btn:hover { filter: brightness(1.06); }
  .chip:hover { border-color: var(--cream); }
}
.wordmark:active, #menu-btn:active, #filter-btn:active, #audience button:active, .primary:active, #go-btn:active, .chip:active {
  transform: scale(0.97);
}
@media (max-width: 700px) {
  #wizard {
    top: calc(62px + var(--safe-top));
    width: min(360px, calc(100% - 24px));
    z-index: 7;
  }
  body[data-phase="quote"] #wizard,
  body[data-phase="results"] #wizard {
    padding: 10px 12px;
  }
  #census { padding: 10px 12px; }
  body[data-filter="open"] #filter-panel {
    max-height: min(28vh, 240px);
  }
  #results {
    top: calc(128px + var(--safe-top));
    right: calc(12px + var(--safe-right));
    left: calc(12px + var(--safe-left));
    bottom: auto;
    width: auto;
    max-height: 22vh;
  }
  body[data-filter="open"] #results { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .dust-bit, #menu, #menu-backdrop, #audience .thumb, #result-list li, .census-body {
    animation: none !important;
  }
  * { transition: none !important; }
  #result-list li { will-change: auto; }
}
