:root {
  color-scheme: light;
  font-family: Arial, Helvetica, sans-serif;
  --ink: #243627;
  --muted: #4d5e51;
  --county-blue: #006597;
  --field-green: #315738;
  --field-dark: #24452a;
  --field-light: #e8f0e4;
  --rule: #d5ded0;
  --ditch: #97518e;
  --ditch-label: #63285e;
  --damage: #ffdc32;
  --damage-outline: #211e13;
  --control-gap: .75rem;
  color: var(--ink);
  background: #f3f5ed;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
main { padding-top: .75rem; }
h1, h2, p { margin: 0; }
button, input, select, textarea { font: inherit; }
button, select { cursor: pointer; }
button:disabled { cursor: default; opacity: .6; }
:focus-visible { outline: 3px solid var(--county-blue); outline-offset: 3px; }
.page-width { width: min(100% - 3rem, 1340px); margin-inline: auto; }
.county-bar { background: #fff; border-bottom: 3px solid var(--county-blue); }
.county-bar .page-width { display: flex; align-items: center; gap: clamp(.75rem, 2vw, 2rem); min-height: 4.35rem; padding-block: .4rem; }
.county-logo { display: block; width: min(11.75rem, 32%); height: auto; flex: none; }
.header-actions { display: flex; flex-shrink: 0; flex-wrap: wrap; gap: var(--control-gap); margin-left: auto; }
h1 {
  color: var(--field-dark);
  font: 700 clamp(1.35rem, 3vw, 2.2rem) / 1.08 Arial, Helvetica, sans-serif;
  letter-spacing: -.02em;
}
.banner { padding: .75rem 1rem; background: #fff4dc; color: #664913; border: 1px solid #ebd39d; border-radius: .55rem; margin-bottom: .6rem; }
.step-progress { color: var(--field-dark); font-weight: 700; margin-bottom: .55rem; }
.step-instructions { line-height: 1.4; margin: .4rem 0 .55rem; }
#expanded-step-progress { margin: .4rem 0 0; padding: .25rem .75rem 0; }
#layout:not([data-active-step="home"]) .home-panel,
#layout:not([data-active-step="choose"]) .choice-panel,
#layout:not([data-active-step="map"]) .map-panel,
#layout:not([data-active-step="review"]) .queue-panel,
#layout:is([data-active-step="home"], [data-active-step="choose"], [data-active-step="map"], [data-active-step="review"]) .form-panel:not(.choice-panel),
#layout:not([data-active-step="damage"]) [data-form-step="damage"],
#layout:not([data-active-step="impact"]) [data-form-step="impact"],
#layout:not([data-active-step="contact"]) [data-form-step="contact"] { display: none; }
.panel { background: white; border: 1px solid var(--rule); border-radius: .85rem; overflow: hidden; box-shadow: 0 3px 12px #2436270a; }
h2 { font: 700 1.3rem / 1.2 Arial, Helvetica, sans-serif; }
h2 small { color: var(--muted); font: 500 .72rem / 1.2 Arial, Helvetica, sans-serif; margin-left: .25rem; }
.panel-head, .map-footer, .queue-head { display: flex; align-items: center; justify-content: space-between; gap: .6rem; }
.panel-head { min-height: 3rem; padding: .35rem .75rem; }
.map-panel .panel-head { border-bottom: 1px solid var(--rule); margin-bottom: .35rem; }
.map-controls, .map-footer-actions, .legend, .draw-actions, .add-actions, .queue-actions, .choice-actions { display: flex; align-items: center; flex-wrap: wrap; gap: var(--control-gap); }
#map { width: 100%; height: auto; min-height: 145px; flex: 1 1 0; background: #e1e9de; }
#map.drawing { cursor: crosshair; }
.map-footer { flex-wrap: wrap; border-top: 1px solid var(--rule); padding: .35rem .75rem; }
.map-footer-actions { margin-left: auto; justify-content: flex-end; }
.legend { color: var(--muted); font-size: .875rem; gap: .9rem; }
.legend span { display: flex; align-items: center; gap: .35rem; }
.legend i { width: 1.15rem; border-top: 3px solid var(--ditch); border-radius: 2px; }
.legend .damage-swatch { height: .43rem; background: var(--damage); border: 1px solid var(--damage-outline); }
.map-status { padding: 0 1rem .7rem; font-size: .875rem; color: var(--muted); }
.map-status:empty { display: none; }
.form-panel, .queue-panel { padding: .7rem .8rem; }
.form-panel, .queue-panel { max-width: 48rem; margin-inline: auto; padding: clamp(.85rem, 2vw, 1.5rem); }
.form-group { min-width: 0; }
.form-group h2 { padding-bottom: .55rem; border-bottom: 1px solid var(--rule); }
.form-group > .help { margin-top: .45rem; }
.contact-fields, .field-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .45rem; align-items: end; }
.contact-fields { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.contact-group .help { margin-top: .2rem; }
.map-drawing { padding: .35rem .75rem .45rem; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.field { display: block; margin-top: .55rem; font-size: 1rem; line-height: 1.25; font-weight: 650; }
.field input, .field select, .field textarea { display: block; margin-top: .15rem; width: 100%; min-width: 0; }
.field small { float: right; font-size: .8rem; font-weight: 450; color: var(--muted); }
.help { font-size: .78rem; line-height: 1.35; color: var(--muted); font-weight: 400; }
.field .help { display: block; margin-top: .25rem; }
input, select, textarea, button { border: 1px solid #aebdab; border-radius: .4rem; background: white; color: var(--ink); }
input, select, textarea { padding: .48rem .55rem; font-weight: 400; }
textarea { resize: vertical; min-height: 2.75rem; }
input[type="file"] { padding: .22rem; font-size: .8rem; }
input::file-selector-button { font: inherit; color: var(--field-green); background: var(--field-light); border: 0; border-radius: .3rem; padding: .38rem .55rem; margin-right: .5rem; cursor: pointer; }
button, .map-controls select, .map-options summary { padding: .3rem .6rem; min-height: 2.75rem; font-size: .95rem; font-weight: 650; }
button:hover:enabled { background: var(--field-light); }
.subtle { color: var(--field-green); }
.map-controls select:hover:enabled, .map-options summary:hover { background: var(--field-light); }
.map-options { position: relative; }
.map-options[open] { z-index: 1101; }
.map-options summary { cursor: pointer; align-content: center; white-space: nowrap; border-radius: .4rem; }
.map-options-menu {
  position: absolute;
  inset: calc(100% + .25rem) 0 auto auto;
  display: grid;
  gap: var(--control-gap);
  width: 13rem;
  max-height: min(24rem, 68dvh);
  overflow: auto;
  padding: .6rem;
  border: 1px solid #aebdab;
  border-radius: .4rem;
  background: white;
  box-shadow: 0 4px 12px #24362730;
}
.map-options-menu button { text-align: left; }
.basemap-option, .map-layer-options legend { font-size: .85rem; font-weight: 700; }
.map-layer-options { margin: .25rem 0; }
.map-layer-options label { display: flex; align-items: center; gap: .45rem; min-height: 2.35rem; cursor: pointer; }
.map-layer-options input { margin: 0; accent-color: var(--field-green); }
.modes { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem; }
.modes [aria-pressed="true"], .outline { background: var(--field-light); color: var(--field-dark); border-color: #72906b; }
#map-instruction { font-size: 1.05rem; font-weight: 700; line-height: 1.35; }
#location-status { flex-basis: 100%; color: var(--muted); font-size: .85rem; }
.add-actions, .queue-actions { margin-top: .15rem; }
.queue-panel { grid-column: 1 / -1; }
.queue-head { margin-bottom: .5rem; }
#queue-count { color: var(--muted); font-size: .875rem; }
.queue, .photo-list { padding: 0; margin: 0; list-style: none; }
.queue li, .photo-list li { display: flex; justify-content: space-between; gap: .6rem; align-items: center; padding: .22rem 0; border-bottom: 1px solid var(--rule); }
.queue li > div:first-child, .photo-list li span { min-width: 0; overflow-wrap: anywhere; }
.queue li strong { display: block; }
.queue li div:last-child { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--control-gap); }
.photo-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 9rem), 1fr)); gap: var(--control-gap); font-size: .75rem; }
.photo-list li { gap: .15rem; }
.photo-list button { min-width: 2.75rem; padding-inline: .25rem; }
.photo-list li span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.primary { color: white; background: var(--field-green); border-color: var(--field-green); }
.primary:hover:enabled { background: var(--field-dark); }
.form-message { margin-top: .65rem; color: var(--field-dark); font-size: .9rem; overflow-wrap: anywhere; }
.form-message.error, #location-status.error { color: #912b18; font-weight: 700; }
footer { display: flex; flex-wrap: wrap; gap: .25rem 1rem; color: var(--muted); font-size: .85rem; padding: .4rem 0; }
footer a { color: var(--county-blue); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.step-actions, .add-actions { display: flex; justify-content: space-between; flex-wrap: wrap; gap: var(--control-gap); margin-top: .85rem; }
.step-actions .primary, .add-actions .primary { margin-left: auto; }
.map-panel { display: flex; flex-direction: column; height: calc(100dvh - 10rem); min-height: min-content; }
.map-panel > :not(#map) { flex: none; }
.map-panel .step-actions { margin: .45rem .75rem .65rem; }
#queue-actions:not([hidden]) ~ .step-actions { display: none; }
.queue-pagination { display: flex; flex-wrap: wrap; gap: var(--control-gap); align-items: center; font-size: .76rem; margin-block: var(--control-gap); }
.queue-actions .help { flex-basis: 100%; }
.map-search { display: flex; position: relative; align-items: center; gap: var(--control-gap); padding: 0 .75rem .4rem; }
.map-search input { flex: 1; min-width: 0; min-height: 2.75rem; font-size: 1rem; }
.search-response { position: absolute; z-index: 1100; top: calc(100% - .4rem); left: .75rem; right: .75rem; background: white; border: 1px solid var(--rule); border-radius: .4rem; box-shadow: 0 5px 14px #24362730; padding: .35rem; max-height: 48dvh; overflow: auto; }
.search-response ul { margin: 0; padding: 0; list-style: none; }
.search-response li + li { margin-top: var(--control-gap); }
.search-response button { width: 100%; text-align: left; }
.ditch-name-label.leaflet-tooltip { color: var(--ditch-label); border: 0; background: #fffcf4eb; box-shadow: 0 1px 3px #15151542; padding: 1px 4px; border-radius: 2px; font: 600 11px/1.3 Arial, Helvetica, sans-serif; }
.ditch-name-label::before { display: none; }
.damage-type-label.leaflet-tooltip { color: var(--damage-outline); background: #fff8dc; border: 1px solid var(--damage-outline); padding: 2px 5px; font: 700 12px/1.3 Arial, Helvetica, sans-serif; }
.damage-type-label::before { display: none; }
#report-help { width: min(32rem, 100% - 2rem); max-height: calc(100dvh - 2rem); padding: 1.15rem; color: var(--ink); background: white; border: 2px solid var(--field-green); border-radius: .8rem; }
dialog::backdrop { background: #14251bb3; }
.home-panel {
  display: grid;
  grid-template-columns: minmax(17rem, 22rem) minmax(0, 1fr);
  grid-template-rows: auto 1fr;
  grid-template-areas: "intro map" "lookup map";
  gap: 1rem;
  align-items: start;
}
.home-intro { grid-area: intro; }
.home-lookup { grid-area: lookup; }
.home-intro, .home-lookup { display: grid; gap: var(--control-gap); padding: clamp(1rem, 2vw, 1.4rem); }
.home-intro h2 { font-size: 1.5rem; }
.home-intro p, .home-lookup p { line-height: 1.45; }
.home-intro .primary { min-height: 3rem; }
.home-map-card { grid-area: map; min-width: 0; }
.home-map-card .panel-head { flex-wrap: wrap; padding: .75rem 1rem; }
.home-map-card .panel-head h2 { margin-bottom: .2rem; }
.home-map-card .map-controls { margin-left: auto; }
.reported-damage-note { padding: 0 1rem .75rem; font-size: .8rem; line-height: 1.4; color: var(--muted); }
.report-reference-search { display: flex; flex-wrap: wrap; align-items: center; gap: var(--control-gap); }
.report-reference-search input { flex: 1 1 10rem; width: 0; min-width: 0; min-height: 2.75rem; }
#reported-damage-map { height: clamp(25rem, 64svh, 46rem); background: #e1e9de; }
:is(#map, #reported-damage-map) .leaflet-control-zoom { border: 0; box-shadow: none; }
:is(#map, #reported-damage-map) .leaflet-control-zoom a { border: 1px solid #aebdab; border-radius: .35rem; }
:is(#map, #reported-damage-map) .leaflet-control-zoom a + a { margin-top: .5rem; }
#reported-damage-status:empty { display: none; }
.legend .report-point-swatch { width: .72rem; height: .72rem; border: 2px solid var(--damage-outline); border-radius: 50%; background: var(--damage); }
.legend .report-line-swatch { height: .38rem; background: var(--damage); border: 1px solid var(--damage-outline); }
#report-help h2 { font-size: 1.3rem; }
#report-help h2:focus { outline: none; }
#report-help section { margin-top: .7rem; padding-top: .6rem; border-top: 1px solid var(--rule); }
#report-help h3 { margin: 0; color: var(--field-dark); font-size: 1rem; }
#report-help p, #report-help li { margin-top: .3rem; font-size: .95rem; line-height: 1.35; }
#report-help ol { margin: .3rem 0 .55rem; padding-left: 1.4rem; }
#report-help form { display: flex; justify-content: end; margin-top: .9rem; }

@media (max-width: 850px) {
  .home-panel { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto; grid-template-areas: "intro" "map" "lookup"; gap: .75rem; }
  .home-intro, .home-lookup { padding: 1rem; }
  #reported-damage-map { height: clamp(20rem, 60svh, 36rem); }
}

@media (max-width: 700px) {
  .page-width { width: calc(100% - 1rem); }
  main { padding-top: .5rem; }
  .county-bar .page-width { min-height: 3.25rem; gap: .55rem; }
  .county-logo { width: min(9.5rem, 29%); }
  .county-bar button { padding-inline: .4rem; }
  .header-actions { gap: .5rem; }
  .contact-fields { display: block; }
  .map-panel { height: auto; }
  .map-panel .panel-head { margin: 0; min-height: 0; padding: .15rem .55rem; }
  .map-panel .panel-head h2 { font-size: 1.05rem; }
  .map-controls { flex: 0 1 auto; justify-content: flex-end; }
  .map-options summary, .map-footer-actions button { font-size: .82rem; }
  .map-drawing { padding: .35rem .55rem; }
  #map-instruction { font-size: .9rem; }
  .map-search { padding-inline: .55rem; }
  #map { flex: none; height: max(20rem, 62svh); }
  :is(#map, #reported-damage-map) .leaflet-control-zoom a { width: 44px; height: 44px; line-height: 44px; }
  .map-footer { padding: .4rem .55rem; gap: var(--control-gap); }
  .legend { font-size: .75rem; gap: .3rem .65rem; }
}
@media (max-width: 420px) {
  .county-bar h1 { font-size: 1.15rem; }
  .home-map-card .panel-head { padding: .65rem .75rem; }
  #report-help { width: calc(100% - 1rem); max-height: calc(100dvh - 1rem); padding: .8rem; }
  #report-help section { margin-top: .5rem; padding-top: .45rem; }
  #report-help form { margin-top: .65rem; }
}
.expanded-only { display: none; }
#expanded-map {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: #fff;
}
#expanded-map .map-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: min-content;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
#expanded-map .map-panel > :not(#map) { flex: none; }
#expanded-map #map { flex: 1 1 0; height: auto; min-height: 145px; }
#expanded-map .expanded-only { display: inline-block; }
#expanded-map #expand-map, #expanded-map .step-actions { display: none; }

.choice-panel .modes { gap: var(--control-gap); margin: .85rem 0; }
.choice { padding: .75rem; text-align: left; line-height: 1.35; border-color: var(--field-green); }
.choice strong, .choice span { display: block; }
.choice strong { color: var(--field-dark); font-size: 1.1rem; }
.choice span { margin-top: .25rem; font-weight: 400; }
@media (max-width: 560px) {
  .choice-panel .modes { grid-template-columns: 1fr; }
}
