/* ── Base & Tokens ─────────────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #0a0b0f;
  --bg2: #111318;
  --bg3: #181b22;
  --border: rgba(255, 255, 255, 0.07);
  --border2: rgba(255, 255, 255, 0.12);
  --text: #e8eaf0;
  --text2: #8b909e;
  --text3: #555b6e;
  --purple: #7c3aed;
  --purple-l: #a855f7;
  --purple-dim: rgba(124, 58, 237, 0.15);
  --green: #22c55e;
  --green-dim: rgba(34, 197, 94, 0.12);
  --yellow: #eab308;
  --yellow-dim: rgba(234, 179, 8, 0.12);
  --red: #ef4444;
  --red-dim: rgba(239, 68, 68, 0.12);
  --cyan: #22d3ee;
  --radius: 12px;
  --radius-sm: 8px;
  --font: 'Inter', system-ui, sans-serif;
  --mono: 'JetBrains Mono', monospace;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 48px rgba(0, 0, 0, 0.6);
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ── Header ──────────────────────────────────────────────────────── */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  height: 60px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  font-size: 22px;
  filter: drop-shadow(0 0 8px var(--purple-l));
}

.logo-text {
  font-size: 20px;
  font-weight: 300;
  letter-spacing: -0.5px;
}

.logo-text strong {
  color: var(--purple-l);
  font-weight: 700;
}

.badge {
  background: var(--purple-dim);
  color: var(--purple-l);
  border: 1px solid var(--purple);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  padding: 2px 8px;
  border-radius: 100px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.network-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
  animation: pulse 2s infinite;
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1
  }

  50% {
    opacity: 0.5
  }
}

.network-label {
  font-size: 13px;
  color: var(--text2);
}

/* ── Steps Bar ───────────────────────────────────────────────────── */
.steps-bar {
  display: flex;
  align-items: center;
  padding: 0 32px;
  height: 52px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
}

.steps-bar::-webkit-scrollbar {
  display: none;
}

.step {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text3);
  white-space: nowrap;
  padding: 4px 12px;
  border-radius: 100px;
  transition: all .2s;
  cursor: default;
}

.step.active {
  color: var(--purple-l);
  background: var(--purple-dim);
}

.step.done {
  color: var(--green);
}

.step-num {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}

.step.active .step-num {
  background: var(--purple);
  color: #fff;
}

.step.done .step-num {
  background: var(--green);
  color: #000;
}

.step-line {
  flex: 1;
  height: 1px;
  background: var(--border);
  min-width: 20px;
}

/* ── Main Layout ─────────────────────────────────────────────────── */
.main {
  max-width: 880px;
  margin: 0 auto;
  padding: 32px 24px 80px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ── Panel ───────────────────────────────────────────────────────── */
.panel {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  animation: fadeUp .3s ease both;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(12px)
  }

  to {
    opacity: 1;
    transform: none
  }
}

.panel-header {
  margin-bottom: 24px;
}

.panel-title {
  font-size: 18px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.panel-icon {
  font-size: 20px;
}

.panel-desc {
  font-size: 14px;
  color: var(--text2);
}

/* ── Forms / Inputs ──────────────────────────────────────────────── */
.input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  padding: 10px 14px;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}

.input:focus {
  border-color: var(--purple);
  box-shadow: 0 0 0 3px var(--purple-dim);
}

.input::placeholder {
  color: var(--text3);
}

.input.mono {
  font-family: var(--mono);
  font-size: 13px;
}

.input-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--text2);
  margin-bottom: 6px;
}

.req {
  color: var(--red);
}

.field-hint {
  font-size: 12px;
  color: var(--text3);
  margin-top: 5px;
  display: block;
}

/* ── Buttons ─────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: all .18s;
  text-decoration: none;
  white-space: nowrap;
}

.btn:active {
  transform: scale(.97);
}

.btn-primary {
  background: linear-gradient(135deg, var(--purple), var(--purple-l));
  color: #fff;
  box-shadow: 0 2px 12px rgba(124, 58, 237, .35);
}

.btn-primary:hover {
  box-shadow: 0 4px 20px rgba(124, 58, 237, .5);
  filter: brightness(1.1);
}

.btn-secondary {
  background: var(--bg3);
  color: var(--text);
  border: 1px solid var(--border2);
}

.btn-secondary:hover {
  border-color: var(--purple);
  color: var(--purple-l);
}

.btn-outline {
  background: transparent;
  color: var(--purple-l);
  border: 1px solid var(--purple);
}

.btn-outline:hover {
  background: var(--purple-dim);
}

.btn-ghost {
  background: transparent;
  color: var(--text2);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  border-color: var(--border2);
  color: var(--text);
}

.btn-danger {
  background: var(--red);
  color: #fff;
}

.btn-danger:hover {
  filter: brightness(1.1);
}

.btn-danger-ghost {
  background: transparent;
  color: var(--red);
  border: 1px solid var(--red-dim);
}

.btn-danger-ghost:hover {
  background: var(--red-dim);
}

.btn-success {
  background: linear-gradient(135deg, #16a34a, var(--green));
  color: #fff;
  box-shadow: 0 2px 12px rgba(34, 197, 94, .3);
}

.btn-success:hover {
  box-shadow: 0 4px 20px rgba(34, 197, 94, .5);
  filter: brightness(1.1);
}

.badge.mainnet {
  background: rgba(34, 197, 94, 0.12);
  color: var(--green);
  border-color: var(--green);
}

.network-dot.mainnet {
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
}


.icon-btn {
  background: transparent;
  border: none;
  color: var(--text2);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 16px;
  transition: all .15s;
}

.icon-btn:hover {
  background: var(--bg3);
  color: var(--text);
}

.btn-start {
  min-width: 160px;
  justify-content: center;
  font-size: 15px;
  padding: 12px 24px;
}

/* ── Central Wallet Display ──────────────────────────────────────── */
.wallet-display {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 16px;
}

.wallet-addr-row,
.balance-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--text3);
  min-width: 70px;
}

.addr-box {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
}

.mono {
  font-family: var(--mono);
  font-size: 13px;
  word-break: break-all;
}

.balance-val {
  font-size: 22px;
  font-weight: 700;
  color: var(--green);
  letter-spacing: -0.5px;
}

.btn-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.action-zone {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ── Divider ─────────────────────────────────────────────────────── */
.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text3);
  font-size: 12px;
}

.divider::before,
.divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.input-group {
  display: flex;
  gap: 10px;
  align-items: stretch;
}

.input-group .input {
  flex: 1;
}

.mb-16 {
  margin-bottom: 16px;
}

/* ── Wallets Table ───────────────────────────────────────────────── */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.table th {
  padding: 10px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--text3);
  border-bottom: 1px solid var(--border);
}

.table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.table tbody tr:hover {
  background: var(--bg3);
}

.table tbody tr:last-child td {
  border-bottom: none;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .4px;
  padding: 3px 10px;
  border-radius: 100px;
}

.status-chip.funded {
  background: var(--green-dim);
  color: var(--green);
}

.status-chip.unfunded {
  background: var(--border);
  color: var(--text3);
}

/* Successor generated ahead of time, waiting for its predecessor's sell to land. */
.status-chip.pending {
  background: var(--yellow-dim);
  color: var(--yellow);
}

/* Wallet retired by a rotation — kept and recoverable, but out of the bot's rotation. */
.status-chip.retired {
  background: var(--red-dim);
  color: var(--red);
}

.empty-state {
  text-align: center;
  color: var(--text3);
  font-size: 14px;
  padding: 40px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

/* ── Fund Mode Tabs ───────────────────────────────────────────────── */
.fund-mode-tabs {
  display: flex;
  background: var(--bg);
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  padding: 3px;
  width: fit-content;
  margin-bottom: 16px;
}

.fund-tab {
  background: transparent;
  border: none;
  color: var(--text2);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  padding: 7px 18px;
  border-radius: 6px;
  cursor: pointer;
  transition: all .15s;
}

.fund-tab.active {
  background: var(--purple);
  color: #fff;
  box-shadow: 0 2px 8px rgba(124, 58, 237, .4);
}

.fund-tab:not(.active):hover {
  color: var(--text);
  background: var(--bg3);
}

.fund-preview {
  font-size: 13px;
  color: var(--cyan);
  font-family: var(--mono);
  min-height: 20px;
  align-self: center;
  padding: 0 4px;
}

/* ── Fund Controls ───────────────────────────────────────────────── */
.fund-controls {
  display: flex;
  gap: 14px;
  align-items: flex-end;
  flex-wrap: wrap;
  margin-bottom: 12px;
}


.fund-controls .input-group {
  flex-direction: column;
  min-width: 160px;
}

.fund-controls .input-group .input {
  min-width: 140px;
}

.fund-note {
  font-size: 13px;
  color: var(--text3);
}

/* ── Bot Form ────────────────────────────────────────────────────── */
.bot-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.form-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-section-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text2);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-field {
  display: flex;
  flex-direction: column;
}

.form-field.full-width {
  grid-column: 1 / -1;
}

.form-divider {
  height: 1px;
  background: var(--border);
}

.contract-input-wrap {
  display: flex;
  gap: 10px;
}

.contract-input-wrap .input {
  flex: 1;
}

/* ── Bot Controls ────────────────────────────────────────────────── */
.bot-controls {
  display: flex;
  gap: 12px;
  align-items: center;
}

/* ── Stats Row ───────────────────────────────────────────────────── */
.stats-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
}

.stat-chip {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 80px;
}

.stat-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--text3);
}

.stat-val {
  font-size: 18px;
  font-weight: 700;
  color: var(--cyan);
  font-family: var(--mono);
}

/* ── Console ─────────────────────────────────────────────────────── */
.console-panel {
  margin-top: 20px;
  background: #080a0d;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.console-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: var(--bg3);
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  font-weight: 600;
}

.console-body {
  padding: 16px;
  height: 320px;
  overflow-y: auto;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.8;
  scroll-behavior: smooth;
}

.console-body::-webkit-scrollbar {
  width: 6px;
}

.console-body::-webkit-scrollbar-track {
  background: transparent;
}

.console-body::-webkit-scrollbar-thumb {
  background: var(--border2);
  border-radius: 3px;
}

.console-line {
  padding: 1px 0;
}

.console-line.dim {
  color: var(--text3);
}

.console-line.info {
  color: var(--cyan);
}

.console-line.success {
  color: var(--green);
}

.console-line.warn {
  color: var(--yellow);
}

.console-line.error {
  color: var(--red);
}

.console-line.stat {
  color: var(--purple-l);
}

.console-line .ts {
  color: var(--text3);
  margin-right: 8px;
}

/* ── Toast ───────────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 999;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  font-size: 14px;
  box-shadow: var(--shadow-lg);
  min-width: 280px;
  max-width: 420px;
  animation: slideIn .3s ease;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(20px)
  }

  to {
    opacity: 1;
    transform: none
  }
}

.toast.success .toast-icon {
  color: var(--green);
}

.toast.error .toast-icon {
  color: var(--red);
}

.toast.warn .toast-icon {
  color: var(--yellow);
}

.toast.info .toast-icon {
  color: var(--cyan);
}

.toast-msg {
  flex: 1;
  line-height: 1.4;
}

/* ── Modal ───────────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  animation: fadeIn .2s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0
  }

  to {
    opacity: 1
  }
}

.modal {
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  padding: 32px;
  width: 360px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: scaleIn .2s ease;
}

@keyframes scaleIn {
  from {
    transform: scale(.9)
  }

  to {
    transform: scale(1)
  }
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
}

.modal-desc {
  font-size: 14px;
  color: var(--text2);
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* ── Wallet detail modal ─────────────────────────────────────────── */
.modal.modal-wide {
  width: min(860px, 94vw);
  max-height: 88vh;
  overflow-y: auto;
}

.wallet-modal-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.wallet-modal-head code {
  font-size: 12px;
  color: var(--text2);
  word-break: break-all;
}

.wallet-modal-bal {
  font-size: 13px;
  color: var(--text2);
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}

.wallet-modal-bal span {
  color: var(--cyan);
  font-weight: 600;
}

.modal.modal-wide .modal-actions {
  flex-wrap: wrap;
}

/* ── Responsive ──────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .main {
    padding: 20px 16px 60px;
  }

  .panel {
    padding: 20px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .header {
    padding: 0 16px;
  }

  .steps-bar {
    padding: 0 16px;
  }
}