.d4-top-map-tools{position:absolute;right:10px;top:12px;z-index:1002;display:flex;gap:8px;align-items:flex-start}.d4-map-button{height:44px;border:0;border-radius:13px;background:#fff;color:#075172;box-shadow:0 5px 16px #153c5530;font-weight:800;display:flex;align-items:center;justify-content:center;gap:8px;cursor:pointer}.d4-map-button svg{width:21px;height:21px;fill:none;stroke:currentColor;stroke-width:2}.d4-basemap-button{width:44px}.d4-layers-button{padding:0 16px;background:#087fbd;color:#fff}.d4-clear-button{position:absolute;right:10px;top:64px;z-index:1002;height:38px;border:2px solid #d24444;border-radius:11px;background:#fff;color:#b72d2d;font-weight:900;padding:0 13px;box-shadow:0 4px 13px #193d5525}.d4-clear-button[hidden]{display:none}.leaflet-control-layers .clear-all-layers-button{display:none!important}body:not(.installed-app-only) .layer-accordion-group:first-of-type{display:none}.d4-basemap-menu{position:absolute;right:106px;top:62px;z-index:1003;width:176px;background:#fff;border:1px solid #bad0db;border-radius:13px;box-shadow:0 8px 24px #173e5530;padding:7px}.d4-basemap-menu[hidden]{display:none}.d4-basemap-menu button{width:100%;border:0;background:transparent;border-radius:9px;padding:10px;text-align:left;font-weight:750;color:#143d50}.d4-basemap-menu button.is-active{background:#e1f3fb;color:#0078b4}.d4-layer-panel,.d4-bridge-drawer{position:absolute;z-index:1100;background:#fff;border:1px solid #b9ced8;box-shadow:0 9px 28px #173e5540}.d4-layer-panel{right:12px;top:145px;width:min(330px,calc(100vw - 24px));border-radius:15px;padding:13px}.d4-layer-panel[hidden],.d4-bridge-drawer[hidden]{display:none}.d4-panel-head{display:flex;align-items:center;justify-content:space-between;border-bottom:1px solid #d9e5ea;padding-bottom:8px;margin-bottom:9px}.d4-panel-head strong{color:#075172}.d4-panel-head button,.d4-tabbar button{border:0;background:transparent;font-weight:850;color:#087fbd;cursor:pointer}.d4-panel-grid{display:grid;grid-template-columns:1fr 1fr;gap:8px}.d4-panel-grid label{font-size:11px;font-weight:800;color:#567080}.d4-panel-grid select{display:block;width:100%;margin-top:4px;padding:8px;border:1px solid #c4d6df;border-radius:8px}.d4-panel-status{margin-top:9px;padding:8px;border-radius:8px;background:#eef7fa;font-size:12px;color:#31596b}.d4-panel-link{display:block;margin-top:9px;background:#087fbd;color:#fff!important;text-align:center;padding:9px;border-radius:8px;text-decoration:none;font-weight:800}.d4-bridge-icon div{width:25px;height:25px;border-radius:8px;background:#087fbd;color:#fff;border:2px solid #fff;box-shadow:0 2px 6px #1238;display:grid;place-items:center;font-weight:900}.d4-cluster div{min-width:31px;height:31px;padding:0 4px;border-radius:50%;background:#075172;color:#fff;border:3px solid #fff;box-shadow:0 2px 7px #1238;display:grid;place-items:center;font-weight:900}.d4-postmile-label{background:transparent!important;border:0!important}.d4-postmile-label span{white-space:nowrap;background:#fffdf2db;border:1px solid #e5bd3d;border-radius:4px;padding:1px 3px;color:#142f3b;font:700 10px/1.2 Arial;box-shadow:0 1px 2px #0002}.d4-bridge-drawer{right:0;top:0;height:100%;width:min(410px,100vw);overflow:auto}.d4-drawer-body{padding:14px}.d4-bridge-title{font-size:20px;color:#075172;margin:0 0 4px}.d4-kv{display:grid;grid-template-columns:115px 1fr;gap:5px 10px;font-size:13px}.d4-kv b{color:#26833b}.d4-tabbar{display:flex;border-bottom:1px solid #ccdbe2;position:sticky;top:0;background:#fff;z-index:2}.d4-tabbar button{flex:1;padding:12px 4px}.d4-tabbar button.is-active{background:#e6f4fa;border-bottom:3px solid #087fbd}.d4-protected-card{padding:14px;border-radius:10px;background:#eef6f9;margin-top:12px}.d4-bview-modal{position:fixed;inset:0;z-index:5000;background:#082b3b99;display:grid;place-items:center}.d4-bview-modal[hidden]{display:none}.d4-bview-dialog{width:min(860px,94vw);height:min(720px,92vh);background:white;border-radius:15px;overflow:hidden;display:grid;grid-template-rows:auto 1fr auto}.d4-bview-dialog header,.d4-bview-dialog footer{padding:10px 13px;display:flex;justify-content:space-between;gap:10px;align-items:center}.d4-bview-dialog iframe{width:100%;height:100%;border:0}.d4-bview-dialog button{padding:9px 13px;border:0;border-radius:8px;background:#087fbd;color:white;font-weight:800}@media(max-width:700px){.d4-top-map-tools{display:none}.d4-layer-panel{top:75px}.d4-bridge-drawer{bottom:0;top:auto;height:75%;border-radius:18px 18px 0 0}.d4-clear-button{display:none}}
/* R8 control placement corrections */
.d4-top-map-tools{right:112px;top:62px}
.d4-top-map-tools .d4-layers-button{display:none!important}
.d4-basemap-menu{right:112px;top:112px}
.d4-clear-button{top:112px}
.d4-postmile-label span{background:transparent;border:0;box-shadow:none;color:#122f3c;font-size:11px;text-shadow:-1px -1px 0 #fff,1px -1px 0 #fff,-1px 1px 0 #fff,1px 1px 0 #fff;padding:0}
@media(max-width:700px){.d4-top-map-tools{display:none}}
.d4-bridge-icon div.is-good{background:#269c51}.d4-bridge-icon div.is-fair{background:#e5a512}.d4-bridge-icon div.is-poor{background:#d84646}.d4-bridge-icon div.is-unknown{background:#667b86}.d4-bridge-icon div.is-overpass{border-radius:50%;transform:rotate(45deg)}.d4-bridge-icon div.is-overpass span{transform:rotate(-45deg)}.d4-bridge-legend{margin-top:9px;border:1px solid #cfdee5;border-radius:9px;padding:8px;font-size:12px}.d4-bridge-legend summary{cursor:pointer;font-weight:850;color:#075172}.d4-legend-row{display:flex;align-items:center;gap:7px;margin-top:7px}.d4-legend-dot{width:13px;height:13px;border-radius:50%;display:inline-block}.d4-legend-dot.good{background:#269c51}.d4-legend-dot.fair{background:#e5a512}.d4-legend-dot.poor{background:#d84646}.d4-legend-dot.unknown{background:#667b86}.d4-legend-symbol{width:19px;height:15px;border:2px solid #087fbd;border-radius:4px;display:inline-grid;place-items:center;font-size:9px}.d4-legend-symbol.overpass{border-radius:50%}.d4-protected-frame{width:100%;height:calc(100vh - 135px);border:0;border-radius:8px;background:#eef6f9}
/* R11 placement and compact filter corrections. */
.d4-layer-panel{top:164px;width:min(330px,calc(100vw - 24px))}.d4-bridge-drawer{width:min(560px,46vw)}body:has(.d4-bridge-drawer:not([hidden])) .d4-clear-button{right:min(572px,calc(46vw + 12px))}.d4-single-select{grid-template-columns:minmax(150px,190px)}.d4-row-county{display:block;margin:8px 0 9px;color:#567080;font-size:10px;font-weight:800}.d4-row-county span{display:block;margin-bottom:3px}.d4-row-county select{width:100%;box-sizing:border-box;border:1px solid #bfd2dc;border-radius:7px;padding:6px;background:#fff;color:#183d4f}@media(max-width:700px){.d4-bridge-drawer{height:82%;width:100%}.d4-layer-panel{top:75px}}
.d4-bview-tab-heading{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:8px}.d4-bview-external{flex:0 0 auto;border-radius:8px;background:#087fbd;color:#fff!important;padding:8px 10px;text-decoration:none;font-size:11px;font-weight:850}.d4-bview-tab-heading .d4-bridge-title{margin:0}.d4-bridge-drawer .d4-protected-frame{height:calc(100vh - 115px)}
/* R13 compact stack and distinct bridge symbols. */
.d4-bridge-drawer{top:160px;right:12px;bottom:12px;height:auto;width:min(460px,calc(100vw - 24px));max-height:calc(100vh - 172px);border-radius:15px}.d4-drawer-body{padding:12px}body:has(.d4-bridge-drawer:not([hidden])) .d4-clear-button{right:10px}.d4-bridge-map-legend{position:absolute;right:12px;bottom:26px;z-index:1090;width:315px;box-sizing:border-box;padding:10px;border:1px solid #b9ced8;border-radius:13px;background:#fff;box-shadow:0 7px 22px #173e5530}.d4-bridge-map-legend[hidden]{display:none}.d4-bridge-map-legend .d4-bridge-legend{margin:0}.d4-bridge-map-legend .d4-panel-status{margin-top:8px}.d4-bridge-icon div:not(.is-overpass){width:32px;height:18px;border-radius:6px}.d4-bridge-icon div:not(.is-overpass) span{font-size:0}.d4-bridge-icon div:not(.is-overpass) span:before{content:'═';font-size:17px}.d4-bridge-icon div.is-overpass{width:21px;height:21px;border-radius:3px}.d4-bridge-icon div.is-overpass span{font-size:0}.d4-bridge-icon div.is-overpass span:before{content:'×';font-size:16px}.d4-legend-symbol{width:25px;height:14px;border-radius:4px;font-size:0}.d4-legend-symbol:before{content:'═';font-size:15px}.d4-legend-symbol.overpass{width:16px;height:16px;border-radius:3px;transform:rotate(45deg);font-size:0}.d4-legend-symbol.overpass:before{content:'×';font-size:13px;transform:rotate(-45deg)}.d4-street-view-button{width:100%;margin:10px 0 0;padding:10px;border:0;border-radius:8px;background:#f0a000;color:#fff;font-weight:850;cursor:pointer}#d4PostmilePanel{width:220px}#d4PostmilePanel .d4-single-select{grid-template-columns:150px}#d4PostmilePanel .d4-panel-status{max-width:180px}.d4-postmile-label:not(.is-official) span{font-size:10px!important;color:#21333a!important}@media(max-width:700px){.d4-bridge-drawer{top:auto;right:0;bottom:0;width:100%;max-height:none}.d4-bridge-map-legend{right:8px;bottom:82px;width:min(300px,calc(100vw - 16px))}}
.d4-bridge-search{display:grid;gap:8px}.d4-bridge-search label{display:block;color:#567080;font-size:11px;font-weight:800}.d4-bridge-search input,.d4-bridge-search select{display:block;width:100%;box-sizing:border-box;margin-top:4px;padding:8px;border:1px solid #c4d6df;border-radius:8px;background:#fff;color:#183d4f}.d4-bridge-search-back{margin-left:auto!important;margin-right:5px!important;padding:6px 9px!important;border-radius:7px!important;background:#e5f3f8!important;color:#087fbd!important}.d4-bridge-drawer .d4-panel-head>strong{margin-right:auto}
.d4-clear-button{width:94px!important;height:44px!important;padding:0 6px!important;border-radius:13px!important;font-size:11px!important;line-height:1.05!important}body:not(.map-layers-panel-open) .camera-filter-control.is-visible,body:not(.map-layers-panel-open) .sensitive-filter-control.is-visible,body:not(.map-layers-panel-open) .traffic-options-control.is-visible,body:not(.map-layers-panel-open) .county-marker-filter-control.is-visible{top:164px!important}.d4-lease-popup{min-width:210px;color:#183d4f;font-size:12px;line-height:1.35}.d4-lease-popup>strong{display:block;margin-bottom:7px;color:#075172;font-size:14px}.d4-lease-popup div{margin:3px 0}.d4-lease-popup a{display:block;margin-top:8px;color:#087fbd;font-weight:800}
.d4-clean-lease-popup .leaflet-popup-content{width:auto!important;min-width:215px;max-width:260px;margin:12px 15px!important}.d4-clean-lease-popup .d4-lease-popup{min-width:0;max-height:none;overflow:visible}.d4-clean-lease-popup .d4-lease-popup div{display:grid;grid-template-columns:max-content minmax(0,1fr);gap:5px;margin:4px 0;overflow-wrap:anywhere}.d4-clean-lease-popup .leaflet-popup-content-wrapper{border-top:4px solid #8e44ad}
.d4-clean-lease-popup .d4-lease-document{display:block;margin-top:10px;padding:9px 12px;border-radius:8px;background:#1188c1;color:#fff!important;text-align:center;text-decoration:none;font-size:11px;font-weight:900;letter-spacing:.25px}
/* R17 BView protected-pane presentation and compact lease controls. */
#d4LeasePanel{width:290px!important;max-width:calc(100vw - 24px)!important}.d4-lease-popup{max-height:340px;overflow:auto}.d4-bview-note{margin:0 0 8px;padding:8px;border-radius:8px;background:#eef7fa;color:#31596b;font-size:11px}.d4-bview-crop{position:relative;width:100%;height:calc(100vh - 250px);min-height:430px;overflow:hidden;border:1px solid #c8dae2;border-radius:9px;background:#fff}.d4-bview-crop .d4-protected-frame{position:absolute!important;top:0;right:0;width:1900px!important;max-width:none!important;height:100%!important;border:0!important;border-radius:0!important}@media(max-width:700px){.d4-bview-crop{height:calc(82vh - 160px);min-height:380px}.d4-bview-crop .d4-protected-frame{width:1500px!important}}
@media(max-width:700px){body:not(.installed-app-only) .d4-layer-panel{position:fixed!important;z-index:2200!important;top:auto!important;right:0!important;bottom:0!important;left:0!important;width:100%!important;max-width:none!important;box-sizing:border-box!important;border-radius:20px 20px 0 0!important;padding:14px 16px calc(16px + env(safe-area-inset-bottom))!important}body:not(.installed-app-only) #d4LeasePanel{width:100%!important;max-width:none!important}}

/* R23: one collision-free desktop stack. Layers always owns the top layer;
   Clear Layers, Pin, and the active layer panel follow in that order. */
@media (min-width:701px){
  body:not(.installed-app-only) .leaflet-top.leaflet-right{z-index:5000!important}
  body:not(.installed-app-only) .leaflet-control-layers,
  body:not(.installed-app-only) .leaflet-control-layers-expanded{position:relative!important;z-index:9000!important}
  body:not(.installed-app-only).map-layers-panel-open .leaflet-control-layers-list{z-index:9100!important}
  body:not(.installed-app-only) .d4-clear-button{z-index:4800!important}
  body:not(.installed-app-only) .pin-drop-control.is-visible{z-index:4700!important}
  body:not(.installed-app-only) .camera-filter-control.is-visible,
  body:not(.installed-app-only) .sensitive-filter-control.is-visible,
  body:not(.installed-app-only) .traffic-options-control.is-visible,
  body:not(.installed-app-only) .county-marker-filter-control,
  body:not(.installed-app-only) .d4-layer-panel:not([hidden]),
  body:not(.installed-app-only) #measurePanel.is-visible{z-index:4600!important;box-sizing:border-box!important}
  body:not(.installed-app-only).map-layers-panel-open .camera-filter-control,
  body:not(.installed-app-only).map-layers-panel-open .sensitive-filter-control,
  body:not(.installed-app-only).map-layers-panel-open .traffic-options-control,
  body:not(.installed-app-only).map-layers-panel-open .county-marker-filter-control,
  body:not(.installed-app-only).map-layers-panel-open .pin-drop-control,
  body:not(.installed-app-only).map-layers-panel-open .d4-layer-panel,
  body:not(.installed-app-only).map-layers-panel-open #measurePanel,
  body:not(.installed-app-only).map-layers-panel-open #restoreMeasureTab{visibility:hidden!important;pointer-events:none!important}
  /* Keep Clear Layers available while the Layers menu is open. The menu sits
     below it instead of covering it. */
  body:not(.installed-app-only).map-layers-panel-open .d4-clear-button{visibility:visible!important;pointer-events:auto!important}
  body:not(.installed-app-only).map-layers-panel-open .leaflet-control-layers-list{
    position:fixed!important;
    top:164px!important;
    right:10px!important;
    max-height:calc(100vh - 176px)!important;
  }
  body:not(.installed-app-only) .drain-inlet-legend,
  body:not(.installed-app-only) .right-of-way-legend,
  body:not(.installed-app-only) .sensitive-area-legend{position:relative!important;top:auto!important;right:auto!important;bottom:auto!important;z-index:1200!important}
}
