:root {
  --bg: #f4f6f5; --card: #ffffff; --ink: #14201d; --muted: #5f6f6b; --line: #dde4e1;
  --brand: #0f766e; --brand-ink: #ffffff; --brand-soft: #e2f3f0;
  --good: #15803d; --good-soft: #dcfce7; --mid: #b45309; --mid-soft: #fef3c7; --bad: #b91c1c; --bad-soft: #fee2e2;
  --info-soft: #e0ecff; --info: #1d4ed8;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1514; --card: #172120; --ink: #e5eeeb; --muted: #94a5a0; --line: #2a3735;
    --brand: #2dd4bf; --brand-ink: #062a26; --brand-soft: #123a35;
    --good: #4ade80; --good-soft: #12321f; --mid: #fbbf24; --mid-soft: #3a2c0b; --bad: #f87171; --bad-soft: #3d1414;
    --info-soft: #172a4d; --info: #93b4ff;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
.hidden { display: none !important; }
.muted { color: var(--muted); } .small { font-size: 13px; }
.err { color: var(--bad); min-height: 1.2em; margin: 8px 0 0; }
a { color: var(--brand); }
input, select, textarea, button { font: inherit; color: inherit; }
input, select, textarea { width: 100%; background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; }
textarea { resize: vertical; min-height: 90px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: -1px; }
label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin: 0 0 12px; }
label > input, label > select, label > textarea { margin-top: 4px; font-weight: 400; color: var(--ink); }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; color: var(--ink); font-size: 14px; }
.check input { width: auto; margin-top: 4px; }
.btn { border: 1px solid var(--line); background: var(--card); border-radius: 8px; padding: 8px 14px; cursor: pointer; font-weight: 600; white-space: nowrap; }
.btn:hover { border-color: var(--brand); }
.btn.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.btn.danger { color: var(--bad); }
.btn:disabled { opacity: .55; cursor: wait; }
.btn.sm { padding: 5px 10px; font-size: 13px; }
.iconbtn { background: none; border: 0; font-size: 22px; cursor: pointer; padding: 4px 8px; display: none; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.brand { font-weight: 800; display: flex; align-items: center; gap: 8px; }
.brand.big { font-size: 24px; }
.logo { background: var(--brand); color: var(--brand-ink); width: 30px; height: 30px; border-radius: 8px; display: inline-grid; place-items: center; font-size: 16px; }

.auth { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.authCard { width: 100%; max-width: 380px; }

.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: var(--card); border-bottom: 1px solid var(--line); }
.top select { width: auto; max-width: 260px; }
.spacer { flex: 1; }
.nav { position: fixed; top: 55px; left: 0; bottom: 0; width: 220px; padding: 12px; border-right: 1px solid var(--line); background: var(--card); overflow: auto; }
.nav a { display: block; padding: 9px 12px; border-radius: 8px; color: var(--ink); text-decoration: none; margin-bottom: 2px; }
.nav a.on, .nav a:hover { background: var(--brand-soft); }
main { margin-left: 220px; padding: 20px; max-width: 1180px; }
h1 { font-size: 22px; margin: 0 0 4px; } h2 { font-size: 17px; margin: 0 0 10px; }
.head { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.head .spacer { min-width: 10px; }

.grid { display: grid; gap: 12px; }
.kpis { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); margin-bottom: 16px; }
.kpi .v { font-size: 28px; font-weight: 800; } .kpi .l { color: var(--muted); font-size: 13px; }
.two { grid-template-columns: 1fr 1fr; }
.bar { display: flex; align-items: center; gap: 8px; margin: 6px 0; font-size: 14px; }
.bar .lbl { width: 130px; flex: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar .track { flex: 1; height: 10px; background: var(--line); border-radius: 6px; overflow: hidden; }
.bar .fill { height: 100%; background: var(--brand); border-radius: 6px; }
.bar .num { width: 70px; text-align: right; color: var(--muted); }

.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.filters > * { width: auto; }
.filters input { min-width: 200px; flex: 1; }

.rv { margin-bottom: 14px; }
.rvTop { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.rvTop .guest { font-weight: 700; }
.chip { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 99px; background: var(--line); color: var(--ink); }
.chip.src { background: var(--info-soft); color: var(--info); }
.chip.good { background: var(--good-soft); color: var(--good); }
.chip.mid { background: var(--mid-soft); color: var(--mid); }
.chip.bad { background: var(--bad-soft); color: var(--bad); }
.chip.st-siap { background: var(--brand-soft); color: var(--brand); }
.chip.st-terkirim { background: var(--good-soft); color: var(--good); }
.chip.st-gagal, .chip.st-perlu_cek { background: var(--bad-soft); color: var(--bad); }
.chip.st-baru, .chip.st-proses { background: var(--mid-soft); color: var(--mid); }
.rvBody { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.quote { background: var(--bg); border-radius: 8px; padding: 10px 12px; font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.quote b { display: block; font-size: 12px; color: var(--muted); }
.pos { border-left: 3px solid var(--good); } .neg { border-left: 3px solid var(--bad); }
.tags { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0; }
.warn { background: var(--mid-soft); color: var(--mid); border-radius: 8px; padding: 6px 10px; font-size: 13px; margin: 6px 0; }
.alarm { background: var(--bad-soft); color: var(--bad); border-radius: 8px; padding: 6px 10px; font-size: 13px; margin: 6px 0; }
.reply textarea { min-height: 190px; font-size: 14px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.pager { display: flex; gap: 8px; align-items: center; justify-content: center; margin: 16px 0; }

.extract .item { border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin-bottom: 10px; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.code { font-family: ui-monospace, Menlo, monospace; background: var(--bg); padding: 2px 6px; border-radius: 6px; overflow-wrap: anywhere; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tblwrap { overflow-x: auto; }
.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%) translateY(120px); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; transition: transform .25s; z-index: 20; max-width: calc(100% - 32px); }
.toast.show { transform: translateX(-50%) translateY(0); }
.empty { text-align: center; padding: 40px 16px; color: var(--muted); }
.section { margin-bottom: 16px; }

@media (max-width: 860px) {
  .iconbtn { display: block; }
  .nav { transform: translateX(-100%); transition: transform .2s; z-index: 6; width: 240px; }
  .nav.open { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.25); }
  main { margin-left: 0; padding: 16px; }
  .rvBody, .two { grid-template-columns: 1fr; }
  #who { display: none; }
  .top select { max-width: 150px; }
}
