/* =========================================================
   IMP ESTIMASI - Tema warna "KUITANSI" (receipt look)
   ---------------------------------------------------------
   Layer tambahan NON-DESTRUKTIF (no timpa):
   - TIDAK mengedit / menghapus 042-imp-estimasi-style.css.
   - Hanya menimpa WARNA tabel estimasi biar senada kuitansi.
   - Semua di-scope ke #tab-estimasi supaya modul lain aman.
   - Dimuat SETELAH 042-imp-estimasi-style.css.
   Palet ikut kuitansi: navy #1e3a8a, abu terang #f1f5f9/#f3f4f6,
   tinta #1f2937, hijau nominal #059669.
   ========================================================= */

#tab-estimasi {
  --est-accent: #1e3a8a;        /* navy khas kuitansi */
  --est-accent-soft: #eef4fb;
  --est-head: #eef2f7;
  --est-line: #d9e1ee;
  --est-line-strong: #b9c6db;
}

/* ---------- Aksen dokumen mengikuti nuansa kuitansi (ringan) ---------- */
#tab-estimasi .est-doc::before {
  background: linear-gradient(90deg, #1e3a8a, #2f5aa8 55%, #3b82f6) !important;
}
#tab-estimasi .est-kop { border-bottom: 3px double #1e3a8a; }
#tab-estimasi .est-kop h2 { color: #1e3a8a !important; }
#tab-estimasi .est-badge { background: #1e3a8a; }

/* ---------- Wrapper tabel: bingkai bersih ala kuitansi ---------- */
#tab-estimasi .est-tbl-wrap {
  border: 1px solid #c7d3e6 !important;
  box-shadow: 0 10px 26px rgba(30, 58, 138, .10) !important;
}

/* ---------- Header tabel: dari gradient warna-warni -> navy tipis ---------- */
#tab-estimasi .est-tbl thead th {
  background: linear-gradient(180deg, #f8fbff, #eef2f7) !important;
  color: #1e3a8a !important;
  border-color: #c7d3e6 !important;
  border-bottom: 2px solid #1e3a8a !important;
}

/* ---------- Sel & baris: garis lembut, look dokumen ---------- */
#tab-estimasi .est-tbl th,
#tab-estimasi .est-tbl td { border-color: #d9e1ee !important; }
#tab-estimasi .est-tbl tbody td { color: #1f2937 !important; }
#tab-estimasi .est-tbl tbody tr:nth-child(even) td { background: #f7faff !important; }
#tab-estimasi .est-tbl tbody tr:hover td { background: #eef4fb !important; }

/* ---------- Nominal tetap hijau seperti kuitansi (#059669) ---------- */
#tab-estimasi .est-total-green,
#tab-estimasi .est-grand-val { color: #059669 !important; }

/* ---------- Baris grand total: kotak jumlah ala kuitansi ---------- */
#tab-estimasi .est-grand-row td {
  background: #f3f4f6 !important;
  border-top: 2px solid #1e3a8a !important;
}

/* ---------- Riwayat: No PO pakai navy senada kuitansi ---------- */
#tab-estimasi .est-tbl-riwayat tbody td:first-child { color: #1e3a8a !important; }
#tab-estimasi .est-hist-row:hover td { background: #eef4fb !important; }

/* ---------- Cetak PDF/JPG: warna tetap akurat ---------- */
#tab-estimasi.est-printing .est-tbl thead th,
#tab-estimasi.est-printing .est-grand-row td,
#tab-estimasi.est-printing .est-doc::before {
  -webkit-print-color-adjust: exact; print-color-adjust: exact;
}

/* =========================================================
   IMP ESTIMASI - Input Supplier via tombol + notif keren
   Tambahan non-destruktif, scope #tab-estimasi & modal terkait.
   ========================================================= */
#tab-estimasi .est-supplier-pick { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
#tab-estimasi .est-supplier-pick .est-supplier-ro {
  flex: 1 1 200px; min-width: 160px; cursor: pointer;
  background: #f8fbff; border: 1px solid #cbd7e8;
  border-bottom: 1.5px solid #b9c6db; border-radius: 10px;
  padding: 8px 12px; transition: background .14s ease, border-color .14s ease;
}
#tab-estimasi .est-supplier-pick .est-supplier-ro:hover { background: #eef4fb; border-color: #9db8d6; }
#tab-estimasi .est-supplier-pick .est-supplier-ro:focus { outline: none; box-shadow: 0 0 0 3px rgba(30,58,138,.12); }
#tab-estimasi .est-supplier-btn {
  flex: 0 0 auto; border: none; color: #fff; font-weight: 800; font-size: .82rem;
  border-radius: 11px; padding: 9px 15px; cursor: pointer; white-space: nowrap;
  background: linear-gradient(135deg, #1e3a8a, #2f5aa8);
  box-shadow: 0 6px 16px rgba(30,58,138,.28);
  transition: transform .15s ease, box-shadow .15s ease, filter .15s ease;
}
#tab-estimasi .est-supplier-btn:hover { transform: translateY(-1px); filter: brightness(1.06); box-shadow: 0 10px 22px rgba(30,58,138,.36); }
#tab-estimasi .est-supplier-btn:active { transform: translateY(0); }

/* Sembunyikan tombol saat ekspor PDF/JPG biar dokumen tetap bersih */
#tab-estimasi.est-printing .est-supplier-btn { display: none !important; }
#tab-estimasi.est-printing .est-supplier-pick .est-supplier-ro {
  background: transparent !important; border: none !important;
  border-bottom: 1.5px solid #9aa7b8 !important; border-radius: 0 !important; padding-left: 0 !important;
}

/* Hint & popup notifikasi keren */
#tab-estimasi .est-supplier-hint, .est-modal .est-supplier-hint { margin-top: 4px; }
.est-swal-keren { border-radius: 18px !important; }
.est-swal-keren .swal2-title { font-family: 'Space Grotesk', sans-serif; font-weight: 900; }
.est-swal-keren .swal2-html-container { font-size: .95rem; }

/* Field supplier terkunci di form Input Material (setelah input pertama, ganti hanya via Reset) */
.est-modal .est-locked, #modalEstInput .est-locked {
  background: #eef2f7 !important; color: #475569 !important;
  border-color: #cbd7e8 !important; cursor: not-allowed;
}
.est-modal .est-locked:focus, #modalEstInput .est-locked:focus { box-shadow: none !important; }

/* =========================================================
   IMP ESTIMASI - Riwayat gaya KARTU (seperti Riwayat Kuitansi)
   Non-destruktif, scope #tab-estimasi. Ringan, ada waktu, enak dilihat.
   ========================================================= */
#tab-estimasi .est-hist-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
#tab-estimasi .est-hist-card {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  border: 1px solid #eef2f7; border-radius: 14px; background: #fff; cursor: pointer;
  transition: transform .14s ease, box-shadow .14s ease, border-color .14s ease;
}
#tab-estimasi .est-hist-card:hover { border-color: #bfdbfe; box-shadow: 0 8px 20px rgba(30, 58, 138, .10); transform: translateY(-1px); }
#tab-estimasi .est-hist-card.est-hist-active { border-color: #1e3a8a; box-shadow: 0 8px 22px rgba(30, 58, 138, .16); background: #f6f9ff; }
#tab-estimasi .est-hist-ava {
  flex: 0 0 auto; width: 44px; height: 44px; border-radius: 13px; display: flex; align-items: center; justify-content: center;
  font-weight: 900; font-size: 1.1rem; color: #fff; box-shadow: 0 6px 14px rgba(37, 99, 235, .22);
}
#tab-estimasi .est-hist-main { flex: 1 1 auto; min-width: 0; }
#tab-estimasi .est-hist-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
#tab-estimasi .est-hist-no {
  font-family: monospace; font-size: .72rem; color: #1d4ed8; font-weight: 800;
  background: #eff6ff; border: 1px solid #dbeafe; padding: 2px 8px; border-radius: 7px; letter-spacing: .02em;
}
#tab-estimasi .est-hist-badge {
  font-size: .6rem; font-weight: 900; padding: 3px 8px; border-radius: 999px; letter-spacing: .3px;
  background: #dcfce7; color: #047857; border: 1px solid #86efac; text-transform: uppercase;
}
#tab-estimasi .est-hist-name { font-size: .92rem; color: #0f172a; font-weight: 800; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#tab-estimasi .est-hist-sub { font-size: .72rem; color: #64748b; margin-top: 3px; display: flex; align-items: center; gap: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#tab-estimasi .est-hist-sub i { color: #94a3b8; }
#tab-estimasi .est-hist-sub .est-dot { color: #cbd5e1; margin: 0 3px; }
#tab-estimasi .est-hist-right { flex: 0 0 auto; text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
#tab-estimasi .est-hist-amt { font-size: .95rem; font-weight: 900; color: #059669; }
#tab-estimasi .est-hist-btns { display: flex; gap: 6px; }
#tab-estimasi .est-hist-btn {
  width: 32px; height: 32px; border-radius: 9px; border: 1px solid #e2e8f0; background: #f8fafc; cursor: pointer;
  font-size: .8rem; display: inline-flex; align-items: center; justify-content: center; transition: all .14s ease;
}
#tab-estimasi .est-hist-load { color: #1d4ed8; }
#tab-estimasi .est-hist-load:hover { background: #1d4ed8; color: #fff; border-color: #1d4ed8; }
#tab-estimasi .est-hist-del { color: #dc2626; }
#tab-estimasi .est-hist-del:hover { background: #dc2626; color: #fff; border-color: #dc2626; }
#tab-estimasi .est-hist-empty { text-align: center; color: #94a3b8; font-style: italic; padding: 16px; font-size: .86rem; }
/* Sembunyikan tombol hapus riwayat untuk non-admin (tetap seperti aturan lama) */
body:not(.role-admin) #tab-estimasi .est-hist-del.est-col-aksi-riwayat { display: none !important; }
@media (max-width: 820px) { #tab-estimasi .est-hist-list { grid-template-columns: 1fr; } }
