html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
}

/* Ensure our content-sized selects can shrink (flex min-width quirk) */
.pm-nav-toolbar .pm-nav-native-select,
.pm-nav-toolbar .pm-nav-boundary-button {
  width: auto;
  min-width: 0;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
  z-index: 5000;
}

.skip-link:focus {
  position: fixed;
  left: 12px;
  top: 12px;
  width: auto;
  height: auto;
  padding: 10px 14px;
  background: #002244;
  color: #fff;
  text-decoration: underline;
  border-radius: 4px;
  overflow: visible;
  outline: 3px solid #e8f2fc;
  outline-offset: 2px;
}

/* Top nav + map: flex column fills viewport; hard height prevents body scroll (map app = no page scroll) */
#app-layout {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

.app-top-nav {
  flex: 0 0 auto;
  width: 100%;
  box-sizing: border-box;
  background: #ffffff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  z-index: 2000;
}

.pm-nav {
  max-width: 100%;
  padding: 12px 20px 14px;
  box-sizing: border-box;
}

/* One wrapping row: wide viewports = PM + time + color + pattern on one line; narrow / zoom = 2+ rows */
.layer-select-wrapper,
.pm-nav-toolbar {
  display: flex;
  flex-wrap: nowrap;
  gap: 14px 28px;
  align-items: flex-end;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow-x: auto;
  padding: 4px 2px;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
}

.pm-nav-field {
  flex: 0 0 auto;
  min-width: 0; /* let controls size to their contents */
  max-width: 100%;
}

/* Keep fields compact; JS sets widths based on option text */
.pm-nav-field--metric,
.pm-nav-field--time,
.pm-nav-field--scheme,
.pm-nav-field--basemap,
.pm-nav-field--boundaries {
  min-width: 0;
}

.pm-nav-field--pattern {
  align-self: flex-end;
  padding-bottom: 4px;
}

@media (min-width: 1100px) {
  /* Only direct-child .pm-nav-field (primary controls) expand to fill available space */
  .pm-nav-toolbar > .pm-nav-field {
    flex: 0 0 auto;
    min-width: 0;
  }
}

.pm-nav-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: #1a1a1a;
  margin-bottom: 4px;
}

.pm-nav-label--secondary {
  font-size: 12px;
  font-weight: normal;
  color: #595959;
}

/* Thin vertical divider — also acts as the spacer that pushes secondary controls to the right */
.pm-nav-divider {
  flex: 1 1 auto;
  align-self: stretch;
  position: relative;
  min-width: 16px;
}
.pm-nav-divider::after {
  content: "";
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #dee2e6;
  border-radius: 2px;
}

.pm-nav-boundary-button {
  /* Match native select look */
  width: 100%;
  text-align: left;
  position: relative;
  cursor: pointer;
  white-space: nowrap;
}

/* Hide the Bootstrap 3 triangle caret; we draw a matching chevron via
   background-image on the rule below so all dropdowns share one arrow style. */
.pm-nav-boundary-button .caret {
  display: none;
}

.pm-nav-boundary-menu {
  position: fixed;
  left: 0;
  top: 0;
  min-width: 220px;
  max-width: none; /* width is set inline to fit checkbox labels */
  background: #fff;
  border: 1px solid #495057; /* match .form-control border */
  border-radius: 4px; /* closer to select */
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.15);
  padding: 4px 0;
  z-index: 3000;
}

.pm-nav-boundary-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  cursor: pointer;
  margin: 0;
  font-weight: normal;
  font-size: 14px;
  line-height: 1.2;
  user-select: none;
}

.pm-nav-boundary-item:hover {
  background: #e9ecef; /* match other UI hover tones */
}

.pm-nav-boundary-item input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  flex: 0 0 auto;
}

.pm-nav-boundary-item input[type="checkbox"]:focus-visible {
  outline: 3px solid #005fcc;
  outline-offset: 2px;
}

/* Narrow screens / high zoom: keep header compact and readable */
@media (max-width: 980px) {
  .pm-nav {
    padding: 10px 14px 12px;
  }

  .layer-select-wrapper,
  .pm-nav-toolbar {
    gap: 10px 14px;
    align-items: flex-end;
    padding: 3px 2px;
  }

  .pm-nav-field {
    min-width: 0;
  }

  .pm-nav-label {
    font-size: 13px;
  }
}

/* Visual hint that the filter row can scroll horizontally when needed */
.pm-nav-toolbar::-webkit-scrollbar {
  height: 10px;
}
.pm-nav-toolbar::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.15);
  border-radius: 10px;
}
.pm-nav-toolbar::-webkit-scrollbar-track {
  background: transparent;
}

/* All selects: same height, font size, AND arrow style for visual consistency.
   Browser default <select> chevrons differ across OSes; we replace them with a
   single shared SVG chevron so the Boundary-layers button (<button>) and the
   native <select>s look identical. */
.pm-nav-native-select,
.pm-nav-native-select--secondary,
.pm-nav-boundary-button {
  height: 34px;
  min-height: 34px;
  font-size: 14px;
  border: 1px solid #495057;
  color: #1a1a1a;
  background-color: #fff;
  padding-top: 0;
  padding-bottom: 0;
  padding-right: 30px;
  line-height: 34px;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23495057' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 12px 10px;
}

/* IE fallback: hide legacy expand arrow so our SVG is the only one shown */
.pm-nav-native-select::-ms-expand,
.pm-nav-native-select--secondary::-ms-expand {
  display: none;
}

.pm-nav-native-select:focus-visible,
.pm-nav-boundary-button:focus-visible {
  outline: 3px solid #005fcc;
  outline-offset: 2px;
}

.pm-nav-checkbox-wrap {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.pm-nav-checkbox-wrap input[type="checkbox"] {
  width: 1.15rem;
  height: 1.15rem;
  margin-top: 3px;
  flex-shrink: 0;
}

.pm-nav-checkbox-wrap input[type="checkbox"]:focus-visible {
  outline: 3px solid #005fcc;
  outline-offset: 2px;
}

.pm-nav-checkbox-label {
  color: #1a1a1a;
  line-height: 1.35;
  margin: 0;
  font-weight: normal;
  cursor: pointer;
}

.pm-nav-checkbox-label--secondary {
  font-size: 12px;
  color: #595959;
}

.pm-nav-fieldset--secondary .pm-nav-checkbox-wrap input[type="checkbox"] {
  width: 1.25rem;
  height: 1.25rem;
}

.app-main {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#map-shell {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

/* Intentionally no map-shell :focus-within highlight:
   map highlight should appear only when the map canvas itself is focused,
   and turn off when tabbing to map controls (e.g., Search button). */

#map {
  position: absolute;
  top: 0;
  bottom: 0;
  right: 0;
  left: 0;
  z-index: 1;
}

/* Map-region focus ring (toggled via JS when map is focused). */
#map-shell.map-focus-highlight::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  box-shadow: inset 0 0 0 3px #005fcc;
  z-index: 1200;
}

.btn-popup-container {
  display: inline;
  align-content: center;
  align-items: center;
  justify-content: center;
}

.leaflet-bar {
  box-shadow: none;
  border: none !important;
  background: transparent !important;
}

.leaflet-bar a {
  border-radius: 4px !important;
  background-color: #002244;
  border: 2px solid #e8f2fc;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

.leaflet-bar a,
.leaflet-bar a:hover,
.leaflet-bar a:focus {
  border-bottom: 2px solid #e8f2fc !important;
  text-decoration: none !important;
}

.leaflet-bar a:hover {
  background-color: #e8f2fc;
  border: 2px solid #002244 !important;
  color: #002244;
  display: flex;
  align-items: center;
  justify-content: center;
}

.leaflet-control-zoom-in {
  margin-top: 0;
}

.leaflet-control-zoom-out {
  margin-top: 6px;
}

.leaflet-bar a + a {
  margin-top: 6px;
}

/* Sidebar close (×) button — override Bootstrap's faint default (opacity 0.2,
   color #000) so the button meets WCAG contrast on the light-blue sidebar
   background and matches the squared shape of the dashboard dialog's
   .dashboard-close-btn for visual consistency across close buttons. */
.leaflet-sidebar .close {
  z-index: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 4px;
  border: 2px solid #002244;
  background-color: transparent;
  color: #002244;
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
  opacity: 1;
  text-shadow: none;
  cursor: pointer;
}

.leaflet-sidebar .close:hover,
.leaflet-sidebar .close:focus {
  background-color: #002244;
  color: #ffffff;
  border-color: #002244;
  opacity: 1;
  text-decoration: none;
}

.leaflet-sidebar .close:focus-visible {
  outline: 3px solid #005fcc;
  outline-offset: 2px;
}

.info {
  padding: 6px 8px;
  font:
    13px/13px Arial,
    Helvetica,
    sans-serif;
  background: white;
  box-shadow: 0 0 15px rgba(0, 0, 0, 0.2);
  border-radius: 5px;
}

.legend {
  margin-top: 10px;
  line-height: 15px;
  color: #323232;
  /* Prevent legend from growing into other controls at 200% zoom */
  /*max-height: min(40vh, 320px);*/
  overflow: auto;
}

@media (max-width: 900px), (max-height: 700px) {
  .legend {
    max-width: min(80vw, 900px);
  }
  .hover-info {
    max-width: min(46vw, 340px);
  }
}

/* Each legend entry: swatch on the left, label on the right, always flush-left */
.legend-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 3px;
}

/* Colour-square swatch (standard / colour-ramp schemes) */
.legend i {
  display: block;
  width: 40px;
  height: 9px;
  flex-shrink: 0;
  opacity: 1;
}

/* SVG line swatch (custom line-style schemes) */
.legend .legend-line-swatch {
  display: block;
  flex-shrink: 0;
}

.legend-label {
  line-height: 1.3;
}

#leaflet-bar {
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

#leaflet-bar .btn {
  border-radius: 4px !important;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

#leaflet-bar .btn-basic {
  color: white;
  background-color: #4c46b5;
}

#leaflet-bar .btn-basic:hover {
  color: #fff;
  background-color: #5846b5;
  border-color: #204d74;
}

#leaflet-bar .btn-basic:focus {
  color: #fff;
  background-color: #5846b5;
  border-color: #204d74;
}

/* --------------------------------------------------------------------------
   Top-left map controls: higher text/button contrast + visible keyboard focus
   (WCAG 2.1: 1.4.3 text contrast, 2.4.7 focus visible — 3px outline, 2px offset)
   -------------------------------------------------------------------------- */

.leaflet-bar a:focus-visible,
#leaflet-bar .btn:focus-visible {
  outline: 3px solid #005fcc;
  outline-offset: 2px;
  z-index: 2;
}

.leaflet-bar a:focus:not(:focus-visible),
#leaflet-bar .btn:focus:not(:focus-visible) {
  outline: none;
}

/* Zoom / Home: keep symbols at ≥4.5:1 on navy */
.leaflet-bar a {
  font-weight: 700;
}

/* Custom toolbar: Bootstrap defaults are weak (e.g. white on #f0ad4e, #5bc0de) */
#leaflet-bar .btn {
  font-weight: 700;
  border-width: 2px !important;
  color: #ffffff !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

#leaflet-bar .btn:focus {
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

#leaflet-bar .btn-primary {
  background-color: #1466b8 !important;
  border-color: #062d57 !important;
}

#leaflet-bar .btn-primary:hover,
#leaflet-bar .btn-primary:focus {
  background-color: #08345f !important;
  border-color: #041a30 !important;
  color: #ffffff !important;
}

#leaflet-bar .btn-info {
  background-color: #00738a !important;
  border-color: #064854 !important;
}

#leaflet-bar .btn-info:hover,
#leaflet-bar .btn-info:focus {
  background-color: #006275 !important;
  border-color: #04323c !important;
  color: #ffffff !important;
}

#leaflet-bar .btn-warning {
  background-color: #b45309 !important;
  border-color: #7c2d12 !important;
}

#leaflet-bar .btn-warning:hover,
#leaflet-bar .btn-warning:focus {
  background-color: #92400e !important;
  border-color: #5c1f0a !important;
  color: #ffffff !important;
}

#leaflet-bar .btn-success {
  background-color: #1d6f42 !important;
  border-color: #14532d !important;
}

#leaflet-bar .btn-success:hover,
#leaflet-bar .btn-success:focus {
  background-color: #166534 !important;
  border-color: #0f3d22 !important;
  color: #ffffff !important;
}

.wrapper {
  overflow-x: hidden;
  overflow-y: visible;
}

.wrapper .selection {
  height: 175px;
  width: 200px;
  border: 1px solid rgb(167, 156, 214);
}

.wrapper .selection .menuitem {
  padding: 5px;
  border-bottom: 1px solid #efefef;
}

#zoomtoCountycontainer {
  position: absolute;
  top: -310px;
  left: 200px;
}

#zoomtoDistrictcontainer {
  position: absolute;
  top: -310px;
  left: 200px;
}

.dropdown1 {
  position: absolute;
  top: 20px;
  right: 55px;
}

.btn-dropdown-toggle::after {
  display: block;
}

.btn-new {
  width: 130px;
  height: 29px;
  background-color: #4c46b5;
  color: white;
}

.btn-new:hover {
  width: 130px;
  height: 29px;
  background-color: #4c46b5;
  color: white;
}

.btn-new:focus-visible {
  width: 130px;
  height: 29px;
  background-color: #4c46b5;
  color: white;
  outline: 3px solid #005fcc;
  outline-offset: 2px;
}

.btn-new:focus:not(:focus-visible) {
  outline: none;
}

.btn-new-sub {
  width: 100px;
  height: 20px;
  background-color: white;
  color: black;
  line-height: 1em;
}

/*LJ Alt */
#disClaimer {
  width: 100%;
  padding: 50px 0;
  text-align: center;
  background-color: lightblue;
  margin-top: 20px;
}

.leaflet-popup-content {
  width: auto !important;
}

#searchLoc {
  position: absolute;
  top: 12px;
  left: 45px;
  z-index: 1001;
}

.leaflet-control-geocoder {
  position: fixed;
  top: 160px;
  left: 45px;
}

.roadwaySearchWrapper {
  position: absolute;
  top: 35px;
  left: 40px;
  background-color: white;
  width: 300px;
  height: 100px;
}

#rid-search {
  margin-top: 5px;
}

#roadway-id-search-button {
  margin-top: 5px;
  background-color: #002244;
  /*border: 2px solid rgba(0, 0, 0, 0.2);*/
  color: #e8f2fc;
}

#roadway-id-invalid-label {
  display: none;
  color: #9c1c12;
}

.leaflet-control-layers-list {
  margin-bottom: 5px;
}

.leaflet-top {
  z-index: 1001;
}

/* Leaflet attribution strip: solid background + dark text/links (WCAG 2.1 AA on map) */
.leaflet-container .leaflet-control-attribution {
  background: #ffffff;
  color: #1a1a1a;
  border-top: 1px solid #adb5bd;
  padding: 4px 8px;
  box-shadow: 0 -2px 6px rgba(0, 0, 0, 0.12);
}

.leaflet-control-attribution a {
  color: #0b4a8c;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.leaflet-control-attribution a:hover {
  color: #062d57;
  text-decoration: underline;
}

.leaflet-control-attribution a:focus-visible {
  outline: 3px solid #005fcc;
  outline-offset: 2px;
  border-radius: 2px;
}

.popup-container {
  padding: 10px;
  background-color: #fff;
  border-radius: 5px;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

.popup-header {
  text-align: center;
  text-decoration: underline;
  margin-bottom: 10px;
}

.popup-subheader {
  text-align: center;
}

.radio-container {
  margin-bottom: 10px;
  display: flex;
  flex-direction: row;
  justify-content: center;
  gap: 10px;
}

.radio-label {
  display: block;
  margin-bottom: 5px;
}

.popup-content {
  padding: 5px;
}

/* Boundary overlay labels: non-interactive; pane sets pointer-events none */
.leaflet-boundaryLabels-pane .boundary-label-marker {
  background: transparent !important;
  border: none !important;
}

/* WCAG 2.1 AA: default Bootstrap .btn-danger (~3.96:1) below 4.5:1 for normal text */
.btn-danger,
.btn-danger:focus,
.btn-danger:active {
  background-color: #b42318;
  border-color: #9c1f15;
  color: #ffffff;
}

.btn-danger:hover {
  background-color: #9c1f15;
  border-color: #851a12;
  color: #ffffff;
}

/* ── Segment dashboard: accessible modal dialog overrides ─────────────────────── */

/* Raise above everything (was z-index:2 in jltUtil.css) */
#dashboardoverlay {
  z-index: 4000 !important;
  cursor: default !important;
}

/* Dialog wrapper: flex column so header + chart area stack cleanly */
#d3-dashboard-wrapper {
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
  /* outline removed for visual cleanliness; focus ring appears on focus-visible */
  outline: none;
}

#d3-dashboard-wrapper:focus-visible {
  outline: 3px solid #005fcc;
  outline-offset: 2px;
}

/* Header bar: dark navy matches site palette, clear visual separation */
.dashboard-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: 0 0 auto;
  padding: 10px 12px 10px 16px;
  background-color: #002244;
  border-bottom: 2px solid rgba(0, 0, 0, 0.2);
  position: relative;
}

.dashboard-dialog-title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: #e8f2fc;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding-right: 12px;
}

/* Close button: top-right, navy/light palette (~14.7:1 contrast) */
.dashboard-close-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 4px;
  border: 2px solid #e8f2fc;
  background-color: transparent;
  color: #e8f2fc;
  font-size: 16px;
  cursor: pointer;
  line-height: 1;
}

.dashboard-close-btn:hover {
  background-color: #e8f2fc;
  color: #002244;
}

.dashboard-close-btn:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 2px;
}

/* Chart area fills all remaining height after the header */
#d3-dashboard-wrapper > #d3-dashboard {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  height: auto !important;
  overflow: hidden;
}

/* Dashboard content grid:
   - Wide (≥992px): two columns side-by-side, each independently scrollable,
     the row fills the dialog's remaining height so the legend table tracks
     the modal size.
   - Narrow (<992px): columns stack and the whole dashboard scrolls
     vertically, so the performance-measure table is reachable instead of
     being clipped by the wrapper's overflow:hidden. */
#d3-dashboard {
  overflow: auto !important; /* narrow-screen fallback scroller */
}

#d3-dashboard > .row {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  min-height: 100%;
}

#d3-dashboard .dashboard-col {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* Keep the Piechart slot at its natural height above the legend. */
#d3-dashboard .dashboard-col--chart > #d3-piechart {
  flex: 0 0 auto;
}

/* Legend (performance-measure table) fills remaining column height and
   scrolls internally when content exceeds the available space. */
#d3-dashboard #d3-legend {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  overflow: auto;
}

@media (min-width: 992px) {
  /* Wide screens: clip the outer container and give each column its own
     scroll, as originally intended. */
  #d3-dashboard {
    overflow: hidden !important;
  }
  #d3-dashboard > .row {
    height: 100%;
    min-height: 0;
    flex-wrap: nowrap;
  }
  #d3-dashboard .dashboard-col {
    height: 100%;
    overflow: auto;
  }
}

/* ── Data Download dialog: accessible modal (mirrors segment dashboard pattern) ── */

/* Raise above everything; remove the misleading pointer cursor on the backdrop */
#county-select-overlay {
  z-index: 4000 !important;
  cursor: default !important;
}

/* Dialog container: flex column so header stacks above scrollable body */
#county-select {
  display: flex !important;
  flex-direction: column !important;
  padding: 0 !important;
  min-width: 320px;
  max-width: 560px;
  width: 90vw;
  max-height: 90vh;
  overflow: hidden !important;
  border-radius: 8px !important;
  outline: none;
  background-color: #fff !important;
}

#county-select:focus-visible {
  outline: 3px solid #005fcc;
  outline-offset: 2px;
}

/* Scrollable body area below the header */
.download-dialog-body {
  padding: 20px 24px 28px;
  overflow-y: auto;
  flex: 1 1 auto;
}

/* Each download row: label on top, controls (select + button) inline below */
.download-form-row {
  margin-bottom: 8px;
}

.download-form-label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
  color: #1a1a1a;
}

/* Statewide row: label sits inside the flex row, taking up the space a select would */
.download-form-label--inline {
  flex: 1 1 auto;
  margin-bottom: 0;
  align-self: center;
}

.download-form-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.download-form-controls .form-control {
  flex: 1 1 auto;
  min-width: 0;
}

#statewide-place-holder {
  display: none;
}

.download-form-controls .btn {
  flex-shrink: 0;
  white-space: nowrap;
}

/* Progress bars: give them a bit of breathing room */
.download-dialog-body .progress {
  margin-top: 6px;
  margin-bottom: 16px;
}

/* Fix Bootstrap 3's .btn:focus { color: #333 } on the primary download buttons */
.download-dialog-body .btn-primary:focus:not(:focus-visible) {
  color: #fff;
  background-color: #337ab7;
  border-color: #2e6da4;
}

/* ── Bottom segment list: flex chain + scroll ────────────────────────────────── */
.segment-panel {
  display: flex;
  flex-direction: column;
  flex: 0 0 280px;
  max-height: 65vh;
  min-height: 0;
  overflow: hidden;
  background: #f8f9fa;
  border-top: 1px solid #adb5bd;
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.08);
}

.segment-panel.segment-panel--collapsed {
  flex: 0 0 auto;
  max-height: none;
  box-shadow: none;
}

.segment-panel-resize-handle {
  flex: 0 0 auto;
  height: 8px;
  cursor: ns-resize;
  background: linear-gradient(to bottom, #dee2e6, #ced4da);
  border-bottom: 1px solid #adb5bd;
}

.segment-panel-resize-handle:focus-visible {
  outline: 3px solid #005fcc;
  outline-offset: -2px;
}

.segment-panel-toggle {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 6px 12px;
  margin: 0;
  border: 0;
  border-bottom: 1px solid #adb5bd;
  background: #e9ecef;
  color: #1a1a1a;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.segment-panel-toggle:hover {
  background: #dee2e6;
}

.segment-panel-toggle:focus-visible {
  outline: 3px solid #005fcc;
  outline-offset: -3px;
  z-index: 1;
}

.segment-panel-body {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  padding: 0 10px 10px;
}

/* Bootstrap 3 omits !important on [hidden], so display:flex above would override the UA rule.
   Force display:none when the panel body is hidden by JS. */
.segment-panel-body[hidden] {
  display: none !important;
}

.segment-table-toolbar {
  flex: 0 0 auto;
  padding-top: 8px;
}

.segment-table-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: flex-end;
}

.segment-filter-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 120px;
  flex: 1 1 140px;
}

.segment-filter-field--roadway {
  flex: 1 1 160px;
  max-width: 220px;
}

.segment-filter-field label {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  color: #1a1a1a;
}

.segment-filter-actions {
  display: flex;
  gap: 8px;
  flex: 0 0 auto;
  padding-bottom: 2px;
}

.segment-table-filter-error {
  margin: 8px 0 0;
  font-size: 13px;
  color: #842029;
}

.segment-table-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  margin-top: 8px;
  border: 1px solid #ced4da;
  border-radius: 4px;
  background: #fff;
}

.segment-table {
  margin-bottom: 0;
  font-size: 12px;
  width: 100%;
  table-layout: fixed;
  /* Sum of fixed column widths (108+156+190+70+110+90+440+280).
     Forces .segment-table-scroll to scroll horizontally instead of
     squeezing the last (Actions) column to zero on narrow viewports. */
  min-width: 1444px;
}

.segment-table caption {
  caption-side: top;
  padding: 8px 10px;
  text-align: left;
  font-size: 12px;
  color: #495057;
  background: #f1f3f5;
  border-bottom: 1px solid #dee2e6;
}

.segment-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #e9ecef;
  box-shadow: 0 1px 0 #ced4da;
  white-space: nowrap;
}

/* Table cells: keep compact columns from expanding; show ellipsis */
.segment-table thead th,
.segment-table tbody td,
.segment-table tbody th[scope="row"] {
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Roadway ID (row header) */
.segment-table tbody th[scope="row"],
.segment-table thead th:first-child {
  width: 108px;
  max-width: 108px;
}

/* Begin/End mileposts (first body cell is th for Roadway ID) */
.segment-table thead th:nth-child(2),
.segment-table tbody td:nth-child(2) {
  width: 156px;
  max-width: 156px;
}

/* Name column: reduce default width */
.segment-table thead th:nth-child(3),
.segment-table tbody td.segment-table-col-name {
  width: 190px;
  max-width: 240px;
}

/* District */
.segment-table thead th:nth-child(4),
.segment-table tbody td:nth-child(4) {
  width: 70px;
  max-width: 70px;
}

/* County */
.segment-table thead th:nth-child(5),
.segment-table tbody td:nth-child(5) {
  width: 110px;
  max-width: 110px;
}

/* Facility type */
.segment-table thead th:nth-child(6),
.segment-table tbody td:nth-child(6) {
  width: 90px;
  max-width: 90px;
}

.segment-table tbody tr:focus {
  outline: 3px solid #5b21b6;
  outline-offset: -2px;
  background-color: #ede9fe;
}

/* Measure column: give it more default space; header wraps */
.segment-table th#segment-table-measure-header,
.segment-table-col-measure {
  width: 440px;
  min-width: 80px;
  max-width: 560px;
}

.segment-table th#segment-table-measure-header {
  white-space: normal;
  word-break: break-word;
  line-height: 1.3;
}

/* Actions column (8th) — reserve space so buttons remain visible even
   when the scroll container is narrow. */
.segment-table thead th:nth-child(8),
.segment-table tbody td.segment-table-actions {
  width: 280px;
  min-width: 280px;
}

.segment-table-actions {
  white-space: nowrap;
  padding-left: 6px !important;
  /* Override the generic `overflow: hidden` on tbody td so action buttons
     are never clipped. */
  overflow: visible;
}

/* Action buttons: navy on light (#002244 / #e8f2fc) → ~14.7:1 contrast, satisfies 3:1 and 4.5:1 */
.segment-table-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 9px;
  margin-right: 8px;
  border-radius: 4px;
  border: 2px solid rgba(0, 0, 0, 0.2);
  background-color: #002244;
  color: #e8f2fc;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
}

.segment-table-icon-btn:last-child {
  margin-right: 0;
}

.segment-table-icon-btn:hover,
.segment-table-icon-btn:focus-visible {
  background-color: #e8f2fc;
  color: #002244;
  border-color: #002244;
  outline: 3px solid #005fcc;
  outline-offset: 2px;
}

/* Bootstrap 3's .btn:focus sets color:#333, overriding our light text on dark bg.
   For pointer/programmatic focus (not keyboard), preserve the default button appearance. */
.segment-table-icon-btn:focus:not(:focus-visible) {
  color: #e8f2fc;
  background-color: #002244;
  border-color: rgba(0, 0, 0, 0.2);
}

/* =======================================================================
   KEYBOARD FOCUS CONSISTENCY  (ADA II / WCAG 2.1 AA)

   Standard token:  outline: 3px solid #005fcc; outline-offset: 2px
     - #005fcc on white: 4.86:1 contrast  ✓ passes 3:1 non-text + 4.5:1 text
     - On dark navy backgrounds: outline: 3px solid #fff (see dashboard-close-btn)
   Pattern: :focus-visible shows ring for keyboard nav only;
            :focus:not(:focus-visible) suppresses it for pointer nav.
   ======================================================================= */

/* ── 1. Buttons: replace Bootstrap 3's browser-specific webkit ring ─────── */
/* Bootstrap 3 emits  outline: 5px auto -webkit-focus-ring-color  which
   looks different on every browser. Replace with a uniform 3 px ring.
   More-specific rules (e.g. #leaflet-bar .btn, .dashboard-close-btn) still win. */

.btn:focus-visible {
  outline: 3px solid #005fcc !important;
  outline-offset: 2px !important;
  box-shadow: none !important;
}

.btn:focus:not(:focus-visible) {
  outline: none !important;
  box-shadow: none !important;
}

/* ── 2. Search sub-menu buttons (no prior focus style at all) ─────────── */
.btn-new-sub:focus-visible {
  outline: 3px solid #005fcc;
  outline-offset: 2px;
}

.btn-new-sub:focus:not(:focus-visible) {
  outline: none;
}

/* ── 3. Form controls: replace low-contrast glow with visible outline ──── */
/* Bootstrap 3 default: border-color: #66afe9 + 8 px rgba glow.
   The glow alone often fails the 3:1 focus-indicator contrast requirement.
   Replace with border-colour change + 3 px outline. */

.form-control:focus {
  border-color: #005fcc !important;
  outline: 3px solid #005fcc !important;
  outline-offset: 0 !important;
  box-shadow: none !important;
}

/* ── 4. Links: replace Bootstrap 3's webkit ring with project standard ── */
/* Bootstrap 3: outline: 5px auto -webkit-focus-ring-color on a:focus.    */

a:focus-visible {
  outline: 3px solid #005fcc !important;
  outline-offset: 2px;
  border-radius: 2px;
  text-decoration: underline;
}

a:focus:not(:focus-visible) {
  outline: none !important;
}

/* ── 5. Popup action buttons (on navy background, shown in map popups) ── */
/* Outline sits on the popup's white content area → #005fcc on white ✓    */
.popupBtnContainer button:focus-visible,
.leaflet-popup-content .btn:focus-visible {
  outline: 3px solid #005fcc !important;
  outline-offset: 2px !important;
  box-shadow: none !important;
}

.popupBtnContainer button:focus:not(:focus-visible),
.leaflet-popup-content .btn:focus:not(:focus-visible) {
  outline: none !important;
  box-shadow: none !important;
}

/* ── 6. Radio buttons (popup road-type selection) ───────────────────── */
input[type="radio"]:focus-visible {
  outline: 3px solid #005fcc;
  outline-offset: 2px;
}

input[type="radio"]:focus:not(:focus-visible) {
  outline: none;
}

/* =======================================================================
   NON-TEXT CONTRAST FIXES  (WCAG 1.4.11, ADA II — minimum 3:1)

   Bootstrap 3 default .form-control and .btn-default use border-color:#ccc
   which gives only ~1.6:1 on white — well below the 3:1 requirement for
   UI component boundaries.  Fix globally to #495057 (≈7.1:1 on white),
   consistent with the top-nav native selects.
   ======================================================================= */

/* ── Form control default border ───────────────────────────────────────
   Affects: segment-panel filter selects + text input, county/district
   download selects, and any other .form-control in the project.          */
.form-control {
  border-color: #495057;
}

/* ── Clear (secondary) button in segment panel ─────────────────────────
   Bootstrap's .btn-default border #ccc on #fff white = ~1.6:1 ✗
   Project-standard #495057 border = ~7.1:1 on white ✓               */
.segment-filter-actions .btn-default {
  color: #1a1a1a;
  background-color: #ffffff;
  border-color: #495057;
  border-width: 2px;
}

.segment-filter-actions .btn-default:hover {
  color: #1a1a1a;
  background-color: #e9ecef;
  border-color: #343a40;
}

.segment-filter-actions .btn-default:active {
  color: #1a1a1a;
  background-color: #dee2e6;
  border-color: #343a40;
}
