:root {
  color-scheme: light;
  --bg: #f4f5f2;
  --surface: #ffffff;
  --surface-2: #f0f1ed;
  --line: #dfe1db;
  --ink: #15171a;
  --ink-2: #4c5058;
  --ink-3: #7a7e86;
  --accent: #0d6b4f;
  --accent-ink: #ffffff;
  --accent-soft: #e2f1eb;
  --s1: #2a78d6;  /* dikunjungi */
  --s2: #eb6834;  /* berminat */
  --s3: #1baf7a;  /* mendaftar */
  --track: #e8e9e4;
  --f1: #86b6ef; --f2: #5598e7; --f3: #2a78d6; --f4: #1c5cab; --f5: #104281;
  --good: #137a3a; --good-bg: #e3f4e8;
  --warn: #8a5a00; --warn-bg: #fdf1d6;
  --bad: #b3261e;  --bad-bg: #fbe5e3;
  --info: #1c5cab; --info-bg: #e2edfb;
  --mute-bg: #eceee9;
  --shadow: 0 1px 2px rgba(0,0,0,.06), 0 2px 8px rgba(0,0,0,.04);
  --r: 14px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #111312; --surface: #1a1c1b; --surface-2: #232625; --line: #2f3331;
    --ink: #f2f3f1; --ink-2: #c3c6c1; --ink-3: #8d918c;
    --accent: #3fb68b; --accent-ink: #06231a; --accent-soft: #173229;
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --track: #2a2d2c;
    --f1: #184f95; --f2: #1c5cab; --f3: #2a78d6; --f4: #3987e5; --f5: #6da7ec;
    --good: #6fd394; --good-bg: #16301f; --warn: #f0c060; --warn-bg: #33270d;
    --bad: #ff8a80; --bad-bg: #3a1714; --info: #86b6ef; --info-bg: #15263c; --mute-bg: #262927;
    --shadow: none;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111312; --surface: #1a1c1b; --surface-2: #232625; --line: #2f3331;
  --ink: #f2f3f1; --ink-2: #c3c6c1; --ink-3: #8d918c;
  --accent: #3fb68b; --accent-ink: #06231a; --accent-soft: #173229;
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --track: #2a2d2c;
  --f1: #184f95; --f2: #1c5cab; --f3: #2a78d6; --f4: #3987e5; --f5: #6da7ec;
  --good: #6fd394; --good-bg: #16301f; --warn: #f0c060; --warn-bg: #33270d;
  --bad: #ff8a80; --bad-bg: #3a1714; --info: #86b6ef; --info-bg: #15263c; --mute-bg: #262927;
  --shadow: none;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
h1, h2, h3 { margin: 0; line-height: 1.25; }
h2 { font-size: 17px; }
h3 { font-size: 15px; }
.muted { color: var(--ink-3); }
.small { font-size: 13px; }
.num { font-variant-numeric: tabular-nums; }

/* shell */
.top {
  position: sticky; top: 0; z-index: 5; background: var(--accent); color: var(--accent-ink);
  padding: 12px 16px; display: flex; align-items: center; gap: 10px;
  padding-top: max(12px, env(safe-area-inset-top));
}
.top .back { background: none; border: 0; color: inherit; font-size: 22px; padding: 0 6px 0 0; cursor: pointer; line-height: 1; }
.top h1 { font-size: 17px; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top .sub { font-size: 12px; opacity: .85; font-weight: 400; }
.top .icon { background: none; border: 0; color: inherit; cursor: pointer; padding: 4px; display: grid; place-items: center; }
main { max-width: 760px; margin: 0 auto; padding: 14px 16px 96px; }
.nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 6; background: var(--surface);
  border-top: 1px solid var(--line); display: flex; padding-bottom: env(safe-area-inset-bottom);
}
.nav a {
  flex: 1; text-align: center; padding: 8px 4px 9px; font-size: 11.5px; color: var(--ink-3);
  text-decoration: none; display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.nav a.on { color: var(--accent); font-weight: 600; }
.nav svg { width: 22px; height: 22px; }

/* cards */
.card { background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); padding: 14px; margin-bottom: 12px; border: 1px solid var(--line); }
.card > h2, .card > h3 { margin-bottom: 10px; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 12px; box-shadow: var(--shadow); }
.tile .v { font-size: 26px; font-weight: 700; letter-spacing: -.5px; }
.tile .l { font-size: 12.5px; color: var(--ink-2); }
.tile .d { font-size: 12px; color: var(--ink-3); }

.hero { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; margin-bottom: 12px; box-shadow: var(--shadow); }
.hero .big { font-size: 40px; font-weight: 800; letter-spacing: -1px; line-height: 1; }
.hero .of { font-size: 18px; color: var(--ink-2); font-weight: 600; }
.bar { height: 12px; background: var(--track); border-radius: 99px; overflow: hidden; margin: 12px 0 6px; }
.bar > i { display: block; height: 100%; background: var(--s3); border-radius: 99px; min-width: 4px; }

/* funnel */
.fun { display: grid; gap: 8px; }
.fun .row { display: grid; grid-template-columns: 112px 1fr 56px; align-items: center; gap: 8px; font-size: 13px; }
.fun .trk { height: 22px; background: var(--track); border-radius: 4px; overflow: hidden; }
.fun .trk > i { display: block; height: 100%; border-radius: 0 4px 4px 0; min-width: 3px; }
.fun .n { text-align: right; font-variant-numeric: tabular-nums; }
.fun .n b { display: block; font-size: 14px; }
.fun .n span { font-size: 11px; color: var(--ink-3); }

/* stacked bars per kategori */
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--ink-2); margin-bottom: 10px; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.sb { display: grid; gap: 10px; }
.sb .item { cursor: pointer; }
.sb .lbl { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0 8px; font-size: 13px; margin-bottom: 3px; }
.sb .lbl b { font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb .lbl span { color: var(--ink-3); white-space: nowrap; font-variant-numeric: tabular-nums; }
.sb .trk { display: flex; height: 12px; background: var(--track); border-radius: 4px; overflow: hidden; gap: 2px; }
.sb .trk i { display: block; height: 100%; }
.sb .trk i:last-of-type { border-radius: 0 4px 4px 0; }

.cols { display: flex; align-items: flex-end; gap: 6px; height: 120px; padding-top: 16px; }
.cols .c { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; min-width: 0; }
.cols .c i { display: block; width: 100%; max-width: 34px; background: var(--s1); border-radius: 4px 4px 0 0; min-height: 2px; }
.cols .c span { font-size: 10.5px; color: var(--ink-3); white-space: nowrap; }
.cols .c b { font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums; }

/* list */
.list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.li { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-top: 1px solid var(--line); cursor: pointer; text-decoration: none; color: inherit; }
.li:first-child { border-top: 0; }
.li:active { background: var(--surface-2); }
.li .main { flex: 1; min-width: 0; }
.li .t { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li .s { font-size: 12.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--accent); flex: none; }
.more { display: block; width: 100%; padding: 12px; border: 0; background: var(--surface-2); color: var(--accent); font-weight: 600; cursor: pointer; }

.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 600; padding: 3px 8px; border-radius: 99px; white-space: nowrap; flex: none; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.b-belum { background: var(--mute-bg); color: var(--ink-2); }
.b-tugas { background: var(--warn-bg); color: var(--warn); }
.b-kunjung { background: var(--info-bg); color: var(--info); }
.b-ragu { background: var(--info-bg); color: var(--info); }
.b-minat { background: #fde9df; color: #a8431a; }
:root[data-theme="dark"] .b-minat { background: #3a2116; color: #ffb08a; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .b-minat { background: #3a2116; color: #ffb08a; } }
.b-lain { background: var(--bad-bg); color: var(--bad); }
.b-daftar { background: var(--good-bg); color: var(--good); }

/* filter */
.search { position: sticky; top: 52px; z-index: 4; background: var(--bg); padding: 4px 0 8px; }
.search input { width: 100%; padding: 11px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 8px 0 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips select, .chip {
  flex: none; padding: 7px 10px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface);
  font-size: 13px; max-width: 190px; cursor: pointer;
}
.chip.on, .chips select.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.count { font-size: 12.5px; color: var(--ink-3); margin: 6px 2px 8px; display: flex; justify-content: space-between; gap: 8px; }

/* forms */
.f { display: grid; gap: 14px; }
.f label { display: grid; gap: 5px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.f input, .f select, .f textarea {
  width: 100%; padding: 11px 12px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); font-weight: 400; color: var(--ink);
}
.f textarea { min-height: 84px; resize: vertical; }
.f input:focus, .f select:focus, .f textarea:focus, .search input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.f .hint { font-weight: 400; color: var(--ink-3); font-size: 12px; }
.seg { display: flex; flex-wrap: wrap; gap: 8px; }
.seg button { padding: 8px 12px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-size: 13.5px; }
.seg button.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 16px;
  border-radius: 12px; border: 1px solid var(--line); background: var(--surface); cursor: pointer;
  font-weight: 600; text-decoration: none; color: var(--ink);
}
.btn.pri { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.wa { background: #1f9d55; border-color: #1f9d55; color: #fff; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .55; cursor: default; }
.btns { display: flex; gap: 10px; flex-wrap: wrap; }
.btns .btn { flex: 1; min-width: 140px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.foto-prev { max-width: 100%; max-height: 220px; border-radius: 10px; display: block; margin-top: 6px; }

.kv { display: grid; grid-template-columns: 120px 1fr; gap: 6px 12px; font-size: 14px; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; word-break: break-word; }

.tl { display: grid; gap: 10px; }
.tl .ev { border-left: 3px solid var(--s1); padding: 2px 0 2px 10px; }
.tl .ev .h { font-size: 12.5px; color: var(--ink-3); }

table.t { width: 100%; border-collapse: collapse; font-size: 13px; }
table.t th, table.t td { padding: 7px 6px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
table.t th { color: var(--ink-3); font-weight: 600; font-size: 12px; }
table.t td.n, table.t th.n { text-align: right; font-variant-numeric: tabular-nums; }
.scroll-x { overflow-x: auto; }

.selbar {
  position: fixed; left: 0; right: 0; bottom: 58px; z-index: 7; background: var(--ink); color: var(--bg);
  padding: 10px 16px; display: flex; gap: 10px; align-items: center; max-width: 760px; margin: 0 auto; border-radius: 14px 14px 0 0;
}
.selbar select { flex: 1; min-width: 0; padding: 9px; border-radius: 10px; border: 0; background: var(--surface); color: var(--ink); }
.selbar .btn { padding: 9px 12px; }

#toast {
  position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%) translateY(20px); opacity: 0;
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-size: 14px;
  transition: .2s; pointer-events: none; z-index: 20; max-width: calc(100% - 32px);
}
#toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.err { background: var(--bad); color: #fff; }
#busy { position: fixed; inset: 0; z-index: 40; background: rgba(10, 14, 12, .28); display: grid; place-items: center; animation: fadeIn .15s ease; }
#busy[hidden] { display: none; }
.busy-box { background: var(--surface); color: var(--ink); border-radius: 16px; padding: 18px 22px; display: flex; align-items: center; gap: 14px;
  box-shadow: 0 8px 30px rgba(0,0,0,.18); max-width: calc(100% - 48px); font-weight: 600; }
.busy-box .spin { width: 26px; height: 26px; flex: none; }
.busy-bar { position: fixed; top: 0; left: 0; right: 0; height: 3px; overflow: hidden; }
.busy-bar i { position: absolute; top: 0; height: 100%; width: 40%; background: var(--s2); animation: busyBar 1.1s ease-in-out infinite; }
@keyframes busyBar { from { left: -40%; } to { left: 100%; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .busy-bar i, .spin { animation-duration: 2.5s; } }
dialog { border: 0; border-radius: 16px; padding: 18px; width: min(420px, calc(100% - 32px)); background: var(--surface); color: var(--ink); }
dialog::backdrop { background: rgba(0,0,0,.45); }

.splash { min-height: 70vh; display: grid; place-items: center; align-content: center; gap: 12px; color: var(--ink-3); }
.spin { width: 34px; height: 34px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: sp 0.8s linear infinite; }
@keyframes sp { to { transform: rotate(360deg); } }
.login { max-width: 380px; margin: 0 auto; padding: 40px 16px; }
.login .logo { width: 56px; height: 56px; border-radius: 16px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-weight: 800; font-size: 20px; margin-bottom: 14px; }
.empty { text-align: center; color: var(--ink-3); padding: 28px 12px; }
.note { background: var(--warn-bg); color: var(--warn); border-radius: 10px; padding: 10px 12px; font-size: 13px; }
.menu .li svg { width: 20px; height: 20px; color: var(--ink-3); flex: none; }
.pre { white-space: pre-line; }
@media (min-width: 640px) {
  .grid4 { grid-template-columns: repeat(4, 1fr); }
}

/* editor info / RAB */
.ed { display: grid; gap: 10px; }
.ed .row-card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: grid; gap: 8px; }
.ed .row-card.judul { background: var(--surface-2); }
.ed .row-card textarea { min-height: 60px; }
.ed .row-tools { display: flex; gap: 6px; justify-content: flex-end; align-items: center; }
.ed .row-tools .tot { margin-right: auto; font-size: 13px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.ed .row-tools button { padding: 6px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-size: 13px; }
.ed .row-tools button.del { color: var(--bad); }
.savebar { position: sticky; bottom: 66px; z-index: 5; display: flex; gap: 10px; padding: 10px 0; background: linear-gradient(transparent, var(--bg) 30%); }
.savebar .btn { flex: 1; }
.f .row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.link-btn { background: none; border: 0; color: var(--accent); font-weight: 600; cursor: pointer; padding: 0; font-size: 13px; text-decoration: underline; }
.danger { color: var(--bad) !important; border-color: var(--bad) !important; }
tr.grp td { background: var(--surface-2); font-weight: 600; }
tr.sum td { font-weight: 700; border-top: 2px solid var(--line); }
.selbar.selbar2 { display: grid; grid-template-columns: auto 1fr; gap: 8px 10px; }
.selbar.selbar2 .btn { padding: 10px 12px; }
.selbar.selbar2 #btnTugas { grid-column: 1; }
.selbar.selbar2 #btnBatalTugas { grid-column: 2; }
.selbar .btn:disabled { opacity: .5; }
