html { scroll-behavior: smooth; }
    .container-fluid { padding-left: 10px; padding-right: 10px; }
    h2 { margin: 8px 0; font-size: 22px; }
    /* 3-panel row: fixed-width side panels, the map takes ALL remaining
       width. Height leaves room for the data-table bar underneath, so the
       table is visible on the first screen instead of hidden below the fold */
    .dash-row   { display: flex; gap: 12px; height: calc(100vh - 150px); min-height: 450px; }
    .dash-left  { flex: 0 0 250px; overflow-y: auto; padding-right: 6px; }
    .dash-right { flex: 0 0 170px; overflow-y: auto; }
    .dash-map   { flex: 1 1 auto; min-width: 0; height: 100%; }
    .dash-left h4, .dash-right h4 { margin-top: 10px; font-size: 15px; font-weight: 600; }
    /* fold/unfold filter blocks */
    .filter-block { border-bottom: 1px solid #e3e3e3; padding: 6px 0; }
    .filter-block > summary { cursor: pointer; font-size: 15px; font-weight: 600; padding: 4px 0; }
    .filter-block .form-group { margin: 6px 0 4px 0; }
    /* bar under the map that points people to the data table */
    .table-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px;
                 flex-wrap: wrap; margin: 10px 0; padding: 10px 14px; background: #f1f7f1;
                 border: 1px solid #cfe3cf; border-radius: 6px; }
    .table-bar .tb-title { font-weight: 600; font-size: 15px; }
    .table-bar .tb-hint  { color: #555; margin-left: 8px; }
    .table-bar a.tb-link { font-weight: 600; text-decoration: none; margin-right: 14px; }
    @media (max-width: 900px) {   /* narrow screens: stack the panels */
      .dash-row { flex-direction: column; height: auto; }
      .dash-left, .dash-right { flex: none; }
      .dash-map { height: 500px; }
    }

/* V08: page layout. Table styles above remain unchanged. */
body { background: #f5f7f6; color: #283b35; font-family: "Helvetica Neue", Arial, sans-serif; }
.container-fluid { padding: 0 20px 16px; max-width: 1920px; margin: 0 auto; }
.app-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 18px 0 16px; }
.app-heading h2 { margin: 0 0 5px; color: #235744; font-size: 25px; font-weight: 600; }
.app-heading p { margin: 0; color: #61716b; font-size: 14px; }
.about-button { background: white; border: 1px solid #cbd8d1; color: #235744; border-radius: 6px; padding: 8px 14px; }
.about-button:hover, .about-button:focus { background: #eaf2ed; color: #173f30; border-color: #638b76; }
.dash-row { gap: 14px; height: calc(100vh - 240px); min-height: 470px; }
.dash-left, .dash-right { background: #fff; border: 1px solid #dce4df; border-radius: 8px; padding: 16px; }
.dash-left { flex: 0 0 270px; }
.dash-right { flex: 0 0 210px; }
.panel-title { margin: 0 0 16px; font-size: 16px; font-weight: 600; color: #235744; }
.dash-map { overflow: hidden; border: 1px solid #dce4df; border-radius: 8px; background: white; }
.dash-left h4, .dash-right h4, .filter-block > summary { font-size: 14px; font-weight: 600; color: #354e42; }
.filter-block { padding: 10px 0; border-bottom-color: #e8eeea; }
.filter-block:last-child { border-bottom: 0; }
.filter-block > summary { padding: 3px 0 8px; }
.selectize-control { margin-bottom: 6px; }
.selectize-input, .form-control { border-color: #ccd8d0; border-radius: 5px; box-shadow: none; }
.selectize-input.focus, .form-control:focus { border-color: #58836b; box-shadow: 0 0 0 2px rgba(52,110,74,.12); }
.dash-left a { color: #286544; }
.control-hint { font-size: 12px; color: #6a7670; margin: 5px 0 0; }
.dash-right .radio { margin-bottom: 12px; }
.dash-right .shiny-input-container, .dash-left .shiny-input-container { width: 100%; max-width: 100%; }
.partner-strip { display: flex; align-items: center; justify-content: center; gap: 28px; flex-wrap: wrap; padding: 14px 16px; margin-top: 12px; background: white; border: 1px solid #dce4df; border-radius: 8px; }
.partner-label { color: #6a7670; font-size: 12px; }
.partner-strip img { height: 42px; width: auto; max-width: 180px; object-fit: contain; }
@media (max-width: 1100px) and (min-width: 901px) {
  .dash-left { flex-basis: 235px; }
  .dash-right { flex-basis: 185px; }
}
@media (max-width: 900px) {
  .container-fluid { padding-left: 12px; padding-right: 12px; }
  .app-header { align-items: flex-start; }
  .app-heading h2 { font-size: 22px; }
  .dash-row { height: auto; min-height: 0; }
  .dash-left, .dash-right { flex: none; overflow: visible; }
  .dash-map { flex: none; height: 500px; }
  .partner-strip { gap: 18px; }
  .partner-strip img { height: 34px; max-width: 145px; }
}

/* V08b: compact branded header, system typography and bounded logos. */
body { font-family: "Segoe UI", "Trebuchet MS", sans-serif; background: #edf3f0; color: #243d34; }
.app-header { background: #205e49; color: white; margin: 0 -20px 22px; padding: 22px 24px; min-height: 108px; border-bottom: 4px solid #e8b45c; }
.app-heading { min-width: 0; }
.app-heading h2 { color: white; font-family: inherit; font-size: 27px; font-weight: 600; letter-spacing: -.4px; }
.app-heading p { color: #e0eee7; max-width: 680px; line-height: 1.5; }
.header-actions { display: flex; align-items: center; justify-content: flex-end; gap: 20px; flex-shrink: 0; }
.header-logos { display: flex; align-items: center; gap: 14px; background: white; border-radius: 6px; padding: 10px 12px; }
.header-logos img { display: block; height: 30px; width: auto; max-width: 100px; object-fit: contain; }
.about-button { background: transparent; color: white; border-color: #a8c8b8; white-space: nowrap; }
.about-button:hover, .about-button:focus { background: #34735c; color: white; border-color: white; }
.dash-row { height: calc(100vh - 225px); }
.dash-left, .dash-right { padding: 0 16px 16px; }
.panel-title { margin: 0 -16px 16px; padding: 14px 16px; background: #e3eee7; border-bottom: 1px solid #cdded2; border-radius: 8px 8px 0 0; color: #205e49; font-size: 16px; }
@media (max-width: 1200px) {
 .app-header { flex-wrap: wrap; gap: 16px; }
 .header-actions { flex-wrap: wrap; }
}
@media (max-width: 900px) {
 .app-header { margin-left: -12px; margin-right: -12px; padding: 18px; }
 .app-heading h2 { font-size: 24px; }
 .header-actions { justify-content: flex-start; gap: 14px; }
 .dash-row { height: auto; }
 .header-logos { gap: 10px; }
}

/* V08c: KIT-inspired yellow accent and individually sized partner logos.
   Inline image dimensions in ui.R preserve each logo's proportions. */
body { background: #F1F6F2; }
.app-header { border-bottom-color: #FFDA36; }
.header-logos { gap: 20px; padding: 12px 16px; }
.header-actions { gap: 24px; }
@media (max-width: 600px) {
 .header-logos { flex-wrap: wrap; gap: 14px; max-width: 100%; }
 .header-actions { max-width: 100%; }
}

/* OCF-26: readable, scrollable intervention details beside the map. */
.dash-right { flex-basis: 330px; min-width: 0; }
.intervention-card, .intervention-empty { border-top: 1px solid #cdded2; margin-top: 18px; padding-top: 10px; }
.intervention-card h4 { overflow-wrap: anywhere; }
.intervention-card .nav-tabs { display: flex; flex-wrap: wrap; gap: 3px; margin: 12px 0; }
.intervention-card .nav-tabs > li { float: none; }
.intervention-card .nav-tabs > li > a { padding: 6px 8px; font-size: 12px; margin: 0; border-radius: 4px; overflow-wrap: anywhere; }
.intervention-card .nav-tabs > li.active > a { background: #e3eee7; color: #205e49; font-weight: 600; border-color: #cdded2; }
.intervention-field { margin: 10px 0; }
.intervention-field strong { font-size: 12px; color: #52675d; }
.intervention-field p { margin: 3px 0; font-size: 13px; overflow-wrap: anywhere; }
.intervention-percentages { width: 100%; margin: 10px 0; font-size: 12px; }
.intervention-percentages th { font-weight: 400; padding: 6px 8px 6px 0; }
.intervention-percentages td { text-align: right; white-space: nowrap; font-weight: 600; }
.intervention-percentages tr { border-bottom: 1px solid #e8eeea; }
.footprint-button { width: 100%; white-space: normal; margin-top: 12px; border-color: #b84e00; color: #944000; }
.footprint-status { border-left: 3px solid #D65A00; padding-left: 8px; margin-top: 12px; font-size: 12px; }
.intervention-card a { color: #286544; }
#close_intervention_card { display: block; margin-top: 14px; }
.leaflet-intervention-highlight-pane { pointer-events: none; }
@media (min-width: 901px) and (max-width: 1100px) { .dash-right { flex-basis: 290px; } }
@media (max-width: 900px) { .dash-right { flex: none; } }

/* V03: shared styling for the four filter checklists. */
.filter-checklist > summary span {
  display: inline-block;
  margin-left: 5px;
  color: #4f665a;
  font-size: 12px;
  font-weight: 400;
  white-space: nowrap;
}
.filter-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin: 2px 0 8px;
}
.filter-actions a { font-size: 13px; text-decoration: underline; }
.filter-options {
  max-height: 245px;
  overflow-y: auto;
  padding: 0 4px;
}
.filter-checklist .checkbox { margin: 5px 0; }
.filter-checklist .checkbox label { overflow-wrap: anywhere; }
.filter-guide { margin-top: 10px; }

/* V05c: let long labels wrap within the horizontally scrollable table. */
.table-filter-note { margin: 8px 0 12px; color: #4f665a; font-size: 13px; }
#table thead th { white-space: normal; min-width: 8em; }

#table thead .table-group-bands th {
  background: #205e49;
  color: #fff;
  border-right: 1px solid #dce4df;
  text-align: left;
  padding: 8px 10px;
}

#table .coverage-details { padding: 6px 12px; }
#table .coverage-details ul { margin: 6px 0 0; padding-left: 20px; }
#table .coverage-child { background: #f4f8f5; }

.table-location-filters { display: flex; flex-wrap: wrap; gap: 0 16px; }
.table-location-filters .shiny-input-container { width: min(100%, 380px); }
#table .table-coverage-actions { display: flex; flex-wrap: wrap; gap: 4px; min-width: 10em; }
#table .coverage-details li { margin-bottom: 4px; }
#table .coverage-details .table-map-zoom { margin-left: 8px; }

/* OCF layout: map controls and intervention filters left; details right. */
.map-controls-separator { border-color: #e3ebe6; margin: 14px 0; }
.panel-subtitle { margin: 0 0 12px; font-size: 15px; font-weight: 600; color: #205e49; }
.dash-left { flex-basis: 285px; }
.dash-right .intervention-card,
.dash-right .intervention-empty {
  margin-top: 0;
  border-top: none;
  padding-top: 0;
}
@media (min-width: 901px) and (max-width: 1100px) { .dash-left { flex-basis: 245px; } }

/* OCF-07: sticky identifier columns and filters.
   Apply stacking to CELLS only. Positioning entire THEAD rows creates
   independent stacking contexts, allowing some colspan group bands to
   paint over the frozen filter cells regardless of cell z-index. */
#table .dataTables_scrollHead table,
#table .dataTables_scrollBody table {
  border-collapse: separate !important;
  border-spacing: 0;
}
#table .dataTables_scrollHead thead tr {
  position: static !important;
  z-index: auto !important;
}
#table .dataTables_scrollHead thead th { white-space: normal; }
#table .dataTables_scrollBody { border-bottom: 1px solid #dce4df; }

/* All scrolling group headings have the SAME lower paint priority. */
#table .dataTables_scrollHead thead tr.table-group-bands > th {
  position: relative;
  z-index: 1;
  background: #205e49;
}
/* One opaque, pinned heading spanning Country / Intervention ID / Actions. */
#table .dataTables_scrollHead thead tr.table-group-bands > th:first-child {
  position: sticky;
  left: 0;
  z-index: 40;
  background: #205e49;
  background-clip: padding-box;
  box-shadow: 1px 0 0 #dce4df;
}

/* DT supplies one ordinary heading row and one TD-based filter row. */
#table .dataTables_scrollHead thead tr:not(.table-group-bands) > :is(th, td):nth-child(-n+3),
#table .dataTables_scrollBody tbody tr > td:nth-child(-n+3) {
  position: sticky;
  background: #fff;
  background-clip: padding-box;
  box-shadow: 1px 0 0 #dce4df;
}
#table .dataTables_scrollHead thead tr:not(.table-group-bands) > :is(th, td):nth-child(-n+3) {
  z-index: 50;
}
#table .dataTables_scrollBody tbody tr > td:nth-child(-n+3) { z-index: 4; }
#table .dataTables_scrollHead thead tr:not(.table-group-bands) > :is(th, td):nth-child(1),
#table .dataTables_scrollBody tbody tr > td:nth-child(1) { left: 0; }
#table .dataTables_scrollHead thead tr:not(.table-group-bands) > :is(th, td):nth-child(2),
#table .dataTables_scrollBody tbody tr > td:nth-child(2) { left: var(--ocf-freeze-left-2, 0px); }
#table .dataTables_scrollHead thead tr:not(.table-group-bands) > :is(th, td):nth-child(3),
#table .dataTables_scrollBody tbody tr > td:nth-child(3) { left: var(--ocf-freeze-left-3, 0px); }
#table .dataTables_scrollHead thead tr:not(.table-group-bands) > :is(th, td):nth-child(-n+3) input {
  max-width: 100%; box-sizing: border-box;
}
#table .dataTables_scrollBody tbody tr.odd > td:nth-child(-n+3) { background: #f9fbfa; }
#table .dataTables_scrollBody tbody tr:hover > td:nth-child(-n+3) { background: #edf4ef; }
#table-nav, #app-top { scroll-margin-top: 0; }
.table-return-map { margin: 12px 0; text-align: right; }
.table-return-map a { color: #205e49; border-color: #cdded2; }

/* Trial: crimson main banner */
.app-header {
  background: #BA0C2F;
}

.about-button {
  border-color: white;
}

.about-button:hover,
.about-button:focus {
  background: #940A26;
  color: white;
  border-color: white;
}
/* Collapsible panels retain visible, keyboard-accessible reopening controls. */
.panel-title { position: relative; padding-right: 42px; }
.panel-toggle { position: absolute; right: 8px; top: 7px; border: 1px solid #b6cec0;
  border-radius: 4px; background: white; color: #205e49; font-size: 23px; line-height: 26px; width: 28px; }
.panel-reopen { display: none; border: 0; background: transparent; color: #205e49;
  font-weight: 600; padding: 14px 7px; }
.dash-left.is-collapsed, .dash-right.is-collapsed { flex: 0 0 42px; padding: 0; overflow: hidden; }
.is-collapsed > .panel-title, .is-collapsed > .panel-content { display: none; }
.is-collapsed > .panel-reopen { display: block; writing-mode: vertical-rl; width: 100%; }
.panel-toggle:focus-visible, .panel-reopen:focus-visible { outline: 2px solid #205e49; outline-offset: -2px; }
.dash-map { position: relative; }
#expand-map { position: absolute; z-index: 1000; top: 10px; left: 48px; }
/* Reserve separate halves for country and district legends; wrap long labels.
   Controls on the same side stack vertically in Leaflet's normal flow. */
#map .leaflet-bottom.leaflet-left, #map .leaflet-bottom.leaflet-right { max-width: calc(50% - 8px); }
#map .leaflet-bottom .leaflet-control { box-sizing: border-box; max-width: calc(100% - 10px);
  white-space: normal; overflow-wrap: anywhere; font-size: 11px; line-height: 1.3; padding: 6px 8px; }
#map .leaflet-bottom .legend { max-height: 24vh; overflow-y: auto; }
#map .legend i { flex-shrink: 0; }
.indicator-scale { width: 210px; max-width: 100%; }
.indicator-scale strong { display: block; margin-bottom: 5px; }
.indicator-gradient { height: 12px; width: 100%; border: 1px solid #adb6be; }
.indicator-ticks { display: flex; justify-content: space-between; gap: 4px; margin-top: 3px; font-size: 10px; }
@media (max-width: 900px) {
  .dash-left.is-collapsed, .dash-right.is-collapsed { flex: none; width: 100%; }
  .is-collapsed > .panel-reopen { writing-mode: horizontal-tb; text-align: left; padding: 10px 14px; }
}

/* A01: chart occupies the combined map + card space; filters stay shared. */
.dash-chart { flex: 1 1 0; min-width: 0; overflow-y: auto; padding: 20px 24px;
  border: 1px solid #dce4df; border-radius: 8px; background: #fff; }
.dash-chart h3 { margin-top: 0; color: #264e3c; }
.dash-chart svg { display: block; width: 100%; height: auto; min-height: 260px; }
.chart-key { display: flex; flex-wrap: wrap; gap: 10px 24px; font-weight: 600; margin: 16px 0 8px; }
.chart-provisional { background: #fff6df; padding: 9px 12px; border-left: 3px solid #bf8425; font-size: 12px; }
.chart-reporting { margin-top: 14px; font-size: 12px; overflow-x: auto; }
.chart-reporting summary { cursor: pointer; color: #286544; font-weight: 600; margin-bottom: 10px; }
@media (max-width: 900px) { .dash-chart { flex: none; overflow: visible; padding: 16px; } }

.ocf-chart-point { cursor: pointer; }
.ocf-chart-point:focus { stroke: #354e42; stroke-width: 2; outline: none; }
.ocf-chart-tooltip { position: fixed; z-index: 10000; pointer-events: none;
  max-width: min(420px, calc(100vw - 16px)); padding: 9px 12px;
  background: #203e32; color: white; border-radius: 5px;
  font: 13px/1.4 Arial, sans-serif; box-shadow: 0 2px 8px #0003; }
.ocf-chart-tooltip[hidden] { display: none; }

/* Keep the view switch accessible when the filter panel was collapsed. */
.dash-row.is-chart-view > .dash-left { flex: 0 0 285px; padding: 0 16px 16px; overflow-y: auto; }
.dash-row.is-chart-view > .dash-left > .panel-title,
.dash-row.is-chart-view > .dash-left > .panel-content { display: block; }
.dash-row.is-chart-view > .dash-left > .panel-reopen,
.dash-row.is-chart-view > .dash-left > .panel-title > .panel-toggle { display: none; }
@media (max-width: 900px) {
  .dash-chart { flex: none; max-height: none; }
  .dash-row.is-chart-view > .dash-left { flex: none; width: 100%; overflow: visible; }
}

/* The view selector shares the banner row, leaving the table bar in view. */
.header-view-switch { flex-shrink: 0; }
.header-view-switch .shiny-input-container { width: auto; margin-bottom: 0; }
.header-view-switch .control-label { font-size: 12px; margin-bottom: 2px; }
.header-view-switch .shiny-options-group { white-space: nowrap; }
.header-view-switch .radio-inline { margin-top: 0; }
.header-view-switch input { accent-color: #FFDA36; }
.app-header { padding-top: 14px; padding-bottom: 14px; min-height: 92px; margin-bottom: 16px; }
.header-actions { gap: 16px; }
@media (min-width: 901px) {
  .app-header { flex-wrap: nowrap; gap: 14px; }
  .app-heading p { font-size: 12px; }
  .header-logos { gap: 10px; padding: 8px 10px; }
  .header-logos img { max-height: 42px; max-width: 115px !important; }
}
