/* === 1. GAYA GLOBAL & FONT === */
/* ------------------------------------------------------------------- */
body {
    font-family: 'Inter', sans-serif;
    background-color: #2c2f48; /* Latar utama area konten (default) */
    color: #FFFFFF; /* Warna teks default */
}


/* === 2. GAYA HALAMAN LOGIN & REGISTRASI === */
/* ------------------------------------------------------------------- */
.auth-body-pro {
    background-color: #2c2f48;
}

.auth-form-container-pro {
    padding: 3rem 5rem;
}

.auth-box-pro {
    width: 100%;
    max-width: 500px;
}

.auth-title-pro {
    font-size: 2.8rem;
    font-weight: 700;
    margin-bottom: 2rem;
    border-left: 5px solid #E8AF00;
    padding-left: 1rem;
    color: #FFFFFF;
}

/* Form di halaman login/registrasi */
.auth-box-pro .form-label {
    color: rgba(255, 255, 255, 0.8);
}

.auth-box-pro .form-control {
    background-color: #e0e0e0;
    border: none;
    border-radius: 8px;
    padding: 0.9rem 1rem;
    color: #333333;
}

.auth-box-pro .form-control:focus {
    background-color: #ffffff;
    box-shadow: none; /* Hilangkan glow */
}

/* Tombol utama (Kuning Emas) */
.btn-auth {
    background: #E8AF00;
    color: #2c2f48;
    font-weight: 700;
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    border: none;
    transition: all 0.3s ease;
}

.btn-auth:hover {
    background: #ffd04b;
    color: #2c2f48;
    transform: translateY(-2px);
}

/* Teks & Link di bawah form */
.auth-box-pro .auth-text {
    color: rgba(255, 255, 255, 0.7);
}

.auth-box-pro .auth-link {
    color: #E8AF00;
    text-decoration: none;
}
.auth-box-pro .auth-link:hover {
    color: #ffd04b;
}


/* Area kanan (Latar kuning & logo besar) */
.auth-bg-image-pro {
    background-image: linear-gradient(to top right, #E8AF00, #ffc107);
    border-top-left-radius: 50%;
    border-bottom-left-radius: 50%;
}

.auth-logo-pro {
    max-width: 70%;
    height: auto;
}

/* Tombol lihat/sembunyikan password */
.input-group .form-control {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}
.btn-toggle-password {
    background-color: #e0e0e0;
    border: none;
    color: #333333;
    border-top-right-radius: 8px !important;
    border-bottom-right-radius: 8px !important;
}
.btn-toggle-password:hover {
    background-color: #ffffff;
}
.btn-toggle-password:focus {
    box-shadow: none;
}

/* Footer & Ikon Sosial Media di login/regis (Posisi Default - Absolute) */
.auth-footer {
    position: absolute;
    bottom: 2rem;
    left: 5rem;
    right: 5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Mengatur ulang posisi footer HANYA di halaman registrasi */
.register-page .auth-footer {
    position: relative; /* Nonaktifkan absolute */
    bottom: auto;
    left: auto;
    right: auto;
    margin-top: 3rem; /* Beri jarak atas */
    text-align: center; /* Ratakan teks copyright */
    /* display: flex; dan justify-content tidak diperlukan lagi di sini */
}

/* Teks copyright (berlaku di login & registrasi) */
.copyright-text {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
    margin: 0;
    max-width: 70%; /* Batasi lebar di login */
}

/* Pastikan teks copyright tidak terpotong di registrasi */
.register-page .copyright-text {
    max-width: 100%; /* Lebar penuh di registrasi */
    margin: 0 auto; /* Tengahkankan */
}


/* Menata kolom kanan (logo & ikon) */
.auth-right-column {
    position: relative; /* Agar ikon bisa diposisikan absolut */
    padding-bottom: 2rem; /* Ruang untuk ikon */
    /* Pastikan flexbox untuk menengahkan logo */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

/* Memposisikan ikon sosial media di bawah logo HANYA di registrasi */
.register-page .auth-social-icons-right { 
    margin-top:0.1rem; /* Jarak dari logo di atasnya */
    text-align: center; /* Pastikan ikon rata tengah jika wrap */
}

/* Gaya ikon HANYA di kolom kanan */
.auth-social-icons-right a { 
    color: #FFFFFF;
    font-size: 1.2rem;
    margin-left: 1rem;
    position: relative;
    bottom: auto;
    transition: color 0.3s ease;
}
.auth-social-icons-right a:hover {
    color: #E8AF00; /* Warna saat hover */
}

.social-icons a {
    color: #FFFFFF;
    font-size: 1.2rem;
    margin-left: 1rem;
    position: relative;
    bottom: auto;
    transition: color 0.3s ease;
}
.social-icons a:hover {
    color: #E8AF00;
}

/* === 3. GAYA LAYOUT UTAMA (SETELAH LOGIN) === */
/* ------------------------------------------------------------------- */

/* Area Konten Utama */
.main-content-pro {
    min-height: 100vh;
    padding: 2rem 3rem !important;
    width: 100%;
}

/* Sidebar */
.sidebar-pro {
    background-color: #1a1c2d;
    width: 280px;
    padding: 1.5rem !important;
    flex-shrink: 0;
    box-shadow: 2px 0 5px rgba(0,0,0,0.2);
    color: #FFFFFF;
}
.sidebar-brand-text {
    font-weight: 700;
    color: #E8AF00;
}
.sidebar-logo {
    height: 70px; /* Ukuran logo di sidebar */
    width: auto;
    display: block;
    margin: 0 auto 1rem auto;
}
.sidebar-divider {
    border-top: 1px solid rgba(255,255,255,0.1);
    margin: 1.5rem 0;
}
.sidebar-nav {
    list-style: none;
    padding-left: 0;
}
.sidebar-link,
.sidebar-link:hover,
.sidebar-link:focus,
.sidebar-link:active,
.sidebar-link:visited {
    color: rgba(255, 255, 255, 0.7);
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
    border-radius: 8px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    text-decoration: none !important; /* Hapus garis bawah link */
    border-bottom: none !important;
}
.sidebar-link:hover, .sidebar-link.active {
    background-color: #3f4460;
    color: #E8AF00;
}
.sidebar-link i {
    font-size: 1.1rem;
    width: 25px;
    text-align: center;
}


/* === 4. GAYA KOMPONEN DI DALAM KONTEN (SETELAH LOGIN) === */
/* ------------------------------------------------------------------- */

/* Judul Halaman & Subjudul */
.dashboard-title {
    color: #E8AF00;
    font-weight: 700;
    margin-bottom: 0.5rem;
}
.dashboard-subtitle {
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 2rem;
}

/* Card Umum */
.dashboard-card {
    border-radius: 12px;
    border: none;
    overflow: hidden;
    transition: transform 0.2s ease-in-out;
}
.dashboard-card:hover {
    transform: translateY(-5px);
}

.table-dark-custom th {
    font-size: 0.6rem !important;
}
.table-dark-custom td {
    font-size: 0.5rem;
    padding-top: 0.6rem !important;    /* Nilai default Bootstrap biasanya 0.75rem */
    padding-bottom: 0.6rem !important;
}

.table-dark-custom th :nth-child(1), .table-dark-custom th:nth-child(1) { width: 50%; text-align: left;}
.table-dark-custom th :nth-child(2), .table-dark-custom th:nth-child(2) { width: 65%; text-align: left;}
.table-dark-custom th :nth-child(3), .table-dark-custom th:nth-child(3) { width: 50%; text-align: left;}

.chart-card {
    background-color: #1a1c2d;
    border: 1px solid rgba(255,255,255,0.1);
}
.chart-card .card-header {
    background-color: #1a1c2d;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    color: #FFFFFF;
    font-weight: 600;
    padding: 1rem 1.5rem;
}
.chart-card .card-header h6 {
    margin: 0;
    color: #FFFFFF;
    font-size: 1.1rem;
}
.chart-card .card-body {
    padding: 1.5rem; /* Padding default untuk card */
}

/* Card Info Utama (Total Data) */
.primary-card {
    background: linear-gradient(135deg, #E8AF00 0%, #ffc107 100%);
    color: #2c2f48;
}
.primary-card .card-body {
    display: flex; /* Override card-body default */
    align-items: center;
}
.primary-card .text-xs,
.primary-card .text-white-50 {
    color: rgba(44, 47, 72, 0.7) !important;
}
.primary-card .h5 {
    color: #2c2f48;
    font-size: 1.8rem;
    font-weight: 700;
}

/* Form di dalam halaman utama */
.form-label {
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 0.5rem;
}
.form-control-dark {
    background-color: #3f4460;
    border: 1px solid #555a7a;
    color: #FFFFFF;
    border-radius: 8px;
    padding: 0.75rem 1rem;
}
.form-control-dark:focus {
    background-color: #3f4460;
    border-color: #E8AF00;
    color: #FFFFFF;
    box-shadow: 0 0 0 0.25rem rgba(232, 175, 0, 0.25);
}
.form-control-dark::placeholder {
    color: rgba(255, 255, 255, 0.4);
}
.form-control-dark[type="number"] {
    padding-right: 1.2rem;
}

/* Tabel Data Umum (digunakan di Master Data & Analisis) */
.table-dark-custom {
    color: #FFFFFF;
    border-color: #3f4460;
    width: 100%;
    table-layout: fixed; /* Penting untuk pengaturan lebar kolom */
    margin-bottom: 0; /* Hapus margin bawah default */
}
.table-dark-custom th {
    color: #E8AF00;
    background-color: #1a1c2d;
    border-bottom: 2px solid #E8AF00 !important;
    text-transform: uppercase;
    font-size: 0.85rem;
    white-space: nowrap; /* Cegah header terpotong */
    padding: 0.75rem; /* Padding default header */
}
.small-table-scroll .table-dark-custom td {
    color: #FFFFFF; /*ini untuk warna huruf di top 10 daerah kriminal*/
    font-size: 0.55rem;
}
.table-dark-custom td {
    background-color: #2c2f48;
    border-color: #3f4460;
    vertical-align: middle;
    padding: 0.80rem; /* Padding default sel */
}
.table-dark-custom tbody tr:hover td { /* Beri efek hover pada semua sel di baris */
    background-color: #3f4460;
}
.table-dark-custom th.text-center,
.table-dark-custom td.text-center {
    text-align: center !important;
}

/* Pembungkus Tabel dengan Scroll */
.table-responsive {
    overflow-x: auto;
}

/* --- Pengaturan Spesifik Tabel Master Data --- */
.data-table-card .table-responsive {
    max-height: 65vh; /* Batas tinggi scroll vertikal */
    overflow-y: auto;
    overflow-x: auto; /* Aktifkan scroll horizontal juga */
}

/* Gaya dasar untuk sel di tabel master data */
.master-data-table th,
.master-data-table td {
    color: #FFFFFF;
    font-size: 0.70rem;
    padding: 0.4rem 0.1rem; /* Padding asli, bisa disesuaikan */
     /*white-space: nowrap;    Pastikan tidak turun baris */
    /* vertical-align: middle; Pastikan rata tengah vertikal */
}

/* Pastikan tombol Aksi tidak terpotong */
.master-data-table td:last-child {
   white-space: nowrap;
}

/* Lebar kolom Tabel Master Data (15 kolom) */
.master-data-table th:nth-child(1), .master-data-table td:nth-child(1) { width: 5%; text-align: center; } /* ID */
.master-data-table th:nth-child(2), .master-data-table td:nth-child(2) { width: 5%; } /* TANGGAL */
.master-data-table th:nth-child(3), .master-data-table td:nth-child(3) { width: 5%; } /* WAKTU */
.master-data-table th:nth-child(4), .master-data-table td:nth-child(4) { width: 8%; } /* TKP */
.master-data-table th:nth-child(5), .master-data-table td:nth-child(5) { width: 8%; } /* TINDAK KRIMINAL */
.master-data-table th:nth-child(6), .master-data-table td:nth-child(6) { width: 10%; } /* METODE */
.master-data-table th:nth-child(7), .master-data-table td:nth-child(7) { width: 5%; text-align: center; } /* UMUR KORBAN */
.master-data-table th:nth-child(8), .master-data-table td:nth-child(8) { width: 10%; text-align: center; } /* JK KORBAN */
.master-data-table th:nth-child(9), .master-data-table td:nth-child(9) { width: 10%; } /* PEKERJAAN KORBAN */
.master-data-table th:nth-child(10),.master-data-table td:nth-child(10){ width: 5%; text-align: center; } /* UMUR PELAKU */
.master-data-table th:nth-child(11),.master-data-table td:nth-child(11){ width: 10%; text-align: center; } /* JK PELAKU */
.master-data-table th:nth-child(12),.master-data-table td:nth-child(12){ width: 9%; } /* PEKERJAAN PELAKU */
.master-data-table th:nth-child(13),.master-data-table td:nth-child(13){ width: 10%; text-align: right;  } /* Kolom Aksi */

/* --- Pengaturan Spesifik Tabel Hasil Analisis --- */
.hasil-analisis-card .card-body {
    color: #FFFFFF;
    padding: 1.5rem; /* Kembalikan padding normal */
}
.hasil-analisis-card th{
    color: #E8AF00;
    background-color: #1a1c2d;
}
.hasil-analisis-card td {
    color: #FFFFFF;
    margin: 0; /* Hapus margin negatif */
}
/* Membuat header tabel hasil analisis tetap terlihat saat scroll */
.hasil-analisis-card .table-responsive {
    /* Pastikan sudah ada max-height dan overflow-y: auto */
    max-height: 400px;
    overflow-y: auto;
}

.hasil-analisis-card thead th {
    position: sticky; /* Membuat header "menempel" */
    top: 0;           /* Menempel di bagian paling atas container */
    z-index: 1;       /* Memastikan header di atas konten body */
    /* Warna latar belakang header (mungkin sudah ada di .table-dark-custom th) */
    background-color: #1a1c2d;
}
/* Lebar Kolom Tabel Analisis (7 kolom) */
.hasil-analisis-card .table th:nth-child(1), .hasil-analisis-card .table td:nth-child(1) { width: 25%; text-align: left;}
.hasil-analisis-card .table th:nth-child(2), .hasil-analisis-card .table td:nth-child(2) { width: 25%; text-align: left;}
.hasil-analisis-card .table th:nth-child(3), .hasil-analisis-card .table td:nth-child(3) { width: 12%; text-align: left; }
.hasil-analisis-card .table th:nth-child(4), .hasil-analisis-card .table td:nth-child(4) { width: 12%; text-align: left; }
.hasil-analisis-card .table th:nth-child(5), .hasil-analisis-card .table td:nth-child(5) { width: 12%; text-align: left; }

/* Kotak Pencarian */
.search-box {
    width: 300px;
}

/* Grafik */
.chart-area-small {
    color: #FFFFFF;
    position: relative;
    height: 180px; /* Tinggi grafik lebih kecil */
    width: 100%;
}
.small-table-scroll { /* Scroll tabel daerah rawan */
    max-height: 370px;
    overflow-y: auto;
}

/* Halaman Tentang */
.about-card-body {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 2rem;
    font-size: 1.1rem;
    line-height: 1.8;
    color: rgba(255, 255, 255, 0.8);
}
.about-card-body p, .about-card-body h5, .about-card-body hr, .about-card-body ul {
    width: 100%;
}
.about-card-body strong {
    color: #E8AF00;
}

/* Rekomendasi Naratif */
.rekomendasi-list .list-group-item {
    background-color: transparent;
    border-color: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.8);
    padding: 1rem 0.5rem;
    font-size: 1.1rem;
}
.rekomendasi-list .list-group-item b {
    color: #E8AF00;
    font-weight: 600;
}


/* === 5. GAYA RESPONSIVE === */
/* ------------------------------------------------------------------- */
@media (max-width: 991.98px) {
    .sidebar-pro {
        width: 100%;
        min-height: auto;
        padding: 1rem !important;
        position: relative; /* Sidebar jadi horizontal di atas */
        box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    }
    .main-content-pro {
        padding: 1.5rem !important;
    }
    .auth-footer {
        position: relative; /* Footer kembali normal */
        bottom: auto;
        left: auto;
        right: auto;
        flex-direction: column;
        text-align: center;
        margin-top: 2rem;
    }
    .copyright-text {
        max-width: 100%;
        margin-bottom: 1rem;
    }
    .social-icons a {
        margin: 0 0.5rem;
    }
}

/* --- PERBAIKAN WARNA TEKS TABEL ADMIN --- */
.admin-table-card .table-dark-custom th {
    font-size: 1rem !important;
}
/* Membuat semua teks di dalam sel data (td) tabel admin menjadi putih */
.admin-table-card .table-dark-custom td {
    font-size: 1rem;
    color: #FFFFFF !important;
}

.admin-table-card th:nth-child(1), .admin-table-card td:nth-child(1) { width: 10%; text-align: center; } /* ID */
.admin-table-card th:nth-child(2), .admin-table-card td:nth-child(2) { width: 40%; } /* Username */
.admin-table-card th:nth-child(3), .admin-table-card td:nth-child(3) { width: 25%; } /* Status */
.admin-table-card th:nth-child(4), .admin-table-card td:nth-child(4) { width: 25%; text-align: center; } /* Aksi */

/* Tinggi untuk line chart bulanan */
.chart-area-medium {
    position: relative;
    height: 240px; /* Atur tinggi line chart di sini */
    width: 100%;
}

/* Tinggi untuk line chart bulanan (lebih besar) */
.chart-area-large {
    position: relative;
    height: 485px; /* Atur tinggi line chart di sini */
    width: 100%;
}

/* Menargetkan semua label di dalam form filter info secara spesifik */
#infoFilterForm .form-label {
    font-size: 0.8rem !important; /* Perkecil font & paksa */
    margin-bottom: 0.2rem !important; /* Rapikan margin */
    color: rgba(255, 255, 255, 0.7) !important; /* Pastikan warnanya abu-abu */
}

.activitylog-data-table td {
    color: #FFFFFF;
    font-size: small;
}
.activitylog-data-table th:nth-child(4), .activitylog-data-table th:nth-child(4) { width: 35%; text-align: left; } 

/* TEMPEL DI FILE 'static/css/custom.css' */

/* 1. CSS untuk styling ikon (?) */
.info-icon {
  display: inline-block;
  width: 20px;
  height: 20px;
  line-height: 20px; /* Buat teks vertikal di tengah */
  text-align: center;
  font-size: 12px;
  font-weight: bold;
  background-color: #4a5568; /* Warna abu-abu (sesuaikan jika perlu) */
  color: #e2e8f0;           /* Warna teks putih keabuan */
  border-radius: 50%;      /* Membuatnya bulat */
  cursor: help;            /* Mengubah kursor mouse */
  margin-left: 5px;
  user-select: none;       /* Mencegah teks (?) terseleksi */
}

/* * 2. CSS agar Tooltip Terlihat (Tema Terang)
 * Wajib agar terbaca di background gelap Anda! 
 */

/* Override untuk Bootstrap 4 */
.tooltip-inner {
  max-width: 320px;   /* Lebar maks tooltip */
  padding: 10px 15px;
  color: #212529;    /* Teks warna hitam */
  background-color: #f8f9fa; /* Latar belakang putih */
  border: 1px solid #d6d8db;
  border-radius: .25rem;
  text-align: left !important; /* Paksa rata kiri */
}

.tooltip.bs-tooltip-top .arrow::before {
  border-top-color: #f8f9fa; /* Sesuaikan warna panah */
}

.tooltip.bs-tooltip-bottom .arrow::before {
  border-bottom-color: #f8f9fa;
}

/* * MEMPERBAIKI WARNA TEKS DI CARD REKOMENDASI (ANALISIS.HTML)
 * Ini akan memperbaiki card "Rekomendasi Tindakan (AI)" 
 * DAN "Rekomendasi Lokasi Patroli"
*/

.dashboard-card .list-group-item {
    /* 1. Ubah warna teks jadi terang (putih keabuan) */
    color: #E0E0E0; 
    
    /* 2. Hapus background list-item agar transparan */
    background-color: transparent;
    
    /* 3. Ubah warna garis pemisah antar list */
    border-color: rgba(255, 255, 255, 0.1); 
}

/* ============================================================
   KHUSUS TABEL HASIL ANALISIS APRIORI (Agar lebih terbaca)
   ============================================================ */

/* Menargetkan tabel di dalam card hasil analisis */
.hasil-analisis-card .table-dark-custom th,
.hasil-analisis-card .table-dark-custom td {
    font-size: 1rem !important; /* 1rem = ukuran standar (sekitar 16px). */
    padding-top: 10px;          /* Menambah jarak atas */
    padding-bottom: 10px;       /* Menambah jarak bawah */
}

/* ============================================================
   PENGATURAN CETAK (PRINT) - FIXED & CONFLICT FREE
   ============================================================ */

/* 1. Default: Sembunyikan Kop & TTD di layar laptop (Screen Mode) */
#print-header, #print-footer {
    display: none !important;
}

@media print {
    /* --- 1. SETTING KERTAS & RESET GLOBAL --- */
    @page {
        size: F4; 
        margin: 0.3cm; /* Margin tipis */
    }
    
    /* RESET TOTAL HALAMAN */
    html, body {
        height: auto !important;
        min-height: 0 !important;
        background-color: white !important;
        color: black !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow: visible !important;
    }

    /* --- 2. SEMBUNYIKAN UI WEBSITE & ELEMEN PENGGANGGU --- */
    .sidebar, nav, .navbar, .topbar, footer, .btn, .no-print, 
    form, #accordionSidebar, .search-box, 
    .dashboard-subtitle, .dashboard-title small,
    
    /* Hilangkan Judul Besar & Filter Atas */
    h1.dashboard-title, 
    .card-header select, .card-header label, .form-select, #trendYearFilter,
    
    /* PENTING: HILANGKAN KOTAK FILTER DETAIL DI BAWAH (YANG BIKIN GELAP) */
    #infoFilterForm, 
    .col-lg-3:has(#infoFilterForm), /* Sembunyikan kolom pembungkusnya jika ada */
    .card:has(#infoFilterForm) {      /* Sembunyikan card pembungkusnya */
        display: none !important;
    }

    /* --- 3. PAKSA BACKGROUND PUTIH (MENGHILANGKAN BIRU GELAP) --- */
    .dashboard-container, 
    .container-fluid, 
    .content-wrapper, 
    #content {
        background-color: white !important; /* Timpa warna biru gelap */
        background: white !important;
        width: 100% !important; 
        margin: 0 !important; 
        padding: 0 !important;
        border: none !important;
    }

    /* --- 4. HEADER --- */
    #print-header {
        display: block !important;
        width: 100%;
        margin-bottom: 10px !important;
        font-family: Arial, sans-serif;
    }
    .kop-container {
        display: flex; align-items: center; justify-content: space-between; margin-bottom: 0;
    }
    .kop-logo { width: 90px; flex-shrink: 0; }
    .kop-logo img { width: 70px; height: auto; }
    .kop-text { flex-grow: 1; text-align: center; padding-right: 90px; }
    .kop-text h5, .kop-text h4, .kop-text small { margin: 1px 0; line-height: 1.2; }
    .kop-separator {
        border-bottom: 3px solid black; margin-top: 5px; margin-bottom: 5px; width: 100%;
    }
    .report-title { text-align: center; margin-bottom: 15px; }
    .report-title h3 { font-size: 14pt; margin: 0; }

    /* --- 5. LAYOUT 2 KOLOM (DIPAKSA SATU HALAMAN) --- */
    .row {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: wrap !important;
        justify-content: space-between !important;
        align-items: flex-start !important;
        margin: 0 !important;
    }

    /* KOLOM KIRI (Total + Tabel) */
    .col-lg-3:has(#top-locations-card) { 
        width: 38% !important; 
        order: 1;
        padding-right: 10px !important;
        margin: 0 !important;
        display: flex !important;
        flex-direction: column !important;
    }

    /* KOLOM KANAN (Grafik Tren) */
    .col-lg-9 {
        width: 60% !important; 
        order: 2;
        padding-left: 5px !important;
        margin: 0 !important;
    }

    /* --- 6. VISUALISASI KOTAK (PAGAR) --- */
    
    /* KOTAK 1: TOTAL DATA */
    .primary-card {
        display: block !important;
        font-size: 20px;
        width: 100% !important;
        margin-bottom: 15px !important;
        /* Style Kotak Kuning */
        border: 2px solid #000 !important; 
        border-radius: 8px !important;
        background-color: #ffc107 !important; /* Tetap kuning sesuai request */
        padding: 15px !important;
        color: black !important;
        /* Mencegah page break */
        break-inside: avoid;
        page-break-inside: avoid;
    }
    .primary-card .h5 { font-size: 20pt !important; font-weight: bold; }
    .primary-card .text-xs { color: black !important; font-weight: bold; font-size: 10pt; }
    .primary-card .text-white-50 { color: black !important; }

    /* KOTAK 2: TABEL TOP 10 */
    #top-locations-card {
        width: 100% !important;
        margin-bottom: 5 !important;
        /* Style Kotak */
        border: 2px solid #000 !important;
        border-radius: 8px !important;
        background-color: transparent !important;
        padding: 10px !important;
        break-inside: avoid;
        page-break-inside: avoid;
    }
    #top-locations-card table { width: 100% !important; font-size: 9pt !important; } 
    #top-locations-card th, #top-locations-card td { 
        padding: 4px !important; 
        border-bottom: 1px solid #ccc !important;
    }
    #top-locations-card .table-responsive { display: block; width: 100%; overflow: visible; }

    /* KOTAK 3: GRAFIK TREN */
    .col-lg-9 .card {
        height: 100% !important; 
        /* Style Kotak */
        border: 2px solid #000 !important;
        border-radius: 8px !important;
        background-color: transparent !important;
        padding: 15px !important;
        break-inside: avoid;
        page-break-inside: avoid;
    }
    .col-lg-9 .chart-area-large {
        height: 360px !important; 
        width: 100% !important;
        overflow: visible !important;
    }
    /* Pastikan canvas (gambar grafik) mengikuti tinggi kontainer */
    .col-lg-9 canvas {
        max-height: 360px !important; /* Samakan dengan chart-area-large */
        width: 100% !important;
    }

    /* ============================================================
       --- 7. GRAFIK KECIL (HALAMAN 2 - BLOCK MODE) ---
       Solusi Final: Mematikan flex pada kolom agar kartu tidak saling tumpuk
    ============================================================ */
    
    /* 1. Container Baris (Row) */
    .row:has(.col-lg-3:not(:has(#top-locations-card))) {
        page-break-before: always !important; 
        break-before: page !important;
        
        display: flex !important;
        flex-wrap: wrap !important;
        justify-content: space-between !important;
        
        margin: 0 !important;
        padding-top: 20px !important;
    }

    /* 2. Kolom Pembungkus (RESET TOTAL) */
    .col-lg-3:not(:has(#top-locations-card)) {
        width: 49% !important;
        flex: none !important;
        order: 3;
        
        /* PENTING: Matikan Flexbox di dalam kolom ini */
        display: block !important; 
        
        /* Pastikan tingginya mengikuti isi (JANGAN DIKUNCI) */
        height: auto !important; 
        min-height: 0 !important;
        
        margin-top: 0 !important;
        margin-bottom: 0 !important;
        padding: 0 !important;
    }

    /* 3. Kartu Grafik (Card) */
    .col-lg-3:not(:has(#top-locations-card)) .card {
        /* Kembalikan ke perilaku blok normal */
        display: block !important;
        position: relative !important;
        height: 340px !important; 
        border: 2px solid #000 !important;
        border-radius: 8px !important;
        
        /* Reset tinggi agar mengikuti konten grafik */
        height: auto !important; 
        
        /* JARAK AMAN ANTAR KARTU (Pencegah Tabrakan) */
        margin-bottom: 20px !important; 
        margin-top: 0 !important;
        
        padding: 5px !important;
        background-color: transparent !important;
        
        break-inside: avoid !important;
        page-break-inside: avoid !important;
    }

    /* 4. Judul Grafik */
    .col-lg-3:not(:has(#top-locations-card)) .card-header {
        display: block !important;
        margin-bottom: 5px !important;
        padding-bottom: 5px !important;
        border-bottom: 1px solid #000 !important;
        background: transparent !important;
    }
    .col-lg-3:not(:has(#top-locations-card)) h6 {
        font-size: 9pt !important;
        margin: 0 !important;
        color: black !important;
    }

    /* 5. Canvas Grafik (Ukuran Pas) */
    .chart-area-small, .chart-area-small canvas {
            max-height: 130px !important; 
            height: 130px !important;
            width: 100% !important;
            display: block !important;
    }
    /* --- 8. UMUM --- */
    .card { box-shadow: none !important; margin: 0; background: transparent !important; }
    
    .card-header {
        display: block !important; background: transparent !important;
        border-bottom: 2px solid #000 !important; 
        margin-bottom: 10px; padding-bottom: 5px; text-align: center;
    }
    .card-header h6 { color: black !important; font-size: 11pt !important; margin: 0 !important; font-weight: bold !important; }
    
    canvas { filter: invert(1); max-width: 100% !important; display: block; }
    
    #print-footer {
        display: block !important; width: 100%; margin-top: 30px; order: 100; page-break-inside: avoid;
    }

    /* HITAMKAN SEMUA TEKS & HILANGKAN EFEK DARK MODE */
    .table-dark-custom th, .table-dark-custom td, table, th, td, label, span, p, b, strong, small, h1, h2, h3, h4, h5, h6 {
        color: black !important; 
        background-color: transparent !important; 
        border-color: black !important; 
        text-shadow: none !important;
    }
}