/* ── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #0e0e0e;
  --surface:   #161616;
  --surface2:  #1e1e1e;
  --border:    #2a2a2a;
  --text:      #e2e2e2;
  --muted:     #888;
  --accent:    #00e676;
  --accent-dim:#00e67622;
  --danger:    #ff5252;
  --warn:      #ffab40;
  --info:      #40c4ff;
  --radius:    6px;
  --mono:      'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
}

html { font-size: 16px; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, sans-serif;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

code, .mono {
  font-family: var(--mono);
  font-size: 0.875em;
  background: var(--surface2);
  padding: 2px 6px;
  border-radius: 3px;
  color: var(--accent);
}

/* ── Nav ──────────────────────────────────────────────────── */
nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  height: 56px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 100;
}

.logo {
  font-family: var(--mono);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.5px;
}
.logo:hover { text-decoration: none; }

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.nav-links a { color: var(--muted); font-size: 0.9rem; }
.nav-links a:hover { color: var(--text); text-decoration: none; }

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-block;
  padding: 0.5rem 1.1rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.15s, background 0.15s;
  border: none;
  text-align: center;
}
.btn:hover { opacity: 0.85; text-decoration: none; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-primary  { background: var(--accent); color: #000; }
.btn-outline  { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
.btn-ghost    { background: var(--surface2); color: var(--text); }
.btn-danger   { background: var(--danger); color: #fff; }
.btn-lg       { padding: 0.75rem 1.75rem; font-size: 1rem; }
.btn-sm       { padding: 0.35rem 0.75rem; font-size: 0.8rem; }

/* ── Cards ────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
}
.card-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  color: var(--text);
}

/* ── Forms ────────────────────────────────────────────────── */
.form-group { margin-bottom: 1.25rem; }
.form-group label {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.4rem;
}

input[type="text"], input[type="email"], select, textarea {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
  padding: 0.6rem 0.9rem;
  outline: none;
  transition: border-color 0.15s;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
}
input.mono-input {
  font-family: var(--mono);
  font-size: 0.85rem;
  letter-spacing: 0.3px;
}

/* ── Alerts ───────────────────────────────────────────────── */
.alert {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  margin-bottom: 1rem;
  display: none;
}
.alert.show { display: block; }
.alert-success { background: #00e67615; border: 1px solid #00e67640; color: var(--accent); }
.alert-error   { background: #ff525215; border: 1px solid #ff525240; color: var(--danger); }
.alert-info    { background: #40c4ff15; border: 1px solid #40c4ff40; color: var(--info); }

/* ── Badges ───────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 0.75rem;
  font-weight: 600;
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.badge-free    { background: #88888820; color: var(--muted); border: 1px solid #44444460; }
.badge-starter { background: #40c4ff15; color: var(--info);  border: 1px solid #40c4ff40; }
.badge-pro     { background: var(--accent-dim); color: var(--accent); border: 1px solid #00e67640; }
.badge-active  { background: #00e67615; color: var(--accent); border: 1px solid #00e67640; }
.badge-inactive{ background: #ff525215; color: var(--danger); border: 1px solid #ff525240; }

/* ── Progress bar ─────────────────────────────────────────── */
.progress-wrap {
  background: var(--surface2);
  border-radius: 99px;
  height: 8px;
  overflow: hidden;
  margin: 0.4rem 0;
}
.progress-bar {
  height: 100%;
  border-radius: 99px;
  background: var(--accent);
  transition: width 0.4s ease;
}
.progress-bar.warn  { background: var(--warn); }
.progress-bar.danger{ background: var(--danger); }

/* ── Stat grid ────────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  margin: 1rem 0;
}
.stat-box {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  text-align: center;
}
.stat-value {
  font-family: var(--mono);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1.2;
}
.stat-label {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ── Main layout ──────────────────────────────────────────── */
main { flex: 1; }

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 1.5rem;
}
.container-sm {
  max-width: 560px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.page-header {
  padding: 3rem 0 2rem;
  text-align: center;
}
.page-header h1 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}
.page-header p {
  color: var(--muted);
  font-size: 1.05rem;
}

section { padding: 4rem 0; }

/* ── Hero ─────────────────────────────────────────────────── */
.hero {
  padding: 5rem 0 3rem;
  text-align: center;
}
.hero-eyebrow {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 99px;
  padding: 3px 12px;
  margin-bottom: 1.5rem;
  letter-spacing: 0.5px;
}
.hero h1 {
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -1px;
  margin-bottom: 1.25rem;
}
.hero h1 span { color: var(--accent); }
.hero p {
  font-size: 1.15rem;
  color: var(--muted);
  max-width: 540px;
  margin: 0 auto 2rem;
}
.hero-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* ── Demo box ─────────────────────────────────────────────── */
.demo-box {
  max-width: 700px;
  margin: 3rem auto 0;
  text-align: left;
}
.demo-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 0.6rem 1rem;
}
.demo-dots { display: flex; gap: 6px; }
.demo-dots span {
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--border);
}
.demo-dots span:nth-child(1) { background: #ff5f57; }
.demo-dots span:nth-child(2) { background: #febc2e; }
.demo-dots span:nth-child(3) { background: #28c840; }
.demo-url-bar {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 3px 10px;
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
}
.demo-body {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0 0 var(--radius) var(--radius);
  padding: 1.25rem;
}
.demo-input-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.demo-input-row input {
  flex: 1;
}
#demo-output {
  font-family: var(--mono);
  font-size: 0.8rem;
  line-height: 1.6;
  white-space: pre;
  overflow-x: auto;
  color: var(--text);
  min-height: 80px;
}
#demo-output .key-color   { color: #82aaff; }
#demo-output .str-color   { color: #c3e88d; }
#demo-output .num-color   { color: #f78c6c; }
#demo-output .bool-color  { color: var(--accent); }
#demo-output .null-color  { color: var(--muted); }

/* ── Features ─────────────────────────────────────────────── */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}
.feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}
.feature-icon {
  font-size: 1.4rem;
  margin-bottom: 0.6rem;
}
.feature-card h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
}
.feature-card p {
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.5;
}

/* ── Pricing ──────────────────────────────────────────────── */
.pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
  margin-top: 2rem;
}
.pricing-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
}
.pricing-card.featured {
  border-color: var(--accent);
  position: relative;
}
.pricing-card.featured::before {
  content: 'Most Popular';
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent);
  color: #000;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 99px;
  white-space: nowrap;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.pricing-name {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
  margin-bottom: 0.5rem;
}
.pricing-price {
  font-size: 2.5rem;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 0.25rem;
}
.pricing-price span {
  font-size: 1rem;
  font-weight: 400;
  color: var(--muted);
}
.pricing-period {
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 1.25rem;
}
.pricing-features {
  list-style: none;
  flex: 1;
  margin-bottom: 1.5rem;
}
.pricing-features li {
  font-size: 0.875rem;
  color: var(--muted);
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.pricing-features li::before {
  content: '✓';
  color: var(--accent);
  font-weight: 700;
  flex-shrink: 0;
}

/* ── Key display ──────────────────────────────────────────── */
.key-box {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 1rem 0;
}
.key-value {
  font-family: var(--mono);
  font-size: 0.875rem;
  color: var(--accent);
  word-break: break-all;
  flex: 1;
}
.copy-btn {
  flex-shrink: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 0.8rem;
  padding: 4px 10px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.copy-btn:hover { color: var(--accent); border-color: var(--accent); }

/* ── Dashboard ────────────────────────────────────────────── */
.dashboard-lookup {
  padding: 3rem 0;
  text-align: center;
}
.dashboard-lookup h2 {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}
.lookup-form {
  display: flex;
  gap: 0.5rem;
  max-width: 480px;
  margin: 1.5rem auto 0;
}
.lookup-form input { flex: 1; }

#dashboard-content { display: none; padding-bottom: 3rem; }

.dash-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem 0 1rem;
  flex-wrap: wrap;
  gap: 1rem;
}
.dash-header h2 {
  font-size: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.dash-key-display {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--muted);
}

.usage-section { margin-bottom: 1.5rem; }
.usage-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.4rem;
}
.usage-label strong { color: var(--text); }

.upgrade-banner {
  background: var(--accent-dim);
  border: 1px solid #00e67640;
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 1.5rem;
}
.upgrade-banner p {
  font-size: 0.9rem;
  color: var(--text);
}
.upgrade-banner p small { color: var(--muted); display: block; font-size: 0.8rem; }

/* ── Tier table ───────────────────────────────────────────── */
.tier-compare {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  margin-top: 1rem;
}
.tier-compare th, .tier-compare td {
  text-align: left;
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--border);
}
.tier-compare th {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  font-weight: 600;
}
.tier-compare td:first-child { color: var(--muted); }
.tier-compare .current-tier { background: var(--accent-dim); }

/* ── Section headings ─────────────────────────────────────── */
.section-heading {
  text-align: center;
  margin-bottom: 2rem;
}
.section-heading h2 {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
}
.section-heading p { color: var(--muted); }

/* ── Footer ───────────────────────────────────────────────── */
footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem 2rem;
  text-align: center;
  font-size: 0.8rem;
  color: var(--muted);
}
footer a { color: var(--muted); }
footer a:hover { color: var(--text); }

/* ── Spinner ──────────────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 16px; height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Divider ──────────────────────────────────────────────── */
hr { border: none; border-top: 1px solid var(--border); margin: 2rem 0; }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 640px) {
  nav { padding: 0 1rem; }
  .nav-links { gap: 1rem; }
  .nav-links a:not(.btn-primary) { display: none; }
  .hero { padding: 3rem 0 2rem; }
  .lookup-form { flex-direction: column; }
  .dash-header { flex-direction: column; align-items: flex-start; }
  .upgrade-banner { flex-direction: column; }
  .key-box { flex-direction: column; align-items: flex-start; }
}

/* ── Admin Layout ─────────────────────────────────────────── */
.admin-body { overflow: hidden; height: 100vh; display: flex; flex-direction: column; }
.admin-layout { display: flex; flex: 1; overflow: hidden; }
.admin-sidebar {
  width: 220px; flex-shrink: 0;
  background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  overflow-y: auto;
}
.admin-sidebar-logo {
  padding: 1.25rem;
  font-family: var(--mono); font-size: 0.95rem; font-weight: 700;
  color: var(--accent); border-bottom: 1px solid var(--border);
}
.admin-nav { flex: 1; padding: 0.5rem 0; }
.admin-nav a {
  display: block; padding: 0.6rem 1.25rem;
  color: var(--muted); font-size: 0.875rem; text-decoration: none;
  transition: all 0.12s;
}
.admin-nav a:hover { color: var(--text); background: var(--surface2); text-decoration: none; }
.admin-nav a.active { color: var(--accent); background: var(--accent-dim); border-right: 2px solid var(--accent); }
.admin-sidebar-footer { padding: 1rem 1.25rem; border-top: 1px solid var(--border); }
.admin-main { flex: 1; overflow-y: auto; padding: 1.75rem 2rem; background: var(--bg); }
.admin-page-title {
  font-size: 1.15rem; font-weight: 700; margin-bottom: 1.25rem;
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0.75rem;
}
.admin-flash {
  padding: 0.65rem 1rem; border-radius: var(--radius); font-size: 0.85rem; margin-bottom: 1.25rem;
}
.admin-flash.ok  { background: #00e67615; border: 1px solid #00e67640; color: var(--accent); }
.admin-flash.err { background: #ff525215; border: 1px solid #ff525240; color: var(--danger); }

/* ── Admin Stats ──────────────────────────────────────────── */
.admin-stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px,1fr)); gap: 0.75rem; margin-bottom: 1.5rem; }

/* ── Admin Table ──────────────────────────────────────────── */
.admin-table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
.admin-table th { text-align: left; padding: 0.55rem 0.85rem; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted); font-weight: 600; background: var(--surface2); border-bottom: 1px solid var(--border); white-space: nowrap; }
.admin-table td { padding: 0.55rem 0.85rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: var(--surface2); }
.admin-table .mono { font-family: var(--mono); font-size: 0.78rem; color: var(--accent); }
.admin-table .muted { color: var(--muted); font-size: 0.78rem; }
.action-group { display: flex; gap: 0.3rem; flex-wrap: nowrap; align-items: center; }
.action-group form { margin: 0; }
.action-group select { background: var(--surface2); border: 1px solid var(--border); color: var(--text); font-size: 0.75rem; padding: 3px 6px; border-radius: 4px; }

/* ── Admin form row ───────────────────────────────────────── */
.admin-form-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.25rem; margin-bottom: 1.25rem; }
.admin-form-card .card-title { font-size: 0.85rem; font-weight: 600; margin-bottom: 0.75rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; }
.admin-inline-form { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: flex-end; }
.admin-inline-form .form-group { margin-bottom: 0; }
.admin-inline-form input, .admin-inline-form select, .admin-inline-form textarea { font-size: 0.85rem; }

/* ── Filter bar ───────────────────────────────────────────── */
.filter-bar { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.filter-bar input, .filter-bar select { font-size: 0.85rem; width: auto; flex: 1; min-width: 140px; max-width: 220px; }

/* ── Pagination ───────────────────────────────────────────── */
.pagination { display: flex; gap: 0.35rem; align-items: center; margin-top: 1rem; font-size: 0.825rem; }
.pagination a, .pagination span { padding: 4px 10px; border-radius: var(--radius); border: 1px solid var(--border); color: var(--muted); text-decoration: none; }
.pagination a:hover { color: var(--text); border-color: var(--accent); text-decoration: none; }
.pagination .pg-current { background: var(--accent-dim); color: var(--accent); border-color: var(--accent); }
.pagination .pg-disabled { opacity: 0.35; pointer-events: none; }

/* ── Login ────────────────────────────────────────────────── */
.admin-login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.admin-login-box { width: 100%; max-width: 360px; padding: 0 1.5rem; }
.admin-login-box .logo { font-family: var(--mono); font-size: 1.2rem; font-weight: 700; color: var(--accent); display: block; text-align: center; margin-bottom: 2rem; }

/* ── Responsive admin ─────────────────────────────────────── */
@media (max-width: 768px) {
  .admin-sidebar { width: 180px; }
  .admin-main { padding: 1rem; }
}

/* ── Badge helpers ────────────────────────────────────────── */
.badge-ok     { background: #00e67620; color: var(--accent); border-color: #00e67640; }
.badge-danger { background: #ff525220; color: var(--danger); border-color: #ff525240; }
.badge-warn   { background: #ffab4020; color: var(--warn); border-color: #ffab4040; }
.badge-info   { background: #40c4ff20; color: var(--info); border-color: #40c4ff40; }
.badge-muted  { background: var(--surface2); color: var(--muted); border-color: var(--border); }

/* ── Button helpers ───────────────────────────────────────── */
.btn-warn   { background: #ffab4020; color: var(--warn); border: 1px solid #ffab4040; }
.btn-warn:hover { background: #ffab4030; }
.btn-danger { background: #ff525220; color: var(--danger); border: 1px solid #ff525240; }
.btn-danger:hover { background: #ff525230; }
