/* ─── Light Mode Tokens ──────────────────────────────────────────────────── */
:root {
  /* Brand */
  --brand-navy:      #1e3c6e;
  --brand-navy-dark: #162f56;
  --brand-navy-mid:  #254d8a;
  --brand-orange:    #f5a623;
  --brand-orange-dk: #e08c10;

  /* Surface */
  --bg:          #f0f4f8;
  --surface:     #ffffff;
  --surface-alt: #f8fafc;
  --border:      #e2e8f0;
  --border-light:#eef2f7;

  /* Semantic */
  --green:       #10b981;
  --green-dim:   #ecfdf5;
  --red:         #ef4444;
  --red-dim:     #fef2f2;
  --amber:       #f59e0b;
  --amber-dim:   #fffbeb;

  /* Text */
  --text:        #0f172a;
  --text-sec:    #475569;
  --text-muted:  #94a3b8;
  --text-xmuted: #cbd5e1;

  /* KPI card (blue) */
  --kpi-bg-from:  #1e3c6e;
  --kpi-bg-to:    #162f56;
  --kpi-border:   #254d8a;
  --kpi-text:     #ffffff;
  --kpi-text-sec: rgba(255,255,255,0.65);
  --kpi-icon-bg:  rgba(255,255,255,0.12);
  --kpi-divider:  rgba(255,255,255,0.12);
  --kpi-spark:    rgba(255,255,255,0.85);
  --kpi-spark-fill: rgba(255,255,255,0.15);

  /* Chart series */
  --tree-hanger: #F6C343;
  --tree-hanger-soft: rgba(246,195,67,0.30);
  --tree-leaner: #F06B5B;
  --tree-leaner-soft: rgba(240,107,91,0.28);

  /* Shadows */
  --shadow-sm:  0 1px 3px rgba(0,0,0,0.07), 0 1px 2px rgba(0,0,0,0.04);
  --shadow:     0 4px 14px rgba(0,0,0,0.09), 0 1px 4px rgba(0,0,0,0.05);
  --shadow-kpi: 0 6px 20px rgba(30,60,110,0.35), 0 2px 6px rgba(30,60,110,0.2);

  --radius-sm:  6px;
  --radius:     10px;
  --radius-lg:  14px;
  --sidebar-w:  128px;
  --font-mono:  "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

/* ─── Dark Mode Tokens ───────────────────────────────────────────────────── */
[data-theme="dark"] {
  --bg:          #0d1829;
  --surface:     #132040;
  --surface-alt: #0f1a33;
  --border:      #1e3255;
  --border-light:#243b64;

  --text:        #e8f0fe;
  --text-sec:    #8ba8d4;
  --text-muted:  #4a6a9a;
  --text-xmuted: #2a4470;

  /* KPI cards stay brand blue but shift slightly */
  --kpi-bg-from:  #1a3460;
  --kpi-bg-to:    #112849;
  --kpi-border:   #1e3c6e;
  --shadow-kpi:   0 6px 24px rgba(0,0,0,0.5), 0 2px 6px rgba(0,0,0,0.3);
  --shadow-sm:    0 1px 4px rgba(0,0,0,0.25);
  --shadow:       0 4px 16px rgba(0,0,0,0.35);
}

/* ─── Reset ──────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

/* ─── Theme Transition ───────────────────────────────────────────────────── */
*:not(svg):not(svg *) {
  transition:
    background-color 320ms ease,
    background 320ms ease,
    color 320ms ease,
    border-color 320ms ease,
    box-shadow 320ms ease,
    opacity 320ms ease;
}

::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 320ms;
  animation-timing-function: ease;
}

@media (prefers-reduced-motion: reduce) {
  *:not(svg):not(svg *) {
    transition-duration: 0.01ms !important;
  }

  ::view-transition-old(root),
  ::view-transition-new(root) {
    animation-duration: 0.01ms;
  }
}

html, body { margin: 0; min-height: 100%; overflow: hidden; }
body {
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", sans-serif;
  background: var(--bg);
  font-size: 14px;
  line-height: 1.5;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ─── App Layout ─────────────────────────────────────────────────────────── */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ─── Sidebar ────────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 14px 10px 20px;
  background: var(--brand-navy-dark);
  border-right: 1px solid var(--kpi-border);
  gap: 10px;
  position: sticky;
  top: 0;
  height: 100vh;
  transition: width 320ms ease, padding 320ms ease, background 320ms ease, border-color 320ms ease;
}

.sidebar--collapsed {
  width: 60px;
  padding: 14px 8px 20px;
  gap: 6px;
}

.sidebar-toggle {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  width: 100%;
  height: 34px;
  padding: 0 5px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: rgba(255,255,255,0.58);
  cursor: pointer;
}

.sidebar-toggle:hover {
  background: rgba(255,255,255,0.1);
  color: #ffffff;
}

.sidebar-toggle-icon {
  transition: transform 320ms ease;
}

.sidebar--collapsed .sidebar-toggle {
  justify-content: center;
  padding: 0;
}

.sidebar--collapsed .sidebar-toggle-icon {
  transform: rotate(180deg);
}

.sidebar-item {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius);
  color: rgba(255,255,255,0.5);
  cursor: pointer;
  transition: background 320ms ease, color 320ms ease, opacity 320ms ease;
  border: none;
  background: none;
}
.sidebar-item:hover       { background: rgba(255,255,255,0.1); color: #ffffff; }
.sidebar-item--active     { background: rgba(255,255,255,0.18); color: #ffffff; }
.sidebar-item--labeled {
  width: 100%;
  min-height: 48px;
  height: auto;
  padding: 9px 10px;
  justify-content: flex-start;
  gap: 10px;
}
.sidebar-item-label {
  flex: 1 1 auto;
  max-width: 100%;
  overflow: visible;
  color: currentColor;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1.15;
  text-align: left;
  text-transform: uppercase;
  white-space: normal;
  overflow-wrap: break-word;
}
.sidebar-item--labeled > svg,
.sidebar-item--labeled > img {
  flex: 0 0 auto;
}
.sidebar-item--combined .sidebar-item-label {
  min-width: 0;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: none;
  white-space: nowrap;
}
.sidebar-item img {
  width: 18px;
  height: 18px;
  display: block;
  filter: brightness(0) invert(1);
  opacity: 0.72;
}
.sidebar-item:hover img,
.sidebar-item--active img {
  opacity: 1;
}

.sidebar--collapsed .sidebar-item--labeled {
  width: 44px;
  min-height: 44px;
  height: 44px;
  padding: 0;
  justify-content: center;
  gap: 0;
}

.sidebar--collapsed .sidebar-item-label {
  display: none;
}

.sidebar-spacer { flex: 1; }

.sidebar-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 7px;
  width: 100%;
  min-height: 68px;
  margin-top: auto;
  padding: 8px 6px 0;
  opacity: 0.95;
}

.sidebar-brand-kicker {
  color: rgba(255,255,255,0.56);
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
}

.sidebar-brand-logo {
  display: block;
  width: min(96px, 100%);
  max-height: 32px;
  object-fit: contain;
}

.sidebar-brand-pin {
  display: none;
  width: 24px;
  height: 28px;
  object-fit: contain;
}

.sidebar--collapsed .sidebar-brand {
  min-height: 42px;
  padding: 0;
}

.sidebar--collapsed .sidebar-brand-kicker,
.sidebar--collapsed .sidebar-brand-logo {
  display: none;
}

.sidebar--collapsed .sidebar-brand-pin {
  display: block;
}

/* ─── Main ───────────────────────────────────────────────────────────────── */
.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* ─── Topbar ─────────────────────────────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 58px;
  background: var(--brand-navy-dark);
  border-bottom: 1px solid var(--kpi-border);
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  min-width: 0;
  text-decoration: none;
}

.topbar-brand--project {
  flex: 1 1 auto;
}

.topbar-title {
  display: block;
  min-width: 0;
  overflow: hidden;
  color: #ffffff;
  font-size: 1.25rem;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-client-logo {
  display: block;
  width: auto;
  max-width: 160px;
  height: auto;
  max-height: 34px;
  object-fit: contain;
  border-radius: 4px;
  flex: 0 1 auto;
}

.topbar-client-logo[hidden] {
  display: none;
}

.topbar-logo-img {
  height: 32px;
  width: auto;
  display: block;
}

.topbar-logo-img--debristech {
  max-width: 154px;
  object-fit: contain;
  flex-shrink: 0;
}

.project-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.2);
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  flex-shrink: 0;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  min-width: 0;
}

/* Theme toggle */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius);
  border: 1px solid rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.65);
  cursor: pointer;
  transition: border-color 320ms ease, color 320ms ease, background 320ms ease;
  flex-shrink: 0;
}
.theme-toggle:hover { border-color: rgba(255,255,255,0.5); color: #ffffff; background: rgba(255,255,255,0.15); }
.theme-toggle .icon-sun  { display: none; }
.theme-toggle .icon-moon { display: block; }
[data-theme="dark"] .theme-toggle .icon-sun  { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

.topbar-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 13px;
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.08);
  font-size: 0.78rem;
  font-weight: 500;
  color: rgba(255,255,255,0.8);
  text-decoration: none;
  cursor: pointer;
  font: inherit;
  transition: border-color 320ms ease, color 320ms ease, background 320ms ease, opacity 320ms ease;
}
.topbar-chip:hover    { border-color: rgba(255,255,255,0.5); color: #ffffff; background: rgba(255,255,255,0.15); }
.topbar-chip:disabled { opacity: 0.45; cursor: wait; }

/* ─── Page Content ───────────────────────────────────────────────────────── */
.page-content {
  padding: 20px 20px 32px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.row-dashboard-content {
  min-height: 0;
}

.page-content--shell {
  padding: 0;
  gap: 0;
  min-height: calc(100vh - 58px);
}

.page-content--shell .dashboard-state {
  padding: 20px;
  color: var(--text-sec);
}

.page-content--shell .widget-grid {
  padding: 20px;
}

.layout-shell-frame {
  display: block;
  width: 100%;
  min-height: calc(100vh - 58px);
  height: calc(100vh - 58px);
  border: 0;
  background: transparent;
}

.layout-shell-frame[hidden] {
  display: none;
}

.metric-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.metric-section--tight {
  margin-top: -2px;
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}

.section-eyebrow {
  margin: 0 0 3px;
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.section-title {
  margin: 0;
  color: var(--text);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

/* ─── KPI Row ────────────────────────────────────────────────────────────── */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
}

/* ─── KPI Card (navy blue) ───────────────────────────────────────────────── */
.kpi-card {
  background: linear-gradient(145deg, var(--kpi-bg-from) 0%, var(--kpi-bg-to) 100%);
  border: 1px solid var(--kpi-border);
  border-radius: var(--radius-lg);
  min-width: 0;
  min-height: 120px;
  padding: 13px 20px 12px;
  box-shadow: var(--shadow-kpi);
  display: grid;
  grid-template-rows: 32px 52px 16px;
  row-gap: 0;
  transition:
    background 320ms ease,
    border-color 320ms ease,
    color 320ms ease,
    box-shadow 320ms ease,
    transform 180ms ease;
  color: var(--kpi-text);
}
.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(30,60,110,0.45), 0 3px 8px rgba(30,60,110,0.25);
}

.kpi-card-top {
  grid-row: 1;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 6px;
  min-width: 0;
  align-self: start;
}

.kpi-card-label {
  min-width: 0;
  font-size: var(--kpi-label-fit-size, 0.95rem);
  font-weight: 700;
  color: var(--kpi-text-sec);
  margin: 0;
  letter-spacing: 0;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kpi-card-icon {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  flex-shrink: 0;
}

.kpi-card-icon img {
  width: auto;
  height: 18px;
  max-width: 22px;
  max-height: 18px;
  display: block;
  object-fit: contain;
  object-position: center;
  filter: brightness(0) invert(1);
}

.kpi-card-value {
  grid-row: 2;
  align-self: end;
  justify-self: center;
  font-size: var(--kpi-value-fit-size, clamp(2.15rem, 1.9vw, 2.6rem));
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1;
  color: var(--kpi-text);
  font-variant-numeric: tabular-nums;
  margin: 0;
  max-width: 100%;
  white-space: nowrap;
}
.kpi-card-value.skeleton {
  color: rgba(255,255,255,0.25);
  animation: pulse 1.4s ease-in-out infinite;
}

.kpi-card-split {
  grid-row: 2 / 4;
  align-self: end;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 1px minmax(0, 1fr);
  column-gap: 16px;
  min-width: 0;
}

.kpi-card-segment {
  display: grid;
  grid-template-rows: 52px 16px;
  align-items: flex-start;
  justify-items: center;
  min-width: 0;
}

.kpi-card-segment-value {
  align-self: end;
  justify-self: center;
  margin: 0;
  color: var(--kpi-text);
  font-size: var(--kpi-value-fit-size, clamp(2.15rem, 1.9vw, 2.6rem));
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
  max-width: 100%;
  white-space: nowrap;
}

.kpi-card-segment-value.skeleton {
  color: rgba(255,255,255,0.25);
  animation: pulse 1.4s ease-in-out infinite;
}

.kpi-card-segment-label {
  align-self: start;
  justify-self: center;
  margin: 0;
  color: var(--kpi-text-sec);
  font-size: 0.62rem;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: 0;
  text-align: center;
  text-transform: uppercase;
}

.kpi-card-split-divider {
  width: 1px;
  height: 40px;
  background: var(--kpi-divider);
  justify-self: center;
  align-self: center;
}

.kpi-card-unit {
  grid-row: 3;
  align-self: start;
  font-size: 0.62rem;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: 0;
  text-transform: uppercase;
  color: var(--kpi-text-sec);
  margin: 0;
  padding-bottom: 1px;
}


/* ─── Mid Row ────────────────────────────────────────────────────────────── */
.mid-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* Chart panel */
.chart-panel {
  background: linear-gradient(145deg, var(--kpi-bg-from) 0%, var(--kpi-bg-to) 100%);
  border: 1px solid var(--kpi-border);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow-kpi);
  color: var(--kpi-text);
  display: flex;
  flex-direction: column;
}

.chart-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  gap: 12px;
}

.chart-panel-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--kpi-text);
  margin: 0;
}

.chart-legend {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.chart-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--kpi-text-sec);
  font-size: 0.72rem;
  font-weight: 600;
}

.chart-legend-swatch {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  display: inline-block;
}

.chart-legend-swatch--hanger {
  background: var(--tree-hanger);
}

.chart-legend-swatch--leaner {
  background: var(--tree-leaner);
}


.chart-body {
  display: block;
  position: relative;
  border-bottom: 1px solid var(--kpi-divider);
  padding-top: 4px;
  flex: 1 1 0;
  min-height: 0;
  overflow: hidden;
}

.chart-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 220px;
  color: var(--kpi-text-sec);
  font-size: 0.78rem;
}

.chart-svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
  shape-rendering: geometricPrecision;
  text-rendering: geometricPrecision;
}

.chart-grid-line {
  stroke: rgba(255,255,255,0.08);
  stroke-width: 1;
  stroke-dasharray: 3 4;
  vector-effect: non-scaling-stroke;
}

.chart-y-axis-line,
.chart-y-axis-tick {
  stroke: rgba(255,255,255,0.20);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.chart-y-axis-label {
  fill: var(--kpi-text-sec);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", sans-serif;
}

.chart-area {
  stroke: none;
}
.chart-area--hanger { fill: url(#grad-hanger); }
.chart-area--leaner { fill: url(#grad-leaner); }

.chart-line {
  fill: none;
  stroke-width: 2.75;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.chart-line--hanger { stroke: var(--tree-hanger); }
.chart-line--leaner { stroke: var(--tree-leaner); }

.chart-hover-guide {
  stroke: rgba(255,255,255,0.24);
  stroke-width: 1;
  stroke-dasharray: 4 5;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
}

.chart-hover-band {
  fill: transparent;
  cursor: pointer;
}

.chart-hover-band:hover {
  fill: rgba(255,255,255,0.03);
}

.chart-point {
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}
.chart-point--hanger {
  fill: var(--tree-hanger);
  stroke: var(--tree-hanger-soft);
}
.chart-point--leaner {
  fill: var(--tree-leaner);
  stroke: var(--tree-leaner-soft);
}

.bar-track {
  fill: rgba(255,255,255,0.08);
}

.bar-fill {
  transition: opacity 120ms;
}

.bar-value-label {
  fill: #ffffff;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", sans-serif;
}

.chart-x-labels {
  display: flex;
  justify-content: flex-start;
  position: relative;
  height: 32px;
  margin-top: 10px;
  padding: 0 8px;
  box-sizing: border-box;
}
.chart-x-labels--bars {
  justify-content: flex-start;
}
.chart-x-label {
  flex: 1 1 0;
  min-width: 0;
  text-align: center;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.1;
  color: var(--kpi-text-sec);
}

.chart-x-labels--positioned {
  display: block;
  padding: 0;
}

.chart-x-labels--positioned .chart-x-label {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  flex: none;
  white-space: nowrap;
}

.chart-x-day,
.chart-x-date {
  display: block;
}

.chart-x-day {
  color: var(--kpi-text-sec);
}

.chart-x-date {
  margin-top: 2px;
  color: rgba(255,255,255,0.52);
  font-size: 0.64rem;
}

.map-cost-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(390px, 460px);
  gap: 12px;
  min-height: 390px;
}

.map-panel {
  min-height: 390px;
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.cost-panel {
  min-height: 390px;
  gap: 18px;
}

.cost-panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.cost-panel .chart-panel-title {
  color: var(--kpi-text);
}

.cost-panel-total {
  display: block;
  margin: 0;
  color: var(--kpi-text);
  font-size: 30px;
  font-weight: 650;
  line-height: 1.15;
  text-align: left;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.cost-panel-body {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  justify-content: flex-start;
  min-height: 0;
}

.cost-panel-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 220px;
  color: var(--kpi-text-sec);
  font-size: 0.78rem;
  line-height: 1.45;
  text-align: center;
}

.boundary-map {
  --map-date-panel-w: clamp(268px, 26vw, 340px);
  flex: 1 1 auto;
  position: relative;
  display: flex;
  align-items: stretch;
  min-height: 360px;
  height: 360px;
  width: 100%;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: rgba(5, 18, 34, 0.28);
}

.boundary-map-view {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 100%;
  overflow: hidden;
  transition: flex-basis 340ms ease, width 340ms ease;
}

.boundary-map .esri-view,
.boundary-map .esri-view-root {
  width: 100%;
  height: 100%;
}

.boundary-map .esri-view-surface,
.boundary-map canvas {
  width: 100% !important;
  height: 100% !important;
}

.boundary-map .esri-view:focus,
.boundary-map .esri-view-root:focus,
.boundary-map .esri-view-surface:focus,
.boundary-map .esri-view-surface--inset-outline:focus,
.boundary-map canvas:focus {
  outline: none !important;
}

.boundary-map .esri-view-surface:focus::after,
.boundary-map .esri-view-surface--inset-outline:focus::after {
  outline: none !important;
  box-shadow: none !important;
}

.boundary-map .esri-ui {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", sans-serif;
}

.boundary-map .esri-attribution,
.boundary-map .esri-ui-bottom-left,
.boundary-map .esri-ui-bottom-right {
  display: none !important;
}

.boundary-map .esri-search {
  max-width: min(320px, calc(100vw - 48px));
  border: 1px solid rgba(255,255,255,0.22);
  border-radius: var(--radius-sm);
  background: rgba(10,22,44,0.86);
  box-shadow: 0 8px 18px rgba(0,0,0,0.25);
  color: #ffffff;
  overflow: hidden;
  backdrop-filter: blur(8px);
}

.boundary-map .esri-search__container,
.boundary-map .esri-search__form {
  border: 0;
  background: transparent;
}

.boundary-map .esri-search__input {
  height: 36px;
  border: 0;
  background: rgba(255,255,255,0.08);
  color: #ffffff;
  font: inherit;
  font-size: 0.76rem;
  font-weight: 750;
  letter-spacing: 0;
}

.boundary-map .esri-search__input::placeholder {
  color: rgba(255,255,255,0.58);
}

.boundary-map .esri-search__input:focus {
  outline: none;
}

.boundary-map .esri-search__submit-button,
.boundary-map .esri-search__clear-button,
.boundary-map .esri-search__sources-button,
.boundary-map .esri-widget--button {
  width: 36px;
  height: 36px;
  border: 1px solid rgba(255,255,255,0.22);
  border-radius: var(--radius-sm);
  background: rgba(10,22,44,0.86);
  color: rgba(255,255,255,0.82);
  box-shadow: 0 8px 18px rgba(0,0,0,0.22);
}

.boundary-map .esri-search__submit-button,
.boundary-map .esri-search__clear-button,
.boundary-map .esri-search__sources-button {
  border-width: 0 0 0 1px;
  border-radius: 0;
  box-shadow: none;
}

.boundary-map .esri-search__submit-button:hover,
.boundary-map .esri-search__clear-button:hover,
.boundary-map .esri-search__sources-button:hover,
.boundary-map .esri-widget--button:hover {
  background: rgba(255,255,255,0.16);
  color: #ffffff;
}

.boundary-map .esri-widget--button:focus,
.boundary-map .esri-widget--button:focus-visible,
.boundary-map .esri-search__input:focus-visible {
  outline: 2px solid rgba(255,255,255,0.34);
  outline-offset: 2px;
}

.boundary-map .esri-icon,
.boundary-map .esri-search__submit-button .esri-icon,
.boundary-map .esri-widget--button .esri-icon {
  color: currentColor;
}

.boundary-map .esri-menu,
.boundary-map .esri-search__suggestions-menu,
.boundary-map .esri-search__sources-menu {
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: var(--radius-sm);
  background: rgba(10,22,44,0.96);
  box-shadow: 0 12px 24px rgba(0,0,0,0.30);
  color: rgba(255,255,255,0.82);
  overflow: hidden;
}

.boundary-map .esri-menu__list-item {
  color: rgba(255,255,255,0.76);
  font-size: 0.74rem;
  font-weight: 700;
}

.boundary-map .esri-menu__list-item:hover,
.boundary-map .esri-menu__list-item:focus,
.boundary-map .esri-menu__list-item--focus {
  background: rgba(255,255,255,0.14);
  color: #ffffff;
}

[data-theme="light"] body .boundary-map .esri-search,
[data-theme="light"] body .boundary-map .esri-widget--button,
[data-theme="light"] body .boundary-map .esri-menu,
[data-theme="light"] body .boundary-map .esri-search__suggestions-menu,
[data-theme="light"] body .boundary-map .esri-search__sources-menu {
  border-color: rgba(148,163,184,0.42);
  background: rgba(226,234,244,0.94);
  box-shadow: 0 8px 18px rgba(71,85,105,0.18);
  color: #253247;
}

[data-theme="light"] body .boundary-map .esri-search__input {
  background: rgba(255,255,255,0.58);
  color: #253247;
  color-scheme: light;
}

[data-theme="light"] body .boundary-map .esri-search__input::placeholder {
  color: rgba(71,85,105,0.68);
}

[data-theme="light"] body .boundary-map .esri-search__submit-button,
[data-theme="light"] body .boundary-map .esri-search__clear-button,
[data-theme="light"] body .boundary-map .esri-search__sources-button,
[data-theme="light"] body .boundary-map .esri-widget--button {
  border-color: rgba(148,163,184,0.38);
  background: rgba(226,234,244,0.94);
  color: #253247;
}

[data-theme="light"] body .boundary-map .esri-search__submit-button:hover,
[data-theme="light"] body .boundary-map .esri-search__clear-button:hover,
[data-theme="light"] body .boundary-map .esri-search__sources-button:hover,
[data-theme="light"] body .boundary-map .esri-widget--button:hover,
[data-theme="light"] body .boundary-map .esri-menu__list-item:hover,
[data-theme="light"] body .boundary-map .esri-menu__list-item:focus,
[data-theme="light"] body .boundary-map .esri-menu__list-item--focus {
  background: rgba(203,213,225,0.70);
  color: #111827;
}

[data-theme="light"] body .boundary-map .esri-widget--button:focus,
[data-theme="light"] body .boundary-map .esri-widget--button:focus-visible,
[data-theme="light"] body .boundary-map .esri-search__input:focus-visible {
  outline-color: rgba(71,85,105,0.34);
}

[data-theme="light"] body .boundary-map .esri-menu__list-item {
  color: #334155;
}

.boundary-map .esri-popup {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", sans-serif;
}

.boundary-map .esri-popup__main-container {
  max-width: min(340px, calc(100vw - 48px));
  border: 1px solid rgba(15,23,42,0.16);
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.97);
  box-shadow: 0 14px 30px rgba(15,23,42,0.24);
  color: #111827;
  overflow: hidden;
  backdrop-filter: blur(8px);
}

.boundary-map .esri-popup__header,
.boundary-map .esri-popup__content,
.boundary-map .esri-popup__footer {
  background: transparent;
  color: inherit;
}

.boundary-map .esri-popup__header-title {
  color: #111827;
  font-size: 0.82rem;
  font-weight: 850;
  letter-spacing: 0;
}

.boundary-map .esri-popup__button {
  color: rgba(17,24,39,0.68);
}

.boundary-map .esri-popup__button:hover {
  background: rgba(15,23,42,0.08);
  color: #111827;
}

.boundary-map .esri-popup__pointer-direction {
  background: rgba(255,255,255,0.97);
}

.map-point-popup {
  display: grid;
  gap: 6px;
  min-width: 220px;
}

.map-point-popup-image-link {
  display: block;
  overflow: hidden;
  margin-top: 6px;
  border: 1px solid rgba(15,23,42,0.12);
  border-radius: var(--radius-sm);
  background: rgba(15,23,42,0.04);
}

.map-point-popup-image {
  display: block;
  width: 100%;
  max-height: 180px;
  object-fit: cover;
}

.map-point-popup-row {
  display: grid;
  grid-template-columns: minmax(86px, 0.72fr) minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 6px 0;
  border-bottom: 1px solid rgba(15,23,42,0.10);
}

.map-point-popup-row:last-child {
  border-bottom: 0;
}

.map-point-popup-row span {
  min-width: 0;
  color: #4b5563;
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1.2;
}

.map-point-popup-row strong {
  min-width: 0;
  overflow-wrap: anywhere;
  color: #111827;
  font-size: 0.72rem;
  font-weight: 750;
  line-height: 1.25;
}

.map-point-popup-empty {
  color: #374151;
  font-size: 0.74rem;
  font-weight: 700;
}

.map-basemap-toggle {
  position: absolute;
  top: 60px;
  left: 12px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid rgba(255,255,255,0.24);
  border-radius: var(--radius-sm);
  background: rgba(10,22,44,0.86);
  box-shadow: 0 8px 18px rgba(0,0,0,0.25);
  color: rgba(255,255,255,0.78);
  backdrop-filter: blur(8px);
  cursor: pointer;
}

.map-basemap-toggle:focus-visible { outline: 2px solid var(--workspace-accent, #2463eb); outline-offset: 2px; }
.map-basemap-icon { grid-area: 1 / 1; }
.map-basemap-toggle[data-basemap-mode="community"] .map-basemap-icon--community,
.map-basemap-toggle[data-basemap-mode="imagery"] .map-basemap-icon--imagery { display: none; }

.map-fullscreen-button {
  position: absolute;
  top: auto;
  bottom: 12px;
  right: 12px;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid rgba(255,255,255,0.24);
  border-radius: var(--radius-sm);
  background: rgba(10,22,44,0.86);
  box-shadow: 0 8px 18px rgba(0,0,0,0.25);
  color: rgba(255,255,255,0.82);
  cursor: pointer;
  backdrop-filter: blur(8px);
}

.map-fullscreen-button:hover,
.map-fullscreen-button--active {
  background: rgba(255,255,255,0.16);
  color: #ffffff;
}

.map-fullscreen-button:focus-visible {
  outline: 2px solid rgba(255,255,255,0.34);
  outline-offset: 2px;
}

.map-fullscreen-icon--exit {
  display: none;
}

.map-fullscreen-button--active .map-fullscreen-icon--enter {
  display: none;
}

.map-fullscreen-button--active .map-fullscreen-icon--exit {
  display: block;
}

.boundary-map:fullscreen,
.boundary-map:-webkit-full-screen {
  width: 100vw;
  height: 100vh;
  min-height: 100vh;
  border-radius: 0;
}

.boundary-map:fullscreen .map-filter-panel,
.boundary-map:-webkit-full-screen .map-filter-panel {
  max-height: min(720px, calc(100% - 96px));
}

.boundary-map:fullscreen .boundary-map-view,
.boundary-map:-webkit-full-screen .boundary-map-view {
  min-height: 100vh;
}

.map-legend {
  position: absolute;
  bottom: 12px;
  left: 12px;
  z-index: 2;
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  max-width: calc(100% - 24px);
  padding: 8px 10px;
  border: 1px solid rgba(255,255,255,0.24);
  border-radius: var(--radius-sm);
  background: rgba(10,22,44,0.86);
  box-shadow: 0 8px 18px rgba(0,0,0,0.25);
  color: rgba(255,255,255,0.82);
  backdrop-filter: blur(8px);
}

.map-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1;
  white-space: nowrap;
}

.map-legend-marker {
  flex: 0 0 auto;
  display: inline-block;
}

.map-legend-marker--point {
  width: 10px;
  height: 10px;
  border: 1px solid #ffffff;
  border-radius: 999px;
}

.map-legend-marker--hanger {
  background: var(--tree-hanger);
}

.map-legend-marker--leaner {
  background: var(--tree-leaner);
}

[data-theme="dark"] .map-legend-marker--point {
  border-color: #000000;
}

.map-legend:empty { display: none; }

.map-filter-panel {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 2;
  display: flex;
  flex-direction: column;
  width: min(316px, calc(100% - 24px));
  max-height: calc(100% - 92px);
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.24);
  border-radius: var(--radius-sm);
  background: rgba(10,22,44,0.82);
  box-shadow: 0 8px 18px rgba(0,0,0,0.25);
  color: rgba(255,255,255,0.78);
  backdrop-filter: blur(8px);
}

.map-filter-toggle {
  appearance: none;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  height: 38px;
  flex: 0 0 38px;
  border: 0;
  padding: 0 10px;
  background: transparent;
  color: #ffffff;
  cursor: pointer;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.map-filter-toggle:hover {
  background: rgba(255,255,255,0.10);
}

.map-filter-toggle:focus-visible {
  outline: 2px solid rgba(255,255,255,0.36);
  outline-offset: -2px;
}

.map-filter-icon, .map-filter-close-icon {
  flex-shrink: 0;
}

.map-filter-title {
  flex: 1;
  text-align: left;
}

.map-filter-panel.map-filter-panel--collapsed {
  width: 40px;
  height: 40px;
}

.map-filter-panel--collapsed .map-filter-toggle {
  justify-content: center;
  padding: 0;
}

.map-filter-panel--collapsed .map-filter-title,
.map-filter-panel--collapsed .map-filter-close-icon {
  display: none;
}

.map-filter-body {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: repeat(2, minmax(116px, 1fr));
  gap: 6px;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 0 6px 6px;
}

.map-filter-body[hidden],
.map-filter-panel--collapsed .map-filter-body {
  display: none;
}

.map-filter-field {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.map-filter-field--disabled {
  opacity: 0.46;
}

.map-filter-action-field {
  align-self: end;
}

.map-filter-field--wide {
  grid-column: 1 / -1;
}

.map-filter-label {
  color: inherit;
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
}

.map-filter-select,
.map-filter-text-input {
  width: 100%;
  height: 30px;
  min-width: 0;
  border: 0;
  border-radius: 4px;
  padding: 0 24px 0 8px;
  background: rgba(255,255,255,0.14);
  color: #ffffff;
  color-scheme: dark;
  cursor: pointer;
  font: inherit;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0;
}

.map-filter-text-input::placeholder {
  color: rgba(255,255,255,0.62);
}

.map-filter-text-input {
  cursor: text;
}

.map-filter-select:disabled {
  cursor: not-allowed;
}

.map-filter-select:focus,
.map-filter-text-input:focus {
  outline: 2px solid rgba(255,255,255,0.36);
  outline-offset: 1px;
}

.map-date-input {
  width: 100%;
  min-width: 116px;
  height: 30px;
  border: 0;
  border-radius: 4px;
  padding: 0 7px;
  background: rgba(255,255,255,0.14);
  color: #ffffff;
  color-scheme: dark;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0;
}

.map-filter-field .map-date-input {
  min-width: 0;
}

.map-date-input:focus {
  outline: 2px solid rgba(255,255,255,0.36);
  outline-offset: 1px;
}

.map-date-clear {
  appearance: none;
  width: 100%;
  height: 30px;
  border: 0;
  border-radius: 4px;
  padding: 0 8px;
  background: rgba(255,255,255,0.14);
  color: #ffffff;
  cursor: pointer;
  font: inherit;
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0;
}

.map-date-clear:hover {
  color: #ffffff;
  background: rgba(255,255,255,0.20);
}

[data-theme="light"] body .map-basemap-toggle,
[data-theme="light"] body .map-fullscreen-button,
[data-theme="light"] body .map-legend,
[data-theme="light"] body .map-filter-panel {
  border-color: rgba(148,163,184,0.42);
  background: rgba(226,234,244,0.94);
  box-shadow: 0 8px 18px rgba(71,85,105,0.18);
  color: #253247;
}

[data-theme="light"] body .map-filter-toggle {
  color: #253247;
}

[data-theme="light"] body .map-basemap-toggle:hover,
[data-theme="light"] body .map-filter-toggle:hover,
[data-theme="light"] body .map-fullscreen-button:hover,
[data-theme="light"] body .map-fullscreen-button--active,
[data-theme="light"] body .map-date-clear:hover {
  background: rgba(203,213,225,0.70);
  color: #111827;
}

[data-theme="light"] body .map-filter-select,
[data-theme="light"] body .map-filter-text-input,
[data-theme="light"] body .map-date-input,
[data-theme="light"] body .map-date-clear {
  background: rgba(255,255,255,0.58);
  color: #253247;
  color-scheme: light;
}

[data-theme="light"] body .map-filter-text-input::placeholder {
  color: rgba(71,85,105,0.68);
}

[data-theme="light"] body .map-fullscreen-button:focus-visible,
[data-theme="light"] body .map-filter-toggle:focus-visible,
[data-theme="light"] body .map-filter-select:focus,
[data-theme="light"] body .map-filter-text-input:focus,
[data-theme="light"] body .map-date-input:focus {
  outline-color: rgba(71,85,105,0.34);
}

.map-date-details {
  flex: 0 0 0;
  width: 0;
  min-width: 0;
  overflow: hidden;
  border-left: 1px solid rgba(255,255,255,0.14);
  background: linear-gradient(180deg, rgba(13,31,58,0.96), rgba(9,22,43,0.98));
  color: var(--kpi-text);
  opacity: 0;
  pointer-events: none;
  transform: translateX(18px);
  transition:
    flex-basis 340ms ease,
    width 340ms ease,
    opacity 220ms ease,
    transform 340ms ease;
}

.boundary-map--details-open .map-date-details {
  flex-basis: var(--map-date-panel-w);
  width: var(--map-date-panel-w);
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0);
}

.map-date-details-inner {
  width: var(--map-date-panel-w);
  max-width: var(--map-date-panel-w);
  height: 100%;
  overflow: auto;
  padding: 16px;
}

.map-date-details-header {
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.12);
}

.map-date-details-eyebrow,
.map-date-details-section h4,
.map-date-details-breakdown p {
  margin: 0;
  color: var(--kpi-text-sec);
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1.1;
  text-transform: uppercase;
}

.map-date-details-header h3 {
  margin: 5px 0 0;
  color: var(--kpi-text);
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1.05;
}

.map-date-details-section {
  padding: 14px 0;
  border-bottom: 1px solid rgba(255,255,255,0.10);
}

.map-date-details-section:last-child {
  border-bottom: 0;
}

.map-date-details-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.map-date-details-metric {
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.06);
}

.map-date-details-metric span {
  display: block;
  overflow: hidden;
  color: var(--kpi-text-sec);
  font-size: 0.58rem;
  font-weight: 800;
  line-height: 1.1;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.map-date-details-metric strong {
  display: flex;
  align-items: baseline;
  gap: 4px;
  min-width: 0;
  margin-top: 4px;
  color: var(--kpi-text);
  font-size: 1.14rem;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1;
  white-space: nowrap;
}

.map-date-details-metric small {
  color: var(--kpi-text-sec);
  font-size: 0.56rem;
  font-weight: 800;
  letter-spacing: 0;
}

.map-date-details-breakdown {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-top: 12px;
}

.map-date-details-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
  color: var(--kpi-text-sec);
  font-size: 0.72rem;
  font-weight: 700;
}

.map-date-details-row span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.map-date-details-row strong {
  flex-shrink: 0;
  color: var(--kpi-text);
  font-weight: 800;
  white-space: nowrap;
}

.map-date-details-empty {
  margin-top: 10px;
  padding: 12px;
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.06);
  color: var(--kpi-text-sec);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.35;
}

.map-point-details-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.map-point-details-close {
  appearance: none;
  flex: 0 0 auto;
  min-width: 0;
  height: 28px;
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: var(--radius-sm);
  padding: 0 9px;
  background: rgba(255,255,255,0.08);
  color: var(--kpi-text);
  cursor: pointer;
  font: inherit;
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0;
}

.map-point-details-close:hover {
  background: rgba(255,255,255,0.16);
}

.map-point-details-rows {
  display: grid;
  gap: 0;
  margin-top: -4px;
}

.map-point-details-row {
  display: grid;
  grid-template-columns: minmax(96px, 0.68fr) minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255,255,255,0.10);
}

.map-point-details-row:last-child {
  border-bottom: 0;
}

.map-point-details-row span {
  min-width: 0;
  overflow: hidden;
  color: var(--kpi-text-sec);
  font-size: 0.6rem;
  font-weight: 800;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.map-point-details-row strong {
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--kpi-text);
  font-size: 0.72rem;
  font-weight: 750;
  line-height: 1.3;
}

.map-point-details-image {
  margin-top: 12px;
}

.map-point-details .map-point-popup-image-link {
  margin-top: 0;
  border-color: rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.06);
}

.map-point-details .map-point-popup-image {
  max-height: 240px;
}

.map-empty {
  min-height: 360px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 24px;
  text-align: center;
}

.map-empty-title {
  margin: 0;
  color: var(--kpi-text);
  font-size: 0.86rem;
  font-weight: 800;
}

.map-empty-copy {
  max-width: 520px;
  margin: 0;
  color: var(--kpi-text-sec);
  font-size: 0.74rem;
  line-height: 1.45;
}

@media (min-width: 1001px) and (min-height: 760px) {
  html:has(body.row-dashboard-page),
  body.row-dashboard-page {
    height: 100%;
    overflow: hidden;
  }

  body.row-dashboard-page > .row-dashboard-content {
    height: 100vh;
    overflow: hidden;
  }

  body.row-dashboard-page .app-layout {
    height: 100vh;
    min-height: 0;
    overflow: hidden;
  }

  body.row-dashboard-page .main {
    min-height: 0;
    overflow: hidden;
  }

  body.row-dashboard-page .topbar {
    flex: 0 0 58px;
  }

  body.row-dashboard-page .app-layout .row-dashboard-content {
    height: calc(100vh - 58px);
    overflow: hidden;
  }

  .row-dashboard-content {
    padding: 16px 20px;
    gap: 14px;
  }

  .row-dashboard-content .metric-section {
    flex: 0 0 auto;
  }

  .row-dashboard-content .mid-row {
    flex: 3 1 0;
    min-height: 0;
  }

  .row-dashboard-content .chart-panel {
    min-height: 0;
  }

  .row-dashboard-content .map-cost-row {
    flex: 2 1 0;
    min-height: 0;
  }

  .row-dashboard-content .map-panel,
  .row-dashboard-content .cost-panel {
    min-height: 0;
  }

  .row-dashboard-content .boundary-map {
    flex: 1 1 0;
    min-height: 0;
    height: auto;
  }
}

.chart-tooltip {
  position: absolute;
  top: 10px;
  min-width: 132px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.16);
  background: rgba(10,22,44,0.94);
  box-shadow: 0 12px 28px rgba(0,0,0,0.28);
  color: #ffffff;
  pointer-events: none;
  z-index: 2;
}

.chart-tooltip-date {
  margin: 0 0 3px;
  font-size: 0.7rem;
  font-weight: 600;
  color: rgba(255,255,255,0.72);
}

.chart-tooltip-total {
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #ffffff;
}

.chart-tooltip-breakdown {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: 8px;
}

.chart-tooltip-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.72rem;
  font-weight: 600;
  color: rgba(255,255,255,0.88);
}

.chart-tooltip-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  display: inline-block;
}

.chart-tooltip-dot--hanger {
  background: var(--tree-hanger);
}

.chart-tooltip-dot--leaner {
  background: var(--tree-leaner);
}

/* Info panel */
.info-panel {
  background: linear-gradient(145deg, var(--kpi-bg-from) 0%, var(--kpi-bg-to) 100%);
  border: 1px solid var(--kpi-border);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow-kpi);
  display: flex;
  flex-direction: column;
  color: var(--kpi-text);
}
.info-panel-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--kpi-text);
  margin: 0 0 10px;
}
.info-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 0;
  border-bottom: 1px solid var(--kpi-divider);
}
.info-row:last-child { border-bottom: none; }
.info-key {
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--kpi-text-sec);
  flex-shrink: 0;
}
.info-val {
  font-size: 0.74rem;
  color: var(--kpi-text);
  text-align: right;
  overflow-wrap: anywhere;
  font-family: var(--font-mono);
}
.info-val--accent { color: rgba(255,255,255,0.9); font-weight: 600; }

/* ─── Bottom Row ─────────────────────────────────────────────────────────── */
.bottom-row {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 12px;
}

.tickets-panel {
  background: linear-gradient(145deg, var(--kpi-bg-from) 0%, var(--kpi-bg-to) 100%);
  border: 1px solid var(--kpi-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-kpi);
  overflow: hidden;
  color: var(--kpi-text);
}
.tickets-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px 10px;
  border-bottom: 1px solid var(--kpi-divider);
}
.tickets-panel-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--kpi-text);
  margin: 0;
}
.tickets-panel-body {
  padding: 10px 18px 14px;
  color: var(--kpi-text-sec);
  font-size: 0.78rem;
}

.ticket-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--kpi-divider);
}

.ticket-row:last-child {
  border-bottom: none;
}

.ticket-row strong {
  color: var(--kpi-text);
  font-weight: 700;
}

/* Status panel */
.status-panel {
  background: linear-gradient(145deg, var(--kpi-bg-from) 0%, var(--kpi-bg-to) 100%);
  border: 1px solid var(--kpi-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-kpi);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  color: var(--kpi-text);
}
.status-panel-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--kpi-text);
  margin: 0;
}
.status-indicator {
  display: flex;
  align-items: center;
  gap: 9px;
}
.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}
.status-dot--live    { background: #4ade80; box-shadow: 0 0 0 3px rgba(74,222,128,0.25); }
.status-dot--loading { background: #fbbf24; box-shadow: 0 0 0 3px rgba(251,191,36,0.25); animation: pulse 1.2s ease-in-out infinite; }
.status-dot--error   { background: #f87171; box-shadow: 0 0 0 3px rgba(248,113,113,0.25); }
.status-dot--idle    { background: rgba(255,255,255,0.25); }
.status-text  { font-size: 0.82rem; font-weight: 600; color: var(--kpi-text); }
.status-meta  { font-size: 0.74rem; color: var(--kpi-text-sec); margin: 0; line-height: 1.5; }
.status-source {
  font-size: 0.71rem;
  color: var(--kpi-text-sec);
  font-family: var(--font-mono);
  overflow-wrap: anywhere;
  margin: 0;
  line-height: 1.5;
}

.test-layout-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
  gap: 12px;
}

.test-layout-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.test-layout-copy {
  margin: 0;
  max-width: 42rem;
  color: var(--kpi-text-sec);
  font-size: 0.8rem;
  line-height: 1.65;
}

.test-layout-image-shell {
  overflow: hidden;
  border: 1px solid var(--kpi-divider);
  border-radius: var(--radius-lg);
  background: rgba(255,255,255,0.04);
}

.test-layout-image {
  display: block;
  width: 100%;
  max-height: 280px;
  object-fit: cover;
}

.test-layout-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.test-layout-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding-left: 18px;
  color: var(--kpi-text-sec);
  font-size: 0.78rem;
  line-height: 1.65;
}

.test-layout-list code {
  color: var(--kpi-text);
}

.test-layout-banner {
  padding: 16px 18px;
  border: 1px solid var(--kpi-divider);
  border-radius: var(--radius);
  background: rgba(255,255,255,0.05);
}

.test-layout-banner strong {
  display: block;
  margin-bottom: 5px;
  color: var(--kpi-text);
  font-size: 0.82rem;
}

.test-layout-banner p {
  margin: 0;
  color: var(--kpi-text-sec);
  font-size: 0.78rem;
  line-height: 1.65;
}

.page-content--viewer {
  padding: 0;
  gap: 0;
  min-height: calc(100vh - 58px);
}

.page-content--embedded-viewer {
  min-height: 100vh;
  height: 100vh;
}

.viewer-layout-shell {
  flex: 1;
  min-height: calc(100vh - 58px);
  overflow: hidden;
  background: transparent;
}

.page-content--embedded-viewer .viewer-layout-shell {
  min-height: 100%;
  height: 100%;
}

.viewer-layout-frame {
  display: block;
  width: 100%;
  min-height: calc(100vh - 58px);
  height: calc(100vh - 58px);
  border: 0;
  background: #081120;
}

.page-content--embedded-viewer .viewer-layout-frame {
  min-height: 100%;
  height: 100%;
}

/* ─── Animations ─────────────────────────────────────────────────────────── */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}

/* ─── Responsive ─────────────────────────────────────────────────────────── */

/* ─── Responsive ─────────────────────────────────────────────────────────── */

/* 1000px: layout collapses to single column, kpi-row → 4 cols */
@media (max-width: 1000px) {
  html, body { overflow: auto; }
  .mid-row { grid-template-columns: 1fr; }
  .map-cost-row { grid-template-columns: 1fr; }
  .chart-panel { min-height: 340px; }
  .cost-panel { min-height: 300px; }
  .chart-body {
    flex: 0 0 260px;
    min-height: 260px;
  }
  .test-layout-grid { grid-template-columns: 1fr; }
  .test-layout-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-row { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .kpi-card-value,
  .kpi-card-segment-value { --kpi-value-fit-size: 2.05rem; }
  .kpi-card-label { --kpi-label-fit-size: 0.78rem; }
}

/* 720px: kpi-row → 2 cols */
@media (max-width: 720px) {
  .page-content { padding: 14px 14px 24px; gap: 12px; }
  .kpi-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chart-panel { min-height: 320px; }
  .cost-panel { min-height: 280px; }
  .chart-body {
    flex-basis: 240px;
    min-height: 240px;
  }
  .kpi-card-value,
  .kpi-card-segment-value { --kpi-value-fit-size: 2.15rem; }
  .kpi-card-label { --kpi-label-fit-size: 0.8rem; }
  .topbar { padding: 0 14px; }
  .topbar-client-logo { max-width: 110px; max-height: 30px; }
  .topbar-title { font-size: 1.05rem; }
  .topbar-logo-img--debristech { max-width: 128px; height: 28px; }
  .test-layout-cards { grid-template-columns: 1fr; }
  .page-content--viewer { min-height: calc(100vh - 58px); }
  .viewer-layout-shell { min-height: calc(100vh - 58px); }
  .viewer-layout-frame {
    min-height: calc(100vh - 58px);
    height: calc(100vh - 58px);
  }
  .map-filter-panel {
    top: 12px;
    left: 12px;
    width: min(300px, calc(100% - 20px));
  }
  .map-filter-body {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-height: 236px;
  }
  .map-fullscreen-button {
    top: auto;
    bottom: 10px;
    right: 10px;
  }
  .boundary-map {
    flex-direction: column;
    min-height: 620px;
  }
  .boundary-map-view {
    min-height: 360px;
  }
  .map-date-details {
    flex: 0 0 0;
    width: 100%;
    border-top: 1px solid rgba(255,255,255,0.14);
    border-left: 0;
    transform: translateY(18px);
  }
  .boundary-map--details-open .map-date-details {
    flex-basis: 260px;
    width: 100%;
    transform: translateY(0);
  }
  .map-date-details-inner {
    width: 100%;
    max-width: none;
  }
}

@media (max-width: 560px) {



}

/* 460px: kpi-row → 1 col */
@media (max-width: 460px) {
  .kpi-row { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .topbar { gap: 10px; }
  .topbar-client-logo { max-width: 82px; }
  .topbar-logo-img--debristech { max-width: 104px; height: 24px; }
  .topbar-chip { display: none; }
  .map-date-input { min-width: 106px; }
  .map-filter-body { max-height: 360px; }
}

/* Shared operations charts and Combined project rankings. */
.combined-dashboard { width: 100%; }
.combined-dashboard .mid-row > .chart-panel { min-width: 0; }
.operations-dashboard .kpi-card-label { --kpi-label-fit-size: .78rem; }
.operations-dashboard .kpi-card-unit { text-align: center; }
.dashboard-chart { flex: 1 0 auto; min-height: 0; display: flex; flex-direction: column; }
.dashboard-plot { position: relative; width: 100%; height: clamp(280px, 32vh, 400px); flex: 0 0 auto; }
.dashboard-plot svg { display: block; width: 100%; height: 100%; }
.dashboard-chart svg text { fill: var(--kpi-text-sec); font: 11px system-ui, sans-serif; }
.combined-coverage { color: var(--kpi-text-sec); font-size: .66rem; flex-shrink: 0; }
.combined-rankings, .combined-projects { flex: 1; min-height: 0; overflow: auto; scrollbar-width: thin; scrollbar-color: var(--kpi-divider) transparent; }
.combined-rankings { display: flex; flex-direction: column; justify-content: space-evenly; gap: 4px; }
.combined-rank { display: grid; grid-template-columns: minmax(70px, 1fr) minmax(50px, 4fr) 95px; gap: 14px; align-items: center; font-size: .72rem; min-height: 20px; flex: 0 0 20px; }
.combined-rank > span { overflow-wrap: anywhere; color: var(--kpi-text-sec); }
.combined-rank strong { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.combined-bar-track { height: 14px; background: var(--kpi-icon-bg); border-radius: 7px; overflow: hidden; }
.combined-bar { height: 100%; border-radius: 7px; background: linear-gradient(90deg, #f5a62355, var(--brand-orange)); }
.combined-project { padding: 5px 0; border-bottom: 1px solid var(--kpi-divider); }
.combined-project:first-child { padding-top: 0; }
.combined-project:last-child { border-bottom: 0; }
.combined-project > div { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: .74rem; }
.combined-project strong { font-variant-numeric: tabular-nums; }
.combined-project a { color: var(--kpi-text); text-decoration: none; }
.combined-project a:hover { text-decoration: underline; }
@media (min-width: 1001px) and (min-height: 760px) {
  .combined-dashboard .mid-row { flex: 0 0 auto; }
  .combined-dashboard .combined-bottom { flex: 1 0 270px; }
}
@media (max-width: 1000px), (max-height: 759px) {
  .dashboard-plot { height: 300px; }
  .combined-rankings { min-height: 260px; }
  .combined-bottom { min-height: 0; }
}
@media (max-width: 460px) {
  .combined-rank { grid-template-columns: 55px minmax(30px, 1fr) 86px; gap: 8px; }
  .combined-dashboard .chart-panel-header { flex-wrap: wrap; }
}

.dashboard-day-hit { fill: transparent; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.dashboard-day-hit:hover, .dashboard-day-hit:focus { fill: rgba(255,255,255,.06); outline: none; }
.dashboard-day-hit:focus-visible { stroke: var(--kpi-text-sec); stroke-width: 1; }
.dashboard-chart-tooltip { position: absolute; z-index: 2; top: 10px; width: 240px; max-width: calc(100% - 16px); padding: 12px; border: 1px solid rgba(255,255,255,.22); border-radius: 8px; background: #102847; color: #fff; box-shadow: 0 6px 20px #0004; font-size: 12px; pointer-events: none; }
.dashboard-chart-tooltip[hidden] { display: none; }
.dashboard-chart-tooltip > strong { display: block; margin-bottom: 10px; }
.dashboard-chart-tooltip > div { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-top: 7px; }
.dashboard-chart-tooltip span { overflow-wrap: anywhere; }
.dashboard-chart-tooltip b { white-space: nowrap; font-variant-numeric: tabular-nums; font-weight: 600; }
.dashboard-chart-tooltip i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.dashboard-tooltip-total { border-top: 1px solid rgba(255,255,255,.18); padding-top: 8px; }

/* Search is anchored to the map surface, independent of ArcGIS UI offsets. */
.map-search-control { position: absolute; top: 12px; right: 12px; width: 40px; height: 40px; max-width: calc(100% - 24px); z-index: 5; }
.map-search-toggle { display: grid; place-items: center; width: 40px; height: 40px; padding: 0; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); box-shadow: 0 3px 12px #0002; cursor: pointer; }
.map-search-toggle:hover { background: var(--surface-alt); }
.map-search-toggle:focus-visible { outline: 2px solid var(--workspace-accent, #2463eb); outline-offset: 2px; }
.map-search-panel { position: absolute; top: 0; right: 0; display: flex; align-items: center; width: 320px; max-width: calc(100cqw - 24px); height: 40px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); box-shadow: 0 3px 12px #0002; }
.map-search-panel:focus-within { border-color: var(--workspace-accent, #2463eb); box-shadow: 0 0 0 2px color-mix(in srgb, var(--workspace-accent, #2463eb) 18%, transparent), 0 3px 12px #0002; }
.map-search-panel[hidden], .map-search-toggle[hidden] { display: none; }
.map-search-close { display: grid; place-items: center; flex: 0 0 34px; height: 28px; padding: 0; margin-right: 3px; border: 0; border-left: 1px solid var(--border); border-radius: 0 5px 5px 0; background: transparent; color: var(--text-sec); cursor: pointer; }
.map-search-close:hover { background: var(--surface-alt); color: var(--text); }
.map-search-close:focus-visible { outline: 2px solid var(--workspace-accent, #2463eb); outline-offset: -2px; }
/* The shell owns the border and input focus ring, not the nested SDK controls. */
:root body .boundary-map .map-search-control .esri-search { flex: 1; min-width: 0; width: auto; max-width: none; border: 0; border-radius: 8px 0 0 8px; background: transparent; box-shadow: none; backdrop-filter: none; color: inherit; overflow: visible; }
:root body .boundary-map .map-search-control :is(.esri-search__container, .esri-search__input-container, .esri-search__form) { min-width: 0; height: 38px; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
:root body .boundary-map .map-search-control .esri-search__input { width: 100%; min-width: 0; height: 38px; margin: 0; padding: 0 12px; border: 0; border-radius: 8px 0 0 8px; background: transparent; color: var(--text); font: 400 13px/normal var(--workspace-font, sans-serif); letter-spacing: normal; box-shadow: none; }
:root body .boundary-map .map-search-control .esri-search__input:focus,
:root body .boundary-map .map-search-control .esri-search__input:focus-visible { outline: none; box-shadow: none; }
:root body .boundary-map .map-search-control .esri-search__input::placeholder { color: var(--text-sec); opacity: 1; }
:root body .boundary-map .map-search-control .esri-widget--button { flex-shrink: 0; width: 34px; height: 38px; padding: 0; border: 0; border-radius: 5px; background: transparent; box-shadow: none; color: var(--text-sec); }
:root body .boundary-map .map-search-control .esri-widget--button:hover { background: var(--surface-alt); color: var(--text); }
:root body .boundary-map .map-search-control .esri-widget--button:focus { outline: none; }
:root body .boundary-map .map-search-control .esri-widget--button:focus-visible { outline: 2px solid var(--workspace-accent, #2463eb); outline-offset: -3px; }
/* Keep one close icon; the query remains editable and survives collapsing. */
:root body .boundary-map .map-search-control .esri-search__clear-button { display: none; }
:root body .boundary-map .map-search-control .esri-search__suggestions-menu { width: calc(100% + 37px); max-height: var(--map-search-results-height, 300px); margin-top: 6px; overflow-y: auto; }
.boundary-map-view { container-type: inline-size; }
@container (max-width: 680px) {
  .map-search-open .map-filter-panel { top: 60px; }
  .map-search-open .map-basemap-toggle { top: 108px; }
  .boundary-map .map-search-open .map-filter-body { max-height: calc(var(--map-surface-height, 360px) - 72px); }
}
/* Reserve the right-hand control column on compact maps. */
.boundary-map .map-filter-panel { max-width: calc(100% - 76px); }
.boundary-map .map-legend { max-width: calc(100% - 76px); }

/* Keep the two map buttons in a fixed column; filters open alongside them. */
:root body .boundary-map .map-filter-panel { z-index: 4; width: 40px; height: 40px; max-height: none; overflow: visible; border: 0; background: transparent; box-shadow: none; backdrop-filter: none; }
:root body .boundary-map .map-filter-toggle { justify-content: center; width: 40px; height: 40px; flex-basis: 40px; padding: 0; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); box-shadow: var(--shadow); }
.map-filter-title { display: none; }
.map-filter-panel:not(.map-filter-panel--collapsed) .map-filter-icon { display: none; }
.boundary-map .map-filter-body { position: absolute; top: 0; left: 48px; width: min(316px, calc(100cqw - 72px)); max-height: calc(var(--map-surface-height, 360px) - 24px); padding: 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.map-filter-heading { grid-column: 1 / -1; margin-bottom: 4px; font-size: 13px; font-weight: 600; }
@container (max-width: 430px) {
  .boundary-map .map-filter-body { width: calc(100cqw - 120px); grid-template-columns: 1fr; }
}

/* One range applies to all daily activity charts. */
.chart-range-control { --range-highlight: #fff; --range-shadow: 0 1px 3px #18202b20; position: relative; isolation: isolate; display: inline-grid; grid-template-columns: repeat(3, 1fr); align-items: center; gap: 3px; padding: 3px; border: 1px solid #dfe3e9; border-radius: 10px; background: #f1f3f6; flex-shrink: 0; }
.chart-range-control::before { content: ""; position: absolute; z-index: 0; left: 3px; top: 3px; bottom: 3px; width: calc((100% - 12px) / 3); border-radius: 7px; background: var(--range-highlight); box-shadow: var(--range-shadow); pointer-events: none; transform: translateX(calc(var(--range-index, 0) * (100% + 3px))); transition: transform 300ms cubic-bezier(.22, 1, .36, 1); }
.chart-range-control[hidden] { display: none; }
.chart-range-control--custom::before { opacity: 0; }
.metric-section > .chart-range-control { margin-top: 10px; float: right; }
.row-data-status { margin: 0; color: var(--text-sec); font-size: 12px; line-height: 1.4; }
.chart-range-control button { position: relative; z-index: 1; transition: color 180ms ease, background-color 180ms ease; border: 0; border-radius: 7px; background: transparent; padding: 6px 12px; color: #606873; font: 600 13px/1.4 Inter, system-ui, sans-serif; white-space: nowrap; cursor: pointer; }
.chart-range-control button[aria-pressed="false"]:hover { background: #e5e9ef; color: #202833; }
.chart-range-control button[aria-pressed="true"] { background: transparent; color: #18202b; }
.chart-range-control button:focus-visible { outline: 2px solid var(--brand-orange); outline-offset: 1px; }
#fleet-chart, .project-fleet-body { overflow-x: auto; }
.combined-dashboard #debris-chart, .combined-dashboard #tree-chart { overflow-x: auto; }
.operations-dashboard #chart-body, .operations-dashboard #chart-body-debris { overflow-x: auto; }
.project-fleet-table th, .project-fleet-table td { min-width: 44px; }
[data-theme="dark"] .chart-range-control { --range-highlight: #3a4d67; background: #17253a; border-color: #35445a; }
[data-theme="dark"] .chart-range-control button { color: #b6c3d4; }
[data-theme="dark"] .chart-range-control button[aria-pressed="false"]:hover { background: #28394f; color: #fff; }
[data-theme="dark"] .chart-range-control button[aria-pressed="true"] { background: transparent; color: #fff; }

@media (prefers-reduced-motion: reduce) {
  .chart-range-control::before, .chart-range-control button { transition: none; }
}
