/* ==========================================================================
   PP PRINT CSS v8 — asetsekolah
   Hasil cetak rapi pada kertas A4 LANDSCAPE:
     1) kolom tidak bertumpuk & tidak terpotong di tepi kanan kertas
     2) baris TOTAL / SUBTOTAL tetap utuh (tidak pecah "TO/TA/L")
     3) seluruh elemen antarmuka (sidebar, topbar, tombol, filter) tidak tercetak
   Dipasang otomatis oleh perbaiki_cetak_v8.php
   ========================================================================== */

@page { size: A4 landscape; margin: 8mm 6mm; }

@media print {

  /* ---- 1. Kertas & dasar ------------------------------------------------ */
  html, body {
    background: #fff !important;
    color: #000 !important;
    margin: 0 !important;
    padding: 0 !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    height: auto !important;
    overflow: visible !important;
  }

  /* ---- 2. Antarmuka tidak tercetak -------------------------------------- */
  nav, aside,
  .sidebar, .sidebar-overlay, .topbar, .navbar, .brand, .school-chip,
  .jam, .clock, .profil, .dropdown, .dropdown-menu, .breadcrumb,
  .tabs, .tab, .toolbar, .filter, .filter-bar, .aksi, .aksi-baris,
  .btn, button, .pagination, .pager, .alert, .modal, .toast,
  .chart, canvas, .stat, .kpi, .card-ringkasan, .judul-hal .aksi,
  .kaki, .footer, .no-print, .d-print-none {
    display: none !important;
  }

  /* ---- 3. Wadah: jangan memotong / menggeser kolom ---------------------- */
  .content-wrapper, .content, #content, main, .container, .container-fluid,
  .row, .col, .card, .panel, .box,
  .tabel-bungkus, .table-responsive, .table-wrap, .table-container,
  [class*="bungkus"], [class*="scroll"], [class*="overflow"], [style*="overflow"] {
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    background: none !important;
    box-shadow: none !important;
    overflow: visible !important;
    width: auto !important;
    max-width: 100% !important;
    float: none !important;
    position: static !important;
    transform: none !important;
  }

  /* ---- 4. TABEL: kunci lebar kolom -------------------------------------- */
  table {
    width: 100% !important;
    max-width: 100% !important;
    table-layout: fixed !important;   /* kunci utama: tabel tak melebar keluar kertas */
    border-collapse: collapse !important;
    font-size: 7pt !important;
  }
  thead { display: table-header-group !important; }   /* judul kolom berulang tiap halaman */
  tfoot { display: table-footer-group !important; }
  tr { page-break-inside: avoid !important; break-inside: avoid !important; }

  th, td {
    white-space: normal !important;        /* judul panjang turun ke baris 2, tidak menimpa kolom sebelah */
    overflow-wrap: break-word !important;
    word-break: break-word !important;
    overflow: visible !important;
    padding: 1.6px 2.5px !important;
    vertical-align: top !important;
    line-height: 1.18 !important;
  }
  th {
    font-size: 6.8pt !important;
    text-align: center !important;
    vertical-align: middle !important;
  }
  caption { text-align: center !important; }

  /* ---- 5. Baris TOTAL / SUBTOTAL tidak pecah ---------------------------- */
  tr.total, tr.tot, tr.sub, tr.subtotal, tr.jumlah, tr.ttl,
  .baris-total, .label-total, .total-nilai {
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }
  tr.total > td, tr.tot > td, tr.sub > td, tr.subtotal > td,
  tr.jumlah > td, tr.ttl > td {
    font-weight: 700 !important;
    font-size: 6.8pt !important;
    white-space: nowrap !important;
    overflow-wrap: normal !important;
    word-break: keep-all !important;
    text-align: right !important;
  }

  /* ---- 6. Kolom angka --------------------------------------------------- */
  .text-end, .text-right, .angka, .num, .rupiah,
  th.angka, td.angka, th.num, td.num {
    text-align: right !important;
    font-variant-numeric: tabular-nums;
  }

  /* ---- 7. Kop surat & tanda tangan -------------------------------------- */
  .kop, .kop-cetak, .kop-sekolah, .kepala-cetak,
  .tanda-tangan, .tanda-tangan-cetak, .ttd, .ttd-cetak {
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }
  .tanda-tangan-cetak, .ttd-cetak { display: block !important; margin-top: 8mm !important; }
  h1, h2, h3, .judul-cetak, .judul-laporan { page-break-after: avoid !important; }

  /* ---- 8. KARTU INVENTARIS RUANGAN (tabel 14 kolom) --------------------- */
  table:has(thead tr th:nth-child(14)) { font-size: 6.6pt !important; }

  table:has(thead tr th:nth-child(14)) th:nth-child(1)  { width: 4% !important; }
  table:has(thead tr th:nth-child(14)) th:nth-child(2)  { width: 7.5% !important; }  /* KODE ASET  */
  table:has(thead tr th:nth-child(14)) th:nth-child(3)  { width: 3.5% !important; }  /* NUP        */
  /* kolom 4 = NAMA ASET -> memakai lebar sisa secara otomatis */
  table:has(thead tr th:nth-child(14)) th:nth-child(5)  { width: 10% !important; }   /* KATEGORI   */
  table:has(thead tr th:nth-child(14)) th:nth-child(6)  { width: 10% !important; }   /* LOKASI     */
  table:has(thead tr th:nth-child(14)) th:nth-child(7)  { width: 5.5% !important; }  /* MERK       */
  table:has(thead tr th:nth-child(14)) th:nth-child(8)  { width: 3.5% !important; }  /* TAHUN      */
  table:has(thead tr th:nth-child(14)) th:nth-child(9)  { width: 4% !important; }    /* JUMLAH     */
  table:has(thead tr th:nth-child(14)) th:nth-child(10) { width: 4.5% !important; }  /* SATUAN     */
  table:has(thead tr th:nth-child(14)) th:nth-child(11) { width: 9% !important; }    /* HARGA      */
  table:has(thead tr th:nth-child(14)) th:nth-child(12) { width: 9% !important; }    /* NILAI TOTAL*/
  table:has(thead tr th:nth-child(14)) th:nth-child(13) { width: 5.5% !important; }  /* KONDISI    */
  table:has(thead tr th:nth-child(14)) th:nth-child(14) { width: 5% !important; }    /* STATUS     */

  table:has(thead tr th:nth-child(14)) th:nth-child(11),
  table:has(thead tr th:nth-child(14)) td:nth-child(11),
  table:has(thead tr th:nth-child(14)) th:nth-child(12),
  table:has(thead tr th:nth-child(14)) td:nth-child(12) {
    text-align: right !important;
    white-space: nowrap !important;
  }

  /* ---- 9. Warna & latar tetap tercetak ---------------------------------- */
  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
}