:root {
  --header-h: 68px;
  --edge-gap: 24px;
  --sidebar-w: 304px;
  --right-panel-w: 202px;

  --navy: #0b385a;
  --blue: #0e558f;
  --blue-hover: #0a4778;
  --blue-deep: #0b4b80;
  --surface: #ffffff;
  --surface-soft: #f7f9fc;
  --border: #cbd5e1;
  --border-soft: #e2e8f0;
  --ink: #101828;
  --text: #344054;
  --muted: #667085;
  --muted-2: #98a2b3;
  --map-dark: #243c33;

  --river-1: #00eeff;
  --river-2: #44c8bb;
  --river-3: #ffef00;
  --river-4: #ff2de9;
  --river-other: #94a3b8;
  --subdas: #f59e0b;
  --subdas-fill: #a855f7;
  --selected: #f2c94c;
  --danger: #b42318;

  --radius-sm: 6px;
  --radius-md: 9px;
  --radius-lg: 12px;
  --panel-shadow: 0 4px 14px rgba(15, 23, 42, 0.08);

  font-family: "Geist";
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; }
body {
  color: var(--text);
  background: var(--map-dark);
  font-family: "Geist";
  font-size: 14px;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
}
button, input, select, textarea { font-family: "Geist"; font-size: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid rgba(14, 85, 143, .28);
  outline-offset: 1px;
}

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

.app-shell { position: relative; width: 100vw; height: 100vh; background: var(--map-dark); }

.app-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 1600;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px 0 14px;
  background: var(--navy);
  color: #fff;
}
.brand-block { min-width: 0; display: flex; align-items: center; gap: 11px; }
.brand-logo { width: 38px; height: 38px; object-fit: contain; flex: 0 0 auto; }
.brand-copy { min-width: 0; line-height: 1.08; }
.brand-copy h1 {
  margin: 0;
  color: #fff;
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -0.025em;
  white-space: nowrap;
}
.brand-copy p {
  margin: 4px 0 0;
  color: #dbe7ef;
  font-size: 12.5px;
  font-weight: 400;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.header-actions { display: flex; align-items: center; gap: 8px; }
.header-button {
  height: 38px;
  padding: 0 13px;
  border: 1px solid #d5dde6;
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font-weight: 600;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
}
.header-button:hover { background: #f8fafc; border-color: #aebdcc; }
.header-button-zoom { display: inline-flex; align-items: center; gap: 6px; }
.header-button-zoom svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.map-stage {
  --active-sidebar-w: var(--sidebar-w);
  position: fixed;
  z-index: 1;
  left: 0;
  right: 0;
  top: var(--header-h);
  bottom: 0;
  overflow: hidden;
  background: var(--map-dark);
}
#map { position: absolute; inset: 0; width: 100%; height: 100%; background: var(--map-dark); }
.leaflet-container { font-family: "Geist"; font-size: 14px; background: var(--map-dark); }
.leaflet-control-attribution { display: none !important; }

.map-loading {
  position: absolute;
  z-index: 800;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  color: rgba(255,255,255,.96);
  font-size: 29px;
  font-weight: 700;
  letter-spacing: -.025em;
  pointer-events: none;
}
.map-loading.is-hidden { display: none; }

.left-sidebar {
  position: absolute;
  z-index: 1200;
  left: var(--edge-gap);
  top: 16px;
  bottom: 18px;
  width: var(--active-sidebar-w);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #fff;
  border: 1px solid #d8e0e8;
  border-radius: var(--radius-lg);
  box-shadow: var(--panel-shadow);
}
.sidebar-tabs {
  height: 46px;
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: #fff;
  border-bottom: 1px solid var(--border-soft);
}
.sidebar-tab {
  position: relative;
  border: 0;
  border-right: 1px solid var(--border-soft);
  background: #fff;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}
.sidebar-tab:last-child { border-right: 0; }
.sidebar-tab.is-active { color: var(--blue); font-weight: 600; }
.sidebar-tab.is-active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: var(--blue);
}
.tab-icon {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sidebar-content { flex: 1 1 auto; min-height: 0; display: none; flex-direction: column; background: #fff; }
.sidebar-content.is-active { display: flex; }
.filter-scroll, .data-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px 15px 18px;
  background: #fff;
  scrollbar-width: thin;
  scrollbar-color: #c9d3de transparent;
}
.filter-scroll::-webkit-scrollbar, .data-scroll::-webkit-scrollbar { width: 5px; }
.filter-scroll::-webkit-scrollbar-thumb, .data-scroll::-webkit-scrollbar-thumb { background: #c9d3de; border-radius: 999px; }

.search-input {
  width: 100%;
  height: 40px;
  border: 1px solid #c9d5e2;
  border-radius: 6px;
  background: #fff;
  padding: 0 12px;
  color: var(--text);
  font-size: 13.5px;
  font-weight: 400;
}
.search-input::placeholder { color: #9aa8bc; }

.filter-section { margin-top: 17px; }
.filter-section h2, .result-heading h2, .data-section h2 {
  margin: 0;
  color: var(--blue-deep);
  font-size: 13.5px;
  line-height: 1.25;
  font-weight: 700;
  letter-spacing: 0;
}
.order-section { margin-top: 17px; }
.order-chips {
  margin-top: 10px;
  display: grid;
  grid-template-columns: 1.35fr repeat(4, .72fr);
  gap: 7px;
}
.order-chip {
  height: 34px;
  min-width: 0;
  border: 1px solid #c9d5e2;
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font-size: 13px;
  font-weight: 400;
  cursor: pointer;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.order-chip:hover { border-color: #a8b9ca; background: #fbfdff; }
.order-chip.is-active {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
  font-weight: 500;
}

.field-stack { margin-top: 15px; display: grid; gap: 7px; }
.field-stack label { color: #475467; font-size: 12.5px; font-weight: 400; }
.field-stack select {
  width: 100%;
  height: 38px;
  border: 1px solid #c9d5e2;
  border-radius: 6px;
  background: #fff;
  color: #667085;
  padding: 0 32px 0 11px;
  font-size: 13.5px;
  font-weight: 400;
}
.field-stack select:disabled { background: #f7f9fb; color: #b1bdca; cursor: not-allowed; }
.section-divider { height: 1px; background: var(--border-soft); margin: 18px 0 0; }
.hierarchy-section { margin-top: 15px; }

.result-section { margin-top: 15px; }
.result-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.result-heading h2 { color: #64748b; font-size: 13.5px; font-weight: 600; }
.result-count { color: #64748b; font-size: 13.5px; font-weight: 400; font-variant-numeric: tabular-nums; }
.search-results { display: grid; gap: 9px; }
.result-card {
  width: 100%;
  min-height: 68px;
  border: 1px solid #d8e1ea;
  border-radius: 8px;
  background: #fff;
  padding: 11px 12px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  column-gap: 12px;
  row-gap: 5px;
  align-items: center;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .025);
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.result-card:hover {
  border-color: #b8c7d8;
  box-shadow: 0 4px 12px rgba(15, 23, 42, .07);
  transform: translateY(-1px);
}
.result-title {
  grid-column: 1;
  grid-row: 1;
  min-width: 0;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.25;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.result-meta {
  grid-column: 1;
  grid-row: 2;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 7px;
  color: #718096;
  font-size: 13px;
  line-height: 1.35;
  font-weight: 400;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.result-meta > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.result-meta-dot { flex: 0 0 auto; color: #7d8ca0; overflow: visible !important; }
.result-badge {
  grid-row: 1 / span 2;
  grid-column: 2;
  align-self: center;
  min-width: 64px;
  height: 30px;
  display: grid;
  place-items: center;
  padding: 0 9px;
  border-radius: 7px;
  font-size: 12.5px;
  line-height: 1;
  font-weight: 600;
  white-space: nowrap;
}
.result-badge.order-1 { color: #fff; background: linear-gradient(135deg, #ff8700, #ff9500); }
.result-badge.order-2 { color: #fff; background: linear-gradient(135deg, #f59e0b, #ffba22); }
.result-badge.order-3 { color: #72510b; background: linear-gradient(135deg, #ffd783, #ffc761); }
.result-badge.order-4 { color: #72510b; background: linear-gradient(135deg, #ffe7b7, #ffd88e); }
.result-badge.order-other { color: #475569; background: #e9eef4; }
.search-results .empty-state { margin: 7px 0; color: var(--muted); font-size: 13px; line-height: 1.45; }
.result-limit-note { padding: 2px 1px 7px; }
.empty-state { margin: 7px 0; color: var(--muted); line-height: 1.45; }

.sidebar-actions {
  min-height: 58px;
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: 1fr 1.18fr;
  gap: 9px;
  align-items: center;
  padding: 9px 15px;
  background: #fff;
  border-top: 1px solid var(--border-soft);
}
.button {
  height: 38px;
  border-radius: 6px;
  padding: 0 12px;
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 600;
}
.button-primary {
  border: 1px solid var(--blue);
  background: var(--blue);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.button-primary svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.button-primary:hover { background: var(--blue-hover); }
.button-secondary { border: 1px solid #c9d5e2; background: #fff; color: var(--ink); }
.button-secondary:hover { border-color: #a9b9c9; background: #fbfdff; }
.button-quiet { border: 1px solid transparent; background: #f5f7fa; color: var(--muted); }
.full-width { width: 100%; }

.data-section + .data-section { margin-top: 22px; }
.data-section h2 { margin-bottom: 10px; }
.data-card { border: 1px solid var(--border-soft); border-radius: 7px; background: #fff; padding: 12px; }
.stat-grid { margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.stat-grid div { min-width: 0; }
.stat-grid dt { color: var(--muted); font-size: 11.5px; font-weight: 400; }
.stat-grid dd { margin: 4px 0 0; color: var(--ink); font-weight: 700; font-size: 14px; overflow-wrap: anywhere; }
.order-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.order-stat {
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  background: #fff;
  padding: 9px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
}
.order-stat span:first-child { color: var(--muted); }
.order-stat strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.upload-actions { display: grid; gap: 8px; }
.upload-status { min-height: 0; margin-top: 8px; color: var(--muted); line-height: 1.4; font-size: 12.5px; }
.upload-status:empty { display: none; }
.upload-status.is-error { color: var(--danger); }


.map-stage.dashboard-mode {
  --active-sidebar-w: min(500px, calc(100vw - var(--edge-gap) - var(--edge-gap) - var(--right-panel-w) - 82px));
}
.left-sidebar {
  transition: width .22s ease, transform .2s ease;
}
.left-sidebar.is-dashboard .sidebar-tabs {
  height: 48px;
}
.left-sidebar.is-dashboard .sidebar-tab {
  font-size: 14px;
}
.left-sidebar.is-dashboard .tab-icon {
  width: 16px;
  height: 16px;
}
.dashboard-scroll {
  padding: 16px 18px 18px;
  background: #fff;
}
.dashboard-section + .dashboard-section {
  margin-top: 18px;
}
.dashboard-section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.dashboard-section .dashboard-section-heading h2 {
  margin: 0;
  color: #0759a6;
  font-size: 13px;
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: -.01em;
}
.dashboard-section-subtitle {
  margin: 3px 0 0;
  color: #7588a3;
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: .015em;
}
.dashboard-main-river-heading {
  align-items: center;
}
.dashboard-ws-filter {
  flex: 0 0 auto;
  max-width: 232px;
}
.dashboard-ws-filter select {
  width: 100%;
  height: 30px;
  padding: 0 28px 0 9px;
  border: 1px solid #c9d8e8;
  border-radius: 6px;
  background: #fff;
  color: #173a64;
  font-size: 10.5px;
  font-weight: 600;
  cursor: pointer;
}
.dashboard-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
}
.dashboard-metric-card {
  min-width: 0;
  min-height: 58px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 8px 10px;
  border: 1px solid #d3e0ed;
  border-radius: 7px;
  background: #fff;
}
.dashboard-metric-card span {
  color: #6d7f99;
  font-size: 10.5px;
  line-height: 1.2;
  white-space: nowrap;
}
.dashboard-metric-card strong {
  margin-top: 3px;
  color: #092f5c;
  font-size: 16px;
  line-height: 1;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.dashboard-table-wrap {
  overflow: hidden;
  border: 1px solid #c9dbef;
  border-radius: 8px;
  background: #fff;
}
.dashboard-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  color: #173a64;
  font-size: 11.5px;
}
.dashboard-table th,
.dashboard-table td {
  height: 36px;
  padding: 5px 6px;
  border-right: 1px solid #e0e9f2;
  border-bottom: 1px solid #e0e9f2;
  text-align: center;
  vertical-align: middle;
  font-variant-numeric: tabular-nums;
}
.dashboard-table tr:last-child th,
.dashboard-table tr:last-child td { border-bottom: 0; }
.dashboard-table th:last-child,
.dashboard-table td:last-child { border-right: 0; }
.dashboard-table thead th {
  background: #f2f7fb;
  color: #314e71;
  font-weight: 650;
}
.dashboard-table tbody th {
  text-align: left;
  color: #173a64;
  font-weight: 500;
  white-space: normal;
  line-height: 1.15;
}
.main-river-table th:first-child { width: 26%; }
.main-river-table th:nth-child(2) { width: 16%; }
.main-river-table th:nth-child(3) { width: 21%; }
.river-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 6px;
  border-radius: 50%;
  vertical-align: 0;
}
.river-opak,
.river-bengawan-solo { background: #ff9918; }
.river-progo,
.river-madiun { background: #1686c7; }
.river-serang,
.river-kali-lamong { background: #0891B2; }
.river-dashboard-default { background: #64748b; }
.dashboard-loading-cell {
  padding: 16px !important;
  color: #7b8ca4 !important;
  text-align: center !important;
  font-size: 12.5px;
}
.dashboard-chart-section {
  margin-top: 12px !important;
}
.dashboard-chart-card {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}
.dashboard-chart-card + .dashboard-chart-card {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid #e2eaf2;
}
.dashboard-chart-card h3 {
  margin: 0;
  color: #173a64;
  font-size: 12.5px;
  line-height: 1.25;
  font-weight: 700;
}
.dashboard-chart-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.river-length-chart {
  display: grid;
  gap: 7px;
  margin-top: 9px;
}
.length-bar-row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) 32px;
  align-items: center;
  gap: 7px;
  min-height: 20px;
}
.length-bar-name,
.slope-river-name {
  color: #314e71;
  font-size: 10.5px;
  font-weight: 500;
}
.length-bar-track {
  height: 18px;
  overflow: hidden;
  border-radius: 4px;
  background: #f1f5f9;
}
.length-bar-fill {
  display: block;
  height: 100%;
  border-radius: 4px;
}
.length-bar-fill.river-opak,
.length-bar-fill.river-bengawan-solo { background: linear-gradient(90deg, #ffb000, #ff9918); }
.length-bar-fill.river-progo,
.length-bar-fill.river-madiun { background: linear-gradient(90deg, #0b95e5, #1686c7); }
.length-bar-fill.river-serang,
.length-bar-fill.river-kali-lamong { background: linear-gradient(90deg, #12b3aa, #0891b2); }
.length-bar-fill.river-dashboard-default { background: #64748b; }
.length-bar-row strong {
  color: #173a64;
  font-size: 10.5px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}
.river-slope-chart {
  margin-top: 8px;
}
.slope-chart-body {
  display: grid;
  gap: 5px;
}
.slope-row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  align-items: center;
  gap: 7px;
  min-height: 22px;
}
.slope-track {
  position: relative;
  height: 22px;
  border-bottom: 1px solid #cddbeb;
}
.slope-dot {
  position: absolute;
  left: 0;
  bottom: -4px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  transform: translateX(-50%);
  box-shadow: 0 0 0 2px #fff;
}
.slope-value {
  position: absolute;
  bottom: 3px;
  transform: translateX(7px);
  color: #173a64;
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.slope-value.is-near-end {
  transform: translateX(calc(-100% - 7px));
}
.slope-axis-row {
  margin-top: 6px;
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 7px;
}
.slope-axis {
  display: flex;
  justify-content: space-between;
  color: #71839c;
  font-size: 9.5px;
  font-variant-numeric: tabular-nums;
}
.heatmap-legend {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  color: #7b8ca4;
  font-size: 8.5px;
  white-space: nowrap;
}
.heatmap-legend-ramp {
  width: 76px;
  height: 9px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(18, 137, 219, .10), rgba(18, 137, 219, .92));
}
.river-width-heatmap {
  margin-top: 8px;
}
.width-heatmap-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
  color: #173a64;
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
}
.width-heatmap-table th,
.width-heatmap-table td {
  height: 31px;
  padding: 5px 7px;
  border-right: 1px solid #e0e9f2;
  border-bottom: 1px solid #e0e9f2;
  text-align: center;
  vertical-align: middle;
}
.width-heatmap-table thead th {
  background: #f4f7fb;
  color: #314e71;
  font-weight: 600;
  border-top: 1px solid #e0e9f2;
}
.width-heatmap-table thead th:first-child {
  width: 31%;
  border-top-left-radius: 6px;
  border-left: 1px solid #e0e9f2;
  background: transparent;
}
.width-heatmap-table thead th:last-child {
  border-top-right-radius: 6px;
}
.width-heatmap-table tbody th {
  text-align: left;
  color: #173a64;
  font-weight: 600;
  border-left: 1px solid #e0e9f2;
  background: #fff;
  white-space: normal;
  line-height: 1.15;
}
.width-heatmap-table tbody tr:last-child th {
  border-bottom-left-radius: 6px;
}
.width-heatmap-table tbody tr:last-child td:last-child {
  border-bottom-right-radius: 6px;
}
.heatmap-cell {
  background: rgba(18, 137, 219, var(--heat-alpha, .1));
  color: var(--heat-text, #173a64);
  font-weight: 600;
}
.heatmap-cell.is-empty {
  background: #f8fafc;
  color: #98a2b3;
}
.dashboard-order-stats {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}
.dashboard-order-stats .order-stat {
  min-height: 52px;
  padding: 7px 9px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 3px;
  border-color: #d3e0ed;
  border-radius: 7px;
}
.dashboard-order-stats .order-stat span:first-child {
  color: #71839c;
  font-size: 10px;
}
.dashboard-order-stats .order-stat strong {
  color: #092f5c;
  font-size: 17px;
  line-height: 1;
}
.dashboard-upload-actions { gap: 6px; }
.dashboard-import-button,
.dashboard-reset-button {
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 6px;
  color: #0759a6;
  font-size: 12.5px;
}
.dashboard-import-button svg,
.dashboard-reset-button svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.dashboard-reset-button {
  color: #7b8ca4;
  background: #f3f6f9;
}
.dashboard-import-section { padding-bottom: 2px; }

.custom-zoom {
  position: absolute;
  z-index: 1100;
  left: calc(var(--edge-gap) + var(--active-sidebar-w) + 16px);
  top: 24px;
  width: 44px;
  overflow: hidden;
  border: 1px solid #d5dde6;
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 2px 8px rgba(15,23,42,.06);
}
.custom-zoom button {
  width: 100%;
  height: 44px;
  border: 0;
  border-bottom: 1px solid var(--border-soft);
  background: #fff;
  color: var(--ink);
  font-family: "Geist";
  font-size: 22px;
  font-weight: 500;
  cursor: pointer;
}
.custom-zoom button:last-child { border-bottom: 0; }
.custom-zoom button:hover { background: #f8fafc; }

.right-panels {
  position: absolute;
  z-index: 1100;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  width: var(--right-panel-w);
  max-height: calc(100% - 32px);
  display: grid;
  gap: 16px;
  overflow-y: auto;
  scrollbar-width: none;
  pointer-events: none;
}
.right-panels::-webkit-scrollbar { display: none; }
.floating-panel {
  pointer-events: auto;
  overflow: hidden;
  border: 1px solid #d4dce5;
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 2px 8px rgba(15, 23, 42, .06);
}
.floating-panel h2 {
  margin: 0;
  min-height: 48px;
  display: flex;
  align-items: center;
  padding: 0 18px;
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 700;
  border-bottom: 0;
}
.panel-group { padding: 0 18px 14px; }
.group-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 21px;
  color: #475467;
  font-size: 11.5px;
  font-weight: 600;
}
.panel-divider { height: 1px; margin: 0 18px 12px; background: var(--border-soft); }

.polygon-controls { display: grid; gap: 12px; }
.polygon-controls .subdas-heading { margin-top: 1px; }
.polygon-controls .polygon-list { margin-top: -2px; padding-left: 10px; }
.layer-list input:disabled { cursor: not-allowed; opacity: .45; }
.layer-subrow { color: #667085 !important; }
.layer-list { margin-top: 8px; display: grid; gap: 12px; }
.layer-list label {
  display: grid;
  grid-template-columns: 1fr 17px;
  align-items: center;
  gap: 8px;
  color: #475467;
  font-size: 12.5px;
  font-weight: 400;
  cursor: pointer;
}
.layer-list input {
  justify-self: end;
  width: 14px;
  height: 14px;
  accent-color: var(--blue);
  cursor: pointer;
}
.switch { position: relative; width: 34px; height: 18px; display: inline-flex; cursor: pointer; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch-track { width: 34px; height: 18px; border-radius: 20px; background: #cbd5e1; transition: background .15s ease; }
.switch-track::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  top: 2px;
  left: 2px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15,23,42,.22);
  transition: transform .15s ease;
}
.switch input:checked + .switch-track { background: #1e3a8a; }
.switch input:checked + .switch-track::after { transform: translateX(16px); }
.basemap-group { display: grid; gap: 10px; padding-bottom: 16px; }
.basemap-group .group-heading { margin-bottom: 1px; }
.radio-row { display: flex; align-items: center; gap: 8px; color: #475467; font-size: 12.5px; cursor: pointer; }
.radio-row input { width: 14px; height: 14px; accent-color: var(--blue); margin: 0; }

.legend-panel h2 { min-height: 48px; }
.legend-list { padding: 0 18px 17px; display: grid; gap: 14px; }
.legend-list > div {
  display: grid;
  grid-template-columns: 48px 1fr;
  align-items: center;
  gap: 8px;
  color: #475467;
  font-size: 12.5px;
}
.line-swatch { display: inline-block; width: 42px; height: 0; border-top-style: solid; border-top-color: currentColor; }
.line-swatch.order-1 { color: var(--river-1); border-top-width: 4px; }
.line-swatch.order-2 { color: var(--river-2); border-top-width: 3px; }
.line-swatch.order-3 { color: var(--river-3); border-top-width: 2px; }
.line-swatch.order-4 { color: var(--river-4); border-top-width: 1.5px; }
.area-swatch { display: inline-block; width: 34px; height: 20px; border-radius: 2px; }
.area-swatch.das-area { background: rgba(242, 201, 76, .34); border: 1px solid #f59e0b; }
.area-swatch.subdas-area { background: rgba(168, 85, 247, .14); border: 1px solid rgba(168, 85, 247, .5); }
.area-swatch.subdas-boundary { background: rgba(168, 85, 247, .05); border: 2px dashed #f59e0b; }

.status-bar {
  position: absolute;
  z-index: 1100;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100% - 48px);
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 5px 8px;
  border: 1px solid #d8e0e8;
  border-radius: 8px;
  background: rgba(255,255,255,.98);
  color: var(--blue-deep);
  box-shadow: 0 3px 10px rgba(15,23,42,.07);
  font-size: 12.5px;
  font-weight: 600;
  pointer-events: none;
}
.status-item { padding: 0 9px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.status-item:first-child { padding-left: 2px; }
.status-divider { width: 1px; height: 24px; background: #d8e0e8; flex: 0 0 auto; }
.scale-graphic { position: relative; width: 156px; height: 30px; margin: 0 2px 0 9px; flex: 0 0 auto; }
.scale-labels { position: absolute; inset: 0 0 auto 0; height: 15px; color: #64748b; font-size: 10px; font-weight: 500; font-variant-numeric: tabular-nums; }
.scale-label { position: absolute; top: 0; line-height: 1; white-space: nowrap; }
.scale-label-start { left: 0; }
.scale-label-quarter { left: 25%; transform: translateX(-50%); }
.scale-label-half { left: 50%; transform: translateX(-50%); }
.scale-label-end { right: 0; }
.scale-bar { position: absolute; left: 0; right: 0; bottom: 3px; height: 2px; background: #294f7a; }
.scale-tick { position: absolute; bottom: 0; width: 1px; height: 7px; background: #294f7a; }
.scale-tick-start { left: 0; }
.scale-tick-quarter { left: 25%; }
.scale-tick-half { left: 50%; }
.scale-tick-end { right: 0; }

.drop-overlay {
  position: absolute;
  z-index: 1500;
  inset: 0;
  display: none;
  place-items: center;
  background: rgba(8,47,79,.42);
  backdrop-filter: blur(2px);
}
.drop-overlay.is-active { display: grid; }
.drop-card {
  width: min(460px, calc(100% - 40px));
  padding: 24px;
  border-radius: 9px;
  border: 1px solid #dbe6f0;
  background: #fff;
  box-shadow: 0 16px 40px rgba(15,23,42,.22);
  display: grid;
  gap: 6px;
  text-align: center;
}
.drop-card strong { color: var(--ink); font-size: 18px; }
.drop-card span { color: var(--muted); }

.leaflet-tooltip.river-tooltip, .leaflet-tooltip.das-tooltip {
  border: 1px solid var(--border);
  border-radius: 5px;
  background: rgba(255,255,255,.98);
  color: var(--text);
  box-shadow: 0 3px 12px rgba(15,23,42,.14);
  padding: 8px 10px;
  font-family: "Geist";
  font-size: 13px;
  line-height: 1.45;
}
.leaflet-tooltip strong { color: var(--ink); }
.leaflet-popup-content-wrapper { border-radius: 7px; box-shadow: 0 10px 28px rgba(15,23,42,.2); }
.leaflet-popup-content { margin: 12px 14px; min-width: 340px; max-width: 480px; font-family: "Geist"; }
.popup-title { margin: 0 0 8px; color: var(--ink); font-size: 16px; font-weight: 700; }
.popup-table-wrap { max-height: 350px; overflow: auto; padding-right: 2px; }
.popup-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.popup-table th, .popup-table td {
  padding: 5px 6px;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: top;
  text-align: left;
}
.popup-table th {
  width: 1%;
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
  word-break: normal;
  overflow-wrap: normal;
}
.popup-table td {
  min-width: 0;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  word-break: normal;
  overflow-wrap: break-word;
}

@media (max-width: 1500px) {
  :root { --sidebar-w: 300px; --right-panel-w: 198px; --edge-gap: 18px; }
  .brand-copy h1 { font-size: 20px; }
  .custom-zoom { left: calc(var(--edge-gap) + var(--active-sidebar-w) + 14px); }
  .scale-graphic { width: 148px; }
}

@media (max-width: 1180px) {
  :root { --sidebar-w: 286px; --right-panel-w: 192px; --edge-gap: 14px; }
  .brand-copy h1 { font-size: 19px; }
  .brand-copy p { font-size: 12px; }
  .scale-graphic { width: 128px; }
}

@media (max-width: 900px) {
  :root { --header-h: 60px; --sidebar-w: 320px; --right-panel-w: 214px; }
  .map-stage.dashboard-mode { --active-sidebar-w: min(94vw, 760px); }
  .dashboard-scroll { padding: 20px 18px 24px; }
  .mobile-only { display: inline-flex !important; align-items: center; }
  .app-header { padding: 0 10px; }
  .brand-logo { width: 32px; height: 32px; }
  .brand-copy h1 { font-size: 16px; }
  .brand-copy p { font-size: 11.5px; max-width: 320px; }
  #zoomAllBtn { display: none; }
  .header-button { height: 34px; padding: 0 10px; }

  .left-sidebar {
    left: 10px;
    top: 10px;
    bottom: 10px;
    transform: translateX(calc(-100% - 24px));
    transition: transform .2s ease;
    box-shadow: 8px 0 24px rgba(15,23,42,.15);
  }
  .left-sidebar.is-open { transform: translateX(0); }

  .right-panels {
    top: 10px;
    right: 10px;
    max-height: calc(100% - 20px);
    transform: translateX(calc(100% + 24px));
    transition: transform .2s ease;
  }
  .right-panels.is-open { transform: translateX(0); }
  .custom-zoom { left: 10px; top: 10px; }

  .status-bar {
    left: 10px;
    right: 10px;
    bottom: 10px;
    transform: none;
    width: auto;
    max-width: none;
    min-height: 42px;
    padding: 6px 8px;
    font-size: 12px;
  }
  .status-item { padding: 0 9px; }
  .scale-graphic { width: 118px; margin-left: 9px; }
}

@media (max-width: 700px) {
  .dashboard-main-river-heading { align-items: flex-start; flex-direction: column; }
  .dashboard-ws-filter { width: 100%; max-width: none; }
  .dashboard-metrics { grid-template-columns: 1fr 1fr; }
  .dashboard-table-wrap { overflow-x: auto; }
  .dashboard-table { min-width: 620px; }
  .dashboard-order-stats { grid-template-columns: repeat(2, 1fr); }
  .dashboard-chart-heading { align-items: flex-start; flex-direction: column; gap: 6px; }
  .heatmap-legend { justify-content: flex-start; }
}

@media (max-width: 560px) {
  :root { --sidebar-w: min(92vw, 340px); }
  .brand-copy p { display: none; }
  .brand-copy h1 { max-width: 220px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .right-panels { width: min(88vw, 214px); max-height: calc(100vh - var(--header-h) - 20px); overflow: auto; }
  .status-bar { justify-content: center; }
  .status-divider:last-of-type, .scale-graphic { display: none; }
  .status-divider:nth-of-type(2), #scaleText { display: none; }
  .sidebar-actions { gap: 8px; }
}
