/* =========================
assets/css/agri-table.css (FULL FILE)
Includes:
- tree-info (Shopify-like table)
- tree-detail (Polaris-like cards + key/value table)
========================= */

:root {
  --sb-bg: #ffffff;
  --sb-border: #e5e7eb;
  --sb-border2: #eef0f2;
  --sb-text: #111827;
  --sb-muted: #6b7280;
  --sb-hover: #f8fafc;
  --sb-tab: #f3f4f6;
  --sb-tab-active: #ffffff;
  --sb-shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 1px rgba(16,24,40,.04);
  --sb-radius: 14px;
  --sb-pill: #f3f4f6;
  --sb-pill-text: #374151;
  --sb-pill-good: #ecfdf3;
  --sb-pill-good-text: #027a48;
  --sb-pill-warn: #fff7ed;
  --sb-pill-warn-text: #9a3412;
}

/* ---------- shared helpers ---------- */

.d-none {
  display: none !important;
}

/* ---------- Pills (used in both pages) ---------- */

.agri-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--sb-pill);
  color: var(--sb-pill-text);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.agri-pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: currentColor;
  opacity: .55;
}

.agri-pill.good {
  background: var(--sb-pill-good);
  color: var(--sb-pill-good-text);
}

.agri-pill.warn {
  background: var(--sb-pill-warn);
  color: var(--sb-pill-warn-text);
}

/* =========================================================
TREE-INFO PAGE (Shopify-like table + tabs + tools)
========================================================= */

.agri-card {
  background: var(--sb-bg);
  border: 1px solid #d4dde8;
  border-radius: var(--sb-radius);
  box-shadow: var(--sb-shadow);
  overflow: hidden;
}

.agri-card-header {
  padding: 10px 14px;
  border-bottom: 1px solid var(--sb-border2);
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.agri-meta {
  color: var(--sb-muted);
  font-size: 12px;
}

.agri-pager-top {
  display: flex;
  align-items: center;
  gap: 6px;
}

.agri-card-footer {
  padding: 10px 14px;
  border-top: 1px solid var(--sb-border2);
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--sb-muted);
  font-size: 12px;
}

.agri-kpi-row {
  display: flex;
  flex-wrap: nowrap;
  overflow: hidden;
  align-items: stretch;
  gap: 0;
  background: #ffffff;
  border: 1px solid #d4dde8;
  border-radius: 12px;
}

.agri-kpi-card {
  flex: 0 0 156px;
  background: #ffffff;
  border: 0;
  border-radius: 0;
  padding: 3px 54px 3px 8px;
  position: relative;
  overflow: hidden;
  transition: opacity .22s ease, transform .22s ease, flex-basis .22s ease, padding .22s ease, margin .22s ease, border-width .22s ease;
}

.agri-kpi-card + .agri-kpi-card {
  border-left: 1px solid #e5e7eb;
}

.agri-kpi-card.is-hidden {
  opacity: 0;
  transform: translateX(14px) scale(.96);
  flex-basis: 0;
  min-width: 0;
  padding-left: 0;
  padding-right: 0;
  margin-left: -2px;
  margin-right: -2px;
  border-width: 0;
  border-left: 0;
  pointer-events: none;
}

.agri-kpi-card::after {
  display: none;
}

.agri-kpi-spark {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  color: #7dc8ff;
  opacity: 0.95;
  animation: agriKpiPulse 2.4s ease-in-out infinite;
  transform-origin: center;
  scale: .78;
}

.agri-kpi-line {
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 70;
  stroke-dashoffset: 70;
  animation: agriKpiDraw 1.2s ease forwards;
}

.agri-kpi-card:nth-child(2) .agri-kpi-line {
  animation-delay: .15s;
}

.agri-kpi-label {
  color: #6b7280;
  font-size: 10px;
  line-height: 1.1;
  display: inline-block;
  padding-bottom: 1px;
  border-bottom: 1px dotted #c7ced6;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.agri-kpi-value {
  color: #1f2937;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.05;
  margin-top: 1px;
}

@keyframes agriKpiDraw {
  to {
    stroke-dashoffset: 0;
  }
}

@keyframes agriKpiPulse {
  0%, 100% { opacity: .72; }
  50% { opacity: 1; }
}

.agri-top-actions {
  display: flex;
  justify-content: flex-end;
}

.agri-map-overview {
  border: 1px solid #d4dde8;
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.08);
  overflow: hidden;
}

.agri-map-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid #e8eef5;
}

.agri-map-head-left {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.agri-map-title {
  font-size: 13px;
  font-weight: 700;
  color: #0f172a;
}

.agri-map-meta {
  font-size: 11px;
  color: #64748b;
}

.agri-map-head-right {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.agri-map-base-switch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px;
  border: 1px solid #d4dde8;
  border-radius: 999px;
  background: #f8fafc;
  overflow-x: auto;
  max-width: min(66vw, 560px);
  scrollbar-width: thin;
}

.agri-map-base-btn {
  border: 0;
  height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  background: transparent;
  color: #475569;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.agri-map-base-btn:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.agri-map-base-btn.is-active {
  background: #ffffff;
  color: #0f172a;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12);
}

.agri-map-wind-btn {
  border: 1px solid #d4dde8;
  height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  background: #ffffff;
  color: #475569;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.agri-map-wind-btn:hover {
  background: #f8fafc;
  color: #0f172a;
}

.agri-map-wind-btn.is-on {
  border-color: #93c5fd;
  background: #eff6ff;
  color: #1d4ed8;
}

.map-overlay-left-stack {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 7;
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-start;
}

.agri-map-temp {
  height: 26px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.46);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.34);
  -webkit-backdrop-filter: blur(8px) saturate(145%);
  backdrop-filter: blur(8px) saturate(145%);
  color: #0f172a;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.15);
}

.agri-map-wind-speed {
  height: 24px;
  display: inline-flex;
  align-items: center;
  padding: 0 9px;
  border: 1px solid rgba(255, 255, 255, 0.46);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.34);
  -webkit-backdrop-filter: blur(8px) saturate(145%);
  backdrop-filter: blur(8px) saturate(145%);
  color: #0f172a;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: 0 5px 14px rgba(15, 23, 42, 0.13);
}

.agri-map-soil {
  height: 24px;
  display: inline-flex;
  align-items: center;
  padding: 0 9px;
  border: 1px solid rgba(255, 255, 255, 0.46);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.34);
  -webkit-backdrop-filter: blur(8px) saturate(145%);
  backdrop-filter: blur(8px) saturate(145%);
  color: #0f172a;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: 0 5px 14px rgba(15, 23, 42, 0.13);
}

.agri-map-extra {
  height: 24px;
  display: inline-flex;
  align-items: center;
  padding: 0 9px;
  border: 1px solid rgba(255, 255, 255, 0.46);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.34);
  -webkit-backdrop-filter: blur(8px) saturate(145%);
  backdrop-filter: blur(8px) saturate(145%);
  color: #0f172a;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: 0 5px 14px rgba(15, 23, 42, 0.13);
}

.agri-map-wind-canvas {
  position: absolute;
  inset: 0;
  z-index: 4;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.map-source-tip {
  position: absolute;
  z-index: 9;
  max-width: 190px;
  padding: 6px 7px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.42);
  background: rgba(2, 6, 23, 0.92);
  color: #ffffff;
  font-size: 8px !important;
  line-height: 1.2 !important;
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.28);
  -webkit-backdrop-filter: blur(7px) saturate(120%);
  backdrop-filter: blur(7px) saturate(120%);
  pointer-events: none;
}

.map-source-tip::before {
  content: "";
  position: absolute;
  top: -5px;
  left: 12px;
  width: 9px;
  height: 9px;
  transform: rotate(45deg);
  background: rgba(2, 6, 23, 0.92);
  border-left: 1px solid rgba(148, 163, 184, 0.38);
  border-top: 1px solid rgba(148, 163, 184, 0.38);
}

.map-tip-title {
  margin: 0 0 4px;
  font-size: 8px !important;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 0.01em;
}

.map-tip-body {
  margin: 0;
  color: #e2e8f0;
}

.map-tip-source {
  margin-top: 4px;
  padding-top: 4px;
  border-top: 1px solid rgba(148, 163, 184, 0.30);
  color: #dbeafe;
  font-size: 7px !important;
}

.map-go-tree-btn {
  display: inline-flex;
  align-items: center;
  margin-top: 7px;
  height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  border: 1px solid #d1d5db;
  background: #ffffff;
  color: #111827;
  font-size: 10px;
  font-weight: 700;
  text-decoration: none;
}

.map-go-tree-btn:hover {
  background: #f8fafc;
  color: #0f172a;
}

.agri-map-canvas {
  width: 100%;
  height: 460px;
  background: #eaf1f8;
  position: relative;
}

.detail-map-topbar {
  display: flex;
  align-items: center;
}

.detail-map-back-btn {
  position: static;
  z-index: auto;
  min-height: 26px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #0f172a;
  text-decoration: none;
  font-size: 10px;
  font-weight: 700;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.10);
}

.detail-map-back-btn:hover {
  background: #f8fafc;
  color: #0f172a;
}

.detail-map-back-btn:active {
  transform: translateY(1px);
}

.agri-map-tint-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity .22s ease;
  z-index: 6;
}

.agri-map-canvas.is-windy .agri-map-tint-overlay {
  opacity: 0;
  background: transparent;
}

.tree-map-marker {
  width: 16px;
  height: 16px;
  border: 2px solid #ffffff;
  background: var(--mk-color, #2563eb);
  box-shadow: 0 1px 8px rgba(15, 23, 42, 0.35);
  cursor: pointer;
  padding: 0;
  position: relative;
  overflow: visible;
}

.tree-map-marker:focus-visible {
  outline: 2px solid #111827;
  outline-offset: 1px;
}

.tree-map-marker.mk-circle {
  border-radius: 999px;
}

.tree-map-marker.mk-square {
  border-radius: 3px;
}

.tree-map-marker.mk-diamond {
  transform: rotate(45deg);
  border-radius: 2px;
}

.tree-map-marker.mk-triangle {
  clip-path: polygon(50% 2%, 4% 98%, 96% 98%);
  border-radius: 0;
}

.tree-map-marker.mk-hex {
  clip-path: polygon(25% 4%, 75% 4%, 98% 50%, 75% 96%, 25% 96%, 2% 50%);
  border-radius: 0;
}

.tree-map-marker.is-muted {
  opacity: 0.9;
  background: #9ca3af !important;
  border-color: #e5e7eb;
  filter: grayscale(1) saturate(0.05) brightness(0.92);
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.16);
}

.tree-map-marker.is-selected {
  opacity: 1;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.95), 0 0 0 5px rgba(37, 99, 235, 0.45), 0 4px 14px rgba(15, 23, 42, 0.38);
  z-index: 2;
}

.tree-map-marker.is-selected::after,
.tree-map-marker.is-selected::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  transform: translate(-50%, -50%) scale(1);
  border: 2px solid rgba(37, 99, 235, 0.55);
  box-sizing: border-box;
  pointer-events: none;
  z-index: -1;
}

.tree-map-marker.is-selected::after {
  animation: agri-radar-pulse 1.6s linear infinite;
}

.tree-map-marker.is-selected::before {
  animation: agri-radar-pulse 1.6s linear 0.8s infinite;
}

@keyframes agri-radar-pulse {
  0% {
    opacity: 0.8;
    transform: translate(-50%, -50%) scale(1);
  }
  70% {
    opacity: 0.22;
    transform: translate(-50%, -50%) scale(2.4);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(2.9);
  }
}

@media (prefers-reduced-motion: reduce) {
  .tree-map-marker.is-selected::after,
  .tree-map-marker.is-selected::before {
    animation: none;
  }
}

.agri-map-legend {
  position: absolute;
  right: 10px;
  bottom: 10px;
  z-index: 6;
  min-width: 190px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid #dbe5f1;
  border-radius: 10px;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.16);
  padding: 8px 9px;
  backdrop-filter: blur(3px);
}

.map-legend-title {
  font-size: 11px;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 6px;
}

.map-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0;
}

.map-legend-label {
  font-size: 11px;
  color: #334155;
  line-height: 1.2;
}

.map-legend-shape {
  width: 12px;
  height: 12px;
  border: 1.6px solid #ffffff;
  background: var(--mk-color, #2563eb);
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.2);
  display: inline-block;
  flex: 0 0 auto;
}

.map-legend-shape.mk-circle { border-radius: 999px; }
.map-legend-shape.mk-square { border-radius: 2px; }
.map-legend-shape.mk-diamond { transform: rotate(45deg); border-radius: 1px; }
.map-legend-shape.mk-triangle { clip-path: polygon(50% 2%, 4% 98%, 96% 98%); border-radius: 0; }
.map-legend-shape.mk-hex { clip-path: polygon(25% 4%, 75% 4%, 98% 50%, 75% 96%, 25% 96%, 2% 50%); border-radius: 0; }

@media (max-width: 767.98px) {
  .agri-map-canvas { height: 360px; }
  .agri-map-head-right {
    width: 100%;
    justify-content: space-between;
  }
  .agri-map-head {
    flex-wrap: wrap;
    align-items: flex-start;
  }
  .agri-map-legend {
    left: 8px;
    right: 8px;
    bottom: 8px;
    min-width: 0;
    padding: 7px 8px;
  }
  .map-legend-item { gap: 7px; margin: 3px 0; }
  .map-legend-label { font-size: 10px; }
}

.agri-export-pop {
  position: relative;
}

.agri-export-btn {
  height: 28px;
  padding: 0 10px;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  background: #fff;
  color: #374151;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(17, 24, 39, 0.08);
}

.agri-export-btn:hover {
  background: #f9fafb;
  border-color: #9ca3af;
}

.agri-export-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 40;
  min-width: 170px;
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  box-shadow: 0 10px 24px rgba(17, 24, 39, 0.14);
  padding: 8px;
  display: none;
}

.agri-export-pop.is-open .agri-export-panel {
  display: block;
}

.agri-export-label {
  display: block;
  font-size: 10px;
  color: #6b7280;
  margin: 2px 0 4px;
}

.agri-export-select {
  width: 100%;
  min-height: 30px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background: #f9fafb;
  font-size: 12px;
  color: #374151;
  padding: 4px 8px;
  margin-bottom: 6px;
}

.agri-export-run {
  width: 100%;
  height: 30px;
  border: 0;
  border-radius: 8px;
  background: #111827;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.agri-export-run:hover {
  background: #1f2937;
}

.agri-table-wrap {
  overflow: auto;
}

.agri-table {
  width: 100%;
  border-collapse: collapse;
  border-spacing: 0;
  table-layout: fixed;
  min-width: 1080px;
  background: #ffffff;
}

.agri-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #ffffff;
  color: #616161;
  font-weight: 600;
  font-size: 12px;
  letter-spacing: .01em;
  border: 0;
  padding: 6px 8px;
  white-space: nowrap;
}

.agri-table tbody td {
  padding: 6px 8px;
  background: #ffffff;
  border: 0;
  color: #3c3f44;
  font-size: 12px;
  vertical-align: middle;
}

.agri-table tbody td:first-child {
  border-left: 0;
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}

.agri-table tbody td:last-child {
  border-right: 0;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.agri-table tbody tr:hover td {
  background: #ffffff;
  color: #2f3136;
}

.agri-empty {
  text-align: center;
  color: var(--sb-muted);
  padding: 18px !important;
}

/* columns */

.col-check {
  width: 42px;
}

.col-nosiri {
  width: 170px;
}

.col-treeid {
  width: 140px;
}

.col-blok {
  width: 130px;
}

.col-jenis {
  width: 130px;
}

.col-status {
  width: 280px;
}

.col-perlu {
  width: 240px;
}

.col-time {
  width: 170px;
}

.agri-table tbody td.col-status {
  overflow: hidden;
}

.agri-table tbody td.col-status .agri-pill {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Nama Pokok: keep to 1 line like Polaris table cells */
.agri-table thead th:nth-child(3),
.agri-table tbody td:nth-child(3) {
  width: 230px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.agri-table thead th:nth-child(4),
.agri-table tbody td:nth-child(4),
.agri-table thead th:nth-child(5),
.agri-table tbody td:nth-child(5) {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.agri-check {
  width: 16px;
  height: 16px;
  accent-color: #111827;
  cursor: pointer;
}

.agri-link {
  color: #303030;
  text-decoration: none;
  font-weight: 600;
}

.agri-link:hover {
  text-decoration: underline;
}

/* tabs */

.agri-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  overflow: visible;
  background: #ffffff !important;
  border: 1px solid #d4dde8 !important;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08) !important;
}

.agri-filters {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.agri-filter-icon-wrap {
  position: relative;
  width: 30px;
  height: 30px;
}

.agri-filter-glyph {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  background: #ffffff;
  border: 1px solid #d1d5db;
  box-shadow: 0 2px 6px rgba(17, 24, 39, 0.12);
  color: #4b5563;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color .16s ease, color .16s ease, box-shadow .16s ease, transform .16s ease;
}

.agri-filter-icon-wrap:hover .agri-filter-glyph {
  background: #ffffff;
  color: #1f2937;
  box-shadow: 0 4px 10px rgba(17, 24, 39, 0.16);
  transform: translateY(-1px);
}

.agri-filter-icon-select {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  opacity: 0;
  cursor: pointer;
  appearance: none;
}

.agri-filter-clear {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 10px;
  background: #eceff3;
  color: #4b5563;
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color .16s ease, color .16s ease;
}

.agri-filter-clear:hover {
  background: #dfe4ea;
  color: #1f2937;
}

.agri-filter-state {
  max-width: 320px;
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border-radius: 10px;
  border: 1px dashed #d1d5db;
  background: #f9fafb;
  color: #4b5563;
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.agri-tab {
  border: 0;
  background: transparent;
  padding: 4px 10px;
  border-radius: 10px;
  font-size: 12px;
  color: #4b5563;
  cursor: pointer;
  transition: background-color .16s ease, color .16s ease;
}

.agri-tab:hover {
  background: #eceff3;
  color: #2f3136;
}

.agri-tab.is-active {
  background: #e5e7eb;
  color: #1f2937;
  font-weight: 600;
}

.agri-tabs-spacer {
  flex: 1;
}

/* tools */

.agri-tools {
  display: flex;
  align-items: center;
  gap: 8px;
}

.agri-dup-toggle {
  border: 1px solid #d1d5db;
  background: #ffffff;
  color: #334155;
  border-radius: 10px;
  height: 34px;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  transition: background-color .16s ease, border-color .16s ease, color .16s ease;
}

.agri-dup-toggle:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #0f172a;
}

.agri-dup-toggle.is-active {
  background: #fff7ed;
  border-color: #fb923c;
  color: #9a3412;
}

.agri-dup-panel {
  margin: 10px 0 12px;
  padding: 10px 12px;
  border: 1px solid #fed7aa;
  border-radius: 12px;
  background: #fffaf5;
}

.agri-dup-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.agri-dup-title {
  font-size: 12px;
  font-weight: 700;
  color: #9a3412;
}

.agri-dup-meta {
  font-size: 11px;
  color: #9a3412;
  white-space: nowrap;
}

.agri-dup-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 6px;
}

.agri-dup-list li {
  border: 1px solid #ffedd5;
  border-radius: 10px;
  padding: 7px 9px;
  background: #ffffff;
  font-size: 11px;
  color: #7c2d12;
  line-height: 1.35;
}

.agri-search {
  position: relative;
}

.agri-search-input {
  border: 1px solid var(--sb-border);
  border-radius: 10px;
  padding: 8px 10px 8px 32px;
  font-size: 13px;
  width: 260px;
  background: #fff;
  transition: border-color .16s ease, box-shadow .22s ease, background-color .16s ease;
}

.agri-search-input:focus,
.agri-search-input:focus-visible {
  outline: none;
  border-color: #67f7b1;
  box-shadow:
    0 0 0 2px rgba(103, 247, 177, 0.32),
    0 0 0 5px rgba(62, 255, 169, 0.15),
    0 0 16px rgba(62, 255, 169, 0.45);
}

.agri-search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--sb-muted);
  font-size: 16px;
}

.agri-icon-btn {
  width: 34px;
  height: 34px;
  border: 1px solid var(--sb-border);
  background: #fff;
  border-radius: 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--sb-muted);
}

.agri-icon-btn:hover {
  background: var(--sb-hover);
}

.agri-pager {
  width: 30px;
  height: 30px;
  border: 1px solid var(--sb-border);
  background: #fff;
  border-radius: 10px;
  cursor: pointer;
  color: var(--sb-muted);
}

.agri-pager:hover {
  background: var(--sb-hover);
}

.agri-pager.is-active {
  background: #e5e7eb;
  border-color: #d1d5db;
  color: #1f2937;
  font-weight: 600;
}

/* alerts (tree-info uses this too) */

.agri-alert {
  border: 1px solid var(--sb-border);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 13px;
}

.agri-alert.is-danger {
  border-color: #fecaca;
  background: #fff1f2;
  color: #991b1b;
}

/* =========================================================
TREE-DETAIL PAGE (Polaris-ish cards + key/value table + media)
========================================================= */

.agri-section-card {
  background: var(--sb-bg);
  border: 1px solid var(--sb-border);
  border-radius: var(--sb-radius);
  box-shadow: var(--sb-shadow);
  overflow: hidden;
}

.agri-section-head {
  padding: 10px 14px;
  border-bottom: 1px solid var(--sb-border2);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.agri-section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--sb-text);
}

/* mini summary cards */

.agri-mini-card {
  background: var(--sb-bg);
  border: 1px solid var(--sb-border);
  border-radius: 12px;
  box-shadow: var(--sb-shadow);
  padding: 12px;
  display: flex;
  gap: 10px;
  align-items: center;
  height: 100%;
}

.agri-mini-text {
  min-width: 0;
}

.agri-mini-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--sb-border2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  background: #fff;
}

.agri-mini-label {
  font-size: 11px;
  color: var(--sb-muted);
  font-weight: 600;
}

.agri-mini-value {
  font-size: 13px;
  color: var(--sb-text);
  font-weight: 700;
  line-height: 1.2;
}

/* compact top summary strip on tree-detail */
.detail-top-cards .agri-mini-card {
  position: relative;
  min-height: 78px;
  padding: 12px;
  padding-right: 40px;
  gap: 10px;
}

.detail-top-cards .agri-mini-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  font-size: 16px;
}

.detail-top-cards .agri-mini-label {
  font-size: 11px;
  line-height: 1.2;
}

.detail-top-cards .agri-mini-value {
  font-size: 14px;
  line-height: 1.2;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

#sumRemark.agri-pill {
  white-space: normal;
  align-items: flex-start;
  line-height: 1.25;
  max-width: 100%;
  border-radius: 10px;
  padding: 4px 8px;
  font-size: 12px;
}

#sumRemark.agri-pill::before {
  display: none;
}

.detail-top-cards .remark-card {
  align-items: flex-start;
}

.detail-top-cards .remark-value {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.agri-mini-copy {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 36px;
  height: 36px;
  border: 1px solid #dadce0;
  border-radius: 8px;
  background: #fff;
  color: #5f6368;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 2;
  transition: background-color .14s ease, border-color .14s ease, color .14s ease;
}

.agri-mini-copy svg {
  display: none;
}

.agri-mini-copy::before {
  content: "⧉";
  font-size: 20px;
  line-height: 1;
  font-weight: 700;
}

.agri-mini-copy.is-copied::before {
  content: "✓";
  font-size: 21px;
}

.agri-mini-copy:hover {
  background: #f8f9fa;
  border-color: #c9cdd3;
  color: #202124;
}

.agri-mini-copy:active {
  background: #eceff1;
}

.agri-mini-copy:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.24);
}

.agri-mini-copy.is-copied {
  border-color: #34a853;
  color: #188038;
  background: #e6f4ea;
}

.agri-mini-copy.is-copied::after {
  content: "Copied!";
  position: absolute;
  top: -22px;
  right: -2px;
  height: 18px;
  padding: 0 7px;
  border-radius: 999px;
  background: #e6f4ea;
  border: 1px solid #34a853;
  color: #188038;
  font-size: 10px;
  font-weight: 700;
  line-height: 17px;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(24, 128, 56, 0.16);
  pointer-events: none;
}

/* media thumbnails */

.agri-empty-box {
  border: 1px dashed var(--sb-border);
  border-radius: 12px;
  padding: 18px 12px;
  text-align: center;
  color: var(--sb-muted);
  font-size: 13px;
  background: #fff;
}

/* compact key/value (location) */

.agri-kv-compact {
  padding: 12px 14px;
}

.agri-kv-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--sb-border2);
}

.agri-kv-row:last-child {
  border-bottom: 0;
}

.agri-kv-k {
  color: var(--sb-muted);
  font-size: 12px;
  font-weight: 600;
}

.agri-kv-v {
  color: var(--sb-text);
  font-size: 12px;
  font-weight: 700;
  text-align: right;
}

.agri-qr-wrap {
  padding: 0 14px 14px;
}

.agri-qr-img {
  display: block;
  width: 100%;
  max-width: 190px;
  height: auto;
  margin: 0 auto;
  border: 1px solid var(--sb-border2);
  border-radius: 10px;
  background: #fff;
}

/* Polaris-like key/value table */

.agri-kv-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.agri-kv-table tbody tr td, .agri-kv-table tbody tr th {
  border-bottom: 1px solid var(--sb-border2);
  padding: 12px 14px;
  font-size: 13px;
  vertical-align: middle;
}

.agri-kv-table tbody tr:last-child td, .agri-kv-table tbody tr:last-child th {
  border-bottom: 0;
}

.agri-kv-table th {
  width: 240px;
  color: var(--sb-muted);
  font-weight: 600;
  background: #fbfbfc;
}

.agri-kv-table td {
  color: var(--sb-text);
  background: #fff;
}

.agri-kv-table tbody tr:hover td, .agri-kv-table tbody tr:hover th {
  background: var(--sb-hover);
}

.agri-edit-meta {
  font-size: 12px;
  color: #4b5563;
}

.agri-edit-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 12px;
}

.agri-edit-field label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: #6b7280;
  margin-bottom: 4px;
}

.agri-edit-input,
.agri-edit-textarea {
  width: 100%;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background: #fff;
  color: #111827;
  font-size: 12px;
  padding: 7px 9px;
}

.agri-edit-input[readonly],
.agri-edit-input:disabled,
.agri-edit-textarea:disabled {
  background: #f3f4f6;
  color: #6b7280;
  border-color: #d1d5db;
  cursor: not-allowed;
}

.agri-edit-textarea {
  min-height: 72px;
  resize: vertical;
}

.agri-edit-status {
  font-size: 12px;
  color: #374151;
}

.agri-edit-status.is-error {
  color: #b91c1c;
}

.agri-edit-status.is-ok {
  color: #166534;
}

@media (max-width: 576px) {
  .agri-kv-table th {
    width: 160px;
  }

  .agri-edit-grid {
    grid-template-columns: 1fr;
  }
}

/* CMD/CTRL + K hint inside search */

.agri-search {
  position: relative;
}

.agri-search-input {
  padding-right: 86px;
}

.agri-kbd {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  gap: 6px;
  color: black!important;
  pointer-events: none;
}

.agri-kbd-key {
  border: 1px solid var(--sb-border);
  background: #ffffff;
  border-radius: 8px;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 700;
  line-height: 18px;
  box-shadow: 0 1px 0 rgba(16,24,40,.04);
  color: var(--text-main);
}

/* Photo container: gives a tall vertical area */

.agri-media {
  display: block;
  width: 100%;
  background: #fff;
  border: 1px solid var(--sb-border);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--sb-shadow);
}

/* Fill the image box edge-to-edge */

.agri-media-img {
  width: 100%;
  height: 420px;
  object-fit: cover;
  object-position: center;
  display: block;
  background: #f7f7f8;
}

/* On smaller screens, reduce height */

@media (max-width: 992px) {
  .agri-media-img {
    height: 360px;
  }
}

@media (max-width: 576px) {
  .agri-media-img {
    height: 300px;
  }
}

.agri-sort {
  cursor: pointer;
  user-select: none;
}

.agri-sort .sort-ind {
  margin-left: 6px;
  font-size: 12px;
  opacity: .8;
}

/* Tree-info specific mobile layout tuning */
@media (max-width: 991.98px) {
  .agri-map-canvas {
    height: 340px;
  }

  .agri-top-actions {
    justify-content: flex-start;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
  }

  .agri-top-actions .agri-export-btn,
  .agri-top-actions > a.agri-export-btn {
    height: 32px;
    font-size: 12px;
  }

  .agri-top-actions .agri-export-pop {
    flex: 0 0 auto;
  }

  .agri-top-actions .agri-export-panel {
    right: auto;
    left: 0;
    min-width: 190px;
  }

  .agri-kpi-row {
    display: flex !important;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .agri-kpi-card {
    flex: 0 0 150px;
  }

  .agri-tabs {
    gap: 10px;
    padding: 10px !important;
  }

  .agri-filters {
    width: 100%;
    gap: 8px;
  }

  .agri-filter-state {
    max-width: none;
    flex: 1 1 180px;
    min-width: 140px;
  }

  .agri-tabs-spacer {
    display: none;
  }

  .agri-tools {
    width: 100%;
  }

  .agri-dup-toggle {
    margin-left: auto;
  }

  .agri-search {
    width: 100%;
  }

  .agri-search-input {
    width: 100%;
    min-width: 0;
  }

  #addTreeForm.agri-edit-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 575.98px) {
  .agri-map-canvas {
    height: 300px;
  }

  .agri-map-head {
    padding: 9px 10px;
  }

  .agri-map-title {
    font-size: 12px;
  }

  .agri-map-meta {
    font-size: 10px;
  }

  .agri-top-actions .agri-export-btn,
  .agri-top-actions > a.agri-export-btn,
  .agri-top-actions #addTreeToggleBtn {
    width: 100%;
    justify-content: center;
  }

  .agri-top-actions .agri-export-pop {
    width: 100%;
  }

  .agri-top-actions .agri-export-pop > .agri-export-btn {
    width: 100%;
  }

  .agri-top-actions .agri-export-panel {
    left: 0;
    right: 0;
    width: 100%;
    min-width: 0;
  }

  .agri-kpi-card {
    flex-basis: 142px;
    padding-right: 44px;
  }

  .agri-kpi-label {
    font-size: 10px;
  }

  .agri-kpi-value {
    font-size: 14px;
  }
}

@media (max-width: 600px) {
  .agri-map-canvas {
    height: 320px !important;
  }

  .map-overlay-left-stack {
    top: 8px;
    left: 8px;
    right: 8px;
    max-width: calc(100% - 16px);
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 5px;
    z-index: 7;
    padding-bottom: 2px;
  }

  .agri-map-temp,
  .agri-map-wind-speed,
  .agri-map-soil,
  .agri-map-extra {
    flex: 0 0 auto;
    max-width: none;
    min-width: 0;
    height: 22px;
    font-size: 10px;
    white-space: nowrap;
  }

  .agri-map-legend {
    left: 8px;
    right: 8px;
    bottom: 8px;
    width: auto;
    min-width: 0;
    max-height: 84px;
    overflow: auto;
    padding: 6px 7px;
  }

  .map-legend-title {
    font-size: 10px;
    margin-bottom: 3px;
  }

  .map-legend-item {
    margin: 2px 0;
    gap: 6px;
  }

  .map-legend-label {
    font-size: 9px;
    line-height: 1.15;
  }

  .agri-table {
    min-width: 0 !important;
    width: 100%;
  }

  /* Keep only No Siri, Nama Pokok, Tree ID on small screens */
  .agri-table thead th:nth-child(1),
  .agri-table tbody td:nth-child(1),
  .agri-table thead th:nth-child(5),
  .agri-table tbody td:nth-child(5),
  .agri-table thead th:nth-child(6),
  .agri-table tbody td:nth-child(6),
  .agri-table thead th:nth-child(7),
  .agri-table tbody td:nth-child(7),
  .agri-table thead th:nth-child(8),
  .agri-table tbody td:nth-child(8),
  .agri-table thead th:nth-child(9),
  .agri-table tbody td:nth-child(9) {
    display: none;
  }

  .agri-table thead th,
  .agri-table tbody td {
    font-size: 11px;
    padding: 6px 6px;
  }

  .agri-table thead th:nth-child(2),
  .agri-table tbody td:nth-child(2) {
    width: 42%;
  }

  .agri-table thead th:nth-child(3),
  .agri-table tbody td:nth-child(3) {
    width: 42%;
  }

  .agri-table thead th:nth-child(4),
  .agri-table tbody td:nth-child(4) {
    width: 16%;
    text-align: right;
  }
}

/* iPhone-sized optimization pass */
@media (max-width: 430px) {
  .text-main.py-5 {
    padding-top: 10px !important;
    padding-bottom: 14px !important;
  }

  .text-main .container.py-3 {
    padding-top: 8px !important;
    padding-bottom: 8px !important;
  }

  .agri-map-overview {
    border-radius: 10px;
  }

  .agri-map-head {
    padding: 8px;
    gap: 6px;
  }

  .agri-map-title {
    font-size: 12px;
    line-height: 1.2;
  }

  .agri-map-head-right {
    width: 100%;
    gap: 6px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
  }

  .agri-map-meta {
    width: 100%;
    font-size: 10px;
    line-height: 1.2;
    order: 3;
  }

  .agri-map-base-switch {
    max-width: calc(100vw - 34px);
  }

  .agri-map-canvas {
    height: 280px;
  }

  .map-overlay-left-stack {
    top: 8px;
    left: 8px;
    max-width: calc(100% - 16px);
    gap: 4px;
  }

  .agri-map-temp,
  .agri-map-wind-speed,
  .agri-map-soil,
  .agri-map-extra {
    height: 21px;
    padding: 0 7px;
    font-size: 9px;
    max-width: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .agri-map-legend {
    left: 8px;
    right: 8px;
    bottom: 8px;
    width: auto;
    min-width: 0;
    padding: 6px 7px;
    max-height: 80px;
    overflow: auto;
  }

  .map-legend-title {
    font-size: 10px;
    margin-bottom: 4px;
  }

  .map-legend-label {
    font-size: 9px;
  }

  .agri-top-actions {
    gap: 6px;
  }

  .agri-top-actions .me-2 {
    margin-right: 0 !important;
  }

  .agri-top-actions > * {
    width: 100%;
    min-width: 0;
  }

  .agri-top-actions .agri-export-pop > .agri-export-btn,
  .agri-top-actions .agri-export-btn,
  .agri-top-actions > a.agri-export-btn,
  .agri-top-actions #addTreeToggleBtn {
    width: 100%;
    min-height: 34px;
    height: 34px;
    font-size: 12px !important;
    font-weight: 700;
    color: #0f172a !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .agri-kpi-row {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0;
    overflow: hidden;
  }

  .agri-kpi-card {
    flex: initial !important;
    min-width: 0;
    flex-basis: auto !important;
    padding: 6px 30px 6px 8px;
  }

  .agri-kpi-card + .agri-kpi-card {
    border-left: 0;
  }

  .agri-kpi-card:nth-child(odd) {
    border-right: 1px solid #e5e7eb;
  }

  .agri-kpi-card {
    border-top: 1px solid #e5e7eb;
  }

  .agri-kpi-card:nth-child(-n+2) {
    border-top: 0;
  }

  .agri-kpi-label {
    font-size: 9px;
  }

  .agri-kpi-value {
    font-size: 16px;
  }

  .agri-tabs {
    padding: 8px !important;
    border-radius: 12px !important;
    gap: 8px;
  }

  .agri-filters {
    width: 100%;
    gap: 6px;
  }

  .agri-filter-icon-wrap,
  .agri-filter-glyph,
  .agri-filter-clear {
    width: 28px;
    height: 28px;
    border-radius: 8px;
  }

  .agri-filter-state {
    flex: 1 1 140px;
    min-width: 0;
    max-width: 100%;
    font-size: 10px;
    height: 28px;
  }

  .agri-tools,
  .agri-search {
    width: 100%;
  }

  .agri-dup-toggle {
    width: 100%;
    height: 32px;
    font-size: 11px;
  }

  .agri-dup-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .agri-dup-meta {
    white-space: normal;
  }

  .agri-search-input {
    width: 100%;
    min-width: 0;
    height: 34px;
    font-size: 12px;
    padding-left: 30px;
    padding-right: 70px;
  }

  .agri-kbd {
    right: 8px;
    gap: 4px;
  }

  .agri-kbd-key {
    padding: 1px 6px;
    font-size: 10px;
    line-height: 16px;
  }

  .agri-table-wrap {
    overflow-x: auto;
  }

  .agri-card-header,
  .agri-card-footer {
    padding: 8px 10px;
  }
}

/* Mobile map UX overrides: larger map, inline controls, inline legend */
@media (max-width: 600px) {
  .agri-map-head {
    flex-wrap: nowrap;
    align-items: center;
    gap: 6px;
  }

  .agri-map-title {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .agri-map-head-right {
    flex: 1 1 auto;
    min-width: 0;
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: nowrap;
    gap: 4px;
  }

  .agri-map-base-switch {
    flex: 1 1 auto;
    min-width: 0;
    max-width: none;
    gap: 4px;
    padding: 2px;
  }

  .agri-map-base-btn,
  .agri-map-wind-btn {
    height: 20px;
    padding: 0 7px;
    font-size: 10px;
  }

  .agri-map-meta {
    display: none;
  }

  .agri-map-canvas {
    height: 340px !important;
  }

  .agri-map-legend {
    left: 8px;
    right: 8px;
    bottom: 8px;
    width: auto;
    min-width: 0;
    max-height: none;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 2px 4px;
    overflow: visible;
    white-space: normal;
    padding: 4px 5px;
  }

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

  .map-legend-item {
    margin: 0;
    gap: 3px;
    min-width: 0;
    justify-content: center;
  }

  .map-legend-label {
    font-size: 8px;
    line-height: 1.1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .map-legend-shape {
    width: 8px;
    height: 8px;
    border-width: 1px;
  }
}

@media (max-width: 430px) {
  .agri-map-canvas {
    height: 320px !important;
  }

  .agri-map-title {
    font-size: 11px;
  }

  .agri-map-base-btn,
  .agri-map-wind-btn {
    height: 19px;
    padding: 0 6px;
    font-size: 9px;
  }
}

/* Hover-reveal map overlays + subtle compact style */
.agri-map-canvas {
  height: 490px;
}

.agri-map-canvas .map-overlay-left-stack,
.agri-map-canvas .agri-map-legend {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: none;
  transition: none;
}

.agri-map-temp,
.agri-map-wind-speed,
.agri-map-soil,
.agri-map-extra {
  height: 22px;
  padding: 0 8px;
  font-size: 10px;
  font-weight: 600;
  color: #475569;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(248, 250, 252, 0.56);
  box-shadow: 0 3px 9px rgba(15, 23, 42, 0.10);
  -webkit-backdrop-filter: blur(5px) saturate(105%);
  backdrop-filter: blur(5px) saturate(105%);
}

.agri-map-legend {
  min-width: 150px;
  padding: 6px 7px;
  border-radius: 9px;
  background: rgba(248, 250, 252, 0.62);
  border: 1px solid rgba(148, 163, 184, 0.38);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.10);
  -webkit-backdrop-filter: blur(5px) saturate(105%);
  backdrop-filter: blur(5px) saturate(105%);
  scrollbar-width: none;
}

.map-legend-title {
  font-size: 10px;
  color: #64748b;
  margin-bottom: 4px;
}

.map-legend-item {
  gap: 6px;
  margin: 2px 0;
}

.map-legend-label {
  font-size: 10px;
  color: #64748b;
}

.map-legend-shape {
  width: 10px;
  height: 10px;
  opacity: 0.86;
}

.agri-map-legend::-webkit-scrollbar,
.map-overlay-left-stack::-webkit-scrollbar,
.agri-map-base-switch::-webkit-scrollbar {
  display: none;
}

.map-overlay-left-stack,
.agri-map-base-switch {
  scrollbar-width: none;
}

@media (max-width: 600px) {
  .agri-map-canvas {
    height: 380px !important;
  }

  .map-overlay-left-stack {
    right: 8px;
  }

  .agri-map-canvas .maplibregl-ctrl-top-right {
    top: 34px;
    right: 6px;
    z-index: 12;
  }

  .agri-map-canvas .maplibregl-ctrl-group {
    border-radius: 8px;
    overflow: hidden;
  }

  .agri-map-canvas .maplibregl-ctrl-group button {
    width: 24px;
    height: 24px;
  }

  .agri-map-canvas .maplibregl-ctrl-group button .maplibregl-ctrl-icon {
    background-size: 14px 14px;
  }

  .leaflet-control-zoom a {
    width: 24px !important;
    height: 24px !important;
    line-height: 24px !important;
    font-size: 14px !important;
  }

  .agri-map-legend {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 2px 4px;
    padding: 4px 5px;
  }
}

@media (max-width: 430px) {
  .agri-map-canvas {
    height: 360px !important;
  }

  .map-overlay-left-stack {
    right: 8px;
  }

  .agri-map-canvas .maplibregl-ctrl-top-right {
    top: 32px;
  }

  .agri-map-canvas .maplibregl-ctrl-group button {
    width: 22px;
    height: 22px;
  }

  .agri-map-canvas .maplibregl-ctrl-group button .maplibregl-ctrl-icon {
    background-size: 12px 12px;
  }

  .leaflet-control-zoom a {
    width: 22px !important;
    height: 22px !important;
    line-height: 22px !important;
    font-size: 13px !important;
  }

  .agri-map-legend {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 2px 3px;
    padding: 4px 4px;
  }
}

/* Final mobile action-button normalization */
@media (max-width: 600px) {
  .agri-top-actions {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: stretch;
    gap: 0;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
    overflow: hidden;
  }

  .agri-top-actions > * {
    flex: 0 0 33.3333%;
    width: 33.3333%;
    max-width: 33.3333%;
    min-width: 0;
    display: flex;
    align-items: stretch;
  }

  .agri-top-actions #addTreeToggleBtn,
  .agri-top-actions > a.agri-export-btn,
  .agri-top-actions .agri-export-pop,
  .agri-top-actions .agri-export-pop > .agri-export-btn {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box;
  }

  .agri-top-actions > * + * {
    border-left: 1px solid #e2e8f0;
  }

  .agri-top-actions #addTreeToggleBtn,
  .agri-top-actions > a.agri-export-btn,
  .agri-top-actions .agri-export-pop > .agri-export-btn {
    height: 34px !important;
    min-height: 34px !important;
    padding: 0 12px !important;
    margin: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    background: transparent !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    line-height: 34px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }
}
