:root {
  --bg: #0b1220;
  --surface: #121b2e;
  --surface-alt: #17233a;
  --border: #253451;
  --text: #e6edf7;
  --muted: #93a4c3;
  --accent: #2bb3c0;
  --accent-hover: #3cc8d5;
  --danger: #e55353;
  --success: #2ecc71;
  --warn-bg: #33250c;
  --warn-border: #b37a1e;
  --radius: 10px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  --sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

code, pre {
  font-family: var(--mono);
  font-size: 0.86rem;
}

.hidden {
  display: none !important;
}

.container {
  max-width: 1060px;
  margin: 0 auto;
  padding: 0 20px;
}

.topbar {
  border-bottom: 1px solid var(--border);
  background: rgba(11, 18, 32, 0.92);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--accent);
  color: #06131c;
  font-weight: 800;
  font-size: 0.95rem;
}

.brand-sub {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
}

.topbar-links {
  display: flex;
  gap: 16px;
}

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

.topbar-links a:hover {
  color: var(--text);
}

.main-content {
  padding-top: 32px;
  padding-bottom: 64px;
}

.banner {
  padding: 12px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface-alt);
  margin-bottom: 20px;
  font-size: 0.93rem;
}

.banner.success {
  border-color: var(--success);
}

.banner.error {
  border-color: var(--danger);
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.auth-layout {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 32px;
  align-items: start;
}

.pill {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent);
  border: 1px solid rgba(43, 179, 192, 0.4);
  background: rgba(43, 179, 192, 0.1);
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 14px;
}

h1 {
  margin: 0 0 12px;
  font-size: 1.9rem;
  line-height: 1.2;
}

h2 {
  margin: 0 0 8px;
  font-size: 1.2rem;
}

.lead {
  color: var(--muted);
  font-size: 1.02rem;
  margin-bottom: 20px;
}

.muted {
  color: var(--muted);
  font-size: 0.9rem;
  margin-top: 0;
}

.feature-list {
  padding-left: 18px;
  color: var(--muted);
}

.feature-list li {
  margin-bottom: 10px;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.88rem;
  color: var(--muted);
}

input[type="email"],
input[type="password"],
input[type="text"] {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 0.95rem;
}

input:focus {
  outline: 2px solid var(--accent);
  border-color: transparent;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent);
  color: #06131c;
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn-secondary {
  background: var(--surface-alt);
  border-color: var(--border);
  color: var(--text);
}

.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--muted);
}

.btn-danger {
  background: transparent;
  border-color: rgba(229, 83, 83, 0.55);
  color: #ff8080;
  padding: 6px 10px;
  font-size: 0.82rem;
}

.btn-small {
  background: var(--surface-alt);
  border-color: var(--border);
  color: var(--text);
  padding: 5px 10px;
  font-size: 0.8rem;
}

.btn-link {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  padding: 4px;
  font-size: 0.9rem;
}

.auth-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 14px;
}

.form-msg {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--surface-alt);
  font-size: 0.88rem;
}

.dash-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 24px;
}

.dash-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.badge {
  text-transform: uppercase;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(43, 179, 192, 0.16);
  color: var(--accent);
  border: 1px solid rgba(43, 179, 192, 0.45);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.stat-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-label {
  font-size: 0.84rem;
  color: var(--muted);
}

.stat-value {
  font-size: 1.85rem;
  letter-spacing: -0.02em;
}

.stat-hint {
  font-size: 0.8rem;
  color: var(--muted);
}

.section-card {
  margin-bottom: 20px;
}

.inline-form {
  display: flex;
  gap: 10px;
  margin-bottom: 18px;
}

.inline-form input {
  flex: 1;
}

.table-wrap {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.data-table th,
.data-table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}

.data-table th {
  color: var(--muted);
  font-weight: 600;
}

.status-active {
  color: var(--success);
  font-weight: 600;
}

.status-revoked {
  color: var(--muted);
}

.delta-pos {
  color: var(--success);
  font-weight: 600;
}

.delta-neg {
  color: #f39c6b;
  font-weight: 600;
}

.packs-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.pack-card {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
}

.pack-price {
  font-size: 1.7rem;
  font-weight: 700;
}

.pack-credits {
  color: var(--accent);
  font-weight: 600;
}

.snippets-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.snippet-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  overflow: hidden;
}

.snippet-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.snippet-box pre {
  margin: 0;
  overflow-x: auto;
  color: #c8d8f0;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 10, 20, 0.78);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 50;
}

.modal-card {
  max-width: 560px;
  width: 100%;
}

.warn-text {
  background: var(--warn-bg);
  border: 1px solid var(--warn-border);
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 0.88rem;
}

.key-reveal {
  background: var(--bg);
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 14px;
  word-break: break-all;
  margin: 14px 0;
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

@media (max-width: 820px) {
  .auth-layout,
  .stats-grid,
  .packs-grid,
  .snippets-grid {
    grid-template-columns: 1fr;
  }
  .inline-form {
    flex-direction: column;
  }
}
