:root {
  color-scheme: light;
  --bg: #f7f7f6;
  --surface: #ffffff;
  --surface-muted: #eeeeec;
  --text: #111111;
  --subtle: #5f5f5b;
  --muted: #a0a09b;
  --line: #deded9;
  --accent: #171717;
  --accent-soft: #f1f1ee;
  --accent-mid: #e4e4df;
  --danger: #8f2f2f;
  --shadow: 0 22px 60px rgba(17, 17, 17, 0.12);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d0d0d;
  --surface: #171717;
  --surface-muted: #252525;
  --text: #f4f4f2;
  --subtle: #b4b4ae;
  --muted: #767670;
  --line: #343434;
  --accent: #f4f4f2;
  --accent-soft: #242424;
  --accent-mid: #303030;
  --danger: #e17070;
  --shadow: 0 22px 60px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-height: 100vh;
}

.report-stage {
  display: flex;
  flex-direction: column;
  width: 100%;
  min-height: 100vh;
  background: var(--bg);
}

.topbar {
  display: grid;
  grid-template-columns: 72px 1fr 72px;
  align-items: center;
  gap: 12px;
  padding: max(14px, env(safe-area-inset-top)) 20px 12px;
}

.ghost-button,
.icon-button {
  border: 0;
  background: transparent;
  color: var(--subtle);
  min-height: 44px;
}

.ghost-button {
  text-align: left;
  visibility: hidden;
}

.ghost-button.visible {
  visibility: visible;
}

.icon-button {
  justify-self: end;
  width: 44px;
  border-radius: 999px;
}

.icon-button:hover {
  background: var(--surface-muted);
}

.progress-dots {
  display: flex;
  justify-content: center;
  gap: 5px;
}

.dot {
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: var(--line);
  transition: width 160ms ease, background 160ms ease;
}

.dot.active {
  width: 18px;
  background: var(--accent);
}

.screen {
  flex: 1;
  overflow: auto;
  padding: 12px 22px 28px;
}

.action-bar {
  padding: 12px 22px max(18px, env(safe-area-inset-bottom));
  background: linear-gradient(180deg, transparent, var(--bg) 24%);
}

.report-status {
  margin: 0 22px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--subtle);
  padding: 12px 14px;
  font-size: 0.88rem;
  line-height: 1.45;
}

.primary-button,
.secondary-button,
.option-card,
.chip,
.detect-button {
  border-radius: 14px;
  border: 1.5px solid transparent;
}

.primary-button,
.secondary-button,
.detect-button {
  min-height: 50px;
}

.primary-button {
  width: 100%;
  border: 0;
  background: var(--accent);
  color: var(--surface);
  font-weight: 750;
}

.primary-button:disabled {
  background: var(--surface-muted);
  color: var(--muted);
  cursor: default;
}

.secondary-button {
  width: 100%;
  border-color: var(--line);
  background: var(--surface);
  color: var(--text);
  font-weight: 700;
}

.screen h2 {
  margin: 0 0 8px;
  font-size: clamp(1.85rem, 8vw, 2.35rem);
  line-height: 1.08;
  letter-spacing: 0;
}

.lede {
  margin: 0 0 24px;
  color: var(--subtle);
  line-height: 1.45;
}

.two-choice {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 26px;
}

.option-card {
  background: var(--surface);
  color: var(--text);
  padding: 18px 14px;
  min-height: 128px;
  text-align: left;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.02);
}

.option-card strong,
.category-row strong {
  display: block;
  font-size: 0.98rem;
}

.option-card span:not(.tile-icon),
.category-row span:not(.tile-icon):not(.checkmark) {
  display: block;
  margin-top: 5px;
  color: var(--subtle);
  font-size: 0.82rem;
  line-height: 1.35;
}

.option-card.selected,
.category-row.selected,
.chip.selected,
.segmented button.selected {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.field-label {
  margin: 28px 0 11px;
  color: var(--subtle);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.category-list {
  display: grid;
  gap: 9px;
}

.category-row {
  display: grid;
  grid-template-columns: 40px 1fr 22px;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border: 1.5px solid transparent;
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  text-align: left;
}

.category-row.inactive {
  color: var(--muted);
  cursor: not-allowed;
  opacity: 0.72;
}

.category-row.inactive .tile-icon {
  color: var(--muted);
}

.tile-icon,
.checkmark {
  display: grid;
  place-items: center;
  border-radius: 11px;
}

.option-card > .tile-icon,
.category-row > .tile-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  margin: 0 0 10px;
  background: var(--surface-muted);
  color: var(--accent);
  font-weight: 900;
}

.category-row > .tile-icon {
  margin: 0;
}

.checkmark {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 1.75px solid var(--muted);
  border-radius: 6px;
  color: transparent;
  font-size: 0.9rem;
  font-weight: 900;
  line-height: 1;
}

.selected .checkmark {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--surface);
}

.inactive .checkmark {
  border-color: var(--line);
  background: var(--surface-muted);
}

.chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.symptom-grid,
.badge-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.chip {
  min-height: 42px;
  padding: 9px 14px;
  background: var(--surface-muted);
  color: var(--subtle);
  font-weight: 700;
}

.chip.selected {
  color: var(--text);
}

.symptom-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 112px;
  max-width: 100%;
  min-width: 0;
  padding: 10px 4px;
  text-align: center;
  white-space: normal;
  width: 100%;
}

.symptom-badge {
  width: clamp(56px, 18vw, 72px);
  height: clamp(56px, 18vw, 72px);
  flex: 0 0 clamp(56px, 18vw, 72px);
  object-fit: contain;
}

.symptom-chip span {
  min-width: 0;
  font-size: 0.72rem;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.input-row,
.text-area {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
}

.input-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  min-height: 54px;
  border-radius: 13px;
  overflow: hidden;
}

.input-row input {
  width: 100%;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  padding: 15px 14px;
  outline: 0;
  font-weight: 700;
}

.date-field {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 54px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
  color: var(--muted);
  padding: 0 14px;
  text-align: left;
}

.date-field:hover,
.date-field:focus-visible {
  border-color: var(--accent);
  outline: 0;
}

.date-field.has-value {
  color: var(--text);
}

.date-field-icon {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  color: var(--subtle);
}

.date-field-value {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
}

.date-field-caret,
.calendar-chevron {
  display: inline-block;
  width: 8px;
  height: 8px;
  border: solid currentColor;
  border-width: 0 2px 2px 0;
}

.date-field-caret {
  color: var(--subtle);
  transform: rotate(45deg);
}

.detect-button {
  margin-right: 4px;
  border: 0;
  background: transparent;
  color: var(--subtle);
  padding: 0 12px;
}

.detect-button:disabled {
  opacity: 0.6;
}

.text-area {
  min-height: 92px;
  resize: vertical;
  border-radius: 13px;
  padding: 14px;
  outline: 0;
}

.photo-button {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 54px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
  padding: 0 16px;
  color: var(--subtle);
  font-weight: 700;
}

.photo-button:hover,
.photo-button:focus-visible {
  background: var(--accent-soft);
  color: var(--text);
  outline: 0;
}

.photo-button:disabled,
.photo-remove-button:disabled {
  cursor: wait;
  opacity: 0.6;
}

.photo-picker {
  display: grid;
  gap: 10px;
}

.photo-summary {
  margin: 0;
  color: var(--subtle);
  font-size: 0.82rem;
  line-height: 1.35;
}

.photo-list {
  display: grid;
  gap: 8px;
}

.photo-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
  padding: 10px 12px;
}

.photo-name,
.photo-meta {
  min-width: 0;
}

.photo-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
}

.photo-meta {
  color: var(--subtle);
  font-size: 0.78rem;
}

.photo-status {
  grid-column: 1 / -1;
  color: var(--subtle);
  font-size: 0.78rem;
  line-height: 1.35;
}

.photo-status.error {
  color: var(--danger);
}

.photo-remove-button {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--text);
  padding: 0 12px;
  font-size: 0.82rem;
  font-weight: 700;
}

.field-error {
  margin: 0;
  color: var(--danger);
  font-size: 0.82rem;
  line-height: 1.35;
}

.field-status {
  margin: 0;
  color: var(--subtle);
  font-size: 0.82rem;
  line-height: 1.35;
}

.calendar-modal-open {
  overflow: hidden;
}

.calendar-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  align-items: end;
}

.calendar-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  border: 0;
  background: rgba(0, 0, 0, 0.34);
}

.calendar-sheet {
  position: relative;
  width: 100%;
  max-height: calc(100vh - 28px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 24px 24px 0 0;
  background: var(--bg);
  padding: 16px 18px max(24px, env(safe-area-inset-bottom));
  box-shadow: var(--shadow);
}

.calendar-grabber {
  width: 44px;
  height: 4px;
  margin: 0 auto 16px;
  border-radius: 999px;
  background: var(--line);
}

.calendar-sheet-heading,
.calendar-month-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.calendar-sheet-heading {
  margin-bottom: 14px;
}

.calendar-sheet-heading .field-label {
  margin: 0 0 4px;
}

.calendar-sheet-heading h3 {
  margin: 0;
  font-size: 1.12rem;
  line-height: 1.2;
}

.calendar-close,
.calendar-nav {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 0;
  background: var(--surface-muted);
  color: var(--text);
}

.calendar-close {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  font-weight: 800;
}

.calendar-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  padding: 12px;
}

.calendar-month-bar {
  margin-bottom: 12px;
}

.calendar-month-bar strong {
  min-width: 0;
  color: var(--text);
  font-size: 1rem;
  text-align: center;
}

.calendar-nav {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  color: var(--subtle);
}

.calendar-chevron.previous {
  transform: rotate(135deg);
}

.calendar-chevron.next {
  transform: rotate(-45deg);
}

.calendar-weekdays,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.calendar-weekdays {
  margin-bottom: 4px;
}

.calendar-weekdays span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1;
  text-align: center;
}

.calendar-grid {
  gap: 4px;
}

.calendar-day,
.calendar-day-placeholder {
  aspect-ratio: 1;
  min-width: 0;
}

.calendar-day {
  display: grid;
  place-items: center;
  min-height: 38px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 700;
}

.calendar-day:not(:disabled):hover,
.calendar-day:not(:disabled):focus-visible,
.calendar-nav:hover,
.calendar-nav:focus-visible,
.calendar-close:hover,
.calendar-close:focus-visible {
  background: var(--accent-soft);
  outline: 0;
}

.calendar-day.today {
  border: 1.4px solid var(--accent-mid);
  background: var(--accent-soft);
}

.calendar-day.selected {
  background: var(--accent);
  color: var(--surface);
  font-weight: 850;
}

.calendar-day:disabled,
.calendar-day.future {
  color: var(--muted);
  cursor: not-allowed;
  opacity: 0.42;
}

.done-view {
  min-height: 100%;
  display: grid;
  align-content: center;
  gap: 14px;
  text-align: center;
}

.done-icon {
  justify-self: center;
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--surface);
  font-size: 2rem;
  font-weight: 900;
}

.nearby-card,
.summary-card,
.map-panel,
.front-door-map-panel,
.mobile-map-panel,
pre {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 8px;
}

.nearby-card {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.nearby-card .metric,
.summary-card .metric {
  display: block;
  font-size: 2rem;
  font-weight: 850;
}

.metric-pair {
  display: grid;
  gap: 3px;
}

.metric-pair + .metric-pair {
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  align-items: end;
  background: rgba(0, 0, 0, 0.34);
  padding-top: 30px;
}

.settings-sheet {
  width: 100%;
  max-height: calc(100vh - 30px);
  overflow: auto;
  border-radius: 28px 28px 0 0;
  background: var(--surface);
  padding: 26px 22px max(34px, env(safe-area-inset-bottom));
}

.sheet-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.sheet-heading h2 {
  margin: 0;
}

.option-list {
  display: grid;
  gap: 8px;
}

.language-option {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 64px;
  border: 1.5px solid transparent;
  border-radius: 16px;
  background: var(--surface-muted);
  color: var(--text);
  padding: 12px 16px;
  text-align: left;
}

.language-option span {
  display: block;
  color: var(--subtle);
  font-size: 0.78rem;
}

.language-option.selected {
  border-color: var(--text);
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.segmented button {
  min-height: 50px;
  border: 1.5px solid transparent;
  border-radius: 14px;
  background: var(--surface-muted);
  color: var(--subtle);
  font-weight: 750;
}

.eyebrow {
  margin: 0;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.summary-card {
  padding: 18px;
}

.map-panel,
.front-door-map-panel,
.mobile-map-panel {
  overflow: hidden;
}

.front-door-map-panel {
  margin: 18px 0 0;
}

.map-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 14px 10px;
  text-align: left;
}

.map-heading h2,
.map-heading h3 {
  margin: 4px 0 0;
  font-size: 1rem;
  line-height: 1.2;
  letter-spacing: 0;
}

.front-door-map .mapboxgl-ctrl-bottom-left,
.front-door-map .mapboxgl-ctrl-bottom-right {
  display: none;
}

.map-count {
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--text);
  padding: 6px 9px;
  font-size: 0.75rem;
  font-weight: 800;
  line-height: 1;
}

.report-map {
  position: relative;
  width: 100%;
  min-height: clamp(280px, 44vw, 390px);
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(103, 169, 207, 0.22), rgba(239, 138, 98, 0.18)),
    var(--surface-muted);
}

.report-map.compact {
  min-height: 0;
  height: clamp(210px, 62vw, 250px);
}

/* PREVIEW (Map Lab): roomy front-door map so the dataset is easy to eyeball. */
.front-door-map.compact {
  height: clamp(380px, 56vh, 760px);
}

.map-lab-section {
  padding: 12px 0 4px;
  border-top: 1px solid var(--line);
}

.map-lab-section:first-of-type {
  border-top: none;
}

.map-lab-section-title {
  margin: 0 0 4px;
  padding: 0 14px;
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text);
}

.map-lab-section-hint {
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
  color: var(--subtle);
}

.map-lab-section-note {
  margin: 0 0 10px;
  padding: 0 14px;
  font-size: 0.76rem;
  line-height: 1.4;
  color: var(--subtle);
}

.map-lab-shading-options:empty {
  display: none;
}

.map-lab-shading-options {
  margin: 4px 0 0 14px;
  padding-top: 10px;
  border-left: 2px solid var(--line);
}

.map-lab-shading-options .map-lab-toggle {
  padding-left: 12px;
}

.map-lab-toggle {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 0 14px 12px;
}

.map-lab-toggle-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--subtle);
  margin-right: 2px;
}

.map-lab-toggle button {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 0.8rem;
  font-weight: 700;
  min-height: 36px;
}

.map-lab-toggle button.active {
  background: var(--text);
  color: var(--surface);
  border-color: var(--text);
}

.map-lab-swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}

.map-lab-emoji {
  margin-right: 6px;
  font-size: 0.95rem;
  line-height: 1;
  vertical-align: middle;
}

.map-lab-breadcrumb-slot:empty {
  display: none;
}

.map-lab-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 14px 12px;
  padding: 7px 10px 7px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 0.8rem;
}

.map-lab-breadcrumb-home {
  border: none;
  background: none;
  color: var(--accent, #2563eb);
  font-weight: 700;
  padding: 0;
  cursor: pointer;
}

.map-lab-breadcrumb-sep {
  color: var(--subtle);
}

.map-lab-breadcrumb-current {
  font-weight: 700;
  color: var(--text);
}

.map-lab-breadcrumb-close {
  margin-left: auto;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  border-radius: 999px;
  width: 26px;
  height: 26px;
  line-height: 1;
  font-size: 0.95rem;
  cursor: pointer;
}

.zip-popup {
  font-size: 0.82rem;
  line-height: 1.4;
}

.zip-popup strong {
  display: block;
  font-size: 0.9rem;
  margin-bottom: 2px;
}

.zip-popup-sick {
  color: #dc2626;
  font-weight: 700;
}

.zip-popup-healthy {
  color: #16a34a;
  font-weight: 700;
}

.zip-popup-sub {
  color: var(--subtle);
  margin-top: 2px;
}

.zip-popup-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.zip-popup-head strong {
  display: inline;
  margin-bottom: 0;
}

.zip-popup-pop {
  color: var(--subtle);
  font-size: 0.74rem;
  white-space: nowrap;
}

.zip-popup-share {
  display: flex;
  align-items: center;
  font-weight: 700;
}

.zip-popup-swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  margin-right: 6px;
  border: 1px solid rgba(0, 0, 0, 0.15);
}

.zip-popup-split {
  margin-top: 1px;
}

.zip-popup-total {
  margin-top: 1px;
}

.zip-popup-note {
  color: var(--subtle);
  font-size: 0.74rem;
  font-style: italic;
  margin-top: 2px;
}

.zip-popup-divider {
  height: 1px;
  background: var(--border, rgba(0, 0, 0, 0.12));
  margin: 6px 0;
}

.zip-popup-cross {
  color: var(--ink, inherit);
}

.map-note {
  margin: 0;
  padding: 10px 14px 14px;
  color: var(--subtle);
  font-size: 0.82rem;
  line-height: 1.35;
  text-align: left;
}

.report-dot-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  align-items: center;
  padding: 12px 14px 0;
  color: var(--subtle);
  font-size: 0.95rem;
  font-weight: 750;
  line-height: 1.3;
  text-align: left;
}

.report-dot-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.report-dot {
  width: 10px;
  height: 10px;
  border: 1.5px solid #ffffff;
  border-radius: 999px;
  box-shadow: 0 0 0 1px rgba(23, 23, 23, 0.18);
}

.report-dot.red {
  background: #dc2626;
}

.report-dot.green {
  background: #16a34a;
}

.legend-gradient-wrap {
  gap: 6px;
}

.legend-gradient {
  display: inline-block;
  width: 100px;
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(90deg, #fecc5c, #fd8d3c, #bd0026);
  box-shadow: 0 0 0 1px rgba(23, 23, 23, 0.18);
}

/* "3 bands" color mode: hard-edged 25/50/25 swatch matching the discrete choropleth. */
.legend-gradient.banded {
  background: linear-gradient(
    90deg,
    #fecc5c 0 25%,
    #fd8d3c 25% 75%,
    #bd0026 75% 100%
  );
}

.legend-size {
  width: 15px;
  height: 15px;
  border-radius: 999px;
  background: #b1362f;
  border: 1.5px solid #ffffff;
  box-shadow: 0 0 0 1px rgba(23, 23, 23, 0.18);
}

.legend-opacity {
  display: inline-block;
  width: 48px;
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(177, 54, 47, 0.12), rgba(177, 54, 47, 0.9));
  box-shadow: 0 0 0 1px rgba(23, 23, 23, 0.18);
}

/* Mirrors the map's "no ZIP code" diagonal hatch (see diagonalHatchImageData). */
.legend-nonzip {
  display: inline-block;
  width: 15px;
  height: 15px;
  border-radius: 3px;
  background: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 5px,
    rgba(100, 116, 139, 0.85) 5px,
    rgba(100, 116, 139, 0.85) 6.5px
  );
  box-shadow: 0 0 0 1px rgba(23, 23, 23, 0.18);
}

.map-fallback {
  display: grid;
  place-content: center;
  min-height: inherit;
  padding: 22px;
  color: var(--subtle);
  text-align: center;
}

.map-fallback strong {
  display: block;
  margin-bottom: 6px;
  color: var(--text);
}

.map-fallback span {
  display: block;
  max-width: 34ch;
  line-height: 1.4;
}

.map-debug {
  border-top: 1px solid var(--line);
  padding: 10px 14px 14px;
  color: var(--subtle);
  text-align: left;
}

.map-debug summary {
  color: var(--text);
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.map-debug dl {
  display: grid;
  gap: 8px;
  margin: 10px 0 0;
}

.map-debug div {
  display: grid;
  gap: 2px;
}

.map-debug dt,
.map-debug dd {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.35;
}

.map-debug dt {
  color: var(--text);
  font-weight: 750;
}

pre {
  overflow: auto;
  max-height: 320px;
  margin: 0;
  padding: 16px;
  color: var(--subtle);
  font-size: 0.78rem;
  line-height: 1.45;
}

.submit-status {
  margin: 0;
  color: var(--subtle);
  font-size: 0.9rem;
  line-height: 1.45;
}

.debug-trigger {
  position: fixed;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 20;
  min-height: 44px;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: var(--shadow);
  color: var(--surface);
  padding: 0 18px;
  font-weight: 800;
}

.debug-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(0, 0, 0, 0.42);
}

.debug-panel {
  position: fixed;
  inset: 0 0 0 auto;
  z-index: 31;
  width: min(480px, 100vw);
  overflow: auto;
  border-left: 1px solid var(--line);
  background: var(--bg);
  box-shadow: -20px 0 60px rgba(17, 17, 17, 0.2);
  padding: max(22px, env(safe-area-inset-top)) 20px max(30px, env(safe-area-inset-bottom));
}

.debug-panel-open {
  overflow: hidden;
}

.debug-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.debug-heading h2 {
  margin: 4px 0 0;
  font-size: 1.65rem;
}

.debug-intro {
  margin: 10px 0 20px;
  color: var(--subtle);
  line-height: 1.5;
}

.debug-content {
  display: grid;
  gap: 18px;
}

.debug-content .field-label {
  margin: 8px 0 -8px;
}

.debug-content .report-map {
  min-height: 300px;
}

@media (min-width: 760px) {
  .app-shell {
    display: block;
    min-height: 0;
    padding: clamp(32px, 6vw, 72px) clamp(24px, 5vw, 72px);
  }

  .report-stage {
    display: block;
    width: min(100%, 960px);
    min-height: 0;
    margin: 0 auto;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    overflow: visible;
  }

  /* PREVIEW (Map Lab): let the map panel break out wider than the text column. */
  .front-door-map-panel {
    width: min(92vw, 1200px);
    position: relative;
    left: 50%;
    transform: translateX(-50%);
  }

  .topbar {
    grid-template-columns: 1fr auto;
    border: 0;
    padding: 0 0 clamp(28px, 4vw, 42px);
  }

  .topbar .ghost-button {
    grid-column: 1;
    grid-row: 1;
    width: fit-content;
  }

  .topbar .progress-dots {
    display: none;
  }

  #settingsButton {
    grid-column: 2;
    grid-row: 1;
    width: auto;
    padding: 0 10px;
    font-size: 0.88rem;
    font-weight: 700;
  }

  #settingsButton span {
    display: none;
  }

  #settingsButton::after {
    content: "Language & theme";
  }

  .screen {
    overflow: visible;
    padding: 0;
  }

  .calendar-modal {
    align-items: center;
    justify-items: center;
    padding: 28px;
  }

  .calendar-sheet {
    width: min(460px, 100%);
    border-radius: 24px;
    padding: 18px;
  }

  .screen h2 {
    max-width: 20ch;
    font-size: clamp(2.35rem, 5vw, 3.15rem);
  }

  .lede {
    max-width: 58ch;
    font-size: 1.05rem;
  }

  .category-list {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
  }

  .category-row {
    min-height: 124px;
    border-color: var(--line);
    background: var(--surface);
    padding: 18px;
  }

  .two-choice {
    gap: 14px;
  }

  .symptom-grid,
  .badge-grid {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  }

  .symptom-chip {
    gap: 7px;
    min-height: 124px;
    padding: 12px 10px;
  }

  .symptom-chip span {
    font-size: 0.78rem;
  }

  .option-card {
    min-height: 150px;
    border-color: var(--line);
    background: var(--surface);
    padding: 22px 20px;
  }

  .done-view h2 {
    justify-self: center;
    width: 100%;
    max-width: none;
  }

  .report-status {
    width: 100%;
    max-width: none;
    margin: 28px 0 0;
  }

  .action-bar {
    display: flex;
    justify-content: flex-start;
    border: 0;
    background: transparent;
    padding: 30px 0 0;
  }

  .action-bar .primary-button {
    width: 100%;
  }

  .settings-sheet {
    justify-self: center;
    width: min(460px, calc(100vw - 32px));
    border-radius: 28px;
    margin-bottom: 30px;
  }
}

@media (max-width: 360px) {
  .screen {
    padding-inline: 16px;
  }

  .action-bar {
    padding-inline: 16px;
  }

  .two-choice {
    grid-template-columns: 1fr;
  }
}
