/* ==========================================================================
   MIDER 2.0 — KONSEP 2: HIGH-TECH GIS COMMAND CENTER
   Sektor Pangan, Pertanian & Perikanan Kota Cirebon
   Design Theme: Tactical Geospatial Command & Telemetry Center
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600;700&family=Plus+Jakarta+Sans:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;1,400&family=Space+Grotesk:wght@500;600;700&display=swap');

:root,
[data-theme="dark"],
[data-theme="light"] {
  /* Ultra-Deep Obsidian Command Palette */
  --bg: #040711;
  --bg-gradient: radial-gradient(circle at 50% 0%, #0d1e3d 0%, #040711 70%);
  --surface: #070d1a;
  --surface-raised: #0b1426;
  --panel: #080f20;
  --panel2: #0e1830;
  --card-bg: linear-gradient(170deg, #0a1224 0%, #060b17 100%);
  --card-text: #f8fafc;
  --text: #f1f5f9;
  --muted: #788ca6;
  --muted-soft: #4b5e78;

  /* Tactical Hairline Borders & High-Tech Glow */
  --line: rgba(56, 189, 248, 0.12);
  --line-strong: rgba(56, 189, 248, 0.25);
  --card-border: 1px solid rgba(56, 189, 248, 0.16);
  --card-hover-border: 1px solid rgba(0, 240, 255, 0.55);

  /* Space-Grade Telemetry Accents */
  --primary: #00f0ff;         /* High-Voltage Cyan / Bahari & Perikanan */
  --primary2: #0284c7;
  --primary-glow: rgba(0, 240, 255, 0.22);
  --success: #00ff9d;         /* Signal Emerald / Pertanian & Normal */
  --warning: #fbbf24;         /* Radar Amber / Ketahanan Pangan */
  --danger: #ff3366;          /* Alert Crimson / Rentan & Kritis */
  --purple: #a78bfa;          /* Spectral Violet */
  --teal: #14b8a6;

  --blue: var(--primary);
  --blue2: var(--primary2);
  --green: var(--success);
  --red: var(--danger);
  --orange: var(--warning);

  /* Tactical Sidebar */
  --sidebar-bg: #050a16;
  --sidebar-text: #8899b3;
  --sidebar-title: #00f0ff;
  --sidebar-hover: rgba(0, 240, 255, 0.05);
  --sidebar-active-bg: linear-gradient(90deg, rgba(0, 240, 255, 0.16) 0%, rgba(0, 240, 255, 0.02) 100%);
  --sidebar-active-text: #00f0ff;
  --sidebar-active-line: #00f0ff;
  --sidebar-border: rgba(56, 189, 248, 0.14);

  /* Command Topbar HUD */
  --topbar-bg: rgba(5, 10, 22, 0.88);
  --topbar-text: #ffffff;
  --topbar-muted: #8899b3;
  --topbar-border: rgba(56, 189, 248, 0.18);

  /* Tactical Form Controls */
  --filter-bg: #060b18;
  --filter-text: #f8fafc;
  --filter-border: rgba(56, 189, 248, 0.2);
  --filter-focus: #00f0ff;

  /* Buttons */
  --button-primary-bg: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  --button-primary-text: #ffffff;
  --button-secondary-bg: rgba(56, 189, 248, 0.06);
  --button-secondary-text: #e2e8f0;

  /* Tables */
  --table-header-bg: #060c1c;
  --table-header-text: #94a3b8;
  --table-row-bg: #080f22;
  --table-row-alt: #050a18;
  --table-hover: rgba(0, 240, 255, 0.08);

  /* Footer & Legend */
  --footer-bg: #050a16;
  --footer-text: #788ca6;
  --footer-border: rgba(56, 189, 248, 0.12);
  --legend-bg: rgba(6, 12, 26, 0.95);
  --legend-text: #f8fafc;
  --legend-border: rgba(56, 189, 248, 0.25);

  /* High-Contrast Telemetry Charts */
  --chart-1: #00f0ff;
  --chart-2: #00ff9d;
  --chart-3: #fbbf24;
  --chart-4: #ff3366;
  --chart-5: #a78bfa;
  --chart-6: #14b8a6;

  --radius: 12px;
  --radius-sm: 6px;
  --radius-lg: 16px;
  --shadow: 0 16px 40px -8px rgba(0, 0, 0, 0.85), 0 0 1px 1px rgba(56, 189, 248, 0.14);
  --softShadow: 0 6px 20px -2px rgba(0, 0, 0, 0.65);
}

/* =====================================================
   BASE & CYBERNETIC GRID CANVAS
   ===================================================== */
* {
  box-sizing: border-box;
}

html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg);
  background-image: 
    radial-gradient(circle at 50% 0%, rgba(56, 189, 248, 0.12) 0%, transparent 60%),
    linear-gradient(rgba(56, 189, 248, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(56, 189, 248, 0.035) 1px, transparent 1px);
  background-size: 100% 100%, 36px 36px, 36px 36px;
  background-attachment: fixed;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.5;
}

.app-layout {
  display: flex;
  height: 100vh;
  background: transparent;
  overflow: hidden;
}

/* =====================================================
   TACTICAL GIS SIDEBAR
   ===================================================== */
.sidebar {
  width: 290px;
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  z-index: 1000;
  padding: 24px 16px;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  border-right: 1px solid var(--sidebar-border);
  overflow-y: auto;
  overflow-x: hidden;
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 6px 0 35px rgba(0, 0, 0, 0.65);
}

.sidebar.collapsed {
  transform: translateX(-290px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--sidebar-border);
  position: relative;
}

.brand::after {
  content: "CMD-GIS";
  position: absolute;
  right: 0;
  top: 2px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--primary);
  background: rgba(0, 240, 255, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid rgba(0, 240, 255, 0.25);
}

.brand-logo {
  width: 44px;
  height: 44px;
  object-fit: contain;
  border-radius: 10px;
  padding: 4px;
  background: rgba(0, 240, 255, 0.08);
  border: 1px solid rgba(0, 240, 255, 0.3);
  box-shadow: 0 0 16px rgba(0, 240, 255, 0.2);
}

.brand h2 {
  margin: 0;
  color: var(--topbar-text);
  font-family: 'Space Grotesk', sans-serif;
  font-size: 21px;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.15;
}

.brand span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.35;
  letter-spacing: 0.01em;
}

.sidebar-title {
  margin: 22px 6px 10px;
  color: var(--sidebar-title);
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.1em;
  display: flex;
  align-items: center;
  gap: 6px;
}

.sidebar-title::before {
  content: "//";
  color: var(--muted-soft);
}

.sidebar-menu,
#sidebarMapTahun button {
  width: 100%;
  min-height: 38px;
  margin-bottom: 4px;
  padding: 8px 12px;
  border: 1px solid transparent;
  border-left: 3px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--sidebar-text);
  text-align: left;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* =====================================================
   MULTILINE ADAPTIVE CATEGORY BUTTONS (2 LINES MAXIMUM)
   ===================================================== */
#sidebarKategori button {
  width: 100%;
  min-height: 40px;
  height: auto;
  margin-bottom: 4px;
  padding: 7px 12px;
  border: 1px solid transparent;
  border-left: 3px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--sidebar-text);
  text-align: left;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: normal !important;
  word-break: break-word;
  overflow-wrap: break-word;
  line-height: 1.25;
}

#sidebarKategori button .kategori-text,
#sidebarKategori button > span {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.25;
  width: 100%;
  word-break: break-word;
  overflow-wrap: break-word;
}

/* Ukuran teks menyesuaikan secara adaptif sesuai panjang nama kategori */
#sidebarKategori button.kategori-compact {
  font-size: 11px;
  padding: 6px 11px;
}

#sidebarKategori button.kategori-compact .kategori-text,
#sidebarKategori button.kategori-compact > span {
  line-height: 1.22;
}

#sidebarKategori button.kategori-mini {
  font-size: 10.2px;
  padding: 5px 10px;
  letter-spacing: -0.01em;
}

#sidebarKategori button.kategori-mini .kategori-text,
#sidebarKategori button.kategori-mini > span {
  line-height: 1.18;
}

/* Adaptasi tombol Urusan & Indikator */
#sidebarUrusan button,
#sidebarIndikator button {
  width: 100%;
  min-height: 38px;
  height: auto;
  margin-bottom: 4px;
  padding: 7px 11px;
  border: 1px solid transparent;
  border-left: 3px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--sidebar-text);
  text-align: left;
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: normal !important;
  word-break: break-word;
  overflow-wrap: break-word;
  line-height: 1.25;
}

#sidebarUrusan button .urusan-text,
#sidebarUrusan button > span,
#sidebarIndikator button .indikator-text,
#sidebarIndikator button > span {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.25;
  width: 100%;
  word-break: break-word;
  overflow-wrap: break-word;
}

#sidebarIndikator button.indikator-compact {
  font-size: 10.8px;
  line-height: 1.2;
}

#sidebarIndikator button.indikator-mini {
  font-size: 10px;
  line-height: 1.16;
}

.sidebar-menu:hover,
#sidebarUrusan button:hover,
#sidebarKategori button:hover,
#sidebarIndikator button:hover,
#sidebarMapTahun button:hover {
  background: var(--sidebar-hover);
  color: var(--topbar-text);
  border-color: rgba(0, 240, 255, 0.15);
  transform: translateX(2px);
}

.sidebar-menu.active,
.active-filter,
#sidebarUrusan button.active-filter,
#sidebarKategori button.active-filter,
#sidebarIndikator button.active-filter {
  background: var(--sidebar-active-bg) !important;
  color: var(--sidebar-active-text) !important;
  border-left-color: var(--sidebar-active-line) !important;
  border-color: rgba(0, 240, 255, 0.3) !important;
  font-weight: 700 !important;
  box-shadow: 0 0 16px rgba(0, 240, 255, 0.18) !important;
}

/* =====================================================
   MAIN CONTENT & COMMAND CENTER HEADER
   ===================================================== */
.main-content {
  margin-left: 290px;
  width: calc(100% - 290px);
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  background: transparent;
  transition: margin-left 0.28s cubic-bezier(0.4, 0, 0.2, 1), width 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

.main-content.fullscreen {
  margin-left: 0;
  width: 100%;
}

.mobile-overlay {
  display: none;
}

.layer-content,
#dashboardLayer,
#mapLayer {
  position: relative;
  z-index: 1;
  padding: 22px 30px 40px;
  max-width: 1640px;
  margin: 0 auto;
}

header,
.topbar {
  position: sticky;
  top: 0;
  z-index: 900;
  min-height: 72px;
  padding: 12px 30px;
  display: flex;
  align-items: center;
  background: var(--topbar-bg) !important;
  color: var(--topbar-text) !important;
  border-bottom: 1px solid var(--topbar-border) !important;
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.7), inset 0 -1px 0 rgba(0, 240, 255, 0.18);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
}

.hamburger {
  width: 40px !important;
  height: 40px !important;
  min-width: 40px !important;
  padding: 0 !important;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--button-secondary-bg);
  color: var(--text);
  font-size: 18px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.hamburger:hover {
  background: var(--panel2);
  border-color: var(--primary);
  color: var(--primary);
  box-shadow: 0 0 12px rgba(0, 240, 255, 0.25);
}

/* Hide theme toggle permanently */
.theme-toggle,
#themeToggle {
  display: none !important;
}

/* Telemetry Live Status Badge */
.command-center-status {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px;
  border-radius: 6px;
  background: rgba(6, 12, 26, 0.8);
  border: 1px solid rgba(0, 240, 255, 0.28);
  box-shadow: 0 0 14px rgba(0, 240, 255, 0.12), inset 0 0 8px rgba(0, 240, 255, 0.05);
  font-family: 'JetBrains Mono', monospace;
  user-select: none;
}

.status-pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #00ff9d;
  box-shadow: 0 0 10px #00ff9d;
  animation: radarPulse 1.8s infinite cubic-bezier(0.4, 0, 0.6, 1);
}

@keyframes radarPulse {
  0% { transform: scale(0.9); opacity: 0.7; box-shadow: 0 0 4px #00ff9d; }
  50% { transform: scale(1.25); opacity: 1; box-shadow: 0 0 14px #00ff9d; }
  100% { transform: scale(0.9); opacity: 0.7; box-shadow: 0 0 4px #00ff9d; }
}

.status-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: #cbd5e1;
}

.status-badge-code {
  font-size: 10px;
  font-weight: 700;
  color: #00ff9d;
  background: rgba(0, 255, 157, 0.12);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid rgba(0, 255, 157, 0.3);
  letter-spacing: 0.05em;
}

.header-logo {
  width: 42px;
  height: 42px;
  object-fit: contain;
  border-radius: 10px;
  background: rgba(0, 240, 255, 0.08);
  border: 1px solid rgba(0, 240, 255, 0.25);
  padding: 4px;
  box-shadow: 0 0 16px rgba(0, 240, 255, 0.18);
}

.header-title h1 {
  margin: 0;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 20px;
  line-height: 1.15;
  color: var(--topbar-text) !important;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.header-title p {
  margin: 2px 0 0;
  color: var(--topbar-muted) !important;
  font-size: 12px;
  line-height: 1.35;
  font-weight: 500;
}

/* =====================================================
   FILTERS & CONTROLS HUD
   ===================================================== */
.panel,
.card {
  background: var(--card-bg);
  color: var(--text);
  border: var(--card-border);
  border-radius: var(--radius);
  box-shadow: var(--softShadow);
}

.panel {
  padding: 16px 20px;
}

.filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
  background: var(--panel);
  border: var(--card-border);
  border-radius: var(--radius);
  box-shadow: var(--softShadow);
  padding: 16px 20px;
  position: relative;
}

.filters::before {
  content: "FILTER TELEMETRI";
  position: absolute;
  top: -9px;
  left: 20px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--primary);
  background: var(--bg);
  padding: 0 8px;
  border-radius: 4px;
  border: 1px solid rgba(0, 240, 255, 0.25);
}

label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

select,
input {
  width: 100%;
  height: 42px;
  padding: 0 14px;
  border: 1px solid var(--filter-border);
  border-radius: 8px;
  background: var(--filter-bg);
  color: var(--filter-text);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  outline: none;
  transition: all 0.2s ease;
  box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.5);
}

select {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2300f0ff' stroke-width='2.2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 15px;
  padding-right: 38px;
  -webkit-appearance: none;
  appearance: none;
}

select:hover,
input:hover {
  border-color: rgba(0, 240, 255, 0.4);
}

select:focus,
input:focus {
  border-color: var(--filter-focus);
  box-shadow: 0 0 0 3px rgba(0, 240, 255, 0.2), inset 0 1px 4px rgba(0, 0, 0, 0.5);
}

/* =====================================================
   ACTIONS BAR
   ===================================================== */
.actions {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 12px 0 22px;
  padding: 12px 18px;
  border: var(--card-border);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--softShadow);
}

button {
  height: 40px;
  border: 0;
  border-radius: 8px;
  padding: 0 18px;
  cursor: pointer;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: var(--button-primary-bg);
  color: var(--button-primary-text);
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.35);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 240, 255, 0.35);
}

button:active {
  transform: translateY(0);
}

button.secondary {
  background: var(--button-secondary-bg);
  color: var(--button-secondary-text);
  border: 1px solid var(--line);
  box-shadow: none;
}

button.secondary:hover {
  background: rgba(0, 240, 255, 0.08);
  border-color: var(--primary);
  color: var(--primary);
  box-shadow: 0 0 12px rgba(0, 240, 255, 0.2);
}

button.green {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3);
}

button.green:hover {
  box-shadow: 0 6px 20px rgba(0, 255, 157, 0.4);
}

/* =====================================================
   COMMAND CENTER SUMMARY CARDS
   ===================================================== */
.summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin: 18px 0 24px;
}

.summary .card {
  min-height: 110px;
  padding: 18px 18px 16px 90px;
  position: relative;
  overflow: hidden;
  background: linear-gradient(165deg, #0b1428 0%, #050a16 100%);
  color: var(--card-text);
  border: var(--card-border);
  border-radius: var(--radius);
  box-shadow: var(--softShadow);
  transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

.summary .card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
  border-color: rgba(0, 240, 255, 0.45);
}

.summary .card::before {
  content: "";
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  width: 52px;
  height: 52px;
  border-radius: 10px;
  background: radial-gradient(circle, rgba(0, 240, 255, 0.2) 0%, rgba(0, 240, 255, 0.03) 100%);
  border: 1px solid rgba(0, 240, 255, 0.35);
  box-shadow: 0 0 16px rgba(0, 240, 255, 0.15);
  transition: all 0.2s ease;
}

.summary .card:nth-child(2)::before {
  background: radial-gradient(circle, rgba(0, 255, 157, 0.2) 0%, rgba(0, 255, 157, 0.03) 100%);
  border-color: rgba(0, 255, 157, 0.35);
  box-shadow: 0 0 16px rgba(0, 255, 157, 0.15);
}

.summary .card:nth-child(3)::before {
  background: radial-gradient(circle, rgba(251, 191, 36, 0.2) 0%, rgba(251, 191, 36, 0.03) 100%);
  border-color: rgba(251, 191, 36, 0.35);
  box-shadow: 0 0 16px rgba(251, 191, 36, 0.15);
}

.summary .card:nth-child(4)::before {
  background: radial-gradient(circle, rgba(255, 51, 102, 0.2) 0%, rgba(255, 51, 102, 0.03) 100%);
  border-color: rgba(255, 51, 102, 0.35);
  box-shadow: 0 0 16px rgba(255, 51, 102, 0.15);
}

.summary .card::after {
  position: absolute;
  left: 33px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 22px;
  line-height: 1;
  font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif;
  pointer-events: none;
}

.summary .card:nth-child(1)::after { content: "📊"; }
.summary .card:nth-child(2)::after { content: "📅"; }
.summary .card:nth-child(3)::after { content: "📈"; }
.summary .card:nth-child(4)::after { content: "📉"; }

.summary b {
  display: block;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 34px;
  line-height: 1.05;
  font-weight: 700;
  color: var(--chart-1);
  letter-spacing: -0.03em;
  font-feature-settings: "tnum" 1;
  text-shadow: 0 0 20px rgba(0, 240, 255, 0.35);
}

.summary .card:nth-child(2) b { color: var(--chart-2); text-shadow: 0 0 20px rgba(0, 255, 157, 0.35); }
.summary .card:nth-child(3) b { color: var(--chart-3); text-shadow: 0 0 20px rgba(251, 191, 36, 0.35); }
.summary .card:nth-child(4) b { color: var(--chart-4); text-shadow: 0 0 20px rgba(255, 51, 102, 0.35); }

.summary span,
.meta {
  color: var(--muted) !important;
}

.summary span {
  display: block;
  margin-top: 5px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

/* =====================================================
   COMMAND SECTION HEADERS
   ===================================================== */
.section {
  margin: 22px 0 0;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-radius: var(--radius) var(--radius) 0 0;
  border: var(--card-border);
  border-bottom: 0;
  background: var(--panel);
  position: relative;
}

.section h2 {
  margin: 0;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 17px;
  color: var(--text);
  font-weight: 700;
  letter-spacing: 0.01em;
  display: flex;
  align-items: center;
}

.section h2::before {
  content: "";
  display: inline-block;
  width: 4px;
  height: 16px;
  border-radius: 2px;
  background: var(--primary);
  margin-right: 10px;
  box-shadow: 0 0 10px rgba(0, 240, 255, 0.8);
}

.section p {
  margin: 4px 0 0 14px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
  font-weight: 500;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 6px;
  background: rgba(0, 240, 255, 0.1);
  color: var(--primary);
  border: 1px solid rgba(0, 240, 255, 0.3);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

/* =====================================================
   KPIS TELEMETRY TILES
   ===================================================== */
.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  padding: 18px;
  border: var(--card-border);
  border-top: 1px solid var(--line);
  border-radius: 0 0 var(--radius) var(--radius);
  margin-bottom: 22px;
  background: var(--panel);
}

.kpi {
  min-height: 162px;
  padding: 16px 14px;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: linear-gradient(165deg, #091224 0%, #050a16 100%);
  color: var(--card-text);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
}

.kpi:hover {
  transform: translateY(-3px);
  border-color: rgba(0, 240, 255, 0.45);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.6), 0 0 16px rgba(0, 240, 255, 0.18);
}

.kpi h3 {
  margin: 0 auto 8px;
  max-width: 220px;
  min-height: 34px;
  font-size: 12px;
  line-height: 1.4;
  color: var(--card-text);
  font-weight: 700;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.kpi .value {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 26px;
  line-height: 1.1;
  font-weight: 700;
  color: var(--chart-1);
  letter-spacing: -0.02em;
  font-feature-settings: "tnum" 1;
  text-shadow: 0 0 14px rgba(0, 240, 255, 0.3);
}

.kpi:nth-child(6n+2) .value { color: var(--chart-2); text-shadow: 0 0 14px rgba(0, 255, 157, 0.3); }
.kpi:nth-child(6n+3) .value { color: var(--chart-3); text-shadow: 0 0 14px rgba(251, 191, 36, 0.3); }
.kpi:nth-child(6n+4) .value { color: var(--chart-4); text-shadow: 0 0 14px rgba(255, 51, 102, 0.3); }
.kpi:nth-child(6n+5) .value { color: var(--chart-5); text-shadow: 0 0 14px rgba(167, 139, 250, 0.3); }
.kpi:nth-child(6n+6) .value { color: var(--chart-6); text-shadow: 0 0 14px rgba(20, 184, 166, 0.3); }

.kpi .meta {
  font-size: 11px;
  text-align: center;
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.35;
  font-family: 'JetBrains Mono', monospace;
}

#kpiGrid .kpi h3::before {
  display: none !important;
}

#indicatorCharts {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

#indicatorCharts .kpi {
  min-height: 220px;
  text-align: left;
  padding: 14px;
}

#indicatorCharts .kpi h3 {
  text-align: center;
  max-width: 260px;
  min-height: 34px;
  margin-bottom: 10px;
}

#indicatorCharts .kpi h3::before {
  display: none;
}

#indicatorCharts canvas {
  max-height: 140px !important;
  width: 100% !important;
}

/* =====================================================
   TRENDS & BADGES
   ===================================================== */
.trend {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 6px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  margin-top: 8px;
}

.trend.up {
  color: var(--success);
  background: rgba(0, 255, 157, 0.12);
  border: 1px solid rgba(0, 255, 157, 0.3);
}

.trend.down {
  color: var(--danger);
  background: rgba(255, 51, 102, 0.12);
  border: 1px solid rgba(255, 51, 102, 0.3);
}

.trend.flat {
  color: var(--warning);
  background: rgba(251, 191, 36, 0.12);
  border: 1px solid rgba(251, 191, 36, 0.3);
}

.periodTag {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(0, 240, 255, 0.1);
  color: var(--primary);
  border: 1px solid rgba(0, 240, 255, 0.25);
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  vertical-align: middle;
}

.insights,
.insightSection,
.insightBox {
  display: none !important;
}

.grid2 {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 16px;
}

/* =====================================================
   HIGH-PRECISION MATRIX DATA TABLE
   ===================================================== */
.tableWrap {
  overflow-x: auto !important;
  overflow-y: visible !important;
  max-width: 100%;
  border-radius: 0 0 var(--radius) var(--radius);
  background: var(--panel);
  border: var(--card-border);
  border-top: 0;
  box-shadow: var(--softShadow);
}

.matrix {
  width: 100%;
  min-width: 900px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12.5px;
  table-layout: auto;
}

.matrix th,
.matrix td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  text-align: center;
  vertical-align: middle;
  white-space: nowrap;
}

.matrix th {
  background: var(--table-header-bg);
  color: var(--table-header-text);
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 1px 0 rgba(0, 240, 255, 0.25);
}

.matrix td {
  background: var(--table-row-bg);
  color: var(--text);
  font-weight: 500;
}

.matrix td:nth-child(4),
.matrix th:nth-child(4) {
  white-space: normal;
  min-width: 250px;
  text-align: left;
  font-weight: 600;
}

.matrix td:nth-child(n+5) {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
}

.matrix tr:nth-child(even) td {
  background: var(--table-row-alt);
}

.matrix tr:hover td {
  background: var(--table-hover);
  color: #ffffff;
}

/* =====================================================
   TACTICAL GIS COMMAND MAP
   ===================================================== */
#map {
  height: 560px;
  width: 100%;
  border-radius: var(--radius);
  overflow: hidden;
  margin-top: 14px;
  box-shadow: var(--shadow);
  border: var(--card-border);
  position: relative;
  z-index: 1;
}

.leaflet-container {
  font-family: inherit;
  border-radius: var(--radius);
  background: #040711 !important;
}

/* Dark GIS Basemap Filter Enhancement */
.leaflet-tile-pane {
  filter: brightness(0.9) contrast(1.15);
}

.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  background: #080f22 !important;
  color: var(--text) !important;
  border: 1px solid rgba(0, 240, 255, 0.4) !important;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.8), 0 0 16px rgba(0, 240, 255, 0.25) !important;
  border-radius: 10px !important;
}

.leaflet-popup-content,
.leaflet-popup-content * {
  color: var(--text) !important;
}

.leaflet-popup-content h4,
.leaflet-popup-content b {
  font-family: 'Space Grotesk', sans-serif;
  color: #00f0ff !important;
}

.leaflet-popup-content small,
.leaflet-popup-content .muted,
.leaflet-popup-content .meta {
  color: var(--muted) !important;
  font-family: 'JetBrains Mono', monospace;
}

.leaflet-popup-close-button {
  color: var(--text) !important;
  padding: 6px !important;
}

.leaflet-bar {
  border: 1px solid rgba(0, 240, 255, 0.3) !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.7) !important;
  border-radius: 8px !important;
  overflow: hidden;
}

.leaflet-bar a {
  background-color: #080f22 !important;
  border-bottom: 1px solid rgba(0, 240, 255, 0.2) !important;
  color: #00f0ff !important;
}

.leaflet-bar a:hover {
  background-color: #0e1830 !important;
  color: #ffffff !important;
}

.leaflet-control-layers {
  background: rgba(8, 15, 34, 0.94) !important;
  color: #f1f5f9 !important;
  border: 1px solid rgba(56, 189, 248, 0.3) !important;
  border-radius: 8px !important;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.7), 0 0 12px rgba(56, 189, 248, 0.15) !important;
  backdrop-filter: blur(12px) !important;
  -webkit-backdrop-filter: blur(12px) !important;
  font-family: 'Plus Jakarta Sans', sans-serif !important;
  font-size: 12px !important;
  padding: 8px 12px !important;
}

.leaflet-control-layers-toggle {
  background-color: rgba(8, 15, 34, 0.9) !important;
  border-radius: 8px !important;
  border: 1px solid rgba(56, 189, 248, 0.3) !important;
}

.leaflet-control-layers label {
  color: #cbd5e1 !important;
  font-size: 11.5px !important;
  font-weight: 500 !important;
  cursor: pointer;
  margin-bottom: 5px;
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
  text-transform: none !important;
}

.leaflet-control-layers label:hover {
  color: #38bdf8 !important;
}

.leaflet-control-layers input[type="radio"],
.leaflet-control-layers input[type="checkbox"] {
  accent-color: #0284c7;
  cursor: pointer;
  width: 14px !important;
  height: 14px !important;
  margin: 0 !important;
}

.mider-map-legend,
.leaflet-control .mider-map-legend-box,
.mider-map-legend-box {
  position: absolute;
  right: 20px;
  bottom: 20px;
  z-index: 650;
  min-width: 210px;
  padding: 14px 16px;
  background: var(--legend-bg);
  color: var(--legend-text);
  border: 1px solid var(--legend-border);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.8), 0 0 16px rgba(0, 240, 255, 0.15);
  font-size: 12px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.mider-map-legend-title {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--primary);
  font-size: 11.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.mider-map-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 7px 0;
  font-weight: 500;
}

.mider-map-legend-color {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  display: inline-block;
  flex-shrink: 0;
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.5);
}

.map-top-filter {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 14px;
  margin-top: 16px;
}

.map-level-box,
.map-year-box,
.map-kecamatan-box,
.map-kelurahan-box {
  min-width: 190px;
}

#mapLayer .section {
  margin-bottom: 18px !important;
  border-radius: var(--radius) !important;
  border: var(--card-border) !important;
}

#mapLayer > .card,
#mapLayer .card:has(#map) {
  margin-top: 18px !important;
  padding: 16px !important;
  border-radius: var(--radius-lg) !important;
  border: var(--card-border) !important;
  background: var(--panel) !important;
  box-shadow: var(--shadow) !important;
  overflow: hidden !important;
}

#mapLayer #map {
  margin: 0 !important;
  height: 570px !important;
  min-height: 570px !important;
  border-radius: var(--radius) !important;
  border: 1px solid var(--line) !important;
}

/* =====================================================
   COMMAND CENTER FOOTER
   ===================================================== */
.footer {
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  margin-top: 26px;
  padding: 14px;
  font-weight: 500;
  line-height: 1.6;
}

.footer b {
  font-family: 'Space Grotesk', sans-serif;
  letter-spacing: 0.08em;
  color: var(--text);
}

.footer span {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.mider-dynamic-footer {
  margin: 20px 30px 30px;
  padding: 12px 20px;
  border: 1px solid var(--footer-border);
  border-radius: var(--radius);
  background: var(--footer-bg);
  color: var(--footer-text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 12px;
  box-shadow: var(--softShadow);
  font-family: 'JetBrains Mono', monospace;
}

.mider-dynamic-footer div {
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}

#footerStatus {
  color: var(--success);
  font-weight: 700;
}

.hidden,
.hide-main-filter {
  display: none !important;
}

/* =====================================================
   TACTICAL SCROLLBAR
   ===================================================== */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: #040711;
}

::-webkit-scrollbar-thumb {
  background: rgba(0, 240, 255, 0.25);
  border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--primary);
  box-shadow: 0 0 10px rgba(0, 240, 255, 0.6);
}

* {
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 240, 255, 0.25) #040711;
}

/* =====================================================
   MAINTENANCE MODE
   ===================================================== */
#maintenanceMode {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 9999999;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
}

.maintenance-box {
  max-width: 500px;
  padding: 32px 24px;
}

.maintenance-icon {
  font-size: 56px;
  margin-bottom: 16px;
}

.maintenance-box h1 {
  margin: 0 0 10px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: clamp(30px, 5vw, 48px);
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -0.04em;
}

.maintenance-box p {
  margin: 0 0 8px;
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
}

.maintenance-box small {
  color: var(--muted);
  font-size: 13.5px;
}

/* =====================================================
   SAFE-AREA & MOBILE RESPONSIVE
   ===================================================== */
:root {
  --mider-safe-top: env(safe-area-inset-top, 0px);
  --mider-safe-right: env(safe-area-inset-right, 0px);
  --mider-safe-bottom: env(safe-area-inset-bottom, 0px);
  --mider-safe-left: env(safe-area-inset-left, 0px);
  --mider-android-statusbar-space: 24px;
}

@supports (height: 100dvh) {
  html,
  body,
  .app-layout,
  .main-content {
    height: 100dvh !important;
    max-height: 100dvh !important;
  }
}

@media (max-width: 1200px) {
  .summary {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-290px);
    height: 100vh;
    padding-top: calc(20px + max(var(--mider-safe-top), var(--mider-android-statusbar-space))) !important;
    padding-left: calc(20px + var(--mider-safe-left)) !important;
    padding-bottom: calc(20px + var(--mider-safe-bottom)) !important;
  }

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

  .main-content,
  .main-content.fullscreen {
    margin-left: 0;
    width: 100%;
    height: 100vh;
  }

  .mobile-overlay.active {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 950;
  }

  header,
  .topbar {
    top: 0 !important;
    min-height: calc(76px + max(var(--mider-safe-top), var(--mider-android-statusbar-space))) !important;
    padding-top: calc(12px + max(var(--mider-safe-top), var(--mider-android-statusbar-space))) !important;
    padding-right: calc(16px + var(--mider-safe-right)) !important;
    padding-bottom: 12px !important;
    padding-left: calc(16px + var(--mider-safe-left)) !important;
    overflow: visible !important;
    z-index: 1200 !important;
  }

  .topbar-left {
    min-height: 44px !important;
    align-items: center !important;
    gap: 12px;
  }

  .hamburger,
  .header-logo {
    flex: 0 0 auto !important;
  }

  .header-title {
    min-width: 0 !important;
    flex: 1 1 auto !important;
  }

  .header-title h1 {
    font-size: 18px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  .header-title p {
    font-size: 11px !important;
    line-height: 1.25 !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
  }

  .command-center-status {
    padding: 4px 8px;
    gap: 6px;
  }

  .status-label {
    display: none;
  }

  .layer-content,
  #dashboardLayer,
  #mapLayer {
    padding-top: 16px !important;
    padding-right: calc(14px + var(--mider-safe-right)) !important;
    padding-bottom: calc(24px + var(--mider-safe-bottom)) !important;
    padding-left: calc(14px + var(--mider-safe-left)) !important;
  }

  .filters,
  .summary,
  .grid2 {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .actions {
    flex-direction: column;
    align-items: stretch;
    margin: 10px 0 16px;
    padding: 12px;
    gap: 8px;
  }

  .actions button {
    width: 100%;
  }

  .section {
    flex-direction: column;
    align-items: flex-start;
    padding: 14px 16px;
  }

  .kpis,
  #indicatorCharts {
    grid-template-columns: 1fr;
    padding: 14px;
  }

  .matrix {
    min-width: 820px;
    font-size: 11.5px;
  }

  .matrix th,
  .matrix td {
    padding: 9px 8px;
  }

  .matrix td:nth-child(4),
  .matrix th:nth-child(4) {
    min-width: 230px;
    max-width: 260px;
  }

  #map {
    height: 450px !important;
    min-height: 450px !important;
    border-radius: 10px !important;
  }

  .map-top-filter {
    flex-direction: column;
    align-items: stretch;
  }

  .map-level-box,
  .map-year-box,
  .map-kecamatan-box,
  .map-kelurahan-box {
    width: 100%;
  }

  .mider-dynamic-footer {
    margin: 14px 14px 22px;
    padding: 12px 14px;
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .mider-map-legend {
    left: 12px;
    right: 12px;
    bottom: 12px;
    min-width: auto;
  }
}

@media print {
  header {
    position: relative;
  }

  .sidebar,
  .filters,
  .actions,
  .hamburger,
  .command-center-status {
    display: none !important;
  }

  .main-content {
    margin-left: 0 !important;
    width: 100% !important;
  }

  body {
    background: #ffffff !important;
    color: #000000 !important;
  }

  .card,
  .panel,
  .kpi,
  .summary .card {
    box-shadow: none !important;
    border: 1px solid #cccccc !important;
    background: #ffffff !important;
    color: #000000 !important;
  }
}
