:root {
  --bg: #0b1220;
  --pane: #0f172a;
  --ink: #e5e7eb;
  --mut: #94a3b8;
  --line: #1f2937;
  --pri: #2563eb;
  --pri-2: #1d4ed8;
  --sec: #0ea5e9;
  --bad: #ef4444;
  --ok: #16a34a;
  --hint: #93c5fd;
  --white: #fff;
}

body.a11y-contrast {
  --bg: #010101;
  --pane: #000;
  --ink: #fefce8;
  --mut: #fef08a;
  --line: #fde047;
  --pri: #f97316;
  --pri-2: #ea580c;
  --sec: #fb7185;
  --bad: #fb7185;
  --ok: #4ade80;
  --hint: #fef08a;
}

body.a11y-contrast {
  letter-spacing: .01em;
  font-weight: 520;
}


* {
  box-sizing: border-box
}

html,
body {
  margin: 0;
  font-family: Inter, system-ui, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  height: 100%;
  overflow: hidden;
}

#map {
  height: var(--app-h, 100svh);
  width: 100%;
}

/* Leaflet zoom control — tema gelap */
.leaflet-control-zoom.leaflet-bar {
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .35);
}

.leaflet-control-zoom a {
  background: #0f172a;
  color: #e5e7eb;
  border-bottom: 1px solid rgba(148, 163, 184, .18);
  width: 38px;
  height: 38px;
  line-height: 38px;
}

.leaflet-control-zoom a:last-child {
  border-bottom: 0;
}

.leaflet-control-zoom a:hover {
  background: #111827;
  color: #fff;
}

.leaflet-control-zoom a:focus {
  outline: 2px solid rgba(96, 165, 250, .65);
  outline-offset: 2px;
}

.home-control a.home-btn {
  width: 30px;
  /* samakan dengan tombol zoom */
  height: 30px;
  display: flex;
  /* center horizontal + vertical */
  align-items: center;
  justify-content: center;
  padding: 0 !important;
  background-color: #0C1222;
  /* warna sama dengan zoom control */
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}

.home-control a.home-btn:hover {
  background-color: #121b33;
  /* efek hover seperti zoom */
}

.home-control .home-svg {
  width: 18px;
  height: 18px;
  fill: white;
  /* bikin ikon jadi putih */
  display: block;
}


/* Toolbar collapse/expand yang nempel di bawah top actions */
.card-toolbar {
  display: flex;
  gap: 6px;
  margin: 6px 0 8px;
  align-self: flex-start;
  flex-wrap: wrap;
}

.card-toolbar .btn.icon {
  background: #0f172a;
  border: 1px solid var(--line);
  box-shadow: none;
}

.card-toolbar .btn.icon:hover {
  background: #111827;
  transform: none;
  /* matikan “naik 1px” supaya stabil */
}

/* Mobile: rapatkan dan kecilkan sedikit */
@media (max-width: 768px) {
  .card-toolbar {
    gap: 4px;
  }

  .card-toolbar .btn.icon {
    width: 34px;
    height: 34px;
  }
}

/* animasi sederhana: fade konten saat collapse */
.card> :not(.panel-title) {
  transition: opacity .18s ease;
}

.card.collapsed> :not(.panel-title) {
  opacity: 0;
}


/* Toast */
.toast-wrap {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1200;
  display: flex;
  flex-direction: column;
  gap: 8px
}

.toast {
  padding: 10px 14px;
  border-radius: 10px;
  background: #111827;
  color: #e5e7eb;
  border: 1px solid rgba(148, 163, 184, .25);
  box-shadow: 0 10px 24px rgba(0, 0, 0, .35);
  opacity: .98
}

/* Toolbox */
.toolbox {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 1000;
  display: flex;
  gap: 10px;
  flex-direction: column;
  width: 500px;
  max-width: 92vw;
  max-height: calc(var(--app-h, 100svh) - 32px);
  overflow: auto;
  overscroll-behavior: contain;
}

.card {
  background: rgba(15, 23, 42, .9);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(148, 163, 184, .25);
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .35);
  padding: 8px
}

.btn {
  appearance: none;
  border: 0;
  border-radius: 12px;
  padding: 8px 8px;
  background: var(--pri);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(37, 99, 235, .35);
  transition: .18s
}

.btn:hover {
  filter: brightness(.98);
  transform: translateY(-1px)
}

.btn.secondary {
  background: var(--sec)
}

.btn.gray {
  background: #475569
}

.btn.bad {
  background: var(--bad)
}

.btn.ghost {
  background: #e5e7eb;
  color: #0b1220
}

.btn:disabled {
  opacity: .55;
  cursor: not-allowed
}

.btn.sm {
  padding: 6px 10px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 12px;
  line-height: 1
}

.btn.icon {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  padding: 0;
  display: grid;
  place-items: center;
  line-height: 1;
  background: #334155
}

.btn.icon svg {
  width: 18px;
  height: 18px;
  stroke: #fff
}

.btn:focus-visible {
  outline: 3px solid rgba(96, 165, 250, .7);
  outline-offset: 2px
}

.a11y-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: 999px
}

.a11y-toggle .a11y-toggle-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: #94a3b8;
  border: 2px solid rgba(148, 163, 184, .5);
  transition: .2s ease
}

.a11y-toggle .a11y-toggle-text {
  white-space: nowrap
}

.a11y-toggle.active .a11y-toggle-dot {
  background: #0f172a;
  border-color: #0f172a;
  transform: scale(1.1)
}

.a11y-toggle.active .a11y-toggle-text {
  font-weight: 700
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px
}

.chip {
  background: #1d4ed8;
  color: #fff;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 12px
}

.muted {
  color: var(--mut);
  font-size: 13px
}

.searchbox {
  display: flex;
  gap: 8px;
  margin: 8px 0
}

.searchbox input {
  flex: 1;
  padding: 10px 12px;
  border: 2px solid rgba(148, 163, 184, .3);
  border-radius: 10px;
  background: #0b1220;
  color: #e5e7eb
}

.toggles {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-top: 8px;
  flex-wrap: wrap
}

.toggles label {
  display: flex;
  gap: 8px;
  align-items: center;
  color: var(--mut);
  font-size: 13px
}

.bulk-actions {
  display: flex;
  gap: 8px;
  margin: 10px 0 6px
}

.active-groups {
  margin-top: 10px;
  overflow: auto;
  /* Follow viewport height but keep space for header/controls */
  max-height: calc(var(--app-h, 100vh) - 260px);
}

@media (max-width: 768px) {
  .active-groups {
    max-height: calc(var(--app-h, 100vh) - 300px);
  }
}

.row-top-actions {
  display: flex;
  gap: 8px
}

.group {
  border: 1px solid rgba(148, 163, 184, .25);
  border-radius: 12px;
  margin-top: 10px;
  overflow: hidden;
  background: rgba(2, 6, 23, .45)
}

.group-head {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: space-between;
  padding: 10px 12px;
  background: rgba(15, 23, 42, .6);
  cursor: pointer;
  border-bottom: 1px solid rgba(148, 163, 184, .15)
}

.group-head .title {
  display: flex;
  align-items: center;
  gap: 10px
}

.group-body {
  padding: 10px
}

.group.collapsed .group-body {
  display: none
}

.badge {
  background: #1f2937;
  color: #cbd5e1;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 11px
}

.layer-row {
  display: grid;
  grid-template-columns: 1fr 42px;
  gap: 12px;
  padding: 12px;
  border: 1px solid rgba(148, 163, 184, .25);
  border-radius: 12px;
  background: rgba(2, 6, 23, .6);
  margin-bottom: 10px
}

.row-head {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 28px
}

.row-head label {
  font-weight: 700
}

.row-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
  align-items: center
}

.row-tools .group-mini {
  display: flex;
  gap: 8px;
  align-items: center
}

.row-actions {
  width: 42px;
  display: grid;
  grid-auto-rows: 36px;
  gap: 8px;
  justify-items: center;
  align-content: start;
  padding-top: 4px
}

.legend {
  margin-top: 10px;
  display: none;
  padding: 8px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid #d1d5db;
  color: #111827
}

.legend.open {
  display: block
}

.legend img {
  max-width: 100%;
  background: #fff;
  border-radius: 6px;
  display: block
}

/* High Contrast overrides */
body.a11y-contrast .toolbox {
  filter: none
}

body.a11y-contrast .card,
body.a11y-contrast .group,
body.a11y-contrast .list,
body.a11y-contrast .legend,
body.a11y-contrast .modal,
body.a11y-contrast .leaflet-sidebar-right,
body.a11y-contrast #coordHud,
body.a11y-contrast .toast,
body.a11y-contrast .bm-card {
  background: #000 !important;
  border: 2px solid rgba(254, 240, 138, .8) !important;
  color: #fefce8 !important;
  box-shadow: none;
}

body.a11y-contrast .group-head {
  background: #0a0a0a;
  border-bottom: 2px solid rgba(254, 240, 138, .4)
}

body.a11y-contrast .searchbox input,
body.a11y-contrast .search input,
body.a11y-contrast .search select,
body.a11y-contrast .modal .list,
body.a11y-contrast .modal .preview-img {
  background: #000;
  color: #fefce8;
  border: 2px solid rgba(254, 240, 138, .6)
}

body.a11y-contrast .muted {
  color: #fefce8;
  font-weight: 600
}

body.a11y-contrast .btn {
  background: #facc15;
  color: #050505;
  border: 2px solid #0f172a;
  box-shadow: none
}

body.a11y-contrast .btn.secondary {
  background: #fb923c
}

body.a11y-contrast .btn.gray {
  background: #38bdf8;
  color: #021a2a
}

body.a11y-contrast .btn.bad {
  background: #fb7185;
  color: #3b0a10
}

body.a11y-contrast .btn.ghost {
  background: #fde68a;
  color: #1e293b
}

body.a11y-contrast .btn:focus-visible {
  outline: 3px solid #facc15;
  outline-offset: 2px
}

body.a11y-contrast .a11y-toggle {
  background: #000;
  color: #fefce8;
  border: 2px solid rgba(254, 240, 138, .7)
}

body.a11y-contrast .a11y-toggle .a11y-toggle-dot {
  background: #fef08a;
  border-color: #fef08a
}

body.a11y-contrast .leaflet-control-zoom a {
  background: #000;
  color: #fef3c7;
  border-bottom: 1px solid rgba(254, 240, 138, .4)
}

body.a11y-contrast .leaflet-control-zoom a:hover {
  background: #111827;
  color: #facc15
}

body.a11y-contrast .leaflet-control-zoom {
  border-color: rgba(254, 240, 138, .6)
}

body.a11y-contrast .leaflet-sidebar-right {
  border-color: rgba(254, 240, 138, .6)
}

body.a11y-contrast .close-right {
  background: #fb923c;
  color: #1e1e1e;
  border: 2px solid #fef08a
}

body.a11y-contrast .backdrop {
  background: rgba(0, 0, 0, .85)
}

body.a11y-contrast .bm-item {
  background: #050505;
  border: 2px solid rgba(254, 240, 138, .4)
}

body.a11y-contrast .tag {
  border-color: rgba(254, 240, 138, .4);
  color: #fefce8
}

body.a11y-contrast .table-sticky thead th {
  background: #050505
}

body.a11y-contrast .legend {
  color: #fefce8
}

body.a11y-contrast .row-top-actions .btn {
  min-height: 44px
}

body.a11y-contrast .panel-title strong {
  color: #fef08a
}

/* Keyboard shortcuts overlay */
.shortcut-overlay {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, .78);
  backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1400;
  padding: 20px
}

.shortcut-overlay.open {
  display: flex
}

.shortcut-panel {
  width: min(520px, 92vw);
  background: #020617;
  border: 1px solid rgba(148, 163, 184, .35);
  border-radius: 20px;
  box-shadow: 0 40px 80px rgba(0, 0, 0, .55);
  padding: 22px;
  color: #e5e7eb;
  position: relative
}

.shortcut-panel h3 {
  margin: 0;
  font-size: 1.4rem;
  color: #fff
}

.shortcut-subtitle {
  margin: 4px 0 16px;
  color: #94a3b8;
  font-size: 14px
}

.shortcut-close {
  position: absolute;
  top: 14px;
  right: 14px;
  border: 0;
  background: #1e293b;
  color: #f8fafc;
  width: 34px;
  height: 34px;
  border-radius: 12px;
  font-size: 20px;
  cursor: pointer
}

.shortcut-close:hover {
  background: #334155
}

.shortcut-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-top: 12px
}

.shortcut-item {
  border: 1px solid rgba(148, 163, 184, .3);
  border-radius: 12px;
  padding: 10px;
  background: rgba(15, 23, 42, .85)
}

.shortcut-item .keys {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px
}

.shortcut-item .keys span {
  color: #64748b;
  font-weight: 600
}

.shortcut-item kbd {
  display: inline-block;
  min-width: 28px;
  padding: 4px 8px;
  border-radius: 8px;
  background: #0f172a;
  border: 1px solid rgba(148, 163, 184, .35);
  font-size: 13px;
  text-align: center
}

.shortcut-item .desc {
  font-size: 13px;
  color: #cbd5e1
}

.shortcut-actions {
  margin-top: 18px;
  display: flex;
  gap: 10px;
  justify-content: flex-end
}

body.a11y-contrast .shortcut-panel {
  background: #000;
  border: 2px solid rgba(254, 240, 138, .8);
  color: #fefce8
}

body.a11y-contrast .shortcut-item {
  background: #050505;
  border: 2px solid rgba(254, 240, 138, .4)
}

body.a11y-contrast .shortcut-item kbd {
  background: #111;
  border-color: #fef08a;
  color: #fefce8
}

body.a11y-contrast .shortcut-subtitle {
  color: #fef08a
}

body.a11y-contrast .shortcut-close {
  background: #facc15;
  color: #1e1e1e;
  border: 2px solid #78350f
}

/* Right panel */
.leaflet-sidebar-right {
  position: absolute;
  top: 0;
  right: 0;
  height: 100%;
  width: 700px;
  background: rgba(15, 23, 42, .98);
  border-left: 1px solid rgba(148, 163, 184, .25);
  box-shadow: -10px 0 40px rgba(0, 0, 0, .45);
  z-index: 1050;
  display: none
}

.leaflet-sidebar-right.open {
  display: block
}

.leaflet-sidebar-right .content {
  padding: 18px;
  max-height: 100%;
  overflow: auto
}

.close-right {
  position: absolute;
  top: 12px;
  right: 12px;
  border: 0;
  background: #334155;
  color: #fff;
  border-radius: 10px;
  padding: 8px 10px;
  cursor: pointer
}

.error-banner {
  display: none;
  margin-bottom: 10px;
  border: 1px solid rgba(239, 68, 68, .5);
  background: rgba(127, 29, 29, .4);
  color: #fecaca;
  padding: 10px 12px;
  border-radius: 10px
}

.error-banner.show {
  display: block
}

/* Modal Explore */
.backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, .65);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1100
}

.backdrop.open {
  display: flex
}

.modal {
  width: min(1080px, 94vw);
  max-height: 88vh;
  overflow: hidden;
  border-radius: 20px;
  background: rgba(15, 23, 42, .98);
  border: 1px solid rgba(148, 163, 184, .25);
  box-shadow: 0 24px 70px rgba(0, 0, 0, .6);
  display: grid;
  grid-template-columns: 380px 1fr
}

.modal .left {
  border-right: 1px solid rgba(148, 163, 184, .2);
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px
}

.modal .right {
  padding: 16px 16px 0 16px;
  display: flex;
  flex-direction: column
}

/* Power Filter modal: ensure scrollable columns + sticky footer */
#pfBackdrop .modal {
  height: 92vh;
  max-height: 92vh;
  width: min(1120px, 96vw);
}

#pfBackdrop .modal .left,
#pfBackdrop .modal .right {
  overflow: auto;
  min-height: 0;
  overscroll-behavior: contain;
}

#pfBackdrop .modal .left {
  padding-bottom: 72px;
}

#pfBackdrop .modal .left .footer {
  position: sticky;
  bottom: 0;
  background: rgba(15, 23, 42, .98);
  border-top: 1px solid rgba(148, 163, 184, .2);
  padding-top: 10px;
  margin-top: 8px;
  z-index: 1;
}

/* Stack columns on small screens for PF modal */
@media (max-width: 768px) {
  #pfBackdrop .modal {
    grid-template-columns: 1fr;
  }
}

.tabs {
  display: flex;
  gap: 8px
}

.tab {
  flex: 1;
  border: 1px solid rgba(148, 163, 184, .25);
  background: #0b1220;
  color: #e5e7eb;
  border-radius: 10px;
  padding: 10px 12px;
  cursor: pointer
}

.tab.active {
  background: linear-gradient(135deg, var(--pri), var(--pri-2));
  color: #fff;
  border-color: transparent
}

.search {
  display: flex;
  gap: 8px
}

.search input,
.search select {
  flex: 1;
  padding: 10px 12px;
  border: 2px solid rgba(148, 163, 184, .3);
  border-radius: 10px;
  background: #0b1220;
  color: #e5e7eb
}

.modal .search--catalogue {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: stretch;
}

.modal .search--catalogue input {
  min-width: 0;
}

.modal .search--catalogue select.workspace-filter {
  width: 100%;
  min-width: 0;
}

.modal .search--catalogue #selectAll {
  width: 100%;
}

.list {
  overflow: auto;
  border: 1px solid rgba(148, 163, 184, .25);
  border-radius: 12px;
  max-height: 56vh;
  background: #0b1220
}

.item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px;
  border-bottom: 1px solid rgba(148, 163, 184, .15)
}

.item:last-child {
  border-bottom: 0
}

.item:hover {
  background: rgba(148, 163, 184, .08)
}

.item-title {
  font-weight: 700
}

.tag {
  background: #0b1220;
  border: 1px solid rgba(148, 163, 184, .25);
  border-radius: 999px;
  font-size: 11px;
  padding: 2px 8px;
  color: #cbd5e1
}

.preview-img {
  width: 100%;
  display: block;
  background: #0b1220;
  border: 1px solid rgba(148, 163, 184, .3);
  border-radius: 12px
}

.footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding: 12px 16px;
  border-top: 1px solid rgba(148, 163, 184, .25);
  background: rgba(2, 6, 23, .4)
}


/* Skeleton */
.skeleton {
  position: relative;
  overflow: hidden;
  background: #111827;
  border-radius: 10px
}

.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .06), transparent);
  transform: translateX(-100%);
  animation: shimmer 1.2s infinite
}

@keyframes shimmer {
  100% {
    transform: translateX(100%)
  }
}

.table-sticky thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: rgba(15, 23, 42, .98);
}

/* Collapsible cards */
.card {
  position: relative;
}

.card .panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  overflow: visible;
}

.panel-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.panel-toggle .chev {
  transition: transform .2s ease;
}

.card.collapsed> :not(.panel-title) {
  display: none !important;
}

.card.collapsed {
  padding-bottom: 8px;
}

.card.collapsed .panel-toggle .chev {
  transform: rotate(-90deg);
}


/* Basemap modal */
.bm-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: none
}

.bm-modal.open {
  display: block
}

.bm-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 23, .6);
  backdrop-filter: blur(2px)
}

.bm-card {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(880px, 92vw);
  background: #0b1220;
  border: 1px solid #1f2937;
  border-radius: 14px;
  box-shadow: 0 25px 80px rgba(0, 0, 0, .45);
  padding: 16px;
  color: #cbd5e1;
}

.bm-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px
}

.bm-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
  margin-top: 6px
}

.bm-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: #0f172a;
  border: 1px solid #1f2937;
  border-radius: 10px;
  padding: 8px;
  cursor: pointer
}

.bm-item:hover {
  outline: 1px solid #3b82f6
}

.bm-thumb {
  height: 96px;
  border-radius: 8px;
  background: #111
}

.bm-thumb.OSM {
  background-image: url('https://a.tile.openstreetmap.org/5/30/17.png');
  background-size: cover
}

.bm-thumb.ESRI_IMG {
  background-image: url('https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/5/17/30');
  background-size: cover
}

.bm-thumb.ESRI_GRAY {
  background: linear-gradient(180deg, #bfc5cf, #d8dde6)
}

.bm-thumb.ESRI_GRAY_DARK {
  background: linear-gradient(180deg, #222831, #2c3440)
}

.bm-thumb.OPENTOP {
  background-image: url('https://a.tile.opentopomap.org/5/30/17.png');
  background-size: cover
}

.bm-label {
  font-size: 12px;
  color: #94a3b8
}

.bm-tools {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  flex-wrap: wrap
}

.bm-switch {
  display: flex;
  gap: 8px;
  align-items: center
}

.bm-sliders {
  display: flex;
  gap: 16px
}

.bm-sliders label {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 12px;
  color: #94a3b8
}

.bm-sliders input[type="range"] {
  width: 180px
}


.dropzone {
  border: 1px dashed #334155;
  border-radius: 10px;
  padding: 12px;
  text-align: center;
  color: #94a3b8;
  background: rgba(2, 6, 23, .4);
}

.dropzone.highlight {
  border-color: #60a5fa;
  background: rgba(59, 130, 246, .08);
  color: #cbd5e1;
}

.dropzone {
  pointer-events: auto;
}

#importList .row .btn.sm {
  padding: 6px 8px
}


/* Export modal */
.export-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: none
}

.export-modal.open {
  display: block
}

.export-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 23, .6);
  backdrop-filter: blur(2px)
}

.export-card {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(560px, 92vw);
  background: #0b1220;
  border: 1px solid #1f2937;
  border-radius: 14px;
  box-shadow: 0 25px 80px rgba(0, 0, 0, .45);
  padding: 16px;
  color: #cbd5e1
}

.export-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px
}

.export-body {
  display: flex;
  gap: 16px;
  flex-wrap: wrap
}

.export-body .exp-col {
  background: #0f172a;
  border: 1px solid #1f2937;
  border-radius: 10px;
  padding: 10px;
  flex: 1;
  min-width: 180px
}

.export-body label {
  font-size: 12px;
  color: #94a3b8
}

.export-body .ck {
  display: block;
  margin-top: 6px;
  color: #cbd5e1
}

.export-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px
}

/* Command palette */
#cmdk {
  position: fixed;
  inset: 0;
  z-index: 1300;
  display: none
}

#cmdk.open {
  display: block
}

.cmdk-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, .6);
  backdrop-filter: blur(2px)
}

.cmdk-card {
  position: absolute;
  top: 18%;
  left: 50%;
  transform: translateX(-50%);
  width: min(720px, 92vw);
  background: #0b1220;
  border: 1px solid #1f2937;
  border-radius: 14px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, .45);
  padding: 12px
}

#cmdkInput {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid #1f2937;
  background: #0f172a;
  color: #e5e7eb
}

.cmdk-list {
  margin-top: 10px;
  max-height: 48vh;
  overflow: auto
}

.cmdk-item {
  padding: 10px 12px;
  border-radius: 8px;
  color: #cbd5e1;
  border: 1px solid transparent;
  cursor: pointer
}

.cmdk-item:hover,
.cmdk-item.active {
  background: #111827;
  border-color: #334155
}

.cmdk-empty {
  padding: 12px;
  color: #94a3b8
}

.cmdk-hint {
  margin-top: 8px;
  color: #64748b;
  font-size: 12px
}

/* Export progress overlay */
.export-progress {
  position: fixed;
  inset: 0;
  z-index: 1400;
  display: none
}

.export-progress.open {
  display: block
}

.export-progress .ep-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, .55);
  backdrop-filter: blur(2px)
}

.export-progress .ep-card {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #0b1220;
  border: 1px solid #1f2937;
  border-radius: 14px;
  padding: 16px 18px;
  min-width: 220px;
  color: #cbd5e1;
  display: flex;
  gap: 12px;
  align-items: center;
  box-shadow: 0 25px 60px rgba(0, 0, 0, .45)
}

.ep-spinner {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  border: 3px solid #334155;
  border-top-color: #60a5fa;
  animation: epSpin .9s linear infinite
}

@keyframes epSpin {
  to {
    transform: rotate(360deg)
  }
}

.ep-text {
  font: 500 13px system-ui, sans-serif
}

/* Pinned legend (saat export kita pakai versi light) */
#pinnedLegendStack img {
  border-radius: 8px
}



.feature-info .kv {
  width: 100%;
  border-collapse: collapse;
  margin-top: 6px
}

.feature-info .kv th {
  width: 32%;
  text-align: left;
  padding: 8px 10px;
  background: rgba(148, 163, 184, .12);
  color: #cbd5e1;
  border-bottom: 1px solid rgba(148, 163, 184, .18)
}

.feature-info .kv td {
  padding: 8px 10px;
  border-bottom: 1px solid rgba(148, 163, 184, .12)
}

.feature-info details summary {
  cursor: pointer;
  opacity: .85
}

/* North Arrow */
.leaflet-control.north-arrow {
  background: transparent;
  box-shadow: none;
}

.north-arrow .na-stack {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-end;
}

.north-arrow .na-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border-radius: 12px;
  background: rgba(2, 6, 23, .65);
  color: #cbd5e1;
  border: 1px solid rgba(148, 163, 184, .25);
  backdrop-filter: blur(2px);
}

.north-arrow .na-locate {
  border: 1px solid rgba(255, 255, 255, .35);
  background: rgba(15, 23, 42, .85);
  color: #f8fafc;
  padding: 6px 10px;
  border-radius: 999px;
  font: 600 11px/1.2 "Inter", system-ui;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: background .2s ease, color .2s ease;
}

.north-arrow .na-locate svg {
  display: block;
}

.north-arrow .na-locate:hover {
  background: rgba(30, 41, 59, .95);
}

.north-arrow .na-locate:disabled,
.north-arrow .na-locate.loading {
  opacity: .6;
  cursor: not-allowed;
}

.north-arrow .na-svg {
  display: block;
}

.north-arrow .na-ring {
  fill: none;
  stroke: rgba(148, 163, 184, .35);
  stroke-width: 2;
}

.north-arrow .na-n {
  fill: url(#naGrad);
}

.north-arrow .na-s {
  fill: #1f2937;
  opacity: .65;
}

.north-arrow .na-label {
  font-weight: 700;
  letter-spacing: .06em;
}

/* mode alternatif (klik untuk toggle) */
.north-arrow.rose .na-label {
  display: none;
}


/* === Shepherd Tour — Theme "geo" === */

.card-toolbar {
  display: flex;
  gap: 6px;
  margin: 6px 0 8px;
  align-self: flex-start;
  flex-wrap: wrap;
}

.card-toolbar .btn.icon {
  background: #0f172a;
  border: 1px solid var(--line);
  box-shadow: none;
}

.card-toolbar .btn.icon:hover {
  background: #111827;
  transform: none;
}

/* Dorong tombol Tour ke kanan (sudah inline style, ini cadangan) */
#btnTakeTour {
  margin-left: auto;
}

/* Mobile: rapatkan */
@media (max-width: 768px) {
  .card-toolbar {
    gap: 4px;
  }

  .card-toolbar .btn.icon {
    width: 34px;
    height: 34px;
  }
}


.shepherd-element.shepherd-theme-geo .shepherd-content {
  background: rgba(2, 6, 23, .86);
  color: #e5e7eb;
  border: 1px solid rgba(148, 163, 184, .18);
  border-radius: 14px;
  backdrop-filter: blur(10px);
  box-shadow:
    0 10px 30px rgba(0, 0, 0, .45),
    0 0 0 1px rgba(255, 255, 255, .02) inset;
  max-width: 420px;
}

.shepherd-element.shepherd-theme-geo .shepherd-header {
  background: linear-gradient(180deg, rgba(13, 23, 42, .96), rgba(9, 14, 23, .96)) !important;
  /* lebih gelap */
  border-bottom: 1px solid rgba(148, 163, 184, .28) !important;
}

.shepherd-element.shepherd-theme-geo .shepherd-title {
  font-weight: 700;
  color: #f8fafc;
  letter-spacing: .2px;
}

.shepherd-element.shepherd-theme-geo .geo-title-icon {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-size: 14px;
  background: #0b1220;
  border: 1px solid #1f2937;
  color: #93c5fd;
}

.shepherd-element.shepherd-theme-geo .shepherd-text {
  padding: 12px 16px;
  line-height: 1.5;
  color: #cbd5e1;
}

.shepherd-element.shepherd-theme-geo .shepherd-footer {
  padding: 10px 14px;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  border-top: 1px solid rgba(148, 163, 184, .12);
}

/* Buttons style -> selaras dengan .btn app */
.shepherd-element.shepherd-theme-geo .shepherd-button {
  border-radius: 10px;
  padding: 8px 12px;
  font-weight: 600;
  background: #1f2937;
  color: #e5e7eb;
  border: 1px solid #374151;
  transition: transform .08s ease, background .2s ease, border-color .2s ease;
}

.shepherd-element.shepherd-theme-geo .shepherd-button:hover {
  background: #111827;
}

.shepherd-element.shepherd-theme-geo .shepherd-button.secondary {
  background: #2563eb;
  border-color: #1d4ed8;
  color: #fff;
}

.shepherd-element.shepherd-theme-geo .shepherd-button.danger {
  background: #7f1d1d;
  border-color: #991b1b;
  color: #fecaca;
}

.shepherd-element.shepherd-theme-geo .shepherd-button:active {
  transform: translateY(1px);
}

/* Arrow & overlay */
.shepherd-element.shepherd-theme-geo .shepherd-arrow:before {
  background: rgba(2, 6, 23, .86);
  border: 1px solid rgba(148, 163, 184, .18);
}

.shepherd-modal-overlay-container.shepherd-modal-is-visible .shepherd-modal-overlay {
  background: rgba(2, 10, 28, .5);
  backdrop-filter: blur(2px);
}

/* Progress bar */
.geo-progress {
  height: 6px;
  background: #0b1220;
  margin: 6px 16px 12px;
  border-radius: 999px;
  overflow: hidden;
}

.geo-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #60a5fa, #34d399);
  transition: width .3s ease;
}

/* Hint */
.geo-hint {
  color: #94a3b8;
  font-size: 12px;
  opacity: .9;
  padding: 0 16px 10px;
}

/* Focus ring untuk target */
.geo-focus {
  outline: 2px solid rgba(96, 165, 250, .85);
  outline-offset: 2px;
  border-radius: 8px;
  transition: outline-color .2s;
}

/* Slide-in anim */
.shepherd-element.shepherd-theme-geo {
  animation: geo-pop .18s ease-out;
}

@keyframes geo-pop {
  from {
    transform: translateY(4px);
    opacity: 0
  }

  to {
    transform: none;
    opacity: 1
  }
}


/* ==== Desktop sempit (≤1280px) ==== */
@media (max-width: 1280px) {
  .toolbox {
    width: 420px;
  }

  .leaflet-sidebar-right {
    width: 600px;
  }
}

/* ==== Tablet (≤1024px) ==== */
@media (max-width: 1024px) {
  .toolbox {
    width: 380px;
  }

  .leaflet-sidebar-right {
    width: 520px;
  }
}

/* ==== Mobile (≤768px): toolbox jadi bottom sheet, panel kanan full-screen slide ==== */
@media (max-width: 768px) {

  /* Toolbox → bottom sheet */
  .toolbox {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    width: 100%;
    max-width: 100%;
    padding: 10px 12px calc(12px + env(safe-area-inset-bottom));
    gap: 10px;
    display: block;
    z-index: 1000;
    pointer-events: auto;
    max-height: 60vh;
    overflow: auto;
  }

  /* Baris tombol atas: bisa digeser */
  .row-top-actions {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 6px;
    -webkit-overflow-scrolling: touch;
  }

  .row-top-actions .btn {
    flex: 0 0 auto;
  }

  /* Kartu lebih kompak */
  .card {
    padding: 8px;
    border-radius: 14px;
  }

  .panel-title {
    margin-bottom: 4px;
  }

  /* Right panel full-screen slide */
  .leaflet-sidebar-right {
    width: 100vw;
    height: var(--app-h, 100dvh);
    transform: translateX(100%);
    transition: transform .18s ease-out;
  }

  .leaflet-sidebar-right.open {
    transform: translateX(0);
  }

  .leaflet-sidebar-right .content {
    padding-bottom: calc(18px + env(safe-area-inset-bottom));
  }

  /* Explore modal 1 kolom full-screen */
  .backdrop.open .modal {
    width: 100vw;
    height: var(--app-h, 100dvh);
    max-height: none;
    border-radius: 0;
    grid-template-columns: 1fr;
  }

  .modal .left,
  .modal .right {
    padding: 14px;
    border: 0;
  }

  .list {
    max-height: 42vh;
  }

  /* Attribute Table v3 */
  .table-sticky {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }

  .table-sticky thead th {
    position: sticky;
    top: 0;
  }

  #rightPanel .kv th {
    text-align: left;
    width: 28%;
    color: #93a1b5;
    font-weight: 600;
    white-space: nowrap;
  }

  #rightPanel .kv td {
    color: #e5e7eb;
  }

  #rightPanel .skeleton {
    background: linear-gradient(90deg, rgba(148, 163, 184, .12), rgba(148, 163, 184, .22), rgba(148, 163, 184, .12));
    border-radius: 12px;
    animation: sk 1.1s infinite linear;
  }

  @keyframes sk {
    0% {
      background-position: -200px 0;
    }

    100% {
      background-position: calc(200px + 100%) 0;
    }
  }


  /* Pinned legend: naik agar tak tertutup bottom sheet */
  #pinnedLegendStack {
    bottom: calc(84px + env(safe-area-inset-bottom));
    right: 10px;
  }

  /* Target sentuh lebih besar */
  .btn,
  .btn.sm {
    min-height: 32px;
  }

  .btn.icon {
    width: 32px;
    height: 32px;
  }

  /* Layer row: aksi pindah ke bawah */
  .layer-row {
    grid-template-columns: 1fr;
  }

  .row-actions {
    width: auto;
    grid-auto-flow: column;
    grid-auto-rows: unset;
    justify-content: flex-start;
  }
}

/* ==== Ponsel kecil (≤480px) ==== */
@media (max-width: 480px) {
  .btn {
    padding: 10px 12px;
    border-radius: 10px;
  }

  .btn.sm {
    padding: 6px 10px;
  }

  .chip {
    font-size: 11px;
  }

  .legend {
    font-size: 12px;
  }
}


/* Sticky toolbar (collapse/expand/tour) biar selalu terlihat */
.card-toolbar {
  position: sticky;
  top: 8px;
  z-index: 1020;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  padding: 8px;
  border-radius: 12px;
  background: rgba(15, 23, 42, .85);
  border: 1px solid rgba(148, 163, 184, .25);
  backdrop-filter: blur(6px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .35);
  margin: 4px 0 6px;
}

.card-toolbar .btn.icon {
  min-width: 36px;
  min-height: 36px;
}

@media (max-width: 480px) {
  .card-toolbar {
    top: 6px;
    padding: 6px;
    gap: 6px;
  }

  .card-toolbar #btnTakeTour {
    padding: 6px 10px;
    font-size: 12px;
  }
}

/* Toolbox responsif */
.toolbox {
  width: clamp(280px, 50vw, 550px);
  max-width: 92vw;
}

@media (max-width: 1023px) {
  .toolbox {
    width: min(96vw, 560px);
    left: 12px;
    right: 12px;
  }

  .row-top-actions {
    flex-wrap: wrap;
  }
}

/* Hit target tombol kecil lebih ramah jari */
@media (max-width: 768px) {
  .btn.sm {
    min-height: 36px;
  }

  .btn.icon {
    width: 32px;
    height: 32px;
  }

  .row-actions {
    grid-auto-rows: 40px;
  }
}

/* Right panel: mode side (desktop) tetap seperti semula */
/* Right panel: mode bottom-sheet (mobile) */
@media (max-width: 1023px) {
  .leaflet-sidebar-right.as-sheet {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    width: 100%;
    height: var(--sheet-h, 46vh);
    display: block;
    border-left: none;
    border-top: 1px solid rgba(148, 163, 184, .25);
    border-radius: 14px 14px 0 0;
    box-shadow: 0 -12px 40px rgba(0, 0, 0, .45);
    transform: translateY(100%);
    transition: transform .18s ease-out;
    background: rgba(15, 23, 42, .98);
    z-index: 1200;
  }

  .leaflet-sidebar-right.as-sheet.open {
    transform: translateY(0);
  }

  /* drag handle bar */
  #rpDragHandle {
    position: absolute;
    top: 6px;
    left: 50%;
    transform: translateX(-50%);
    width: 44px;
    height: 5px;
    border-radius: 999px;
    background: rgba(148, 163, 184, .55);
    cursor: ns-resize;
  }

  /* pindah tombol close sedikit ke bawah agar tak bertabrakan dengan handle */
  .leaflet-sidebar-right.as-sheet .close-right {
    top: 16px;
    right: 12px;
  }

  /* overlay gelap ketika sheet terbuka */
  #rpOverlay {
    position: fixed;
    inset: 0;
    z-index: 1195;
    display: none;
    background: rgba(2, 10, 28, .45);
    backdrop-filter: blur(1.5px);
  }

  #rpOverlay.open {
    display: block;
  }
}

/* Better readability untuk teks di panel saat layar kecil */
@media (max-width: 480px) {
  .leaflet-sidebar-right .content {
    padding: 14px;
  }

  .feature-info .kv th,
  .feature-info .kv td {
    padding: 8px 8px;
  }
}

/* Reduced motion: matikan animasi besar */
@media (prefers-reduced-motion: reduce) {
  .skeleton::after {
    animation: none !important;
  }

  .leaflet-sidebar-right.as-sheet {
    transition: none;
  }
}

/* Basemap modal & command palette: biar gak nabrak */
@media (max-width: 480px) {

  .bm-card,
  .cmdk-card {
    border-radius: 12px;
  }
}


/* ===== Story / Slides overlay ===== */
.story-overlay {
  position: fixed;
  inset: 0;
  z-index: 1350;
  display: none;
  pointer-events: none;
  /* biar klik map tetap bisa kecuali area card */
}

.story-overlay.open {
  display: block;
}

.story-overlay .story-card {
  position: absolute;
  left: 50%;
  bottom: calc(12px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: rgba(15, 23, 42, .92);
  color: #e5e7eb;
  border: 1px solid rgba(148, 163, 184, .25);
  border-radius: 14px;
  box-shadow: 0 18px 60px rgba(0, 0, 0, .45);
  min-width: min(720px, 94vw);
  pointer-events: auto;
  /* aktifkan interaksi di card */
}

.story-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px 6px 12px;
}

.story-title {
  margin-left: 8px;
  margin-right: auto;
  font-weight: 700;
  color: #f8fafc;
  max-width: 40ch;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.story-opt {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #94a3b8;
  font-size: 12px;
  background: rgba(2, 6, 23, .35);
  padding: 6px 8px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, .18);
}

.story-opt input[type="number"] {
  width: 54px;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid #1f2937;
  background: #0f172a;
  color: #e5e7eb;
}

.story-progress {
  height: 6px;
  background: #0b1220;
  border-radius: 0 0 14px 14px;
  overflow: hidden;
}

.story-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #60a5fa, #34d399);
  transition: width .12s linear;
}

/* Dark icon buttons harmonize */
.story-overlay .btn.icon {
  background: #0f172a;
  border: 1px solid var(--line);
  box-shadow: none;
}

.story-overlay .btn.icon:hover {
  background: #111827;
  transform: none;
}

.story-overlay .btn.gray.sm {
  background: #334155;
}

/* Mobile tweaks */
@media (max-width: 768px) {
  .story-overlay .story-card {
    min-width: min(96vw, 560px);
  }

  .story-title {
    display: none;
  }

  /* hemat ruang; opsional */
}


/* Styling aman untuk konten GFI berbasis HTML */

.gfi-html {
  color: #e5e7eb;
  font: 14px/1.5 Inter, system-ui, sans-serif;
}

.gfi-html table {
  width: 100%;
  border-collapse: collapse;
  margin: 6px 0 10px;

  background: transparent;
}

.gfi-html th,
.gfi-html td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid rgba(148, 163, 184, .18);
  vertical-align: top;
}

.gfi-html th {
  width: 32%;
  background: rgba(148, 163, 184, .12);
  color: #cbd5e1;
  font-weight: 600;
}

.gfi-html a {
  color: #93c5fd;
  text-decoration: underline;
}

.gfi-html code,
.gfi-html pre {
  background: rgba(2, 6, 23, .45);
  border: 1px solid rgba(148, 163, 184, .2);
  border-radius: 8px;
  padding: 6px 8px;
  overflow: auto;
  display: block;
  color: #e5e7eb;
}

.gfi-html img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  display: block;
}

/* GFI: paksa tabel GeoServer .featureInfo cocok tema gelap */
.gfi-html table.featureInfo,
.gfi-html table.featureInfo td,
.gfi-html table.featureInfo th {
  border: 1px solid rgba(148, 163, 184, .18) !important;
  border-collapse: collapse !important;
  color: #e5e7eb !important;
  background: transparent !important;
  margin: 0 !important;
  font-size: 90% !important;
  padding: .5rem .6rem !important;
}

.gfi-html table.featureInfo th {
  font-weight: 700 !important;
  background: rgba(148, 163, 184, .12) !important;
}

.gfi-html table.featureInfo td {
  background: transparent !important;
}

.gfi-html table.featureInfo tr.odd td {
  background: rgba(148, 163, 184, .06) !important;
}

.gfi-html table.featureInfo caption {
  text-align: left !important;
  font-size: 100% !important;
  font-weight: 700 !important;
  padding: .4rem .6rem !important;
  color: #e5e7eb !important;
}


/* === GFI Tabbed Viewer === */
.gfi-tabs .gfi-nav {
  display: flex;
  gap: 6px;
  align-items: center;
  border-bottom: 1px solid rgba(148, 163, 184, .18);
  padding-bottom: 6px;
  margin-bottom: 8px;
}

.gfi-tabs .t {
  background: #0f172a;
  color: #cbd5e1;
  border: 1px solid rgba(148, 163, 184, .25);
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 12px;
}

.gfi-tabs .t:hover {
  background: #111827;
}

.gfi-tabs .t:disabled {
  opacity: .5;
  cursor: not-allowed;
}

.gfi-tabs .t.active {
  background: #2563eb;
  color: #fff;
  border-color: transparent;
}

.gfi-tabs .t.link {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

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

.gfi-json {
  margin: 0;
  padding: 10px;
  background: #0b1220;
  color: #e5e7eb;
  border: 1px solid rgba(148, 163, 184, .18);
  border-radius: 8px;
  overflow: auto;
  max-height: 40vh;
}

/* paksa HTML GFI kompatibel tema gelap */
.gfi-html,
.gfi-html table {
  color: #e5e7eb;
}

.gfi-html table {
  width: 100%;
  border-collapse: collapse;
}

.gfi-html th,
.gfi-html td {
  border: 1px solid rgba(148, 163, 184, .18);
  padding: 8px 10px;
}

.gfi-html th {
  background: rgba(148, 163, 184, .12);
  color: #cbd5e1;
}

.gfi-html tr:nth-child(odd) td {
  background: rgba(148, 163, 184, .06);
}

.gfi-html tr:nth-child(even) td {
  background: rgba(148, 163, 184, .02);
}

.gfi-html a {
  color: #93c5fd;
  text-decoration: underline;
}

/* === CQL Builder modal === */
.cql-modal {
  position: fixed;
  inset: 0;
  z-index: 1250;
  display: none
}

.cql-modal.open {
  display: block
}

.cql-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 23, .55);
  backdrop-filter: blur(2px)
}

.cql-card {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(640px, 92vw);
  background: #0b1220;
  border: 1px solid #1f2937;
  border-radius: 14px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .55);
  color: #cbd5e1;
  padding: 14px;
}

.cql-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px
}

.cql-row {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 8px;
  align-items: center;
  margin: 8px 0
}

.cql-row.hide {
  display: none
}

.cql-input {
  padding: 10px 12px;
  border: 1px solid #1f2937;
  border-radius: 10px;
  background: #0f172a;
  color: #e5e7eb
}

.cql-hflex {
  display: flex;
  gap: 8px
}

.cql-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin: 6px 0
}

.cql-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px
}

.cql-input.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace
}

.cql-card .badge {
  background: #111827;
  border: 1px solid #374151;
  border-radius: 10px;
  padding: 6px 10px;
  color: #e5e7eb
}

/* Tombol Filter aktif */
.btn-cql.on {
  background: #2563eb;
  color: #fff;
  border-color: transparent;
}

.cql-badge {
  background: #0a1c3a;
  border: 1px solid #1e3a8a;
  color: #bfdbfe;
}

/* Alert kecil dalam CQL modal */
.cql-alert {
  margin: 6px 0 2px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, .25);
  background: rgba(15, 23, 42, .6);
  color: #cbd5e1;
  font-size: 12px;
}


/* Filter Pro rows */
.pf-row .pf-grid {
  display: grid;
  grid-template-columns: 1.2fr .95fr 1fr 1fr auto auto auto;
  gap: 6px;
  align-items: center;
}

.pf-row .pf-suggest {
  grid-column: 1 / -1;
  padding-top: 4px;
  max-height: 160px;
  overflow: auto;
}

.pf-chip {
  margin: 2px;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, .25);
  background: #0b1220;
  color: #cbd5e1;
  cursor: pointer;
}

.pf-row.pf-not {
  outline: 1px dashed #f59e0b;
  outline-offset: 4px;
  border-radius: 8px;
}

/* Overlay teks pick */
#pfPickOverlay {
  pointer-events: none;
}

/* Badge hit-count di footer modal */
#pfCount {
  align-self: center;
  background: #1f2937;
  color: #cbd5e1;
}

/* === Right Panel: compact width controls next to Close (desktop) === */
@media (min-width: 1024px) {

  /* pastikan close di atas */
  #closeRight {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 10;
  }

  /* compact bar nempel di kiri close */
  #rightPanel .rpw-compact {
    position: absolute;
    top: 12px;
    right: calc(12px + var(--closeW, 44px) + 8px);
    /* jarak dari close */
    display: flex;
    gap: 6px;
    z-index: 9;
  }

  #rightPanel .rpw-compact .btn.sm {
    height: 32px;
    padding: 4px 8px;
    line-height: 1;
  }

  #rightPanel.full .rpw-compact [data-full] {
    filter: brightness(1.05);
  }
}

/* mobile untouched (bottom-sheet kamu tetap jalan) */
