:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --border: #e2e5ea;
  --text: #1c2230;
  --muted: #6b7280;
  --accent: #2563eb;
  --positif: #16803c;
  --negatif: #c0362c;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 -apple-system, "Segoe UI", Roboto, sans-serif;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
  padding: 0.75rem 1.5rem;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}

.brand { font-weight: 700; }
.badge {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--positif);
  background: #e6f4ea;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  vertical-align: middle;
  margin-left: 0.3rem;
}

.topbar nav { display: flex; gap: 1rem; flex-wrap: wrap; flex: 1; }
.topbar nav a { color: var(--text); text-decoration: none; }
.topbar nav a:hover { color: var(--accent); }
.userbox { color: var(--muted); font-size: 0.9rem; }
.userbox a { color: var(--muted); }

.content { max-width: 980px; margin: 0 auto; padding: 1.5rem; }

h1 { font-size: 1.4rem; margin-bottom: 0.5rem; }
h2 { font-size: 1.1rem; margin-top: 2rem; }
.muted { color: var(--muted); }
.error { color: var(--negatif); font-weight: 600; }
.positif { color: var(--positif); }
.negatif { color: var(--negatif); }

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem;
}
.card-label { color: var(--muted); font-size: 0.85rem; }
.card-value { font-size: 1.5rem; font-weight: 700; margin: 0.25rem 0 0.5rem; }
.card a { font-size: 0.85rem; color: var(--accent); text-decoration: none; }

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem;
  margin: 1rem 0;
}

.tbl {
  width: 100%;
  border-collapse: collapse;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}
.tbl th, .tbl td { padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--border); text-align: left; }
.tbl thead th { background: #f0f2f5; font-weight: 600; font-size: 0.85rem; }
.tbl tfoot th { background: #f0f2f5; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl tbody tr:last-child td { border-bottom: none; }

/* Tabel bisa lebar (banyak kolom mutasi) -- scroll horizontal di kontainernya,
   bukan meluber ke luar halaman. */
table.tbl { display: block; overflow-x: auto; white-space: nowrap; }
table.tbl thead, table.tbl tbody, table.tbl tfoot { display: table; width: 100%; }

.filter-form {
  display: flex;
  align-items: end;
  gap: 1rem;
  flex-wrap: wrap;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem;
  margin-bottom: 1.5rem;
}
.filter-form label { display: flex; flex-direction: column; font-size: 0.8rem; color: var(--muted); gap: 0.25rem; }
.filter-form input, .filter-form select {
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.95rem;
}

.preset-links { display: flex; gap: 0.5rem; margin-bottom: 0.75rem; flex-wrap: wrap; }
.chip {
  font-size: 0.8rem;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  background: #eef2ff;
  color: var(--accent);
  text-decoration: none;
}
.chip:hover { background: #dbe4ff; }

button, .btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 0.5rem 1rem;
  font-size: 0.95rem;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
button:hover, .btn:hover { background: #1d4ed8; }

.footer { text-align: center; color: var(--muted); font-size: 0.8rem; padding: 2rem 1rem; }

.login-box {
  max-width: 320px;
  margin: 4rem auto;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem;
  text-align: center;
}
.login-box form { display: flex; flex-direction: column; gap: 0.75rem; margin-top: 1rem; }
.login-box input {
  padding: 0.6rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 1.1rem;
  text-align: center;
  letter-spacing: 0.2em;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14181f;
    --panel: #1c222c;
    --border: #2b323e;
    --text: #e6e9ef;
    --muted: #93a0b4;
    --accent: #5b8def;
    --positif: #3ecf7a;
    --negatif: #ff6b60;
  }
  .tbl thead th, .tbl tfoot th { background: #232a36; }
  .badge { background: #163527; }
  .chip { background: #202a44; }
  .chip:hover { background: #28345a; }
}
