:root {
  --shell: #354a5f; --shell-text: #fff; --primary: #0a6ed1; --primary-hover: #085caf;
  --bg: #f5f6f7; --card: #fff; --line: #e5e5e5; --line-strong: #c9ced3;
  --text: #32363a; --muted: #6a6d70;
  --abu-bg: #edeff0; --abu: #556b82; --biru-bg: #d1efff; --biru: #0a6ed1;
  --kuning-bg: #fef7d4; --kuning: #8d6b00; --hijau-bg: #e3f6e6; --hijau: #107e3e;
  --merah-bg: #ffe1e1; --merah: #bb0000;
  --kesisteman: #0a6ed1; --hse: #107e3e;
  --radius: 8px; --shadow: 0 0 0 1px rgba(0,0,0,.05), 0 2px 6px rgba(0,0,0,.08);
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: "72", "72full", Arial, Helvetica, sans-serif; font-size: 14px; color: var(--text); background: var(--bg); line-height: 1.4; }
h1, h2, h3 { margin: 0; font-weight: 600; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--primary); }

/* Shell bar */
.shellbar { position: sticky; top: 0; z-index: 20; background: var(--shell); color: var(--shell-text); display: flex; align-items: center; gap: 12px; padding: 0 16px; height: 48px; }
.shellbar .brand { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 16px; color: #fff; text-decoration: none; background: none; border: 0; cursor: pointer; padding: 0; }
.shellbar .brand .logo { width: 26px; height: 26px; border-radius: 4px; background: var(--primary); display: grid; place-items: center; font-size: 11px; font-weight: 700; }
.shellbar .spacer { flex: 1; }
.shellbar label { font-size: 12px; opacity: .85; display: flex; align-items: center; gap: 6px; }
.shellbar select { background: #46607a; color: #fff; border: 1px solid #5d7791; border-radius: 4px; padding: 5px 8px; max-width: 180px; }
.shellbar .menu-btn { background: none; border: 0; color: #fff; cursor: pointer; padding: 6px 8px; border-radius: 4px; display: flex; align-items: center; gap: 8px; }
.shellbar .menu-btn:hover { background: #46607a; }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: #0a6ed1; display: grid; place-items: center; font-weight: 600; font-size: 12px; }
.popup { position: absolute; right: 12px; top: 50px; background: var(--card); color: var(--text); border-radius: var(--radius); box-shadow: 0 4px 16px rgba(0,0,0,.2); min-width: 220px; padding: 6px 0; z-index: 30; }
.popup .who { padding: 8px 14px; border-bottom: 1px solid var(--line); }
.popup .who small { color: var(--muted); display: block; }
.popup button { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 9px 14px; cursor: pointer; }
.popup button:hover { background: var(--bg); }
.viewas-banner { background: #fff3b8; color: #5c4600; padding: 8px 16px; font-size: 13px; border-bottom: 1px solid #e6d27a; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* Halaman */
.page { max-width: 1280px; margin: 0 auto; padding: 16px; }
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.page-head h1 { font-size: 22px; }
.crumb { color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.crumb a { text-decoration: none; }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-left: auto; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 14px; }
.card-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.card-head h2 { font-size: 16px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.right { text-align: right; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.grow { flex: 1; min-width: 160px; }

/* Launchpad */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.tile { background: var(--card); border: 0; border-radius: 12px; box-shadow: var(--shadow); padding: 18px; text-align: left; cursor: pointer; min-height: 130px; display: flex; flex-direction: column; justify-content: space-between; text-decoration: none; color: var(--text); }
.tile:hover { box-shadow: 0 0 0 2px var(--primary); }
.tile .ic { width: 40px; height: 40px; border-radius: 10px; background: var(--biru-bg); color: var(--primary); display: grid; place-items: center; font-size: 20px; }
.tile .t { font-weight: 600; font-size: 15px; margin-top: 12px; }
.tile .d { color: var(--muted); font-size: 12px; margin-top: 2px; }

/* Tombol & form */
.btn { border: 1px solid var(--primary); background: var(--card); color: var(--primary); padding: 7px 14px; border-radius: 6px; cursor: pointer; font-weight: 500; }
.btn:hover:not(:disabled) { background: #ebf5fe; }
.btn.primary { background: var(--primary); color: #fff; }
.btn.primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn.danger { border-color: var(--merah); color: var(--merah); }
.btn.danger:hover:not(:disabled) { background: var(--merah-bg); }
.btn.ok { border-color: var(--hijau); color: var(--hijau); }
.btn.ok.primary { background: var(--hijau); color: #fff; }
.btn.flat { border-color: transparent; }
.btn.small { padding: 3px 9px; font-size: 12px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.busy { position: relative; color: transparent !important; }
.btn.busy::after { content: ""; position: absolute; inset: 0; margin: auto; width: 14px; height: 14px; border: 2px solid #fff; border-top-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
.btn:not(.primary).busy::after { border-color: var(--primary); border-top-color: transparent; }
.input, select.input, textarea.input { width: 100%; padding: 6px 8px; border: 1px solid var(--line-strong); border-radius: 4px; background: #fff; min-height: 32px; }
.input:focus, select:focus, .btn:focus-visible, button:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.input:disabled, select:disabled { background: #f2f3f4; color: #555; cursor: not-allowed; }
.input.bad { border-color: var(--merah); background: #fff6f6; }
.label { display: block; font-size: 12px; color: var(--muted); margin: 8px 0 3px; }
.field-error { color: var(--merah); font-size: 12px; min-height: 16px; margin-top: 4px; }
.num { text-align: right; }

/* Badge */
.badge { display: inline-block; padding: 2px 9px; border-radius: 10px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge-abu { background: var(--abu-bg); color: var(--abu); }
.badge-biru { background: var(--biru-bg); color: var(--biru); }
.badge-kuning { background: var(--kuning-bg); color: var(--kuning); }
.badge-hijau { background: var(--hijau-bg); color: var(--hijau); }
.badge-merah { background: var(--merah-bg); color: var(--merah); }
.bidang { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 4px; color: #fff; }
.bidang-kesisteman { background: var(--kesisteman); }
.bidang-hse { background: var(--hse); }

/* Tabel */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 6px 6px; border-bottom: 1px solid var(--line-strong); white-space: nowrap; }
.tbl td { padding: 6px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tfoot td { font-weight: 600; border-bottom: 0; }
.red { color: var(--merah); font-weight: 600; }

/* Perencanaan */
.prog { border-left: 4px solid var(--kesisteman); }
.prog.hse { border-left-color: var(--hse); }
.prog.locked { background: #fcfcfc; }
.prog-name { font-weight: 600; font-size: 15px; }
.sub-tbl .col-nama { min-width: 190px; } .sub-tbl .col-ang { min-width: 130px; } .sub-tbl .col-tgl { min-width: 150px; }
.sub-tbl .col-bobot { width: 80px; } .sub-tbl .col-pic { min-width: 120px; } .sub-tbl .col-agt { min-width: 190px; } .sub-tbl .col-act { width: 40px; }
.tgl { display: flex; gap: 4px; }
.tgl select { padding: 6px 4px; }
.tgl .d { width: 56px; flex: none; } .tgl .m { flex: 1; min-width: 96px; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 4px; }
.chip { background: var(--biru-bg); color: var(--biru); border-radius: 10px; padding: 1px 4px 1px 9px; font-size: 12px; display: inline-flex; align-items: center; gap: 2px; }
.chip button { border: 0; background: none; cursor: pointer; color: inherit; font-size: 14px; line-height: 1; padding: 0 4px; }
.note-vp { background: var(--kuning-bg); color: #5c4600; border-radius: 6px; padding: 8px 12px; margin-bottom: 10px; font-size: 13px; }
.sum { display: flex; gap: 20px; flex-wrap: wrap; font-size: 13px; }
.sum b { font-size: 15px; }
.hint { font-size: 12px; color: var(--muted); }

/* Tabel RKAP */
.rkap-tbl .row-prog td { background: #f7f8f9; font-weight: 600; }
.rkap-tbl .mo { width: 34px; min-width: 34px; padding: 0; border-left: 1px solid var(--line); }
.rkap-tbl .mo-h { text-align: center; padding: 6px 2px; }
.rkap-tbl .mo.on.kes { background: var(--kesisteman); } .rkap-tbl .mo.on.hse { background: var(--hse); }
.legend { display: inline-block; width: 12px; height: 12px; border-radius: 2px; vertical-align: -1px; }
.legend.kes { background: var(--kesisteman); } .legend.hse { background: var(--hse); }
.rkap-tbl { -webkit-print-color-adjust: exact; print-color-adjust: exact; }

/* Realisasi */
.cards { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); }
.subcard { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.kvs { display: grid; gap: 4px; margin: 6px 0; }
.kv { display: flex; gap: 8px; font-size: 13px; }
.kv .k { color: var(--muted); min-width: 110px; flex: none; }
.split { display: grid; grid-template-columns: 280px 1fr; gap: 16px; }
.split-r { display: grid; grid-template-columns: 1fr 300px; gap: 16px; align-items: start; }
.sub-list { display: flex; flex-direction: column; gap: 8px; max-height: 560px; overflow: auto; }
.sub-item { text-align: left; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 10px; cursor: pointer; }
.sub-item:hover { border-color: var(--primary); }
.sub-item.on { border-color: var(--primary); box-shadow: 0 0 0 2px #cfe5fb; }
.si-t { font-weight: 600; }
.cols2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ket { background: #f7f8f9; border-radius: var(--radius); padding: 12px; display: grid; gap: 6px; }
.ket-t { font-weight: 600; }
.tgl .y { width: 70px; flex: none; }
@media (max-width: 900px) { .split, .split-r, .cols2 { grid-template-columns: 1fr; } .cards { grid-template-columns: 1fr; } }

/* Dashboard */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 14px; }
.stat { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.stat .n { font-size: 24px; font-weight: 600; margin-top: 4px; }
.stat .l { color: var(--muted); font-size: 12px; }
.bar { height: 10px; background: var(--abu-bg); border-radius: 5px; overflow: hidden; position: relative; }
.bar > i { display: block; height: 100%; background: var(--primary); border-radius: 5px; }
.bar.ok > i { background: var(--hijau); }
.sub-row { display: grid; grid-template-columns: minmax(160px, 1.3fr) 2fr 290px; gap: 12px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); }
.pills { display: flex; gap: 14px; flex-wrap: wrap; }
.pill b { font-size: 18px; margin-right: 4px; }
@media (max-width: 760px) { .sub-row { grid-template-columns: 1fr; } }

/* Dialog & toast */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.4); display: grid; place-items: center; z-index: 100; padding: 16px; }
.dialog { background: var(--card); border-radius: 10px; width: min(480px, 100%); box-shadow: 0 8px 32px rgba(0,0,0,.3); }
.dialog-title { padding: 14px 18px; font-weight: 600; font-size: 16px; border-bottom: 1px solid var(--line); }
.dialog-body { padding: 14px 18px; max-height: 60vh; overflow: auto; }
.dialog-body p { margin: 0; }
.dialog-actions { padding: 10px 18px; display: flex; justify-content: flex-end; gap: 8px; border-top: 1px solid var(--line); }
#toasts { position: fixed; top: 58px; right: 14px; z-index: 200; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 28px)); }
.toast { background: var(--shell); color: #fff; padding: 10px 14px; border-radius: 6px; box-shadow: 0 4px 14px rgba(0,0,0,.25); transition: opacity .3s; white-space: pre-line; }
.toast.success { background: var(--hijau); } .toast.error { background: var(--merah); } .toast.out { opacity: 0; }

/* Login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: linear-gradient(160deg, #354a5f 0%, #1e2d3c 100%); }
.login-card { background: var(--card); border-radius: 12px; width: min(400px, 100%); padding: 28px; box-shadow: 0 10px 40px rgba(0,0,0,.35); }
.login-card h1 { font-size: 20px; margin: 10px 0 2px; }
.login-card .logo { width: 44px; height: 44px; border-radius: 8px; background: var(--primary); color: #fff; display: grid; place-items: center; font-weight: 700; }
.tabs { display: flex; border-bottom: 1px solid var(--line); margin: 16px 0 6px; }
.tabs button { flex: 1; background: none; border: 0; border-bottom: 3px solid transparent; padding: 9px; cursor: pointer; color: var(--muted); font-weight: 600; }
.tabs button[aria-selected="true"] { color: var(--primary); border-bottom-color: var(--primary); }
.err-box { background: var(--merah-bg); color: var(--merah); border-radius: 6px; padding: 8px 12px; margin-top: 10px; font-size: 13px; }
.ok-box { background: var(--hijau-bg); color: var(--hijau); border-radius: 6px; padding: 8px 12px; margin-top: 10px; font-size: 13px; }

/* Lain-lain */
.empty { text-align: center; padding: 36px 16px; color: var(--muted); }
.empty-title { font-weight: 600; font-size: 15px; color: var(--text); margin-bottom: 4px; }
.loading { display: flex; gap: 10px; align-items: center; justify-content: center; padding: 40px; color: var(--muted); }
.spin { width: 18px; height: 18px; border: 2px solid var(--line-strong); border-top-color: var(--primary); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

@media (max-width: 640px) {
  .page { padding: 12px; }
  .tiles { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .tile { min-height: 110px; padding: 14px; }
  .shellbar { padding: 0 10px; gap: 8px; }
  .shellbar .vname { display: none; }
  .shellbar label span { display: none; }
}
@media print {
  .shellbar, .viewas-banner, .toolbar, .no-print, #toasts { display: none !important; }
  body { background: #fff; }
  .card { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
}
