:root {
  --bg-dark: #080c14;
  --card-bg: rgba(18, 24, 38, 0.75);
  --card-border: rgba(255, 255, 255, 0.08);
  --text-main: #f0f4f8;
  --text-muted: #8a99ad;
  --neon-green: #00f59b;
  --neon-cyan: #00d2ff;
  --neon-purple: #9d4edd;
  --neon-amber: #ffb703;
  --neon-red: #ff3366;
  --accent-glow: rgba(0, 245, 155, 0.15);
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-dark);
  background-image: 
    radial-gradient(circle at 15% 15%, rgba(0, 210, 255, 0.05) 0%, transparent 40%),
    radial-gradient(circle at 85% 85%, rgba(157, 78, 221, 0.05) 0%, transparent 40%);
  color: var(--text-main);
  font-family: var(--font-sans);
  min-height: 100vh;
  line-height: 1.5;
  padding: 24px;
}

.app-container {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 28px;
  background: var(--card-bg);
  backdrop-filter: blur(16px);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

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

.logo-icon {
  font-size: 28px;
  background: linear-gradient(135deg, var(--neon-cyan), var(--neon-green));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 12px var(--neon-cyan));
}

.brand-text h1 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

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

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.status-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 20px;
  background: rgba(0, 245, 155, 0.1);
  border: 1px solid rgba(0, 245, 155, 0.3);
  font-size: 13px;
  color: var(--neon-green);
  font-family: var(--font-mono);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--neon-green);
  box-shadow: 0 0 8px var(--neon-green);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

.chain-badges {
  display: flex;
  gap: 8px;
}

.chain-pill {
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font-mono);
}

.chain-pill.base {
  background: rgba(0, 82, 255, 0.2);
  color: #3b82f6;
  border: 1px solid rgba(59, 130, 246, 0.4);
}

.chain-pill.arb {
  background: rgba(40, 160, 240, 0.2);
  color: #28a0f0;
  border: 1px solid rgba(40, 160, 240, 0.4);
}

.btn-icon {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--card-border);
  color: var(--text-main);
  padding: 6px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.2s ease;
}

.btn-icon:hover {
  background: rgba(255, 255, 255, 0.12);
}

/* Metrics Grid */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
}

.metric-card {
  background: var(--card-bg);
  backdrop-filter: blur(12px);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 20px;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.metric-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.16);
}

.metric-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.metric-value {
  font-size: 30px;
  font-weight: 700;
  margin: 10px 0 6px 0;
  font-family: var(--font-mono);
}

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

.text-positive {
  color: var(--neon-green);
}

.text-glow-green {
  color: var(--neon-green);
  text-shadow: 0 0 16px rgba(0, 245, 155, 0.4);
}

/* Calculator Panel */
.calculator-panel {
  background: var(--card-bg);
  backdrop-filter: blur(12px);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 20px 24px;
}

.calc-header h3 {
  font-size: 16px;
  font-weight: 600;
}

.calc-sub {
  font-size: 13px;
  color: var(--text-muted);
}

.calc-body {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.calc-input-group label {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  margin-bottom: 8px;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--neon-green);
  cursor: pointer;
}

.calc-results {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  background: rgba(0, 0, 0, 0.25);
  padding: 14px 18px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.calc-res-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
}

/* Table Controls & Tabs */
.table-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.tab-filters {
  display: flex;
  gap: 10px;
}

.filter-tab {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--card-border);
  color: var(--text-muted);
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.filter-tab.active, .filter-tab:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
  border-color: var(--neon-cyan);
}

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

/* Table */
.table-container {
  background: var(--card-bg);
  backdrop-filter: blur(12px);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  overflow-x: auto;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.alpha-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.alpha-table th {
  padding: 16px 20px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--card-border);
  background: rgba(0, 0, 0, 0.2);
}

.alpha-table td {
  padding: 16px 20px;
  font-size: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  vertical-align: middle;
}

.alpha-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

/* Category Badges */
.badge-category {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
}

.badge-liq {
  background: rgba(157, 78, 221, 0.2);
  color: #c77dff;
  border: 1px solid rgba(157, 78, 221, 0.4);
}

.badge-direct {
  background: rgba(0, 210, 255, 0.2);
  color: var(--neon-cyan);
  border: 1px solid rgba(0, 210, 255, 0.4);
}

.badge-hop {
  background: rgba(255, 183, 3, 0.2);
  color: #ffb703;
  border: 1px solid rgba(255, 183, 3, 0.4);
}

.profit-pill {
  display: inline-block;
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--neon-green);
  background: rgba(0, 245, 155, 0.1);
  padding: 4px 8px;
  border-radius: 6px;
}

.asset-pill {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text-muted);
}

.empty-state td {
  text-align: center;
  color: var(--text-muted);
  padding: 40px;
}

/* Terminal Log */
.terminal-log {
  background: #05070a;
  border: 1px solid var(--card-border);
  border-radius: 12px;
  font-family: var(--font-mono);
  font-size: 12px;
  overflow: hidden;
}

.terminal-header {
  display: flex;
  justify-content: space-between;
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid var(--card-border);
  color: var(--text-muted);
}

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

.terminal-body {
  padding: 12px 16px;
  max-height: 120px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.log-line.info { color: #8a99ad; }
.log-line.success { color: var(--neon-green); }
.log-line.alert { color: var(--neon-cyan); }

/* ==================== WEB3 WALLET NAV BADGE ==================== */
.wallet-nav-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: rgba(0, 210, 255, 0.08);
  border: 1px solid rgba(0, 210, 255, 0.25);
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.25s ease;
  font-size: 13px;
}

.wallet-nav-badge:hover {
  background: rgba(0, 210, 255, 0.16);
  border-color: rgba(0, 210, 255, 0.5);
  box-shadow: 0 0 16px rgba(0, 210, 255, 0.25);
  transform: translateY(-1px);
}

.wallet-icon {
  font-size: 15px;
}

.wallet-addr {
  font-weight: 600;
  color: #fff;
  letter-spacing: -0.3px;
}

.wallet-balance-tag {
  background: rgba(0, 245, 155, 0.15);
  border: 1px solid rgba(0, 245, 155, 0.35);
  color: var(--neon-green);
  font-weight: 700;
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 6px;
}

/* ==================== SESSION KEY ARMING CONTROLS ==================== */
.session-key-container {
  display: inline-flex;
  align-items: center;
}

.btn-arm-session {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.25) 0%, rgba(168, 85, 247, 0.25) 100%);
  border: 1px solid rgba(168, 85, 247, 0.5);
  color: #c4b5fd;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s ease;
}

.btn-arm-session:hover {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.45) 0%, rgba(168, 85, 247, 0.45) 100%);
  border-color: #a855f7;
  color: #fff;
  box-shadow: 0 0 16px rgba(168, 85, 247, 0.35);
  transform: translateY(-1px);
}

.session-active-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 245, 155, 0.12);
  border: 1px solid rgba(0, 245, 155, 0.4);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 12px;
  color: var(--neon-green);
  font-weight: 600;
}

.dot-green {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--neon-green);
  box-shadow: 0 0 8px var(--neon-green);
}

.btn-disarm {
  background: none;
  border: none;
  color: var(--neon-red);
  cursor: pointer;
  font-size: 11px;
  margin-left: 6px;
  padding: 0 4px;
  text-decoration: underline;
  font-weight: 600;
  transition: opacity 0.2s;
}

.btn-disarm:hover {
  opacity: 0.8;
}

/* ==================== SLIDE-OVER WALLET DRAWER ==================== */
.wallet-drawer-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  z-index: 9998;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.wallet-drawer-overlay.open {
  opacity: 1;
  visibility: visible;
}

.wallet-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 440px;
  max-width: 92vw;
  height: 100vh;
  background: #0d121f;
  border-left: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: -10px 0 40px rgba(0, 0, 0, 0.6);
  z-index: 9999;
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.wallet-drawer.open {
  transform: translateX(0);
}

.wallet-drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--card-border);
  background: rgba(255, 255, 255, 0.02);
}

.wallet-drawer-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.wallet-avatar {
  font-size: 24px;
  background: rgba(0, 210, 255, 0.1);
  border: 1px solid rgba(0, 210, 255, 0.3);
  padding: 6px;
  border-radius: 12px;
}

.wallet-drawer-title-row h3 {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  margin: 0;
}

.badge-accent {
  display: inline-block;
  font-size: 11px;
  color: var(--neon-cyan);
  font-family: var(--font-mono);
  font-weight: 600;
}

.drawer-close-btn {
  background: none;
  border: none;
  font-size: 26px;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
  transition: color 0.2s;
}

.drawer-close-btn:hover {
  color: #fff;
}

.wallet-drawer-content {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Address Box */
.wallet-address-box {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 16px;
}

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

.address-copy-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.full-address {
  flex: 1;
  font-size: 12px;
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
  padding: 8px 10px;
  border-radius: 6px;
  word-break: break-all;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid var(--neon-cyan);
  background: rgba(0, 210, 255, 0.15);
  color: var(--neon-cyan);
  transition: all 0.2s ease;
}

.btn-sm:hover {
  background: var(--neon-cyan);
  color: #080c14;
}

.copy-feedback {
  display: none;
  color: var(--neon-green);
  font-size: 11px;
  margin-top: 6px;
  font-weight: 600;
}

.address-links-row {
  margin-top: 10px;
  display: flex;
  gap: 16px;
}

.address-links-row a {
  font-size: 11px;
  text-decoration: underline;
  transition: opacity 0.2s;
}

.text-purple-link {
  color: #a5b4fc;
}

.address-links-row a:hover {
  opacity: 0.8;
}

/* Balances Grid */
.wallet-balances-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

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

.token-balance-card.highlight-usdc {
  border-color: rgba(0, 210, 255, 0.35);
  background: rgba(0, 210, 255, 0.04);
}

.token-balance-card.highlight-eth {
  border-color: rgba(0, 245, 155, 0.35);
  background: rgba(0, 245, 155, 0.04);
}

.token-balance-card.highlight-mainnet {
  border-color: rgba(168, 85, 247, 0.3);
  background: rgba(168, 85, 247, 0.04);
}

.token-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.token-name {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.network-tag {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(0, 210, 255, 0.2);
  color: var(--neon-cyan);
  font-family: var(--font-mono);
}

.network-tag.l1-tag {
  background: rgba(168, 85, 247, 0.2);
  color: #c4b5fd;
}

.token-amount {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
}

.token-usd-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Deposit Tip */
.deposit-tip-box {
  background: rgba(255, 183, 3, 0.06);
  border: 1px solid rgba(255, 183, 3, 0.25);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 12px;
  color: #ffd166;
  line-height: 1.5;
}

.deposit-tip-box strong {
  color: #ffb703;
}

.deposit-tip-box p {
  margin-top: 4px;
  color: rgba(255, 255, 255, 0.85);
}

/* Withdrawal Card */
.wallet-withdraw-card {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 18px;
}

.withdraw-card-header h4 {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 14px;
}

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

.form-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-row label, .form-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
}

.form-select, .form-input {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  padding: 10px 12px;
  color: #fff;
  font-family: inherit;
  font-size: 13px;
  transition: border-color 0.2s;
  outline: none;
}

.form-select option {
  background: #0d121f;
  color: #fff;
}

.form-select:focus, .form-input:focus {
  border-color: var(--neon-cyan);
  box-shadow: 0 0 10px rgba(0, 210, 255, 0.2);
}

.label-with-action {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.btn-text-action {
  background: none;
  border: none;
  color: var(--neon-cyan);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
}

.key-status-hint {
  font-size: 11px;
  color: var(--neon-cyan);
  margin-top: 2px;
}

.key-status-hint.text-emerald {
  color: var(--neon-green);
}

.withdraw-result-box {
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.4;
  word-break: break-all;
}

.withdraw-result-box.success {
  background: rgba(0, 245, 155, 0.12);
  border: 1px solid rgba(0, 245, 155, 0.4);
  color: var(--neon-green);
}

.withdraw-result-box.error {
  background: rgba(255, 51, 102, 0.12);
  border: 1px solid rgba(255, 51, 102, 0.4);
  color: var(--neon-red);
}

.btn-submit-withdraw {
  background: linear-gradient(135deg, var(--neon-cyan) 0%, #4facfe 100%);
  border: 1px solid var(--neon-cyan);
  color: #080c14;
  font-weight: 700;
  font-size: 14px;
  padding: 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-top: 6px;
}

.btn-submit-withdraw:hover {
  box-shadow: 0 4px 16px rgba(0, 210, 255, 0.4);
  transform: translateY(-1px);
}

.btn-submit-withdraw:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* ==================== MODAL STYLES ==================== */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.25s ease;
}

.modal.open {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  background: #0d121f;
  border: 1px solid rgba(168, 85, 247, 0.4);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.6), 0 0 24px rgba(168, 85, 247, 0.2);
  border-radius: 16px;
  width: 520px;
  max-width: 92vw;
  overflow: hidden;
  animation: modalScaleUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalScaleUp {
  from { transform: scale(0.92); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 20px 24px;
  border-bottom: 1px solid var(--card-border);
  background: rgba(255, 255, 255, 0.02);
}

.modal-title {
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
}

.close-btn {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
  transition: color 0.2s;
}

.close-btn:hover {
  color: #fff;
}

.modal-body {
  padding: 24px;
}

.arm-info-box {
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.25);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 20px;
}

.arm-info-intro {
  font-size: 13px;
  color: var(--text-main);
  line-height: 1.5;
  margin-bottom: 10px;
}

.arm-info-list {
  font-size: 12px;
  color: var(--text-muted);
  margin: 0;
  padding-left: 18px;
  line-height: 1.6;
}

.arm-info-list strong {
  color: #c4b5fd;
}

.btn-submit-arm {
  width: 100%;
  padding: 14px;
  font-size: 15px;
  font-weight: 700;
  background: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
  border: 1px solid #a855f7;
  border-radius: 8px;
  color: #fff;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-submit-arm:hover {
  box-shadow: 0 4px 20px rgba(168, 85, 247, 0.4);
  transform: translateY(-1px);
}

.btn-submit-arm:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* ==================== AUTOPILOT PANEL ==================== */
.autopilot-panel {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px;
  background: rgba(18, 24, 38, 0.85);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(0, 210, 255, 0.25);
  border-radius: 16px;
  padding: 18px 24px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}

.autopilot-left {
  display: flex;
  align-items: center;
}

.autopilot-toggle-row {
  display: flex;
  align-items: center;
  gap: 16px;
}

.autopilot-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.autopilot-title-row h3 {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
}

.autopilot-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.badge-status-inactive {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 12px;
  font-family: var(--font-mono);
}

.badge-status-active {
  background: rgba(0, 245, 155, 0.15);
  border: 1px solid rgba(0, 245, 155, 0.45);
  color: var(--neon-green);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 12px;
  font-family: var(--font-mono);
  box-shadow: 0 0 10px rgba(0, 245, 155, 0.3);
}

/* Toggle Switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 28px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.15);
  transition: .3s;
  border-radius: 28px;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background-color: #fff;
  transition: .3s;
  border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
  background-color: var(--neon-green);
  border-color: var(--neon-green);
  box-shadow: 0 0 14px rgba(0, 245, 155, 0.4);
}

.toggle-switch input:checked + .toggle-slider:before {
  transform: translateX(22px);
  background-color: #080c14;
}

/* Autopilot Controls */
.autopilot-controls {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

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

.control-group label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
}

.input-prefix-box {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  padding: 4px 8px;
  gap: 4px;
}

.input-prefix-box span {
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.input-mini {
  background: transparent;
  border: none;
  color: #fff;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  width: 65px;
  outline: none;
}

.btn-action-test {
  padding: 8px 14px;
  background: linear-gradient(135deg, rgba(0, 210, 255, 0.15) 0%, rgba(0, 245, 155, 0.15) 100%);
  border: 1px solid var(--neon-cyan);
  color: var(--neon-cyan);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-action-test:hover {
  background: var(--neon-cyan);
  color: #080c14;
  box-shadow: 0 0 14px rgba(0, 210, 255, 0.35);
  transform: translateY(-1px);
}

.btn-action-upgrade {
  padding: 8px 14px;
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.2) 0%, rgba(236, 72, 153, 0.2) 100%);
  border: 1px solid #c084fc;
  color: #e9d5ff;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-action-upgrade:hover {
  background: linear-gradient(135deg, #a855f7 0%, #ec4899 100%);
  color: #fff;
  box-shadow: 0 0 14px rgba(168, 85, 247, 0.4);
  transform: translateY(-1px);
}

/* Table Action Buttons */
.table-action-cell {
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-table-simulate {
  padding: 4px 8px;
  background: rgba(0, 210, 255, 0.1);
  border: 1px solid rgba(0, 210, 255, 0.35);
  color: var(--neon-cyan);
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn-table-simulate:hover {
  background: rgba(0, 210, 255, 0.25);
  border-color: var(--neon-cyan);
}

.btn-table-execute {
  padding: 4px 10px;
  background: linear-gradient(135deg, rgba(0, 245, 155, 0.2) 0%, rgba(0, 210, 255, 0.2) 100%);
  border: 1px solid rgba(0, 245, 155, 0.5);
  color: var(--neon-green);
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn-table-execute:hover {
  background: var(--neon-green);
  color: #080c14;
  box-shadow: 0 0 12px rgba(0, 245, 155, 0.4);
}

/* ==================== POOLS MONITOR PANEL (TICK-BY-TICK) ==================== */
.pools-monitor-panel {
  background: rgba(13, 20, 36, 0.7);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(0, 210, 255, 0.2);
  border-radius: 14px;
  padding: 16px 20px;
  margin-bottom: 24px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.pools-monitor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  flex-wrap: wrap;
  gap: 8px;
}

.pools-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pools-title-row h3 {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.2px;
}

.live-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--neon-cyan);
  box-shadow: 0 0 8px var(--neon-cyan);
  animation: pulse-glow 1.5s infinite;
}

/* ==================== RADAR SPREAD LIVE DEI PERCORSI ==================== */
.spreads-radar-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
}

.spread-card {
  background: rgba(18, 26, 43, 0.7);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: all 0.25s ease;
  position: relative;
  overflow: hidden;
}

.spread-card:hover {
  transform: translateY(-2px);
  border-color: rgba(0, 210, 255, 0.4);
}

.spread-card.opportunity {
  border-color: rgba(0, 245, 155, 0.7);
  box-shadow: 0 0 22px rgba(0, 245, 155, 0.25), inset 0 0 16px rgba(0, 245, 155, 0.06);
  background: rgba(0, 245, 155, 0.03);
}

.spread-card.expanding {
  border-color: rgba(255, 179, 0, 0.5);
  box-shadow: 0 0 16px rgba(255, 179, 0, 0.15);
}

.spread-card.compressed {
  border-color: rgba(255, 255, 255, 0.06);
}

.spread-card.illiquid {
  opacity: 0.55;
  border-color: rgba(239, 68, 68, 0.2);
  filter: grayscale(20%);
}

.spread-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.spread-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.spread-name {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.2px;
}

.flash-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(0, 210, 255, 0.12);
  color: var(--neon-cyan);
  border: 1px solid rgba(0, 210, 255, 0.3);
  font-family: var(--font-mono);
}

.spread-pill {
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.spread-pill.opportunity {
  background: rgba(0, 245, 155, 0.2);
  color: var(--neon-green);
  border: 1px solid var(--neon-green);
  box-shadow: 0 0 8px rgba(0, 245, 155, 0.4);
}

.spread-pill.expanding {
  background: rgba(255, 179, 0, 0.2);
  color: #ffb300;
  border: 1px solid #ffb300;
}

.spread-pill.compressed {
  background: rgba(255, 255, 255, 0.05);
  color: #94a3b8;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.spread-pill.illiquid {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.spread-venues-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 8px;
  padding: 8px 12px;
  font-family: var(--font-mono);
}

.venue-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.venue-name {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-weight: 500;
}

.venue-price {
  font-size: 12px;
  font-weight: 700;
  color: #f1f5f9;
}

.venue-vs {
  font-size: 10px;
  font-weight: 800;
  color: #64748b;
  padding: 0 6px;
}

.spread-metrics-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  align-items: center;
  padding: 4px 0;
}

.metric-col {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.metric-col .metric-lbl {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.metric-col .metric-val {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 700;
}

.metric-col .metric-val.gross {
  color: #fff;
}

.metric-col .metric-val.hurdle {
  color: #94a3b8;
}

.metric-col .metric-val.net-pos {
  color: var(--neon-green);
  text-shadow: 0 0 8px rgba(0, 245, 155, 0.4);
}

.metric-col .metric-val.net-neg {
  color: #64748b;
}

.spread-bar-container {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  position: relative;
  overflow: hidden;
}

.spread-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.4s ease;
}

.spread-footer-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--text-muted);
  padding-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.spread-direction {
  font-size: 11px;
  color: #94a3b8;
  font-family: var(--font-mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 240px;
}

.spread-depth {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--neon-cyan);
}

/* ==================== EXECUTION HISTORY PANEL ==================== */
.execution-history-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 18px 22px;
  margin-bottom: 24px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

.execution-history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.execution-history-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.execution-history-title h3 {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  margin: 0;
}

.badge-history-count {
  background: rgba(0, 245, 155, 0.12);
  border: 1px solid var(--neon-green);
  color: var(--neon-green);
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: 600;
}

.btn-refresh-history {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-main);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-refresh-history:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.3);
}

.history-table-container {
  max-height: 260px;
  overflow-y: auto;
}

.badge-confirmed {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(0, 245, 155, 0.15);
  border: 1px solid var(--neon-green);
  color: var(--neon-green);
  font-size: 11px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 6px;
  font-family: var(--font-mono);
}

.badge-broadcasted {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(255, 183, 3, 0.15);
  border: 1px solid #ffb703;
  color: #ffb703;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 6px;
  font-family: var(--font-mono);
}

.badge-reverted {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(255, 0, 85, 0.15);
  border: 1px solid var(--neon-red);
  color: var(--neon-red);
  font-size: 11px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 6px;
  font-family: var(--font-mono);
}

.history-badge-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.badge-missed-count {
  background: rgba(255, 183, 3, 0.12);
  border: 1px solid rgba(255, 183, 3, 0.5);
  color: #ffb703;
}

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

.history-filter-tabs {
  display: flex;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 2px;
  gap: 2px;
}

.history-tab-btn {
  background: transparent;
  border: none;
  color: #a0aec0;
  font-size: 11px;
  font-weight: 600;
  padding: 5px 11px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.history-tab-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
}

.history-tab-btn.active {
  background: rgba(0, 245, 155, 0.15);
  color: var(--neon-green);
  border: 1px solid rgba(0, 245, 155, 0.3);
}

.history-tab-btn.active[data-filter="missed"] {
  background: rgba(255, 183, 3, 0.15);
  color: #ffb703;
  border: 1px solid rgba(255, 183, 3, 0.4);
}

.badge-missed {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(255, 183, 3, 0.15);
  border: 1px solid #ffb703;
  color: #ffb703;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 6px;
  font-family: var(--font-mono);
}

.missed-reason-text {
  max-width: 320px;
  font-size: 12px;
  color: #e2e8f0;
  line-height: 1.35;
  white-space: normal;
  word-break: break-word;
}

.tx-hash-link {
  font-family: var(--font-mono);
  color: var(--neon-cyan);
  text-decoration: none;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.tx-hash-link:hover {
  text-decoration: underline;
  color: #fff;
}

/* ==================== MORPHO AT-RISK RADAR PANEL ==================== */
.morpho-atrisk-panel {
  background: var(--card-bg);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 159, 10, 0.25);
  border-radius: 16px;
  padding: 24px;
  margin-top: 24px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.morpho-atrisk-header {
  margin-bottom: 16px;
}

.morpho-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.live-indicator-orange {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ff9500;
  box-shadow: 0 0 10px #ff9500;
  animation: pulse-orange 1.5s infinite;
}

@keyframes pulse-orange {
  0% { transform: scale(0.9); opacity: 0.8; }
  50% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.8; }
}

.badge-morpho-count {
  background: rgba(255, 149, 0, 0.15);
  border: 1px solid rgba(255, 149, 0, 0.4);
  color: #ff9500;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font-mono);
}

.morpho-filter-pills {
  margin-left: auto;
  display: flex;
  gap: 8px;
}

.morpho-pill-filter {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--card-border);
  color: var(--text-muted);
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.morpho-pill-filter:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
}

.morpho-pill-filter.active {
  background: rgba(255, 149, 0, 0.2);
  border-color: #ff9500;
  color: #ff9500;
  font-weight: 600;
}

.badge-risk {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  font-family: var(--font-mono);
  white-space: nowrap;
}

.badge-risk.badge-critical {
  background: rgba(255, 59, 48, 0.25);
  border: 1px solid #ff3b30;
  color: #ff3b30;
}

.badge-risk.badge-extreme {
  background: rgba(255, 69, 58, 0.2);
  border: 1px solid #ff453a;
  color: #ff453a;
}

.badge-risk.badge-high {
  background: rgba(255, 149, 0, 0.2);
  border: 1px solid #ff9500;
  color: #ff9500;
}

.badge-risk.badge-warning {
  background: rgba(255, 214, 10, 0.15);
  border: 1px solid #ffd60a;
  color: #ffd60a;
}

.badge-risk.badge-safe {
  background: rgba(52, 199, 89, 0.15);
  border: 1px solid #34c759;
  color: #34c759;
}

.pulse-alert {
  animation: pulse-red-row 1.2s infinite;
}

@keyframes pulse-red-row {
  0% { box-shadow: 0 0 4px rgba(255, 59, 48, 0.4); }
  50% { box-shadow: 0 0 12px rgba(255, 59, 48, 0.8); }
  100% { box-shadow: 0 0 4px rgba(255, 59, 48, 0.4); }
}

.row-critical {
  background: rgba(255, 59, 48, 0.05);
}

.borrower-link {
  color: var(--neon-cyan);
  text-decoration: none;
  font-weight: 600;
  transition: all 0.2s ease;
}

.borrower-link:hover {
  text-decoration: underline;
  color: #fff;
}

.badge-status-watching {
  display: inline-block;
  font-size: 11px;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--card-border);
  padding: 3px 8px;
  border-radius: 4px;
  font-family: var(--font-mono);
}

.badge-bonus {
  background: rgba(0, 245, 155, 0.1);
  border: 1px solid rgba(0, 245, 155, 0.25);
  color: var(--neon-green);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
}

.badge-tier {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
  font-family: var(--font-mono);
  white-space: nowrap;
}
.badge-tier.t0 {
  background: rgba(255, 0, 85, 0.2);
  border: 1px solid var(--neon-red);
  color: var(--neon-red);
  box-shadow: 0 0 6px rgba(255, 0, 85, 0.4);
}
.badge-tier.t1 {
  background: rgba(255, 59, 48, 0.15);
  border: 1px solid rgba(255, 59, 48, 0.4);
  color: #ff3b30;
}

.badge-tier.t2 {
  background: rgba(255, 149, 0, 0.15);
  border: 1px solid rgba(255, 149, 0, 0.4);
  color: #ff9500;
}
.badge-tier.t3 {
  background: rgba(52, 199, 89, 0.15);
  border: 1px solid rgba(52, 199, 89, 0.3);
  color: #34c759;
}

