:root {
  --bg: #f3f6fb;
  --panel: #fff;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --brand: #2563eb;
  --brand-dark: #1d4ed8;
  --ok: #047857;
  --warn: #b45309;
  --bad: #b91c1c;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.55 system-ui, -apple-system, "Segoe UI", sans-serif; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 26px; margin: 0 0 4px; }
h2 { font-size: 17px; margin: 0 0 14px; }
h3 { font-size: 15px; margin: 0 0 8px; }
p { margin: 0 0 1rem; }
.topbar { display: flex; align-items: center; gap: 22px; padding: 12px 24px; background: #0f172a; color: #e2e8f0; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: #fff; font-weight: 700; white-space: nowrap; }
.brand img { width: 32px; height: 32px; border-radius: 8px; }
.brand em { color: #93c5fd; font-style: normal; font-weight: 500; margin-left: 4px; }
.topbar nav { display: flex; flex-wrap: wrap; gap: 16px; margin-left: 8px; font-size: 14px; }
.topbar nav a { color: #cbd5e1; }
.topbar nav a.active, .topbar nav a:hover { color: #fff; text-decoration: none; }
.topbar .user { margin-left: auto; display: flex; align-items: center; gap: 12px; font-size: 13px; color: #cbd5e1; }
.topbar .user form { margin: 0; }
.topbar .user button { background: transparent; border: 1px solid #334155; color: #e2e8f0; border-radius: 8px; padding: 6px 11px; cursor: pointer; font: inherit; }
.topbar .auth-nav { margin-left: auto; align-items: center; }
main { max-width: 1180px; margin: 0 auto; padding: 24px; }
.sub { color: var(--muted); margin: 0 0 20px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 20px; margin-bottom: 20px; box-shadow: 0 1px 2px rgba(15,23,42,.04); }
.grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 12px; }
.grid .wide { grid-column: span 2; }
label { display: block; font-size: 12px; font-weight: 600; color: #334155; margin-bottom: 4px; }
input, textarea, select { width: 100%; border: 1px solid #cbd5e1; border-radius: 8px; padding: 9px 10px; font: inherit; background: #fff; color: var(--ink); }
input:focus, textarea:focus, select:focus { outline: 2px solid #bfdbfe; border-color: var(--brand); }
textarea { min-height: 80px; resize: vertical; }
button, .button { display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 8px; padding: 9px 14px; background: var(--brand); color: #fff; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
button:hover, .button:hover { background: var(--brand-dark); text-decoration: none; }
button.secondary, .button.secondary { background: #e2e8f0; color: #0f172a; }
button.secondary:hover, .button.secondary:hover { background: #cbd5e1; }
button.danger { background: var(--bad); }
button.danger:hover { background: #991b1b; }
button.small, .button.small { padding: 5px 9px; font-size: 12px; }
.button-sm { min-height: 34px; padding: 6px 12px; font-size: 13px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filters select, .filters input { width: auto; min-width: 160px; }
.filters input[name="email"], .filters input[name="q"] { min-width: 230px; }
.inline-form { display: inline-flex; gap: 8px; align-items: center; margin: 0; }
.inline-form input { width: 90px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
tr:last-child td { border-bottom: 0; }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px; }
.badge { display: inline-block; border-radius: 999px; padding: 2px 9px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; background: #e2e8f0; color: #334155; }
.badge.active, .badge.paid, .badge.verified { background: #d1fae5; color: var(--ok); }
.badge.suspended, .badge.pending { background: #fef3c7; color: var(--warn); }
.badge.revoked, .badge.expired, .badge.failed { background: #fee2e2; color: var(--bad); }
.flash { padding: 11px 14px; border-radius: 10px; margin-bottom: 18px; }
.flash.ok { background: #d1fae5; color: #065f46; }
.flash.error { background: #fee2e2; color: #991b1b; }
.error { color: var(--bad); font-weight: 600; }
.muted { color: var(--muted); }
.keybox { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; background: #0f172a; color: #e2e8f0; padding: 14px; border-radius: 10px; margin: 12px 0; }
.keybox code { font-size: 15px; word-break: break-all; }
.auth-wrap { max-width: 440px; margin: 8vh auto 0; }
.auth-wrap .panel { padding: 26px; }
.field-error { margin-top: 14px; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 14px; margin-bottom: 20px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; }
.stat .num { font-size: 24px; font-weight: 700; }
.stat .lbl { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }
.detail-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 14px; }
.detail-grid .wide { grid-column: span 3; }
.k { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.v { margin-top: 2px; font-weight: 600; }
.plans { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 16px; }
.plan { border: 1px solid var(--line); border-radius: 14px; padding: 18px; background: #fff; display: flex; flex-direction: column; }
.plan .price { font-size: 28px; font-weight: 700; margin: 6px 0; }
.plan .actions { margin-top: auto; }
@media (max-width: 860px) {
  .grid, .stats, .detail-grid, .plans { grid-template-columns: 1fr; }
  .grid .wide, .detail-grid .wide { grid-column: auto; }
  main { padding: 16px; }
  .topbar { flex-wrap: wrap; padding: 12px 16px; }
  .topbar .user { margin-left: 0; }
}
