/* Bloom: shared viewport height + flex layout (desktop + mobile)
   Link from templates: <link rel="stylesheet" href="{{ url_for('static', filename='css/app-shell.css') }}">
   Use with <meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover">
*/
html {
  height: 100%;
  -webkit-text-size-adjust: 100%;
  --app-viewport-height: 100vh;
  --app-nav-height: 5rem;
  --bloom-control-height: 2.5rem;
  --bloom-control-font-size: 0.875rem; /* 14px — buttons */
  --bloom-input-font-size: 0.75rem; /* 12px — inputs, selects, textareas */
  --bloom-control-padding-y: 0.5rem;
  --bloom-control-padding-x: 0.75rem;
  --bloom-control-line-height: 1.25;
  --bloom-control-radius: 8px;
}
@supports (height: 100svh) {
  html {
    --app-viewport-height: 100svh;
  }
}

/* Full-viewport UIs: no document scroll; panels scroll inside (maps, split sidebars) */
body.app-viewport-locked {
  /* Use svh directly so Chrome/Android reflow on rotation without a stale JS pixel lock. */
  height: 100vh;
  height: 100svh;
  max-height: 100vh;
  max-height: 100svh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Soft keyboard: shrink to visible viewport (JS sets --app-viewport-height in px). */
body.app-viewport-locked.bloom-soft-keyboard-open {
  height: var(--app-viewport-height, 100svh);
  max-height: var(--app-viewport-height, 100svh);
}

/* Global tools menu lives in nav; keep that stack above map panels/menus. */
body > nav {
  z-index: 10300;
}

body.app-viewport-locked > nav {
  position: relative;
  flex-shrink: 0;
}

/* Nav + inner header row both had border-b, stacking into a thick line */
nav.border-b > div > .border-b {
  border-bottom-width: 0;
}

/* Touch devices: 16px inputs prevent iOS Safari from zooming on focus. */
@media (pointer: coarse) {
  :root {
    --bloom-input-font-size: 1rem;
  }

  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="hidden"]):not([type="file"]):not([type="button"]):not([type="submit"]):not([type="reset"]):not([type="image"]),
  select,
  textarea {
    font-size: var(--bloom-input-font-size) !important;
  }
}
body.app-stretch {
  min-height: 100%;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* Primary action buttons (Project Management standard) */
.bloom-button,
a.bloom-button,
button.bloom-button {
  border: 2px solid var(--bloom-accent) !important;
  color: var(--bloom-accent) !important;
  padding: var(--bloom-control-padding-y) 1.5rem !important;
  font-size: var(--bloom-control-font-size) !important;
  font-weight: 500 !important;
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease !important;
  background-color: transparent !important;
  text-decoration: none !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  min-height: var(--bloom-control-height) !important;
  line-height: var(--bloom-control-line-height) !important;
  border-radius: var(--bloom-control-radius) !important;
  box-sizing: border-box;
  max-width: 100%;
  cursor: pointer;
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
  appearance: none;
  -webkit-appearance: none;
}

.bloom-button:hover:not(:disabled),
a.bloom-button:hover,
button.bloom-button:hover:not(:disabled) {
  background-color: var(--bloom-accent) !important;
  color: var(--bloom-text-on-accent) !important;
  text-decoration: none !important;
}

/* Keep press / toggle states on-brand (avoid UA blue-grey flash). */
.bloom-button:active:not(:disabled),
a.bloom-button:active,
button.bloom-button:active:not(:disabled) {
  background-color: var(--bloom-accent-hover) !important;
  border-color: var(--bloom-accent-hover) !important;
  color: var(--bloom-text-on-accent) !important;
  text-decoration: none !important;
}

.bloom-button[aria-pressed="true"]:not(:disabled),
button.bloom-button[aria-pressed="true"]:not(:disabled) {
  background-color: var(--bloom-accent) !important;
  border-color: var(--bloom-accent) !important;
  color: var(--bloom-text-on-accent) !important;
  text-decoration: none !important;
}

.bloom-button[aria-pressed="true"]:hover:not(:disabled),
button.bloom-button[aria-pressed="true"]:hover:not(:disabled),
.bloom-button[aria-pressed="true"]:active:not(:disabled),
button.bloom-button[aria-pressed="true"]:active:not(:disabled) {
  background-color: var(--bloom-accent-hover) !important;
  border-color: var(--bloom-accent-hover) !important;
  color: var(--bloom-text-on-accent) !important;
}

.bloom-button:disabled,
button.bloom-button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.bloom-button.hidden,
button.bloom-button.hidden {
  display: none !important;
}

/* Leading “+” action buttons — + and label center together as one unit */
.bloom-button-leading-plus-label {
  display: inline-flex;
  align-items: center;
  gap: 0.125rem;
}

.bloom-button-plus {
  font-weight: 600;
  line-height: 1;
}

.bloom-button.pm-delete-project-confirm-btn {
  background: var(--bloom-color-danger) !important;
  color: var(--bloom-color-white) !important;
  border-color: var(--bloom-color-danger) !important;
}

.bloom-button.pm-delete-project-confirm-btn:hover:not(:disabled) {
  background: var(--bloom-color-danger-hover) !important;
  border-color: var(--bloom-color-danger-hover) !important;
  color: var(--bloom-color-white) !important;
}

/* Text fields & selects — 12px text, 2.5rem height (match .bloom-button height) */
input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="hidden"]):not([type="file"]):not([type="button"]):not([type="submit"]):not([type="reset"]):not([type="image"]):not(.pm-sidebar-date-field),
select,
.bloom-native-select,
.project-picker-select {
  box-sizing: border-box !important;
  min-height: var(--bloom-control-height) !important;
  padding-top: var(--bloom-control-padding-y) !important;
  padding-bottom: var(--bloom-control-padding-y) !important;
  padding-left: var(--bloom-control-padding-x) !important;
  font-size: var(--bloom-input-font-size) !important;
  line-height: var(--bloom-control-line-height) !important;
  border: 1px solid var(--bloom-control-border-color) !important;
  border-radius: var(--bloom-control-radius) !important;
  background-color: var(--bloom-bg-input);
  color: var(--bloom-text-primary);
  font-family: inherit;
}

input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="hidden"]):not([type="file"]):not([type="button"]):not([type="submit"]):not([type="reset"]):not([type="image"]):not(.pm-sidebar-date-field) {
  padding-right: var(--bloom-control-padding-x) !important;
}

select {
  padding-right: 2.5rem !important;
}

textarea {
  box-sizing: border-box !important;
  padding: var(--bloom-control-padding-y) var(--bloom-control-padding-x) !important;
  font-size: var(--bloom-input-font-size) !important;
  line-height: 1.4;
  border: 1px solid var(--bloom-control-border-color) !important;
  border-radius: var(--bloom-control-radius) !important;
  background-color: var(--bloom-bg-input);
  color: var(--bloom-text-primary);
  font-family: inherit;
}

input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="hidden"]):not([type="file"]):not([type="button"]):not([type="submit"]):not([type="reset"]):not([type="image"]):not(.pm-sidebar-date-field):focus,
select:focus,
textarea:focus,
.bloom-native-select:focus,
.project-picker-select:focus {
  outline: none;
  border-color: var(--bloom-control-border-color-focus) !important;
}

.pm-sidebar-date-field-shell:focus-within {
  border-color: var(--bloom-control-border-color-focus) !important;
}

/* Direct child of body under nav: fills remaining height */
.app-main-below-nav {
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* Row under nav (replaces height: calc(100vh - 5rem) on #pageLayout) */
.app-page-layout {
  width: 100%;
  flex: 1 1 0;
  min-height: 0;
  min-width: 0;
  display: flex;
  flex-direction: row;
}

/* Split-tool sidebars (scroll with .step-content or inner overflow-y-auto) */
.app-sidebar-column {
  min-height: 0;
  max-height: 100%;
  align-self: stretch;
  display: flex;
  flex-direction: column;
}

/* Collapsible sidebar shell — edge tab stays visible when panel is collapsed */
.project-sidebar-shell {
  position: relative;
  flex-shrink: 0;
  align-self: stretch;
  display: flex;
  min-height: 0;
  overflow: visible;
}

.sidebar-edge-tab {
  position: absolute;
  z-index: 500;
  top: 50%;
  right: 0;
  transform: translate(100%, -50%);
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 1.65rem;
  min-height: calc(5.2rem + 14px);
  padding: 0.55rem 0.3rem;
  border: 1px solid var(--bloom-border);
  border-left: none;
  border-radius: 0 var(--bloom-control-radius) var(--bloom-control-radius) 0;
  background: transparent;
  color: var(--bloom-text-primary);
  cursor: pointer;
  font: inherit;
  line-height: 1;
  box-shadow: none;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

[data-theme='dark'] .sidebar-edge-tab {
  color: var(--bloom-color-white);
}

.sidebar-edge-tab:hover,
.sidebar-edge-tab:active,
.sidebar-edge-tab:focus-visible {
  background: var(--bloom-bg-page);
  outline: none;
}

.sidebar-edge-tab-chevron {
  display: block;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

#projectSidebar.is-collapsed ~ .sidebar-edge-tab {
  border-left: 1px solid var(--bloom-border);
}

[data-theme='dark'] #projectSidebar.is-collapsed ~ .sidebar-edge-tab {
  border-left-color: var(--bloom-border);
}

#projectSidebar.is-collapsed ~ .sidebar-edge-tab .sidebar-edge-tab-chevron {
  transform: rotate(180deg);
}

/* EO / CRTN / Dev: map + results area below status bar */
.app-viewer-results-pane {
  flex: 1 1 0;
  min-height: 0;
  width: 100%;
  position: relative;
}

.app-viewport-locked #statusBar {
  position: absolute;
  top: var(--status-bar-top, 0);
  left: 0;
  right: 0;
  z-index: 1100;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border: none;
  background: transparent;
  padding: 0;
  min-height: 0;
  pointer-events: none;
}

.app-viewport-locked #statusBar > * {
  pointer-events: auto;
}

#statusBar:has(#statusText.status-message-pill--visible),
#statusBar:has(#pmPolygonPopupSelectionChip:not(.hidden)) {
  padding-top: 0.5rem;
  padding-left: 0.5rem;
}

body.bloom-status-below-controls #statusBar:has(#statusText.status-message-pill--visible),
body.bloom-status-below-controls #statusBar:has(#pmPolygonPopupSelectionChip:not(.hidden)) {
  padding-top: 0.25rem;
  padding-right: 0.5rem;
}

body.bloom-status-below-controls #statusText.status-message-pill--visible,
body.bloom-status-below-controls #projectsMapStatusText.status-message-pill--visible {
  max-width: 100%;
}

body.bloom-status-map-top.app-viewport-locked #statusBar:has(#statusText.status-message-pill--visible),
body.bloom-status-map-top.app-viewport-locked #projectsMapStatusBar:has(#projectsMapStatusText.status-message-pill--visible),
body.bloom-status-map-top.app-viewport-locked #statusBar:has(#pmPolygonPopupSelectionChip:not(.hidden)),
body.bloom-status-map-top.app-viewport-locked #projectsMapStatusBar:has(#pmPolygonPopupSelectionChip:not(.hidden)) {
  padding-top: 0;
  padding-left: 10px;
}

#statusText {
  min-width: 0;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.55s ease, transform 0.55s ease;
}

#statusText.status-message-pill--visible {
  display: inline-flex;
  align-items: center;
  align-self: center;
  flex-shrink: 0;
  gap: 0.375rem;
  flex-wrap: nowrap;
  box-sizing: border-box;
  max-width: calc(100% - 0.5rem);
  min-width: 0;
  overflow: hidden;
  opacity: 1;
  transform: translateY(0);
  /* Keep in sync with .pm-polygon-popup-selection-chip */
  height: calc(1.7rem + 2px);
  border: 1px solid var(--bloom-border);
  background: var(--bloom-bg-page);
  color: var(--bloom-text-primary);
  padding: 0 0.75rem;
  font-size: 0.75rem;
  font-weight: 400;
  letter-spacing: 0.02em;
  line-height: 1.2;
  border-radius: 999px;
}

#statusText.status-message-pill--visible.status-error {
  color: var(--bloom-color-error) !important;
}

#statusText.status-message-pill--visible.status-success {
  color: var(--bloom-color-success) !important;
}

.status-message-pill-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1 1 auto;
}

#statusText.status-message-pill--visible.status-message-pill--leaving {
  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;
}

@keyframes status-bar-spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.status-bar-spinner {
  display: inline-block;
  box-sizing: border-box;
  flex-shrink: 0;
  vertical-align: middle;
  border: 2px solid var(--bloom-border-muted);
  border-top: 2px solid #000000;
  border-radius: 50%;
  width: 16px;
  height: 16px;
  animation: status-bar-spin 1s linear infinite;
}

/* Project map: #map fills main column (not raw 100vh) */
body.app-viewport-locked .app-map-column .pm-map-row {
  flex: 1 1 0;
  min-height: 0;
  min-width: 0;
}
body.app-viewport-locked .app-map-column .pm-map-stack {
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  position: relative;
}
body.app-viewport-locked .app-map-column.map-main-column {
  flex: 1 1 0;
  min-height: 0;
  overflow: hidden;
}
body.app-viewport-locked .app-map-column .pm-map-stack .pm-map-viewport,
body.app-viewport-locked .app-map-column .pm-map-stack #map,
body.app-viewport-locked .app-map-column #map {
  flex: 1 1 0;
  min-height: 0;
  height: auto !important;
  width: 100%;
  position: relative;
  z-index: 0;
  border: none;
  outline: none;
}

/* CRTN / dev: map pane below status overlay */
body.app-viewport-locked .app-viewer-results-pane .results-wrapper {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
}
body.app-viewport-locked .app-viewer-results-pane #leafletMap {
  flex: 1 1 0;
  min-height: 0;
  height: auto !important;
  width: 100%;
  position: relative;
}

/* iPhone landscape: reclaim vertical space for the map */
@media (orientation: landscape) and (max-height: 31.25rem) {
  html {
    --app-nav-height: 2.75rem;
  }
  body.app-viewport-locked > nav .h-20 {
    height: 2.75rem;
  }
  /* Center on the main column below the nav, not the full screen. */
  .project-sidebar-shell .sidebar-edge-tab {
    position: fixed;
    top: calc(50vh + var(--app-nav-height, 2.75rem) / 2);
    top: calc(50svh + var(--app-nav-height, 2.75rem) / 2);
    left: var(--bloom-sidebar-tab-left, 18rem);
    right: auto;
    transform: translate(0, -50%);
  }
}

/* Small map pane (e.g. iPhone landscape, sidebar open): map-scoped modals use the viewport */
body.map-area-compact .map-report-overlay {
  position: fixed;
  top: var(--app-nav-height, 5rem);
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 10100;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 0.75rem;
  padding-left: max(0.75rem, env(safe-area-inset-left, 0px));
  padding-right: max(0.75rem, env(safe-area-inset-right, 0px));
  padding-bottom: max(0.75rem, env(safe-area-inset-bottom, 0px));
  box-sizing: border-box;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
}
body.map-area-compact .map-report-panel--large {
  width: min(88%, calc(100% - 1.5rem));
  max-height: none;
  height: auto;
  flex: 1 1 auto;
  min-height: 0;
}
body.map-area-compact #pmLayerAttrsOverlay.map-report-overlay {
  inset: auto;
  left: 0;
  right: 0;
  bottom: 6%;
  top: auto;
  height: 44%;
  max-height: 44%;
  justify-content: center;
  align-items: stretch;
  padding: 0 0.75rem;
  pointer-events: none;
  background: transparent;
}
body.map-area-compact #pmLayerAttrsOverlay .pm-layer-attrs-panel.map-report-panel--large {
  pointer-events: auto;
  flex: 1 1 auto;
  height: 100%;
  max-height: 100%;
  width: min(88%, calc(100% - 1.5rem));
}
body.map-area-compact .map-report-panel--small {
  width: min(34rem, 100%);
  max-height: 100%;
  height: auto;
}

body.map-area-compact #pmProjectImagesOverlay.pm-map-report-stack-with-image {
  z-index: 10101;
}

body.map-area-compact #mapQualityReportOverlay.pm-map-report-stack-with-images {
  z-index: 10102;
}

/* Phone portrait + landscape: image/list panels use the viewport (map column is too small) */
@media (max-width: 767px) and (orientation: portrait),
       (orientation: landscape) and (max-height: 31.25rem) {
  body.app-viewport-locked .map-report-overlay:has(.map-report-body[data-modal-mode="image"]),
  body.app-viewport-locked .map-report-overlay:has(.map-report-body[data-modal-mode="pdf"]),
  body.app-viewport-locked #pmProjectImagesOverlay.map-report-overlay,
  body.app-viewport-locked #mapQualityReportOverlay.pm-map-report-stack-with-images,
  body.app-viewport-locked #pmProjectInfoOverlay.map-report-overlay,
  body.app-viewport-locked #pmLayerDetailsInfoOverlay.map-report-overlay,
  body.app-viewport-locked #pmProjectDetailsOverlay.map-report-overlay,
  body.app-viewport-locked #pmLayerDetailsEditOverlay.map-report-overlay,
  body.app-viewport-locked #pmTilesIndexOverlay.map-report-overlay,
  body.app-viewport-locked #pmIjlaOverlay.map-report-overlay,
  body.app-viewport-locked #pmPositioningPpkOverlay.map-report-overlay {
    position: fixed;
    top: var(--app-nav-height, 5rem);
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 10100;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding: 0.75rem;
    padding-left: max(0.75rem, env(safe-area-inset-left, 0px));
    padding-right: max(0.75rem, env(safe-area-inset-right, 0px));
    padding-bottom: max(0.75rem, env(safe-area-inset-bottom, 0px));
    box-sizing: border-box;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
  }

  body.app-viewport-locked #pmProjectImagesOverlay.pm-map-report-stack-with-image {
    z-index: 10101;
  }

  body.app-viewport-locked #mapQualityReportOverlay.pm-map-report-stack-with-images {
    z-index: 10102;
  }
}

/* Phone landscape: sidebar shares the row — all map popups cover the full viewport */
@media (orientation: landscape) and (max-height: 31.25rem) {
  body.app-viewport-locked .map-report-overlay {
    position: fixed;
    top: var(--app-nav-height, 5rem);
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 10100;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding: 0.75rem;
    padding-left: max(0.75rem, env(safe-area-inset-left, 0px));
    padding-right: max(0.75rem, env(safe-area-inset-right, 0px));
    padding-bottom: max(0.75rem, env(safe-area-inset-bottom, 0px));
    box-sizing: border-box;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
  }

  body.app-viewport-locked .map-report-panel--large {
    width: min(88%, calc(100% - 1.5rem));
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    height: auto;
  }

  body.app-viewport-locked .map-report-panel--small {
    width: min(34rem, 100%);
    max-height: 100%;
    height: auto;
  }

  /* Left-docked panels fill the phone viewport (override desktop 50% dock). */
  body.app-viewport-locked #pmIjlaOverlay .pm-ijla-panel.map-report-panel--large,
  body.app-viewport-locked #pmPositioningPpkOverlay .pm-positioning-ppk-panel.map-report-panel--large,
  body.app-viewport-locked #pmProjectImagesOverlay .pm-project-images-panel.map-report-panel--large,
  body.app-viewport-locked #mapQualityReportOverlay:has(.map-report-body[data-modal-mode="image"]) .map-report-panel.map-report-panel--large {
    width: 100%;
    max-width: 100%;
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    height: auto;
  }
  body.app-viewport-locked #pmProjectImagesOverlay .pm-project-images-edit-overlay:not(.hidden) {
    width: 100%;
    right: 0;
  }
  body.app-viewport-locked #pmLayerDetailsInfoOverlay .pm-details-panel.map-report-panel--small,
  body.app-viewport-locked #pmLayerDetailsEditOverlay .pm-details-panel.map-report-panel--small,
  body.app-viewport-locked #pmTilesIndexOverlay .pm-details-panel.map-report-panel--small {
    width: 100%;
    max-width: 100%;
    max-height: 100%;
    height: auto;
    align-self: stretch;
  }

  /* Section profile stays bottom-docked and non-blocking over the map. */
  body.app-viewport-locked #pmSectionProfileOverlay.map-report-overlay {
    align-items: flex-end;
    justify-content: center;
    padding: 0.75rem 3.25rem 10px;
    pointer-events: none;
    background: transparent;
    overflow: visible;
  }
  body.app-viewport-locked #pmSectionProfileOverlay .pm-section-profile-panel.map-report-panel--large {
    flex: 0 1 auto;
    height: auto;
    max-height: calc(100% - 1.25rem);
    width: min(56rem, calc(100% - 6.5rem));
    align-self: flex-end;
    margin: 0 auto 0;
  }
}

/* Pseudo-fullscreen fallback (iOS Safari: no Fullscreen API for map/panel elements) */
.bloom-pseudo-fullscreen {
  position: fixed !important;
  inset: 0 !important;
  width: 100% !important;
  max-width: none !important;
  height: 100% !important;
  max-height: none !important;
  margin: 0 !important;
  z-index: 10150 !important;
  border-radius: 0 !important;
  box-sizing: border-box !important;
}
#map.bloom-pseudo-fullscreen {
  width: 100% !important;
  height: 100% !important;
  max-height: 100svh !important;
}
.pm-map-stack.bloom-pseudo-fullscreen {
  display: flex !important;
  flex-direction: column !important;
  width: 100% !important;
  height: 100% !important;
  max-height: 100svh !important;
  background: var(--bloom-bg-page);
}
.pm-map-stack.bloom-pseudo-fullscreen .pm-map-viewport,
.pm-map-stack.bloom-pseudo-fullscreen #map,
.pm-map-stack.bloom-pseudo-fullscreen #leafletMap {
  flex: 1 1 0 !important;
  min-height: 0 !important;
  height: auto !important;
}
@supports (height: 100dvh) {
  #map.bloom-pseudo-fullscreen {
    height: 100dvh !important;
    max-height: 100dvh !important;
  }
  .pm-map-stack.bloom-pseudo-fullscreen {
    height: 100dvh !important;
    max-height: 100dvh !important;
  }
}
.map-report-panel.bloom-pseudo-fullscreen {
  display: flex !important;
  flex-direction: column !important;
}
.map-report-panel.bloom-pseudo-fullscreen:has(.map-report-body[data-modal-mode="image"]),
.map-report-panel.bloom-pseudo-fullscreen:has(.map-report-body[data-modal-mode="pdf"]) {
  height: 100% !important;
  max-height: none !important;
}
body.bloom-pseudo-fullscreen-active {
  overflow: hidden !important;
}

/* Map fullscreen: cover app chrome (nav 10300 beats map inside .pm-map-stack isolation). */
body.bloom-map-fullscreen-active > nav,
body.bloom-map-fullscreen-active .sidebar-edge-tab {
  display: none !important;
}
body.bloom-map-fullscreen-active .project-sidebar-shell {
  visibility: hidden !important;
  pointer-events: none !important;
}
body.bloom-map-fullscreen-active > .app-main-below-nav {
  position: relative;
  z-index: 10400;
}

/* In-app feedback panel (fixed overlay, all pages) */
.feedback-overlay {
  position: fixed;
  inset: 0;
  z-index: 200000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem;
  box-sizing: border-box;
}
.feedback-overlay.hidden {
  display: none !important;
}
.feedback-backdrop {
  position: absolute;
  inset: 0;
  border: none;
  padding: 0;
  margin: 0;
  background: var(--bloom-bg-overlay);
  cursor: pointer;
}
.feedback-panel {
  position: relative;
  z-index: 1;
  width: min(28rem, 100%);
  max-height: min(90vh, calc(100% - 1.5rem));
  display: flex;
  flex-direction: column;
  background: var(--bloom-bg-page);
  border: 1px solid var(--bloom-border);
  border-radius: 8px;
  box-shadow: var(--bloom-shadow-lg);
  color: var(--bloom-text-primary);
  overflow: hidden;
}
.feedback-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--bloom-border-faint);
  flex-shrink: 0;
}
.feedback-title {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--bloom-text-muted);
}
.feedback-close {
  border: none;
  background: transparent;
  font-size: 1.35rem;
  line-height: 0;
  color: var(--bloom-text-disabled);
  cursor: pointer;
  padding: 0.15rem 0.35rem;
  border-radius: 8px !important;
}
.feedback-close:hover {
  color: var(--bloom-text-primary);
}
.feedback-body {
  position: relative;
  padding: 0.85rem;
  min-height: 15rem;
  box-sizing: border-box;
}
.feedback-form-stage form {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.feedback-success-stage {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  box-sizing: border-box;
  background: var(--bloom-bg-page);
}
.feedback-success-text {
  margin: 0;
  text-align: center;
  font-size: 0.9375rem;
  line-height: 1.45;
  color: var(--bloom-accent);
}
.feedback-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--bloom-text-faint);
  margin-top: 0.35rem;
}
.feedback-optional {
  font-weight: 400;
  color: var(--bloom-text-placeholder);
}
.feedback-select,
.feedback-input,
.feedback-textarea {
  width: 100%;
}
.feedback-textarea {
  resize: vertical;
  min-height: 7rem;
  line-height: 1.4;
}
.feedback-select:focus,
.feedback-input:focus,
.feedback-textarea:focus {
  outline: none;
}
.feedback-message {
  font-size: 0.8125rem;
  margin: 0.25rem 0 0;
}
.feedback-message--error {
  color: var(--bloom-color-danger-hover);
}
.feedback-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 0.65rem;
}
.feedback-actions .bloom-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
button.js-feedback-open {
  cursor: pointer;
}
button.js-solar-activity-open {
  cursor: pointer;
}

/* Nav user email trigger — do not use font: inherit (it resets text-sm / text-xs utilities). */
.app-nav-user-email {
  text-align: right;
  background: none;
  border: none;
  padding: 0;
  font-family: inherit;
  font-weight: inherit;
  line-height: inherit;
  cursor: pointer;
  text-decoration: none;
}
.app-nav-user-email:hover,
.app-nav-user-email:focus-visible {
  text-decoration: underline;
  color: var(--bloom-accent);
  outline: none;
}

/* User details panel (fixed overlay, all pages) */
.user-info-overlay {
  position: fixed;
  inset: 0;
  z-index: 200000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem;
  box-sizing: border-box;
}
.user-info-overlay.hidden {
  display: none !important;
}
.user-info-backdrop {
  position: absolute;
  inset: 0;
  border: none;
  padding: 0;
  margin: 0;
  background: var(--bloom-bg-overlay);
  cursor: pointer;
}
.user-info-panel {
  position: relative;
  z-index: 1;
  width: min(34rem, 100%);
  max-height: min(88dvh, calc(100% - 1.5rem));
  display: flex;
  flex-direction: column;
  background: var(--bloom-bg-page);
  border: 1px solid var(--bloom-border);
  border-radius: 8px;
  box-shadow: var(--bloom-shadow-lg);
  color: var(--bloom-text-primary);
  overflow: hidden;
  min-height: 0;
}
.user-info-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--bloom-border-faint);
  flex-shrink: 0;
}
.user-info-title {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--bloom-text-muted);
}
.user-info-close {
  border: none;
  background: transparent;
  font-size: 1.35rem;
  line-height: 0;
  color: var(--bloom-text-disabled);
  cursor: pointer;
  padding: 0.15rem 0.35rem;
  border-radius: 8px !important;
}
.user-info-close:hover {
  color: var(--bloom-text-primary);
}
.user-info-body {
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  flex: 1 1 auto;
  min-height: 0;
  padding: 0.75rem 1rem;
}
.user-info-dl {
  margin: 0;
}
.user-info-dl dt {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--bloom-border-focus);
  margin-top: 0.75rem;
}
.user-info-dl dt:first-child {
  margin-top: 0;
}
.user-info-dl dd {
  margin: 0.15rem 0 0;
  font-size: 13px;
  color: var(--bloom-text-primary);
  word-break: break-word;
}
.user-info-value {
  display: flex;
  align-items: flex-start;
  gap: 0.35rem;
}
.user-info-text {
  flex: 1 1 auto;
  min-width: 0;
}
.user-info-copy {
  position: relative;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  margin-top: -0.05rem;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--bloom-border-focus);
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
}
.user-info-copy:hover,
.user-info-copy:focus-visible {
  color: var(--bloom-text-primary);
  background: var(--bloom-bg-hover-subtle);
  outline: none;
}
.user-info-copy[hidden] {
  display: none;
}
.user-info-copy .bloom-copy-icon {
  display: block;
  width: 14px;
  height: 14px;
}
.user-info-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  border-top: 1px solid var(--bloom-border-faint);
  flex-shrink: 0;
}
.user-info-field-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--bloom-text-faint);
  margin: 0 0 0.25rem;
}
.user-info-field-label + .user-info-field-input {
  margin-bottom: 0.65rem;
}
.user-info-field-input {
  width: 100%;
  box-sizing: border-box;
}
.user-info-field-input:focus {
  outline: none;
}
.user-info-edit-error {
  margin: 0.35rem 0 0;
  font-size: 0.8125rem;
  color: var(--bloom-color-danger-hover);
}
.user-info-edit-error.hidden {
  display: none !important;
}
.user-info-actions .bloom-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
button.js-project-mgmt-open {
  cursor: pointer;
}
button.js-data-mgmt-open {
  cursor: pointer;
}

/* Project management full-area overlay (below top nav) */
.project-mgmt-overlay {
  position: fixed;
  top: var(--app-nav-height, 5rem);
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 100000;
  display: flex;
  flex-direction: column;
  background: var(--bloom-bg-page);
  border-top: 1px solid var(--bloom-border-faint);
}
.project-mgmt-overlay.hidden {
  display: none !important;
}
.project-mgmt-shell {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  width: 100%;
}
.project-mgmt-toolbar {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-shrink: 0;
  padding: 1.25rem 1rem 0;
  background: var(--bloom-bg-page);
}
@media (min-width: 768px) {
  .project-mgmt-toolbar {
    padding-left: 2rem;
    padding-right: 2rem;
  }
}
.project-mgmt-toolbar .project-sidebar-back {
  flex-shrink: 0;
}
.project-mgmt-toolbar-title {
  min-width: 0;
  flex: 1;
  margin-left: 0.375rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 2rem;
}
.project-mgmt-toolbar-title:has(p) {
  min-height: 0;
  justify-content: flex-start;
}
.project-mgmt-toolbar-title h2 {
  margin: 0;
  line-height: 1.25;
}
.project-mgmt-scroll {
  flex: 1 1 0;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.project-mgmt-overlay-main {
  min-width: 0;
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.project-mgmt-overlay-main .project-mgmt-tab-header {
  flex-shrink: 0;
}
.project-mgmt-overlay-main .project-mgmt-frame-host {
  flex: 1 1 0;
  width: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  position: relative;
  background: var(--bloom-bg-page);
}
.project-mgmt-frame-loading {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bloom-bg-page);
  pointer-events: none;
}
.project-mgmt-frame-loading[hidden] {
  display: none !important;
}
.project-mgmt-frame-loading-spinner {
  width: 1.75rem;
  height: 1.75rem;
  border-width: 2.5px;
}
.project-mgmt-overlay-main .project-mgmt-frame {
  flex: 1 1 0;
  width: 100%;
  min-height: 0;
  border: none;
  display: block;
  background: var(--bloom-bg-page);
}
.project-sidebar-back,
.project-sidebar-back:visited {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  line-height: 0;
  box-sizing: border-box;
  border: 1px solid var(--bloom-border);
  border-radius: 8px;
  background: var(--bloom-bg-page);
  color: var(--bloom-text-subtle);
  text-decoration: none;
}
.project-sidebar-back:hover {
  background: var(--bloom-bg-hover);
  color: var(--bloom-text-strong);
}
.project-sidebar-back svg {
  display: block;
  flex-shrink: 0;
}
button.project-sidebar-back {
  cursor: pointer;
  font: inherit;
}
.project-sidebar-back.hidden,
.project-sidebar-back.is-hidden {
  display: none;
}
.project-mgmt-frame {
  flex: 1 1 0;
  width: 100%;
  min-height: 0;
  border: none;
  display: block;
  background: var(--bloom-bg-page);
}
body.project-mgmt-embed.project-mgmt-chrome-hidden .project-mgmt-content {
  padding: 0 0 1.5rem;
}
body.project-mgmt-embed .project-mgmt-content {
  padding-top: 0;
}
body.project-mgmt-embed .project-mgmt-tab-header {
  margin-top: 0;
}
body.project-mgmt-embed .project-mgmt-tab-header,
.pm-project-checklist-main .project-mgmt-tab-header,
.project-mgmt-overlay-main .project-mgmt-tab-header {
  margin-bottom: 0.375rem;
}
.project-mgmt-content .app-tab-toolbar-header .app-toolbar-actions {
  margin-bottom: 0.25rem;
}
.project-mgmt-overlay-main .app-tab-toolbar-header .app-toolbar-actions {
  margin-bottom: 0.25rem;
  /* Match bloom-button row height so tabs sit like Project Management when actions are empty */
  min-height: var(--bloom-control-height);
}
body.project-mgmt-overlay-open {
  overflow: hidden;
}
body.project-mgmt-overlay-open nav {
  z-index: 100010 !important;
}
.project-mgmt-content {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  padding: 0 1rem 1.5rem;
}
@media (min-width: 768px) {
  .project-mgmt-content {
    padding-left: 2rem;
    padding-right: 2rem;
  }
}
.project-mgmt-content--standalone {
  padding-top: 3rem;
  padding-bottom: 3rem;
}
@media (min-width: 768px) {
  .project-mgmt-content--standalone {
    padding-left: 6rem;
    padding-right: 6rem;
  }
}

.project-mgmt-table-wrap {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  margin-top: 0;
  margin-bottom: 2rem;
}
.project-mgmt-table-wrap .project-mgmt-data-table {
  border-collapse: separate;
  border-spacing: 0;
}
.project-mgmt-table-wrap .project-mgmt-data-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background-color: var(--bloom-bg-page);
  box-shadow: 0 1px 0 var(--bloom-border-muted);
}

/* Chrome-hidden embed (iframe): scroll table rows only; keep alerts/forms above the table */
body.project-mgmt-embed.project-mgmt-chrome-hidden {
  height: 100%;
  min-height: 0;
  overflow: hidden;
}
body.project-mgmt-embed.project-mgmt-chrome-hidden > div {
  flex: 1 1 0;
  min-height: 0;
  overflow: hidden;
}
body.project-mgmt-embed.project-mgmt-chrome-hidden .project-mgmt-content {
  flex: 1 1 0;
  min-height: 0;
  overflow: hidden;
  padding-bottom: 1rem;
}
body.project-mgmt-embed.project-mgmt-chrome-hidden .project-mgmt-content > .w-full {
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
body.project-mgmt-embed.project-mgmt-chrome-hidden section:not(.hidden) {
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background-color: var(--bloom-bg-page);
}
/* Add/edit forms are taller than the iframe; scroll the whole section, not just the table */
body.project-mgmt-embed.project-mgmt-chrome-hidden section:not(.hidden):has(.share-mgmt-form-panel) {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
body.project-mgmt-embed.project-mgmt-chrome-hidden section:not(.hidden):has(.share-mgmt-form-panel) .project-mgmt-table-wrap {
  flex: none;
  min-height: auto;
  overflow: visible;
}
body.project-mgmt-embed.project-mgmt-chrome-hidden .project-mgmt-table-wrap {
  flex: 1 1 0;
  min-height: 0;
  overflow: auto;
  margin-bottom: 0;
  -webkit-overflow-scrolling: touch;
}
.project-mgmt-status-line {
  margin: 0 0 0.375rem;
  min-height: 0;
}
.project-mgmt-status-line:empty {
  display: none;
  margin: 0;
}

.project-mgmt-data-table {
  width: 100%;
  font-size: 0.875rem;
  line-height: 1.35;
  text-align: left;
  color: var(--bloom-text-primary);
  background-color: var(--bloom-bg-page);
  border-collapse: collapse;
}
.project-mgmt-data-table thead {
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--bloom-text-subtle);
  background-color: var(--bloom-bg-page);
  border-bottom: 1px solid var(--bloom-border-muted);
}
.project-mgmt-data-table th {
  padding: 0.5rem 0.75rem;
  font-weight: 500;
  vertical-align: bottom;
}
.project-mgmt-data-table td {
  padding: 0.75rem;
  vertical-align: middle;
  font-size: 0.75rem;
  color: rgba(var(--bloom-rgb-navy), 0.9);
  border-bottom: 1px solid var(--bloom-border-muted);
}
.project-mgmt-data-table tbody tr:last-child td {
  border-bottom: 0;
}
.project-mgmt-data-table .project-mgmt-actions-col {
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
  text-align: right;
  white-space: nowrap;
  width: 3.5rem;
}

.share-mgmt-form-panel {
  border-radius: var(--bloom-control-radius);
  border: 1px solid var(--bloom-border);
  background: var(--bloom-bg-surface);
  padding: 1.25rem 1.5rem;
  margin-bottom: 2rem;
  width: 100%;
  box-sizing: border-box;
}

.share-mgmt-table-shell {
  border-radius: var(--bloom-control-radius);
  overflow: auto;
}

.share-site-edit-pill {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  border-radius: 999px;
  padding: 0.1rem 0.5rem;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background-color: #f97316;
  border: 1px solid #ea580c;
  color: #ffffff !important;
}

/* Beat `.text-navy *` theme override so light mode keeps white label text. */
.share-mgmt-table-shell .text-navy .share-site-edit-pill {
  color: #ffffff !important;
}

.share-mgmt-table-shell .share-project-sites-table tbody tr:last-child {
  border-bottom: 0;
}

.share-mgmt-table-shell .share-project-sites-table:has(tbody:empty) thead {
  border-bottom: none;
}

/* Solar activity forecast popup */
.solar-activity-overlay {
  position: fixed;
  inset: 0;
  z-index: 200000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem;
  box-sizing: border-box;
}
.solar-activity-overlay.hidden {
  display: none !important;
}
.solar-activity-backdrop {
  position: absolute;
  inset: 0;
  border: none;
  padding: 0;
  margin: 0;
  background: var(--bloom-bg-overlay);
  cursor: pointer;
}
.solar-activity-panel {
  position: relative;
  z-index: 1;
  width: min(56rem, 100%);
  max-height: min(92vh, calc(100% - 1.5rem));
  display: flex;
  flex-direction: column;
  background: var(--bloom-bg-page);
  border: 1px solid var(--bloom-border);
  border-radius: 8px;
  box-shadow: var(--bloom-shadow-lg);
  color: var(--bloom-text-primary);
  overflow: hidden;
}
.solar-activity-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--bloom-border-faint);
  flex-shrink: 0;
}
.solar-activity-title {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--bloom-text-muted);
}
.solar-activity-close {
  border: none;
  background: transparent;
  font-size: 1.35rem;
  line-height: 0;
  color: var(--bloom-text-disabled);
  cursor: pointer;
  padding: 0.15rem 0.35rem;
  border-radius: 8px !important;
}
.solar-activity-close:hover {
  color: var(--bloom-text-primary);
}
.solar-activity-body {
  padding: 1rem 1.25rem 1.25rem;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}
.solar-activity-loading,
.solar-activity-error {
  margin: 2rem 0;
  text-align: center;
  font-size: 0.9375rem;
  color: var(--bloom-text-faint);
}
.solar-activity-error {
  color: var(--bloom-color-danger-hover);
}
.solar-activity-content {
  width: 100%;
  max-width: none;
}
.solar-activity-content .tool-card {
  transition: all 0.3s ease;
  border: 2px solid var(--bloom-border);
  background-color: var(--bloom-bg-page);
}
.solar-activity-content .section-heading {
  font-size: 1.25rem !important;
  font-weight: 600 !important;
  color: var(--bloom-text-primary) !important;
  margin-bottom: 1rem !important;
}
.solar-activity-content .forecast-body {
  width: 100%;
  max-width: none;
  font-size: 0.9rem;
  line-height: 1.6;
  white-space: pre-line;
}

/* Three-dot overflow menus (reference: project viewer sidebar header menu) */
.layer-sidebar-actions {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex-wrap: nowrap;
  flex-shrink: 0;
  gap: 0;
}
/* Keep visibility switches in one column whether or not a ⋯ menu is shown. */
.layer-sidebar-actions:not(:has(> .layer-actions-menu-btn:not(.hidden))) {
  padding-right: 2rem; /* match .layer-actions-menu-btn width */
}
/*
 * Chevron column: rows with a chevron but no visible toggle need the switch-width
 * reserved so chevrons line up with rows that have [chevron][switch][⋯].
 * Switch hit target width is 1.5rem (.bloom-switch).
 */
.layer-sidebar-actions:has([class*='chevron-wrap']):not(:has(> .bloom-switch:not(.hidden)))
  > .layer-actions-menu-btn:not(.hidden) {
  margin-left: 1.5rem;
}
.layer-sidebar-actions:has([class*='chevron-wrap']):not(:has(> .bloom-switch:not(.hidden))):not(
    :has(> .layer-actions-menu-btn:not(.hidden))
  ) {
  padding-right: 3.5rem; /* switch 1.5rem + dots 2rem */
}
.layer-actions-menu-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--bloom-text-faint);
  border-radius: 8px;
  cursor: pointer;
}
.layer-actions-menu-btn:hover {
  background-color: var(--bloom-bg-hover);
}
.layer-actions-menu-btn:disabled {
  cursor: default;
}
.layer-actions-menu-btn:disabled:hover {
  background-color: transparent;
}
.layer-dropdown-menu {
  min-width: 9rem;
  width: max-content;
  max-width: min(16rem, calc(100vw - 1rem));
  box-sizing: border-box;
  background-color: var(--bloom-bg-page);
  border: 1px solid var(--bloom-border);
  border-radius: 8px;
  box-shadow: 0 4px 12px var(--bloom-border-light);
  z-index: 10070;
  padding: 0.25rem 0;
  overflow: hidden;
}
.layer-dropdown-menu button,
.layer-dropdown-menu a {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.5rem 0.75rem;
  font-size: 12px !important;
  line-height: 1.3;
  color: var(--bloom-text-primary);
  background: transparent;
  border: none;
  cursor: pointer;
  font-family: inherit;
  text-decoration: none;
}
.layer-dropdown-menu button:hover,
.layer-dropdown-menu a:hover {
  background-color: var(--bloom-bg-hover);
}

.layer-dropdown-menu .layer-dropdown-divider {
  display: block;
  width: 100%;
  height: 0;
  margin: 0.25rem 0;
  padding: 0;
  border: 0;
  border-top: 1px solid var(--bloom-border-faint);
  background: none;
}

#globalMenu a.global-menu-external-link {
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

#globalMenu .global-menu-external-link-icon {
  flex-shrink: 0;
  display: inline-block;
  width: 12px;
  height: 12px;
  background-color: currentColor;
  opacity: 0.7;
  mask: url('../img/external-link-icon.svg') center / contain no-repeat;
  -webkit-mask: url('../img/external-link-icon.svg') center / contain no-repeat;
}
#globalMenu a.global-menu-external-link:hover .global-menu-external-link-icon {
  opacity: 0.95;
}

.bloom-copy-icon {
  display: block;
  flex-shrink: 0;
  width: 14px;
  height: 14px;
  background-color: currentColor;
  mask: url('../img/copy-icon.svg') center / contain no-repeat;
  -webkit-mask: url('../img/copy-icon.svg') center / contain no-repeat;
}

#globalMenu .global-menu-pref-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
  box-sizing: border-box;
  padding: 0.35rem 0.75rem;
  font-size: 12px !important;
  line-height: 1.3;
  color: var(--bloom-text-primary);
  background: transparent;
  cursor: default;
  user-select: none;
}

#globalMenu .global-menu-pref-item:hover {
  background-color: var(--bloom-bg-hover);
}

#globalMenu .global-menu-pref-label {
  min-width: 0;
  flex: 1 1 auto;
}

#globalMenu .global-menu-pref-item .bloom-switch {
  display: inline-flex;
  width: 1.5rem;
  height: 2rem;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  flex-shrink: 0;
}

#globalMenu .global-menu-pref-item .bloom-switch:hover {
  background: transparent;
}

#globalMenu .global-menu-theme-item {
  margin-top: 0.25rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--bloom-border-faint);
}

html[data-brand-title='off'] .js-brand-title {
  display: none;
}

#globalMenu .global-menu-logout-item {
  margin-top: 0.25rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--bloom-border-faint);
}

#globalMenuButton {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: none;
  background: transparent;
  border-radius: 8px;
  cursor: pointer;
  color: var(--bloom-text-subtle);
}
#globalMenuButton .global-menu-button-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  line-height: 0;
}
#globalMenuButton .global-menu-button-icon svg {
  display: block;
}
#globalMenuButton:hover {
  opacity: 0.85;
  color: var(--bloom-text-primary);
}
[data-theme='dark'] #globalMenuButton {
  color: var(--bloom-nav-brand);
}
[data-theme='dark'] #globalMenuButton:hover {
  color: var(--bloom-nav-brand-hover);
}

.nav-brand-title {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.75rem;
  max-width: 100%;
  min-width: 0;
  color: var(--bloom-nav-brand);
}
.nav-brand-logo {
  display: block;
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  padding: 0;
  border: none;
  background-color: currentColor;
  color: var(--bloom-nav-brand);
  cursor: pointer;
  mask: url('../img/superbloom-logo-blank-black.png') center / contain no-repeat;
  -webkit-mask: url('../img/superbloom-logo-blank-black.png') center / contain no-repeat;
}
.nav-brand-logo:hover {
  color: var(--bloom-nav-brand-hover);
  opacity: 0.85;
}
.nav-brand-title-text {
  font-family: 'Archivo Black', sans-serif !important;
  font-weight: 400 !important;
  font-size: 20px !important;
  white-space: nowrap !important;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--bloom-nav-brand) !important;
  text-transform: uppercase !important;
  text-align: left;
}
.nav-brand-title-text:hover {
  color: var(--bloom-nav-brand-hover) !important;
  opacity: 0.85;
}
/* Portrait phones: keep logo only so title does not crowd the hamburger. */
@media (max-width: 767px) and (orientation: portrait) {
  .nav-brand-title-text {
    display: none !important;
  }
  .nav-brand-title {
    gap: 0;
  }
}
#globalMenu {
  border-radius: 8px;
  overflow: hidden;
  /* Beat .layer-dropdown-menu (10070) and stay at the top of the nav stack. */
  z-index: 10310;
}
#globalMenu.global-menu-scrollable {
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

details.client-row-menu > summary,
details.share-site-row-menu > summary,
details.pm-checklist-row-menu > summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--bloom-text-faint);
  line-height: 1;
}
details.client-row-menu > summary:hover,
details.share-site-row-menu > summary:hover,
details.pm-checklist-row-menu > summary:hover {
  background-color: var(--bloom-bg-hover);
}
details.client-row-menu > summary::-webkit-details-marker,
details.share-site-row-menu > summary::-webkit-details-marker,
details.pm-checklist-row-menu > summary::-webkit-details-marker {
  display: none;
}
details.client-row-menu[open] > summary,
details.share-site-row-menu[open] > summary,
details.pm-checklist-row-menu[open] > summary {
  opacity: 0.85;
}

.app-row-menu-panel {
  position: fixed;
  z-index: 10070;
  min-width: 9rem;
  width: max-content;
  max-width: min(16rem, calc(100vw - 1rem));
  box-sizing: border-box;
  background-color: var(--bloom-bg-page);
  border: 1px solid var(--bloom-border);
  border-radius: 8px;
  box-shadow: 0 4px 12px var(--bloom-border-light);
  padding: 0.25rem 0;
  overflow: hidden;
}

.app-row-menu-panel form {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  border: none;
}

.app-row-menu-panel button,
.app-row-menu-panel a {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.5rem 0.75rem;
  font-size: 12px !important;
  line-height: 1.3;
  color: var(--bloom-text-primary);
  background: transparent;
  border: none;
  cursor: pointer;
  font-family: inherit;
  text-decoration: none;
  box-sizing: border-box;
}

.app-row-menu-panel button:hover,
.app-row-menu-panel a:hover {
  background-color: var(--bloom-bg-hover);
}

.app-row-menu-section-start {
  margin-top: 0.25rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--bloom-border-faint);
}

.app-row-menu-panel .app-menu-item-danger {
  color: #b91c1c !important;
}

.app-row-menu-panel .app-menu-item-danger:hover:not(:disabled) {
  background-color: rgba(185, 28, 28, 0.08);
  color: var(--bloom-color-danger-hover) !important;
}

details.pm-checklist-row-menu > .pm-checklist-row-menu-panel button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.5rem 0.75rem;
  font-size: 12px !important;
  line-height: 1.3;
  color: var(--bloom-text-primary);
  background: transparent;
  border: none;
  cursor: pointer;
  font-family: inherit;
  text-decoration: none;
}
.pm-checklist-row-menu-panel.pm-images-row-menu-panel--portaled button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.5rem 0.75rem;
  font-size: 12px !important;
  line-height: 1.3;
  color: var(--bloom-text-primary);
  background: transparent;
  border: none;
  cursor: pointer;
  font-family: inherit;
  text-decoration: none;
}
details.pm-checklist-row-menu > .pm-checklist-row-menu-panel button:hover:not(:disabled) {
  background-color: var(--bloom-bg-hover);
}
.pm-checklist-row-menu-panel.pm-images-row-menu-panel--portaled button:hover:not(:disabled) {
  background-color: var(--bloom-bg-hover);
}

.project-item-menu-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--bloom-text-faint);
  cursor: pointer;
  line-height: 0;
  outline: none;
  box-shadow: none;
}
.project-item-menu-btn:focus,
.project-item-menu-btn:focus-visible,
.project-item-menu-btn:active {
  outline: none;
  box-shadow: none;
}
.project-item-menu-btn:hover {
  background-color: var(--bloom-bg-hover);
}
.project-item-menu-panel button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.5rem 0.75rem;
  font-size: 12px !important;
  line-height: 1.3;
  border: none;
  background: transparent;
  color: var(--bloom-text-primary);
  cursor: pointer;
  font-family: inherit;
}
.project-item-menu-panel button:hover {
  background-color: var(--bloom-bg-hover);
}

.image-card-menu-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--bloom-text-faint);
  line-height: 1;
  cursor: pointer;
}
.image-card-menu-btn:hover {
  background-color: var(--bloom-bg-hover);
}
.image-card-menu button {
  padding: 0.5rem 0.75rem;
  font-size: 12px !important;
  line-height: 1.3;
}

/* Destructive actions in dropdown / context menus */
.app-menu-item-danger {
  color: #b91c1c;
}
.app-menu-item-danger:hover:not(:disabled) {
  background-color: rgba(185, 28, 28, 0.08);
  color: var(--bloom-color-danger-hover);
}

/* Horizontal rule before the first destructive action in a menu.
   Key off panel children (not button :first-child) so hidden form inputs
   don't create a stray divider when Delete is the only action. */
.app-row-menu-panel > .app-menu-item-danger:not(:first-child),
.app-row-menu-panel > a.app-menu-item-danger:not(:first-child),
.app-row-menu-panel > form:not(:first-child) > .app-menu-item-danger,
.pm-project-header-menu-danger:not(:first-child):not(.pm-project-header-menu-danger ~ .pm-project-header-menu-danger),
.pm-checklist-menu-danger:not(:first-child):not(.pm-checklist-menu-danger ~ .pm-checklist-menu-danger) {
  margin-top: 0.25rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--bloom-border-faint);
}

/* Checklist row menus (override inherited text color) */
details.pm-checklist-row-menu > .pm-checklist-row-menu-panel button.app-menu-item-danger {
  color: #b91c1c;
}
.pm-checklist-row-menu-panel.pm-images-row-menu-panel--portaled button.app-menu-item-danger {
  color: #b91c1c;
}
details.pm-checklist-row-menu > .pm-checklist-row-menu-panel button.app-menu-item-danger:hover:not(:disabled) {
  background-color: rgba(185, 28, 28, 0.08);
  color: var(--bloom-color-danger-hover);
}
.pm-checklist-row-menu-panel.pm-images-row-menu-panel--portaled button.app-menu-item-danger:hover:not(:disabled) {
  background-color: rgba(185, 28, 28, 0.08);
  color: var(--bloom-color-danger-hover);
}

/* Tab bars with action buttons (project checklist, project links, etc.) */
.app-tab-toolbar-header {
  align-items: flex-end;
  border-bottom: 1px solid var(--bloom-border-muted);
  padding-bottom: 0;
}

.app-tab-toolbar-tabs {
  min-width: 0;
  gap: 0.25rem;
  align-items: flex-end;
}

.app-tab-toolbar-tab,
.pm-project-checklist-tab {
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  border: 1px solid transparent;
  border-radius: 8px 8px 0 0;
  margin-bottom: -1px;
  background: rgba(var(--bloom-rgb-navy), 0.05);
  color: rgba(var(--bloom-rgb-navy), 0.65);
  cursor: pointer;
  font-family: inherit;
  box-sizing: border-box;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.app-tab-toolbar-tab:hover:not(.is-active),
.pm-project-checklist-tab:hover:not(.is-active):not(:disabled) {
  background: var(--bloom-bg-hover);
  color: var(--bloom-text-primary);
}

.app-tab-toolbar-tab.is-active,
.pm-project-checklist-tab.is-active {
  background: var(--bloom-bg-page);
  border-color: var(--bloom-border);
  border-bottom-color: var(--bloom-bg-page);
  color: var(--bloom-text-primary);
  position: relative;
  z-index: 1;
}

.app-tab-toolbar-header .app-toolbar-actions {
  margin-bottom: 0.5rem;
}

@media (max-width: 767px) {
  .app-tab-toolbar-header {
    flex-direction: column;
    align-items: stretch !important;
    gap: 0.75rem;
  }

  .app-tab-toolbar-tabs {
    display: flex;
    flex-wrap: nowrap;
    justify-content: flex-start;
    align-items: flex-end;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    width: 100%;
    max-width: 100%;
    margin: 0 -0.25rem;
    padding: 0 0.25rem 0.125rem;
    gap: 0.5rem;
  }

  .app-tab-toolbar-tabs::-webkit-scrollbar {
    display: none;
  }

  .app-tab-toolbar-tab {
    flex-shrink: 0;
    white-space: nowrap;
    padding-left: 0.75rem !important;
    padding-right: 0.75rem !important;
  }

  .app-toolbar-actions {
    width: 100%;
    flex-wrap: nowrap;
    justify-content: stretch;
    padding-bottom: 0;
  }

  .app-toolbar-actions .bloom-button,
  .app-toolbar-actions a.bloom-button,
  .app-toolbar-actions button.bloom-button {
    flex: 1 1 0;
    justify-content: center;
    min-width: 0;
    padding-left: 0.75rem !important;
    padding-right: 0.75rem !important;
  }
}

/* Phone sidebar forms: when the soft keyboard is open, float action bars over
   scroll content instead of reserving a permanent strip above the keyboard. */
@media (pointer: coarse) {
  body.bloom-soft-keyboard-open #projectSidebar:not(.is-collapsed) :is(
    #pmGbdPhase1,
    #pmGbdPhase2,
    #addProjectPhase1,
    #addProjectPhaseDetails,
    #addProjectPhase2,
    #pmClimateDataShell,
    #pmInatShell,
    #pmIframeShell,
    #eoSatelliteForm,
    #devForm,
    #resultsSidebar,
    .step-panel.is-active
  ) {
    position: relative;
  }

  body.bloom-soft-keyboard-open #projectSidebar:not(.is-collapsed) :is(
    .pm-sidebar-panel-footer,
    .add-project-step-actions,
    .sidebar-actions,
    .step-actions
  ) {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 6;
    background: var(--bloom-bg-page);
    box-shadow: 0 -4px 12px var(--bloom-bg-hover-subtle);
  }

  body.bloom-soft-keyboard-open #projectSidebar:not(.is-collapsed) :is(
    .pm-sidebar-panel-body,
    .add-project-step-content,
    .sidebar-content,
    .step-content,
    #pmGbdPhase1 > .overflow-y-auto,
    #pmGbdPhase2 > .overflow-y-auto
  ) {
    padding-bottom: calc(4.75rem + env(safe-area-inset-bottom, 0px)) !important;
  }
}

/* Mobile: keep the map usable — cap open sidebar width by orientation */
@media (max-width: 767px) and (orientation: portrait) {
  .project-sidebar-shell:has(#projectSidebar:not(.is-collapsed)) {
    max-width: 50vw;
    min-width: 0;
    flex-shrink: 1;
  }

  #projectSidebar:not(.is-collapsed) {
    width: min(18rem, 50vw);
    min-width: 0;
    max-width: 50vw;
  }
}

@media (orientation: landscape) and (max-height: 31.25rem) {
  .project-sidebar-shell:has(#projectSidebar:not(.is-collapsed)) {
    max-width: 33.333vw;
    min-width: 0;
    flex-shrink: 1;
  }

  #projectSidebar:not(.is-collapsed) {
    width: min(18rem, 33.333vw);
    min-width: 0;
    max-width: 33.333vw;
  }
}
