:root {
  --bg: #f6f8fa;
  --surface: #ffffff;
  --border: #e3e8ee;
  --text: #1a1f36;
  --muted: #697386;
  --accent: #635bff;
  --accent-hover: #5851df;
  --green-bg: #d7f7c2; --green-fg: #217005;
  --blue-bg: #d7e9ff;  --blue-fg: #1a4fa3;
  --gray-bg: #eef1f4;  --gray-fg: #545a69;
  --red-bg: #ffe3e0;   --red-fg: #b3261e;
  --amber-bg: #fcedb9; --amber-fg: #8a6116;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(26, 31, 54, .06), 0 1px 6px rgba(26, 31, 54, .04);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font: 14px/1.5 -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
h1 { font-size: 20px; margin: 0; }
h2 { font-size: 16px; margin: 0 0 12px; }

/* ---------- login ---------- */
.login { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: var(--bg); z-index: 50; }
.login-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); padding: 40px; width: 360px; text-align: center; }
.login-card h1 { margin: 14px 0 4px; }
.login-card input { width: 100%; margin: 18px 0 10px; }
.login-card .btn { width: 100%; }
.err { color: var(--red-fg); font-size: 13px; }

/* ---------- shell ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 224px; flex-shrink: 0; background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 15px; padding: 18px 16px 14px; }
.logo-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 7px; background: var(--accent);
  color: #fff; font-weight: 700; font-size: 15px;
}
.sidebar nav { display: flex; flex-direction: column; gap: 2px; padding: 8px; }
.sidebar nav a {
  padding: 7px 10px; border-radius: 6px; text-decoration: none;
  color: var(--text); font-weight: 500;
}
.sidebar nav a:hover { background: var(--bg); }
.sidebar nav a.active { color: var(--accent); background: #f0efff; }
.sidebar-foot { margin-top: auto; padding: 14px 16px; }
.env-pill { font-size: 12px; color: var(--muted); background: var(--bg); border: 1px solid var(--border); border-radius: 20px; padding: 3px 10px; }

.main { flex: 1; padding: 28px 36px 60px; max-width: 1160px; }
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; gap: 12px; flex-wrap: wrap; }
.page-head .actions { display: flex; gap: 8px; }

/* ---------- komponen ---------- */
.btn {
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  border-radius: 6px; padding: 7px 13px; font-size: 13.5px; font-weight: 600;
  cursor: pointer; box-shadow: 0 1px 1px rgba(26,31,54,.04);
}
.btn:hover { background: var(--bg); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-hover); }
.btn.sm { padding: 4px 10px; font-size: 12.5px; }

input, select {
  border: 1px solid var(--border); border-radius: 6px; padding: 7px 10px;
  font-size: 13.5px; color: var(--text); background: var(--surface); outline: none;
}
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(99, 91, 255, .15); }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px;
}
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat .label { font-size: 12.5px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.stat .value { font-size: 24px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th {
  text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); font-weight: 600; padding: 8px 12px; border-bottom: 1px solid var(--border);
}
td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: #fafbfc; }
.amount { font-weight: 600; font-variant-numeric: tabular-nums; }
.mono { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 12.5px; }

.badge {
  display: inline-block; padding: 2px 8px; border-radius: 20px;
  font-size: 12px; font-weight: 600;
}
.badge.paid      { background: var(--green-bg); color: var(--green-fg); }
.badge.pending   { background: var(--blue-bg);  color: var(--blue-fg); }
.badge.expired   { background: var(--gray-bg);  color: var(--gray-fg); }
.badge.failed    { background: var(--red-bg);   color: var(--red-fg); }
.badge.refunded  { background: var(--amber-bg); color: var(--amber-fg); }
.badge.test      { background: var(--amber-bg); color: var(--amber-fg); }
.badge.live      { background: var(--green-bg); color: var(--green-fg); }

.filters { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.empty { text-align: center; color: var(--muted); padding: 40px 0; }

/* ---------- drawer detail ---------- */
.drawer { position: fixed; inset: 0; z-index: 40; }
.drawer-backdrop { position: absolute; inset: 0; background: rgba(26, 31, 54, .35); }
.drawer-panel {
  position: absolute; top: 0; right: 0; bottom: 0; width: 460px; max-width: 92vw;
  background: var(--surface); box-shadow: -8px 0 28px rgba(26,31,54,.18);
  overflow-y: auto; padding: 26px 28px;
}
.drawer .amount-big { font-size: 26px; font-weight: 700; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 6px 12px; font-size: 13.5px; margin: 16px 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-all; }
.timeline { border-left: 2px solid var(--border); margin: 10px 0 0 6px; padding-left: 16px; }
.timeline .ev { position: relative; padding-bottom: 14px; }
.timeline .ev::before {
  content: ""; position: absolute; left: -21px; top: 5px;
  width: 8px; height: 8px; border-radius: 50%; background: var(--accent);
}
.timeline .ev .t { font-size: 12px; color: var(--muted); }
.qr-box { background: var(--bg); border: 1px dashed var(--border); border-radius: 8px; padding: 10px 12px; margin: 10px 0; }

.modal-key {
  background: #1a1f36; color: #d7f7c2; border-radius: 8px; padding: 12px 14px;
  word-break: break-all; margin: 10px 0;
}
.section-gap { margin-top: 26px; }
