:root {
  --bg: #0f1420;
  --bg-2: #151c2c;
  --bg-3: #1c2537;
  --line: #263149;
  --text: #e6ecf7;
  --muted: #8fa0be;
  --brand: #3b82f6;
  --brand-2: #6366f1;
  --ok: #22c55e;
  --warn: #f59e0b;
  --bad: #ef4444;
  --info: #06b6d4;
  --radius: 12px;
  --shadow: 0 6px 24px rgba(0, 0, 0, .28);
}

html[data-theme="light"] {
  --bg: #f2f5fa;
  --bg-2: #ffffff;
  --bg-3: #f7f9fc;
  --line: #dde4ef;
  --text: #16203a;
  --muted: #64748b;
  --shadow: 0 6px 20px rgba(16, 32, 64, .08);
}

* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--brand); text-decoration: none; }
h1, h2, h3 { margin: 0 0 .6rem; font-weight: 650; }
h1 { font-size: 1.35rem; }
h2 { font-size: 1.1rem; }

/* ── Tata letak ─────────────────────────────────────────────── */
.layout { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.sidebar {
  background: var(--bg-2); border-right: 1px solid var(--line);
  padding: 14px 10px; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 10px 16px; font-weight: 700; font-size: 1.05rem; }
.brand .logo {
  width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; font-size: 15px;
}
.nav-section { color: var(--muted); font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; margin: 14px 12px 6px; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 9px;
  color: var(--text); font-size: 13.5px; margin-bottom: 2px;
}
.nav a:hover { background: var(--bg-3); }
.nav a.active { background: linear-gradient(90deg, rgba(59,130,246,.2), transparent); color: var(--brand); font-weight: 600; }
.nav a .ic { width: 20px; flex: 0 0 20px; text-align: center; overflow: hidden; white-space: nowrap; line-height: 1; }

.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  display: flex; align-items: center; gap: 12px; padding: 10px 18px;
  background: var(--bg-2); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20;
}
.topbar .spacer { flex: 1; }
.content { padding: 18px; flex: 1; }
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.page-head .spacer { flex: 1; }

/* ── Komponen ───────────────────────────────────────────────── */
.card { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.grid { display: grid; gap: 14px; }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }

.stat { display: flex; flex-direction: column; gap: 4px; }
.stat .label { color: var(--muted); font-size: 12px; }
.stat .value { font-size: 1.5rem; font-weight: 700; }
.stat .sub { font-size: 11.5px; color: var(--muted); }
.stat.accent { background: linear-gradient(135deg, rgba(59,130,246,.16), rgba(99,102,241,.06)); }

.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 9px;
  border: 1px solid var(--line); background: var(--bg-3); color: var(--text); cursor: pointer; font-size: 13px;
}
.btn:hover { border-color: var(--brand); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.sm { padding: 5px 9px; font-size: 12px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

input, select, textarea {
  width: 100%; padding: 8px 11px; border-radius: 9px; border: 1px solid var(--line);
  background: var(--bg-3); color: var(--text); font-size: 13px; font-family: inherit;
}
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(59,130,246,.4); border-color: var(--brand); }
label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.field { margin-bottom: 12px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 9px 10px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; }
tbody tr:hover { background: var(--bg-3); }
.table-wrap { overflow-x: auto; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.badge.ok { background: rgba(34,197,94,.16); color: var(--ok); }
.badge.warn { background: rgba(245,158,11,.16); color: var(--warn); }
.badge.bad { background: rgba(239,68,68,.16); color: var(--bad); }
.badge.info { background: rgba(6,182,212,.16); color: var(--info); }
.badge.mut { background: var(--bg-3); color: var(--muted); }

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(3, 7, 18, .6); display: grid; place-items: center; z-index: 100; padding: 16px;
}
.modal { background: var(--bg-2); border: 1px solid var(--line); border-radius: 14px; width: min(720px, 100%); max-height: 88vh; overflow: auto; }
.modal header { padding: 14px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; }
.modal .body { padding: 18px; }
.modal footer { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; }

.toast-wrap { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 200; }
.toast { padding: 11px 15px; border-radius: 10px; background: var(--bg-2); border-left: 3px solid var(--brand); box-shadow: var(--shadow); max-width: 380px; }
.toast.ok { border-left-color: var(--ok); }
.toast.bad { border-left-color: var(--bad); }

.pager { display: flex; align-items: center; gap: 8px; justify-content: flex-end; padding-top: 12px; color: var(--muted); font-size: 12.5px; }
.muted { color: var(--muted); }
.right { text-align: right; }
.mono { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 12px; }
.chip { padding: 3px 8px; border-radius: 8px; background: var(--bg-3); font-size: 11.5px; border: 1px solid var(--line); }
.hidden { display: none !important; }
#map { height: 70vh; border-radius: var(--radius); }
.bar { height: 8px; background: var(--bg-3); border-radius: 6px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: linear-gradient(90deg, var(--brand), var(--brand-2)); }
.spark { display: flex; align-items: flex-end; gap: 3px; height: 60px; }
.spark div { flex: 1; background: linear-gradient(180deg, var(--brand), rgba(59,130,246,.25)); border-radius: 3px 3px 0 0; min-height: 2px; }

/* ── Login ──────────────────────────────────────────────────── */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px;
  background: radial-gradient(900px 500px at 20% -10%, rgba(59,130,246,.22), transparent), var(--bg); }
.login-card { width: min(400px, 100%); }

/* Halaman masuk berbagi ruang dengan keterangan layanan: pengunjung yang belum
   punya akun — termasuk pemeriksa penyedia pembayaran — tetap bisa tahu
   aplikasi ini milik siapa dan menjual apa. */
.login-2kolom { grid-template-columns: minmax(0, 460px) minmax(0, 400px); gap: 22px; align-items: start; }
.login-info { width: 100%; }
.login-info h3 { text-transform: uppercase; color: var(--muted); }
@media (max-width: 880px) {
  .login-2kolom { grid-template-columns: minmax(0, 420px); }
  .login-info { order: 2; }
}

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; z-index: 50; width: 250px; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: none; }
  .grid.cols-4, .grid.cols-3, .grid.cols-2 { grid-template-columns: 1fr; }
  .row { grid-template-columns: 1fr; }
}
@media (min-width: 901px) { #menu-toggle { display: none; } }

/* Logo J-Tech (30 Sep 2026): putih di tema gelap, hitam di tema terang */
.brand .brand-img { height: 38px; width: auto; display: block; }
.brand .brand-sub { font-size: .78rem; font-weight: 600; opacity: .75; line-height: 1.2; }
:root:not([data-theme="light"]) .brand .logo-hitam { display: none; }
[data-theme="light"] .brand .logo-putih { display: none; }

/* Tampilan HP (14 Okt 2026): tabel data jadi kartu per baris — label di kiri, isi di kanan. */
@media (max-width: 700px) {
  .main, main { padding-left: 10px !important; padding-right: 10px !important; }
  .page-head { gap: 8px; }
  .page-head h1 { font-size: 1.25rem; width: 100%; margin: 0; }
  .page-head .spacer { display: none; }
  .page-head input, .page-head select { max-width: none !important; flex: 1 1 140px; min-width: 0; }
  .page-head .btn { font-size: 12px; padding: 6px 9px; }
  .dt-kartu thead { display: none; }
  .dt-kartu, .dt-kartu tbody { display: block; width: 100%; }
  .dt-kartu tr { display: block; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 10px; padding: 6px 12px; }
  .dt-kartu td { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; white-space: normal; border: 0; padding: 5px 0; text-align: right; }
  .dt-kartu td::before { content: attr(data-label); color: var(--muted); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; text-align: left; flex: 0 0 34%; }
  .dt-kartu td[data-label=""]::before { display: none; }
  .dt-kartu td[data-label=""] { justify-content: flex-start; }
  .dt-kartu td:empty { display: none; }
  .dt-kartu td.num { text-align: right; }
  .dt-kartu td.aksi { flex-wrap: wrap; gap: 6px; border-top: 1px dashed var(--line); margin-top: 4px; padding-top: 8px; }
  .dt-kartu td.aksi:empty { display: none; }
  .dt-kartu td > div { text-align: right; }
  .table-wrap { overflow-x: visible; }
  .pager { flex-wrap: wrap; justify-content: center; }
}
