:root {
  --bg: #020617;
  --bg-alt: #050b1f;
  --card-bg: #030712;
  --border-subtle: rgba(51, 65, 85, 0.9);
  --accent: #6366f1;
  --accent-soft: rgba(99, 102, 241, 0.18);
  --text-main: #e5e7eb;
  --text-muted: #9ca3af;
  --error: #fb7185;
  --success: #22c55e;
}

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

body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, #111827 0, #020617 45%),
    radial-gradient(circle at bottom right, #020617 0, #000000 55%);
  color: var(--text-main);
  -webkit-font-smoothing: antialiased;
}

.app-shell {
  display: flex;
  min-height: 100vh;
}

/* Sidebar / navbar */

.sidebar {
  width: 260px;
  background:
    radial-gradient(circle at top, #111827 0, #020617 55%),
    radial-gradient(circle at bottom, #020617 0, #020617 60%);
  border-right: 1px solid rgba(15, 23, 42, 0.9);
  padding: 18px 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 4px 10px;
}

.brand-logo {
  width: 32px;
  height: 32px;
  border-radius: 12px;
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-size: 14px;
  font-weight: 600;
}

.brand-subtitle {
  font-size: 11px;
  color: var(--text-muted);
}

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

.nav-item {
  border: none;
  background: transparent;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  padding: 7px 11px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, transform 0.06s ease;
}

.nav-item:hover {
  background: rgba(15, 23, 42, 0.96);
  color: var(--text-main);
}

.nav-item.active {
  background: var(--accent-soft);
  color: var(--text-main);
}

.nav-item.active .nav-icon {
  color: var(--accent);
  text-shadow: 0 0 14px rgba(129, 140, 248, 0.85);
}

.nav-icon {
  font-size: 16px;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid rgba(15, 23, 42, 0.9);
}

.network-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(55, 65, 81, 0.9);
  background: radial-gradient(circle at top left, #0f172a 0, #020617 55%);
  font-size: 11px;
  color: var(--text-muted);
}

.network-icon {
  width: 16px;
  height: 16px;
}

/* Main */

.main {
  flex: 1;
  padding: 20px 22px 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Topbar */

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.topbar-left {
  max-width: 640px;
}

.topbar-tagline {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.topbar-title {
  font-size: 22px;
  margin: 0 0 4px;
}

.topbar-subtitle {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
}

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

.chain-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.92);
  border: 1px solid rgba(55, 65, 81, 0.9);
  font-size: 12px;
}

.chain-icon {
  width: 16px;
  height: 16px;
  border-radius: 999px;
}

.connect-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  padding: 6px 14px;
  border: none;
  cursor: pointer;
  background: linear-gradient(90deg, #6366f1, #8b5cf6);
  color: white;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 8px 24px rgba(79, 70, 229, 0.4);
}

.connect-btn:hover {
  transform: translateY(-1px);
}

.wallet-icon {
  width: 18px;
  height: 18px;
}

/* Views */

.view {
  display: none;
}

.view.active {
  display: block;
}

/* Card */

.card {
  background:
    linear-gradient(
      135deg,
      rgba(15, 23, 42, 0.98),
      rgba(15, 23, 42, 0.94)
    ),
    radial-gradient(circle at top left, rgba(76, 81, 191, 0.4), transparent 55%);
  border-radius: 18px;
  border: 1px solid var(--border-subtle);
  padding: 16px 18px 18px;
  box-shadow: 0 18px 60px rgba(15, 23, 42, 0.9);
  margin-bottom: 14px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.card-header-actions {
  display: flex;
  gap: 8px;
}

.card-title {
  margin: 0 0 4px;
  font-size: 16px;
}

.card-subtitle {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
}

/* Buttons */

.btn-primary,
.btn-ghost,
.btn-mini {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn-primary {
  border: none;
  padding: 8px 16px;
  border-radius: 999px;
  background: linear-gradient(90deg, #6366f1, #8b5cf6);
  color: white;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(79, 70, 229, 0.5);
}

.btn-primary:hover {
  transform: translateY(-1px);
}

.btn-ghost {
  border-radius: 999px;
  border: 1px solid rgba(55, 65, 81, 0.9);
  padding: 7px 14px;
  background: transparent;
  color: var(--text-main);
  font-size: 12px;
  cursor: pointer;
}

.btn-ghost:hover {
  background: rgba(15, 23, 42, 0.92);
}

.btn-mini {
  border-radius: 999px;
  border: 1px solid rgba(55, 65, 81, 0.9);
  padding: 3px 10px;
  background: rgba(15, 23, 42, 0.94);
  color: var(--text-main);
  font-size: 11px;
  cursor: pointer;
}

/* Forms */

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 14px;
  margin-top: 14px;
}

.form-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 14px;
  align-items: flex-end;
}

.form-field label {
  display: block;
  font-size: 12px;
  margin-bottom: 4px;
  color: var(--text-muted);
}

.form-field input {
  width: 100%;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(31, 41, 55, 0.9);
  background: radial-gradient(circle at top, #020617 0, #020617 55%);
  color: var(--text-main);
  font-size: 13px;
}

.form-field input::placeholder {
  color: rgba(156, 163, 175, 0.7);
}

.form-actions {
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
}

/* Inputs with prefix/suffix */

.input-with-prefix {
  position: relative;
  display: flex;
  align-items: center;
}

.input-with-prefix input {
  padding-left: 30px;
  padding-right: 40px;
}

.input-prefix {
  position: absolute;
  left: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
}

.input-suffix {
  position: absolute;
  right: 10px;
  font-size: 11px;
  color: var(--text-muted);
}

.input-token-icon {
  width: 16px;
  height: 16px;
}

/* Misc text */

.helper-text {
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-muted);
}

.helper-text.warning {
  color: #f97316;
}

.mono-text {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
    "Liberation Mono", "Courier New", monospace;
  font-size: 12px;
}

/* Info rows */

.info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 6px 0;
  border-top: 1px solid rgba(31, 41, 55, 0.8);
  margin-top: 4px;
}

.info-row:first-of-type {
  border-top: none;
}

.info-label {
  font-size: 12px;
  color: var(--text-muted);
}

.info-value {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}

/* Status + spinner */

.status-text {
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-muted);
}

.status-text.loading .spinner {
  display: inline-block;
}

.status-text.success {
  color: var(--success);
}

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

.spinner {
  display: none;
  width: 14px;
  height: 14px;
  border-radius: 999px;
  border: 2px solid rgba(148, 163, 184, 0.4);
  border-top-color: #ffffff;
  animation: spin 0.7s linear infinite;
  margin-right: 8px;
  vertical-align: -2px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.tx-display {
  margin-top: 6px;
  font-size: 12px;
}

.tx-display a {
  color: #7c9bff;
  text-decoration: underline;
}

/* Stats */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.stat-item {
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(31, 41, 55, 0.9);
  background: radial-gradient(circle at top, #020617 0, #020617 55%);
}

.stat-label {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
}

.stat-value {
  display: block;
  margin-top: 4px;
  font-size: 13px;
}

/* Coupon table */

.table-wrapper {
  margin-top: 12px;
  border-radius: 12px;
  border: 1px solid rgba(31, 41, 55, 0.9);
  overflow: hidden;
}

.coupon-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.coupon-table thead {
  background: rgba(15, 23, 42, 0.96);
}

.coupon-table th,
.coupon-table td {
  padding: 8px 10px;
  border-bottom: 1px solid rgba(31, 41, 55, 0.9);
  text-align: left;
}

.coupon-table th {
  font-weight: 500;
  color: var(--text-muted);
}

.coupon-table tbody tr:hover {
  background: rgba(17, 24, 39, 0.8);
}

/* Generate coupon result */

.coupon-result {
  margin-top: 6px;
  padding-top: 8px;
  border-top: 1px solid rgba(31, 41, 55, 0.8);
}

.result-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 4px 0;
}

.result-label {
  font-size: 12px;
  color: var(--text-muted);
}

.result-value {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}

/* Notes */

.notes-textarea {
  margin-top: 12px;
  width: 100%;
  min-height: 180px;
  border-radius: 12px;
  border: 1px solid rgba(31, 41, 55, 0.9);
  background: radial-gradient(circle at top, #020617 0, #020617 55%);
  color: var(--text-main);
  font-size: 13px;
  padding: 10px 12px;
  resize: vertical;
}

/* ZK preview */

.preview-placeholder {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px dashed rgba(148, 163, 184, 0.7);
  background: radial-gradient(circle at top left, #0b1120 0, #020617 60%);
  font-size: 13px;
}

/* Footer */

.footer {
  margin-top: auto;
  padding-top: 4px;
  font-size: 11px;
  color: var(--text-muted);
}

/* Utilities */

.hidden {
  display: none;
}

/* Responsive (mobile: sidebar becomes top navbar) */

@media (max-width: 768px) {
  .app-shell {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    flex-direction: column;
    border-right: none;
    border-bottom: 1px solid rgba(15, 23, 42, 0.9);
  }

  .nav {
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
  }

  .nav-item {
    flex: 1;
    justify-content: center;
    font-size: 12px;
    padding-inline: 8px;
  }

  .main {
    padding: 14px 14px 16px;
  }

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

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

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

  .coupon-table {
    font-size: 11px;
  }
}
