/* =========================================================
   CASHBOOK.CSS - Khusus untuk halaman Buku Tunai & Bank
   ========================================================= */

   .table-responsive { min-height: 400px; } /* Override saiz dari global */
   table.crm-table th { padding: 10px 8px; }
   table.crm-table td { padding: 10px 8px; }
   
   .match-input { width: 60px; text-align: center; padding: 6px; border: 2px solid #ddd; border-radius:4px; font-weight: bold; font-family: Arial; cursor:pointer; background:#fff; transition:0.3s;}
   .match-input:focus { border-color: var(--success); outline: none; background: #e8f4fd; }
   .match-input.matched { background: #e0f7fa; border-color: #26c6da; color: #00838f; }
   
   /* FILTER BAR & PAGINATION */
   .filter-bar { background: #f8f9fa; padding: 15px; border-radius: 8px; border: 1px solid #eee; display: flex; gap: 10px; margin-bottom: 20px; align-items: center; flex-wrap: wrap;}
   .pagination-bar { display: flex; justify-content: space-between; align-items: center; margin-top: 20px; padding-top: 15px; border-top: 1px solid #eee;}
   
   /* RECONCILIATION DASHBOARD */
   #recon-dashboard { display: none; background: #34495e; color: white; padding: 20px; border-radius: 8px; margin-bottom: 20px; box-shadow: 0 10px 20px rgba(0,0,0,0.15); animation: fadeIn 0.3s; position: relative;}
   .recon-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
   .recon-item { display: flex; justify-content: space-between; font-size: 13px; font-weight: 600; padding: 5px 0; border-bottom: 1px solid rgba(255,255,255,0.1); }
   .recon-val { font-family: Arial, sans-serif; font-size: 14px; font-weight: bold; }
   .recon-input { background: rgba(255,255,255,0.9); border: none; padding: 5px 10px; border-radius: 4px; text-align: right; font-weight: bold; width: 120px; font-family: Arial; }
   .btn-reset-match { position: absolute; right: 20px; top: 20px; font-size: 10px; padding: 5px 10px; background: rgba(231, 76, 60, 0.2); color: #ffcccb; border: 1px solid rgba(231, 76, 60, 0.5); }
   .btn-reset-match:hover { background: #e74c3c; color: white; }
   
   /* KAWALAN PRINT & SKRIN */
   .print-only { display: none; }
   .print-header { display: none; text-align: center; margin-bottom: 20px; font-family: Arial, sans-serif; }
   .print-header h1 { margin: 0 0 5px 0; font-size: 20px; }
   .print-header p { margin: 0; font-size: 12px; }
   
   /* ==========================================
   TETAPAN KERTAS CETAKAN (FORMAT LEDGER KORPORAT)
   ========================================== */
@media print {
    @page { size: portrait; margin: 12mm; }

    /* 1. KAWALAN MUTLAK WARNA (Paksa SEMUA tulisan & link jadi Hitam) */
    *, *:before, *:after {
        color: #000 !important;
        text-shadow: none !important;
        text-decoration: none !important;
    }

    body, html {
        background: #fff !important;
        height: auto !important;
        overflow: visible !important;
        margin: 0 !important;
        padding: 0 !important;
        font-family: Arial, Helvetica, sans-serif !important;
    }

    /* 2. Sembunyikan elemen web yang tak perlu */
    .navbar, .crm-left, .no-print, .filter-bar, .pagination-bar, #recon-dashboard, .screen-only, #authOverlay, #loadingOverlay {
        display: none !important;
    }

    /* 3. Paksa pembungkus utama untuk mengembang (Kalis Blank Page) */
    .crm-container, .crm-right, #view-ledger, .table-responsive {
        display: block !important;
        width: 100% !important;
        height: auto !important;
        overflow: visible !important;
        position: static !important; 
        margin: 0 !important;
        padding: 0 !important;
        box-shadow: none !important;
        border: none !important;
        background: transparent !important;
    }

    /* 4. Header Syarikat */
    .print-header { display: block !important; margin-bottom: 15px !important; }
    .print-header h1 { font-size: 14pt !important; font-weight: bold !important; margin: 0 0 5px 0 !important; }
    .print-header p, .print-header h2, .print-header div { font-size: 10pt !important; }
    .print-only { display: inline !important; }

    /* 5. Format Jadual Rasmi */
    table.crm-table {
        display: table !important;
        width: 100% !important;
        border-collapse: collapse !important;
        font-size: 9.5pt !important;
    }
    
    table.crm-table thead { display: table-header-group !important; }
    table.crm-table tbody { display: table-row-group !important; }
    table.crm-table tfoot { display: table-row-group !important; }
    table.crm-table tr { page-break-inside: avoid !important; }

   /* 6. Header Jadual (Garisan lurus atas & bawah) */
   table.crm-table th {
    border-left: none !important;
    border-right: none !important;
    border-top: 1px solid #000 !important;
    border-bottom: 1px solid #000 !important;
    padding: 8px 4px !important;
    font-weight: bold !important;
    background: transparent !important;
    text-transform: capitalize !important;
    vertical-align: middle !important;
    }

    /* 7. Isi Data (Kosongkan garisan untuk nampak kemas) */
    table.crm-table tbody td {
        border: none !important; 
        padding: 6px 4px !important;
        vertical-align: top !important; 
    }

    /* 8. Total Bawah / Footer (Garisan single atas, double line bawah) */
    table.crm-table tfoot td {
        border-left: none !important;
        border-right: none !important;
        border-top: 1px solid #000 !important;
        border-bottom: 3px double #000 !important;
        font-weight: bold !important;
        padding: 8px 4px !important;
    }

    /* 9. Hilangkan gaya input box pada ruangan Match */
    .match-input {
        border: none !important;
        background: transparent !important;
        padding: 0 !important;
        color: #000 !important;
        width: auto !important;
        font-size: 9.5pt !important;
    }
}
   
   @media screen and (max-width: 768px) {
       /* Susunan Kotak Grid Kad Transaksi di Mobile */
       .crm-left { position: relative !important; top: auto !important; margin-bottom: 20px !important; }
       #cashbook-summary { flex-direction: column !important; gap: 15px !important; }
       #cashbook-summary > div { width: 100% !important; box-sizing: border-box !important; }
       .recon-grid { grid-template-columns: 1fr; }
       .btn-reset-match { position: relative; right: 0; top: 0; display: block; margin-bottom: 10px; width: 100%; text-align: center; }
       
       #view-ledger .table-responsive { border: none !important; background: transparent !important; }
       #view-ledger .crm-table thead, #cashbook-foot { display: none !important; }
       #cashbook-body { display: block !important; }
       
       #cashbook-body tr {
           display: grid !important; grid-template-columns: 1fr 1fr 1fr !important; gap: 8px !important;
           background: #ffffff !important; margin-bottom: 15px !important; border-radius: 10px !important;
           border: 1px solid #e0e0e0 !important; padding: 15px !important; box-shadow: 0 4px 10px rgba(0,0,0,0.05) !important;
           position: relative !important; box-sizing: border-box !important;
       }
       #cashbook-body td { display: block !important; width: 100% !important; padding: 0 !important; border: none !important; text-align: left !important; }
   
       #cashbook-body td:nth-child(2) { grid-column: 1 / 3 !important; font-size: 11px !important; color: #7f8c8d !important; }
       #cashbook-body td:nth-child(3) { grid-column: 3 / 4 !important; text-align: right !important; font-size: 11px !important; }
       #cashbook-body td:nth-child(4) { grid-column: 1 / 4 !important; font-size: 13px !important; font-weight: bold !important; color: #2c3e50 !important; padding-bottom: 10px !important; border-bottom: 1px dashed #eee !important; margin-bottom: 5px !important; word-wrap: break-word !important; }
       
       #cashbook-body td:nth-child(5) { grid-column: 1 / 2 !important; color: #e74c3c !important; font-weight: bold !important; font-size: 12px !important; }
       #cashbook-body td:nth-child(5)::before { content: "OUT (RM)"; display: block; font-size: 9px; color: #95a5a6; }
       
       #cashbook-body td:nth-child(6) { grid-column: 2 / 3 !important; text-align: center !important; color: #27ae60 !important; font-weight: bold !important; font-size: 12px !important; }
       #cashbook-body td:nth-child(6)::before { content: "IN (RM)"; display: block; font-size: 9px; color: #95a5a6; text-align: center; }
       
       #cashbook-body td:nth-child(7) { grid-column: 3 / 4 !important; text-align: right !important; color: #2980b9 !important; font-weight: bold !important; font-size: 12px !important; }
       #cashbook-body td:nth-child(7)::before { content: "BAL (RM)"; display: block; font-size: 9px; color: #95a5a6; text-align: right; }
   
       #cashbook-body td:nth-child(1) { grid-column: 1 / 3 !important; margin-top: 10px !important; }
       #cashbook-body td:nth-child(1) select { max-width: 100%; font-size: 11px; padding: 6px; border: 1px solid #ccc; border-radius: 4px;}
       
       #cashbook-body td:nth-child(8) { grid-column: 3 / 4 !important; text-align: right !important; margin-top: 10px !important; }
       #cashbook-body td:nth-child(8) button { padding: 8px 15px !important; font-size: 12px !important; width: auto !important; display: inline-block !important; }
   
       #view-docs .table-responsive { border: none !important; }
       #doc-table td, #doc-table th { font-size: 11px !important; padding: 8px 5px !important; }
   }