* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Inter', sans-serif;
}

body {
  background-color: #f1f5f9;
  color: #1e293b;
  padding: 24px;
}

.main-container {
  width: 100% !important;
  min-height: 100vh !important;
  height: 100% !important;
  background-color: #f8fafc;
  padding: 20px 24px;
  box-sizing: border-box;
}

/* NAVBAR ATAS ALA OLT & BACKBONE */
.navbar-card {
  display: flex;
  gap: 8px;
  background: #ffffff;
  padding: 12px 20px;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  margin-bottom: 20px;
  overflow-x: auto;
}

.nav-tab {
  background: transparent;
  color: #64748b;
  border: none;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.nav-tab:hover {
  background: #f1f5f9;
  color: #2563eb;
}

.nav-tab.active {
  background: #2563eb;
  color: #fff;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.3);
}

.top-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  background: #ffffff;
  padding: 20px 24px;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.top-header h2 {
  font-size: 20px;
  font-weight: 700;
  color: #0f172a;
}

.top-header p {
  font-size: 13px;
  color: #64748b;
  margin-top: 4px;
}

.filters-group-flex {
  display: flex;
  align-items: center;
  gap: 15px;
  flex-wrap: wrap;
}

.filter-box {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: #475569;
}

.filter-box select {
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #1e293b;
  outline: none;
  cursor: pointer;
  font-size: 13px;
}

/* STATS GRID */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.stat-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 18px 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.stat-label {
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
  letter-spacing: 0.5px;
}

.stat-card h3 {
  font-size: 24px;
  font-weight: 700;
  color: #2563eb;
  margin: 8px 0 4px 0;
}

.stat-sub {
  font-size: 12px;
  color: #94a3b8;
}

/* SECTIONS */
.dashboard-section {
  display: none;
}
.dashboard-section.active-section {
  display: block;
}

.chart-card-clean {
  background: #ffffff;
  border-radius: 8px;
  padding: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  margin-bottom: 20px;
  overflow: hidden; /* Mengunci agar plugin tidak menambah scroll luar */
}

.chart-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f8fafc;
  color: #0f172a;
  padding: 12px 16px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 15px;
}

.chart-legend-box {
  display: flex;
  gap: 15px;
  font-size: 12px;
  color: #475569;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
}

.legend-box-blue { width: 12px; height: 12px; background: #3b82f6; border-radius: 2px; }
.legend-box-orange { width: 12px; height: 12px; background: #f97316; border-radius: 2px; }
.legend-box-gray { width: 12px; height: 12px; background: #94a3b8; border-radius: 2px; }

.chart-wrapper-canvas {
  position: relative;
  height: 480px;
  width: 100%;
  overflow: hidden; /* Membatasi tinggi canvas */
}

/* TABLE CARD */
.content-card {
  background: #ffffff;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  overflow: hidden;
}

.table-header-flex {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 24px;
  border-bottom: 1px solid #e2e8f0;
}

.badge-count {
  background: #f1f5f9;
  color: #2563eb;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  border: 1px solid #e2e8f0;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
}

th {
  background: #f8fafc;
  color: #475569;
  font-weight: 600;
  padding: 14px 20px;
  border-bottom: 1px solid #e2e8f0;
}

td {
  padding: 14px 20px;
  border-bottom: 1px solid #f1f5f9;
  color: #334155;
}

tr:hover td { background: #f8fafc; }

.btn-action {
  padding: 6px 12px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  margin-right: 4px;
}

.btn-edit { background: #2563eb; color: #fff; }
.btn-del { background: #dc2626; color: #fff; }

/* MODAL REVISI (DENGAN EFEK BLUR PERSIS RETAIL) */
.modal {
  display: none;
  position: fixed;
  top: 0; 
  left: 0;
  width: 100%; 
  height: 100%;
  background: rgba(15, 23, 42, 0.6) !important; /* Warna gelap transparan yang seimbang */
  
  /* --- KUNCI EFEK BLUR BACKGROUND --- */
  backdrop-filter: blur(5px) !important;
  -webkit-backdrop-filter: blur(5px) !important; /* Dukungan browser Webkit/Safari */
  
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.modal-content {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  padding: 24px;
  border-radius: 12px;
  width: 100%;
  max-width: 500px !important; /* Disamakan ke 500px */
  box-shadow: 0 10px 25px rgba(0,0,0,0.1);
}

.form-row {
  display: flex;
  gap: 12px;
}

.form-row .form-group {
  flex: 1;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.close-btn { background: none; border: none; font-size: 20px; cursor: pointer; color: #64748b; }

.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 12px; font-weight: 500; margin-bottom: 6px; color: #475569; }
.form-group input { width: 100%; padding: 10px 14px; background: #ffffff; border: 1px solid #cbd5e1; border-radius: 8px; color: #1e293b; outline: none; }
.form-group input:disabled { background: #f1f5f9; color: #94a3b8; }

.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; }
.btn { padding: 8px 16px; border-radius: 8px; border: none; cursor: pointer; font-weight: 500; font-size: 13px; }
.btn-sec { background: #e2e8f0; color: #334155; }
.btn-pri { background: #2563eb; color: #fff; }

/* FILTER PILL PT BAR */
.mitra-filter-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 12px;
  margin-bottom: 20px;
}

.filter-pill {
  background: #ffffff;
  color: #64748b;
  border: 1px solid #cbd5e1;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.filter-pill:hover {
  background: #f1f5f9;
  color: #2563eb;
}

.filter-pill.active {
  background: #2563eb;
  color: #fff;
  border-color: #2563eb;
}

/* HEADER COMPACT (NAVBAR + FILTER SEJAJAR) */
.top-header-compact {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #ffffff;
  padding: 12px 20px;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  margin-bottom: 16px;
  gap: 15px;
  flex-wrap: wrap;
}

.navbar-group {
  display: flex;
  gap: 6px;
}

.nav-tab {
  background: transparent;
  color: #64748b;
  border: none;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.nav-tab:hover {
  background: #f1f5f9;
  color: #2563eb;
}

.nav-tab.active {
  background: #2563eb;
  color: #fff;
  box-shadow: 0 2px 5px rgba(37, 99, 235, 0.2);
}

/* TITLE CARD COMPACT */
.title-card-compact {
  background: #ffffff;
  padding: 16px 20px;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  margin-bottom: 16px;
}

.title-card-compact h2 {
  font-size: 18px;
  font-weight: 700;
  color: #0f172a;
}

.title-card-compact p {
  font-size: 12px;
  color: #64748b;
  margin-top: 2px;
}

/* FILTERS DROPDOWN COMPACT */
.filters-group-flex {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.filter-box select {
  padding: 7px 12px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  color: #1e293b;
  outline: none;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  transition: border-color 0.2s;
}

.filter-box select:hover {
  border-color: #94a3b8;
}

.filter-box select:focus {
  border-color: #2563eb;
  background: #ffffff;
}

.table-actions-flex {
  display: flex;
  gap: 10px;
}

.btn-sec {
  background: #e2e8f0;
  color: #334155;
  border: none;
  padding: 8px 14px;
  border-radius: 8px;
  font-weight: 500;
  font-size: 13px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-sec:hover {
  background: #cbd5e1;
}

.btn-pri {
  background: #2563eb;
  color: #fff;
  border: none;
  padding: 8px 14px;
  border-radius: 8px;
  font-weight: 500;
  font-size: 13px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-pri:hover {
  background: #1d4ed8;
}

/* SEARCHABLE INPUT PERIODE */
.searchable-input {
  padding: 7px 12px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  color: #1e293b;
  outline: none;
  font-size: 12px;
  font-weight: 600;
  transition: all 0.2s;
  width: 220px; /* Lebar dilebihkan agar nama periode tidak terpotong */
}

.searchable-input:hover {
  border-color: #94a3b8;
}

.searchable-input:focus {
  border-color: #2563eb;
  background: #ffffff;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

.btn-nav:hover:not(:disabled) {
  background: #2563eb;
  color: #ffffff;
  border-color: #2563eb;
}

.btn-nav:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: #e2e8f0;
}

/* =========================================================
   STYLING FLATPICKR RANGE PICKER & PRESET DROPDOWN
   ========================================================= */

.form-control-range {
  padding: 7px 12px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background: #ffffff !important;
  color: #0f172a;
  outline: none;
  font-size: 12px;
  font-weight: 700;
  width: 220px;
  cursor: pointer;
}

.form-control-range:hover {
  border-color: #94a3b8;
}

.form-control-range:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

.text-blue {
  color: #2563eb;
}

/* Layout 2 Chart Atas-Bawah Penuh */
#chartsContainer {
  display: flex;
  flex-direction: column;
  gap: 24px;
}


/* Filter periode pembanding */
.text-orange {
  color: #f97316;
}

.comparison-range {
  border-color: #fed7aa;
}

/* Container dua chart vertikal */
#chartsContainer {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Pesan jika tidak ada data */
.empty-chart {
  text-align: center;
  color: #94a3b8;
  padding: 40px;
  font-weight: 600;
}

/* Header chart responsif */
@media (max-width: 900px) {
  .chart-card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
}

/* STYLING FILTER TOOLBAR (POPOVER DATEPICKER + DROPDOWN PERIODE 2) */
.filter-toolbar-row {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.filter-item-box {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-width: 260px;
}

.filter-label {
  font-size: 0.78rem;
  font-weight: 800;
  color: #475569;
  text-transform: uppercase;
}

.datepicker-custom-wrapper {
  position: relative;
  width: 100%;
}

.datepicker-custom-wrapper .icon-calendar {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: #2563eb;
  font-size: 0.95rem;
  z-index: 2;
  pointer-events: none;
}

.datepicker-input {
  width: 100%;
  padding: 10px 14px 10px 38px !important;
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  border-radius: 10px !important;
  font-size: 0.88rem !important;
  font-weight: 700 !important;
  color: #1e293b !important;
  cursor: pointer !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  transition: all 0.2s ease;
}

.datepicker-input:hover,
.datepicker-input:focus {
  border-color: #2563eb !important;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15) !important;
}

.section-divider {
  display: flex;
  align-items: center;
  margin: 24px 0 16px 0;
  border-bottom: 2px dashed #cbd5e1;
}

.section-divider span {
  background: #e0f2fe;
  color: #0369a1;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 800;
}

/* Styling Datepicker Popover mirip Gambar Referensi */
.datepicker-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.datepicker-wrapper .icon-calendar,
.filter-box .icon-preset {
  position: absolute;
  left: 12px;
  color: #2563eb;
  font-size: 0.9rem;
  z-index: 2;
  pointer-events: none;
}

.datepicker-input {
  padding-left: 34px !important;
  font-weight: 700 !important;
  color: #1e293b !important;
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  border-radius: 8px !important;
  cursor: pointer !important;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.datepicker-input:focus,
.datepicker-input:hover {
  border-color: #2563eb !important;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15) !important;
}

/* Custom Styling Popover Flatpickr */
.flatpickr-calendar {
  border-radius: 12px !important;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1) !important;
  border: 1px solid #e2e8f0 !important;
}

.flatpickr-day.selected, 
.flatpickr-day.startRange, 
.flatpickr-day.endRange {
  background: #2563eb !important;
  border-color: #2563eb !important;
}

.flatpickr-day.inRange {
  background: #eff6ff !important;
  border-color: #eff6ff !important;
  color: #1d4ed8 !important;
}

body.dark {
  background-color: #0f172a !important;
  color: #f8fafc !important;
}
body.dark .card, 
body.dark .content-card,
body.dark .table-card {
  background-color: #1e293b !important;
  border-color: #334155 !important;
  color: #f8fafc !important;
}

/* =========================================================
   PENGATURAN SCROLL & UTILS UNTUK INTEGRASI IFRAME DASHBOARD
   ========================================================= */
html, body {
  margin: 0 !important;
  padding: 0 !important;
  width: 100% !important;
  overflow-y: auto !important; /* Membiarkan konten mengalir mulus tanpa scrollbar ganda */
}