/* Section navigation stays compact and fully visible. Original controls remain
   available when JavaScript cannot create the mobile selector. */
html:root body :is(.area-report-tabs, .complaint-view-tabs, .status-tabs,
  .secretary-task-filters, .resident-review-desk-filters, .bpw-map-metric-bar,
  .premium-trend-period, .city-module-tabs, .citizen-news-tablist) {
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: center;
  gap: 6px !important;
  min-width: 0 !important;
  max-width: 100%;
  overflow: visible !important;
  scroll-snap-type: none !important;
}

html:root body :is(.area-report-tabs, .complaint-view-tabs, .status-tabs,
  .secretary-task-filters, .resident-review-desk-filters, .bpw-map-metric-bar,
  .premium-trend-period, .city-module-tabs, .citizen-news-tablist) > :is(a, button) {
  display: inline-flex !important;
  flex: 1 1 auto !important;
  align-items: center;
  justify-content: center;
  gap: 6px !important;
  min-width: 0 !important;
  min-height: 34px !important;
  height: auto !important;
  padding: 6px 9px !important;
  font-size: .8125rem !important;
  line-height: 1.25 !important;
  white-space: normal !important;
  text-decoration: none;
}

html:root body :is(.area-report-tabs, .complaint-view-tabs, .status-tabs,
  .secretary-task-filters, .resident-review-desk-filters, .bpw-map-metric-bar,
  .premium-trend-period, .city-module-tabs, .citizen-news-tablist) > :is(a, button) :is(.icon, .ui-icon, .ico, .bpw-icon) {
  flex: 0 0 16px !important;
  width: 16px !important;
  height: 16px !important;
  min-width: 16px !important;
  min-height: 16px !important;
}

/* Dashboard map controls have route-specific legacy geometry. */
html:root body.bims-admin-shell .bpw-map-metric-bar {
  flex-wrap: wrap !important;
}

html:root body.bims-pro-shell.bims-admin-shell .bpw-map-metric-bar > .bpw-map-filter {
  flex: 1 1 auto !important;
  min-height: 34px !important;
  height: auto !important;
  padding: 6px 9px !important;
  white-space: normal !important;
}

html:root body.bims-admin-shell :is(.area-report-tabs, .bpw-map-metric-bar) > :is(a, button) :is(.ico, .bpw-icon) {
  flex: 0 0 16px !important;
  width: 16px !important;
  min-width: 16px !important;
  height: 16px !important;
  min-height: 16px !important;
}

/* The seven workflow areas fit the normal desktop report width together. */
html:root body.bims-admin-shell .area-report-tabs > a {
  padding: 6px 7px !important;
  font-size: .75rem !important;
}

html:root body.bims-admin-shell .area-report-tabs > a > .area-report-tab-icon.bpw-icon.ico {
  flex: 0 0 14px !important;
  width: 14px !important;
  min-width: 14px !important;
  height: 14px !important;
  min-height: 14px !important;
}

html:root body.bims-admin-shell .area-report-tabs > a > .area-report-tab-icon.bpw-icon.ico svg {
  width: 14px !important;
  height: 14px !important;
}

html:root body .citizen-news-tablist > button {
  flex: 1 1 auto !important;
}

html:root body nav.document-print-toolbar > .button-row {
  display: flex !important;
  flex: 1 1 100%;
  flex-wrap: wrap !important;
  min-width: 0;
  max-width: 100%;
  width: 100%;
  gap: 6px !important;
}

html:root body nav.document-print-toolbar > .button-row > a {
  flex: 1 1 auto !important;
  min-width: 0;
  min-height: 34px !important;
  padding: 6px 9px !important;
  font-size: .8125rem !important;
  white-space: normal !important;
}

html body .bims-responsive-tab-picker {
  display: none !important;
  min-width: 0;
  max-width: 100%;
  margin: 0;
  padding: 6px 0;
}

html body .bims-responsive-tab-picker__label {
  display: block;
  margin-bottom: 5px;
  color: var(--bims-system-muted, var(--city-muted, #52675b));
  font-size: .75rem;
  font-weight: 750;
  line-height: 1.3;
}

html body .bims-responsive-tab-picker__select {
  display: block !important;
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
  min-height: 44px !important;
  margin: 0 !important;
  padding: 9px 34px 9px 12px !important;
  border: 1px solid var(--bims-system-line-strong, var(--city-border, #b9cec1)) !important;
  border-radius: 10px !important;
  background-color: var(--bims-system-surface, var(--city-surface, #fff)) !important;
  color: var(--bims-system-text-strong, var(--city-ink, #123d2b)) !important;
  font: inherit;
  font-size: .875rem !important;
  font-weight: 650;
  line-height: 1.35 !important;
  box-shadow: none !important;
  cursor: pointer;
}

html body .bims-responsive-tab-picker__select:focus-visible {
  outline: 3px solid var(--bims-system-focus, rgba(27, 109, 224, .2));
  outline-offset: 2px;
}

@media (max-width: 767px) {
  html body .bims-responsive-tab-picker {
    display: block !important;
    flex: 1 1 100%;
  }

  /* Only hide a strip once its usable native selector has been inserted. */
  html:root body [data-bims-responsive-tabs="ready"] {
    display: none !important;
  }

  html:root body.bims-admin-shell [data-bims-responsive-tabs="ready"],
  html:root body nav.document-print-toolbar > .button-row[data-bims-responsive-tabs="ready"] {
    display: none !important;
  }

  /* The permission list keeps its desktop layout and wraps safely without JS. */
  html body .permission-tab-list:not([data-bims-responsive-tabs="ready"]) {
    grid-auto-flow: row !important;
    grid-auto-columns: auto !important;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)) !important;
    overflow: visible !important;
  }
}

html body .bims-responsive-tab-picker[hidden] {
  display: none !important;
}

@media print {
  html body .bims-responsive-tab-picker {
    display: none !important;
  }
}
