:root {
  --brand: #163C8D;
  --brand-dark: #0F2C6B;
  --bg: #F2F5FB;
  --card: #FFFFFF;
  --text: #1A2340;
  --muted: #6B7590;
  --line: #E2E7F1;
  --hot: #E8552B;
  --hot-soft: #FDEBE4;
  --cold: #3B8FD9;
  --cold-soft: #E4F0FB;
  --ok: #1E8E5A;
  --err: #C62828;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); font-size: 16px; }
[hidden] { display: none !important; }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px;
  background: radial-gradient(circle at 50% 20%, #24509F, var(--brand) 55%, var(--brand-dark)); }
.login-box { width: 100%; max-width: 340px; text-align: center; color: #fff; }
.login-logo { width: 150px; height: auto; margin-bottom: 8px; }
.login h1 { font-size: 18px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; opacity: .9; margin: 8px 0 20px; }
.login input { width: 100%; padding: 14px; border-radius: 10px; border: 0; font-size: 18px; text-align: center; letter-spacing: .2em; margin-bottom: 10px; }
.login .btn.primary { width: 100%; background: #fff; color: var(--brand); }
.login .err { color: #FFD2C7; min-height: 1.2em; }
.tag { margin-top: 28px; font-weight: 800; font-style: italic; opacity: .85; }

/* header */
.top { background: var(--brand); color: #fff; display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; position: sticky; top: 0; z-index: 5; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand img { height: 34px; }
.brand b { display: block; font-size: 17px; }
.brand small { opacity: .8; font-size: 12px; }
.link-btn { background: none; border: 1px solid rgba(255,255,255,.4); color: #fff; border-radius: 8px; padding: 6px 12px; font-size: 14px; cursor: pointer; }
.tabs { display: flex; background: var(--brand); padding: 0 12px; gap: 4px; }
.tab { flex: 1; background: none; border: 0; color: rgba(255,255,255,.7); padding: 12px 8px; font-size: 15px; font-weight: 600; border-bottom: 3px solid transparent; cursor: pointer; }
.tab.active { color: #fff; border-color: #fff; }

main { max-width: 760px; margin: 0 auto; padding: 16px; }
.card { background: var(--card); border-radius: 14px; padding: 16px; margin-bottom: 14px; box-shadow: 0 1px 3px rgba(20,40,90,.06); }
h2 { font-size: 16px; margin: 0 0 12px; }

/* form */
label, .field { display: block; font-size: 14px; font-weight: 600; color: var(--muted); margin-bottom: 14px; }
label em { font-weight: 400; }
input, textarea { display: block; width: 100%; margin-top: 6px; padding: 12px; font: inherit; color: var(--text); border: 1px solid var(--line); border-radius: 10px; background: #fff; }
input:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: -1px; }
.jenis { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 6px; }
.opt { margin: 0; cursor: pointer; }
.opt input { position: absolute; opacity: 0; width: 0; height: 0; }
.opt span { display: block; text-align: center; padding: 14px; border-radius: 10px; border: 2px solid var(--line); font-size: 17px; color: var(--text); }
.opt.hot input:checked + span { border-color: var(--hot); background: var(--hot-soft); color: var(--hot); }
.opt.cold input:checked + span { border-color: var(--cold); background: var(--cold-soft); color: var(--cold); }
.opt input:focus-visible + span { outline: 2px solid var(--brand); }
.btn { border: 0; border-radius: 10px; padding: 14px 18px; font-size: 16px; font-weight: 700; cursor: pointer; }
.btn.primary { background: var(--brand); color: #fff; width: 100%; }
.btn.primary:disabled { opacity: .6; }
.btn.small { padding: 8px 12px; font-size: 13px; background: var(--bg); color: var(--brand); }
.msg { min-height: 1.2em; margin: 10px 0 0; text-align: center; font-weight: 600; }
.msg.ok { color: var(--ok); } .msg.bad { color: var(--err); }

/* list */
.row-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; }
.row-head h2 { margin: 0; }
.pills { display: flex; gap: 6px; }
.pill { font-size: 13px; font-weight: 700; padding: 4px 10px; border-radius: 99px; }
.pill.hot { background: var(--hot-soft); color: var(--hot); }
.pill.cold { background: var(--cold-soft); color: var(--cold); }
.pill.hot::before { content: "🔥 "; } .pill.cold::before { content: "❄️ "; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; justify-content: space-between; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.list li:first-child { border-top: 0; }
.list .who { font-weight: 600; }
.list small { display: block; color: var(--muted); font-size: 13px; }
.empty { color: var(--muted); text-align: center; padding: 12px 0; }
.badge { font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 6px; white-space: nowrap; align-self: center; }
.badge.hot { background: var(--hot-soft); color: var(--hot); }
.badge.cold { background: var(--cold-soft); color: var(--cold); }

/* rekap */
.presets { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 99px; padding: 7px 14px; font-size: 14px; cursor: pointer; color: var(--text); }
.chip.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.range { display: flex; align-items: center; gap: 8px; }
.range input { margin: 0; min-width: 0; padding: 10px 8px; font-size: 15px; }
.range span { color: var(--muted); font-size: 14px; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 14px; }
.kpi { background: var(--card); border-radius: 14px; padding: 14px; box-shadow: 0 1px 3px rgba(20,40,90,.06); }
.kpi small { color: var(--muted); font-size: 13px; font-weight: 600; }
.kpi b { display: block; font-size: 28px; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi.hot b { color: var(--hot); } .kpi.cold b { color: var(--cold); }
@media (max-width: 520px) { .kpis { grid-template-columns: repeat(2, 1fr); } }

.legend { display: flex; gap: 14px; font-size: 13px; color: var(--muted); margin: -4px 0 10px; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.dot.hot { background: var(--hot); } .dot.cold { background: var(--cold); }
.chart { display: flex; align-items: flex-end; gap: 4px; height: 180px; overflow-x: auto; padding-bottom: 22px; position: relative; }
.bar { flex: 1 1 0; min-width: 7px; max-width: 42px; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; position: relative; }
.bar .seg { width: 100%; }
.bar .seg.hot { background: var(--hot); border-radius: 4px 4px 0 0; }
.bar .seg.cold { background: var(--cold); }
.bar .seg.cold:first-child { border-radius: 4px 4px 0 0; }
.bar .n { font-size: 11px; text-align: center; color: var(--text); font-weight: 600; margin-bottom: 2px; }
.bar .d { position: absolute; bottom: -20px; left: 0; right: 0; text-align: center; font-size: 10px; color: var(--muted); }

.tbl-wrap { overflow-x: auto; margin: 0 -16px; padding: 0 16px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; padding: 8px 6px; border-bottom: 1px solid var(--line); }
.tbl td { padding: 9px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl tfoot td { font-weight: 700; border-bottom: 0; }
.tbl .note { color: var(--muted); max-width: 220px; }
.del { background: none; border: 0; color: var(--err); cursor: pointer; font-size: 13px; }
.foot { text-align: center; color: var(--muted); font-weight: 800; font-style: italic; padding: 10px 0 28px; font-size: 14px; }
