:root {
  --bg: #0d0f14;
  --bg2: #12151c;
  --card: #161a23;
  --card2: #1c2130;
  --line: #262c3b;
  --text: #e6e8ee;
  --mut: #8b93a7;
  --pri: #6366f1;
  --pri2: #818cf8;
  --ok: #22c55e;
  --bad: #ef4444;
  --warn: #f59e0b;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; color: var(--text); font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: radial-gradient(1200px 600px at 10% -10%, rgba(99, 102, 241, .14), transparent 60%),
              radial-gradient(900px 500px at 110% 0%, rgba(34, 197, 94, .07), transparent 60%), var(--bg);
  background-attachment: fixed;
}
h1, h2 { margin: 0 0 12px; font-weight: 650; letter-spacing: -.01em; }
h2 { font-size: 16px; }
p { margin: 8px 0; }
code { font: 13px ui-monospace, SFMono-Regular, Consolas, monospace; color: #c7d2fe; }
a { color: var(--pri2); }
.mut { color: var(--mut); font-size: 13px; }
.hide { display: none !important; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ---------- layout ---------- */
.wrap { max-width: 1000px; margin: 0 auto; padding: 20px 16px 48px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.wrap.wide, .nav-in.wide { max-width: 1320px; }
.nav { position: sticky; top: 0; z-index: 10; background: rgba(13, 15, 20, .75); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.nav-in { max-width: 1000px; margin: 0 auto; padding: 12px 16px; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.nav-act { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; font-size: 15px; }
.brand-lg { margin-bottom: 20px; font-size: 17px; }
.brand-lg div { display: grid; }
.logo { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-weight: 800; font-size: 13px; color: #fff;
  background: linear-gradient(135deg, var(--pri), #22c55e); box-shadow: 0 4px 14px rgba(99, 102, 241, .4); }

.card { background: linear-gradient(180deg, var(--card2), var(--card)); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); min-width: 0; }
.card { scroll-margin-top: 80px; }   /* scrollIntoView tidak tertutup navbar sticky */
.card.flush { padding: 0; overflow: hidden; }
.card.accent { border-color: rgba(99, 102, 241, .5); }
.head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.head h2 { margin: 0; }
.chip { display: inline-block; padding: 4px 10px; border-radius: 999px; background: var(--bg2); border: 1px solid var(--line); color: var(--mut); font-size: 12px; }
.chip:empty { display: none; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; }
.toolbar .search { flex: 1; min-width: 220px; }

/* ---------- auth ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.auth-card { width: 100%; max-width: 400px; padding: 28px; }
.tabs { display: flex; gap: 4px; padding: 4px; background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; }
.tabs button { flex: 1; background: transparent; color: var(--mut); box-shadow: none; }
.tabs button.on { background: var(--pri); color: #fff; }

/* ---------- form ---------- */
label { display: block; margin: 12px 0 6px; font-weight: 600; font-size: 13px; }
input, select { width: 100%; padding: 10px 12px; background: var(--bg2); color: var(--text); border: 1px solid var(--line); border-radius: 8px; font: inherit; transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus { outline: none; border-color: var(--pri); box-shadow: 0 0 0 3px rgba(99, 102, 241, .25); }
button { padding: 9px 16px; border: 0; border-radius: 8px; cursor: pointer; background: var(--pri); color: #fff; font: 600 14px/1.2 inherit; font-family: inherit; transition: filter .15s, transform .05s; white-space: nowrap; }
button:hover:not(:disabled) { filter: brightness(1.12); }
button:active:not(:disabled) { transform: translateY(1px); }
button:disabled { opacity: .45; cursor: default; }
button:focus-visible { outline: 2px solid var(--pri2); outline-offset: 2px; }
button.block { width: 100%; margin-top: 8px; padding: 11px; }
.sm { padding: 6px 11px; font-size: 12px; background: #2a3042; }
.ghost { background: transparent; border: 1px solid var(--line); color: var(--text); }
.green { background: var(--ok); color: #052e14; }
.red { background: var(--bad); }

/* ---------- table ---------- */
.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { position: sticky; top: 0; background: var(--bg2); color: var(--mut); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
th[onclick] { cursor: pointer; user-select: none; }
th[onclick]:hover { color: var(--text); }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); font-size: 13px; white-space: nowrap; vertical-align: top; }
tbody tr:hover td, table tr:hover td { background: rgba(255, 255, 255, .02); }
tr.grp td { background: rgba(99, 102, 241, .08) !important; border-top: 1px solid rgba(99, 102, 241, .45); padding: 12px; white-space: normal; }
td.act { display: flex; gap: 6px; flex-wrap: wrap; }
.det td { white-space: normal; padding: 8px 10px; }
.det td:first-child { width: 140px; color: var(--mut); }

/* ---------- status ---------- */
.st { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; border: 1px solid transparent; }
.Active, .Paid { background: rgba(34, 197, 94, .12); color: #4ade80; border-color: rgba(34, 197, 94, .3); }
.Expired, .Failed, .Cancelled { background: rgba(239, 68, 68, .12); color: #f87171; border-color: rgba(239, 68, 68, .3); }
.Inactive, .Pending { background: rgba(245, 158, 11, .12); color: #fbbf24; border-color: rgba(245, 158, 11, .3); }

/* ---------- download ---------- */
.dl { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; border-color: rgba(34, 197, 94, .35); }
.dl h2 { margin: 0 0 2px; }
.dl p { margin: 0; }
.dl-ico { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; font-size: 20px; background: rgba(34, 197, 94, .14); color: #4ade80; }
.pass { margin-top: 8px; font-size: 13px; }
.pass code { font-size: 15px; color: #fbbf24; background: var(--bg2); padding: 2px 8px; border-radius: 6px; border: 1px solid var(--line); }

/* ---------- toast ---------- */
#msg { position: fixed; right: 16px; bottom: 16px; max-width: min(360px, calc(100vw - 32px)); padding: 12px 16px; border-radius: 10px; display: none; box-shadow: var(--shadow); z-index: 20; }
#msg.ok { background: #14532d; border: 1px solid #22c55e; display: block; }
#msg.err { background: #7f1d1d; border: 1px solid #ef4444; display: block; }

@media (max-width: 600px) {
  .card { padding: 14px; }
  .nav-act .chip { display: none; }
}
