:root {
  --ink: #1f2328; --ink-2: #5b6470; --garis: #d7dbe0; --garis-2: #eceef1; --latar: #f6f7f9; --putih: #fff;
  --utama: #073B7A; --utama-2: #0b4f9f; --galat: #b42318; --aman: #1a7f37; --peringatan: #9a6700;
  --kuning: #fff2cc; --peach: #fce4d6; --biru: #dceaf7; --hijau: #e2f0d9; --lilac: #eadcf4;
  --sel-w: 34px; --sel-h: 28px;
  font-family: Calibri, Arial, system-ui, sans-serif; color: var(--ink); background: var(--latar);
}
* { box-sizing: border-box; }
body { margin: 0; font-size: 14px; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 1px solid var(--garis); background: var(--putih); border-radius: 6px; padding: 6px 12px; }
button.utama { background: var(--utama); color: #fff; border-color: var(--utama); }
button.tipis { background: transparent; }
button:disabled { opacity: .5; cursor: default; }
input, select, textarea { border: 1px solid var(--garis); border-radius: 6px; padding: 6px 8px; background: var(--putih); min-height: 34px; }
[hidden] { display: none !important; }
.redup { color: var(--ink-2); } .kecil { font-size: 12px; } .galat { color: var(--galat); min-height: 1em; }

.atas { display: flex; align-items: center; gap: 16px; padding: 8px 16px; background: #262626; color: #fff; position: sticky; top: 0; z-index: 20; }
.atas .merek strong { font-size: 16px; letter-spacing: .5px; } .atas .merek span { opacity: .75; font-size: 12px; margin-left: 6px; }
.atas nav { display: flex; gap: 4px; }
.atas nav button { background: transparent; color: #ddd; border-color: transparent; }
.atas nav button.aktif { background: #fff; color: #262626; }
.atas .kanan { margin-left: auto; display: flex; gap: 12px; align-items: center; font-size: 13px; }
.atas .kanan button { color: #fff; border-color: #666; }
.sinkron { padding: 2px 10px; border-radius: 999px; background: #3a3a3a; white-space: nowrap; }
.sinkron.ok { background: #e2f0d9; color: #1a5c2a; } .sinkron.kirim { background: #dceaf7; color: #0b3d75; }
.sinkron.tunggu { background: #fff2cc; color: #6b4a00; } .sinkron.gagal { background: #fce4d6; color: #8a2a0b; }

main { padding: 12px 16px 120px; }
.kartu { background: var(--putih); border: 1px solid var(--garis); border-radius: 10px; padding: 16px; }
.kartu h1, .kartu h2 { margin: 0 0 4px; } .kartu h2 { font-size: 16px; }
.masuk { display: grid; place-items: center; min-height: 70vh; }
.masuk form { width: min(360px, 100%); display: grid; gap: 12px; }
label { display: grid; gap: 4px; font-size: 13px; color: var(--ink-2); }

.alat { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px; }
.alat #cari { flex: 1 1 160px; min-width: 140px; }
.seg { display: inline-flex; } .seg button { border-radius: 0; } .seg button:first-child { border-radius: 6px 0 0 6px; }
.seg button:last-child { border-radius: 0 6px 6px 0; margin-left: -1px; } .seg button.aktif { background: #262626; color: #fff; border-color: #262626; }
.info { display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: 12px; color: var(--ink-2); margin-bottom: 8px; }
.info .tanda { padding: 1px 8px; border-radius: 999px; background: var(--kuning); color: #6b4a00; }
.info .tanda.kunci { background: #e5e7eb; color: #374151; }

/* GRID */
.wadah-grid { overflow: auto; max-height: calc(100vh - 260px); border: 1px solid var(--garis); border-radius: 8px; background: var(--putih); outline: none; }
.wadah-grid:focus-visible { box-shadow: 0 0 0 2px var(--utama-2); }
#grid { border-collapse: separate; border-spacing: 0; font-size: 12px; user-select: none; }
#grid th, #grid td { border-right: 1px solid var(--garis-2); border-bottom: 1px solid var(--garis-2); padding: 0; height: var(--sel-h); white-space: nowrap; }
#grid thead th { position: sticky; top: 0; background: #262626; color: #fff; font-weight: 600; z-index: 3; }
#grid thead th.hari { width: var(--sel-w); min-width: var(--sel-w); text-align: center; line-height: 1.1; font-size: 11px; }
#grid thead th.hari small { display: block; font-weight: 400; opacity: .7; }
#grid thead th.hari.libur small { color: #ffb4a8; opacity: 1; }
#grid thead th.hari.kini { background: var(--utama-2); }
#grid .nrp, #grid .nama { position: sticky; background: var(--putih); z-index: 2; padding: 0 8px; text-align: left; }
#grid thead .nrp, #grid thead .nama { z-index: 4; background: #262626; }
#grid .nrp { left: 0; width: 84px; min-width: 84px; }
#grid .nama { left: 84px; width: 190px; min-width: 190px; max-width: 190px; overflow: hidden; text-overflow: ellipsis; border-right: 2px solid var(--garis); }
#grid .nama small { display: block; color: var(--ink-2); font-size: 10px; line-height: 1; overflow: hidden; text-overflow: ellipsis; }
#grid .ls { font-size: 9px; background: var(--lilac); color: #4b2a6b; border-radius: 3px; padding: 0 3px; margin-left: 4px; }
#grid td.h { width: var(--sel-w); min-width: var(--sel-w); text-align: center; font-weight: 600; cursor: cell; position: relative; }
#grid td.h.kini { box-shadow: inset 1px 0 0 var(--utama-2), inset -1px 0 0 var(--utama-2); }
#grid td.h.luar { background: repeating-linear-gradient(45deg, #f3f4f6 0 4px, #e9ebee 4px 8px); cursor: not-allowed; }
#grid td.h.kosong { background: #fff8db; }
#grid td.h.kunci:not(.luar)::after { content: ''; position: absolute; right: 2px; top: 2px; width: 5px; height: 5px; border-radius: 50%; background: #9aa1aa; }
#grid td.h.tunda::before { content: ''; position: absolute; left: 2px; bottom: 2px; width: 6px; height: 2px; background: var(--peringatan); }
#grid td.h.salah { outline: 2px solid var(--galat); outline-offset: -2px; }
#grid td.h.konflik { outline: 2px dashed #8250df; outline-offset: -2px; }
#grid td.h.pilih { background-image: linear-gradient(rgba(11,79,159,.18), rgba(11,79,159,.18)); }
#grid td.h.fokus { outline: 2px solid var(--utama-2); outline-offset: -2px; z-index: 1; }
/* Resume, ATR, Isi selalu terlihat di kanan */
#grid .rk, #grid .pct { position: sticky; background: var(--putih); z-index: 2; }
#grid thead .rk, #grid thead .pct, #grid thead .pct.isi { background: #262626; color: #fff; z-index: 4; }
#grid .rk { right: 128px; width: 132px; min-width: 132px; max-width: 132px; padding: 0 8px; font-size: 11px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; border-left: 2px solid var(--garis); }
#grid .pct { width: 64px; min-width: 64px; padding: 0 8px; text-align: right; font-variant-numeric: tabular-nums; }
#grid .pct.atr { right: 64px; font-weight: 700; } #grid .pct.isi { right: 0; color: var(--ink-2); }
#grid .pct.rendah { color: var(--galat); font-weight: 600; }
#grid tbody tr:hover td.nrp, #grid tbody tr:hover td.nama { background: #f2f6fb; }

/* Warna kode (mengikuti tabel kode HC) */
.k-D  { background: #dceaf7; color: #0b3d75; } .k-N  { background: #1f2a4d; color: #fff; }
.k-T  { background: #e9ddf7; color: #4b2a6b; } .k-L  { background: #e5e7eb; color: #374151; }
.k-S  { background: #f8d0d4; color: #8a1c24; } .k-I  { background: #ffe8a3; color: #6b4a00; }
.k-U  { background: #6f42c1; color: #fff; }    .k-A  { background: #d1242f; color: #fff; }
.k-O  { background: #a9b0bb; color: #1f2328; } .k-DL { background: #fdba74; color: #6b2a00; }
.k-C  { background: #a7e3dc; color: #0b4d45; } .k-CT { background: #b9ecf7; color: #0b4d5e; }
.k-CB { background: #e2c9a6; color: #5a3b12; } .k-NR { background: #4b4fb8; color: #fff; }
.k-DR { background: #8592a6; color: #fff; }

.palet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; padding: 8px 12px; background: rgba(255,255,255,.96); border-top: 1px solid var(--garis); }
.palet button { min-width: 44px; height: 38px; font-weight: 700; border: 0; }
.palet button.hapus { background: #fff; border: 1px solid var(--garis); font-weight: 400; }
.palet button[title]:hover { filter: brightness(.95); }
.bantuan { margin: 6px 0 0; }

.per-tanggal { display: grid; gap: 6px; max-width: 720px; }
.per-tanggal .brs { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; background: var(--putih); border: 1px solid var(--garis); border-radius: 8px; padding: 8px 10px; }
.per-tanggal .brs small { color: var(--ink-2); display: block; }
.per-tanggal select { min-width: 92px; font-weight: 700; }

.kolom { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); }
.baris-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; margin: 12px 0; }
.tabel { width: 100%; border-collapse: collapse; font-size: 13px; }
.tabel th { background: #f2f2f2; text-align: left; font-weight: 600; }
.tabel th, .tabel td { border-bottom: 1px solid var(--garis-2); padding: 6px 8px; vertical-align: top; }
.tabel td.aksi { white-space: nowrap; text-align: right; }

dialog { border: 0; padding: 0; background: transparent; }
dialog::backdrop { background: rgba(0,0,0,.35); }
dialog form { display: grid; gap: 10px; width: min(420px, 92vw); }
dialog .aksi { display: flex; justify-content: flex-end; gap: 8px; }

.toast { position: fixed; right: 16px; bottom: 70px; z-index: 30; display: grid; gap: 6px; max-width: min(420px, 92vw); }
.toast div { background: #262626; color: #fff; padding: 10px 12px; border-radius: 8px; font-size: 13px; box-shadow: 0 4px 14px rgba(0,0,0,.2); }
.toast div.galat { background: #8a1c24; }

@media (max-width: 720px) {
  main { padding: 8px 8px 130px; }
  .atas { flex-wrap: wrap; gap: 8px; } .atas .merek span { display: none; }
  #grid .nama { width: 130px; min-width: 130px; max-width: 130px; } #grid .nrp { width: 72px; min-width: 72px; } #grid .nama { left: 72px; }
  #grid .rk { display: none; } #grid .pct { width: 56px; min-width: 56px; } #grid .pct.atr { right: 56px; }
  .kolom { grid-template-columns: 1fr; }
  .bantuan { display: none; }
}

/* DASHBOARD & CATATAN */
.kpi { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; margin-bottom: 12px; }
.kpi div { background: var(--putih); border: 1px solid var(--garis); border-radius: 10px; padding: 10px 12px; }
.kpi b { display: block; font-size: 22px; font-variant-numeric: tabular-nums; }
.kpi span { font-size: 12px; color: var(--ink-2); }
.kpi .s { background: #fce4d6; } .kpi .i { background: #fff2cc; } .kpi .u { background: #eadcf4; } .kpi .a { background: #f8cbad; }
.tabel td.n, .tabel th.n { text-align: right; font-variant-numeric: tabular-nums; }
.tanda-ok { background: #e2f0d9; color: #1a5c2a; border-radius: 999px; padding: 1px 8px; font-size: 12px; }
.tanda-telat { background: #fff2cc; color: #6b4a00; border-radius: 999px; padding: 1px 8px; font-size: 12px; }
.gulir { max-height: 360px; overflow: auto; }
#ct-tabel input { width: 100%; min-width: 160px; }
#ct-tabel td.kd { font-weight: 700; text-align: center; }
.tren-svg { width: 100%; height: auto; }
.legend { display: flex; gap: 16px; font-size: 12px; color: var(--ink-2); margin-top: 4px; }
.legend i { display: inline-block; width: 14px; height: 3px; vertical-align: middle; margin-right: 4px; }
.legend i.l-atr { background: #073B7A; } .legend i.l-isi { background: #9aa1aa; }
.pesan-sel { padding: 16px !important; }
