/* Tema Hando & Peternakan - Web Peternakan */
:root {
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --sidebar-bg: #ffffff;
  --sidebar-border: #eef2f7;
  --card-border: #eef2f7;

  --c-blue: #2f6fed;
  --c-blue-dark: #2158c9;
  --c-red: #e6483e;
  --c-red-dark: #c73a31;
  --c-green: #21a678;
  --c-green-dark: #178a63;
  --c-purple: #7d5cf0;
  --c-purple-dark: #6544d6;
  --c-orange: #f5951f;
  --c-orange-dark: #dd7f0f;
  --c-teal: #14b8a6;

  --text-dark: #1e293b;
  --text-muted: #64748b;
  --bg-main: #f4f6f9;
  --topbar-h: 68px;
}

body {
  font-family: 'Inter', system-ui, sans-serif;
  background-color: var(--bg-main) !important;
}

/* Cegah seluruh halaman bisa digeser ke samping (horizontal scroll) di HP.
   Elemen yang memang butuh scroll horizontal sendiri (tabel, stat-row)
   sudah punya overflow-x: auto masing-masing, jadi ini aman. */
html {
  overflow-x: hidden;
  max-width: 100%;
}

body {
  overflow-x: hidden;
  max-width: 100%;
}

/* ============ PRELOADER (Dashboard-KK style) ============ */
#preloader {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ffffff;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

#preloader.fade-out {
  opacity: 0;
  visibility: hidden;
}

.loader-spinner {
  width: 45px;
  height: 45px;
  border: 3px solid #f3f3f3;
  border-top: 3px solid var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

/* ============ PAGE ENTRANCE ANIMATIONS ============ */
.animate-fade-in {
  animation: fadeIn 0.6s ease forwards;
}

.animate-fade-in-up {
  opacity: 0;
  transform: translateY(15px);
  animation: fadeInUp 0.6s cubic-bezier(0.25, 0.8, 0.25, 1) forwards;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(15px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Stagger delay for cards */
.delay-1 {
  animation-delay: 0.1s;
}

.delay-2 {
  animation-delay: 0.2s;
}

.delay-3 {
  animation-delay: 0.3s;
}

.delay-4 {
  animation-delay: 0.4s;
}

/* ============ SIDEBAR (Hando Light Sidebar style) ============ */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.app-sidebar {
  width: 17rem;
  flex-shrink: 0;
  /* position: fixed (bukan sticky) supaya sidebar benar-benar diam di
     tempat dan TIDAK ikut turun/bergerak saat konten halaman di-scroll.
     Sticky sebelumnya bisa "lepas" mengikuti scroll kalau ada ancestor
     yang overflow-nya berubah (mis. overflow-x: hidden di body/html
     membuat overflow-y ikut jadi "auto" secara implisit). Fixed tidak
     bergantung pada ancestor manapun, jadi selalu aman. */
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 30;
  color: #4b5563;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  overflow-y: auto;
  transition: width 0.25s ease, min-width 0.25s ease;
}

/* Karena sidebar sekarang position:fixed (lepas dari alur flex), area
   konten utama diberi margin-left selebar sidebar supaya tidak tertutup. */
.app-main {
  margin-left: 17rem;
  transition: margin-left 0.25s ease;
}

.sidebar-collapsed .app-main {
  margin-left: 4.75rem;
}

.app-sidebar::-webkit-scrollbar {
  width: 5px;
}

.app-sidebar::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.05);
  border-radius: 999px;
}

/* Sidebar collapsed (desktop) */
.sidebar-collapsed .app-sidebar {
  width: 4.75rem;
  min-width: 4.75rem;
}

.sidebar-collapsed .sidebar-region,
.sidebar-collapsed .sidebar-onehealth,
.sidebar-collapsed .sidebar-tagline {
  display: none;
}

.sidebar-collapsed .sidebar-brand {
  flex-direction: column;
  align-items: center;
  padding: 1.25rem 0.5rem;
  gap: 0.65rem;
}

.sidebar-collapsed .sidebar-brand-text {
  display: none;
}

/* Mode ikon-saja: menu & footer tetap tampil, cuma teksnya yang disembunyikan */
.sidebar-collapsed .sidebar-nav {
  padding: 0 0 0.5rem;
}

.sidebar-collapsed .sidebar-section-title {
  display: none;
}

.sidebar-collapsed .side-link {
  justify-content: center;
  margin: 0.2rem 0.6rem;
  padding: 0.65rem;
  position: relative;
}

.sidebar-collapsed .side-link span {
  display: none;
}

.sidebar-collapsed .side-link i {
  font-size: 1.15rem;
}

.sidebar-collapsed .side-badge {
  position: absolute;
  top: 0.15rem;
  right: 0.15rem;
  min-width: 16px;
  height: 16px;
  font-size: 0.6rem;
  padding: 0 0.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: 0;
}

.sidebar-collapsed .sidebar-footer-admin,
.sidebar-collapsed .sidebar-footer-public {
  padding: 0.75rem 0.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.sidebar-collapsed .sidebar-footer-admin #adminName {
  display: none;
}

.sidebar-collapsed .sidebar-footer-admin .side-logout,
.sidebar-collapsed .sidebar-footer-public {
  justify-content: center;
}

.sidebar-collapsed .sidebar-footer-admin .side-logout span,
.sidebar-collapsed .sidebar-footer-public span {
  display: none;
}

.sidebar-toggle-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.5rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  color: #64748b;
  font-size: 0.95rem;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}

.sidebar-toggle-btn:hover {
  background: #f1f5f9;
  color: var(--text-dark);
}

.mobile-menu-btn {
  display: none;
  width: 38px;
  height: 38px;
  align-items: center;
  justify-content: center;
  border-radius: 0.5rem;
  background: #ffffff;
  border: 1px solid var(--card-border);
  color: #475569;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.mobile-menu-btn:hover {
  background: #f8fafc;
}

.sidebar-brand {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 1.25rem 1.25rem 1rem;
}

.sidebar-brand-main {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.brand-logo {
  width: 60px;
  height: 60px;
  flex-shrink: 0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.brand-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.brand-logo i {
  color: #fff;
  font-size: 20px;
}

.sidebar-brand h1 {
  color: var(--text-dark);
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: 0.02em;
  line-height: 1;
}

.sidebar-brand p {
  color: var(--text-muted);
  font-size: 0.65rem;
  line-height: 1.2;
  margin-top: 4px;
}

.sidebar-region {
  margin: 0 1.25rem 1rem;
  padding: 0.5rem 0.75rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  font-size: 0.75rem;
  color: #475569;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.sidebar-section-title {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #94a3b8;
  padding: 0 1.25rem;
  margin-bottom: 0.4rem;
  margin-top: 0.5rem;
  font-weight: 700;
}

.sidebar-nav {
  padding-bottom: 0.5rem;
}

.side-link {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin: 0.1rem 0.75rem;
  padding: 0.55rem 0.75rem;
  border-radius: 0.5rem;
  font-size: 0.83rem;
  color: #475569;
  position: relative;
  transition: background 0.15s, color 0.15s;
}

.side-link i {
  font-size: 1rem;
  width: 18px;
  text-align: center;
  color: #64748b;
}

.side-link:hover {
  background: #f3f4f6;
  color: var(--text-dark);
}

.side-link:hover i {
  color: var(--text-dark);
}

.side-link-active {
  background: #eff6ff;
  color: var(--accent);
  font-weight: 600;
}

.side-link-active i {
  color: var(--accent);
}

.side-badge {
  margin-left: auto;
  background: var(--c-red);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  min-width: 18px;
  text-align: center;
}

.sidebar-onehealth {
  padding: 0.5rem 0 0.25rem;
}

.oh-btn {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0.35rem 0.75rem;
  padding: 0.6rem 0.75rem;
  border-radius: 0.5rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: #fff;
}

.oh-btn i {
  font-size: 1rem;
}

.oh-green {
  background: linear-gradient(90deg, var(--c-green), var(--c-green-dark));
}

.oh-blue {
  background: linear-gradient(90deg, var(--c-blue), var(--c-blue-dark));
}

.oh-teal {
  background: linear-gradient(90deg, #14b8a6, #0d9488);
}

.sidebar-tagline {
  margin: auto 1rem 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.75rem;
  background: #f0fdf4;
  border: 1px solid #dcfce7;
  border-radius: 0.6rem;
}

.sidebar-tagline i {
  color: #16a34a;
  font-size: 1.3rem;
}

.sidebar-tagline p {
  font-size: 0.65rem;
  color: #15803d;
  margin: 0;
}

.sidebar-tagline strong {
  font-size: 0.78rem;
  color: #166534;
}

.sidebar-footer-admin {
  padding: 0.9rem 1.25rem 1.1rem;
  border-top: 1px solid var(--sidebar-border);
}

.side-logout {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: #475569;
  font-size: 0.8rem;
  margin-top: 0.35rem;
}

.side-logout:hover {
  color: var(--text-dark);
}

.sidebar-footer-public {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin: 0.5rem 1rem 1.1rem;
  padding: 0.65rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  color: #475569;
  font-size: 0.82rem;
  font-weight: 600;
  transition: all 0.15s;
}

.sidebar-footer-public:hover {
  background: #f3f4f6;
  color: var(--text-dark);
}

/* ============ TOPBAR ============ */
.app-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.app-topbar {
  /* position: fixed (bukan sticky) -- alasan sama seperti .app-sidebar di
     atas: overflow-x: hidden di html/body membuat overflow-y ikut jadi
     "auto" secara implisit, sehingga position: sticky bisa "lepas" dan
     header ikut ter-scroll ke atas alih-alih tetap diam. Fixed tidak
     bergantung pada ancestor manapun jadi selalu aman & konsisten. */
  position: fixed;
  top: 0;
  left: 17rem;
  right: 0;
  height: var(--topbar-h);
  background: #ffffff;
  border-bottom: 1px solid var(--card-border);
  padding: 0.85rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  z-index: 45;
  box-shadow: 0 2px 4px rgba(0, 0, 0, .02);
  transition: left 0.25s ease;
}

.sidebar-collapsed .app-topbar {
  left: 4.75rem;
}

/* Karena header sekarang position:fixed (lepas dari alur), konten <main>
   di bawahnya perlu diberi jarak atas supaya tidak tertutup header. */
.app-main>main {
  margin-top: var(--topbar-h);
}

#appTopbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  width: 100%;
}

.topbar-title {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.topbar-brand-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--c-blue), var(--c-teal));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.topbar-brand-text {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-dark);
  letter-spacing: 0.01em;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-left: auto;
}

.topbar-bell {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  font-size: 1rem;
  border: 1px solid #e2e8f0;
}

.topbar-bell:hover {
  background: #e2e8f0;
  color: var(--text-dark);
}

.topbar-user {
  position: relative;
}

.topbar-user-trigger {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.2rem;
  border-radius: 999px;
}

.topbar-user-trigger:hover .topbar-avatar {
  box-shadow: 0 0 0 3px rgba(47, 111, 237, 0.15);
}

.topbar-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--c-blue), var(--c-teal));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.1rem;
  flex-shrink: 0;
  transition: box-shadow 0.15s ease;
}

.topbar-avatar-lg {
  width: 42px;
  height: 42px;
  font-size: 1.2rem;
}

.topbar-user-caret {
  font-size: 0.85rem;
  color: var(--text-muted);
  transition: transform 0.15s ease;
}

.topbar-user.open .topbar-user-caret {
  transform: rotate(180deg);
}

.topbar-user-info {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.topbar-user-info span {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-dark);
}

.topbar-user-info small {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.topbar-user-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 240px;
  background: #ffffff;
  border: 1px solid var(--card-border);
  border-radius: 0.9rem;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.12);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s ease;
  z-index: 60;
  overflow: hidden;
}

.topbar-user.open .topbar-user-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.topbar-user-dropdown-head {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--card-border);
  background: #f8fafc;
}

.topbar-user-dropdown-menu {
  display: flex;
  flex-direction: column;
  padding: 0.4rem;
}

.topbar-user-dropdown-menu a,
.topbar-user-dropdown-menu button {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  text-align: left;
  padding: 0.6rem 0.7rem;
  border-radius: 0.6rem;
  border: none;
  background: none;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-dark);
  text-decoration: none;
  cursor: pointer;
}

.topbar-user-dropdown-menu a i,
.topbar-user-dropdown-menu button i {
  font-size: 1.05rem;
  color: var(--text-muted);
}

.topbar-user-dropdown-menu a:hover,
.topbar-user-dropdown-menu button:hover {
  background: #f1f5f9;
}

.topbar-user-dropdown-menu button {
  color: var(--c-red);
}

.topbar-user-dropdown-menu button i {
  color: var(--c-red);
}

@media (max-width: 480px) {
  .topbar-user-dropdown {
    min-width: 210px;
  }
}

/* ============ STAT CARDS ROW (Hando / Dashboard-KK style) ============ */
.stat-row {
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  padding-bottom: 0.25rem;
}

.stat-row::-webkit-scrollbar {
  height: 6px;
}

.stat-row::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 999px;
}

.stat-tile {
  flex: 1 1 0;
  min-width: 178px;
  border-radius: 0.6rem;
  padding: 1.1rem 1.25rem;
  background: #ffffff;
  color: var(--text-dark);
  position: relative;
  overflow: hidden;
  border: 1px solid var(--card-border);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.02);
  transition: transform 0.2s, box-shadow 0.2s;
}

.stat-tile:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.04);
}

.stat-tile-blue {
  border-left: 4px solid var(--c-blue);
}

.stat-tile-red {
  border-left: 4px solid var(--c-red);
}

.stat-tile-green {
  border-left: 4px solid var(--c-green);
}

.stat-tile-purple {
  border-left: 4px solid var(--c-purple);
}

.stat-tile-orange {
  border-left: 4px solid var(--c-orange);
}

.stat-tile-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.stat-tile-label {
  font-size: 0.63rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.stat-tile-icon {
  width: 32px;
  height: 32px;
  border-radius: 0.5rem;
  background: #f8fafc;
  border: 1px solid #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  position: relative;
  z-index: 1;
}

.stat-tile-blue .stat-tile-icon {
  color: var(--c-blue);
  background: #eff6ff;
}

.stat-tile-red .stat-tile-icon {
  color: var(--c-red);
  background: #fef2f2;
}

.stat-tile-green .stat-tile-icon {
  color: var(--c-green);
  background: #ecfdf5;
}

.stat-tile-purple .stat-tile-icon {
  color: var(--c-purple);
  background: #f5f3ff;
}

.stat-tile-orange .stat-tile-icon {
  color: var(--c-orange);
  background: #fffbeb;
}

.stat-tile-value {
  font-size: 1.7rem;
  font-weight: 800;
  line-height: 1;
  position: relative;
  z-index: 1;
  color: var(--text-dark);
}

.stat-tile-sub {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
  position: relative;
  z-index: 1;
}

.stat-tile-body {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-top: 0.55rem;
}

.stat-sparkline {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 35px;
  width: 50px;
  margin-bottom: 3px;
  transform-origin: bottom;
}

.stat-sparkline span {
  display: inline-block;
  width: 4px;
  height: 0;
  border-radius: 2px;
  transform-origin: bottom;
  animation: sparkGrow 0.8s cubic-bezier(0.25, 0.8, 0.25, 1) forwards, sparkWave 2s ease-in-out infinite alternate;
  animation-delay: var(--d), calc(var(--d) + 0.8s);
}

.stat-sparkline.blue span {
  background-color: var(--c-blue);
}

.stat-sparkline.red span {
  background-color: var(--c-red);
}

.stat-sparkline.green span {
  background-color: var(--c-green);
}

.stat-sparkline.purple span {
  background-color: var(--c-purple);
}

.stat-sparkline.orange span {
  background-color: var(--c-orange);
}

@keyframes sparkGrow {
  from {
    height: 0;
  }

  to {
    height: var(--h);
  }
}

@keyframes sparkWave {
  from {
    transform: scaleY(1);
  }

  to {
    transform: scaleY(0.7);
  }
}

/* ============ CARD / PANEL ============ */
.panel {
  background: #ffffff;
  border: 1px solid var(--card-border);
  border-radius: 0.6rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
}

/* Dashboard: kolom kanan (Tren Kasus / Alert / Distribusi Kasus) dibuat
   setinggi kolom kiri (Peta + Kasus Terbaru), lalu panel terakhir di kolom
   kanan (Distribusi Kasus) melar mengisi sisa ruang -- supaya bagian bawah
   kedua kolom selalu sejajar rata, berapa pun jumlah baris/isi di tiap panel. */
@media (min-width: 1024px) {
  #peta {
    align-items: stretch;
  }

  #peta>div.flex-col.h-full {
    min-height: 100%;
  }

  #peta .panel.flex-1 {
    flex: 1 1 0%;
    min-height: 0;
  }

  #peta .panel.flex-1>.p-4 {
    flex: 1 1 auto;
    min-height: 0;
  }
}

.panel-head {
  padding: 0.9rem 1.1rem;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.panel-head h2 {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-dark);
}

.panel-select {
  font-size: 0.75rem;
  color: #475569;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 0.4rem;
  padding: 0.3rem 0.6rem;
}

.chart-box {
  position: relative;
  width: 100%;
}

/* Map legend overlay */
.map-legend {
  position: absolute;
  right: 0.75rem;
  bottom: 0.75rem;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid #e2e8f0;
  border-radius: 0.6rem;
  padding: 0.65rem 0.85rem;
  font-size: 0.72rem;
  color: #475569;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
  z-index: 500;
}

.map-legend p {
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 0.35rem;
  font-size: 0.72rem;
}

.map-legend-body .legend-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.25rem;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.map-legend-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  cursor: pointer;
}

.map-legend-head p {
  margin-bottom: 0;
}

.map-legend-toggle {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: #f1f5f9;
  border-radius: 50%;
  color: #64748b;
  font-size: 0.7rem;
  cursor: pointer;
  transition: background 0.15s, transform 0.2s;
}

.map-legend-toggle:hover {
  background: #e2e8f0;
}

.map-legend-body {
  overflow: hidden;
  max-height: 200px;
  transition: max-height 0.25s ease, opacity 0.2s ease, margin-top 0.25s ease;
  opacity: 1;
  margin-top: 0.35rem;
}

.map-legend.collapsed .map-legend-body {
  max-height: 0;
  opacity: 0;
  margin-top: 0;
}

/* Alert list */
.alert-item {
  display: flex;
  gap: 0.65rem;
  padding: 0.7rem 1.1rem;
  border-bottom: 1px solid #f8fafc;
}

.alert-item:last-child {
  border-bottom: none;
}

.alert-icon {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  color: #fff;
}

.alert-icon-red {
  background: var(--c-red);
}

.alert-icon-orange {
  background: var(--c-orange);
}

.alert-icon-blue {
  background: var(--c-blue);
}

.alert-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-dark);
}

.alert-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 1px;
}

.alert-time {
  font-size: 0.68rem;
  color: #cbd5e1;
  margin-top: 3px;
}

/* Quick actions */
.aksi-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  padding: 1rem 1.1rem;
}

.aksi-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.9rem 0.5rem;
  border-radius: 0.6rem;
  color: #fff;
  text-align: center;
  font-size: 0.72rem;
  font-weight: 700;
  transition: transform 0.15s, opacity 0.15s;
}

.aksi-btn:hover {
  transform: translateY(-1px);
  opacity: 0.95;
}

.aksi-btn i {
  font-size: 1.3rem;
}

.aksi-btn small {
  font-weight: 500;
  opacity: 0.85;
  font-size: 0.62rem;
}

.aksi-green {
  background: linear-gradient(135deg, var(--c-green), var(--c-green-dark));
}

.aksi-blue {
  background: linear-gradient(135deg, var(--c-blue), var(--c-blue-dark));
}

.aksi-purple {
  background: linear-gradient(135deg, var(--c-purple), var(--c-purple-dark));
}

.aksi-teal {
  background: linear-gradient(135deg, #14b8a6, #0d9488);
}

/* Doughnut center label */
.donut-wrap {
  position: relative;
}

.donut-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.donut-center strong {
  font-size: 1.4rem;
  color: var(--text-dark);
}

.donut-center span {
  font-size: 0.65rem;
  color: var(--text-muted);
}

.donut-legend-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.35rem 1.1rem;
  font-size: 0.78rem;
}

.donut-legend-row .dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 0.5rem;
}

.donut-legend-row .lbl {
  display: flex;
  align-items: center;
  color: #475569;
}

.donut-legend-row .val {
  color: var(--text-muted);
  font-weight: 600;
}

/* Distribusi Kasus: dropdown detail (buka/tutup), supaya tinggi card
   tidak berubah-ubah mengikuti banyaknya jenis kasus */
.dist-legend-wrap {
  flex-shrink: 0;
  min-height: 0;
}

.dist-legend-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  cursor: pointer;
  padding: 0.4rem 1.1rem;
  border-top: 1px solid #f1f5f9;
}

.dist-legend-head p {
  font-weight: 700;
  color: var(--text-dark);
  font-size: 0.78rem;
  margin: 0;
}

.dist-legend-toggle {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: #f1f5f9;
  border-radius: 50%;
  color: #64748b;
  font-size: 0.7rem;
  cursor: pointer;
  transition: background 0.15s, transform 0.2s;
}

.dist-legend-toggle:hover {
  background: #e2e8f0;
}

.dist-legend-body {
  overflow-y: auto;
  max-height: 160px;
  transition: max-height 0.25s ease, opacity 0.2s ease;
  opacity: 1;
}

.dist-legend-body.collapsed {
  max-height: 0;
  opacity: 0;
}

@media (max-width: 1024px) {
  .app-sidebar {
    position: fixed;
    left: -17rem;
    top: 0;
    z-index: 100;
    transition: left .2s;
    height: 100vh;
    overflow-y: auto;
    width: 17rem;
    min-width: 17rem;
  }

  .app-sidebar.open {
    left: 0;
  }

  .mobile-menu-btn {
    display: flex;
  }

  /* Di layar sempit sidebar jadi overlay off-canvas, jadi konten utama
     tidak perlu diberi jarak (margin-left) sama sekali. */
  .app-main,
  .sidebar-collapsed .app-main {
    margin-left: 0;
  }

  .app-topbar,
  .sidebar-collapsed .app-topbar {
    left: 0;
  }
}

/* ============ RESPONSIVE MOBILE (HP) ============ */
@media (max-width: 640px) {

  /* Kartu statistik: dari geser-samping (dan kepotong di pinggir) menjadi
     grid 2 kolom yang rapi dan selalu terlihat utuh di layar HP. */
  .stat-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    overflow-x: visible;
  }

  .stat-tile {
    min-width: 0;
    padding: 0.85rem;
  }

  .stat-tile-label {
    font-size: 0.68rem;
  }

  .stat-tile-value {
    font-size: 1.25rem;
  }

  /* Peta diperpendek sedikit di layar kecil supaya tidak perlu banyak
     scroll vertikal untuk sampai ke konten di bawahnya. */
  #map,
  .map-container {
    height: 260px;
  }

  .app-topbar {
    padding: 0.7rem 1rem;
  }

  main {
    padding: 0.85rem !important;
    gap: 0.85rem !important;
  }

  /* Grid & panel: rapatkan jarak antar-elemen supaya lebih banyak konten
     terlihat sekaligus tanpa terasa sesak. */
  .grid.lg\:grid-cols-3,
  .grid.md\:grid-cols-3 {
    gap: 0.85rem !important;
  }

  .panel-head {
    padding: 0.85rem 1rem;
  }

  .panel-head h2 {
    font-size: 0.9rem;
  }

  /* ===== Chart & donut: pastikan selalu pas di dalam panelnya, tidak
     pernah meluber ke luar kartu / layar. ===== */
  .chart-box,
  .donut-wrap {
    width: 100%;
    max-width: 100%;
    overflow: hidden;
  }

  .chart-box canvas,
  .donut-wrap canvas {
    max-width: 100% !important;
  }

  .aksi-grid {
    gap: 0.6rem;
    padding: 0.85rem;
  }

  .aksi-btn {
    padding: 0.75rem 0.4rem;
    font-size: 0.68rem;
  }

  .aksi-btn i {
    font-size: 1.1rem;
  }

  /* ===== Tabel jadi bentuk kartu bertumpuk (tanpa geser horizontal) =====
     Alih-alih memaksa banyak kolom muat berdampingan di layar sempit
     (yang selalu berujung kepotong / harus digeser), tiap baris tabel
     ditampilkan sebagai kartu: label kolom di kiri, isi datanya di kanan.
     Ini yang membuat tabel benar-benar "menyesuaikan" ukuran HP. */
  .table-wrap {
    overflow-x: visible;
  }

  table.data-table thead {
    display: none;
  }

  table.data-table,
  table.data-table tbody,
  table.data-table tr {
    display: block;
    width: 100%;
  }

  table.data-table tr {
    margin-bottom: 0.65rem;
    border: 1px solid var(--card-border);
    border-radius: 0.9rem;
    padding: 0.35rem 0.9rem;
    background: #fff;
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.05);
  }

  table.data-table tr:last-child {
    margin-bottom: 0;
  }

  table.data-table td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    width: 100%;
    max-width: none !important;
    white-space: normal !important;
    text-align: right;
    padding: 0.55rem 0;
    border-bottom: 1px dashed #f1f5f9;
    font-size: 0.8rem;
  }

  table.data-table td:last-child {
    border-bottom: none;
  }

  table.data-table td::before {
    content: attr(data-label);
    flex-shrink: 0;
    text-align: left;
    font-weight: 600;
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-right: 0.75rem;
  }

  /* Sel tanpa data-label (mis. baris "Belum ada data" dengan colspan)
     tampil apa adanya, tanpa label semu di depannya. */
  table.data-table td:not([data-label])::before {
    content: none;
  }

  table.data-table td[colspan] {
    display: block;
    text-align: center;
  }

  table.data-table td[colspan]::before {
    content: none;
  }
}

.btn-primary {
  background: var(--accent);
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  transition: background 0.2s;
  border: 1px solid var(--accent);
}

.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn-outline {
  border: 1px solid #cbd5e1;
  color: #475569;
  padding: 0.5rem 1rem;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  background: white;
  transition: background 0.2s, border-color 0.2s;
}

.btn-outline:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.badge-aktif {
  background: #e7e5e4;
  color: #57534e;
}

.badge-verifikasi {
  background: #fef3c7;
  color: #92400e;
}

.badge-selesai {
  background: #e2e8f0;
  color: #475569;
}

.badge-menunggu {
  background: #f1f5f9;
  color: #64748b;
}

.badge-disetujui {
  background: #d1fae5;
  color: #065f46;
}

.badge-ditolak {
  background: #fee2e2;
  color: #991b1b;
}

.icon-btn-circle {
  width: 2.15rem;
  height: 2.15rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9999px;
  background: #14b8a6;
  color: #ffffff;
  border: 1px solid #14b8a6;
  font-size: 1rem;
  box-shadow: 0 2px 6px rgba(20, 184, 166, 0.35);
  transition: background 0.2s, transform 0.15s;
}

.icon-btn-circle:hover {
  background: #0d9488;
}

.icon-btn-circle:active {
  transform: scale(0.94);
}

.icon-btn-circle-slate {
  background: #2f6fed;
  color: #ffffff;
  border-color: #2f6fed;
  box-shadow: 0 2px 6px rgba(47, 111, 237, 0.35);
}

.icon-btn-circle-slate:hover {
  background: #2158c9;
}

.icon-btn-circle-red {
  background: #ef4444;
  color: #ffffff;
  border-color: #ef4444;
  box-shadow: 0 2px 6px rgba(239, 68, 68, 0.35);
}

.icon-btn-circle-red:hover {
  background: #dc2626;
}

/* ============ FILTER TABS (Kelola Data Kasus: Semua/Aktif/Verifikasi/Selesai) ============ */
.filter-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.filter-tab {
  padding: 0.4rem 0.95rem;
  border-radius: 9999px;
  font-size: 0.82rem;
  font-weight: 500;
  background: #ffffff;
  color: #64748b;
  border: 1px solid #e2e8f0;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  cursor: pointer;
}

.filter-tab:hover {
  background: #f1f5f9;
  color: #334155;
}

.filter-tab.active {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

.btn-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.8rem;
  font-weight: 500;
  border: 1px solid transparent;
  transition: background 0.2s;
}

.btn-pill-purple {
  background: #eef2ff;
  color: #4f46e5;
  border-color: #e0e7ff;
}

.btn-pill-purple:hover {
  background: #e0e7ff;
}

.btn-pill-green {
  background: #ecfdf5;
  color: #059669;
  border-color: #d1fae5;
}

.btn-pill-green:hover {
  background: #d1fae5;
}

.btn-pill-red {
  background: #fef2f2;
  color: #dc2626;
  border-color: #fee2e2;
}

.btn-pill-red:hover {
  background: #fee2e2;
}

/* Kolom "Tindakan" di tabel Pengajuan: tag-tag tindakan ditampilkan langsung + tombol kelola kecil */
.tindakan-cell-wrap {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: center;
}

.tindakan-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  justify-content: center;
  max-width: 220px;
  margin: 0 auto;
}

.tindakan-tag {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 9999px;
  background: #eef2ff;
  color: #4f46e5;
  border: 1px solid #e0e7ff;
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
}

.tindakan-tag-empty {
  background: #f1f5f9;
  color: #94a3b8;
  border-color: #e2e8f0;
  font-weight: 400;
  font-style: italic;
}

/* Tag tindakan versi read-only (dipakai di halaman Data Kasus, tanpa interaksi) */
.tindakan-tag-readonly {
  background: #f0fdf4;
  color: #15803d;
  border-color: #dcfce7;
}

.tindakan-edit-btn {
  width: 1.7rem;
  height: 1.7rem;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9999px;
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #e2e8f0;
  font-size: 0.75rem;
  transition: background 0.2s;
}

.tindakan-edit-btn:hover {
  background: #e2e8f0;
}

/* ============ DAFTAR TINDAKAN (master aksi tindak lanjut pengajuan) ============ */
.tindakan-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 0.9rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
  color: #334155;
  background: #f8fafc;
}

.tindakan-list-item:last-child {
  margin-bottom: 0;
}

/* Popup "Tindakan" per pengajuan (dibuka dari kolom Tindakan di tabel Pengajuan) */
.tindakan-modal-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  max-height: 260px;
  overflow-y: auto;
}

.tindakan-modal-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.4rem;
  font-size: 0.85rem;
  color: #334155;
  background: #f8fafc;
}

.tindakan-remove-btn {
  width: 1.5rem;
  height: 1.5rem;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9999px;
  color: #dc2626;
  background: #fef2f2;
  border: 1px solid #fee2e2;
  font-size: 0.7rem;
  transition: background 0.2s;
}

.tindakan-remove-btn:hover {
  background: #fee2e2;
}

#map,
.map-container {
  height: 450px;
  z-index: 1;
}

.leaflet-container {
  border-radius: 0.375rem;
}

.sidebar-overlay {
  display: none;
}

@media (max-width: 1024px) {
  .sidebar-overlay.open {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    z-index: 90;
  }
}

.form-input {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 0.375rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  background: white;
}

.form-input:focus {
  outline: none;
  border-color: #94a3b8;
  box-shadow: 0 0 0 2px rgba(148, 163, 184, 0.2);
}

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

table.data-table {
  width: 100%;
  font-size: 0.875rem;
}

table.data-table th {
  background: #f8fafc;
  color: var(--text-muted);
  font-weight: 600;
  text-align: left;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #e2e8f0;
}

table.data-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #f1f5f9;
  color: #475569;
  vertical-align: middle;
}

table.data-table tr:hover td {
  background: #f8fafc;
}

.mobile-row-summary {
  display: none;
}

/* Tabel "Pengajuan dari Masyarakat": judul kolom rata tengah, dan beberapa
   kolom isinya (Pelapor, Foto, Status, Aksi) juga dipusatkan supaya lebih
   enak dilihat. Dibatasi ke layar desktop (min-width: 641px) supaya tidak
   merusak tampilan kartu di layar HP, yang isinya sudah rata kanan by design. */
table.data-table.pengajuan-table th {
  text-align: center !important;
}

@media (min-width: 641px) {

  table.data-table.pengajuan-table td[data-label="Pelapor"],
  table.data-table.pengajuan-table td[data-label="Foto"],
  table.data-table.pengajuan-table td[data-label="Status"],
  table.data-table.pengajuan-table td[data-label="Aksi"],
  table.data-table.pengajuan-table td[data-label="Tindakan"] {
    text-align: center !important;
  }

  table.data-table.kasus-table td[data-label="Foto"],
  table.data-table.kasus-table td[data-label="Status"],
  table.data-table.kasus-table td[data-label="Tindakan"],
  table.data-table.kasus-table td[data-label="Aksi"] {
    text-align: center !important;
  }
}

.modal-overlay {
  position: fixed !important;
  inset: 0 !important;
  background: rgba(15, 23, 42, 0.6) !important;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: 2000 !important;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: fadeIn 0.18s ease forwards;
}

.modal-overlay.modal-closing {
  animation: modalOverlayOut 0.15s ease forwards;
}

@keyframes modalOverlayOut {
  from {
    opacity: 1;
  }

  to {
    opacity: 0;
  }
}

.modal-box {
  background-color: #ffffff !important;
  border-radius: 0.75rem;
  max-width: 640px;
  width: 95%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 60px -10px rgba(15, 23, 42, 0.35);
  opacity: 1 !important;
}

.modal-pop {
  animation: modalPop 0.22s cubic-bezier(0.25, 0.8, 0.25, 1) forwards;
}

@keyframes modalPop {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(10px);
  }

  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal-box-sm {
  max-width: 420px;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem 1.25rem;
  border-bottom: 1px solid #eef1f6;
  flex-shrink: 0;
}

.modal-head h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-dark);
}

.modal-close {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #f1f5f9;
  color: #64748b;
  font-size: 1rem;
  border: none;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.modal-close:hover {
  background: #fee2e2;
  color: #dc2626;
}

.modal-body {
  padding: 1.25rem;
  overflow-y: auto;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.6rem;
  padding: 1rem 1.25rem;
  border-top: 1px solid #f1f5f9;
  flex-shrink: 0;
}

/* Confirm / prompt style popup (Hando alert-modal) */
.modal-confirm-body {
  padding: 1.85rem 1.5rem 1.25rem;
  text-align: center;
}

.modal-icon-badge {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
  font-size: 1.5rem;
}

.modal-icon-red {
  background: #fef2f2;
  color: var(--c-red);
}

.modal-icon-orange {
  background: #fffbeb;
  color: var(--c-orange);
}

.modal-icon-green {
  background: #ecfdf5;
  color: var(--c-green);
}

.modal-icon-blue {
  background: #eff6ff;
  color: var(--c-blue);
}

.modal-confirm-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 0.4rem;
}

.modal-confirm-text {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.55;
}

.btn-danger {
  background: var(--c-red);
  border-color: var(--c-red);
}

.btn-danger:hover {
  background: var(--c-red-dark);
  border-color: var(--c-red-dark);
}

.input-error {
  border-color: var(--c-red) !important;
  box-shadow: 0 0 0 2px rgba(230, 72, 62, 0.15) !important;
}

.coord-display {
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 0.375rem;
  padding: 0.75rem;
  font-family: monospace;
  font-size: 0.8125rem;
  color: #64748b;
}

/* ============ LOGIN PAGE (Tema Hando) ============ */
.login-card {
  background: #ffffff;
  border-radius: 1rem;
  overflow: hidden;
  box-shadow: 0 20px 45px -12px rgba(37, 99, 235, 0.25);
  border: 1px solid #eef2f7;
}

.login-card-header {
  background: linear-gradient(135deg, var(--c-blue) 0%, var(--c-purple) 100%);
  color: #fff;
  text-align: center;
  padding: 2.1rem 1.5rem 1.75rem;
}

.login-icon-badge {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 0.85rem;
  font-size: 1.5rem;
}

.login-card-header h2 {
  font-size: 1.3rem;
  font-weight: 800;
  margin: 0;
  letter-spacing: 0.01em;
}

.login-card-header p {
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.85);
  margin: 0.3rem 0 0;
}

.login-card-body {
  padding: 1.75rem 1.75rem 0.5rem;
}

.login-field {
  margin-bottom: 1.1rem;
}

.login-field label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: #475569;
  margin-bottom: 0.35rem;
}

.login-input-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: #f3f6fb;
  border: 1px solid #e6ebf3;
  border-radius: 0.6rem;
  padding: 0 0.8rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.login-input-wrap:focus-within {
  border-color: var(--c-blue);
  box-shadow: 0 0 0 3px rgba(47, 111, 237, 0.12);
}

.login-input-wrap i {
  color: #94a3b8;
  font-size: 1rem;
}

.login-input-wrap input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  padding: 0.7rem 0;
  font-size: 0.875rem;
  color: var(--text-dark);
  outline: none;
}

.login-eye-toggle {
  border: none;
  background: none;
  color: #94a3b8;
  cursor: pointer;
  display: flex;
  align-items: center;
  padding: 0.3rem;
}

.login-eye-toggle:hover {
  color: #475569;
}

.login-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.login-checkbox {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.8rem;
  color: #475569;
  cursor: pointer;
}

.login-checkbox input {
  accent-color: var(--c-blue);
  width: 15px;
  height: 15px;
}

.login-link {
  font-size: 0.8rem;
  color: var(--c-purple);
  font-weight: 600;
  text-decoration: none;
  background: none;
  border: none;
  cursor: pointer;
}

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

.login-submit-btn {
  width: 100%;
  border: none;
  cursor: pointer;
  padding: 0.85rem;
  border-radius: 0.6rem;
  font-size: 0.9rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, var(--c-blue) 0%, var(--c-purple) 100%);
  box-shadow: 0 10px 20px -6px rgba(109, 74, 230, 0.45);
  transition: transform 0.15s, box-shadow 0.15s;
  margin-bottom: 0.9rem;
}

.login-submit-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 24px -6px rgba(109, 74, 230, 0.55);
}

.login-submit-btn:active {
  transform: translateY(0);
}

.login-submit-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

.login-card-footer {
  text-align: center;
  padding: 0 1.75rem 1.6rem;
  font-size: 0.8rem;
}

.login-card-footer a {
  color: #94a3b8;
  text-decoration: none;
}

.login-card-footer a:hover {
  color: #475569;
}

.login-hint {
  text-align: center;
  font-size: 0.72rem;
  color: #94a3b8;
  margin-top: 1rem;
}

.login-wrap {
  width: 100%;
  max-width: 400px;
  margin: 0 1rem;
}

/* ===== Info nomor WhatsApp admin yang sedang dipakai (halaman Pengaturan) ===== */
.wa-current-box {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  background: #eff6ff;
  border: 1px solid #dbeafe;
  border-radius: 0.6rem;
  padding: 0.85rem 1rem;
  margin-bottom: 1.1rem;
}

.wa-current-box i {
  color: var(--c-blue);
  font-size: 1.1rem;
  margin-top: 0.1rem;
}

.wa-current-label {
  font-size: 0.72rem;
  color: #64748b;
  margin: 0 0 0.15rem;
}

.wa-current-value {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-dark);
  margin: 0;
  font-variant-numeric: tabular-nums;
}

/* ===== Baris yang disorot saat admin buka link dari notifikasi WhatsApp ===== */
@keyframes rowHighlightFade {
  0% {
    background-color: #fef08a;
  }

  100% {
    background-color: transparent;
  }
}

tr.row-highlight td {
  animation: rowHighlightFade 4s ease-out forwards;
}

/* ============ NOTIFIKASI: Pengajuan Menunggu (belum ditindaklanjuti) ============ */
.notif-stack {
  position: fixed;
  top: 5.5rem;
  right: 1rem;
  z-index: 5000;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  width: min(360px, calc(100vw - 2rem));
  animation: fadeInUp 0.3s ease;
}

.notif-stack-out {
  animation: notifStackOut 0.35s ease forwards;
}

@keyframes notifStackOut {
  to {
    opacity: 0;
    transform: translateY(-10px);
  }
}

.notif-card {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  background: #ffffff;
  border: 1px solid #fde68a;
  border-left: 4px solid var(--c-orange);
  border-radius: 0.6rem;
  padding: 0.75rem 0.85rem;
  box-shadow: 0 12px 30px -10px rgba(15, 23, 42, 0.28);
  cursor: pointer;
  transition: transform 0.15s ease;
}

.notif-card:hover {
  transform: translateY(-2px);
}

.notif-card-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #fffbeb;
  color: var(--c-orange);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.9rem;
  margin-top: 0.05rem;
}

.notif-card-body {
  flex: 1;
  min-width: 0;
}

.notif-card-body p {
  font-size: 0.8rem;
  color: var(--text-dark);
  line-height: 1.5;
  margin: 0;
}

.notif-card-close {
  border: none;
  background: none;
  color: #94a3b8;
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  cursor: pointer;
}

.notif-card-close:hover {
  background: #f1f5f9;
  color: #475569;
}

.notif-card-more {
  justify-content: center;
  text-align: center;
  background: #f8fafc;
  border-left-color: #cbd5e1;
}

.notif-card-more p {
  color: var(--accent);
  font-weight: 600;
}

@media (max-width: 640px) {
  .notif-stack {
    top: auto;
    bottom: 1rem;
    left: 0.75rem;
    right: 0.75rem;
    width: auto;
  }
}

.mobile-app-home,
.mobile-tabbar {
  display: none;
}

@media (max-width: 768px) {
  html {
    scroll-behavior: smooth;
  }

  .mobile-app-home {
    display: block;
    margin-top: calc(var(--topbar-h) + 0.75rem);
    padding: 0 1rem 1.5rem;
  }

  body.page-home .app-main>main {
    margin-top: 0;
  }

  .mah-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-bottom: 0.9rem;
  }

  .mah-action-card {
    background: #ffffff;
    border: 1px solid var(--card-border);
    border-radius: 1.1rem;
    padding: 1.1rem 0.9rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
    text-align: center;
    text-decoration: none;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.05);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
  }

  .mah-action-card:active {
    transform: scale(0.97);
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
  }

  .mah-action-icon {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
  }

  .mah-action-blue .mah-action-icon {
    background: rgba(47, 111, 237, 0.1);
    color: var(--c-blue);
  }

  .mah-action-green .mah-action-icon {
    background: rgba(33, 166, 120, 0.1);
    color: var(--c-green);
  }

  .mah-action-label {
    font-weight: 700;
    font-size: 0.92rem;
    color: var(--text-dark);
  }

  .mah-highlight {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    background: linear-gradient(135deg, var(--c-blue) 0%, var(--c-blue-dark) 100%);
    border-radius: 1.1rem;
    padding: 1rem 1.1rem;
    text-decoration: none;
    color: #ffffff;
    margin-bottom: 1.4rem;
    box-shadow: 0 8px 20px rgba(47, 111, 237, 0.25);
  }

  .mah-highlight-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.18);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
  }

  .mah-highlight-body {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    flex: 1;
    min-width: 0;
  }

  .mah-highlight-body strong {
    font-size: 0.92rem;
    font-weight: 700;
  }

  .mah-highlight-body span {
    font-size: 0.8rem;
    opacity: 0.9;
  }

  .mah-highlight-arrow {
    font-size: 1.1rem;
    opacity: 0.85;
  }

  .mah-why h2 {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--text-dark);
    margin-bottom: 0.9rem;
  }

  .mah-why-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 1rem;
  }

  .mah-why-icon {
    width: 38px;
    height: 38px;
    border-radius: 0.7rem;
    background: #eef2ff;
    color: var(--c-purple);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    flex-shrink: 0;
  }

  .mah-why-item strong {
    display: block;
    font-size: 0.9rem;
    color: var(--text-dark);
    margin-bottom: 0.15rem;
  }

  .mah-why-item p {
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.45;
    margin: 0;
  }

  .mah-about-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: none;
    border: none;
    border-top: 1px solid var(--card-border);
    padding: 1rem 0 0.4rem;
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text-dark);
    cursor: pointer;
  }

  .mah-about-toggle i {
    color: var(--text-muted);
    transition: transform 0.2s ease;
  }

  .mah-about-toggle.open i {
    transform: rotate(90deg);
  }

  .mah-about-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease;
  }

  .mah-about-body.open {
    max-height: 140px;
  }

  .mah-about-body p {
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.55;
    padding-top: 0.6rem;
  }

  .app-shell .p-4.md\:p-6>.stat-row {
    margin-top: 0.5rem;
  }

  .app-main {
    padding-bottom: 64px;
  }

  .mobile-tabbar {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 500;
    background: #ffffff;
    border-top: 1px solid var(--card-border);
    box-shadow: 0 -4px 16px rgba(15, 23, 42, 0.06);
    padding: 0.45rem 0.4rem calc(0.45rem + env(safe-area-inset-bottom, 0px));
  }

  .mtb-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.68rem;
    font-weight: 600;
    padding: 0.2rem 0;
    position: relative;
  }

  .mtb-item i {
    font-size: 1.25rem;
  }

  .mtb-item.mtb-active {
    color: var(--accent);
  }

  .mtb-item.mtb-active::before {
    content: '';
    position: absolute;
    top: -0.1rem;
    left: 50%;
    transform: translateX(-50%);
    width: 22px;
    height: 3px;
    border-radius: 999px;
    background: var(--accent);
  }
}

@media (max-width: 768px) {
  :root {
    --topbar-h: 58px;
  }

  .app-topbar {
    padding: 0.6rem 1rem !important;
  }

  .topbar-brand-text {
    font-size: 0.85rem !important;
  }

  .topbar-brand-icon {
    width: 30px !important;
    height: 30px !important;
    font-size: 0.95rem !important;
  }

  .mobile-menu-btn {
    display: none !important;
  }

  table.data-table tr.tr-accordion {
    cursor: pointer;
  }

  table.data-table tr.tr-accordion td.row-detail {
    display: none;
  }

  table.data-table tr.tr-accordion.tr-open td.row-detail {
    display: flex;
  }

  table.data-table tr.tr-accordion td[data-label="Kecamatan"],
  table.data-table.pengajuan-table tr.tr-accordion td[data-label="Tanggal"] {
    font-weight: 700;
    color: var(--accent);
    padding-left: 0;
  }

  table.data-table tr.tr-accordion td[data-label="Kecamatan"]::before,
  table.data-table.pengajuan-table tr.tr-accordion td[data-label="Tanggal"]::before {
    content: none;
  }

  .mobile-row-summary {
    display: inline;
    color: var(--text-muted);
    font-weight: 600;
    margin-right: 0.15rem;
  }

  .td-value-with-caret {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    color: var(--accent);
    width: 100%;
  }

  .tr-accordion-caret {
    width: 26px;
    height: 26px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 9999px;
    background: rgba(47, 111, 237, 0.12);
    color: var(--accent);
    font-size: 0.85rem;
    order: -1;
    transition: transform 0.2s ease, background 0.2s ease;
  }

  table.data-table tr.tr-accordion.tr-open .tr-accordion-caret {
    background: var(--accent);
    color: #ffffff;
  }

  table.data-table tr.tr-accordion.tr-open .tr-accordion-caret {
    transform: rotate(180deg);
  }
}

@media (max-width: 768px) {
  .mtb-icon-wrap {
    position: relative;
    display: inline-flex;
  }

  .mtb-badge {
    position: absolute;
    top: -2px;
    right: -5px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--c-red);
    border: 1.5px solid #fff;
  }

  .mtb-badge.hidden {
    display: none;
  }

  .mobile-toolbar {
    display: flex;
    gap: 0.6rem;
    margin-bottom: 0.9rem;
  }

  .mobile-toolbar select.mobile-filter-select {
    flex: 1;
    height: 40px;
    border-radius: 0.6rem;
    border: 1px solid var(--card-border);
    background: #fff;
    padding: 0 0.75rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-dark);
  }

  details.mobile-dropdown {
    position: relative;
    flex-shrink: 0;
  }

  details.mobile-dropdown summary {
    list-style: none;
    height: 40px;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0 0.9rem;
    border-radius: 0.6rem;
    border: 1px solid var(--card-border);
    background: #fff;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-dark);
    cursor: pointer;
  }

  details.mobile-dropdown summary::-webkit-details-marker {
    display: none;
  }

  details.mobile-dropdown[open] summary {
    border-color: var(--accent);
    color: var(--accent);
  }

  details.mobile-dropdown .mobile-dropdown-panel {
    position: absolute;
    right: 0;
    top: calc(100% + 0.4rem);
    z-index: 60;
    background: #fff;
    border: 1px solid var(--card-border);
    border-radius: 0.7rem;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.1);
    padding: 0.6rem;
    display: none;
    flex-direction: column;
    gap: 0.4rem;
    width: 200px;
    max-width: calc(100vw - 2rem);
  }

  details.mobile-dropdown[open] .mobile-dropdown-panel {
    display: flex;
  }

  details.mobile-dropdown .mobile-dropdown-panel .btn-outline {
    width: 100%;
    justify-content: flex-start;
  }

  .desktop-only-toolbar {
    display: none !important;
  }
}

@media (min-width: 769px) {
  .mobile-toolbar {
    display: none !important;
  }
}

/* ===================== Dropdown checkbox "Gejala" ===================== 
   Dipakai di form Ajukan Data Kasus (publik) & form Tambah/Edit Data Kasus
   (admin), lihat public/js/gejala.js. */
.gejala-dropdown {
  position: relative;
}

.gejala-dropdown-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  text-align: left;
  cursor: pointer;
}

.gejala-dropdown-trigger span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gejala-dropdown-panel {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  margin-top: 4px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.12);
  z-index: 9999;
  overflow: hidden;
}

.gejala-dropdown-panel.hidden {
  display: none !important;
}

.gejala-dropdown-search {
  width: 100%;
  border: none;
  border-bottom: 1px solid #e2e8f0;
  padding: 0.6rem 0.85rem;
  font-size: 0.85rem;
  outline: none;
}

.gejala-dropdown-list {
  max-height: 260px;
  overflow-y: auto;
}

.gejala-dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.5rem 0.85rem;
  font-size: 0.825rem;
  color: #334155;
  cursor: pointer;
}

.gejala-dropdown-item:hover {
  background: #f1f5f9;
}

.gejala-dropdown-item input[type="checkbox"] {
  flex-shrink: 0;
  width: 15px;
  height: 15px;
  accent-color: var(--c-blue, #2563eb);
}

.gejala-dropdown-empty {
  padding: 0.6rem 0.85rem;
  font-size: 0.8rem;
  color: #94a3b8;
  font-style: italic;
}

.kemungkinan-penyakit-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.kemungkinan-penyakit-tag {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  background: #fef3c7;
  color: #92400e;
  font-size: 0.7rem;
  font-weight: 500;
  white-space: nowrap;
}

/* ======================================================================
   DARK MODE
   Diaktifkan dengan menambahkan class "dark" ke <html>. Lihat js/theme.js
   ====================================================================== */
html.dark {
  --accent: #3b82f6;
  --accent-hover: #60a5fa;
  --sidebar-bg: #111827;
  --sidebar-border: #1f2937;
  --card-border: #1f2937;

  --text-dark: #e5e7eb;
  --text-muted: #94a3b8;
  --bg-main: #0b1120;
}

html.dark body {
  background-color: var(--bg-main) !important;
}

html.dark .app-sidebar {
  color: #cbd5e1;
}

html.dark .app-topbar,
html.dark .panel,
html.dark .stat-tile,
html.dark .modal-box,
html.dark .login-card,
html.dark .topbar-user-dropdown,
html.dark .notif-card,
html.dark .gejala-dropdown-panel {
  background-color: #111827 !important;
}

html.dark .brand-logo {
  background: none;
  box-shadow: none;
}

html.dark .sidebar-region,
html.dark .panel-select,
html.dark table.data-table th,
html.dark table.data-table tr:hover td,
html.dark .side-link:hover,
html.dark .sidebar-footer-public:hover,
html.dark .topbar-user-dropdown-head,
html.dark .topbar-user-dropdown-menu a:hover,
html.dark .topbar-user-dropdown-menu button:hover,
html.dark .gejala-dropdown-item:hover,
html.dark .coord-display {
  background-color: #1a2332 !important;
}

html.dark .sidebar-region,
html.dark table.data-table th,
html.dark table.data-table td,
html.dark .panel-select,
html.dark .coord-display,
html.dark .gejala-dropdown-panel,
html.dark .gejala-dropdown-search,
html.dark .gejala-dropdown-item:hover+.gejala-dropdown-item,
html.dark .sidebar-footer-public,
html.dark .sidebar-footer-admin,
html.dark .modal-head,
html.dark .modal-footer,
html.dark .panel-head,
html.dark .topbar-user-dropdown-head {
  border-color: #1f2937 !important;
}

html.dark .sidebar-region,
html.dark .panel-select,
html.dark .side-link,
html.dark .side-logout,
html.dark .sidebar-footer-public,
html.dark .login-field label,
html.dark .login-checkbox,
html.dark .login-eye-toggle,
html.dark .gejala-dropdown-item,
html.dark .wa-current-label {
  color: #94a3b8 !important;
}

html.dark .side-link i {
  color: #94a3b8;
}

html.dark .side-link:hover,
html.dark .side-link:hover i,
html.dark .sidebar-footer-public:hover {
  color: #f1f5f9 !important;
}

html.dark .side-link-active {
  background: rgba(59, 130, 246, 0.18) !important;
  color: #60a5fa !important;
}

html.dark .side-link-active i {
  color: #60a5fa !important;
}

html.dark .sidebar-section-title {
  color: #64748b;
}

html.dark .sidebar-tagline {
  background: rgba(34, 197, 94, 0.1);
  border-color: rgba(34, 197, 94, 0.25);
}

html.dark .sidebar-tagline p {
  color: #86efac;
}

html.dark .sidebar-tagline strong {
  color: #bbf7d0;
}

html.dark .btn-outline {
  background: #111827;
  border-color: #334155;
  color: #cbd5e1;
}

html.dark .btn-outline:hover {
  background: #1a2332;
  border-color: #475569;
}

html.dark .form-input,
html.dark .login-input-wrap,
html.dark .gejala-dropdown-search {
  background: #0b1120;
  border-color: #334155;
  color: #e5e7eb;
}

html.dark .form-input:focus {
  border-color: #64748b;
}

html.dark .form-input::placeholder,
html.dark .login-input-wrap input::placeholder {
  color: #64748b;
}

html.dark .login-input-wrap input {
  color: #e5e7eb;
}

html.dark table.data-table td {
  color: #cbd5e1;
  border-color: #1f2937 !important;
}

html.dark .modal-overlay {
  background: rgba(0, 0, 0, 0.6);
}

html.dark .modal-close {
  background: #1f2937;
  color: #94a3b8;
}

html.dark .modal-icon-badge {
  filter: brightness(0.9);
}

html.dark .notif-card {
  border-color: #3f3a1f;
  box-shadow: 0 12px 30px -10px rgba(0, 0, 0, 0.6);
}

html.dark .wa-current-box {
  background: rgba(59, 130, 246, 0.12);
  border-color: rgba(59, 130, 246, 0.25);
}

html.dark .stat-row::-webkit-scrollbar-thumb,
html.dark .app-sidebar::-webkit-scrollbar-thumb {
  background: #334155;
}

html.dark .badge-aktif {
  background: #374151;
  color: #d1d5db;
}

html.dark .badge-selesai {
  background: #1e293b;
  color: #cbd5e1;
}

html.dark .badge-menunggu {
  background: #1e293b;
  color: #94a3b8;
}

html.dark .badge-verifikasi {
  background: #422006;
  color: #fcd34d;
}

html.dark .badge-disetujui {
  background: #052e1c;
  color: #6ee7b7;
}

html.dark .badge-ditolak {
  background: #450a0a;
  color: #fca5a5;
}

html.dark .kemungkinan-penyakit-tag {
  background: #422006;
  color: #fcd34d;
}

html.dark .icon-btn-circle {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

html.dark .icon-btn-circle-slate {
  background: #3b82f6;
  color: #ffffff;
  border-color: #3b82f6;
}

html.dark .icon-btn-circle-slate:hover {
  background: #2563eb;
}

html.dark .icon-btn-circle-red {
  background: #ef4444;
  color: #ffffff;
  border-color: #ef4444;
}

html.dark .icon-btn-circle-red:hover {
  background: #dc2626;
}

html.dark .login-wrap .login-card-footer a,
html.dark .login-hint {
  color: #64748b;
}

html.dark ::-webkit-scrollbar-track {
  background: #0b1120;
}

/* Theme toggle button (dipasang di topbar) */
.theme-toggle-btn {
  width: 40px;
  height: 40px;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--card-border);
  background: #f8fafc;
  color: #475569;
  font-size: 1.05rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}

.theme-toggle-btn:hover {
  background: #eef2f7;
}

.theme-toggle-btn .ti-moon {
  display: none;
}

html.dark .theme-toggle-btn .ti-sun {
  display: none;
}

html.dark .theme-toggle-btn .ti-moon {
  display: inline-block;
}

html.dark .theme-toggle-btn {
  background: #1f2937;
  border-color: #334155;
  color: #fbbf24;
}

html.dark .theme-toggle-btn:hover {
  background: #263043;
}

/* Override warna teks/BG utility Tailwind polos yang dipakai di beberapa
   halaman (mis. pengajuan.html) supaya tetap kebaca saat dark mode aktif. */
html.dark .text-slate-700,
html.dark .text-slate-600 {
  color: #cbd5e1 !important;
}

html.dark .text-slate-500,
html.dark .text-slate-400,
html.dark .text-slate-300 {
  color: #94a3b8 !important;
}

html.dark .bg-slate-50,
html.dark .bg-slate-100,
html.dark .bg-white {
  background-color: #111827 !important;
}

html.dark .border-slate-100,
html.dark .border-slate-200 {
  border-color: #1f2937 !important;
}

html.dark .bg-slate-50.min-h-screen,
html.dark body.bg-slate-50 {
  background-color: var(--bg-main) !important;
}

/* ======================================================================
   DARK MODE — mobile bottom navbar, home action cards, dan kartu tabel
   di layar HP (lihat juga bagian "Tabel jadi bentuk kartu bertumpuk"
   dan .mobile-tabbar / .mah-action-card di atas).
   ====================================================================== */
html.dark .mobile-tabbar {
  background-color: #0f172a !important;
  border-top-color: #1f2937 !important;
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.4);
}

html.dark .mtb-item {
  color: #64748b;
}

html.dark .mtb-item i {
  color: #64748b;
}

html.dark .mtb-item.mtb-active,
html.dark .mtb-item.mtb-active i {
  color: #60a5fa !important;
}

html.dark .mah-action-card {
  background: #111827 !important;
  border-color: #1f2937 !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}

html.dark .mah-action-label {
  color: #e5e7eb !important;
}

html.dark .mah-highlight {
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
}

html.dark .mah-why-icon {
  background: rgba(101, 68, 214, 0.18);
}

html.dark .mah-about-toggle {
  border-top-color: #1f2937;
}

@media (max-width: 640px) {

  html.dark table.data-table tr {
    background: #111827 !important;
    border-color: #1f2937 !important;
  }

  html.dark table.data-table td {
    border-bottom-color: #1f2937 !important;
  }

  html.dark table.data-table td::before {
    color: #94a3b8;
  }
}

@media (max-width: 768px) {

  html.dark .mobile-toolbar select.mobile-filter-select,
  html.dark details.mobile-dropdown summary,
  html.dark details.mobile-dropdown .mobile-dropdown-panel {
    background: #111827 !important;
    border-color: #1f2937 !important;
    color: #e5e7eb !important;
  }
}

/* ======================================================================
   MOBILE — tabel/kartu lebih padat + scroll di dalam kartu (bukan
   scroll panjang di seluruh halaman). Panel pembungkus tabel dibatasi
   tingginya dan digulir sendiri secara vertikal.
   ====================================================================== */
@media (max-width: 640px) {

  .table-wrap {
    max-height: calc(100vh - var(--topbar-h, 58px) - 190px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-right: 0.25rem;
  }

  table.data-table tr {
    margin-bottom: 0.5rem;
    padding: 0.15rem 0.7rem;
    border-radius: 0.5rem;
  }

  table.data-table td {
    padding: 0.4rem 0;
    font-size: 0.76rem;
  }

  table.data-table td::before {
    font-size: 0.68rem;
  }

  .table-wrap::-webkit-scrollbar {
    width: 5px;
  }

  .table-wrap::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 999px;
  }

  html.dark .table-wrap::-webkit-scrollbar-thumb {
    background: #334155;
  }
}