:root {
  color-scheme: dark;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-btn: 12px;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --surface-950: #181818;
  --surface-900: #1f1f1f;
  --surface-800: #252526;
  --surface-700: #2b2b2b;
  --surface-600: #3c3c3c;
  --surface-500: #555;
  --surface-400: #717171;
  --surface-300: #a0a0a0;
  --surface-200: #cccccc;
  --surface-100: #e0e0e0;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--surface-950);
  color: var(--surface-200);
  font-family: Inter, system-ui, sans-serif;
}

body {
  background-image:
    radial-gradient(circle at top, rgba(59, 130, 246, 0.08), transparent 32%),
    linear-gradient(180deg, rgba(255,255,255,0.02), transparent 30%);
}

a {
  color: inherit;
  text-decoration: none;
}

.page-shell {
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px 24px 60px;
}

/* --- Topbar --- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 700;
  color: var(--surface-100);
}

.brand img {
  width: 18px;
  height: 18px;
}

.topbar-links {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: var(--radius-btn);
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.04);
  color: var(--surface-300);
  font-size: 12px;
  transition: background 0.15s;
}

.pill:hover {
  background: rgba(255,255,255,0.07);
}

/* --- Layout --- */
.layout {
  display: grid;
  gap: 20px;
}

.layout.two-col {
  grid-template-columns: 1.15fr 0.85fr;
}

/* --- Panel --- */
.panel {
  background: var(--surface-900);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-xl);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.3);
}

.panel-inner {
  padding: 24px;
}

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

/* --- Eyebrow, Title, Subtitle --- */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: var(--radius-btn);
  border: 1px solid rgba(59, 130, 246, 0.24);
  background: rgba(59, 130, 246, 0.1);
  color: #9cc4ff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.title {
  margin: 18px 0 0;
  font-size: clamp(30px, 5vw, 46px);
  line-height: 1.1;
  color: white;
}

.subtitle {
  margin: 14px 0 0;
  max-width: 680px;
  font-size: 15px;
  line-height: 1.8;
  color: var(--surface-300);
}

/* --- Stats --- */
.stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 28px;
}

.stat-card {
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.03);
  padding: 16px;
}

.stat-label {
  margin: 0;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--surface-500);
}

.stat-value {
  margin: 10px 0 0;
  font-size: 26px;
  font-weight: 700;
  color: white;
}

.muted {
  color: var(--surface-400);
}

/* --- Purchase steps --- */
.purchase-steps {
  display: grid;
  gap: 10px;
}

.purchase-step {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 14px;
  color: var(--surface-300);
  line-height: 1.6;
}

.purchase-step-num {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(59, 130, 246, 0.12);
  color: #9cc4ff;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 2px;
}

/* --- Form --- */
.form-grid {
  display: grid;
  gap: 14px;
}

.tabs {
  display: inline-flex;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-lg);
  padding: 4px;
  background: rgba(255,255,255,0.03);
}

.tab {
  border: 0;
  background: transparent;
  color: var(--surface-300);
  padding: 10px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}

.tab.active {
  background: var(--accent);
  color: white;
}

.field-label {
  display: block;
  margin-bottom: 7px;
  font-size: 11px;
  color: var(--surface-500);
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.input {
  width: 100%;
  border-radius: var(--radius-btn);
  border: 1px solid var(--surface-600);
  background: var(--surface-800);
  color: var(--surface-100);
  padding: 13px 14px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.input:focus {
  border-color: rgba(59, 130, 246, 0.55);
  box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.28);
}

.input::placeholder {
  color: var(--surface-500);
}

/* --- Buttons --- */
.button-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: var(--radius-btn);
  padding: 12px 18px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease, transform 0.1s;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--accent);
  color: white;
}

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

.btn-ghost {
  background: transparent;
  color: var(--surface-200);
  border: 1px solid rgba(255,255,255,0.08);
}

.btn-ghost:hover {
  background: rgba(255,255,255,0.04);
}

.btn-sm {
  padding: 8px 14px;
  font-size: 13px;
  border-radius: var(--radius-md);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.12);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.2);
}

.btn-success {
  background: rgba(34, 197, 94, 0.12);
  color: #86efac;
  border: 1px solid rgba(34, 197, 94, 0.2);
}

.btn-success:hover {
  background: rgba(34, 197, 94, 0.2);
}

/* --- Stack, Notice --- */
.stack {
  display: grid;
  gap: 16px;
}

.notice {
  padding: 14px 16px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.6;
}

.notice.error {
  border: 1px solid rgba(239, 68, 68, 0.18);
  background: rgba(239, 68, 68, 0.08);
  color: #fecaca;
}

.notice.success {
  border: 1px solid rgba(34, 197, 94, 0.18);
  background: rgba(34, 197, 94, 0.08);
  color: #bbf7d0;
}

/* --- Status --- */
.status-card {
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.03);
  padding: 20px;
}

.status-title {
  margin: 14px 0 0;
  color: white;
  font-size: 24px;
  font-weight: 700;
}

.status-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: var(--radius-btn);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-weight: 600;
}

.status-tag.trial {
  color: #fde68a;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.2);
}

.status-tag.active {
  color: #bbf7d0;
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.2);
}

.status-tag.expired,
.status-tag.blocked {
  color: #fecaca;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.status-tag.deleted {
  color: #fca5a5;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.15);
}

/* --- List --- */
.list {
  display: grid;
  gap: 12px;
}

.list-item {
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.03);
  padding: 16px;
  transition: background 0.15s;
}

.list-item:hover {
  background: rgba(255,255,255,0.05);
}

.list-item-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
}

.list-item-info {
  flex: 1;
  min-width: 200px;
}

.list-item-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.list-item-meta {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 10px;
  font-size: 12px;
  color: var(--surface-400);
}

.list-item-meta span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.code {
  font-family: "JetBrains Mono", monospace;
  font-size: 13px;
  color: var(--surface-100);
  font-weight: 600;
}

/* --- Badge --- */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: var(--radius-md);
  font-size: 11px;
  font-weight: 700;
  background: var(--accent);
  color: white;
}

.badge.badge-zero {
  background: var(--surface-600);
  color: var(--surface-300);
}

/* --- FAQ --- */
.faq-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.faq-item {
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.06);
  background: rgba(255,255,255,0.02);
  overflow: hidden;
}

.faq-item summary {
  padding: 14px 16px;
  font-size: 14px;
  font-weight: 600;
  color: var(--surface-200);
  cursor: pointer;
  list-style: none;
  transition: background 0.15s;
}

.faq-item summary::-webkit-details-marker { display: none; }

.faq-item summary::before {
  content: '+ ';
  color: var(--accent);
  font-family: "JetBrains Mono", monospace;
  font-weight: 700;
  margin-right: 6px;
}

.faq-item[open] summary::before { content: '- '; }

.faq-item summary:hover {
  background: rgba(255,255,255,0.03);
}

.faq-body {
  padding: 0 16px 14px;
  font-size: 13px;
  line-height: 1.7;
  color: var(--surface-400);
}

/* --- Admin Stats --- */
.admin-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.admin-stat-card {
  background: var(--surface-900);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px;
  padding: 20px;
  text-align: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.admin-stat-value {
  font-size: 32px;
  font-weight: 800;
  color: white;
  font-family: "JetBrains Mono", monospace;
}

.admin-stat-label {
  margin-top: 6px;
  font-size: 12px;
  color: var(--surface-400);
  letter-spacing: 0.08em;
}

.admin-stat-accent {
  border-color: rgba(34, 197, 94, 0.2);
  background: linear-gradient(160deg, rgba(34, 197, 94, 0.06), var(--surface-900));
}

.admin-stat-accent .admin-stat-value { color: #86efac; }

.admin-stat-warning {
  border-color: rgba(245, 158, 11, 0.2);
  background: linear-gradient(160deg, rgba(245, 158, 11, 0.06), var(--surface-900));
}

.admin-stat-warning .admin-stat-value { color: #fde68a; }

.admin-stat-danger {
  border-color: rgba(239, 68, 68, 0.2);
  background: linear-gradient(160deg, rgba(239, 68, 68, 0.06), var(--surface-900));
}

.admin-stat-danger .admin-stat-value { color: #fca5a5; }

/* --- Admin toolbar --- */
.admin-toolbar {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.admin-search-wrap {
  position: relative;
  flex: 1;
  min-width: 220px;
}

.admin-search-input {
  max-width: 100%;
}

/* --- Modal --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}

.modal-box {
  background: var(--surface-900);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-xl);
  padding: 28px;
  max-width: 440px;
  width: 90%;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
}

.modal-title {
  margin: 0 0 8px;
  font-size: 20px;
  font-weight: 700;
  color: white;
}

.modal-text {
  margin: 0 0 16px;
  font-size: 14px;
  color: var(--surface-300);
  line-height: 1.6;
}

/* --- Hidden --- */
.hidden {
  display: none !important;
}

/* --- Responsive --- */
@media (max-width: 980px) {
  .layout.two-col {
    grid-template-columns: 1fr;
  }

  .admin-stats {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .page-shell {
    padding: 18px 14px 36px;
  }

  .panel-inner {
    padding: 18px;
  }

  .stats {
    grid-template-columns: 1fr;
  }

  .admin-stats {
    grid-template-columns: 1fr;
  }

  .faq-grid {
    grid-template-columns: 1fr;
  }

  .admin-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
}
