/* Compact map-layer popover with scrollable checkbox groups. */
.atlas-explore .map-tools .layer-studio{position:relative;display:block;flex:0 0 auto;align-self:center;margin:0;padding:0;border:0;background:transparent;z-index:850}
.atlas-explore #layerStudioToggle{border:1px solid #a9bda5;border-radius:6px;background:#fff;color:#174b3c;min-height:36px;padding:6px 11px;font-size:12px;font-weight:700;white-space:nowrap;cursor:pointer}
.atlas-explore #layerStudioToggle[aria-expanded=true]{background:#e9f2e9;border-color:#236149}
.atlas-explore #layerStudioBody{position:absolute;top:calc(100% + 9px);right:0;z-index:1000;width:min(330px,calc(100vw - 32px));max-height:min(65dvh,540px);overflow:hidden;display:flex;flex-direction:column;background:#fff;border:1px solid #cbdace;border-radius:13px;box-shadow:0 14px 44px #163d3440;text-align:start}
.atlas-explore #layerStudioBody[hidden]{display:none!important}
.atlas-explore .layer-studio-title{display:flex;align-items:center;justify-content:space-between;padding:12px 14px;border-bottom:1px solid #e0e8e0}
.atlas-explore .layer-studio-title strong{font-size:16px}
.atlas-explore #layerStudioClose{border:0;background:transparent;color:#254d40;font-size:23px;line-height:1;cursor:pointer}
.atlas-explore #layerStudioTabs{display:flex;gap:4px;padding:8px;overflow-x:auto;flex:none;border-bottom:1px solid #e2eae3}
.atlas-explore #layerStudioTabs button{flex:0 0 auto;border:0;background:transparent;padding:8px 10px;color:#53685d;font-size:11px;border-radius:6px;cursor:pointer}
.atlas-explore #layerStudioTabs button[aria-pressed=true]{background:#e5efe5;color:#174b3c;font-weight:700}
.atlas-explore #layerStudioItems{overflow-y:auto;min-height:0;max-height:310px;padding:7px}
.atlas-explore .layer-option{display:flex;align-items:center;gap:10px;padding:10px 9px;border-radius:7px;cursor:pointer;min-height:44px}
.atlas-explore .layer-option:hover{background:#f2f7f2}
.atlas-explore .layer-option input{margin:0;width:17px;height:17px;min-height:0;accent-color:#174b3c;flex:0 0 17px}
.atlas-explore .layer-option-text{display:grid;gap:2px;min-width:0}
.atlas-explore .layer-option-text strong{font-size:13px;font-weight:550;line-height:1.35}
.atlas-explore .layer-option-text small{font-size:10px;line-height:1.45;color:#69776f}
.atlas-explore .layer-option.is-unavailable{cursor:not-allowed;opacity:.55}
.atlas-explore .layer-option.is-unavailable:hover{background:transparent}
.atlas-explore .layer-studio-foot{display:flex;align-items:center;justify-content:space-between;gap:9px;padding:9px 13px;border-top:1px solid #e2eae3}
.atlas-explore .layer-studio-foot span{font-size:11px;color:#53685d;line-height:1.35}
.atlas-explore #layerStudioCopy{border:0;background:transparent;color:#174b3c;padding:6px;font-size:11px;cursor:pointer;white-space:nowrap}
@media(max-width:760px){.atlas-explore #layerStudioBody{left:0;right:auto;max-height:60dvh}.atlas-explore #layerStudioTabs button{font-size:11px}}
.atlas-area-compare{margin:10px 0;border:1px solid #cdddcf;border-radius:12px;background:#fff;padding:14px 16px;display:grid;grid-template-columns:minmax(160px,1fr) minmax(350px,1.3fr);gap:12px 18px}.atlas-area-compare h3{margin:0 0 6px;font-size:17px}.atlas-area-compare p{margin:0;color:#60766b;font-size:12px;line-height:1.5}.atlas-compare-controls{display:flex;gap:12px;align-items:center}.atlas-compare-controls label{flex:1;display:grid;gap:5px;font-size:12px}.atlas-compare-controls select{min-width:0;width:100%;padding:8px 10px;border:1px solid #c4d7c7;border-radius:7px;min-height:42px;background:#fff;font-size:14px}.atlas-area-compare #atlasCompareResults{grid-column:1/-1;overflow-x:auto}.atlas-area-compare table{width:100%;border-collapse:collapse;font-size:13px}.atlas-area-compare td,.atlas-area-compare th{padding:8px;border-bottom:1px solid #e2e9e2;text-align:start}.atlas-area-compare td{text-align:end;font-variant-numeric:tabular-nums}@media(max-width:800px){.atlas-area-compare{grid-template-columns:1fr}.atlas-compare-controls{flex-wrap:wrap}}
/* Compact area comparison: closed by default to protect map-first layout. */
.atlas-area-compare{display:block!important;padding:0!important;grid-template-columns:none!important}
.atlas-area-compare>summary{cursor:pointer;padding:12px 16px;display:flex;align-items:center;justify-content:space-between;gap:15px;min-height:46px;list-style:revert}
.atlas-area-compare>summary strong{font-size:14px}
.atlas-area-compare>summary span{font-size:12px;color:#61766b}
.atlas-area-compare-body{border-top:1px solid #e1eae2;padding:12px 16px;display:grid;grid-template-columns:minmax(160px,1fr) minmax(350px,1.3fr);gap:12px 18px}
.atlas-area-compare-body #atlasCompareResults{grid-column:1/-1}
@media(max-width:800px){.atlas-area-compare-body{grid-template-columns:1fr}.atlas-area-compare>summary span{display:none}}

/* Interactive right-hand map legend: selectable, touch-friendly layer visibility. */
.atlas-explore #mapLegend{display:grid;gap:3px}
.atlas-explore #mapLegend .atlas-legend-option{display:flex!important;align-items:center;gap:8px;cursor:pointer;border-radius:7px;padding:6px 5px;min-height:35px;transition:background .12s}
.atlas-explore #mapLegend .atlas-legend-option:hover{background:#edf4ee}
.atlas-explore #mapLegend .atlas-legend-option input,.atlas-explore #mapLegend .atlas-legend-all input{flex:0 0 16px;width:16px;height:16px;min-height:0;margin:0;accent-color:#185340;cursor:pointer}
.atlas-explore #mapLegend .atlas-legend-option .legend-symbol{flex:0 0 24px;display:grid;place-items:center;margin:0}
.atlas-explore #mapLegend .atlas-legend-option>span:nth-last-child(2){flex:1;min-width:0}
.atlas-explore #mapLegend .atlas-legend-option b{margin-inline-start:auto;font-size:12px}
.atlas-explore #mapLegend .atlas-legend-all{display:flex;justify-content:space-between;align-items:center;gap:6px;padding:5px 3px 11px;margin-bottom:3px;border-bottom:1px solid #e1eae3}
.atlas-explore #mapLegend .atlas-legend-all label{display:flex;align-items:center;gap:8px;font-size:12px;font-weight:700;cursor:pointer}
.atlas-explore #mapLegend .atlas-legend-all button{border:1px solid #c2d4c6;border-radius:6px;padding:5px 7px;min-height:30px;background:#f2f7f1;font-size:11px;cursor:pointer;color:#164b3c}

/* Right legend uses four explicit columns; prevent inherited grid/flex conflicts
   that push labels to the far edge and wrap numeric counts. */
.atlas-explore #mapLegend label.legend-row.atlas-legend-option{
 display:grid!important;
 grid-template-columns:18px 24px minmax(0,1fr) max-content!important;
 align-items:center!important;column-gap:8px!important;row-gap:0!important;
 justify-content:stretch!important;padding:7px 4px!important;
 width:100%!important;box-sizing:border-box!important;
}
.atlas-explore #mapLegend .atlas-legend-option input{grid-column:1;width:16px!important}
.atlas-explore #mapLegend .atlas-legend-option .legend-symbol{grid-column:2;width:24px!important;height:24px!important}
.atlas-explore #mapLegend .atlas-legend-option>span:nth-last-child(2){
 grid-column:3;min-width:0!important;line-height:1.35!important;text-align:start!important;
 overflow-wrap:break-word;
}
.atlas-explore #mapLegend .atlas-legend-option>b{
 grid-column:4;justify-self:end!important;margin:0!important;
 white-space:nowrap!important;line-height:1.35!important;
}

/* Layer popup is anchored to the first, left-side toolbar button.
   Right anchoring pushed its 330px width off the map's left edge. */
@media screen{
 body.atlas-explore .map-tools .layer-studio{isolation:isolate;z-index:1100!important}
 body.atlas-explore .map-tools #layerStudioBody{
   left:0!important;right:auto!important;
   width:min(330px,calc(100vw - 32px))!important;
   box-sizing:border-box!important;
   direction:inherit!important;
 }
 body.atlas-explore .map-tools{overflow:visible!important}
}
@media screen and (max-width:600px){
 body.atlas-explore .map-tools #layerStudioBody{
   width:min(310px,calc(100vw - 24px))!important;
 }
}

/* Unified map-type / measuring tools, no external imagery without permission. */
.atlas-explore #layerStudioBody .atlas-map-appearance{padding:11px 13px;border-bottom:1px solid #e2eae3;display:grid;gap:8px;flex:none}
.atlas-explore #layerStudioBody .atlas-map-appearance strong,.atlas-explore #layerStudioBody .atlas-layers-subtitle{font-size:12px;font-weight:750;color:#1c4739}
.atlas-explore #layerStudioBody .atlas-layers-subtitle{padding:11px 13px 5px}
.atlas-explore #layerStudioBody .atlas-map-type-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:7px}
.atlas-explore #layerStudioBody .atlas-map-type-grid button{display:flex;align-items:center;flex-direction:column;gap:3px;padding:8px 2px;border:1px solid #cdddcf;border-radius:9px;background:white;min-width:0;color:#164738}
.atlas-explore #layerStudioBody .atlas-map-type-grid button[aria-pressed=true]{border:2px solid #1a5c42;background:#eef5ee}
.atlas-explore #layerStudioBody .atlas-map-type-grid button:disabled{opacity:.4;cursor:not-allowed}
.atlas-explore #layerStudioBody .atlas-map-type-grid button>span:first-child{font-size:25px}
.atlas-explore #layerStudioBody .atlas-map-type-grid button>span:last-child{font-size:11px}
.atlas-explore #atlasMeasureToggle,.atlas-explore #atlasMeasureClear{font-size:12px;border-radius:6px;border:1px solid #cdddcf;background:white;padding:8px 10px;min-height:36px;text-align:start}
.atlas-explore #atlasMeasureToggle[aria-pressed=true]{background:#164b3c;color:white}
.atlas-explore #atlasMeasureStatus{font-size:11px;color:#51695f}
.atlas-explore #layerStudioBody{max-height:min(82dvh,730px)!important}
.atlas-explore #layerStudioItems{max-height:210px!important}
.atlas-explore .atlas-education-layers{display:none!important}

/* Always-visible compact bulk layer controls, matching Google Maps style. */
.atlas-explore .atlas-layer-quick{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:8px 12px 4px}
.atlas-explore .atlas-layer-quick .atlas-layers-subtitle{padding:0!important}
.atlas-explore .atlas-layer-quick>div{display:flex;gap:5px}
.atlas-explore #atlasLayersNone,.atlas-explore #atlasLayersAll{border:1px solid #c5d5c8;border-radius:6px;background:white;color:#205442;font-size:11px;padding:5px 8px;cursor:pointer}
.atlas-explore #atlasLayersNone:hover,.atlas-explore #atlasLayersAll:hover{background:#e9f3eb}

/* Mobile map-first layout: keep controls on one scrollable row, preserve map
   height and keep informational text from obscuring the map. */
@media screen and (max-width:700px){
 body.atlas-explore .map-panel:not(:fullscreen):not(.atlas-map-expanded){
   display:flex!important;flex-direction:column!important;
   height:min(76svh,660px)!important;min-height:440px!important;
   max-height:none!important;position:relative!important;
 }
 body.atlas-explore .map-panel .map-tools,
 body.atlas-explore .map-panel:fullscreen .map-tools,
 body.atlas-explore .map-panel.atlas-map-expanded .map-tools{
   order:-1!important;display:flex!important;flex-wrap:nowrap!important;
   overflow-x:auto!important;overflow-y:visible!important;
   justify-content:flex-start!important;align-items:center!important;
   gap:7px!important;padding:8px 10px!important;
   max-width:100%!important;min-width:0!important;
   scrollbar-width:none;-webkit-overflow-scrolling:touch;
   border-radius:0!important;
 }
 body.atlas-explore .map-panel .map-tools::-webkit-scrollbar{display:none}
 body.atlas-explore .map-panel .map-tools>button,
 body.atlas-explore .map-panel .map-tools>.atlas-map-more,
 body.atlas-explore .map-panel .map-tools>.layer-studio{
   flex:0 0 auto!important;min-width:max-content!important;
 }
 body.atlas-explore .map-panel .map-tools button,
 body.atlas-explore .map-panel .map-tools .atlas-map-more>summary{
   min-height:36px!important;max-width:none!important;
   padding:7px 10px!important;font-size:12px!important;
   line-height:1.25!important;white-space:nowrap!important;
 }
 body.atlas-explore .map-panel .map-scroll-hint{
   order:0!important;flex:0 0 auto!important;margin:0!important;
   padding:5px 10px!important;font-size:11px!important;
   line-height:1.35!important;max-height:43px!important;
   overflow:hidden!important;
 }
 body.atlas-explore .map-panel #map{
   order:1!important;flex:1 1 auto!important;min-height:255px!important;
 }
 body.atlas-explore .map-panel .map-caption{
   font-size:11px!important;padding:5px 8px!important;
   max-width:55%!important;
 }
 body.atlas-explore .map-sidebar .map-sidebar-heading{
   padding:10px 12px!important;
 }
 body.atlas-explore .map-sidebar #mapCards{gap:9px!important}
 /* Keep the dropdown above the map despite toolbar horizontal scrolling. */
 body.atlas-explore .map-panel .map-tools #layerStudioBody{
   position:fixed!important;left:12px!important;right:12px!important;
   top:calc(env(safe-area-inset-top,0px) + 100px)!important;
   width:auto!important;max-width:360px!important;
   max-height:70dvh!important;z-index:4000!important;
 }
}

/* On small screens the Layers panel is moved to body by layer-studio.js,
   so toolbar scrolling cannot cut it off. */
@media screen and (max-width:700px){
 body.atlas-explore > #layerStudioBody{
   position:fixed!important;z-index:9999!important;
   top:calc(env(safe-area-inset-top,0px) + 72px)!important;
   left:12px!important;right:12px!important;
   width:auto!important;max-width:none!important;
   max-height:min(75dvh,630px)!important;
   box-sizing:border-box!important;display:flex!important;
   flex-direction:column!important;background:#fff!important;
   border:1px solid #cbdace!important;border-radius:14px!important;
   overflow:hidden!important;box-shadow:0 12px 45px #153b324a!important;
 }
 body.atlas-explore > #layerStudioBody[hidden]{display:none!important}
 body.atlas-explore > #layerStudioBody #layerStudioItems{overflow-y:auto!important;min-height:70px!important;max-height:32dvh!important}
 body.atlas-explore > #layerStudioBody #layerStudioTabs{overflow-x:auto!important;flex-shrink:0!important}
 body.atlas-explore > #layerStudioBody .atlas-map-appearance{flex-shrink:0!important}
}

/* National Map-inspired vertical tool rail: entirely local actions. */
body.atlas-explore .map-panel .atlas-map-rail{
 position:absolute!important;z-index:600!important;left:12px!important;
 top:125px!important;display:flex!important;flex-direction:column!important;
 align-items:stretch!important;gap:3px!important;padding:5px!important;
 background:rgba(255,255,255,.96)!important;border:1px solid #d3e0d5!important;
 border-radius:11px!important;box-shadow:0 3px 14px #173e3629!important;
}
body.atlas-explore .map-panel .atlas-map-rail button{
 display:grid!important;place-items:center!important;width:37px!important;
 height:37px!important;min-height:37px!important;padding:0!important;
 border:0!important;border-radius:7px!important;background:transparent!important;
 color:#17543f!important;font-size:22px!important;font-weight:600!important;
 line-height:1!important;cursor:pointer!important;
}
body.atlas-explore .map-panel .atlas-map-rail button:hover,
body.atlas-explore .map-panel .atlas-map-rail button:focus-visible{
 background:#e7f2eb!important;
}
body.atlas-explore .map-panel .atlas-map-rail button[aria-pressed=true]{
 background:#17543f!important;color:#fff!important;
}
body.atlas-explore .map-panel .atlas-rail-separator{
 height:1px!important;background:#dbe6dd!important;margin:3px 5px!important;
}
@media(max-width:700px){
 body.atlas-explore .map-panel .atlas-map-rail{
   top:98px!important;left:8px!important;padding:3px!important;gap:2px!important;
 }
 body.atlas-explore .map-panel .atlas-map-rail button{
   width:34px!important;height:34px!important;min-height:34px!important;font-size:20px!important;
 }
}
body.atlas-print-map .atlas-map-rail{display:none!important}

/* The custom rail replaces Leaflet's duplicate zoom buttons. */
body.atlas-explore .map-panel .leaflet-control-zoom{display:none!important}
@media(max-height:600px) and (orientation:landscape){
 body.atlas-explore .map-panel .atlas-map-rail{top:72px!important}
 body.atlas-explore .map-panel .atlas-map-rail button{height:30px!important;min-height:30px!important}
}

/* When Layers is open, it must be above the vertical tool rail and all map controls. */
body.atlas-explore .map-panel .map-tools .layer-studio{z-index:1500!important}
body.atlas-explore .map-panel #layerStudioBody{
 z-index:2500!important;left:0!important;right:auto!important;
}
body.atlas-explore .map-panel:has(#layerStudioToggle[aria-expanded="true"]) .atlas-map-rail{
 visibility:hidden!important;pointer-events:none!important;
}
body.atlas-explore:has(> #layerStudioBody:not([hidden])) .map-panel .atlas-map-rail{
 visibility:hidden!important;pointer-events:none!important;
}
@media(min-width:701px){
 body.atlas-explore .map-panel #layerStudioBody{
  position:fixed!important;left:clamp(12px,5vw,90px)!important;
  top:clamp(65px,12vh,130px)!important;right:auto!important;
  width:min(345px,calc(100vw - 24px))!important;
  max-height:75dvh!important;overflow:hidden!important;
 }
}

body.atlas-explore .map-panel .atlas-measure-floating{position:absolute;z-index:750;left:64px;bottom:45px;max-width:calc(100% - 90px);padding:8px 12px;background:#fff;border:1px solid #abc8b4;border-radius:9px;color:#164b3c;font-weight:700;font-size:12px;box-shadow:0 3px 12px #173e3629;pointer-events:none}
body.atlas-explore .map-panel .atlas-measure-floating[hidden]{display:none!important}
@media(max-width:700px){body.atlas-explore .map-panel .atlas-measure-floating{left:54px;bottom:42px}}

/* Indicate active measuring mode and keep map interactions predictable. */
body.atlas-explore #map.atlas-measuring{cursor:crosshair!important}
body.atlas-explore #map.atlas-measuring .leaflet-container,
body.atlas-explore #map.atlas-measuring .leaflet-grab{cursor:crosshair!important}
body.atlas-explore .atlas-map-rail button:focus-visible{
 outline:3px solid #e7ad44!important;outline-offset:2px!important;
}

/* Clear measurement is accessible directly on the map, not only in Layers. */
body.atlas-explore .map-panel #atlasMeasureFloating:not([hidden]){
 display:flex!important;align-items:center!important;gap:10px!important;
 max-width:min(340px,calc(100% - 90px))!important;
 z-index:700!important;
}
body.atlas-explore .map-panel #atlasMeasureReadout{min-width:0;flex:1;line-height:1.35}
body.atlas-explore .map-panel #atlasMeasureClearFloating{
 flex:0 0 auto;border:1px solid #ccdad0;border-radius:7px;
 background:white;color:#154c40;padding:5px 9px;min-height:32px;
 font:inherit;font-size:12px;cursor:pointer;
}
body.atlas-explore .map-panel #atlasMeasureClearFloating:focus-visible{outline:3px solid #e7ad44;outline-offset:2px}

/* More drawing tools without allowing the vertical rail to overflow small maps. */
body.atlas-explore .map-panel .atlas-map-rail{
 max-height:calc(100% - 142px)!important;overflow-y:auto!important;
 scrollbar-width:thin;overscroll-behavior:contain;
}
@media(max-width:700px){
 body.atlas-explore .map-panel .atlas-map-rail{
  max-height:calc(100% - 120px)!important;
 }
}

body.atlas-explore #layerStudioBody .atlas-measure-unit-label{font-size:12px;color:#405e50}
body.atlas-explore #layerStudioBody #atlasMeasureUnits{width:100%;min-height:36px;border:1px solid #c4d5c8;border-radius:7px;padding:6px 9px;background:white;color:#174b3c;font:inherit;font-size:12px}

/* Measurement status container was non-interactive: enable its Clear button. */
body.atlas-explore .map-panel #atlasMeasureFloating:not([hidden]){
 pointer-events:auto!important;z-index:1200!important;
}
body.atlas-explore .map-panel #atlasMeasureClearFloating{
 pointer-events:auto!important;cursor:pointer!important;
 position:relative;z-index:1;
}
body.atlas-explore #map .leaflet-pane.leaflet-atlas-measure-pane-pane{
 z-index:650!important;pointer-events:none!important;
}

/* Canvas-based distance path is above all map tiles and point markers. */
body.atlas-explore #map .atlas-measure-canvas{
 position:absolute!important;top:0!important;left:0!important;
 z-index:650!important;pointer-events:none!important;
 display:block!important;max-width:none!important;
}

/* Custom placemarks are drawn with CSS, not missing default Leaflet image assets. */
body.atlas-explore .atlas-custom-placemark{background:transparent;border:0;overflow:visible}
body.atlas-explore .atlas-custom-placemark span{
 display:grid;place-items:center;width:29px;height:29px;box-sizing:border-box;
 border-radius:50% 50% 50% 4px;transform:rotate(-45deg);
 background:#d44e25;color:white;border:3px solid #fff;
 box-shadow:0 2px 8px #182f2955;font-size:12px;font-weight:800;
}
body.atlas-explore .atlas-custom-placemark span::first-letter{color:white}

/* Clear, image-free place markers instead of tiny numeric characters. */
body.atlas-explore .atlas-custom-placemark{background:transparent!important;border:0!important;overflow:visible!important}
body.atlas-explore .atlas-custom-placemark>span{
 display:grid!important;place-items:center!important;width:34px!important;height:34px!important;
 border:2px solid white!important;border-radius:50%!important;
 transform:none!important;background:#c74a26!important;color:white!important;
 box-shadow:0 2px 9px #172b246e!important;
}
body.atlas-explore .atlas-custom-placemark svg{display:block!important;width:23px!important;height:23px!important;overflow:visible!important}

/* Education markers are first-class optional map legend layers. */
.atlas-explore #mapLegend .atlas-legend-education-heading{font-size:12px;font-weight:750;color:#204d3d;padding:13px 4px 7px;margin-top:8px;border-top:1px solid #dce7df}

.atlas-explore #mapLegend .atlas-school-status{font-size:11px;line-height:1.5;color:#546b5e;padding:4px 5px;margin:4px 0}

/* School icons render in Leaflet's marker pane, above standard map tiles. */
.atlas-explore .atlas-school-marker{border:0!important;background:transparent!important}
.atlas-explore .atlas-school-marker span{display:grid;place-items:center;width:34px;height:34px;border:2px solid #fff;border-radius:50%;box-shadow:0 2px 8px #0006;color:white;font:700 13px/1 system-ui,sans-serif;text-align:center}

/* Keep unverified future layers secondary to usable map layers. */
.atlas-explore #layerStudioItems .atlas-planned-toggle{
 display:block;width:100%;min-height:40px;margin:7px 0 1px;
 padding:8px 12px;border:1px dashed #b7cdbd;border-radius:8px;
 background:#f4f8f4;color:#295644;text-align:start;
 font:600 12px/1.4 system-ui,Arial,sans-serif;cursor:pointer;
}
.atlas-explore #layerStudioItems .atlas-planned-toggle:hover,
.atlas-explore #layerStudioItems .atlas-planned-toggle:focus-visible{background:#e8f2e9}
