/* ==========================================================================
   Dokumen karyawan - Slip Gaji, KPI & Rekening (js/karyawan-dokumen.js).
   Dipakai halaman Karyawan dan Freelance, Gajian, dan KPI. Kelas dasar
   (.section, .confirm-overlay, .confirm-modal-btn, .impor-empty) dari
   css/laporan-impor.css.
   ========================================================================== */

.kd-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 900px) { .kd-grid { grid-template-columns: 1fr; } }

.kd-kartu {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  min-width: 0;
}
.kd-kartu-judul { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; font-weight: 800; font-size: .9rem; color: var(--ink); }
.kd-kartu-judul svg { width: 18px; height: 18px; color: var(--red); flex: none; }

.kd-kosong { color: var(--muted); font-size: .82rem; line-height: 1.5; padding: 4px 0; }

/* Rekening */
.kd-rek { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.kd-rek-isi { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.kd-rek-bank { font-size: .75rem; font-weight: 700; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .03em; }
.kd-rek-nomor { font-size: 1.05rem; font-weight: 800; letter-spacing: .03em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.kd-rek-nama { font-size: .8rem; color: var(--ink-soft); overflow-wrap: anywhere; }

.kd-btn {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--ink);
  border-radius: var(--radius-full);
  padding: 6px 14px;
  font: inherit;
  font-size: .8rem;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.kd-btn:hover { border-color: var(--red); color: var(--red); }
.kd-btn:disabled { opacity: .5; cursor: not-allowed; }
.kd-btn--merah { background: var(--red); border-color: var(--red); color: #fff; }
.kd-btn--merah:hover { background: var(--red-dark); border-color: var(--red-dark); color: #fff; }

/* Daftar dokumen */
.kd-daftar { display: flex; flex-direction: column; gap: 6px; max-height: 260px; overflow-y: auto; }
.kd-dok {
  display: flex; align-items: center; gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.kd-dok:hover { border-color: var(--red); background: #FFF7F7; }
.kd-dok-ikon { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; background: #FDEBEC; color: var(--red); flex: none; }
.kd-dok-ikon--kpi { background: #EEF2FF; color: #4F46E5; }
.kd-dok-ikon svg { width: 17px; height: 17px; }
.kd-dok-teks { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.kd-dok-teks strong { font-size: .85rem; }
.kd-dok-teks small { font-size: .72rem; color: var(--muted); }
.kd-dok-aksi { font-size: .75rem; font-weight: 700; color: var(--red); flex: none; }
.kd-baru { font-style: normal; font-size: .65rem; font-weight: 800; color: #fff; background: var(--red); border-radius: var(--radius-full); padding: 1px 7px; margin-left: 4px; vertical-align: 1px; }

/* Modal */
.kd-modal { max-width: 420px; text-align: left; }
.kd-modal--pdf { max-width: 900px; width: 100%; height: calc(100vh - 40px); display: flex; flex-direction: column; }
.kd-modal--lebar { max-width: 760px; }
.kd-modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.kd-modal-head .confirm-modal-text { margin: 0; text-align: left; }
.kd-x { border: 0; background: none; font-size: 1.6rem; line-height: 1; color: var(--muted); cursor: pointer; padding: 0 4px; }
.kd-x:hover { color: var(--red); }
.kd-pdf-frame { flex: 1; width: 100%; min-height: 300px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: #f3f3f5; }
.kd-pdf-ganti { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; color: var(--ink-soft); text-align: center; }
.kd-pdf-ganti svg { width: 56px; height: 56px; color: var(--red); }
.kd-modal .confirm-modal-actions a.confirm-modal-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.kd-modal .confirm-modal-actions a.confirm-modal-btn svg { width: 16px; height: 16px; }

.kd-bantu { margin: 0 0 12px; font-size: .8rem; color: var(--ink-soft); line-height: 1.5; }
.kd-field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.kd-field > span { font-size: .75rem; font-weight: 700; color: var(--ink-soft); }
.kd-input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 11px;
  font: inherit;
  font-size: .9rem;
  background: #fff;
  color: var(--ink);
}
.kd-input:focus { outline: none; border-color: var(--red); box-shadow: 0 0 0 3px rgba(228,33,43,.12); }
.kd-galat { margin: 0 0 8px; color: var(--red); font-size: .8rem; font-weight: 600; }

/* Tabel kirim (Gajian: kirim semua slip, KPI: daftar penerima) */
.kd-tabel-bungkus { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); max-height: 55vh; overflow-y: auto; }
.kd-tabel { width: 100%; border-collapse: collapse; font-size: .8rem; }
.kd-tabel th, .kd-tabel td { padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
.kd-tabel th { background: #F7F7F9; font-size: .72rem; font-weight: 800; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .03em; position: sticky; top: 0; z-index: 1; }
.kd-tabel tr:last-child td { border-bottom: 0; }
.kd-tabel td small { display: block; color: var(--muted); font-size: .72rem; }
.kd-tabel .kd-td-cek { width: 28px; }
.kd-tabel .kd-td-aksi { white-space: nowrap; text-align: right; }
.kd-tabel .kd-td-aksi .kd-btn { padding: 4px 10px; font-size: .74rem; }
.kd-tabel .kd-td-aksi .kd-btn + .kd-btn { margin-left: 4px; }

.kd-status { display: inline-flex; align-items: center; gap: 4px; font-size: .72rem; font-weight: 700; border-radius: var(--radius-full); padding: 2px 8px; white-space: nowrap; }
.kd-status--belum { background: #F3F3F5; color: var(--muted); }
.kd-status--kirim { background: #FFF4E5; color: #B45309; }
.kd-status--lihat { background: #E7F7EE; color: #15803D; }
.kd-status--gagal { background: #FDEBEC; color: var(--red); }
.kd-status--proses { background: #EEF2FF; color: #4F46E5; }

.kd-progres { height: 6px; border-radius: 99px; background: #F0F0F3; overflow: hidden; margin: 10px 0 0; }
.kd-progres i { display: block; height: 100%; width: 0; background: var(--red); transition: width .25s; }

/* Wadah render PDF (html2pdf mengkloningnya ke overlay sendiri) */
.kd-pdf-root .gaji-slip-kertas { min-height: 0; margin: 0; }

.kd-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.kd-memuat { opacity: .5; pointer-events: none; }
.kd-toast {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%) translateY(20px);
  background: var(--surface-dark); color: #fff; padding: 10px 16px; border-radius: var(--radius-md);
  font-size: .85rem; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
  z-index: 300; box-shadow: 0 8px 24px rgba(0,0,0,.18);
}
.kd-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Jendela tanya / kabar / proses (pengganti confirm & alert bawaan) */
.kd-dialog { max-width: 400px; text-align: center; padding: 26px 22px 20px; }
.kd-dialog-ikon {
  display: grid; place-items: center;
  width: 56px; height: 56px; margin: 0 auto 12px;
  border-radius: 50%;
  background: #FDEBEC; color: var(--red);
  box-shadow: 0 0 0 8px #FFF5F5;
}
.kd-dialog-ikon svg { width: 26px; height: 26px; }
.kd-dialog-ikon--kirim, .kd-dialog-ikon--muat { background: #EEF2FF; color: #4F46E5; box-shadow: 0 0 0 8px #F5F7FF; }
.kd-dialog-ikon--info, .kd-dialog-ikon--tanya { background: #EFF6FF; color: #2563EB; box-shadow: 0 0 0 8px #F5F9FF; }
.kd-dialog-ikon--ok { background: #E7F7EE; color: #15803D; box-shadow: 0 0 0 8px #F2FBF6; }
.kd-dialog-ikon--hapus, .kd-dialog-ikon--galat { background: #FDEBEC; color: var(--red); }
.kd-dialog-judul { margin: 0 0 6px; font-size: 1.02rem; font-weight: 800; color: var(--ink); line-height: 1.35; white-space: pre-line; }
.kd-dialog-pesan { margin: 0 0 4px; font-size: .86rem; color: var(--ink-soft); line-height: 1.55; white-space: pre-line; overflow-wrap: anywhere; }
.kd-dialog-catatan { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; text-align: left; }
.kd-dialog-catatan li { position: relative; padding: 8px 10px 8px 30px; border-radius: var(--radius-sm); font-size: .78rem; line-height: 1.45; background: #F7F7F9; color: var(--ink-soft); }
.kd-dialog-catatan li::before { position: absolute; left: 10px; top: 8px; font-weight: 800; }
.kd-catatan--ok { background: #F0FAF4 !important; color: #166534 !important; }
.kd-catatan--ok::before { content: '✓'; }
.kd-catatan--warn { background: #FFF8EC !important; color: #92400E !important; }
.kd-catatan--warn::before { content: '!'; left: 13px !important; }
.kd-catatan--info::before { content: 'i'; left: 13px !important; font-style: italic; }
.kd-dialog .confirm-modal-actions { margin-top: 18px; }
.kd-dialog--proses .kd-progres { margin: 16px 0 0; }
.kd-btn-bahaya { background: var(--red) !important; }
.kd-putar { animation: kd-putar .8s linear infinite; }
@keyframes kd-putar { to { transform: rotate(360deg); } }

/* Daftar rekening semua admin */
.kd-modal--rekening .confirm-modal-text { display: flex; align-items: center; gap: 8px; }
.kd-modal--rekening .confirm-modal-text svg { width: 20px; height: 20px; color: var(--red); }
.kd-td-nomor { white-space: nowrap; font-variant-numeric: tabular-nums; font-weight: 700; }
.kd-salin { margin-left: 6px; border: 1px solid var(--border); background: #fff; border-radius: var(--radius-full); padding: 2px 8px; font: inherit; font-size: .7rem; font-weight: 700; color: var(--ink-soft); cursor: pointer; }
.kd-salin:hover { border-color: var(--red); color: var(--red); }
.kd-btn svg { width: 14px; height: 14px; vertical-align: -2px; margin-right: 4px; }
.section-head .kd-btn { display: inline-flex; align-items: center; white-space: nowrap; }

/* Penampil slip tampilan (HTML) - iframe memenuhi sisa tinggi modal */
.kd-slip-bungkus { flex: 1; min-height: 0; display: flex; }
.kd-slip-bungkus .kd-pdf-frame { flex: 1; background: #ECECF0; }
.kd-slip-bungkus .kd-kosong { margin: auto; }
.kd-modal .confirm-modal-actions button.confirm-modal-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.kd-modal .confirm-modal-actions button.confirm-modal-btn svg { width: 16px; height: 16px; }

/* Tombol ketiga di jendela tanya (mis. "Tarik Slip") - di bawah, tidak
   bersaing dengan tombol utama. */
.kd-btn-lain {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  width: 100%; margin-top: 10px; padding: 10px 14px;
  border: 1px dashed #F3B8BC; border-radius: var(--radius-md);
  background: #FFF7F7; color: var(--red);
  font: inherit; font-size: .86rem; font-weight: 700; cursor: pointer;
  transition: background .15s, border-color .15s;
}
.kd-btn-lain:hover { background: #FDEBEC; border-color: var(--red); }
.kd-btn-lain svg { width: 16px; height: 16px; }
.kd-status--usang { background: #FDEBEC; color: var(--red); }

/* Kartu Bukti Transfer (dari Gajian) - empat kartu jadi 2 x 2 */
@media (min-width: 901px) { .kd-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.kd-dok-ikon--bukti { background: #E7F7EE; color: #15803D; }
.kd-bukti-gambar { flex: 1; min-height: 0; overflow: auto; display: flex; align-items: flex-start; justify-content: center; background: #F3F3F5; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px; }
.kd-bukti-gambar img { max-width: 100%; height: auto; border-radius: 6px; box-shadow: 0 4px 16px rgba(20,20,26,.12); }
