/* LandRush web app. Desktop-first (3 users, desktop only), plain CSS, no build step. */
:root {
  --bg: #f7f7f5; --panel: #ffffff; --ink: #1d1f21; --muted: #6b7075; --line: #dcdfe3;
  --accent: #2f5d50; --accent-ink: #ffffff; --error: #a8322d; --error-bg: #fbeceb;
  --tier-A: #2e7d32; --tier-B: #6a9a2a; --tier-C: #c98a12; --tier-D: #a8322d;
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); }
a { color: var(--accent); }
main { padding: 16px 24px 48px; max-width: 1600px; }
h1 { font-size: 22px; margin: 8px 0 12px; }
h1 .sub { font-size: 14px; font-weight: normal; color: var(--muted); margin-left: 8px; }
h2 { font-size: 15px; margin: 0 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

.topbar { display: flex; align-items: center; gap: 24px; padding: 8px 24px;
          background: var(--accent); color: var(--accent-ink); }
.topbar a { color: var(--accent-ink); text-decoration: none; }
.topbar .brand { font-weight: 700; font-size: 16px; }
/* The menu: separate items with a hover and a highlighted current page. */
.topbar nav { display: flex; align-items: center; gap: 4px; padding-left: 20px;
              border-left: 1px solid rgba(255, 255, 255, .3); }
.topbar nav a { display: inline-block; padding: 5px 12px; border-radius: 4px; font-weight: 500;
                color: rgba(255, 255, 255, .85); }
.topbar nav a:hover { background: rgba(255, 255, 255, .12); color: var(--accent-ink); }
.topbar nav a[aria-current="page"] { background: rgba(255, 255, 255, .2); color: var(--accent-ink); font-weight: 600; }
.topbar .who { margin-left: auto; display: flex; gap: 12px; align-items: center; }
button.link { background: none; border: 0; color: inherit; text-decoration: underline; cursor: pointer; padding: 0; font: inherit; }

button, .reset { font: inherit; padding: 5px 12px; border-radius: 4px; }
button { background: var(--accent); color: var(--accent-ink); border: 1px solid var(--accent); cursor: pointer; }
input, select { font: inherit; padding: 4px 6px; border: 1px solid var(--line); border-radius: 4px; background: #fff; }
input[type="number"] { width: 6.5em; }

.flash { padding: 8px 12px; border-radius: 4px; }
.flash-error { background: var(--error-bg); color: var(--error); }

.login { max-width: 320px; margin: 48px auto; background: var(--panel); padding: 24px;
         border: 1px solid var(--line); border-radius: 6px; }
.login label { display: block; margin-bottom: 12px; }
.login input { display: block; width: 100%; margin-top: 4px; }
.login button { width: 100%; }

/* Parcels list: filters in a left panel that collapses (app.js), results on the right. */
.parcels-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 16px; align-items: start; }
.parcels-layout.collapsed { grid-template-columns: minmax(0, 1fr); }
.parcels-layout.collapsed .filter-panel { display: none; }
.filter-panel { position: sticky; top: 12px; max-height: calc(100vh - 24px); overflow-y: auto;
                background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 10px 14px 14px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.panel-head h2 { margin: 0; }
.panel-toggle, .panel-open { background: none; color: var(--muted); border: 1px solid var(--line); padding: 1px 8px; }
.panel-toggle:hover, .panel-open:hover { color: var(--ink); border-color: var(--muted); }
.main-head { display: flex; align-items: center; gap: 12px; }
.panel-open { display: none; }
.parcels-layout.collapsed .panel-open { display: inline-block; }
.parcels-main h1 { margin: 0 0 6px; }

.filters { display: flex; flex-direction: column; gap: 12px; }
.filters label, .filters .multi-label { display: flex; flex-direction: column; gap: 2px; color: var(--muted); font-size: 12px; }
.filters label > input, .filters label > select { color: var(--ink); font-size: 14px; width: 100%; }
.filters label.check, .filters .tier-check { flex-direction: row; align-items: center; gap: 4px; }
/* "For sale": the words on the left, the box flush right, one line. */
.filters label.switch { flex-direction: row; align-items: center; justify-content: space-between;
                        color: var(--ink); font-size: 14px; cursor: pointer; }
.filters .hint { color: var(--muted); font-size: 11px; }
.filters fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.filters legend { color: var(--muted); font-size: 12px; padding: 0; margin-bottom: 4px; display: flex; gap: 10px; width: 100%; }
.filters legend .link { color: var(--accent); }
.tier-row { display: flex; gap: 10px; }
.range > div { display: flex; align-items: center; gap: 6px; color: var(--muted); }
.range input[type="number"] { width: 100%; min-width: 0; }
.filters input[type="number"] { width: 100%; }
.filters .actions { display: flex; align-items: center; gap: 12px; }

/* Zoning: a drop-down of checkboxes with a find box. */
.multi details { position: relative; margin-top: 2px; }
.multi summary { list-style: none; cursor: pointer; border: 1px solid var(--line); border-radius: 4px; background: #fff;
                 padding: 4px 22px 4px 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; position: relative; }
.multi summary::-webkit-details-marker { display: none; }
.multi summary::after { content: "▾"; position: absolute; right: 7px; color: var(--muted); }
.multi details[open] summary { border-color: var(--accent); }
.multi-pop { position: absolute; z-index: 5; left: 0; right: 0; top: calc(100% + 2px); background: #fff;
             border: 1px solid var(--line); border-radius: 4px; box-shadow: 0 4px 14px #0002; padding: 6px; }
.multi-pop .multi-find { width: calc(100% - 50px); }
.multi-pop > .link { margin-left: 6px; color: var(--accent); }
.multi-list { max-height: 300px; overflow-y: auto; margin-top: 6px; }
.filters input[type="checkbox"] { width: auto; flex: none; margin: 0; }
/* One row per code, in columns: box | code (left) | parcel count (right). */
.filters .multi-opt { display: grid; grid-template-columns: 18px minmax(0, 1fr) auto; align-items: center;
                      column-gap: 6px; color: var(--ink); font-size: 13px; padding: 2px 4px; border-radius: 3px; cursor: pointer; }
.filters .multi-opt[hidden] { display: none; }
.filters .multi-opt:hover { background: #f2f6f4; }
.filters .multi-opt > span:first-of-type { text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filters .multi-opt .muted { text-align: right; font-size: 11px; font-variant-numeric: tabular-nums; }
.multi-pop { min-width: 260px; }
.multi-group { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted);
               padding: 6px 2px 2px; border-top: 1px solid var(--line); margin-top: 4px; }
.multi-group:first-child { border-top: 0; margin-top: 0; }
.filters [hidden] { display: none !important; }

.active-filters { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 4px; }
.active-filters .chip { display: inline-flex; align-items: center; gap: 4px; background: #e8eeeb; color: var(--ink);
                        border-radius: 10px; padding: 1px 4px 1px 9px; font-size: 12px; }
.active-filters .chip:not(:has(.chip-x)) { padding-right: 9px; }
.chip-x { display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; color: var(--muted);
          text-decoration: none; font-size: 14px; line-height: 1; }
.chip-x:hover { background: #cfd9d4; color: var(--ink); }
td.owner-cell { max-width: 300px; overflow: hidden; text-overflow: ellipsis; }
.owner-line { display: flex; flex-wrap: wrap; gap: 6px 22px; margin: -4px 0 8px; }
.reset { color: var(--muted); }

.count { color: var(--muted); margin: 4px 0 8px; }
#results.htmx-request { opacity: .55; transition: opacity .15s; }
.table-wrap { overflow-x: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; }
table.parcels { border-collapse: collapse; width: 100%; }
table.parcels th, table.parcels td { padding: 5px 8px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
table.parcels th { background: #eef0ee; position: sticky; top: 0; font-weight: 600; }
table.parcels th a { color: var(--ink); text-decoration: none; }
table.parcels tbody tr:hover { background: #f2f6f4; }
.num { text-align: right !important; font-variant-numeric: tabular-nums; }
td.why { max-width: 420px; overflow: hidden; text-overflow: ellipsis; color: var(--muted); }
.table-scroll { overflow: auto; }
tr.more td { text-align: center; padding: 10px; }
.empty { padding: 24px; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; }

.tier { display: inline-block; min-width: 1.6em; text-align: center; border-radius: 3px; font-weight: 700;
        color: #fff; padding: 0 5px; }
.tier-A { background: var(--tier-A); } .tier-B { background: var(--tier-B); }
.tier-C { background: var(--tier-C); } .tier-D { background: var(--tier-D); }
.tier.big { font-size: 20px; padding: 2px 10px; margin-right: 8px; }

.crumbs { margin: 0; }
.headline { font-size: 15px; display: flex; align-items: center; }
.doubts { background: #fff7e0; border: 1px solid #f0dca0; padding: 8px 12px; border-radius: 4px; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; margin: 14px 0; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 12px 14px; }
.card dl { display: grid; grid-template-columns: auto 1fr; gap: 3px 14px; margin: 0; }
.card dt { color: var(--muted); }
.card dd { margin: 0; }

/* Parcel map: map on the left, layer/plan checkboxes on the right. */
.mapwrap { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 12px; margin: 14px 0; }
.map { height: 620px; border: 1px solid var(--line); border-radius: 6px; background: #dfe3e0; }
.mappanel { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px;
            max-height: 620px; overflow-y: auto; }
.mappanel h2 { margin: 6px 0; }
.mappanel h2 + .layer { margin-top: 0; }
.layer { display: flex; align-items: center; gap: 6px; padding: 2px 0; cursor: pointer; }
.layer .muted { margin-left: auto; font-size: 12px; }
.plat { border-top: 1px solid var(--line); padding: 4px 0; }
.plat details summary { cursor: pointer; font-size: 12px; margin-left: 22px; }
.plat details p { margin: 4px 0 4px 22px; }
table.lots { border-collapse: collapse; font-size: 12px; margin: 4px 0 6px 22px; }
table.lots th, table.lots td { padding: 1px 6px; border-bottom: 1px solid var(--line); text-align: left; }
table.lots tr.withheld td { color: var(--muted); }
.swatch { display: inline-block; width: 14px; height: 14px; border-radius: 2px; border: 1px solid #0003; flex: none; }
.sw-buildable { background: #43a047; } .sw-unbuildable { background: #8d4a2b; }
.sw-wetland { background: #1e88e5; } .sw-water { background: #80deea; } .sw-floodway { background: #0d2f8a; } .sw-flood_zone { background: #64b5f6; }
.sw-soil_poor_cautious { background: #c0ca33; } .sw-soil_poor_hopeful { background: #827717; }
.sw-roads_public { background: #fff; border-color: #888; } .sw-roads_private { background: repeating-linear-gradient(90deg, #fff 0 4px, #333 4px 7px); }
.sw-houses { background: #d50000; border-radius: 50%; } .sw-buildings { background: #bdbdbd; border-radius: 50%; }
.sw-plat-simple { background: #00e5ff; } .sw-plat-flag { background: #e040fb; }
.sw-plat-shared { background: #ff6d00; } .sw-plat-exempt { background: #ff4081; }
.sw-plat-road { background: #ffd600; } .sw-plat-exempt_flag { background: #76ff03; }
.sw-legend-lot { background: linear-gradient(135deg, #00e5ff 0 25%, #e040fb 25% 50%, #ff6d00 50% 75%, #ff4081 75%); }
.sw-legend-rest { background: #9e9e9e; border: 2px dashed #fff; }
.sw-legend-home { background: transparent; border: 2px dotted #888; }
.legend { display: grid; gap: 3px; margin: 4px 0 6px; } .legend div { display: flex; gap: 6px; align-items: center; }
.layer .count { margin-left: auto; white-space: nowrap; }
.maplibregl-popup-content { font-size: 12px; }
.sw-near-parcels { background: transparent; border: 1.5px solid #555; }
.sw-near-roads_public { background: #fff; border-color: #888; }
.sw-near-roads_private { background: repeating-linear-gradient(90deg, #fff 0 4px, #333 4px 7px); }
.sw-near-houses { background: #d50000; border-radius: 50%; } .sw-near-buildings { background: #bdbdbd; border-radius: 50%; }
.sw-near-power { background: repeating-linear-gradient(90deg, #651fff 0 6px, #fff 6px 8px); }
.sw-near-rail { background: repeating-linear-gradient(90deg, #212121 0 3px, #fff 3px 5px); border-color: #212121; }

/* Area card: small-lot sales by year (2026-11-22) */
.sales-chart { width: 100%; border-collapse: collapse; margin-top: .5rem; }
.sales-chart td, .sales-chart th { padding: 2px 4px; text-align: left; }
.sales-chart td:last-child { width: 60%; }
.sales-chart .bar { display: inline-block; height: .7em; background: var(--accent, #4a7bd0); vertical-align: middle; max-width: 70%; }

/* Recent changes (app_v7): change badges in the list, the parcel's history, the changes page. */
.change { display: inline-block; border-radius: 3px; padding: 0 5px; font-size: 12px; font-weight: 600;
          border: 1px solid var(--line); background: var(--panel); white-space: nowrap; }
.change-added { border-color: var(--tier-A); color: var(--tier-A); }
.change-replanned { border-color: var(--accent); color: var(--accent); }
.change-changed { border-color: var(--tier-C); color: var(--tier-C); }
.change-removed { border-color: var(--tier-D); color: var(--tier-D); }
td.updated { white-space: nowrap; }
.history { list-style: none; margin: 0; padding: 0; }
.history li { padding: 4px 0; border-bottom: 1px solid var(--line); }
.history li:last-child { border-bottom: 0; }
.run-filter { padding: 6px 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; }
.card.run { margin-bottom: 14px; }

/* v5: impaired lots (provisional) */
.impaired { color: #e65100; font-weight: 600; }
table.lots tr.impaired td { color: #e65100; }

/* Subdivision rules pages (webapp/rules.py) */
.rules-intro { max-width: 900px; }
.rules-link { margin: 2px 0 8px; }
h3 { font-size: 15px; margin: 14px 0 6px; }
table.rules td { white-space: normal; vertical-align: top; }
table.rules td.val { min-width: 140px; }
table.rules td.src { max-width: 520px; font-size: 12px; }
table.rules .note, .card .note, p.note, details .note { color: var(--muted); font-size: 12px; margin-top: 2px; }
table.rules-index tr.town-row td:first-child { padding-left: 28px; }
.basis, .status, .use { display: inline-block; border-radius: 3px; padding: 0 6px; font-size: 12px; white-space: nowrap; }
.basis-read { background: #e3f1e4; color: #1f5e24; }
.basis-assumed { background: #fdf1d8; color: #7a5300; }
.basis-unknown { background: #eceeef; color: var(--muted); }
.status-used { background: #e3f1e4; color: #1f5e24; }
.status-draft { background: #eceeef; color: var(--muted); }
.use-planner { background: #e1ecf7; color: #1d4f80; }
.use-screen { background: #efe6f5; color: #5b2f7a; }
.use-unused, .use-draft { color: var(--muted); padding-left: 0; }
table.districts td.cell-unknown { color: var(--muted); }
table.districts td.cell-assumed { font-style: italic; }
table.districts tr:target, table.districts tr.is-target { background: #fff7e0; }
details.district { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 6px 12px; margin: 8px 0; }
details.district[open] { padding-bottom: 12px; }
details.district:target, details.district.is-target { border-color: #f0dca0; box-shadow: 0 0 0 2px #fff7e0; }
details.district summary { cursor: pointer; padding: 4px 0; }
ul.ordinances, ul.questions, ul.towns { margin: 4px 0; padding-left: 20px; }
ul.questions li { margin-bottom: 4px; }

/* Parcel map (app_v9): imagery choice, zoning classes, outside-data places. Colors match
   parcel_map.js (ZONING_COLORS, PLACE_STYLE). */
/* Map panel groups (Map / Layers / Lot plans): collapsible, a summary line when closed. */
.mappanel h3.subhead:first-of-type { margin-top: 2px; }
.pgroup { border-bottom: 1px solid var(--line); padding: 6px 0; }
.pgroup:last-child { border-bottom: 0; }
.pgroup > summary, .psub > summary { cursor: pointer; list-style: none; display: flex; align-items: baseline; gap: 8px; }
.pgroup > summary::-webkit-details-marker, .psub > summary::-webkit-details-marker { display: none; }
/* Open / close chevron: bold, in the accent color; points right when closed, down when open. */
.pgroup > summary::before, .psub > summary::before {
  content: ""; flex: none; align-self: center; box-sizing: border-box;
  width: 10px; height: 10px; margin: 0 8px 0 3px;
  border-right: 3px solid var(--accent); border-bottom: 3px solid var(--accent);
  transform: rotate(-45deg); transition: transform .15s;
}
.psub > summary::before { width: 8px; height: 8px; border-width: 2.5px; margin: 0 7px 0 2px; }
.pgroup[open] > summary::before, .psub[open] > summary::before { transform: rotate(45deg); }
.pgroup > summary, .psub > summary { padding: 3px 4px; border-radius: 4px; }
.pgroup > summary:hover, .psub > summary:hover { background: #eef3f0; }
.pgroup > summary .pg-title { font-weight: 600; font-size: 15px; }
.psub { margin: 4px 0 2px 4px; }
.psub > summary .pg-title { font-weight: 600; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.pg-summary { color: var(--muted); font-size: 12px; margin-left: auto; text-align: right; }
.pgroup[open] > summary .pg-summary { visibility: hidden; }
.psub > :not(summary) { margin-left: 18px; }
.choice { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-bottom: 6px; }
.choice label { display: flex; align-items: center; gap: 4px; cursor: pointer; }
.zoning-legend { margin: 2px 0 4px 4px; }
.zclass { display: flex; align-items: center; gap: 6px; padding: 2px 4px; border-radius: 3px; cursor: pointer; font-size: 13px; }
.zclass:hover { background: #eef3f0; }
.zclass input:not(:checked) ~ .swatch { background: #fff !important; border-color: #bbb; }
/* This parcel's pin: black with a white center - no color scheme on the map uses black. */
.parcel-pin { width: 22px; height: 30px; cursor: pointer; }
.parcel-pin::before { content: ""; position: absolute; left: 1px; top: 0; width: 20px; height: 20px; background: #111;
                      border: 2px solid #fff; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); box-sizing: border-box;
                      box-shadow: 0 1px 4px #0008; }
.parcel-pin::after { content: ""; position: absolute; left: 7px; top: 6px; width: 8px; height: 8px; background: #fff; border-radius: 50%; }
.mappanel .subhead { font-size: 12px; font-weight: 600; color: var(--muted); margin: 8px 0 2px; text-transform: uppercase; letter-spacing: .03em; }
.sw-zoning-rural { background: #8bc34a; } .sw-zoning-res_low { background: #ffeb3b; }
.sw-zoning-res_high { background: #ff9800; } .sw-zoning-commercial { background: #e53935; }
.sw-zoning-industrial { background: #8e24aa; } .sw-zoning-planned { background: #00acc1; }
.sw-zoning-other { background: #9e9e9e; }
.sw-zoning-community { background: repeating-linear-gradient(45deg, #00acc1 0 3px, #ffffff 3px 5px); }
.sw-place { border-radius: 50%; border: 1.5px solid #fff; box-shadow: 0 0 0 1px #0004; }
.sw-place-supermarket { background: #2e7d32; } .sw-place-dollar_store { background: #f9a825; }
.sw-place-pharmacy { background: #00897b; } .sw-place-hardware { background: #6d4c41; }
.sw-place-urgent_care { background: #ec407a; } .sw-place-hospital { background: #c62828; }
.sw-place-potw { background: #0277bd; } .sw-place-landfill { background: #5d4037; }
.sw-place-tri_plant { background: #455a64; } .sw-place-mh_dealer { background: #ef6c00; }
.sw-water-area { background: #29b6f633; border: 2px solid #0288d1; }
/* Place markers in the key: the same image the map draws (parcel_map.js placeIcon). */
.swatch.sw-icon { width: 18px; height: 18px; border: 0; box-shadow: none; border-radius: 0;
                  background-color: transparent !important; background-size: contain; background-repeat: no-repeat; background-position: center; }
/* Hover label on the map (places, power lines, railroads, roads). */
.hover-tip .maplibregl-popup-content { padding: 4px 8px; font-size: 12px; font-weight: 600; pointer-events: none; }
.hover-tip .maplibregl-popup-tip { display: none; }
/* Marker rows: "only" / "find" links, shown on hover (always on touch screens). */
.place-row .layer-tools { margin-left: auto; display: flex; gap: 8px; font-size: 11px; visibility: hidden; }
.place-row:hover .layer-tools, .place-row:focus-within .layer-tools { visibility: visible; }
@media (hover: none) { .place-row .layer-tools { visibility: visible; } }
.place-row:hover { background: #eef3f0; border-radius: 3px; }
