/* ════════════════════════════════════════════════════════════════════
   BEACCOUNTING — Dokumen Laporan (layar & cetak/PDF)
   Dipakai di aplikasi (pratinjau "kertas") dan di iframe cetak.
   Satuan garis memakai pt agar presisi saat dicetak / disimpan PDF.
   ════════════════════════════════════════════════════════════════════ */

.rp-preview-wrap {
  background: #e9edf2;
  padding: 22px 16px;
  border-radius: 10px;
  margin-top: 14px;
  overflow-x: auto;
}
.rp-preview {
  --rp-ink: #111827;
  --rp-muted: #4b5563;
  --rp-line: #9aa4b2;
  --rp-hair: #d5dbe3;
  --rp-accent: #1e3a5f;
  background: #fff;
  width: 100%;
  max-width: 900px;
  min-width: 640px;
  margin: 0 auto;
  padding: 34px 40px 26px;
  box-shadow: 0 1px 2px rgba(15,23,42,.08), 0 8px 24px rgba(15,23,42,.10);
  font-family: Helvetica, Arial, sans-serif;
  font-size: 9.5pt;
  line-height: 1.35;
  color: var(--rp-ink);
  position: relative;
}
.rp-preview.rp-landscape { max-width: 1180px; }
.rp-preview + .rp-preview { margin-top: 18px; }

/* ── Toolbar (layar saja) ── */
.rp-toolbar {
  display: flex; justify-content: flex-end; gap: 6px; flex-wrap: wrap;
  margin: -18px -24px 14px; padding-bottom: 10px; border-bottom: 1px dashed #e2e8f0;
}
.rp-toolbar .rp-tb-btn {
  display: inline-flex; align-items: center; gap: 5px;
  font: 600 11px/1 Helvetica, Arial, sans-serif; color: #1e3a5f;
  background: #fff; border: 1px solid #cbd5e1; border-radius: 6px; padding: 6px 10px; cursor: pointer;
  transition: background .12s, border-color .12s;
}
.rp-toolbar .rp-tb-btn:hover { background: #eff6ff; border-color: #93c5fd; }
.rp-toolbar .rp-tb-btn.primary { background: #1e3a5f; color: #fff; border-color: #1e3a5f; }
.rp-toolbar .rp-tb-btn.primary:hover { background: #163055; }

/* ── Kop surat (letterhead) ── */
.rp-lh { display: flex; align-items: center; gap: 14px; padding-bottom: 9px; }
.rp-lh-logo { width: 58px; height: 58px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.rp-lh-logo img { max-width: 58px; max-height: 58px; object-fit: contain; }
.rp-lh-mono {
  width: 52px; height: 52px; border-radius: 10px; background: var(--rp-accent); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 22pt; font-weight: 700;
}
.rp-lh-co { flex: 1; min-width: 0; }
.rp-lh-name { font-size: 14pt; font-weight: 700; letter-spacing: .2px; color: var(--rp-ink); text-transform: uppercase; }
.rp-lh-addr, .rp-lh-contact { font-size: 8.5pt; color: var(--rp-muted); margin-top: 1px; }
.rp-lh-rule { border-top: 1.6pt solid var(--rp-ink); border-bottom: .5pt solid var(--rp-ink); height: 2.2pt; margin-bottom: 12px; }

/* ── Blok judul ── */
.rp-titleblock { text-align: center; margin: 4px 0 12px; }
.rp-title { font-size: 13pt; font-weight: 700; letter-spacing: .3px; text-transform: uppercase; color: var(--rp-ink); }
.rp-period { font-size: 9.5pt; color: #1f2937; margin-top: 2px; }
.rp-meta { display: flex; justify-content: space-between; gap: 12px; font-size: 8pt; color: var(--rp-muted); margin: 8px 0 4px; }
.rp-subheading { font-size: 10pt; font-weight: 700; margin: 16px 0 4px; color: var(--rp-accent); }

/* ── Tabel ── */
.rp-table { width: 100%; border-collapse: collapse; font-size: 9pt; font-variant-numeric: tabular-nums; }
.rp-table + .rp-table { margin-top: 14px; }
.rp-table thead th {
  font-size: 8.5pt; font-weight: 700; color: var(--rp-ink); text-align: left; vertical-align: bottom;
  padding: 5px 6px; border-top: .9pt solid var(--rp-ink); border-bottom: .9pt solid var(--rp-ink); background: #f3f5f8;
}
.rp-table td { padding: 3px 6px; vertical-align: top; }
.rp-table .rp-num, .rp-table th.rp-num { text-align: right; white-space: nowrap; }
.rp-table .rp-center { text-align: center; }
.rp-table .rp-code { font-family: "Courier New", monospace; font-size: 8.5pt; color: #374151; white-space: nowrap; }
.rp-table .rp-muted { color: var(--rp-muted); }
.rp-table .rp-wrap { white-space: normal; }

.rp-section-row td { font-weight: 700; padding: 9px 6px 3px; text-transform: uppercase; font-size: 8.8pt; letter-spacing: .3px; color: var(--rp-accent); }
.rp-group-row td { font-weight: 700; padding: 8px 6px 3px; background: #f8fafc; border-bottom: .5pt solid var(--rp-line); }
.rp-detail-row td { border-bottom: .4pt solid var(--rp-hair); }
.rp-detail-row.rp-sub td { color: #374151; font-size: 8.5pt; }
.rp-subtotal-row td { font-weight: 700; padding: 4px 6px; border-top: .7pt solid var(--rp-ink); }
.rp-subtotal-row td:not(.rp-num) { }
.rp-total-row td { font-weight: 700; padding: 5px 6px; border-top: .9pt solid var(--rp-ink); border-bottom: 2.4pt double var(--rp-ink); background: #f3f5f8; }
.rp-spacer td { height: 6px; padding: 0; border: none; }
.rp-separator td { border-top: .5pt solid var(--rp-line); padding: 0; }
.rp-neg { color: #b91c1c; }
.rp-badge { display: inline-block; font-size: 7.5pt; font-weight: 700; padding: 0 5px; border: .6pt solid currentColor; border-radius: 3px; text-transform: uppercase; letter-spacing: .2px; }
.rp-badge.ok { color: #15803d; } .rp-badge.warn { color: #b45309; } .rp-badge.bad { color: #b91c1c; } .rp-badge.info { color: #1d4ed8; } .rp-badge.mute { color: #6b7280; }

/* Varian bergaris penuh (daftar transaksi) */
.rp-table.rp-grid thead th { border: .6pt solid var(--rp-ink); }
.rp-table.rp-grid td { border: .4pt solid var(--rp-line); }
.rp-table.rp-grid .rp-group-row td { border: .6pt solid var(--rp-line); }
.rp-table.rp-grid .rp-subtotal-row td { border: .4pt solid var(--rp-line); border-top: .7pt solid var(--rp-ink); background: #fbfcfd; }
.rp-table.rp-grid .rp-total-row td { border-left: .4pt solid var(--rp-line); border-right: .4pt solid var(--rp-line); }

/* Ringkasan kecil di bawah dokumen */
.rp-summary { display: flex; justify-content: flex-end; margin-top: 10px; }
.rp-summary table { border-collapse: collapse; font-size: 9pt; min-width: 260px; }
.rp-summary td { padding: 2px 6px; }
.rp-summary td:last-child { text-align: right; font-weight: 700; }
.rp-note { font-size: 8pt; color: var(--rp-muted); margin-top: 10px; }

/* Tanda tangan */
.rp-sign { display: grid; grid-template-columns: repeat(var(--cols, 3), 1fr); gap: 24px; margin-top: 34px; text-align: center; font-size: 9pt; break-inside: avoid; }
.rp-sign-line { margin-top: 56px; border-top: .6pt solid var(--rp-ink); padding-top: 3px; color: var(--rp-muted); font-size: 8pt; }

/* Footer dokumen */
.rp-foot { display: flex; justify-content: space-between; gap: 12px; margin-top: 18px; padding-top: 6px; border-top: .5pt solid var(--rp-line); font-size: 7.5pt; color: #6b7280; }

.rp-empty { text-align: center; padding: 48px 24px; color: #94a3b8; }
.rp-empty-icon { font-size: 40px; margin-bottom: 10px; }

@media (max-width: 760px) {
  .rp-preview-wrap { padding: 10px; }
  .rp-preview { padding: 22px 18px; }
  .rp-toolbar { margin: -10px -6px 12px; }
}

/* ═══ CETAK / PDF ═══════════════════════════════════════════════════ */
@media print {
  html, body { background: #fff !important; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .rp-preview-wrap { background: none; padding: 0; margin: 0; border-radius: 0; overflow: visible; }
  .rp-preview { box-shadow: none; padding: 0; max-width: none; min-width: 0; width: auto; margin: 0; }
  .rp-preview + .rp-preview { break-before: page; margin-top: 0; }
  .rp-toolbar, .no-print { display: none !important; }
  .rp-table thead { display: table-header-group; }
  .rp-table tfoot { display: table-footer-group; }
  .rp-table tr { break-inside: avoid; }
  .rp-lh, .rp-lh-rule, .rp-titleblock, .rp-section-row, .rp-group-row { break-after: avoid; }
  .rp-neg { color: #b91c1c; }
}
.rp-table td[style*="monospace"]{white-space:nowrap;}
/* Alias kelas badge lama */
.rp-badge-ok { color: #15803d; } .rp-badge-info { color: #1d4ed8; } .rp-badge-danger { color: #b91c1c; } .rp-badge-muted { color: #6b7280; } .rp-badge-warn { color: #b45309; }
