.app-logo { width: 36px; height: 36px; border-radius: 9px; box-shadow: 0 1px 3px rgba(0,0,0,.35); }
.panel-title { font-weight: 600; font-size: 0.875rem; margin-bottom: 0.5rem; color: #0f172a; }

/* --- Accordion panel kiri: header bisa diklik untuk melipat/membuka --- */
.section-header { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; cursor: pointer; padding: 0.4rem 0.55rem; margin: -0.4rem -0.55rem 0.5rem; border-radius: 0.375rem; outline-offset: 2px; transition: background-color 0.15s ease, color 0.15s ease; }
.section-header:hover { background: #eff6ff; color: #1d4ed8; }
.section-header:hover .chevron { color: #1d4ed8; }
.section-header .chevron { font-size: 0.7rem; color: #94a3b8; transition: transform 0.15s ease, color 0.15s ease; }
.collapsible:not(.open) > .section-header { margin-bottom: -0.4rem; }
.collapsible:not(.open) > .section-header .chevron { transform: rotate(-90deg); }
.collapsible:not(.open) > .section-header ~ * { display: none; }
.field-select { flex: 1; min-width: 0; border: 1px solid #cbd5e1; border-radius: 0.25rem; padding: 0.25rem 0.5rem; background: #fff; }
.num-input { display: block; width: 100%; margin-top: 0.25rem; border: 1px solid #cbd5e1; border-radius: 0.25rem; padding: 0.25rem 0.5rem; }
.th { text-align: left; padding: 0.5rem 0.75rem; font-weight: 600; }
.td { padding: 0.4rem 0.75rem; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
.badge { display: inline-block; padding: 0.1rem 0.5rem; border-radius: 9999px; font-size: 0.7rem; font-weight: 600; white-space: nowrap; }
.chip { display: inline-block; width: 0.8rem; height: 0.8rem; border-radius: 0.2rem; flex-shrink: 0; margin-top: 0.1rem; }
.btn-disabled { opacity: 0.4; pointer-events: none; }
.row-active { background: #eff6ff; }
/* Penanda baris kasus lintas kabupaten (garis ungu di tepi kiri) */
.row-cross { box-shadow: inset 3px 0 0 #a855f7; }
.btn-sm { padding: 0.2rem 0.6rem; border-radius: 0.25rem; font-weight: 600; white-space: nowrap; display: inline-flex; align-items: center; justify-content: center; gap: 0.25rem; vertical-align: middle; }
.btn-icon { display: inline-flex; align-items: center; justify-content: center; width: 1.75rem; height: 1.6rem; padding: 0; border-radius: 0.25rem; vertical-align: middle; line-height: 1; }

.nav-btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.3rem; padding: 0.35rem 0.5rem; border-radius: 0.25rem; border: 1px solid #cbd5e1; background: #fff; font-size: 0.75rem; font-weight: 600; color: #334155; }
.nav-btn:hover { background: #f1f5f9; }
.nav-btn:disabled { opacity: 0.4; cursor: default; }
.nav-btn-primary { border-color: #f97316; color: #c2410c; background: #fff7ed; }
.nav-btn-primary:hover { background: #ffedd5; }

.layer-row { display: flex; align-items: center; gap: 0.5rem; }
.layer-row .name { width: 7.5rem; font-size: 0.75rem; font-weight: 500; color: #475569; }
.layer-row .file { flex: 1; min-width: 0; font-size: 0.7rem; color: #64748b; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.option-card { display: flex; gap: 0.6rem; align-items: flex-start; padding: 0.6rem 0.75rem; border: 1px solid #e2e8f0; border-radius: 0.4rem; cursor: pointer; font-size: 0.78rem; line-height: 1.45; }
.option-card:hover { background: #f8fafc; }
.option-card:has(input:checked) { border-color: #3b82f6; background: #eff6ff; }
.case-panel-stack { display: flex; flex-direction: column; gap: 0.9rem; }
.case-panel-stack.hidden { display: none; }
.case-info-card { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 0.5rem; padding: 0.75rem; display: flex; flex-direction: column; gap: 0.6rem; }
.case-meta-row { display: flex; align-items: flex-start; gap: 0.5rem; font-size: 0.76rem; line-height: 1.45; color: #334155; }
.case-nav-group { display: flex; flex-direction: column; gap: 0.45rem; }
.case-actions-group { border-top: 1px solid #e2e8f0; padding-top: 0.85rem; }
.dl-quick-links { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 0.4rem 0.6rem; margin-top: 0.5rem; font-size: 0.74rem; }

.legend { background: rgba(255,255,255,0.95); padding: 6px 10px; border-radius: 6px; box-shadow: 0 1px 4px rgba(0,0,0,.2); font-size: 11px; line-height: 1.6; }
.legend i { display: inline-block; width: 12px; height: 12px; margin-right: 6px; vertical-align: -2px; border-radius: 2px; }
.legend-head { margin-top: 4px; padding-top: 4px; border-top: 1px solid #e2e8f0; font-weight: 600; color: #334155; }
.legend-kab { max-height: 9rem; overflow-y: auto; }

.toast { padding: 0.6rem 0.9rem; border-radius: 0.375rem; color: #fff; box-shadow: 0 4px 12px rgba(0,0,0,.2); max-width: 26rem; font-size: 0.8rem; pointer-events: auto; }

.download-box {
  position: fixed;
  top: 3.75rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2100;
  width: min(25rem, calc(100vw - 2rem));
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 0.5rem;
  padding: 0.75rem 0.9rem;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.22);
}
.download-box.hidden { display: none; }
.dl-track { width: 100%; height: 0.5rem; border-radius: 9999px; background: #e2e8f0; overflow: hidden; }
.dl-bar { height: 100%; border-radius: 9999px; background: #2563eb; transition: width 0.15s ease, background-color 0.2s ease; }
.dl-bar.ready { background: #059669; }
.dl-bar.indeterminate { width: 40% !important; animation: dl-slide 1.1s ease-in-out infinite; }
@keyframes dl-slide {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(260%); }
}
.is-downloading { opacity: 0.6; pointer-events: none; cursor: progress; }

.busy-card {
  width: min(23rem, calc(100% - 2rem));
  background: #0f172a;
  color: #f8fafc;
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 0.75rem;
  padding: 0.9rem 1rem;
  box-shadow: 0 18px 36px rgba(15, 23, 42, 0.35);
}
.busy-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.busy-spinner {
  width: 1.5rem;
  height: 1.5rem;
  flex-shrink: 0;
  border-radius: 9999px;
  border: 2.5px solid rgba(148, 163, 184, 0.35);
  border-top-color: #38bdf8;
  animation: busy-spin 0.75s linear infinite;
}
.busy-title {
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.25;
}
.busy-sub {
  font-size: 0.72rem;
  color: #cbd5e1;
  margin-top: 0.15rem;
  line-height: 1.3;
}
.busy-track {
  width: 100%;
  height: 0.35rem;
  border-radius: 9999px;
  background: rgba(148, 163, 184, 0.24);
  overflow: hidden;
  margin-top: 0.7rem;
}
.busy-bar {
  width: 42%;
  height: 100%;
  border-radius: 9999px;
  background: linear-gradient(90deg, #38bdf8, #34d399);
  animation: dl-slide 1.15s ease-in-out infinite;
}
@keyframes busy-spin {
  to { transform: rotate(360deg); }
}
.btn-spinner {
  display: inline-block;
  width: 0.9rem;
  height: 0.9rem;
  flex-shrink: 0;
  border-radius: 9999px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #ffffff;
  animation: busy-spin 0.7s linear infinite;
}

.modal-backdrop { position: fixed; inset: 0; z-index: 2500; background: rgba(15, 23, 42, 0.55); display: flex; align-items: center; justify-content: center; padding: 1rem; }
.modal-backdrop.hidden { display: none; }
.modal-card { width: 100%; max-width: 34rem; background: #fff; border-radius: 0.5rem; box-shadow: 0 20px 35px rgba(15, 23, 42, 0.3); border: 1px solid #e2e8f0; overflow: hidden; }
.modal-head { padding: 1rem 1.25rem; display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; border-bottom: 1px solid #e2e8f0; background: #f8fafc; }
.modal-head-brand { display: flex; align-items: center; gap: 0.875rem; min-width: 0; }
.modal-body { padding: 1.25rem; }
.modal-body p { text-align: justify; line-height: 1.6; }
.modal-foot { padding: 0.75rem 1.25rem; border-top: 1px solid #e2e8f0; background: #f8fafc; }
.modal-close { width: 1.75rem; height: 1.75rem; border-radius: 0.25rem; color: #64748b; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.modal-close:hover { background: #f1f5f9; color: #0f172a; }
.about-meta { display: grid; grid-template-columns: 5.5rem 1fr; gap: 0.5rem 0.75rem; align-items: baseline; }
.about-meta dt { font-weight: 600; color: #334155; }
.about-meta dd { margin: 0; color: #475569; min-width: 0; overflow-wrap: anywhere; }
.changelog-body { max-height: 62vh; overflow-y: auto; }
.changelog-entry { padding: 0.75rem 0.9rem; border: 1px solid #e2e8f0; border-radius: 0.375rem; background: #f8fafc; }
.changelog-entry-head { display: flex; flex-wrap: wrap; align-items: center; gap: 0.45rem; margin-bottom: 0.4rem; }
.changelog-list { margin: 0; padding-left: 1.1rem; list-style: disc; line-height: 1.5; color: #475569; }
.changelog-list li + li { margin-top: 0.25rem; }

/* ======================================================================
   RESPONSIF — berbagai ukuran layar
   ====================================================================== */

/* Tablet & layar sedang: panel kiri menjadi penuh lebar di atas konten */
@media (max-width: 1024px) {
  #app-main {
    flex-direction: column;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  #app-sidebar {
    width: 100% !important;
    max-height: none;
    flex: 0 0 auto;
    overflow-y: visible;
    border-right: none;
    border-bottom: 1px solid #e2e8f0;
  }
  #app-content {
    flex: 1 0 auto;
    min-height: 0;
  }
  #app-map-wrap {
    flex: 0 0 auto;
    min-height: 0;
    height: 55vh;
  }
  #app-table-wrap {
    flex: 1 1 auto;
    min-height: 300px;
  }
  /* Peta & tabel tetap terlihat tanpa harus scroll jauh */
  .legend { font-size: 10px; }
}

/* Ponsel: header ringkas, peta & tabel tetap punya tinggi cukup */
@media (max-width: 640px) {
  #app-map-wrap { height: 45vh; min-height: 260px; }
  #app-table-wrap { min-height: 340px; }
  .th, .td { padding: 0.4rem 0.5rem; }
  .toast { max-width: calc(100vw - 2rem); font-size: 0.75rem; }
  /* Filter tabel: pilihannya mengalir ke baris baru */
  #scope-title { width: 100%; }
  #summary { width: 100%; }
}

/* Ponsel kecil: header tombol aksi mengecil agar tidak meluber */
@media (max-width: 400px) {
  #app-map-wrap { height: 40vh; }
  header button, header a#btn-full, header #scope-badge { font-size: 0.75rem; padding: 0.3rem 0.5rem; }
}

/* Tabel deteksi bisa digeser mendatar bila kolom tidak muat */
@media (max-width: 1024px) {
  #app-table-wrap .overflow-auto { overflow-x: auto; }
}

/* Label ID & nama langsung di atas poligon peta */
.map-sls-label { pointer-events: none; background: transparent; border: none; }
.map-sls-label-inner {
  width: max-content;
  transform: translate(-50%, -50%);
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  line-height: 1.15;
  white-space: nowrap;
  color: #ffffff;
  text-shadow:
    -1px -1px 0 rgba(15, 23, 42, 0.9),
     1px -1px 0 rgba(15, 23, 42, 0.9),
    -1px  1px 0 rgba(15, 23, 42, 0.9),
     1px  1px 0 rgba(15, 23, 42, 0.9),
     0    1px 3px rgba(15, 23, 42, 0.95);
  user-select: none;
}
.map-sls-label-id { font-size: 10px; font-weight: 700; letter-spacing: 0.01em; }
.map-sls-label-name { font-size: 9.5px; font-weight: 500; max-width: 150px; overflow: hidden; text-overflow: ellipsis; }
.map-theme-light .map-sls-label-inner {
  color: #0f172a;
  text-shadow:
    -1px -1px 0 rgba(255, 255, 255, 0.95),
     1px -1px 0 rgba(255, 255, 255, 0.95),
    -1px  1px 0 rgba(255, 255, 255, 0.95),
     1px  1px 0 rgba(255, 255, 255, 0.95),
     0    1px 3px rgba(255, 255, 255, 0.95);
}

/* Paginasi tabel kasus untuk ribuan hasil */
.table-pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.45rem 0.75rem;
  border-top: 1px solid #e2e8f0;
  background: #f8fafc;
  font-size: 0.75rem;
  color: #475569;
}
.table-pager.hidden { display: none; }
.table-pager-actions { display: inline-flex; align-items: center; gap: 0.35rem; }
.pager-btn {
  padding: 0.2rem 0.55rem;
  border: 1px solid #cbd5e1;
  border-radius: 0.25rem;
  background: #ffffff;
  color: #334155;
  font-weight: 600;
}
.pager-btn:hover:not(:disabled) { background: #f1f5f9; }
.pager-btn:disabled { opacity: 0.45; cursor: default; }

/* Kartu pilihan mode cepat pada Opsi Analisis */
.analysis-presets { margin-top: 0.6rem; margin-bottom: 0.75rem; }
.analysis-presets-label { font-size: 0.72rem; color: #64748b; margin-bottom: 0.3rem; }
.preset-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.1rem;
  padding: 0.42rem 0.5rem;
  border: 1px solid #cbd5e1;
  border-radius: 0.375rem;
  background: #ffffff;
  line-height: 1.25;
  text-align: center;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
.preset-btn:hover { background: #f8fafc; border-color: #94a3b8; }
.preset-btn.is-active { border-color: #3b82f6; background: #eff6ff; }
.preset-title { font-size: 0.75rem; font-weight: 600; color: #1e293b; }
.preset-btn.is-active .preset-title { color: #1d4ed8; }
.preset-sub { font-size: 0.68rem; color: #64748b; }

/* Modal pilih level & format unduhan Peta Utuh */
.export-section { padding: 0.75rem; border: 1px solid #e2e8f0; border-radius: 0.45rem; background: #f8fafc; }
.export-max-select { max-width: 12.5rem; font-size: 0.75rem; }
.export-level-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.45rem; }
.export-level-item {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.4rem 0.55rem;
  border: 1px solid #cbd5e1;
  border-radius: 0.35rem;
  background: #ffffff;
  cursor: pointer;
}
.export-level-item.is-disabled { opacity: 0.5; cursor: not-allowed; background: #f1f5f9; }
.export-format-list { display: flex; flex-direction: column; gap: 0.45rem; }
.export-format-item {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  padding: 0.5rem 0.6rem;
  border: 1px solid #cbd5e1;
  border-radius: 0.35rem;
  background: #ffffff;
  cursor: pointer;
}
.export-format-item:hover, .export-level-item:not(.is-disabled):hover { border-color: #93c5fd; }
.export-note { padding: 0.5rem 0.65rem; border-radius: 0.35rem; background: #eff6ff; border: 1px solid #bfdbfe; color: #1e40af; line-height: 1.45; }

/* Minimize / expand panel Tabel Deteksi */
.table-toggle-btn {
  padding: 0.25rem 0.55rem;
  border: 1px solid #cbd5e1;
  border-radius: 0.25rem;
  background: #f8fafc;
  color: #334155;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
}
.table-toggle-btn:hover { background: #e2e8f0; }
#app-table-wrap.is-minimized { flex: 0 0 auto; min-height: 0; }
#app-table-wrap.is-minimized .table-head-bar { border-bottom: none; }
#app-table-wrap.is-minimized #table-filters,
#app-table-wrap.is-minimized #table-body-wrap,
#app-table-wrap.is-minimized #table-pager { display: none; }
#app-table-wrap.is-minimized #btn-toggle-table { margin-left: auto; }
@media (max-width: 1024px) {
  #app-content:has(#app-table-wrap.is-minimized) #app-map-wrap { height: 78vh; }
}
