:root {
  color-scheme: dark;
  --bg: #0f172a;
  --panel: #1e293b;
  --panel-solid: #111827;
  --field: #0f172a;
  --line: #334155;
  --line-strong: #475569;
  --text: #f8fafc;
  --white: #ffffff;
  --muted: #94a3b8;
  --green: #22c55e;
  --red: #ef4444;
  --indigo: #4f46e5;
  --indigo-hover: #6366f1;
  --indigo-text: #818cf8;
  --radius: 8px;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
    "PingFang SC", "Helvetica Neue", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
a,
input,
select,
textarea {
  font: inherit;
  letter-spacing: 0;
}

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

i[data-lucide] {
  display: none;
}

.hidden {
  display: none !important;
}

.uppercase {
  text-transform: uppercase;
}

.break-all {
  word-break: break-all;
}

.font-medium {
  font-weight: 600;
}

/* Public recharge page */
.recharge-shell {
  min-height: 100vh;
  background:
    radial-gradient(circle at top, rgba(79, 70, 229, 0.16), transparent 22rem),
    var(--bg);
  padding: 32px 16px;
}

.recharge-wrap {
  width: min(512px, 100%);
  margin: 0 auto;
}

.hero-bar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 4px 0 24px;
}

.admin-link {
  display: inline-flex;
  height: 36px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 14px;
  background: transparent;
  color: #cbd5e1;
  font-size: 14px;
  font-weight: 600;
}

.hero-bar h1 {
  margin: 0;
  color: var(--text);
  font-size: 22px;
  line-height: 1.2;
  font-weight: 700;
}

.recharge-stack {
  display: grid;
  gap: 24px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 24px;
  box-shadow: 0 18px 48px rgba(2, 6, 23, 0.24);
}

.section-disabled {
  opacity: 0.52;
  pointer-events: none;
}

.section-disabled .token-link,
.section-disabled a[target="_blank"] {
  opacity: 1;
  pointer-events: auto;
}

.stepper {
  display: grid;
  grid-template-columns: auto 1fr auto 1fr auto;
  align-items: center;
  gap: 10px;
  margin: 0 0 24px;
}

.step-dot {
  display: inline-flex;
  width: 32px;
  height: 32px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #1e293b;
  color: #64748b;
  font-size: 14px;
  font-weight: 800;
}

.step-dot-active {
  border-color: var(--indigo);
  background: var(--indigo);
  color: white;
}

.step-dot-done {
  border-color: var(--green);
  background: rgba(34, 197, 94, 0.16);
  color: #86efac;
}

.step-index {
  display: inline-flex;
  width: 32px;
  height: 32px;
  flex: none;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--indigo);
  color: white;
  font-size: 14px;
  font-weight: 800;
}

.step-line {
  height: 1px;
  background: var(--line);
}

.step-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
}

.step-head h2 {
  margin: 0;
  color: var(--text);
  font-size: 18px;
  line-height: 1.25;
  font-weight: 700;
}

.step-head p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.token-link {
  display: inline-flex;
  flex: none;
  align-items: center;
  color: var(--indigo-text);
  font-size: 14px;
  font-weight: 700;
}

.token-link:hover {
  color: #a5b4fc;
}

.form-row,
.action-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  margin-top: 18px;
}

.action-row {
  margin-top: 14px;
}

.input,
.select,
.textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--field);
  color: var(--text);
  outline: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.input,
.select {
  height: 44px;
  padding: 0 12px;
  font-size: 15px;
  font-weight: 600;
}

.textarea {
  min-height: 132px;
  margin-top: 16px;
  padding: 12px;
  resize: vertical;
  font-size: 14px;
  line-height: 1.45;
}

.input::placeholder,
.textarea::placeholder {
  color: #64748b;
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--indigo-hover);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.24);
}

.btn-primary,
.btn-secondary,
.icon-link,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  border-radius: var(--radius);
  padding: 0 16px;
  border: 1px solid transparent;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  transition: transform 0.16s ease, opacity 0.16s ease, background 0.16s ease;
}

.btn-primary {
  background: var(--indigo);
  color: #fff;
}

.btn-secondary {
  border-color: var(--line-strong);
  background: transparent;
  color: #e2e8f0;
}

.btn-primary:hover,
.btn-secondary:hover,
.admin-link:hover {
  transform: none;
}

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

.btn-secondary:hover,
.admin-link:hover {
  border-color: #64748b;
  background: rgba(148, 163, 184, 0.08);
}

.btn-primary:disabled,
.btn-secondary:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
}

.btn-wide {
  width: 100%;
  margin-top: 18px;
}

.check-line {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #cbd5e1;
  font-size: 14px;
  font-weight: 600;
}

.check-line input {
  width: 20px;
  height: 20px;
  accent-color: var(--indigo);
}

.summary-grid {
  display: grid;
  gap: 10px;
  margin: 18px 0 0;
  padding: 0;
}

.summary-grid div {
  min-width: 0;
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 12px;
  align-items: baseline;
  border-bottom: 1px solid rgba(148, 163, 184, 0.16);
  padding: 10px 0;
}

.summary-grid dt {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.summary-grid dd {
  margin: 0;
  color: var(--text);
  font-size: 15px;
  font-weight: 650;
  word-break: break-all;
}

.status-line {
  min-height: 24px;
  margin: 12px 0 0;
  font-size: 14px;
  line-height: 1.4;
  font-weight: 650;
}

.status-ok {
  color: var(--green);
}

.status-error {
  color: var(--red);
}

.status-info {
  color: #cbd5e1;
}

.progress-track {
  height: 12px;
  margin-top: 18px;
  overflow: hidden;
  border-radius: 999px;
  background: #0f172a;
}

.progress-bar {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--indigo-hover);
  transition: width 0.3s ease;
}

.result-row {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.result-icon {
  display: inline-flex;
  width: 46px;
  height: 46px;
  flex: none;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: var(--text);
  font-size: 28px;
  font-weight: 900;
}

.result-icon-ok {
  background: rgba(52, 199, 89, 0.18);
  color: var(--green);
}

.result-icon-error {
  background: rgba(255, 69, 58, 0.18);
  color: var(--red);
}

.result-row h2 {
  margin: 0;
  color: var(--text);
  font-size: 20px;
  line-height: 1;
  font-weight: 850;
}

.result-row p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.4;
}

/* Admin pages, still local CSS after CDN removal */
.min-h-screen {
  min-height: 100vh;
}

.bg-zinc-100,
.bg-zinc-50,
.bg-white {
  background: var(--bg);
}

.text-zinc-950,
.text-zinc-900,
.text-zinc-700,
.text-zinc-600,
.text-zinc-500 {
  color: var(--white);
}

.antialiased {
  -webkit-font-smoothing: antialiased;
}

.admin-panel,
.metric {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-solid);
  padding: 18px;
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.panel-title h1,
.admin-panel h1 {
  margin: 0;
  color: #fff;
  font-size: 28px;
  font-weight: 820;
}

.metric span {
  color: var(--muted);
  font-size: 15px;
  font-weight: 700;
}

.metric strong {
  display: block;
  margin-top: 8px;
  color: #fff;
  font-size: 40px;
  line-height: 1;
  font-weight: 850;
}

.nav-link {
  display: flex;
  min-width: max-content;
  align-items: center;
  gap: 8px;
  border-radius: var(--radius);
  padding: 12px 14px;
  color: #d1d1d6;
  font-size: 15px;
  font-weight: 720;
}

.nav-link:hover,
.nav-link-active {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.filter-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  align-items: center;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  min-width: 780px;
  border-collapse: collapse;
  font-size: 15px;
}

.data-table th,
.data-table td {
  border-bottom: 1px solid var(--line);
  padding: 14px;
  color: #f5f5f7;
  text-align: left;
  vertical-align: top;
}

.data-table th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.empty-cell {
  padding: 44px 16px !important;
  text-align: center !important;
  color: var(--muted) !important;
}

.status-pill {
  display: inline-flex;
  min-width: 74px;
  justify-content: center;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 850;
}

.status-active,
.status-unused,
.status-completed {
  background: rgba(52, 199, 89, 0.16);
  color: var(--green);
}

.status-processing,
.status-pending {
  background: rgba(10, 132, 255, 0.16);
  color: #64aaff;
}

.status-disabled,
.status-used,
.status-failed,
.status-expired {
  background: rgba(255, 69, 58, 0.16);
  color: var(--red);
}

.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 18px;
  color: var(--muted);
  font-size: 15px;
}

.icon-link,
.icon-button {
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.label {
  display: inline-block;
  color: var(--muted);
  font-size: 15px;
  font-weight: 720;
}

/* Utility classes still used by templates */
.mx-auto { margin-left: auto; margin-right: auto; }
.max-w-7xl { max-width: 1280px; }
.max-w-3xl { max-width: 768px; }
.max-w-sm { max-width: 384px; }
.max-w-2xl { max-width: 672px; }
.w-full { width: 100%; }
.h-4 { width: 1rem; height: 1rem; }
.h-5 { width: 1.25rem; height: 1.25rem; }
.h-8 { width: 2rem; height: 2rem; }
.h-9 { min-height: 2.25rem; }
.h-10 { min-height: 2.5rem; }
.flex { display: flex; }
.inline-flex { display: inline-flex; }
.grid { display: grid; }
.block { display: block; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.space-y-1 > * + * { margin-top: 4px; }
.space-y-4 > * + * { margin-top: 16px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.p-2 { padding: 8px; }
.p-3 { padding: 12px; }
.p-4 { padding: 16px; }
.p-6 { padding: 24px; }
.px-3 { padding-left: 12px; padding-right: 12px; }
.px-4 { padding-left: 16px; padding-right: 16px; }
.py-3 { padding-top: 12px; padding-bottom: 12px; }
.py-4 { padding-top: 16px; padding-bottom: 16px; }
.rounded { border-radius: 6px; }
.rounded-md { border-radius: var(--radius); }
.rounded-full { border-radius: 999px; }
.border { border: 1px solid var(--line); }
.border-b { border-bottom: 1px solid var(--line); }
.sticky { position: sticky; }
.top-0 { top: 0; }
.z-20 { z-index: 20; }
.overflow-x-auto { overflow-x: auto; }
.overflow-hidden { overflow: hidden; }
.overflow-auto { overflow: auto; }
.min-w-0 { min-width: 0; }
.shrink-0 { flex-shrink: 0; }
.text-xs { font-size: 12px; }
.text-sm { font-size: 15px; }
.text-base { font-size: 17px; }
.text-xl { font-size: 24px; }
.text-2xl { font-size: 32px; }
.font-semibold { font-weight: 760; }
.font-bold { font-weight: 820; }
.font-medium { font-weight: 680; }
.text-center { text-align: center; }
.shadow-sm { box-shadow: 0 12px 34px rgba(0, 0, 0, 0.24); }
.cursor-pointer { cursor: pointer; }
.whitespace-pre-wrap { white-space: pre-wrap; }

@media (min-width: 640px) {
  .sm\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sm\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .sm\:w-fit { width: fit-content; }
  .sm\:w-auto { width: auto; }
}

@media (min-width: 768px) {
  .md\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 1024px) {
  .lg\:block { display: block; }
  .lg\:grid-cols-\[220px_1fr\] { grid-template-columns: 220px 1fr; }
  .lg\:sticky { position: sticky; }
  .lg\:top-\[72px\] { top: 72px; }
  .lg\:h-\[calc\(100vh-88px\)\] { height: calc(100vh - 88px); }
}

@media (min-width: 1280px) {
  .xl\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
  .recharge-shell {
    padding: 20px 12px 40px;
  }

  .hero-bar {
    padding: 0 0 18px;
  }

  .form-row,
  .action-row,
  .summary-grid {
    grid-template-columns: 1fr;
  }

  .btn-primary,
  .btn-secondary {
    width: 100%;
  }

  .step-head {
    gap: 12px;
  }

  .step-index {
    width: 36px;
    height: 36px;
    font-size: 18px;
  }

  .pager {
    align-items: flex-start;
    flex-direction: column;
  }
}
