:root {
  --bg: #f4f6f5;
  --panel: #ffffff;
  --panel-2: #f8faf9;
  --line: #e4e9e7;
  --text: #15201c;
  --muted: #64716c;
  --accent: #0f8a6c;
  --accent-ink: #ffffff;
  --accent-soft: #e2f4ee;
  --lime: #c8f169;
  --warn: #b45309;
  --warn-soft: #fef3c7;
  --bad: #c2410c;
  --bad-soft: #ffedd5;
  --info: #3b5bdb;
  --info-soft: #e7ecff;
  --side: #0f1a16;
  --side-text: #c9d6d1;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(16, 32, 26, .04), 0 8px 24px -12px rgba(16, 32, 26, .12);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1210; --panel: #121c19; --panel-2: #172320; --line: #24332e;
    --text: #e7efec; --muted: #8fa19a; --accent: #34c79d; --accent-ink: #062018;
    --accent-soft: #143a30; --warn: #fbbf24; --warn-soft: #3a2c0b; --bad: #fb923c;
    --bad-soft: #3b1d0c; --info: #8ea6ff; --info-soft: #1c2448; --side: #070c0a;
    --shadow: 0 1px 2px rgba(0,0,0,.3); color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
svg.ic { width: 1.15em; height: 1.15em; flex: none; vertical-align: -.2em; }
.num, td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------- layout */
.app { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.side {
  background: var(--side); color: var(--side-text); padding: 22px 14px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; gap: 4px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 10px 22px; color: #fff; }
.brand-logo {
  width: 36px; height: 36px; border-radius: 11px; background: var(--lime); color: #0f1a16;
  display: grid; place-items: center; font-weight: 800; font-size: 15px;
}
.brand b { display: block; font-size: 15px; }
.brand small { color: #7f9089; font-size: 12px; }
.side h6 { margin: 18px 10px 6px; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: #6c7d76; font-weight: 600; }
.side a {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px;
  font-weight: 500; transition: background .15s;
}
.side a:hover { background: rgba(255,255,255,.06); color: #fff; }
.side a.on { background: rgba(200,241,105,.12); color: var(--lime); }
.side svg { width: 18px; height: 18px; flex: none; }
.side .foot { margin-top: auto; padding: 14px 10px 0; font-size: 12px; color: #6c7d76; }

.main { padding: 26px 34px 60px; min-width: 0; }
.top { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.top h1 { margin: 0; font-size: 24px; letter-spacing: -.02em; }
.top p { margin: 4px 0 0; color: var(--muted); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- cards */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 20px 22px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 22px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.card-head h2, .card-head h3 { margin: 0; font-size: 15px; }
.card-head p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.grid { display: grid; gap: 16px; }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.stack { display: flex; flex-direction: column; gap: 16px; }

.kpi { padding: 18px 20px; position: relative; overflow: hidden; }
.kpi .lbl { color: var(--muted); font-size: 13px; font-weight: 500; display: flex; align-items: center; gap: 8px; }
.kpi .val { font-size: 24px; font-weight: 700; letter-spacing: -.02em; margin-top: 6px; font-variant-numeric: tabular-nums; }
.kpi .sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.kpi.hero { background: var(--side); color: #fff; border-color: transparent; }
.kpi.hero .lbl, .kpi.hero .sub { color: #a9bab3; }
.kpi.hero .val { color: var(--lime); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); display: inline-block; }

/* ---------- stepper */
.stepper { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-bottom: 20px; }
.step {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 14px;
  background: var(--panel); border: 1px solid var(--line); transition: border-color .15s, transform .15s;
}
.step:hover { border-color: var(--accent); }
.step .n {
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; flex: none;
  font-weight: 700; font-size: 13px; background: var(--panel-2); border: 1px solid var(--line); color: var(--muted);
}
.step b { display: block; font-size: 13.5px; }
.step small { color: var(--muted); font-size: 12px; }
.step.ok .n { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.step.on { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.step.on .n { background: var(--accent); color: var(--accent-ink); border-color: transparent; }

/* ---------- tables */
.tbl-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { font-size: 12px; font-weight: 600; color: var(--muted); background: var(--panel-2); position: sticky; top: 0; z-index: 1; white-space: nowrap; }
tbody tr:hover td { background: var(--panel-2); }
tbody tr:last-child td { border-bottom: 0; }
tfoot td { font-weight: 700; background: var(--panel-2); border-top: 1px solid var(--line); border-bottom: 0; }
td.sub { color: var(--muted); font-size: 12.5px; }
.tbl-scroll { max-height: 68vh; overflow: auto; }
th.grp { text-align: center; border-left: 1px solid var(--line); }
td.bl, th.bl { border-left: 1px solid var(--line); }

/* ---------- forms */
input, select, textarea {
  font: inherit; color: var(--text); background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; padding: 8px 10px; min-width: 0; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input[type=number] { text-align: right; font-variant-numeric: tabular-nums; }
td input, td select { padding: 6px 8px; width: 100%; }
td input.w-s { width: 90px; } td input.w-m { width: 120px; }
input.diubah { border-color: var(--info); background: var(--info-soft); }
label.f { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 500; color: var(--muted); }
.form-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 9px 15px; border-radius: 11px;
  border: 1px solid var(--line); background: var(--panel); font: inherit; font-weight: 600; font-size: 13.5px;
  cursor: pointer; color: var(--text); white-space: nowrap; transition: transform .1s, background .15s;
}
.btn:hover { background: var(--panel-2); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 16px; height: 16px; }
.btn.pri { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn.pri:hover { filter: brightness(1.06); }
.btn.dark { background: var(--side); color: var(--lime); border-color: transparent; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.danger { color: var(--bad); }
.btn.sm { padding: 6px 10px; font-size: 12.5px; border-radius: 9px; }

/* ---------- chips, tabs, badges */
.tabs { display: inline-flex; gap: 4px; padding: 4px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; flex-wrap: wrap; }
.tabs a { padding: 6px 12px; border-radius: 9px; font-weight: 600; font-size: 13px; color: var(--muted); display: inline-flex; gap: 6px; align-items: center; }
.tabs a.on { background: var(--panel); color: var(--text); box-shadow: var(--shadow); }
.tabs .cnt { font-size: 11px; background: var(--line); padding: 0 6px; border-radius: 99px; }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 99px; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.b-scm { background: var(--accent-soft); color: var(--accent); }
.b-ck { background: var(--info-soft); color: var(--info); }
.b-mbu { background: var(--warn-soft); color: var(--warn); }
.b-warn { background: var(--warn-soft); color: var(--warn); }
.b-bad { background: var(--bad-soft); color: var(--bad); }
.b-ok { background: var(--accent-soft); color: var(--accent); }
.b-mute { background: var(--panel-2); color: var(--muted); border: 1px solid var(--line); }
.up { color: var(--accent); font-weight: 600; } .down { color: var(--bad); font-weight: 600; }
.muted { color: var(--muted); }

/* ---------- alerts */
.flash { padding: 12px 16px; border-radius: 12px; margin-bottom: 14px; font-weight: 500; display: flex; gap: 10px; align-items: center; }
.flash.ok { background: var(--accent-soft); color: var(--accent); }
.flash.error { background: var(--bad-soft); color: var(--bad); }
.note { padding: 14px 16px; border-radius: 12px; background: var(--panel-2); border: 1px dashed var(--line); color: var(--muted); font-size: 13px; }
.note b { color: var(--text); }
.lock-banner { background: var(--warn-soft); color: var(--warn); padding: 10px 16px; border-radius: 12px; margin-bottom: 14px; font-weight: 600; display: flex; justify-content: space-between; align-items: center; gap: 10px; }

/* ---------- bars */
.bar { height: 8px; border-radius: 99px; background: var(--panel-2); overflow: hidden; border: 1px solid var(--line); }
.bar i { display: block; height: 100%; border-radius: 99px; background: var(--accent); }
.bar i.over { background: var(--bad); }
.bars { display: flex; flex-direction: column; gap: 16px; }
.bars .row-lbl { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 6px; }

/* ---------- menu grid */
.menu-grid td { min-width: 150px; }
.menu-grid th:first-child, .menu-grid td:first-child { min-width: 90px; font-weight: 600; }
.pill-list { display: flex; gap: 6px; flex-wrap: wrap; }
.pill { padding: 6px 12px; border-radius: 99px; border: 1px solid var(--line); background: var(--panel); font-weight: 600; font-size: 13px; display: inline-flex; gap: 6px; align-items: center; }
.pill.on { background: var(--side); color: var(--lime); border-color: transparent; }
.pill .mini { width: 7px; height: 7px; border-radius: 50%; background: var(--line); }
.pill .mini.ok { background: var(--accent); }

.empty { text-align: center; padding: 50px 20px; color: var(--muted); }
.empty h3 { color: var(--text); margin: 10px 0 4px; }
.sticky-bar {
  position: sticky; bottom: 14px; margin-top: 16px; display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 12px 16px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); flex-wrap: wrap;
}
.flow { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; counter-reset: f; }
.flow div { padding: 14px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.flow div b { display: block; color: var(--text); margin-bottom: 2px; }

@media screen and (max-width: 1100px) {
  .g4 { grid-template-columns: repeat(2, 1fr); }
  .stepper, .flow { grid-template-columns: repeat(3, 1fr); }
}
.mtop, .scrim { display: none; }

/* ---------- HP & tablet kecil (screen saja: kertas cetak juga sempit, jangan ikut gaya HP) */
@media screen and (max-width: 760px) {
  body { font-size: 15px; }
  .app { display: block; }

  /* bar atas + menu laci */
  .mtop {
    display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 40;
    height: 54px; padding: 0 12px; background: var(--side); color: #fff;
  }
  .mtop .brand-logo { width: 30px; height: 30px; border-radius: 9px; font-size: 13px; }
  .mtop-judul { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .burger { display: grid; place-items: center; width: 42px; height: 42px; margin-left: -6px; border: 0; border-radius: 10px; background: transparent; color: #fff; cursor: pointer; }
  .burger:active { background: rgba(255,255,255,.1); }
  .side {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 60; width: min(84vw, 300px); height: auto;
    transform: translateX(-102%); transition: transform .22s ease; box-shadow: 0 0 40px rgba(0,0,0,.35);
  }
  .side a { padding: 12px 10px; }
  body.menu-buka .side { transform: none; }
  .scrim { position: fixed; inset: 0; z-index: 50; background: rgba(5,12,10,.5); }
  body.menu-buka .scrim { display: block; }
  body.menu-buka { overflow: hidden; }

  .main { padding: 16px 12px 100px; }
  .top { align-items: stretch; margin-bottom: 16px; gap: 12px; }
  .top h1 { font-size: 20px; }
  .top > form, .top > .actions { width: 100%; }
  .top > form.card .btn { flex: 1 1 auto; justify-content: center; }
  .form-row > input, .form-row > select { flex: 1 1 140px; }
  .form-row > * { min-width: 0; max-width: 100%; }
  .form-row > .form-row { width: 100%; }
  input[type=search] { width: 100%; }

  /* grid & kolom: semua jadi satu kolom (termasuk grid dengan style inline) */
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g3, .g2, .flow, .grid[style*="grid-template-columns"] { grid-template-columns: minmax(0, 1fr) !important; }
  .grid > *, .stack > * { min-width: 0; }
  select { max-width: 100%; }
  .kpi { padding: 14px 16px; }
  .kpi .val { font-size: 19px; }
  .card-pad { padding: 16px; }
  .card-head { padding: 14px 16px; }

  /* stepper: satu baris yang bisa digeser */
  .stepper { display: flex; overflow-x: auto; gap: 6px; margin: 0 -12px 16px; padding: 2px 12px 6px; scroll-snap-type: x proximity; scrollbar-width: none; }
  .stepper::-webkit-scrollbar { display: none; }
  .step { flex: none; padding: 8px 12px 8px 8px; scroll-snap-align: center; }
  .step small { display: none; }
  .step .n { width: 24px; height: 24px; font-size: 12px; }

  /* tab filter: satu baris yang bisa digeser */
  .tabs { flex-wrap: nowrap; overflow-x: auto; max-width: 100%; scrollbar-width: none; }
  .tabs a { white-space: nowrap; padding: 8px 12px; }

  /* input & tombol cukup besar untuk jempol; 16px mencegah zoom otomatis di iPhone */
  input, select, textarea { font-size: 16px; min-height: 42px; }
  td input, td select { min-height: 38px; }
  td select { min-width: 170px; }
  input[type=checkbox] { min-height: 0; width: 22px; height: 22px; }
  .btn { min-height: 42px; padding: 9px 14px; font-size: 14px; }
  .btn.sm { min-height: 36px; }

  /* tabel: geser ke samping, kolom pertama tetap terlihat */
  th, td { padding: 9px 10px; }
  .tbl-scroll { max-height: 72vh; }
  .tbl-wrap th:first-child, .tbl-wrap td:first-child {
    position: sticky; left: 0; z-index: 2; background: var(--panel); box-shadow: 1px 0 0 var(--line);
    max-width: 42vw;
  }
  .tbl-wrap th:first-child { z-index: 3; background: var(--panel-2); }
  .tbl-wrap tfoot td:first-child { background: var(--panel-2); }

  /* tombol simpan menempel di bawah layar */
  .sticky-bar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; margin: 0; border-radius: 16px 16px 0 0;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); border-bottom: 0;
    box-shadow: 0 -6px 24px -10px rgba(16,32,26,.25);
  }
  .sticky-bar > .muted:not(.tetap) { display: none; }
  .sticky-bar > .muted { font-size: 12.5px; width: 100%; }
  .sticky-bar .actions, .sticky-bar > form { flex: 1; }
  .sticky-bar .btn { flex: 1 1 auto; justify-content: center; }
  .sticky-bar > .btn { width: 100%; }
}
@media print {
  @page { size: A4 landscape; margin: 12mm; }
  :root {
    --bg: #fff; --panel: #fff; --panel-2: #f3f6f5; --line: #d5ddd9; --text: #111; --muted: #555;
    --accent: #0f6b54; --accent-soft: #e2f4ee; color-scheme: light;
  }
  body { background: #fff; font-size: 10.5pt; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .side, .mtop, .scrim, .stepper, .actions, .no-print, .sticky-bar form, .sticky-bar .btn { display: none !important; }
  .app { display: block; } .main { padding: 0; }
  .top { margin-bottom: 10px; } .top h1 { font-size: 16pt; }
  .card { box-shadow: none; border-color: var(--line); break-inside: avoid; margin-bottom: 10px; }
  .card-head { padding: 8px 12px; } .card-pad { padding: 10px 12px; }
  .tbl-wrap, .tbl-scroll { overflow: visible !important; max-height: none !important; }
  th { position: static; }
  th, td { padding: 4px 8px; }
  tbody tr:hover td { background: none; }
  input, select { border: 0; padding: 0; background: none; }
  .grid { gap: 10px; }
  .sticky-bar { position: static; box-shadow: none; border: 0; padding: 4px 0; margin: 0; }
  .lock-banner { border: 1px solid var(--warn); }
}
