/* ePacta: dropdown & pemilih tanggal modern (js/kontrol.js). Dimuat SETELAH style.css / adm.css. */

/* ---------- Dropdown ---------- */
/* <select> asli tetap ada (bisa difokus & diketik) tetapi tidak terlihat */
.pilih-asli { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: 0 !important;
  border: 0 !important; opacity: 0 !important; pointer-events: none !important; overflow: hidden !important; clip-path: inset(50%); }
.pilih-tombol {
  display: inline-flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; max-width: 100%;
  text-align: left; cursor: pointer; font: inherit; color: var(--text); line-height: 1.35;
  border: 1px solid var(--line); background: var(--soft); border-radius: 10px; padding: 8px 10px;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.pilih-tombol .pilih-teks { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pilih-tombol > svg { width: 16px; height: 16px; flex: none; color: var(--muted); transition: transform .22s ease; }
.pilih-tombol.buka > svg { transform: rotate(180deg); color: var(--green-dark); }
.pilih-tombol:hover { border-color: #cfd4d0; }
.pilih-tombol.fokus, .pilih-tombol.buka { border-color: var(--lime); background: #fff; box-shadow: 0 0 0 3px var(--lime-soft); outline: none; }
.pilih-tombol.kosong .pilih-teks { color: var(--muted); }
.pilih-tombol:disabled { opacity: .55; cursor: not-allowed; }
/* select yang tadinya bergaya tombol (toolbar, filter) */
.pilih-tombol.btn { background: var(--panel); border-radius: 12px; padding: 9px 14px; font-weight: 500; }
.pilih-tombol.btn.sm { padding: 5px 10px; border-radius: 9px; font-size: 12.5px; }
.pilih-tombol.btn.buka, .pilih-tombol.btn.fokus { background: #fff; }
/* lebar penuh di dalam isian form */
.field > .pilih-tombol, .kp-f > .pilih-tombol, .f > .pilih-tombol, .fields .field .pilih-tombol, td > .pilih-tombol { width: 100%; }
/* Kelurahan/Desa: dropdown kecil di kiri, kotak nama di kanan (selektor dibuat lebih kuat dari aturan lebar penuh di atas) */
.inline > .pilih-tombol, .fields .field .inline > .pilih-tombol { width: auto; flex: none; min-width: 120px; }
.inline > input { flex: 1; min-width: 0; }
.inv-form .pilih-tombol { background: #fff; border-color: #dfe3e1; padding: 10px 12px; box-shadow: 0 1px 2px rgba(17, 36, 15, .04); }
.inv-baris .item .pilih-tombol { border: 0; background: transparent; box-shadow: none; padding: 2px 0; font-weight: 600; width: 100%; }
.atur-isian .pilih-tombol { padding: 6px 8px; border-radius: 8px; font-size: 13px; min-width: 130px; }

/* Saran isian (pengganti datalist): huruf yang cocok ditebalkan */
.saran-pop .pilih-isi button span b { font-weight: 700; color: var(--green-dark); }

/* ---------- Popup bersama ---------- */
.ktl-pop {
  position: fixed; z-index: 9500; background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 18px 44px rgba(17, 36, 15, .16), 0 2px 6px rgba(17, 36, 15, .06); transform-origin: top left;
}
.ktl-pop[data-arah="atas"] { transform-origin: bottom left; }
.pilih-pop { padding: 6px; max-width: min(440px, calc(100vw - 16px)); }
.pilih-isi { max-height: min(300px, 50vh); overflow-y: auto; display: flex; flex-direction: column; gap: 1px; overscroll-behavior: contain; }
.pilih-isi button {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; text-align: left;
  border: 0; background: none; font: inherit; font-size: 13.5px; padding: 9px 10px; border-radius: 9px; cursor: pointer; color: var(--text);
}
.pilih-isi button span { min-width: 0; overflow-wrap: anywhere; }
.pilih-isi button.sorot { background: var(--soft); }
.pilih-isi button.pilih { background: var(--lime-soft); color: var(--green-dark); font-weight: 600; }
.pilih-isi button.pilih.sorot { background: #dcf3c6; }
.pilih-isi button svg { width: 16px; height: 16px; flex: none; color: var(--green); }
.pilih-isi button:disabled { opacity: .45; cursor: default; }
.pilih-cari { padding: 2px 2px 6px; }
.pilih-cari input { width: 100%; border: 1px solid var(--line); background: var(--soft); border-radius: 9px; padding: 7px 10px; font: inherit; font-size: 13px; outline: none; }
.pilih-cari input:focus { border-color: var(--lime); background: #fff; }
.pilih-nihil { padding: 14px; color: var(--muted); font-size: 13px; text-align: center; }

/* ---------- Tanggal ---------- */
.tgl-asli { display: none !important; }
.tgl-wrap { position: relative; display: inline-flex; align-items: center; min-width: 0; max-width: 100%; vertical-align: middle; }
.field > .tgl-wrap, .f > .tgl-wrap, .fields .field .tgl-wrap, .kp-f .tgl-wrap, .inv-form .tgl-wrap { display: flex; width: 100%; }
.tgl-wrap .tgl-teks { width: 100%; min-width: 0; padding-right: 38px !important; font-variant-numeric: tabular-nums; }
.tgl-teks[readonly] { cursor: pointer; caret-color: transparent; }
.tgl-teks.btn { text-align: left; font-weight: 500; }
.tgl-wrap.buka .tgl-teks { border-color: var(--lime) !important; background: #fff; box-shadow: 0 0 0 3px var(--lime-soft); }
.tgl-teks.salah { border-color: var(--red) !important; background: var(--red-soft) !important; box-shadow: 0 0 0 3px rgba(217, 75, 75, .12) !important; }
.tgl-btn {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 30px; height: 30px; display: grid; place-items: center;
  border: 0; background: none; border-radius: 8px; color: var(--muted); cursor: pointer; transition: background .15s, color .15s;
}
.tgl-btn:hover, .tgl-wrap.buka .tgl-btn { color: var(--green-dark); background: var(--lime-soft); }
.tgl-btn svg { width: 17px; height: 17px; }
.tahap-tgl.tgl-teks { width: 150px; }

.kal-pop { width: min(300px, calc(100vw - 16px)); padding: 12px; user-select: none; }
.kal-head { display: flex; align-items: center; gap: 4px; margin-bottom: 8px; }
.kal-head button { border: 0; background: none; font: inherit; cursor: pointer; border-radius: 9px; color: var(--text); }
.kal-nav { width: 34px; height: 34px; display: grid; place-items: center; flex: none; }
.kal-nav:hover { background: var(--soft); }
.kal-nav svg { width: 17px; height: 17px; }
.kal-judul { flex: 1; padding: 7px 8px; font-weight: 600; font-size: 14.5px; display: inline-flex; align-items: center; justify-content: center; gap: 4px; }
.kal-judul:hover { background: var(--soft); }
.kal-judul svg { width: 14px; height: 14px; color: var(--muted); }
.kal-badan { min-height: 252px; }
.kal-hari { display: grid; grid-template-columns: repeat(7, 1fr); margin-bottom: 2px; }
.kal-hari span { text-align: center; font-size: 11.5px; color: var(--muted); font-weight: 600; padding: 4px 0; }
.kal-hari span:last-child { color: var(--red); }
.kal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.kal-grid.besar { grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 6px 0; }
.kal-grid button {
  height: 36px; border: 0; background: none; border-radius: 10px; font: inherit; font-size: 13.5px; cursor: pointer;
  color: var(--text); font-variant-numeric: tabular-nums; transition: background .12s, color .12s, transform .12s;
}
.kal-grid.besar button { height: 52px; font-size: 14px; font-weight: 500; }
.kal-grid button:hover { background: var(--lime-soft); color: var(--green-dark); }
.kal-grid button:active { transform: scale(.94); }
.kal-grid button.luar { color: #b8bfba; }
.kal-grid button.minggu { color: var(--red); }
.kal-grid button.minggu.luar { color: #ebb9b9; }
.kal-grid button.hariini { box-shadow: inset 0 0 0 1.5px var(--green); font-weight: 600; }
.kal-grid button.pilih { background: var(--green-dark); color: #fff; font-weight: 600; box-shadow: 0 4px 10px rgba(29, 92, 74, .25); }
.kal-kaki { display: flex; justify-content: space-between; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.kal-kaki button { border: 0; background: none; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; padding: 7px 12px; border-radius: 9px; }
.kal-kaki [data-k="hapus"] { color: var(--muted); }
.kal-kaki [data-k="hapus"]:hover { background: var(--red-soft); color: var(--red); }
.kal-kaki [data-k="kini"] { color: var(--green-dark); background: var(--lime-soft); }
.kal-kaki [data-k="kini"]:hover { background: var(--lime); }
