:root {
  --header-bg: #002B54;
  --header-text: #FFFFFF;
  --sidebar-bg: #002B54;
  --sidebar-text: #FFFFFF;
  --header-height: 80px;
  --schematic-tooltip-horizontal-offset: -60px;

  --sidebar-collapsed-width: 80px;
  --sidebar-expanded-width: 200px;
  --sidebar-logo-height: 88px;
  --sidebar-hover: rgba(255,255,255,0.06);
  --sidebar-item-bg: transparent;
  --sidebar-item-border-radius: 8px;
  --sidebar-padding-vertical: 8px;
  --sidebar-padding-horizontal: 12px;
  --sidebar-gap: 8px;
}

.field-info-tooltip-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
  margin-left: 7px;
  cursor: help;
  user-select: none;
}

.field-info-icon-symbol {
  color: #595c5f;
  font-size: 20px;
  line-height: 1;
}

.field-info-tooltip-bubble {
  position: absolute;
  left: calc(100% + 10px);
  top: 50%;
  bottom: auto;
  transform: translateY(-50%) translateX(-4px);
  min-width: 220px;
  max-width: 340px;
  padding: 8px 10px;
  border-radius: 6px;
  background: #0f172a;
  color: #ffffff;
  font-size: 12px;
  line-height: 1.4;
  text-align: left;
  white-space: normal;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.22);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.08s ease, transform 0.08s ease, visibility 0.08s ease;
  z-index: 10000;
}

.field-info-tooltip-bubble::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 100%;
  left: auto;
  transform: translateY(-50%);
  border-width: 6px;
  border-style: solid;
  border-color: transparent #0f172a transparent transparent;
}

.field-info-tooltip-wrapper:hover .field-info-tooltip-bubble,
.field-info-tooltip-wrapper:focus .field-info-tooltip-bubble,
.field-info-tooltip-wrapper:focus-within .field-info-tooltip-bubble {
  opacity: 1;
  visibility: visible;
  transform: translateY(-50%) translateX(0);
}

/* Ensure page content takes full viewport height */
#page-content {
  height: calc(100vh - var(--header-height)) !important;
  box-sizing: border-box !important;
  overflow: hidden !important;
}

/* Sidebar */

.sidebar-link {
  display: flex;
  align-items: center;
  gap: var(--sidebar-gap);
  color: var(--sidebar-text);
  text-decoration: none;
  margin: 30px 8px; /* increased vertical spacing */
  padding: var(--sidebar-padding-vertical) var(--sidebar-padding-horizontal);
  border-radius: var(--sidebar-item-border-radius);
  transition: background-color 0.12s ease, transform 0.08s ease;
}

/* Center icons when sidebar is collapsed, left-align when expanded */
#sidebar.sidebar-collapsed .sidebar-link {
  justify-content: center;
}

#sidebar.sidebar-expanded .sidebar-link {
  justify-content: flex-start;
}

.sidebar-link:hover {
  background-color: var(--sidebar-hover);
  text-decoration: none;
  transform: translateX(4px);
}

.sidebar-link.active {
  background-color: #008531;
  color: white;
}

.sidebar-icon {
  width: 24px;
  text-align: center;
  font-size: 16px;
}

.sidebar-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 120px;
  font-size: 16px;
  font-weight: 500;
}

.sidebar-toggle-btn {
  background: transparent;
  border: 2px solid rgba(255,255,255,0.12);
  color: var(--sidebar-text);
  border-radius: 8px;
  cursor: pointer;
  padding: 9px 14px;
  font-size: 20px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.sidebar-toggle-btn:hover {
  background-color: rgba(255,255,255,0.06);
}

/* Brand button and upload box styles */
.brand-btn {
  background-color: #BE0553;
  color: #ffffff;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(190,5,83,0.12);
  transition: background-color 120ms ease, box-shadow 120ms ease, transform 120ms ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.brand-btn:hover {
  background-color: rgba(190,5,83,0.9);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(190,5,83,0.14);
}

/* Greyed/disabled appearance for brand buttons */
.brand-btn:disabled,
.brand-btn[disabled] {
  background-color: #E5E7EB;
  color: #9CA3AF;
  box-shadow: none;
  cursor: not-allowed;
  opacity: 1;
}

/* Back to Home button (green) */
.back-home-btn {
  background-color: #008531;
  color: #ffffff;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,133,49,0.12);
  transition: background-color 120ms ease, box-shadow 120ms ease, transform 120ms ease;
}

.back-home-btn:hover {
  background-color: #00722a;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(0,133,49,0.14);
}

/* Secondary button (neutral/gray style) */
.secondary-btn {
  background-color: #f1f5f9;
  color: #334155;
  border: 1px solid #cbd5e1;
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(51,65,85,0.08);
  transition: background-color 120ms ease, box-shadow 120ms ease, transform 120ms ease, border-color 120ms ease;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  min-height: 38px;
}

.secondary-btn:hover {
  background-color: #e2e8f0;
  border-color: #94a3b8;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(51,65,85,0.12);
}

.secondary-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(51,65,85,0.08);
}

.secondary-btn:disabled,
.secondary-btn[disabled] {
  background-color: #f8fafc;
  color: #cbd5e1;
  border-color: #e2e8f0;
  cursor: not-allowed;
  box-shadow: none;
}

.brand-btn.is-loading {
  pointer-events: none;
}

.brand-btn.is-loading::before {
  content: "";
  width: 14px;
  height: 14px;
  margin-right: 8px;
  display: inline-block;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: brand-btn-spin 0.7s linear infinite;
  vertical-align: middle;
}

@keyframes brand-btn-spin {
  to {
    transform: rotate(360deg);
  }
}

/* Disable Confirm button while save callback is running */
#save-project-loading._dash-loading #save-project-confirm {
  pointer-events: none;
  opacity: 0.65;
}

#waterbalance-loading {
  position: relative;
}

#waterbalance-loading .dash-spinner,
#waterbalance-loading .dash-default-spinner,
#waterbalance-loading .dash-spinner-container,
#waterbalance-loading > div:last-child {
  position: relative;
  z-index: 20;
}


.upload-box {
  width: 100%;
  box-sizing: border-box;
  height: 70px;
  line-height: 64px;
  border: 1px dashed #BE0553;
  border-radius: 6px;
  text-align: left;
  padding-left: 14px;
  margin: 16px 0 0 0;
  background-color: rgba(255,255,255,0.96);
  color: #334155;
  transition: background-color 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
}

.upload-box:hover {
  background-color: rgba(190,5,83,0.1);
  border-color: rgba(190,5,83,0.9);
  box-shadow: 0 6px 14px rgba(190,5,83,0.04);
}

/* Validation message styles (moved from inline styles) */
.validate-success {
  color: var(--validate-success-text, #064e3b);
  background-color: var(--validate-success-bg, #f0fdf4);
  padding: 14px 16px;
  border-radius: 8px;
  margin-bottom: 14px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.04);
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.validate-error {
  color: var(--validate-error-text, #7f1d1d);
  background-color: var(--validate-error-bg, #fff7f7);
  padding: 14px 16px;
  border-radius: 8px;
  margin-bottom: 14px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.04);
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.validate-warning {
  color: var(--validate-warning-text, #970d0d);
  background-color: var(--validate-warning-bg, #fef0f0);
  padding: 14px 16px;
  border-radius: 8px;
  margin-bottom: 14px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.04);
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.validate-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  min-width: 28px;
  min-height: 28px;
  flex: 0 0 28px;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  color: #ffffff;
  font-weight: 700;
  font-size: 16px;
  line-height: 1;
}
.validate-badge.success { background-color: #16a34a; }
.validate-badge.error { background-color: #ef4444; }
.validate-badge.warning { background-color: #d12840; }
.validate-text {
  margin-left: 0;
  font-size: 15px; /* slightly larger */
  font-weight: 600; /* bolder */
  line-height: 1.4;
}

/* Upload info message (subtle, text-only) */
.upload-info {
  color: #0f172a;
  background-color: #eef2ff;
  padding: 10px;
  border-radius: 8px;
  margin-top: 12px;
  box-shadow: 0 1px 4px rgba(2,6,23,0.06);
}

/* DataTable visual refinements to look professional */
.manage-table .dash-header {
  font-weight: 700;
  font-size: 15px;
  color: #0f172a;
}

/* Prevent automatic header text transformation (preserve original casing) */
.dash-table-container .dash-header,
.dash-table-container .column-header-name {
  text-transform: none !important;
}
.manage-table .dash-cell {
  font-size: 14px;
  padding: 12px 10px;
  color: #0f172a;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial;
}
.manage-table .dash-table-container {
  width: 100%;
}

/* Make the table card text and cells use consistent app font */
.manage-table { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial; }

@media (max-width: 768px) {
  .brand-btn { width: 100%; display: block; margin-bottom: 10px; }
  .upload-box { max-width: 100%; }
}

/* Brand the selected tab's top indicator line without changing tab background */
/* Targets common Dash tab classes; uses !important to override component defaults */
.tab--selected,
.dash-tabs .tab--selected,
.rc-tabs-tab-active,
.rc-tabs-tab--active,
.dash-tab--selected {
  border-top: 3px solid #008531 !important;
}

.tab--selected > div,
.dash-tabs .tab--selected > div {
  /* ensure the top border sits above content cleanly */
  margin-top: -3px;
}

/* Custom checkbox color for comparison page */
#comparison-show-differences input[type="checkbox"]:checked {
  accent-color: #eb1278;
}

/* For browsers that don't support accent-color, use a more detailed approach */
#comparison-show-differences input[type="checkbox"] {
  accent-color: #eb1278;
  width: 18px;
  height: 18px;
  cursor: pointer;
}

/* Style disabled checkbox */
#comparison-show-differences input[type="checkbox"]:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Style the label when checkbox is disabled */
#comparison-show-differences label:has(input[type="checkbox"]:disabled) {
  opacity: 0.4;
  cursor: not-allowed;
  color: #808080;
}

/* Fallback for browsers that don't support :has() */
#comparison-show-differences input[type="checkbox"]:disabled ~ span {
  opacity: 0.4;
  color: #808080;
}
/* Comparison/COMP visual helpers used by generated HTML in callbacks */
.comp-square {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 6px;
  vertical-align: middle;
  border-radius: 2px;
}
.comp-bar { display: inline-block; width: 40%; vertical-align: middle; }
.comp-img { width: 100%; height: 14px; display: block; }
.comp-counts { display: inline-block; width: 58%; vertical-align: middle; padding-left: 6px; font-size: 13px; color: #444; line-height: 1.4; }
.comp-wrapper { min-height: 30px; display: flex; align-items: center; }
.comp-counts-alt { min-height: 30px; display: flex; align-items: center; font-size: 13px; color: #444; }
.comp-help {
  display: inline-flex;
  position: relative;
  align-items: center;
  padding: 1px 7px;
  border: 1px solid #d8dee8;
  border-radius: 12px;
  background: #f8fafc;
  color: #64748b;
  font-size: 11px;
  line-height: 1.2;
  cursor: help;
}
.comp-help:hover {
  color: #334155;
  border-color: #cbd5e1;
  background: #f1f5f9;
}
.comp-help::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 0;
  bottom: calc(100% + 8px);
  display: none;
  width: 320px;
  max-width: min(320px, 80vw);
  padding: 8px 10px;
  border-radius: 8px;
  background: #111827;
  color: #f8fafc;
  font-size: 11px;
  line-height: 1.35;
  white-space: pre-line;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.3);
  z-index: 20;
}
.comp-help:hover::after,
.comp-help:focus-visible::after {
  display: block;
}
.comp-info-panel {
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: #ffffff;
}
.comp-info-summary {
  cursor: pointer;
  padding: 8px 10px;
  font-size: 12px;
  color: #334155;
  font-weight: 600;
  list-style: none;
}
.comp-info-summary::-webkit-details-marker {
  display: none;
}
.comp-info-summary::before {
  content: "▸";
  margin-right: 6px;
  color: #64748b;
}
.comp-info-panel[open] .comp-info-summary::before {
  content: "▾";
}
.comp-info-body {
  border-top: 1px solid #e2e8f0;
  padding: 8px 10px;
}
.comp-info-text {
  margin: 0 0 6px 0;
  font-size: 12px;
  color: #475569;
  line-height: 1.4;
}

.comp-info-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  color: #334155;
}
.comp-info-table th,
.comp-info-table td {
  border: 1px solid #e2e8f0;
  padding: 6px 8px;
  text-align: left;
  vertical-align: top;
}
.comp-info-table th {
  background: #f8fafc;
  font-weight: 700;
}
.comp-info-key {
  font-size: 11px;
  color: #64748b;
  margin: 10px 0;
  font-style: italic;
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: flex-start;
}
.comp-info-key-label {
  font-weight: 600;
}

/* Metric details (question mark) compact control */
.metric-details { display: inline-flex; align-items: center; white-space: nowrap; margin-left: 6px; }
.metric-details-toggle { cursor: pointer; padding: 0 6px; background: #eee; border-radius: 50%; font-weight: 600; font-size: 11px; line-height: 1; display: inline-flex; align-items: center; }
.metric-details-text { display: none; color: #444; font-size: 12px; margin-left: 6px; line-height: 1.4; white-space: normal; overflow: hidden; text-overflow: ellipsis; max-width: 340px; }
.metric-details-toggle:focus + .metric-details-text,
.metric-details-toggle:active + .metric-details-text { display: inline-block; }

/* Full Results header clickable raw-name toggles */
[id^="full-results-master-wrapper-"] .fr-header-label {
  display: inline;
}

[id^="full-results-master-wrapper-"] .fr-header-help-toggle {
  margin-left: 6px;
  border: 1px solid #94a3b8;
  border-radius: 999px;
  width: 17px;
  height: 17px;
  line-height: 15px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  color: #1e293b;
  background: #f8fafc;
  padding: 0;
  vertical-align: middle;
}

[id^="full-results-master-wrapper-"] .fr-header-help-toggle:hover {
  background: #e2e8f0;
  border-color: #64748b;
}

[id^="full-results-master-wrapper-"] .fr-header-help-toggle:focus {
  outline: 2px solid #1d4ed8;
  outline-offset: 1px;
}

[id^="full-results-master-wrapper-"] .fr-header-raw-name {
  display: none;
  margin-left: 6px;
  padding: 0;
  border: none;
  background: transparent;
  color: #334155;
  font-size: 11px;
  font-weight: 600;
  white-space: normal;
}

[id^="full-results-master-wrapper-"] .fr-header-raw-name.is-open {
  display: inline-block;
}

/* Schematic View header question-mark tooltips */
#schematic-ea-wb-table-wrapper .column-header-name {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  overflow: visible;
}

#schematic-ea-wb-table th.dash-header,
#schematic-ea-wb-table th.dash-header > div {
  overflow: visible !important;
}

#schematic-ea-wb-table th.dash-header > div {
  display: flex !important;
  align-items: center !important;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

#schematic-ea-wb-table th.dash-header > div::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

#schematic-ea-wb-table-wrapper .fr-header-label {
  display: inline-block;
}

#schematic-ea-wb-table-wrapper .fr-header-help-toggle {
  margin-left: 6px;
  border: 1px solid #94a3b8;
  border-radius: 999px;
  width: 17px;
  height: 17px;
  line-height: 15px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  color: #1e293b;
  background: #f8fafc;
  padding: 0;
  vertical-align: middle;
}

#schematic-ea-wb-table-wrapper .fr-header-help-toggle:hover {
  background: #e2e8f0;
  border-color: #64748b;
}

#schematic-ea-wb-table-wrapper .fr-header-help-toggle:focus {
  outline: 2px solid #1d4ed8;
  outline-offset: 1px;
}

#schematic-ea-wb-table-wrapper .fr-header-raw-name {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 220px;
  max-width: 340px;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid rgba(148, 163, 184, 0.45);
  background: #0f172a;
  color: #ffffff;
  font-size: 12px;
  font-weight: 600;
  white-space: normal;
  line-height: 1.4;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.22);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  pointer-events: none;
  z-index: 10000;
  transition: opacity 0.08s ease, transform 0.08s ease, visibility 0.08s ease;
}

#schematic-ea-wb-table-wrapper .fr-header-raw-name::after {
  content: "";
  position: absolute;
  left: 16px;
  bottom: 100%;
  border-width: 6px;
  border-style: solid;
  border-color: transparent transparent #0f172a transparent;
}

#schematic-ea-wb-table-wrapper .fr-header-raw-name.is-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* Difference indicators */
.diff-up { color: #27ae60; font-size: 14px; font-weight: 600; }
.diff-down { color: #c0392b; font-size: 14px; font-weight: 600; }
.diff-nochange { color: #95a5a6; font-size: 14px; font-weight: 600; }
.comp-diff { min-height: 30px; display: flex; align-items: center; font-size: 13px; color: #444; line-height: 1.4; }

/* Numeric value cell used for aggregated non-COMP measures */
.comp-numeric { min-height: 30px; display: flex; align-items: center; font-size: 13px; color: #444; }

/* Reduce visible selection/highlight in DataTable when clicking action cells */
.dash-table-container .dash-cell:focus,
.dash-table-container .dash-cell:active,
.dash-table-container .dash-cell:focus-within,
.dash-table-container .dash-cell--selected {
  background-color: transparent !important;
  outline: none !important;
}

/* Style for inline action element placed in action-row cells */
.table-action-btn {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 6px;
  background: #f1f5f9;
  color: #334155;
  border: 1px solid #cbd5e1;
  cursor: pointer;
  font-size: 13px;
}
.table-action-btn:hover { background: #e2e8f0; }

/* Larger map modal for Full Screen view (regional tab) */
.map-modal-xl .modal-dialog {
  max-width: 1200px; /* limit modal width to a reasonable maximum */
  width: 90%;
}
.map-modal-xl .modal-content {
  max-height: 70vh; /* slightly tall but not overwhelming */
  max-width: none !important; /* ensure overrides apply */
  width: 100% !important;
  padding: 12px 16px !important;
  box-sizing: border-box;
  border-radius: 8px;
}
.map-modal-xl .modal-body {
  overflow: auto;
  padding: 12px;
}
.map-modal-xl img {
  width: 100%;
  height: auto;
  max-height: 50vh; /* slightly smaller so legend fits without scrolling */
  object-fit: contain;
}

.map-legend-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.map-legend-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  color: #334155;
  border-radius: 999px;
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
}

.map-legend-chip:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
}

.map-legend-chip.is-active {
  background: #e2e8f0;
  border-color: #64748b;
  color: #0f172a;
  box-shadow: inset 0 0 0 1px #94a3b8;
}

.map-legend-swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  border: 1px solid rgba(15, 23, 42, 0.2);
  flex: 0 0 auto;
}

.map-legend-label {
  font-weight: 600;
}

.map-legend-count {
  min-width: 18px;
  text-align: right;
  color: #475569;
}

.map-legend-total {
  font-weight: 700;
  color: #0f172a;
}

/* Waterbody banner (above comparison subtabs) */
.waterbody-banner {
  display: flex;
  gap: 30px;
  row-gap: 10px;
  align-items: center;
  width: 100%;
  box-sizing: border-box;
  padding: 14px 20px;
  margin: 8px 0 25px 0;
  border-radius: 8px;
  background-color: rgba(84, 188, 231, 0.2);
  border: 1px solid rgba(84, 188, 231, 0.35);
  font-size: 15px;
  color: #0a3d63;
  font-weight: 500;
  align-self: stretch;
}

.waterbody-banner span {
  color: inherit;
}

.waterbody-banner-item {
  color: #243b4a;
  font-weight: 500;
}

.waterbody-banner-item--name {
  color: #0b3a59;
  font-weight: 640;
  font-size: 16px;
}

/* Centered wrapping container for map action buttons under the regional table */
.map-buttons-row {
  display: flex;
  gap: 12px;
  justify-content: center;
  padding: 8px 0;
  flex-wrap: wrap;
  align-items: center;
}

.map-buttons-row .table-action-btn {
  margin: 6px;
}

/* Force tab content to fill available height */
.dash-tabs {
  display: flex !important;
  flex-direction: column !important;
  height: 100% !important;
}

.dash-tabs .tab-content {
  flex: 1 !important;
  min-height: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
}

.dash-tabs .tab-content > div {
  height: 100% !important;
  min-height: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: visible !important;
}

#comparison-subtabs .tab-content {
  overflow: visible !important;
  padding-bottom: 12px;
}

#comparison-subtabs .tab-content > div {
  overflow: visible !important;
}

#edit-scenario-tabs .tab-container {
  position: sticky;
  top: 0;
  z-index: 30;
  background: #ffffff;
  box-shadow: 0 1px 0 #e2e8f0;
}

#changelog-scroll-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 280px);
  min-height: 0;
  overflow-y: auto;
  padding: 20px;
  box-sizing: border-box;
}

.changelog-heading {
  margin: 0 0 6px 0;
  color: #0f172a;
}

.changelog-subheading {
  margin: 0 0 16px 0;
  color: #64748b;
}

.changelog-controls {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-bottom: 16px;
  border-bottom: 1px solid #e2e8f0;
  margin-bottom: 20px;
}

.changelog-controls-row {
  display: flex;
  align-items: flex-end;
  gap: 12px;
}

.changelog-control-col {
  flex: 1;
  min-width: 160px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.changelog-control-col--shrink {
  flex: 0 0 auto;
}

.changelog-control-col--table {
  flex: 0 0 300px;
  max-width: 300px;
  margin-right: 12px;
}

.changelog-label {
  font-weight: 600;
  font-size: 13px;
  color: #0f172a;
}

.changelog-placeholder {
  padding: 40px;
  text-align: center;
  color: #94a3b8;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
}

/* ==========================================================================
   Header & Sidebar Layout
   ========================================================================== */

/* Top header styling */
#top-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  z-index: 1100;
  background-color: var(--header-bg);
  color: var(--header-text);
  display: flex;
  align-items: center;
}

.header-inner {
  display: flex;
  align-items: center;
  width: 100%;
  padding-left: 20px;
  padding-right: 20px;
  box-sizing: border-box;
}

.app-title {
  font-size: 20px;
  font-weight: 500;
}

.header-logo {
  height: 50px;
  width: auto;
  margin-left: 8px;
  display: block;
}

.header-about-link {
  color: var(--header-text);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-decoration: none;
  margin-left: auto;
  margin-right: 18px;
  padding: 4px 8px;
  border-radius: 4px;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.header-about-link:hover,
.header-about-link:focus {
  color: var(--header-text);
  background-color: #00722a;
  text-decoration: none;
}

.header-about-link.active,
.header-about-link.active:hover,
.header-about-link.active:focus {
  color: var(--header-text);
  background-color: #008531;
  text-decoration: none;
}

.about-page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 24px 0;
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--header-height));
  box-sizing: border-box;
  overflow: hidden;
}

.about-scroll-body {
  overflow-y: auto;
  flex: 1;
  padding-bottom: 64px;
  padding-right: 4px;
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
}

.about-scroll-body::-webkit-scrollbar {
  width: 6px;
}

.about-scroll-body::-webkit-scrollbar-track {
  background: transparent;
}

.about-scroll-body::-webkit-scrollbar-thumb {
  background-color: #cbd5e1;
  border-radius: 3px;
}

.about-hero {
  margin-bottom: 20px;
}

.about-title {
  font-size: 32px;
  line-height: 1.2;
  color: #0f172a;
  margin-bottom: 20px;
}

.about-lead {
  font-size: 16px;
  line-height: 1.6;
  color: #334155;
  margin-bottom: 6px;
}

.about-subtext {
  font-size: 15px;
  line-height: 1.6;
  color: #475569;
}

.about-grid-top {
  margin-top: 28px;
  margin-bottom: 18px;
}

.about-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 18px;
  margin-top: 0;
}

.about-card-full {
  grid-column: 1 / -1;
}

.about-card,
.about-version-card {
  background-color: #ffffff;
  border: 1px solid #dbe2ea;
  border-radius: 10px;
  padding: 20px;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.04);
  display: flex;
  flex-direction: column;
}

.about-card-primary {
  border-color: #cdd9e6;
}

.about-card-secondary {
  background-color: #f8fafc;
  border-color: #e2e8f0;
}

.about-section-title {
  font-size: 19px;
  color: #0f172a;
  margin-top: 0;
  margin-bottom: 12px;
}

.about-card p,
.about-version-text {
  color: #334155;
  line-height: 1.6;
  margin-bottom: 10px;
}

.about-list {
  margin: 0 0 12px 22px;
  color: #334155;
  line-height: 1.6;
}

.about-list-ordered {
  margin-left: 0;
  padding-left: 0;
  list-style: none;
  counter-reset: about-steps;
}

.about-list-ordered li {
  position: relative;
  counter-increment: about-steps;
  padding-left: 28px;
  margin-bottom: 8px;
}

.about-list-ordered li::before {
  content: counter(about-steps) ".";
  position: absolute;
  left: 0;
  color: #0f172a;
  font-weight: 600;
}

.about-link {
  color: #1d4b8f;
  text-decoration: none;
  font-weight: 500;
}



.about-link:hover,
.about-link:focus {
  text-decoration: underline;
}

.about-card-intro {
  color: #475569;
  font-size: 14px;
  margin-bottom: 10px;
  margin-top: 0;
}

.about-version-dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 20px;
  margin: 0;
  align-items: baseline;
}

.about-version-dl dt {
  color: #64748b;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.about-version-dl dd {
  color: #0f172a;
  font-size: 14px;
  font-weight: 600;
  margin: 0;
}

@media (max-width: 768px) {
  .about-page {
    padding: 14px;
  }

  .about-title {
    font-size: 26px;
  }

  .about-lead {
    font-size: 16px;
  }
}

@media (max-width: 480px) {
  .about-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .about-title {
    font-size: 22px;
  }

  .about-card,
  .about-version-card {
    padding: 16px;
  }
}


/* Sidebar layout and responsive behavior handled via classes */
#sidebar {
  position: fixed;
  top: var(--header-height);
  left: 0;
  bottom: 0;
  padding: 10px 0;
  background-color: var(--sidebar-bg);
  color: var(--sidebar-text);
  overflow: hidden;
  transition: width 0.18s ease;
  z-index: 1000;
}

#sidebar.sidebar-expanded {
  width: var(--sidebar-expanded-width);
}

#sidebar.sidebar-collapsed {
  width: var(--sidebar-collapsed-width);
}

/* page-content margin follows sidebar width using sibling selector */
#sidebar.sidebar-expanded ~ #page-content {
  margin-left: var(--sidebar-expanded-width);
}
#sidebar.sidebar-collapsed ~ #page-content {
  margin-left: var(--sidebar-collapsed-width);
}

/* Header inside sidebar */
.sidebar-header {
  display: flex;
  align-items: center;
  padding: 8px 10px;
  margin-bottom: 8px;
}

/* Label visibility toggles via sidebar state */
#sidebar.sidebar-collapsed .sidebar-label {
  max-width: 0px;
  opacity: 0;
  transition: opacity 0.12s ease, max-width 0.18s ease;
}
#sidebar.sidebar-expanded .sidebar-label {
  max-width: 120px;
  opacity: 1;
  transition: opacity 0.18s ease, max-width 0.18s ease;
}

/* Footer with logo and version */

.sidebar-footer {
  position: absolute;
  bottom: 18px;
  left: 0;
  right: 0;
  padding: 8px 10px;
  border-top: 1px solid rgba(255,255,255,0.04);
  height: 128px; /* increased to fit larger logo */
  box-sizing: border-box;
  /* position context for absolutely positioned children */
  display: block;
}

/* Logo wrapper: fixed container to vertically center the image consistently */
.sidebar-logo-wrap {
  /* Anchor the logo at a fixed offset within the footer so its
     absolute vertical position doesn't change when version text
     appears or disappears. */
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  height: var(--sidebar-logo-height);
  box-sizing: border-box;
  overflow: hidden; /* avoid vertical overflow when sidebar is narrow */
}

/* Image fills wrapper height (preserves aspect ratio) */
.sidebar-logo-img {
  height: var(--sidebar-logo-height);
  width: auto;
  display: block;
  object-fit: contain;
}

/* Show/hide the correct image depending on sidebar state. Both images
   use the same height so they align perfectly when switching. */
#sidebar.sidebar-expanded .sidebar-logo-expanded { display: block; }
#sidebar.sidebar-expanded .sidebar-logo-collapsed { display: none; }
#sidebar.sidebar-collapsed .sidebar-logo-expanded { display: none; }
#sidebar.sidebar-collapsed .sidebar-logo-collapsed { display: block; }

/* Constrain logo width per sidebar state so it always fits and stays centered. */
#sidebar.sidebar-expanded .sidebar-logo-img {
  max-width: calc(var(--sidebar-expanded-width) - 10px);
}

#sidebar.sidebar-collapsed .sidebar-logo-img {
  max-width: calc(var(--sidebar-collapsed-width) - 28px);
}

/* Version visibility controlled by sidebar state */
#sidebar.sidebar-collapsed .sidebar-versions {
  /* hide the whole versions block when collapsed */
  display: none;
}
#sidebar.sidebar-expanded .sidebar-versions {
  display: block;
}

/* Smaller font for version lines in the sidebar footer */
.sidebar-versions {
  /* position the versions block centered under the logo */
  position: absolute;
  top: calc(12px + var(--sidebar-logo-height) + 6px);
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 0 8px; /* small padding to prevent touching edges */
  box-sizing: border-box;
}

/* Version text styling (muted, centered) */
.sidebar-version {
  font-size: 12px;
  line-height: 1.2;
  margin: 0;
  color: #9CA3AF;
  text-align: center;
  width: 100%;
}

/* ==========================================================================
   Modal Dialogs
   ========================================================================== */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(15, 23, 42, 0.45);
  z-index: 10000;
  align-items: center;
  justify-content: center;
}

.modal-overlay.modal-visible {
  display: flex;
}

.modal-content {
  background-color: #ffffff;
  border-radius: 8px;
  padding: 24px 32px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.2);
  max-width: 400px;
  margin: 0 auto;
  text-align: center;
}

.modal-success-icon {
  font-size: 48px;
  color: #10b981;
  margin-bottom: 16px;
  font-weight: bold;
}

.modal-message {
  margin-bottom: 20px;
  color: #0f172a;
  font-size: 16px;
  font-weight: 500;
}

.modal-actions {
  display: flex;
  justify-content: center;
}

.modal-btn {
  min-width: 100px;
}

/* Changelog Comparison Styles */

.changelog-message {
  padding: 40px;
  text-align: center;
  font-size: 16px;
}
.changelog-message.info { color: #64748b; }
.changelog-message.warning { color: #f59e0b; }
.changelog-message.error { color: #dc2626; }
.changelog-message.success { color: #10b981; }

.changelog-stat-card {
  flex: 1;
  padding: 16px;
  background-color: #f8fafc;
  border-radius: 8px;
  text-align: center;
}
.changelog-stat-value {
  font-size: 32px;
  font-weight: bold;
  color: #0f172a;
  margin-bottom: 4px;
}
.changelog-stat-value.added { color: #56004E; }
.changelog-stat-value.modified { color: #FDCA00; }
.changelog-stat-value.gray { color: #64748b; }

.changelog-stat-label {
  font-size: 14px;
  color: #64748b;
}

.changelog-summary {
  padding: 20px;
  background-color: #ffffff;
  border-radius: 8px;
  margin-bottom: 20px;
  border: 1px solid #e2e8f0;
}
.changelog-summary-title {
  margin: 0 0 16px 0;
}

.changelog-stats-row {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}

.changelog-note {
  color: #64748b;
  font-size: 14px;
  margin: 0;
  font-style: italic;
}

.changelog-tables-container {
  display: flex;
  gap: 16px;
  width: 100%;
  height: 560px;
  margin-bottom: 12px;
  align-items: stretch;
}

.changelog-table-left,
.changelog-table-right {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
}

.changelog-scenario-header {
  margin: 0 0 12px 0;
  font-size: 14px;
  font-weight: 600;
  color: #111827;
  flex-shrink: 0;
}

.changelog-table-title {
  margin: 0 0 12px 0;
}

.changelog-datatable-wrapper {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: 100%;
  width: 100%;
  flex: 1;
}

.changelog-datatable-wrapper .dash-table-container {
  width: 100% !important;
  height: 100% !important;
  min-width: 100% !important;
  overflow: hidden;
  flex: 1;
}

.changelog-datatable-wrapper .dash-spreadsheet-container,
.changelog-datatable-wrapper .dash-spreadsheet-inner,
.changelog-datatable-wrapper .dash-spreadsheet {
  width: 100% !important;
  height: 100% !important;
  min-width: 100% !important;
}

.changelog-datatable-wrapper .dash-spreadsheet-inner table {
  width: 100% !important;
}

.changelog-datatable-wrapper .dash-cell {
  padding: 14px 12px;
  font-size: 14px;
  font-family: "Segoe UI", "Calibri", "Trebuchet MS", sans-serif;
  color: #374151;
  border-right: 1px solid #e5e7eb;
  line-height: 1.65;
  background-color: #ffffff;
  text-align: left;
  min-width: 120px;
  max-width: none;
  white-space: normal;
}

.changelog-datatable-wrapper .dash-cell:hover {
  background-color: #f9fafb;
}

.changelog-datatable-wrapper .dash-header {
  background-color: #e5e7eb;
  color: #1f2937;
  font-weight: 600;
  font-size: 13px;
  font-family: "Segoe UI", "Calibri", "Trebuchet MS", sans-serif;
  padding: 14px 12px;
  border-bottom: 1px solid #d1d5db;
  border-right: 1px solid #d1d5db;
}

.changelog-table-section {
  padding: 16px;
  background-color: #ffffff;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
}

#schematic-ea-wb-table .dash-table-tooltip,
#schematic-ea-wb-table .dash-tooltip {
  z-index: 9999 !important;
  border: none !important;
  border-radius: 6px !important;
  background: #0f172a !important;
  min-width: 100px !important;
  max-width: 150px !important;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.22) !important;
}

#schematic-ea-wb-table .dash-tooltip[data-attr-anchor='top'],
#schematic-ea-wb-table .dash-tooltip[data-attr-anchor='bottom'] {
  margin-left: var(--schematic-tooltip-horizontal-offset) !important;
}

#schematic-ea-wb-table .dash-tooltip-content {
  z-index: 9999 !important;
  padding: 8px 10px !important;
  background: #0f172a !important;
  color: #ffffff !important;
  min-height: 56px !important;
  font-size: 12px !important;
  line-height: 1.4 !important;
  font-family: "Segoe UI", "Calibri", "Trebuchet MS", sans-serif !important;
  text-align: left !important;
  white-space: normal !important;
}

#schematic-ea-wb-table .dash-tooltip-content *,
#schematic-ea-wb-table .dash-table-tooltip *,
#schematic-ea-wb-table .dash-tooltip * {
  color: #ffffff !important;
}

/* Shared wrappers for large DataTable sections */
.results-table-wrapper {
  width: 100%;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  overflow-x: auto;
  flex: 1 1 auto;
  min-height: 0;
  gap: 8px;
}

/* Reusable map placeholders/loading states */
.map-placeholder-msg {
  padding: 28px;
  text-align: center;
}

.map-loading-placeholder {
  min-height: 520px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.map-loading-placeholder__label {
  margin-top: 12px;
  color: #475569;
  font-size: 14px;
}

/* Regional DataTable map cells */
.map-cell-img-wrap {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

.map-cell-img-wrap img {
  width: 100%;
  height: auto;
  max-height: 320px;
  object-fit: contain;
}

/* Ensure action button in map table cells is centered with consistent padding */
.map-button-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
}

/* Map modal content */
.map-modal-img {
  width: 100%;
  height: auto;
  max-height: 50vh;
  object-fit: contain;
}

.map-legend-inner-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.map-legend-inner-row-sdf {
  width: 100%;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.map-legend-filter-total-row {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.map-legend-outer-row {
  padding: 8px 4px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.map-legend-outer-row-sdf {
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
}

.map-legend-chip-row-center {
  justify-content: center;
}

.sd-scale-center-wrap {
  width: 100%;
  display: flex;
  justify-content: center;
}

.map-legend-total-center {
  text-align: center;
}

/* SD legend scale */
.sd-scale-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 220px;
}

.sd-scale-bar {
  width: 220px;
  height: 10px;
  border-radius: 999px;
  border: 1px solid #cbd5e1;
  background: linear-gradient(90deg, #D70040 0%, #FF9966 45%, #FFFFFF 50%, #10B981 95%, #007DD3 100%);
}

.sd-scale-labels {
  display: flex;
  width: 220px;
  font-size: 11px;
  color: #475569;
  margin-top: 4px;
}

.sd-scale-labels span {
  flex: 1 1 0;
}

.sd-scale-labels span:nth-child(1) {
  text-align: left;
}

.sd-scale-labels span:nth-child(2) {
  text-align: center;
}

.sd-scale-labels span:nth-child(3) {
  text-align: right;
}

.sd-scale-note {
  font-size: 12px;
  color: #475569;
  margin-top: 4px;
}

/* Waterbody list styles in map modal */
.wb-list-section {
  margin-top: 12px;
  padding: 0 4px;
}

.wb-list-heading {
  font-weight: 700;
  font-size: 12px;
  color: #0f172a;
  margin-bottom: 6px;
}

.wb-list-scroll {
  max-height: 160px;
  overflow-y: auto;
  border-radius: 4px;
  border: 1px solid #e2e8f0;
  background-color: #f8fafc;
}

.wb-list-row {
  display: flex;
  align-items: center;
  padding: 4px 8px;
  font-size: 12px;
  color: #0f172a;
}

.wb-list-swatch {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  margin-right: 8px;
  flex: 0 0 auto;
}

.wb-list-label {
  font-weight: 600;
}

.wb-list-muted {
  color: #64748b;
  font-size: 12px;
}

