html, body { margin: 0; height: 100%; font: 14px/1.35 system-ui, sans-serif; }
#map { position: absolute; inset: 0; }
[hidden] { display: none !important; }

#panel {
  position: absolute; top: 10px; left: 10px; width: 310px; max-height: calc(100% - 40px); overflow-y: auto;
  background: rgba(255, 255, 255, 0.96); border-radius: 8px; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3); z-index: 2;
}
#panel header { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px 4px; }
#panel h1 { font-size: 16px; margin: 0; }
#panel h2 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: #666; margin: 6px 0; }
#panel section { padding: 4px 12px 8px; border-top: 1px solid #eee; }
#panel label { display: flex; align-items: center; gap: 6px; padding: 3px 0; cursor: pointer; }
#panel .name { flex: 1; }
#panel .count { color: #888; font-size: 12px; font-variant-numeric: tabular-nums; }
#panel footer { padding: 8px 12px; border-top: 1px solid #eee; font-size: 12px; }
.swatch { width: 14px; height: 14px; border-radius: 3px; border: 1px solid #555; flex: none; }
.hint { color: #777; font-size: 12px; margin: 4px 0 0; }
#collapse, #expand { border: 0; background: #eee; border-radius: 4px; font-size: 18px; width: 26px; height: 26px; cursor: pointer; }
#expand { position: absolute; top: 10px; left: 10px; z-index: 2; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3); background: #fff; }

.maplibregl-popup-content h3 { margin: 0 0 6px; font-size: 14px; }
.maplibregl-popup-content .props { max-height: 260px; overflow-y: auto; }
.maplibregl-popup-content table { border-collapse: collapse; font-size: 12px; }
.maplibregl-popup-content th { text-align: left; color: #666; font-weight: normal; padding: 1px 8px 1px 0; vertical-align: top; }
.maplibregl-popup-content td { padding: 1px 0; word-break: break-word; }

.layer-tools { display: flex; gap: 6px; margin-bottom: 6px; }
.layer-tools button, .solo {
  border: 1px solid #ccc; background: #f6f6f6; border-radius: 4px; cursor: pointer; font-size: 12px; padding: 2px 8px;
}
.layer-tools button:hover, .solo:hover { background: #e8e8e8; }
.layer-row { display: flex; align-items: center; gap: 4px; }
.layer-row label { flex: 1; min-width: 0; }
.solo { padding: 0 5px; font-size: 11px; color: #555; visibility: hidden; }
.layer-row:hover .solo { visibility: visible; }

/* Editor */
.edit-btn, .edit-tools button, .edit-actions button {
  border: 1px solid #bbb; background: #f6f6f6; border-radius: 4px; cursor: pointer; font-size: 13px; padding: 4px 10px;
}
.edit-tools { display: flex; gap: 4px; margin-bottom: 8px; }
.edit-tools button.on { background: #1c7ed6; border-color: #1c7ed6; color: #fff; }
.edit-actions { display: flex; align-items: center; gap: 6px; margin-top: 8px; }
.edit-actions .primary { background: #2f9e44; border-color: #2f9e44; color: #fff; }
.edit-status { font-size: 12px; color: #666; }
.edit-status.dirty { color: #e67700; font-weight: 600; }
.edit-status.ok { color: #2f9e44; }
.edit-status.error { color: #e03131; font-weight: 600; }
.edit-form { background: #f8f9fa; border: 1px solid #e9ecef; border-radius: 6px; padding: 6px 8px; }
.edit-form label { display: block !important; font-size: 12px; color: #555; margin: 4px 0; }
.edit-form label.check { display: flex !important; }
.edit-form select, .edit-form input[type=text] { width: 100%; box-sizing: border-box; font-size: 13px; margin-top: 2px; }
button.link { border: 0; background: none; padding: 0; cursor: pointer; text-decoration: underline; font-size: 12px; }
button.danger { color: #e03131; }
.edit-nav { display: flex; gap: 4px; }
.edit-nav select { flex: 1; min-width: 0; font-size: 13px; }
.edit-nav button { border: 1px solid #bbb; background: #f6f6f6; border-radius: 4px; cursor: pointer; font-size: 13px; padding: 4px 8px; white-space: nowrap; }
.todo-count { margin: 4px 0 8px; }
.edit-nav + .edit-nav { margin-top: 4px; }
.edit-nav button.ok { flex: 1; background: #2f9e44; border-color: #2f9e44; color: #fff; }
.edit-title { font-size: 14px; margin: 0 0 6px; }
.edit-btn { margin: 2px 0; }
.detail-card { background: #fff; border: 1px solid #dee2e6; border-radius: 6px; padding: 6px 8px; font-size: 13px; margin-bottom: 4px; }
.detail-name { font-weight: 600; font-size: 14px; }
.detail-sub { color: #666; font-size: 12px; margin-top: 4px; }
.detail-fields { border-top: 1px solid #e9ecef; margin-top: 4px; padding-top: 4px; }
.basemap-controls { margin-top: 6px; padding-top: 6px; border-top: 1px dashed #e9ecef; font-size: 13px; }
#panel .basemap-controls label { display: flex; align-items: center; gap: 6px; }
.basemap-controls input[type=range] { flex: 1; }
.basemap-controls select { flex: 1; font-size: 13px; }
#map { background: #fff; }
.layer-group { margin: 2px 0; }
.layer-group > summary { cursor: pointer; font-weight: 600; font-size: 13px; padding: 3px 0; display: flex; align-items: center; gap: 4px; }
.layer-group > summary::before { content: "▸"; width: 10px; color: #888; }
.layer-group[open] > summary::before { content: "▾"; }
.layer-group > summary::-webkit-details-marker { display: none; }
.layer-group > summary { list-style: none; }
.layer-group > summary .count { margin-left: auto; font-weight: normal; }
.layer-group > .layer-row { padding-left: 14px; }

/* ---- setbacks */
.sb-top { display: flex; gap: 10px; flex-wrap: wrap; font-size: 13px; }
.sb-top .dot { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 3px; vertical-align: -1px; }
.sb-stats { margin: 6px 0 2px; font-size: 13px; padding: 5px 7px; background: #f8f9fa; border-radius: 4px; }
.sb-stats.busy { opacity: 0.5; }
.sb-stats .of { color: #777; }
.sb-group { margin-top: 8px; font-weight: 600; font-size: 12px; color: #555; text-transform: uppercase; letter-spacing: 0.03em; }
.sb-row { padding: 3px 0 4px; border-bottom: 1px solid #f1f3f5; font-size: 13px; }
.sb-row label { cursor: help; }
.sb-ctl { display: flex; align-items: center; gap: 6px; padding-left: 20px; }
.sb-ctl input[type=range] { flex: 1; min-width: 0; }
.sb-ctl input[type=number] { width: 58px; font-size: 12px; }
.sb-acres { padding-left: 20px; font-size: 11px; color: #777; }
.sb-row.off .sb-ctl, .sb-row.off .sb-acres { opacity: 0.4; }
#setbacks.hidden-zones .sb-row, #setbacks.hidden-zones .sb-stats { opacity: 0.5; }

/* ---- foldable panel sections */
#panel > section > h2 { cursor: pointer; user-select: none; }
#panel > section > h2::before { content: "▾"; display: inline-block; width: 12px; color: #999; }
#panel > section.folded > h2::before { content: "▸"; }
#panel > section.folded > :not(h2) { display: none; }
#panel > section.folded { padding-bottom: 2px; }
.status-pick { display: flex; flex-direction: column; gap: 2px; margin-bottom: 4px; }
.status-pick .dot { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin: 0 4px 0 2px; vertical-align: -1px; }
.status-pick kbd { font-size: 10px; padding: 0 3px; border: 1px solid #ccc; border-radius: 3px; color: #555; }
/* Address pin while reviewing homes: the E911 point, usually at the driveway. */
.site-pin { background: #fff; color: #111; font: 600 12px/1.2 system-ui, sans-serif; padding: 2px 6px; border-radius: 4px;
  border: 2px solid #1971c2; white-space: nowrap; pointer-events: none; position: relative; margin-bottom: 8px; box-shadow: 0 1px 4px rgba(0,0,0,.4); }
.site-pin::after { content: ""; position: absolute; left: 50%; bottom: -8px; margin-left: -6px; border: 6px solid transparent; border-top-color: #1971c2; border-bottom: 0; }
.edit-here { margin: 6px 0 0; font-size: 13px; font-weight: 600; color: #1971c2; }
