/* Tahap 2: daftar, tabel data, modal, dan kontrol form.
   Nilai gaya dicomot dari inline style Master Data.dc.html. */

.list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.list-title { font-size: 23px; font-weight: 700; }
.list-sub { font-size: 12.5px; color: var(--textMuted); margin-top: 2px; }

.tb { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tb-btn {
  padding: 11px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  font-family: inherit;
}
.tb-btn:disabled { opacity: 0.45; cursor: default; }
.tb-icon {
  width: 42px; height: 42px; padding: 0;
  justify-content: center; font-size: 16px; flex-shrink: 0;
}
.tb-violet {
  border-color: rgba(124, 58, 237, 0.35);
  background: rgba(124, 58, 237, 0.08);
  color: #7c3aed;
}

.btn {
  padding: 10px 18px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 12.5px;
  cursor: pointer;
  border: 1px solid transparent;
  font-family: inherit;
}
.btn:disabled { opacity: 0.45; cursor: default; }
.btn-primary { background: var(--buttonColor); color: #fff; border: none; }
.btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-danger { background: #dc2626; color: #fff; border: none; }
.btn-sm { padding: 8px 12px; font-size: 12px; }
.btn-plus { padding: 11px 18px; }
.btn-plus span { font-size: 19px; font-weight: 800; line-height: 1; }

.filter-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.filter-count {
  margin-left: auto;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--textMuted);
}

.ctl {
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
}
.ctl-ro { background: var(--background); color: var(--textMuted); }
.field-label { font-size: 11.5px; font-weight: 600; margin-bottom: 6px; }
.form-col { display: flex; flex-direction: column; gap: 12px; }
.form-col .ctl, .grid2 .ctl { width: 100%; padding: 9px 11px; font-size: 12.5px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 18px; }
.form-error { font-size: 12px; color: #dc2626; text-align: right; margin-top: 10px; }
.hint { font-size: 11.5px; color: var(--textMuted); margin-bottom: 8px; }
.check-row {
  display: flex; align-items: center; gap: 8px;
  cursor: pointer; font-size: 12.5px; font-weight: 600; margin-bottom: 12px;
}

/* ---------- tabel data ---------- */

.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow-x: auto;
}
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  padding: 11px 14px;
  font-size: 10.5px;
  color: var(--textMuted);
  white-space: nowrap;
  font-weight: 600;
  text-align: left;
}
.th-sortable { cursor: pointer; user-select: none; }
.pill { padding: 4px 10px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.icon-btn {
  border: none; background: transparent; color: #94a3b8;
  cursor: pointer; font-size: 14px; padding: 2px 6px;
}
.cell-input {
  width: 90px; padding: 7px 9px; border-radius: 8px;
  border: 1px solid var(--border); font-size: 12.5px; text-align: right;
  background: var(--surface); color: var(--text); font-family: inherit;
}
.act {
  border: none; padding: 6px 10px; border-radius: 8px;
  font-size: 11.5px; font-weight: 600; cursor: pointer; margin-left: 6px;
  font-family: inherit;
}
.act-muted { background: rgba(100, 116, 139, 0.12); color: #475569; }
.act-edit { background: rgba(37, 99, 235, 0.1); color: #2563eb; }
.act-del { background: rgba(220, 38, 38, 0.1); color: #dc2626; }

.thumb {
  width: 36px; height: 36px; overflow: hidden; border-radius: 6px;
  background: var(--surfaceAlt);
}
.thumb img { width: 36px; height: 36px; object-fit: cover; display: block; }

/* ---------- tab ---------- */

.tabbar {
  display: flex; gap: 8px; margin-bottom: 18px;
  border-bottom: 1px solid var(--border); padding-bottom: 2px;
}
.tab {
  padding: 10px 16px; border: none; border-bottom: 2px solid transparent;
  background: transparent; color: var(--text);
  font-weight: 700; font-size: 13px; cursor: pointer; font-family: inherit;
}
.tab.active { border-bottom-color: var(--buttonColor); }

/* ---------- modal ---------- */

.modal-overlay {
  position: fixed; inset: 0; background: rgba(15, 23, 42, 0.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 50; padding: 24px;
}
.modal-card {
  background: var(--surface); border-radius: 16px;
  max-width: 94vw; display: flex; flex-direction: column; overflow: hidden;
  color: var(--text);
}
.modal-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 24px 24px 12px;
}
.modal-title { font-size: 16px; font-weight: 700; }
.modal-x {
  border: none; background: transparent; font-size: 17px;
  cursor: pointer; color: var(--textMuted);
}
.modal-body { padding: 0 24px 8px; overflow-y: auto; }
.modal-foot {
  display: flex; justify-content: flex-end; gap: 10px; padding: 14px 24px 24px;
}
.modal-note { font-size: 12px; color: var(--textMuted); margin-bottom: 16px; }
.colset-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px;
}
.colset-move {
  border: none; background: var(--background); color: var(--text);
  width: 26px; height: 26px; border-radius: 6px; cursor: pointer; font-size: 12px;
}
.colset-move:disabled { opacity: 0.35; cursor: default; }

/* ---------- gambar produk & satuan alternatif ---------- */

.img-row { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.img-slot {
  width: 88px; height: 88px; flex-shrink: 0; border-radius: 10px;
  border: 1px dashed var(--border); background: var(--surfaceAlt);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; overflow: hidden;
}
.img-slot img { width: 100%; height: 100%; object-fit: cover; }
.img-slot-empty { font-size: 11px; color: var(--textMuted); }
.alt-box { background: var(--surfaceAlt); border-radius: 10px; padding: 12px; margin-bottom: 18px; }
.alt-row {
  display: grid; grid-template-columns: 1.4fr 1fr auto;
  gap: 8px; margin-bottom: 8px; align-items: center;
}
.alt-row .ctl { width: 100%; padding: 8px 9px; font-size: 12px; }

/* ---------- chip kategori & satuan ---------- */

.add-row { display: flex; gap: 6px; margin-bottom: 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 10px; border-radius: 999px;
  background: var(--background); border: 1px solid var(--border); font-size: 12px;
}
.chip-x {
  border: none; background: transparent; color: #dc2626;
  font-size: 12px; cursor: pointer; padding: 0; line-height: 1;
}

/* ---------- modal riwayat ---------- */

.hist-head { margin-bottom: 14px; }
.hist-name { font-size: 15px; font-weight: 700; }
.hist-sub { font-size: 12px; color: var(--textMuted); margin-top: 2px; }
.hist-summary { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.hist-stat {
  flex: 1; min-width: 150px; background: var(--surfaceAlt);
  border-radius: 10px; padding: 11px 13px;
}
.hist-stat-label { font-size: 11px; color: var(--textMuted); }
.hist-stat-value { font-size: 15px; font-weight: 700; margin-top: 3px; }
.hist-filter { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.hist-filter .ctl { padding: 8px 11px; font-size: 12.5px; }
.hist-section { margin-bottom: 18px; }
.hist-section-title { font-size: 13px; font-weight: 700; margin-bottom: 8px; }
.hist-table th { font-size: 10px; }
.hist-empty {
  font-size: 12px; color: var(--textMuted);
  padding: 14px; background: var(--surfaceAlt); border-radius: 10px;
}

/* ---------- notifikasi sukses ---------- */

.ok-toast {
  position: fixed; right: 18px; bottom: 18px; max-width: 460px;
  background: #16a34a; color: #fff; border-radius: 10px; padding: 12px 16px;
  font-size: 12.5px; line-height: 1.5; box-shadow: 0 6px 20px rgba(15, 23, 42, 0.3);
  z-index: 999; white-space: pre-wrap; cursor: pointer;
}

/* ---------- data master (Tahap 2, versi web) ---------- */

.grid-master { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.grid-master .card { margin-bottom: 0; }
.grid-master + .card, .card + .grid-master, .grid-master + .baris-tombol { margin-top: 18px; }
.isian-baru { margin-top: 6px; width: 100%; box-sizing: border-box; }
.ctl-sempit { max-width: 130px; }
.baris-tambah { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.baris-tambah .ctl { flex: 1; min-width: 160px; }
.baris-tambah .ctl-sempit { flex: 0 1 150px; }
.tabel-baris td { vertical-align: top; padding: 8px 10px; }
.tabel-baris .ctl-kecil { min-width: 90px; }
.tabel-baris input.angka { text-align: right; }
.tabel-kategori td { vertical-align: middle; }
.tabel-kategori .cabang { color: var(--textMuted); white-space: pre; }
.tabel-kategori tr.tingkat-1 td:first-child { font-weight: 700; }
.kotak-min { background: var(--surfaceAlt); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; font-size: 12.5px; line-height: 1.7; }
.foto-produk { min-height: 80px; display: flex; align-items: center; margin-bottom: 8px; }
.foto-produk img { max-width: 220px; max-height: 220px; border-radius: 10px; border: 1px solid var(--border); background: #fff; }
.daftar-mirip { margin: 6px 0; padding-left: 18px; }
.zona-aksi { margin-top: 18px; }
.baris-tingkat { display: flex; gap: 10px; align-items: center; margin-bottom: 8px; }
.baris-tingkat .ctl { flex: 1; }
.baris-tingkat .check-row { margin: 0; }

@media (max-width: 900px) {
  .grid-master { grid-template-columns: 1fr; }
}

/* ---------- persediaan (Tahap 3A) ---------- */

.kartu-ringkas { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 14px; }
.kartu-ringkas .card { padding: 14px 16px; margin: 0; }
.angka-besar { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; margin-top: 4px; }
.baris-saldo td { background: var(--surfaceAlt); }
.baris-pembalik td { color: var(--textMuted); }

/* ---------- penjualan (Tahap 3B) ---------- */

.tab-modul { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 14px; }
.tab-modul a, .tab-modul .segera { padding: 8px 14px; font-size: 13px; font-weight: 600; text-decoration: none; color: var(--textMuted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab-modul a.aktif { color: var(--text); border-bottom-color: var(--buttonColor); }
.tab-modul .segera { opacity: 0.45; cursor: default; }
.tabel-jual .sel-produk { min-width: 240px; }
.tabel-jual .sel-produk .ctl { width: 100%; box-sizing: border-box; }
.tabel-jual .sel-diskon { min-width: 180px; }
.tabel-jual .sel-diskon select { width: 92px; }
.tabel-jual .sel-diskon input { width: 80px; }
.tabel-jual input.angka { width: 100px; }
.info-stok { margin-top: 3px; }
.ringkas-total { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; flex-wrap: wrap; margin-top: 14px; }
.ringkas-total .diskon-dok { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.ringkas-total table td { padding: 3px 0 3px 22px; font-size: 13px; }
.ringkas-total tr.besar td { font-size: 16px; font-weight: 700; border-top: 1px solid var(--border); padding-top: 6px; }
.daftar-dok { margin: 6px 0; padding-left: 18px; line-height: 1.9; }
details.card summary { cursor: pointer; font-weight: 600; font-size: 13px; }

.teks-galat { color: #dc2626; }

/* ---------- faktur (Tahap 3C) ---------- */
.daftar-centang { list-style: none; padding-left: 0; }
.daftar-centang .check-row { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.pilihan-sebaris { display: flex; gap: 16px; align-items: center; min-height: 38px; }

/* ---------- pembayaran (Tahap 3D) ---------- */
.tabel-info td { padding: 3px 14px 3px 0; vertical-align: top; }
.tabel-info td:first-child { color: var(--textMuted); white-space: nowrap; }
.umur-piutang { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 8px 0 14px; }
.umur-piutang div { border: 1px solid var(--border, #E2E8F0); border-radius: 10px; padding: 8px 10px; }
.umur-piutang span { display: block; font-size: 11px; color: var(--textMuted); }
.umur-piutang .telat strong { color: #B91C1C; }
@media (max-width: 640px) { .umur-piutang { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.giro-isian { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin-top: 6px; }

/* ---------- retur (Tahap 3E) ---------- */
.pilihan-tumpuk { display: flex; flex-direction: column; gap: 8px; }
.pilihan-tumpuk .check-row { align-items: baseline; }
