:root {
  --bg: #0f1115;
  --bg2: #161920;
  --card: #1b1f27;
  --line: #2a2f3a;
  --text: #e7e9ee;
  --muted: #8a91a1;
  --accent: #7c9cff;
  --accent-ink: #0f1115;
  --ok: #47c98a;
  --warn: #e8b04a;
  --bad: #ef6464;
  --discord: #5865f2;
  --radius: 10px;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: var(--mono); font-size: .88em; background: var(--bg2); border: 1px solid var(--line); padding: 1px 6px; border-radius: 6px; }
h1 { font-size: 1.6rem; margin: 0 0 .25rem; letter-spacing: -.01em; display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
h1 code { font-size: .8em; }
h2 { font-size: 1.02rem; margin: 0 0 .9rem; }
p { margin: .4rem 0 .9rem; }
.muted { color: var(--muted); }
.sm { font-size: .84rem; }
.nowrap { white-space: nowrap; }

/* Top bar */
.topbar { display: flex; align-items: center; gap: 1.5rem; padding: .8rem 1.5rem; border-bottom: 1px solid var(--line); background: var(--bg2); flex-wrap: wrap; }
.brand { font-weight: 700; color: var(--text); letter-spacing: -.01em; }
.brand:hover { text-decoration: none; }
.brand-mark { color: var(--accent); }
.brand-by { color: var(--muted); font-weight: 500; font-size: .8rem; margin-left: .55rem; }
@media (max-width: 600px) { .brand-by { display: none; } }
.foot { text-align: center; color: var(--muted); font-size: .8rem; padding: 2rem 1rem 2.5rem; border-top: 1px solid var(--line); }
.eyebrow { text-transform: uppercase; letter-spacing: .14em; font-size: .78rem !important; color: var(--accent) !important; margin-bottom: .6rem !important; font-weight: 700; }
.nav { display: flex; gap: .3rem; }
.nav a, .subnav a { color: var(--muted); padding: .35rem .7rem; border-radius: 8px; }
.nav a:hover, .subnav a:hover { color: var(--text); background: var(--card); text-decoration: none; }
.nav a.on, .subnav a.on { color: var(--text); background: var(--card); }
.me { margin-left: auto; display: flex; align-items: center; gap: .6rem; }
.me form { margin: 0; }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--card); }
.subnav { display: flex; gap: .2rem; padding: .5rem 1.5rem; border-bottom: 1px solid var(--line); overflow-x: auto; }
.subnav a { white-space: nowrap; font-size: .92rem; }

.wrap { max-width: 1180px; margin: 0 auto; padding: 1.75rem 1.5rem 4rem; }
.page-head { margin-bottom: 1.4rem; }
.back { display: inline-block; font-size: .88rem; margin-bottom: .4rem; color: var(--muted); }

/* Layout */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; margin-bottom: 1.2rem; }
.grid2.wide-left { grid-template-columns: 1.7fr 1fr; align-items: start; }
@media (max-width: 860px) { .grid2, .grid2.wide-left { grid-template-columns: 1fr; } }

.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem 1.3rem; margin-bottom: 1.2rem; min-width: 0; }
.grid2 > .panel { margin-bottom: 0; }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; }
.danger-zone { border-color: color-mix(in srgb, var(--bad) 35%, var(--line)); }

/* Cards (customer panel) */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1.1rem; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem 1.3rem; display: flex; flex-direction: column; }
.card-top { display: flex; justify-content: space-between; align-items: center; gap: .5rem; margin-bottom: .6rem; }
.card-top h2 { margin: 0; font-size: 1.1rem; }
.card-actions { display: flex; gap: .5rem; align-items: center; margin-top: auto; padding-top: .8rem; }

.kv { display: grid; grid-template-columns: auto 1fr; gap: .45rem 1rem; margin: 0 0 1rem; }
.kv dt { color: var(--muted); font-size: .88rem; }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: .9rem; margin-bottom: 1.2rem; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; display: flex; flex-direction: column; color: var(--muted); font-size: .88rem; }
a.stat:hover { border-color: var(--accent); text-decoration: none; }
.stat .n { font-size: 1.7rem; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.stat.warn { border-color: var(--warn); }
.stat.warn .n { color: var(--warn); }

/* Tables */
.tbl-scroll { overflow-x: auto; }
.tbl-scroll.tall { max-height: 460px; overflow-y: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: .92rem; }
.tbl th { text-align: left; font-weight: 600; color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; padding: .4rem .6rem; border-bottom: 1px solid var(--line); }
.tbl td { padding: .6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr.dim { opacity: .5; }
.tbl form { margin: 0; }
.user-cell { display: flex; gap: .6rem; align-items: center; }

/* Badges & events */
.badge { display: inline-block; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; padding: 2px 8px; border-radius: 999px; border: 1px solid; }
.badge.active { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 45%, transparent); }
.badge.suspended, .badge.expired { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 45%, transparent); }
.badge.revoked { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 45%, transparent); }
.ev { font-size: .82rem; font-weight: 600; text-transform: capitalize; margin-right: .3rem; }
.ev.verify_denied, .ev.auto_suspended, .ev.status_revoked { color: var(--bad); }
.ev.activated, .ev.granted, .ev.status_active { color: var(--ok); }
.ev.download { color: var(--accent); }

/* Forms */
.form { display: flex; flex-direction: column; gap: .85rem; }
.form label { display: flex; flex-direction: column; gap: .3rem; font-size: .88rem; color: var(--muted); }
.form label.check { flex-direction: row; align-items: center; gap: .5rem; color: var(--text); }
.form .btn { align-self: flex-start; }
.hint { font-size: .8rem; color: var(--muted); }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--bg2); border: 1px solid var(--line);
  border-radius: 8px; padding: .55rem .7rem; width: 100%;
}
input[type=checkbox] { width: auto; accent-color: var(--accent); }
input[type=file] { padding: .45rem; }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--accent) 60%, transparent); outline-offset: 0; border-color: var(--accent); }
.filters, .inline-form { display: flex; gap: .5rem; margin-bottom: 1rem; flex-wrap: wrap; }
.filters input { flex: 1; min-width: 180px; }
.filters select { width: auto; }
.inline-form input { flex: 1; min-width: 200px; width: auto; }
.actions-row { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1.2rem; }
.actions-row form, form.inline { margin: 0; display: inline; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  font: inherit; font-weight: 600; font-size: .9rem; cursor: pointer;
  padding: .5rem .95rem; border-radius: 8px; border: 1px solid transparent;
  background: var(--line); color: var(--text); text-decoration: none;
}
.btn:hover { text-decoration: none; filter: brightness(1.12); }
.btn:disabled { opacity: .45; cursor: not-allowed; filter: none; }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.ghost { background: transparent; border-color: var(--line); }
.btn.ghost:hover { background: var(--bg2); }
.btn.danger { background: var(--bad); color: #fff; }
.btn.danger.ghost { background: transparent; color: var(--bad); border-color: color-mix(in srgb, var(--bad) 45%, transparent); }
.btn.discord { background: var(--discord); color: #fff; }
.btn.sm { padding: .3rem .65rem; font-size: .82rem; }
.btn.lg { padding: .8rem 1.4rem; font-size: 1rem; }

/* Copy */
.copy { cursor: pointer; }
.copy.copied { outline: 1px solid var(--ok); }
.copy.copied::after { content: " ✓ copied"; color: var(--ok); font-family: system-ui, sans-serif; font-size: .8em; }

pre.code { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 1rem; overflow-x: auto; margin: .5rem 0 .8rem; }
pre.code code { background: none; border: 0; padding: 0; font-size: .85rem; line-height: 1.6; }

/* Flash */
.flash { padding: .75rem 1rem; border-radius: 8px; margin-bottom: 1.2rem; border: 1px solid; overflow-wrap: anywhere; }
.flash.ok { border-color: color-mix(in srgb, var(--ok) 45%, transparent); background: color-mix(in srgb, var(--ok) 10%, transparent); }
.flash.error { border-color: color-mix(in srgb, var(--bad) 45%, transparent); background: color-mix(in srgb, var(--bad) 10%, transparent); }

.hero { text-align: center; padding: 5rem 1rem; max-width: 560px; margin: 0 auto; }
.hero h1 { font-size: 2.2rem; justify-content: center; }
.hero p { color: var(--muted); font-size: 1.05rem; margin-bottom: 1.6rem; }
.empty { background: var(--card); border: 1px dashed var(--line); border-radius: var(--radius); padding: 2.5rem; text-align: center; }

@media (max-width: 600px) {
  .topbar { padding: .7rem 1rem; gap: .8rem; }
  .me-name { display: none; }
  .wrap { padding: 1.2rem 1rem 3rem; }
  .subnav { padding: .5rem 1rem; }
}

/* Logo */
.brand-logo { height: 26px; width: 26px; vertical-align: middle; margin-right: .1rem; }
.hero-logo { width: 96px; height: 96px; margin: 0 auto 1.2rem; display: block; filter: drop-shadow(0 6px 20px rgba(0,0,0,.4)); }
