/* ARC AI Agents - Estilos customizados | build: 20250326d */

/* ─────────────────────────────────────────────────────────────────────────────
   CHAT WIDGET — Interaction safety rules
   The chat panel must NEVER block underlying UI when closed.
   pointer-events:none is the primary guard; display:none (Tailwind .hidden) is
   the secondary guard.  Both are applied so neither can cause a regression.
   ───────────────────────────────────────────────────────────────────────────── */
#chat-widget.hidden {
  pointer-events: none !important;
  visibility: hidden !important;
}
#chat-widget[data-chat-closing="true"] {
  pointer-events: none !important;
}
/* When the widget is fully open (not hidden, not closing) restore interaction */
#chat-widget:not(.hidden):not([data-chat-closing="true"]) {
  pointer-events: auto !important;
  visibility: visible !important;
}

/* ── CSS Variables ────────────────────────────────────────────────────────── */
:root {
  /* Height of the sticky top-bar (banner + header). Updated by updateTopbarHeight().
     Used as the `top` value for the tab nav so it always sticks just below the
     top-bar regardless of whether the banner is visible or not. */
  --topbar-h: 0px;
}

/* ── Sticky top-bar: banner + header wrapper ─────────────────────────────── */
#sticky-topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  /* Ensure the wrapper never collapses to zero when banner is hidden */
  min-height: 0;
}

/* ── Testnet banner collapse transition ──────────────────────────────────── */
#testnet-banner {
  overflow: hidden;
  /* Smooth collapse handled by JS (max-height + opacity + padding) */
}

/* ── Tab navigation ──────────────────────────────────────────────────────── */
#tab-nav {
  position: sticky;
  /* top is set inline via var(--topbar-h) and updated by updateTopbarHeight() */
  z-index: 40;
  /* Ensure the tab bar is never hidden behind other elements */
  isolation: isolate;
}

/* Scrollable tab bar on small screens */
.tab-nav-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none; /* Firefox */
}
.tab-nav-wrapper::-webkit-scrollbar { display: none; }

/* Animações */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideIn {
  from { opacity: 0; transform: translateX(-10px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 5px rgba(139, 92, 246, 0.3); }
  50% { box-shadow: 0 0 20px rgba(139, 92, 246, 0.7); }
}

@keyframes thinking {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.1); opacity: 0.7; }
}

@keyframes spin-slow {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes modal-in {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* Tab content transitions */
.tab-content {
  animation: fadeIn 0.3s ease;
}

/* Tab buttons */
.tab-btn.active {
  color: #a78bfa;
  border-color: #7c3aed;
}

/* Cards de estatística */
.stat-card {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

/* Step cards */
.step-card {
  background: linear-gradient(135deg, rgba(17, 24, 39, 0.8), rgba(31, 41, 55, 0.6));
  transition: border-color 0.2s ease;
}

.step-card:hover {
  border-color: rgba(139, 92, 246, 0.5);
}

/* Status badges */
.status-draft { background: rgba(75, 85, 99, 0.4); color: #9ca3af; border: 1px solid rgba(75, 85, 99, 0.5); }
.status-active { background: rgba(16, 185, 129, 0.15); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.4); }
.status-completed { background: rgba(59, 130, 246, 0.15); color: #60a5fa; border: 1px solid rgba(59, 130, 246, 0.4); }
.status-disputed { background: rgba(239, 68, 68, 0.15); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.4); }
.status-cancelled { background: rgba(107, 114, 128, 0.15); color: #9ca3af; border: 1px solid rgba(107, 114, 128, 0.4); }

/* Payment status */
.pay-pending { background: rgba(251, 191, 36, 0.15); color: #fbbf24; border: 1px solid rgba(251, 191, 36, 0.4); }
.pay-executed { background: rgba(16, 185, 129, 0.15); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.4); }
.pay-rejected { background: rgba(239, 68, 68, 0.15); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.4); }
.pay-analyzing { background: rgba(139, 92, 246, 0.15); color: #a78bfa; border: 1px solid rgba(139, 92, 246, 0.4); }

/* Agent status */
.agent-idle { color: #34d399; }
.agent-thinking { color: #a78bfa; animation: thinking 1s ease infinite; }
.agent-executing { color: #60a5fa; }
.agent-error { color: #f87171; }

/* Milestone progress bar */
.milestone-bar {
  height: 4px;
  border-radius: 2px;
  background: rgba(75, 85, 99, 0.5);
  overflow: hidden;
}

.milestone-fill {
  height: 100%;
  border-radius: 2px;
  background: linear-gradient(90deg, #7c3aed, #3b82f6);
  transition: width 0.5s ease;
}

/* Risk level indicators */
.risk-low { color: #34d399; }
.risk-medium { color: #fbbf24; }
.risk-high { color: #f97316; }
.risk-critical { color: #f87171; }

/* Code blocks */
pre code {
  font-family: 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
  font-size: 0.78rem;
  line-height: 1.6;
}

/* Scrollbar customizado */
::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}

::-webkit-scrollbar-track {
  background: rgba(31, 41, 55, 0.5);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb {
  background: rgba(139, 92, 246, 0.5);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(139, 92, 246, 0.8);
}

/* Toast notification */
#toast {
  transition: all 0.3s ease;
}

/* Glow effect para agentes ativos */
.agent-glow {
  animation: pulse-glow 2s ease infinite;
}

/* Contract card hover */
.contract-card {
  transition: all 0.2s ease;
}

.contract-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

/* ============================================================
   WALLET STYLES
   ============================================================ */

/* Botão conectar com pulso */
.wallet-connect-pulse {
  position: relative;
  overflow: hidden;
}

.wallet-connect-pulse::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: rgba(139, 92, 246, 0.4);
  animation: wallet-ring 2s ease-out infinite;
  pointer-events: none;
}

@keyframes wallet-ring {
  0% { transform: scale(1); opacity: 0.6; }
  100% { transform: scale(1.6); opacity: 0; }
}

/* Modal de wallet */
.animate-modal-in {
  animation: modal-in 0.25s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* Botão de provedor com hover */
.wallet-provider-btn {
  transition: all 0.2s ease;
}

.wallet-provider-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(139, 92, 246, 0.2);
}

/* Wallet info no header */
#wallet-info {
  transition: all 0.2s ease;
}

#wallet-info:hover {
  box-shadow: 0 0 0 1px rgba(139, 92, 246, 0.4);
}

/* Avatar da wallet */
#wallet-avatar {
  font-size: 10px;
  letter-spacing: -0.5px;
}

/* Indicador de rede no header */
#wallet-network-display {
  cursor: default;
}

/* Painel de wallet */
#wallet-panel {
  min-height: 80px;
}

/* Responsive */
@media (max-width: 640px) {
  .tab-btn {
    padding: 12px 12px;
    font-size: 12px;
  }

  .tab-btn span {
    display: none;
  }
}


/* Animações */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideIn {
  from { opacity: 0; transform: translateX(-10px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 5px rgba(139, 92, 246, 0.3); }
  50% { box-shadow: 0 0 20px rgba(139, 92, 246, 0.7); }
}

@keyframes thinking {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.1); opacity: 0.7; }
}

@keyframes spin-slow {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Tab content transitions */
.tab-content {
  animation: fadeIn 0.3s ease;
}

/* Tab buttons */
.tab-btn.active {
  color: #a78bfa;
  border-color: #7c3aed;
}

/* Cards de estatística */
.stat-card {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

/* Step cards */
.step-card {
  background: linear-gradient(135deg, rgba(17, 24, 39, 0.8), rgba(31, 41, 55, 0.6));
  transition: border-color 0.2s ease;
}

.step-card:hover {
  border-color: rgba(139, 92, 246, 0.5);
}

/* Status badges */
.status-draft { background: rgba(75, 85, 99, 0.4); color: #9ca3af; border: 1px solid rgba(75, 85, 99, 0.5); }
.status-active { background: rgba(16, 185, 129, 0.15); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.4); }
.status-completed { background: rgba(59, 130, 246, 0.15); color: #60a5fa; border: 1px solid rgba(59, 130, 246, 0.4); }
.status-disputed { background: rgba(239, 68, 68, 0.15); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.4); }
.status-cancelled { background: rgba(107, 114, 128, 0.15); color: #9ca3af; border: 1px solid rgba(107, 114, 128, 0.4); }

/* Payment status */
.pay-pending { background: rgba(251, 191, 36, 0.15); color: #fbbf24; border: 1px solid rgba(251, 191, 36, 0.4); }
.pay-executed { background: rgba(16, 185, 129, 0.15); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.4); }
.pay-rejected { background: rgba(239, 68, 68, 0.15); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.4); }
.pay-analyzing { background: rgba(139, 92, 246, 0.15); color: #a78bfa; border: 1px solid rgba(139, 92, 246, 0.4); }

/* Agent status */
.agent-idle { color: #34d399; }
.agent-thinking { color: #a78bfa; animation: thinking 1s ease infinite; }
.agent-executing { color: #60a5fa; }
.agent-error { color: #f87171; }

/* Milestone progress bar */
.milestone-bar {
  height: 4px;
  border-radius: 2px;
  background: rgba(75, 85, 99, 0.5);
  overflow: hidden;
}

.milestone-fill {
  height: 100%;
  border-radius: 2px;
  background: linear-gradient(90deg, #7c3aed, #3b82f6);
  transition: width 0.5s ease;
}

/* Risk level indicators */
.risk-low { color: #34d399; }
.risk-medium { color: #fbbf24; }
.risk-high { color: #f97316; }
.risk-critical { color: #f87171; }

/* Code blocks */
pre code {
  font-family: 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
  font-size: 0.78rem;
  line-height: 1.6;
}

/* Scrollbar customizado */
::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}

::-webkit-scrollbar-track {
  background: rgba(31, 41, 55, 0.5);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb {
  background: rgba(139, 92, 246, 0.5);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(139, 92, 246, 0.8);
}

/* Toast notification */
#toast {
  transition: all 0.3s ease;
}

/* Glow effect para agentes ativos */
.agent-glow {
  animation: pulse-glow 2s ease infinite;
}

/* Contract card hover */
.contract-card {
  transition: all 0.2s ease;
}

.contract-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

/* Responsive */
@media (max-width: 640px) {
  .tab-btn {
    padding: 12px 12px;
    font-size: 12px;
  }

  .tab-btn span {
    display: none;
  }
}

/* ── Settings & Profile modals ── */
.settings-tab {
  transition: color 0.15s, border-color 0.15s;
  white-space: nowrap;
}

/* Toggle switch (peer-checked requires Tailwind JIT — force via CSS) */
input[type="checkbox"].sr-only:checked + div {
  background-color: #7c3aed;
}
input[type="checkbox"].sr-only:checked + div + div,
input[type="checkbox"].sr-only:checked ~ div > div {
  transform: translateX(1.25rem);
}

/* Peer checkbox workaround for CDN Tailwind */
.peer:checked ~ .peer-checked\:bg-purple-600 { background-color: #7c3aed !important; }
.peer:checked ~ .peer-checked\:translate-x-5 { transform: translateX(1.25rem) !important; }

/* ── Swap Steps Panel ── */
.swap-step { transition: all 0.2s ease; }

.swap-step-active .swap-step-icon {
  border-color: #a855f7;
  background: rgba(168,85,247,0.15);
  animation: swapStepPulse 1.2s ease-in-out infinite;
}
.swap-step-active .swap-step-icon i { color: #a855f7; }
.swap-step-active { color: #e2e8f0 !important; }

.swap-step-done .swap-step-icon {
  border-color: #22c55e;
  background: rgba(34,197,94,0.12);
}
.swap-step-done .swap-step-icon i { color: #22c55e; }
.swap-step-done .swap-step-icon i::before { content: "\f00c"; } /* fa-check */
.swap-step-done { color: #86efac !important; }

.swap-step-error .swap-step-icon {
  border-color: #ef4444;
  background: rgba(239,68,68,0.12);
}
.swap-step-error .swap-step-icon i { color: #ef4444; }
.swap-step-error .swap-step-icon i::before { content: "\f00d"; } /* fa-times */
.swap-step-error { color: #fca5a5 !important; }

@keyframes swapStepPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(168,85,247,0.4); }
  50%       { box-shadow: 0 0 0 5px rgba(168,85,247,0); }
}

/* ── Chatbot compacto ── */
#chat-widget {
  width: 300px !important;
  max-width: calc(100vw - 20px) !important;
}
#chat-messages {
  scrollbar-width: thin;
  scrollbar-color: #4c1d95 #111827;
}
#chat-messages::-webkit-scrollbar { width: 3px; }
#chat-messages::-webkit-scrollbar-track { background: #111827; }
#chat-messages::-webkit-scrollbar-thumb { background: #4c1d95; border-radius: 4px; }

/* ── Payment Steps Panel ── */
.pay-step {
  color: #4b5563;
  transition: all 0.2s ease;
}

.pay-step-icon {
  border: 1.5px solid #374151;
  background: rgba(31,41,55,0.6);
  flex-shrink: 0;
}

.pay-step.pay-step-idle .pay-step-icon i { color: #4b5563; }
.pay-step.pay-step-idle { color: #6b7280; }

.pay-step.pay-step-active .pay-step-icon {
  border-color: #06b6d4;
  background: rgba(6,182,212,0.15);
  animation: payStepPulse 1.2s ease-in-out infinite;
}
.pay-step.pay-step-active .pay-step-icon i { color: #06b6d4; }
.pay-step.pay-step-active { color: #e2e8f0; }

.pay-step.pay-step-done .pay-step-icon {
  border-color: #22c55e;
  background: rgba(34,197,94,0.12);
}
.pay-step.pay-step-done .pay-step-icon i { color: #22c55e; }
.pay-step.pay-step-done .pay-step-icon i::before { content: "\f00c"; }
.pay-step.pay-step-done { color: #86efac; }

.pay-step.pay-step-error .pay-step-icon {
  border-color: #ef4444;
  background: rgba(239,68,68,0.12);
}
.pay-step.pay-step-error .pay-step-icon i { color: #ef4444; }
.pay-step.pay-step-error .pay-step-icon i::before { content: "\f00d"; }
.pay-step.pay-step-error { color: #fca5a5; }

@keyframes payStepPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(6,182,212,0.4); }
  50%       { box-shadow: 0 0 0 5px rgba(6,182,212,0); }
}

/* ── Receipt Card ── */
.pay-receipt-card {
  background: linear-gradient(135deg, rgba(6,78,59,0.15), rgba(17,24,39,0.8));
  border: 1px solid rgba(34,197,94,0.25);
  border-radius: 1rem;
  padding: 1.25rem;
  animation: fadeIn 0.3s ease;
}

/* ── Details/Summary for batch panel ── */
details > summary::-webkit-details-marker { display: none; }
details[open] > summary .fa-chevron-down { transform: rotate(180deg); }
details > summary .fa-chevron-down { transition: transform 0.2s ease; }

/* ── Contract Step Panel (ct-step-*) ── */
.ct-step {
  color: #4b5563;
  transition: all 0.2s ease;
}
.ct-step-icon {
  border: 1.5px solid #374151;
  background: rgba(31,41,55,0.6);
  flex-shrink: 0;
}
.ct-step.ct-step-idle .ct-step-icon i { color: #5a7090; }
.ct-step.ct-step-idle { color: #6080a0; }

.ct-step.ct-step-active .ct-step-icon {
  border-color: #22c55e;
  background: rgba(34,197,94,0.15);
  animation: ctStepPulse 1.2s ease-in-out infinite;
}
.ct-step.ct-step-active .ct-step-icon i { color: #22c55e; }
.ct-step.ct-step-active { color: #e2e8f0; }

.ct-step.ct-step-done .ct-step-icon {
  border-color: #22c55e;
  background: rgba(34,197,94,0.12);
}
.ct-step.ct-step-done .ct-step-icon i { color: #22c55e; }
.ct-step.ct-step-done .ct-step-icon i::before { content: "\f00c"; }
.ct-step.ct-step-done { color: #86efac; }

.ct-step.ct-step-error .ct-step-icon {
  border-color: #ef4444;
  background: rgba(239,68,68,0.12);
}
.ct-step.ct-step-error .ct-step-icon i { color: #ef4444; }
.ct-step.ct-step-error .ct-step-icon i::before { content: "\f00d"; }
.ct-step.ct-step-error { color: #fca5a5; }

@keyframes ctStepPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(34,197,94,0.4); }
  50%       { box-shadow: 0 0 0 5px rgba(34,197,94,0); }
}

/* ── Contract Receipt Panel (inside card) ── */
.ct-receipt-panel {
  background: linear-gradient(135deg, rgba(6,78,59,0.12), rgba(17,24,39,0.7));
  border: 1px solid rgba(34,197,94,0.22);
  border-radius: 0.75rem;
  padding: 0.875rem 1rem;
  animation: fadeIn 0.35s ease;
}

.ct-receipt-icon {
  width: 22px;
  height: 22px;
  background: rgba(34,197,94,0.12);
  border: 1px solid rgba(34,197,94,0.35);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ct-receipt-title {
  display: flex;
  align-items: center;
}

.ct-receipt-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.ct-receipt-label {
  font-size: 11px;
  color: #6b7280;
  flex-shrink: 0;
  width: 80px;
}

.ct-receipt-addr {
  font-family: 'Courier New', monospace;
  font-size: 11px;
  font-weight: 600;
  text-align: right;
}

/* Receipt action buttons */
.ct-receipt-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  padding: 5px 10px;
  border-radius: 8px;
  border: 1px solid;
  transition: all 0.15s ease;
  cursor: pointer;
  text-decoration: none;
  font-weight: 500;
}
.ct-receipt-btn-view {
  background: rgba(31,41,55,0.8);
  border-color: rgba(34,197,94,0.3);
  color: #d1d5db;
}
.ct-receipt-btn-view:hover { background: rgba(34,197,94,0.1); border-color: rgba(34,197,94,0.6); }

.ct-receipt-btn-dl {
  background: rgba(31,41,55,0.8);
  border-color: rgba(34,197,94,0.3);
  color: #d1d5db;
}
.ct-receipt-btn-dl:hover { background: rgba(6,182,212,0.1); border-color: rgba(6,182,212,0.4); }

.ct-receipt-btn-pdf {
  background: rgba(31,41,55,0.8);
  border-color: rgba(34,197,94,0.3);
  color: #d1d5db;
}
.ct-receipt-btn-pdf:hover { background: rgba(239,68,68,0.1); border-color: rgba(239,68,68,0.4); }

.ct-receipt-btn-ext {
  background: rgba(30,58,138,0.2);
  border-color: rgba(59,130,246,0.3);
  color: #60a5fa;
}
.ct-receipt-btn-ext:hover { background: rgba(59,130,246,0.15); border-color: rgba(59,130,246,0.6); }

/* ── Contract Receipt Modal ── */
#ct-receipt-modal .animate-modal-in {
  animation: modal-in 0.25s cubic-bezier(0.34,1.56,0.64,1) forwards;
}

/* ═══════════════════════════════════════════════════════════════
   ARC DEX — AMM Liquidity Pool Styles
   Arc Testnet · x*y=k · 0.3% fee
   ═══════════════════════════════════════════════════════════════ */

/* ── DEX Stat Cards ── */
.dex-stat-card {
  background: linear-gradient(135deg, rgba(17,24,39,0.8), rgba(31,41,55,0.6));
  border: 1px solid rgba(75,85,99,0.4);
  border-radius: 1rem;
  padding: 1rem 1.25rem;
  transition: border-color 0.2s ease;
}
.dex-stat-card:hover {
  border-color: rgba(6,182,212,0.3);
}

/* ── DEX Panel (glass card) ── */
.dex-panel {
  background: linear-gradient(135deg, rgba(17,24,39,0.85), rgba(31,41,55,0.7));
  border: 1px solid rgba(75,85,99,0.35);
  border-radius: 1.25rem;
  padding: 1.25rem;
  backdrop-filter: blur(12px);
  transition: border-color 0.2s ease;
}
.dex-panel:hover {
  border-color: rgba(6,182,212,0.2);
}

/* ── DEX Card Header ── */
.dex-card-header {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(75,85,99,0.25);
}

/* ── Token Input Groups ── */
.dex-token-input-group {
  background: rgba(31,41,55,0.6);
  border: 1px solid rgba(75,85,99,0.4);
  border-radius: 0.875rem;
  padding: 0.75rem;
  transition: border-color 0.2s ease;
}
.dex-token-input-group:focus-within {
  border-color: rgba(6,182,212,0.5);
  background: rgba(8,47,73,0.3);
}

/* ── Token Selects ── */
.dex-token-select {
  background: rgba(17,24,39,0.9);
  border: 1px solid rgba(75,85,99,0.5);
  border-radius: 0.625rem;
  padding: 0.375rem 0.625rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: white;
  cursor: pointer;
  outline: none;
  transition: border-color 0.2s ease;
  min-width: 100px;
}
.dex-token-select:focus {
  border-color: rgba(6,182,212,0.6);
}

/* ── Amount Inputs ── */
.dex-amount-input {
  background: transparent;
  border: none;
  outline: none;
  font-size: 1.125rem;
  font-weight: 700;
  color: white;
  font-family: 'Courier New', monospace;
  min-width: 0;
  width: 100%;
}
.dex-amount-input::placeholder { color: rgba(107,114,128,0.6); }
.dex-amount-input::-webkit-inner-spin-button,
.dex-amount-input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.dex-amount-input[type=number] { -moz-appearance: textfield; }

/* ── Quote Box ── */
.dex-quote-box {
  background: rgba(17,24,39,0.7);
  border: 1px solid rgba(75,85,99,0.3);
  border-radius: 0.875rem;
  padding: 0.75rem 1rem;
  space-y: 0.375rem;
}

.dex-quote-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  color: #9ca3af;
  padding: 0.25rem 0;
  border-bottom: 1px solid rgba(75,85,99,0.15);
}
.dex-quote-row:last-child { border-bottom: none; }

/* ── Transaction Steps ── */
.dex-step {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.375rem 0;
  color: #6b7280;
  font-size: 0.75rem;
  transition: color 0.2s ease;
}

.dex-step-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(75,85,99,0.5);
  flex-shrink: 0;
  transition: all 0.3s ease;
}

.dex-step-idle .dex-step-dot { background: rgba(75,85,99,0.4); }
.dex-step-idle { color: #4b5563; }

.dex-step-active {
  color: #22d3ee;
  animation: dexStepPulseText 1.4s ease-in-out infinite;
}
.dex-step-active .dex-step-dot {
  background: #22d3ee;
  box-shadow: 0 0 0 0 rgba(34,211,238,0.4);
  animation: dexStepPulseDot 1.4s ease-in-out infinite;
}

.dex-step-done { color: #4ade80; }
.dex-step-done .dex-step-dot {
  background: #4ade80;
  box-shadow: 0 0 5px rgba(74,222,128,0.4);
}

.dex-step-error { color: #f87171; }
.dex-step-error .dex-step-dot {
  background: #f87171;
  box-shadow: 0 0 5px rgba(248,113,113,0.4);
}

@keyframes dexStepPulseDot {
  0%, 100% { box-shadow: 0 0 0 0 rgba(34,211,238,0.5); }
  50%       { box-shadow: 0 0 0 6px rgba(34,211,238,0); }
}
@keyframes dexStepPulseText {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.7; }
}

/* ── Position Cards ── */
.dex-position-card {
  background: linear-gradient(135deg, rgba(17,24,39,0.8), rgba(31,41,55,0.5));
  border: 1px solid rgba(75,85,99,0.3);
  border-radius: 1rem;
  padding: 1rem;
  transition: border-color 0.2s ease, transform 0.2s ease;
}
.dex-position-card:hover {
  border-color: rgba(139,92,246,0.4);
  transform: translateY(-1px);
}

.dex-pos-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  padding: 0.125rem 0;
}

/* ── Pool Table ── */
#dex-pools-table tr:hover td { background: rgba(6,182,212,0.04); }
#dex-pools-table td { transition: background 0.15s ease; }

/* ── Subtab active indicator ── */
.dex-subtab {
  position: relative;
  overflow: hidden;
}
.dex-subtab::after {
  content: '';
  position: absolute;
  bottom: 0; left: 50%; right: 50%;
  height: 2px;
  background: transparent;
  transition: all 0.2s ease;
  border-radius: 1px;
}
.dex-subtab.active::after,
.dex-subtab[class*="bg-cyan"]::after {
  left: 20%; right: 20%;
  background: rgba(34,211,238,0.6);
}

/* ── Network Badge ── */
#dex-network-badge {
  position: relative;
  overflow: hidden;
}
#dex-network-badge::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(34,211,238,0.05) 50%, transparent 100%);
  animation: dexNetworkScan 4s ease-in-out infinite;
}
@keyframes dexNetworkScan {
  0%, 100% { transform: translateX(-100%); }
  50%       { transform: translateX(100%); }
}

/* ── Price impact indicators ── */
.dex-impact-low    { color: #4ade80; }
.dex-impact-medium { color: #facc15; }
.dex-impact-high   { color: #fb923c; }
.dex-impact-danger { color: #f87171; }

/* ── LP Token badge ── */
.dex-lp-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  background: linear-gradient(90deg, rgba(234,179,8,0.15), rgba(234,179,8,0.08));
  border: 1px solid rgba(234,179,8,0.25);
  border-radius: 9999px;
  padding: 0.125rem 0.625rem;
  font-size: 0.6875rem;
  font-weight: 600;
  color: #fbbf24;
  font-family: 'Courier New', monospace;
}

/* ── Analytics Grid ── */
.dex-analytics-metric {
  background: rgba(31,41,55,0.5);
  border: 1px solid rgba(75,85,99,0.25);
  border-radius: 0.75rem;
  padding: 0.875rem;
  text-align: center;
  transition: all 0.2s ease;
}
.dex-analytics-metric:hover {
  border-color: rgba(6,182,212,0.3);
  background: rgba(8,47,73,0.25);
}

/* ── APR Badge ── */
.dex-apr-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.125rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.6875rem;
  font-weight: 700;
}
.dex-apr-badge.high   { background: rgba(34,197,94,0.15); color: #4ade80; border: 1px solid rgba(34,197,94,0.2); }
.dex-apr-badge.medium { background: rgba(234,179,8,0.12); color: #fbbf24; border: 1px solid rgba(234,179,8,0.2); }
.dex-apr-badge.low    { background: rgba(6,182,212,0.1);  color: #22d3ee; border: 1px solid rgba(6,182,212,0.2); }

/* ── Swap Arrow Flip Animation ── */
.dex-flip-btn {
  transition: transform 0.4s cubic-bezier(0.34,1.56,0.64,1);
}
.dex-flip-btn:active { transform: rotate(180deg) scale(0.9); }

/* ── Token Pair Icons ── */
.dex-token-pair {
  display: flex;
  align-items: center;
}
.dex-token-pair > span:first-child { z-index: 1; }
.dex-token-pair > span + span { margin-left: -6px; }

/* ── Glow effects for active pools ── */
.dex-pool-active-glow {
  box-shadow: 0 0 20px rgba(6,182,212,0.08), 0 0 40px rgba(6,182,212,0.04);
}

/* ── Receipt overlay ── */
#dex-receipt-modal,
#dex-lp-receipt-modal {
  animation: dexModalFadeIn 0.2s ease forwards;
}
@keyframes dexModalFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ── Dark scrollbar for DEX panels ── */
#dex-recent-swaps::-webkit-scrollbar,
#dex-positions-list::-webkit-scrollbar { width: 4px; }
#dex-recent-swaps::-webkit-scrollbar-track,
#dex-positions-list::-webkit-scrollbar-track { background: rgba(17,24,39,0.5); }
#dex-recent-swaps::-webkit-scrollbar-thumb,
#dex-positions-list::-webkit-scrollbar-thumb { background: rgba(75,85,99,0.5); border-radius: 2px; }

/* ── DEX loading skeleton ── */
.dex-skeleton {
  background: linear-gradient(90deg, rgba(31,41,55,0.5) 25%, rgba(55,65,81,0.5) 50%, rgba(31,41,55,0.5) 75%);
  background-size: 200% 100%;
  animation: dexSkeletonShimmer 1.5s infinite;
  border-radius: 0.5rem;
}
@keyframes dexSkeletonShimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Pool TVL bar ── */
.dex-tvl-bar {
  height: 3px;
  border-radius: 9999px;
  background: linear-gradient(90deg, #06b6d4, #3b82f6);
  transition: width 0.6s ease;
}

/* ── Info tooltip ── */
.dex-tooltip {
  position: relative;
  cursor: help;
}
.dex-tooltip::before {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(17,24,39,0.95);
  border: 1px solid rgba(75,85,99,0.4);
  color: #d1d5db;
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 6px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 50;
}
.dex-tooltip:hover::before { opacity: 1; }

/* ── "New Pool" badge ── */
.dex-new-pool-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: linear-gradient(90deg, rgba(139,92,246,0.2), rgba(59,130,246,0.15));
  border: 1px solid rgba(139,92,246,0.3);
  border-radius: 9999px;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 700;
  color: #a78bfa;
}

/* ── Mobile responsive ── */
@media (max-width: 640px) {
  .dex-panel { padding: 1rem; }
  .dex-token-select { min-width: 80px; font-size: 0.75rem; }
  .dex-amount-input { font-size: 1rem; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   ESCROW WALLET MODULE — ARC Testnet
   ═══════════════════════════════════════════════════════════════════════════ */

/* ─── Escrow Card ─────────────────────────────────────────────────────────── */
.escrow-card {
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
}
.escrow-card:hover {
  box-shadow: 0 4px 24px rgba(6, 182, 212, 0.12);
  transform: translateY(-1px);
}

/* ─── Stat Card ───────────────────────────────────────────────────────────── */
.escrow-stat-card {
  transition: box-shadow 0.2s;
}
.escrow-stat-card:hover {
  box-shadow: 0 2px 16px rgba(6, 182, 212, 0.08);
}

/* ─── Progress Track ─────────────────────────────────────────────────────── */
.escrow-progress-track {
  background: rgba(75, 85, 99, 0.4);
  border-radius: 999px;
  height: 6px;
  overflow: hidden;
}
.escrow-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #0891b2, #06b6d4, #67e8f9);
  border-radius: 999px;
  transition: width 0.6s cubic-bezier(0.25, 1, 0.5, 1);
  min-width: 0;
}

.escrow-progress-track-lg {
  background: rgba(75, 85, 99, 0.4);
  border-radius: 999px;
  height: 10px;
  overflow: hidden;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.3);
}
.escrow-progress-fill-lg {
  height: 100%;
  background: linear-gradient(90deg, #0e7490, #0891b2, #06b6d4, #a5f3fc);
  border-radius: 999px;
  transition: width 0.8s cubic-bezier(0.25, 1, 0.5, 1);
  box-shadow: 0 0 8px rgba(6, 182, 212, 0.5);
  min-width: 0;
}

/* ─── Milestone Row ──────────────────────────────────────────────────────── */
.escrow-milestone-row {
  transition: background-color 0.2s;
}
.escrow-milestone-row:hover {
  background: rgba(6, 182, 212, 0.04);
}

/* ─── Milestone Button ───────────────────────────────────────────────────── */
.escrow-ms-btn {
  transition: all 0.15s;
  font-size: 12px;
  cursor: pointer;
}
.escrow-ms-btn:hover {
  transform: translateY(-1px);
}
.escrow-ms-btn:active {
  transform: translateY(0);
}

/* ─── Input Styles ───────────────────────────────────────────────────────── */
.escrow-input {
  transition: border-color 0.15s, box-shadow 0.15s;
}
.escrow-input:focus {
  box-shadow: 0 0 0 2px rgba(6, 182, 212, 0.15);
}

/* ─── Deposit Modal Animation ────────────────────────────────────────────── */
#escrow-deposit-modal {
  animation: escrowModalIn 0.2s ease-out;
}
#escrow-deposit-modal > div {
  animation: escrowSlideIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes escrowModalIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes escrowSlideIn {
  from { opacity: 0; transform: scale(0.92) translateY(12px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* ─── State Badge Colors ─────────────────────────────────────────────────── */
.escrow-state-created   { color: #fbbf24; background: rgba(120,53,15,0.3);  border: 1px solid rgba(120,53,15,0.5); }
.escrow-state-active    { color: #4ade80; background: rgba(20,83,45,0.3);   border: 1px solid rgba(20,83,45,0.5); }
.escrow-state-disputed  { color: #f87171; background: rgba(127,29,29,0.3);  border: 1px solid rgba(127,29,29,0.5); }
.escrow-state-completed { color: #60a5fa; background: rgba(30,58,138,0.3);  border: 1px solid rgba(30,58,138,0.5); }
.escrow-state-refunded  { color: #9ca3af; background: rgba(55,65,81,0.3);   border: 1px solid rgba(55,65,81,0.5); }

/* ─── Milestone State Colors ─────────────────────────────────────────────── */
.ms-pending    { color: #9ca3af; background: rgba(55,65,81,0.4); }
.ms-requested  { color: #fbbf24; background: rgba(120,53,15,0.3); }
.ms-verified   { color: #4ade80; background: rgba(20,83,45,0.3); }
.ms-released   { color: #60a5fa; background: rgba(30,58,138,0.3); }

/* ─── Escrow Address Label ───────────────────────────────────────────────── */
.escrow-addr {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

/* ─── Glow Effect for Active Escrow ─────────────────────────────────────── */
.escrow-active-glow {
  box-shadow: 0 0 0 1px rgba(6, 182, 212, 0.3), 0 4px 24px rgba(6, 182, 212, 0.1);
}

/* ─── Receipt-style Event Log Row ────────────────────────────────────────── */
.escrow-event-row {
  border-left: 2px solid transparent;
  transition: border-color 0.15s, background 0.15s;
}
.escrow-event-row:hover {
  border-left-color: rgba(6, 182, 212, 0.5);
  background: rgba(6, 182, 212, 0.04);
}

/* ─── Escrow Milestone Input ──────────────────────────────────────────────── */
.escrow-milestone-input {
  animation: fadeInRow 0.2s ease-out;
}
@keyframes fadeInRow {
  from { opacity: 0; transform: translateX(-8px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ─── Tab Escrow Active Indicator ────────────────────────────────────────── */
#tab-escrow.active {
  border-bottom-color: #06b6d4 !important;
  color: #06b6d4 !important;
}
#tab-escrow.active i {
  color: #06b6d4;
}

/* ─── Escrow v2.0 — Additional Styles ────────────────────────────────────── */

/* Fade-in-up animation for floating chips */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
.animate-fade-in-up {
  animation: fadeInUp 0.3s ease-out forwards;
}

/* Pulse animation for new events */
@keyframes pulseOnce {
  0%   { box-shadow: 0 0 0 0 rgba(168, 85, 247, 0.5); }
  70%  { box-shadow: 0 0 0 8px rgba(168, 85, 247, 0); }
  100% { box-shadow: 0 0 0 0 rgba(168, 85, 247, 0); }
}
.animate-pulse-once {
  animation: pulseOnce 1.5s ease-out 3;
}

/* Data flow diagram arrows */
.escrow-flow-arrow {
  color: #4b5563;
  font-size: 12px;
}

/* Step indicators in create form */
[id^="ecstep-"] {
  transition: color 0.2s;
}
[id^="ecstep-"] .w-5 {
  transition: all 0.2s;
}
.text-green-400 [id^="ecstep-"] .w-5 {
  background: rgba(74, 222, 128, 0.2);
  border-color: #4ade80;
}
.text-cyan-400 [id^="ecstep-"] .w-5 {
  background: rgba(6, 182, 212, 0.2);
  border-color: #06b6d4;
}

/* USDC info box in create form */
#escrow-usdc-info {
  border-left: 2px solid rgba(6, 182, 212, 0.3);
}

/* Escrow wallet chip */
#escrow-wallet-chip {
  min-width: 140px;
}
#escrow-wallet-chip.border-green-600\/50 {
  box-shadow: 0 0 0 1px rgba(22, 163, 74, 0.2);
}

/* On-chain badge */
#escrow-onchain-badge {
  animation: fadeInUp 0.3s ease-out;
}

/* Tab badge */
#tab-escrow-badge {
  animation: scaleIn 0.2s ease-out;
}
@keyframes scaleIn {
  from { transform: scale(0); }
  to   { transform: scale(1); }
}


/* ═══════════════════════════════════════════════════════════════════════════
   LIGHT MODE — Premium, modern, Web3-professional
   Scope: body.light-mode only. Dark mode is completely untouched.
   Design system: layered off-white backgrounds, soft shadows, purple accents,
   WCAG AA contrast, smooth 0.2s transitions on theme switch.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ─────────────────────────────────────────────────────────────────────────
   § 1 — CSS Custom Properties (Design Tokens)
   ───────────────────────────────────────────────────────────────────────── */
body.light-mode {
  /* Backgrounds — layered depth */
  --lm-bg:          #f1f5f9;          /* page canvas */
  --lm-bg-card:     #ffffff;          /* elevated cards */
  --lm-bg-raised:   #f8fafc;          /* slightly raised surfaces */
  --lm-bg-sunken:   #e9eef7;          /* inset / recessed areas */
  --lm-bg-hover:    #edf2fb;          /* interactive hover state */
  --lm-bg-header:   rgba(255,255,255,0.97); /* header glass */

  /* Borders */
  --lm-border:      #dae1ec;
  --lm-border-soft: #e4eaf4;
  --lm-border-mid:  #c8d3e3;
  --lm-border-focus: #7c3aed;

  /* Typography */
  --lm-text-hi:     #0f172a;          /* headings, high emphasis */
  --lm-text-md:     #1e293b;          /* body text */
  --lm-text-lo:     #475569;          /* secondary labels */
  --lm-text-muted:  #64748b;          /* muted / caption */
  --lm-text-dim:    #94a3b8;          /* placeholders, hints */

  /* Accent — purple brand */
  --lm-accent:         #6d28d9;
  --lm-accent-light:   #7c3aed;
  --lm-accent-soft:    rgba(109,40,217,0.08);
  --lm-accent-border:  rgba(109,40,217,0.25);
  --lm-accent-glow:    rgba(109,40,217,0.15);

  /* Blue accent (payments, DEX) */
  --lm-blue:           #1d4ed8;
  --lm-blue-soft:      rgba(29,78,216,0.07);
  --lm-blue-border:    rgba(29,78,216,0.22);

  /* Status colors */
  --lm-success:        #15803d;
  --lm-success-soft:   rgba(21,128,61,0.07);
  --lm-warning:        #92400e;
  --lm-warning-soft:   rgba(217,119,6,0.07);
  --lm-danger:         #b91c1c;
  --lm-danger-soft:    rgba(185,28,28,0.06);

  /* Shadows — crisp and layered */
  --lm-shadow-xs: 0 1px 2px rgba(15,23,42,0.05);
  --lm-shadow-sm: 0 1px 4px rgba(15,23,42,0.07), 0 1px 2px rgba(15,23,42,0.04);
  --lm-shadow-md: 0 4px 14px rgba(15,23,42,0.09), 0 2px 4px rgba(15,23,42,0.05);
  --lm-shadow-lg: 0 8px 30px rgba(15,23,42,0.11), 0 4px 8px rgba(15,23,42,0.06);
  --lm-shadow-xl: 0 20px 60px rgba(15,23,42,0.14), 0 8px 20px rgba(15,23,42,0.08);

  /* Radius */
  --lm-radius-sm: 8px;
  --lm-radius-md: 12px;
  --lm-radius-lg: 16px;
  --lm-radius-xl: 20px;

  background-color: var(--lm-bg) !important;
  color: var(--lm-text-md) !important;
}

/* ─────────────────────────────────────────────────────────────────────────
   § 2 — Body & App Shell
   ───────────────────────────────────────────────────────────────────────── */
body.light-mode main,
body.light-mode #app-shell {
  background-color: var(--lm-bg) !important;
}

/* ─────────────────────────────────────────────────────────────────────────
   § 3 — Smooth Theme Transition
   ───────────────────────────────────────────────────────────────────────── */
body {
  transition: background-color 0.25s ease, color 0.2s ease;
}
body.light-mode *,
body.light-mode *::before,
body.light-mode *::after {
  transition-property: background-color, border-color, color, box-shadow, opacity;
  transition-duration: 0.18s;
  transition-timing-function: ease;
}
/* Don't transition transforms/width to avoid breaking animations */
body.light-mode [class*="transition-all"],
body.light-mode [class*="transition-transform"] {
  transition-property: all !important;
}

/* ─────────────────────────────────────────────────────────────────────────
   § 4 — Header (Sticky top bar)
   ───────────────────────────────────────────────────────────────────────── */
body.light-mode header#main-header {
  background: var(--lm-bg-header) !important;
  backdrop-filter: blur(16px) saturate(1.6) !important;
  -webkit-backdrop-filter: blur(16px) saturate(1.6) !important;
  border-bottom: 1px solid var(--lm-border) !important;
  box-shadow: 0 2px 12px rgba(15,23,42,0.07), 0 1px 3px rgba(15,23,42,0.04) !important;
}

/* Header text overrides */
body.light-mode header .text-white,
body.light-mode header .text-gray-100,
body.light-mode header .text-gray-200 { color: var(--lm-text-hi) !important; }
body.light-mode header .text-gray-300 { color: var(--lm-text-lo) !important; }
body.light-mode header .text-gray-400,
body.light-mode header .text-gray-500 { color: var(--lm-text-muted) !important; }
body.light-mode header .text-purple-400 { color: var(--lm-accent-light) !important; }

/* Header language selector */
body.light-mode #lang-selector button {
  background: var(--lm-bg-raised) !important;
  border-color: var(--lm-border) !important;
  color: var(--lm-text-lo) !important;
  box-shadow: var(--lm-shadow-xs) !important;
}
body.light-mode #lang-selector button:hover {
  background: var(--lm-bg-hover) !important;
  border-color: var(--lm-border-mid) !important;
  color: var(--lm-text-md) !important;
}
body.light-mode #lang-dropdown {
  background: var(--lm-bg-card) !important;
  border-color: var(--lm-border) !important;
  box-shadow: var(--lm-shadow-lg) !important;
}
body.light-mode #lang-dropdown .lang-option {
  color: var(--lm-text-lo) !important;
}
body.light-mode #lang-dropdown .lang-option:hover {
  background: var(--lm-bg-hover) !important;
  color: var(--lm-text-md) !important;
}

/* Arc testnet badge */
body.light-mode header .bg-green-900\/30 {
  background: rgba(21,128,61,0.08) !important;
  border-color: rgba(21,128,61,0.22) !important;
}
body.light-mode header .text-green-400 { color: #15803d !important; }

/* Wallet info pill */
body.light-mode #wallet-info {
  background: var(--lm-bg-raised) !important;
  border-color: var(--lm-border) !important;
  box-shadow: var(--lm-shadow-xs) !important;
}
body.light-mode #wallet-info:hover {
  border-color: var(--lm-accent-border) !important;
  background: var(--lm-bg-hover) !important;
  box-shadow: var(--lm-shadow-sm) !important;
}
body.light-mode #wallet-address-display { color: var(--lm-text-hi) !important; }
body.light-mode #wallet-network-display { color: #15803d !important; }
body.light-mode #wallet-balance-display {
  background: rgba(29,78,216,0.08) !important;
  color: var(--lm-blue) !important;
}

/* Settings & Profile buttons */
body.light-mode #settings-btn {
  background: var(--lm-bg-raised) !important;
  border-color: var(--lm-border) !important;
  color: var(--lm-text-muted) !important;
  box-shadow: var(--lm-shadow-xs) !important;
}
body.light-mode #settings-btn:hover {
  background: var(--lm-bg-hover) !important;
  border-color: var(--lm-border-mid) !important;
  color: var(--lm-text-md) !important;
}

/* Testnet banner */
body.light-mode #testnet-banner {
  background: #fffbeb !important;
  border-bottom-color: rgba(217,119,6,0.2) !important;
}

/* ─────────────────────────────────────────────────────────────────────────
   § 5 — Tab Navigation Bar
   ───────────────────────────────────────────────────────────────────────── */
body.light-mode #tab-nav {
  background: rgba(255,255,255,0.96) !important;
  border-bottom-color: var(--lm-border) !important;
  box-shadow: 0 1px 0 var(--lm-border), 0 2px 6px rgba(15,23,42,0.04) !important;
  backdrop-filter: blur(8px) !important;
}
body.light-mode .tab-btn {
  color: var(--lm-text-muted) !important;
  border-color: transparent !important;
}
body.light-mode .tab-btn:hover:not(.active) {
  color: var(--lm-text-md) !important;
  background: var(--lm-bg-sunken) !important;
}
body.light-mode .tab-btn.active {
  color: var(--lm-accent) !important;
  border-color: var(--lm-accent) !important;
  background: var(--lm-accent-soft) !important;
}
body.light-mode .tab-btn i { opacity: 0.85; }
body.light-mode .tab-btn.active i { opacity: 1; }

/* ─────────────────────────────────────────────────────────────────────────
   § 6 — Card & Panel Backgrounds (Tailwind class overrides)
   ───────────────────────────────────────────────────────────────────────── */
body.light-mode .bg-gray-950,
body.light-mode .bg-gray-950\/90,
body.light-mode .bg-gray-900\/95,
body.light-mode .bg-gray-900\/80,
body.light-mode .bg-gray-900\/60,
body.light-mode .bg-gray-900\/50 {
  background-color: var(--lm-bg-card) !important;
  box-shadow: var(--lm-shadow-md) !important;
}
body.light-mode .bg-gray-900 {
  background-color: var(--lm-bg-raised) !important;
  box-shadow: var(--lm-shadow-sm) !important;
}
body.light-mode .bg-gray-800 {
  background-color: var(--lm-bg-sunken) !important;
}
body.light-mode .bg-gray-800\/80,
body.light-mode .bg-gray-800\/60,
body.light-mode .bg-gray-800\/40,
body.light-mode .bg-gray-800\/20 {
  background-color: rgba(233,238,247,0.7) !important;
}
body.light-mode .bg-gray-700 {
  background-color: var(--lm-border) !important;
}

/* Specific rounded card enhancements */
body.light-mode .rounded-2xl.bg-gray-900,
body.light-mode .rounded-xl.bg-gray-900 {
  background: var(--lm-bg-card) !important;
  border: 1px solid var(--lm-border-soft) !important;
  box-shadow: var(--lm-shadow-md) !important;
}

/* ─────────────────────────────────────────────────────────────────────────
   § 7 — Typography
   ───────────────────────────────────────────────────────────────────────── */
body.light-mode .text-white          { color: var(--lm-text-hi) !important; }
body.light-mode .text-gray-100,
body.light-mode .text-gray-200       { color: var(--lm-text-md) !important; }
body.light-mode .text-gray-300       { color: var(--lm-text-lo) !important; }
body.light-mode .text-gray-400       { color: var(--lm-text-muted) !important; }
body.light-mode .text-gray-500       { color: var(--lm-text-dim) !important; }
body.light-mode .text-gray-600,
body.light-mode .text-gray-700       { color: #b0bac9 !important; }

/* Preserve accent colors */
body.light-mode .text-purple-400     { color: var(--lm-accent-light) !important; }
body.light-mode .text-purple-300     { color: #7c3aed !important; }
body.light-mode .text-blue-400       { color: #2563eb !important; }
body.light-mode .text-blue-300       { color: #1d4ed8 !important; }
body.light-mode .text-green-400      { color: #15803d !important; }
body.light-mode .text-green-300      { color: #166534 !important; }
body.light-mode .text-yellow-400,
body.light-mode .text-amber-400      { color: #92400e !important; }
body.light-mode .text-red-400,
body.light-mode .text-rose-400       { color: #b91c1c !important; }
body.light-mode .text-cyan-400       { color: #0e7490 !important; }
body.light-mode .text-indigo-400     { color: #3730a3 !important; }

/* Preserve gradient text */
body.light-mode .bg-gradient-to-r.from-purple-400,
body.light-mode [class*="bg-clip-text"] {
  -webkit-background-clip: text !important;
  background-clip: text !important;
}

/* ─────────────────────────────────────────────────────────────────────────
   § 8 — Borders & Dividers
   ───────────────────────────────────────────────────────────────────────── */
body.light-mode .border-gray-900     { border-color: var(--lm-border-soft) !important; }
body.light-mode .border-gray-800,
body.light-mode .border-gray-800\/60,
body.light-mode .border-gray-800\/40,
body.light-mode .border-gray-800\/20 { border-color: var(--lm-border-soft) !important; }
body.light-mode .border-gray-700,
body.light-mode .border-gray-700\/60,
body.light-mode .border-gray-700\/40 { border-color: var(--lm-border) !important; }
body.light-mode .border-gray-600     { border-color: var(--lm-border-mid) !important; }
body.light-mode .border-purple-700\/50,
body.light-mode .border-purple-800\/30 { border-color: var(--lm-accent-border) !important; }

body.light-mode hr,
body.light-mode [class*="divide-gray"] > * + * {
  border-color: var(--lm-border) !important;
}

/* ─────────────────────────────────────────────────────────────────────────
   § 9 — Inputs, Selects & Textareas (Premium form styling)
   ───────────────────────────────────────────────────────────────────────── */
body.light-mode input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
body.light-mode select,
body.light-mode textarea {
  background-color: #ffffff !important;
  border: 1.5px solid var(--lm-border) !important;
  color: var(--lm-text-hi) !important;
  box-shadow: var(--lm-shadow-xs) !important;
  border-radius: var(--lm-radius-sm) !important;
}
body.light-mode input::placeholder,
body.light-mode textarea::placeholder { color: var(--lm-text-dim) !important; }

body.light-mode input:not([type="checkbox"]):not([type="radio"]):hover,
body.light-mode select:hover,
body.light-mode textarea:hover {
  border-color: var(--lm-border-mid) !important;
}
body.light-mode input:not([type="checkbox"]):not([type="radio"]):focus,
body.light-mode select:focus,
body.light-mode textarea:focus {
  border-color: var(--lm-border-focus) !important;
  box-shadow: 0 0 0 3px var(--lm-accent-glow) !important;
  background: #ffffff !important;
  outline: none !important;
}
/* Disabled inputs */
body.light-mode input:disabled,
body.light-mode select:disabled,
body.light-mode textarea:disabled {
  background: var(--lm-bg-sunken) !important;
  color: var(--lm-text-dim) !important;
  border-color: var(--lm-border-soft) !important;
  cursor: not-allowed !important;
}

/* ─────────────────────────────────────────────────────────────────────────
   § 10 — Buttons (Generic overrides)
   ───────────────────────────────────────────────────────────────────────── */
/* Hover state for gray hover buttons */
body.light-mode .hover\:bg-gray-800:hover,
body.light-mode .hover\:bg-gray-700:hover { background-color: var(--lm-bg-hover) !important; }
body.light-mode .hover\:bg-gray-900:hover { background-color: var(--lm-bg-sunken) !important; }

/* Plain/ghost buttons that have no brand color */
body.light-mode button:not([class*="bg-purple"]):not([class*="bg-blue"]):not([class*="bg-green"]):not([class*="bg-red"]):not([class*="bg-gradient"]):not([style*="background"]):not(.pay-tok-btn):not(.pay-cf-input):not(.chat-quick-btn) {
  color: var(--lm-text-md);
}

/* Primary action button (purple) */
body.light-mode .bg-purple-600,
body.light-mode .bg-purple-700 {
  /* keep vivid purple, just ensure text is white */
  color: #ffffff !important;
}
body.light-mode .hover\:bg-purple-700:hover { opacity: 0.92; }

/* ─────────────────────────────────────────────────────────────────────────
   § 11 — Landing Page
   ───────────────────────────────────────────────────────────────────────── */
body.light-mode #landing-page section {
  background: linear-gradient(160deg, #f8fafc 0%, #eef2fb 50%, #f4f1ff 100%) !important;
}
body.light-mode #landing-page section .absolute {
  /* background glow overlay stays soft */
  opacity: 0.04 !important;
}
body.light-mode #landing-page footer {
  background: transparent !important;
  border-top-color: var(--lm-border) !important;
}
body.light-mode #landing-page footer a,
body.light-mode #landing-page footer span {
  color: var(--lm-text-muted) !important;
}
body.light-mode #landing-page footer a:hover { color: var(--lm-text-lo) !important; }

/* Feature cards on landing */
body.light-mode #landing-page .bg-gray-900 {
  background: var(--lm-bg-card) !important;
  border: 1px solid var(--lm-border-soft) !important;
  box-shadow: var(--lm-shadow-md) !important;
}
body.light-mode #landing-page .bg-gray-900:hover {
  border-color: var(--lm-accent-border) !important;
  box-shadow: var(--lm-shadow-lg), 0 0 0 1px var(--lm-accent-border) !important;
  transform: translateY(-2px);
}

/* ─────────────────────────────────────────────────────────────────────────
   § 12 — Cards (Rounded containers everywhere)
   ───────────────────────────────────────────────────────────────────────── */
/* General rounded bordered elements */
body.light-mode [class*="rounded-xl"][class*="border"],
body.light-mode [class*="rounded-2xl"][class*="border"] {
  border-color: var(--lm-border) !important;
}
body.light-mode [class*="rounded-xl"][class*="bg-gray"],
body.light-mode [class*="rounded-2xl"][class*="bg-gray"] {
  box-shadow: var(--lm-shadow-sm) !important;
}

/* Stat / info cards */
body.light-mode .stat-card,
body.light-mode [id*="stat-"] {
  background: var(--lm-bg-card) !important;
  border: 1px solid var(--lm-border-soft) !important;
  box-shadow: var(--lm-shadow-md) !important;
}
body.light-mode .stat-card:hover {
  box-shadow: var(--lm-shadow-lg) !important;
  border-color: var(--lm-border) !important;
}

/* ─────────────────────────────────────────────────────────────────────────
   § 13 — Modals & Overlays
   ───────────────────────────────────────────────────────────────────────── */
/* Overlay backgrounds */
body.light-mode .fixed.inset-0.bg-black\/80,
body.light-mode .fixed.inset-0.bg-black\/60,
body.light-mode .fixed.inset-0.bg-black\/50 {
  background: rgba(15,23,42,0.55) !important;
  backdrop-filter: blur(4px) !important;
}

/* Modal panels */
body.light-mode #settings-modal .bg-gray-900,
body.light-mode #profile-modal  .bg-gray-900,
body.light-mode #wallet-modal   .bg-gray-900,
body.light-mode #pin-modal      .bg-gray-900 {
  background: var(--lm-bg-card) !important;
  box-shadow: var(--lm-shadow-xl) !important;
  border: 1px solid var(--lm-border) !important;
}
body.light-mode #settings-modal .bg-gray-800,
body.light-mode #profile-modal  .bg-gray-800,
body.light-mode #wallet-modal   .bg-gray-800,
body.light-mode #pin-modal      .bg-gray-800 {
  background: var(--lm-bg-raised) !important;
  border-color: var(--lm-border-soft) !important;
}

/* Modal header gradients */
body.light-mode #settings-modal .bg-gradient-to-br,
body.light-mode #profile-modal  .bg-gradient-to-br {
  /* keep gradient but tint it lighter */
  opacity: 0.9 !important;
}

/* Pin modal */
body.light-mode #pin-modal input[type="password"] {
  background: var(--lm-bg-raised) !important;
  border: 1.5px solid var(--lm-border) !important;
  color: var(--lm-text-hi) !important;
  letter-spacing: 0.3em;
  box-shadow: var(--lm-shadow-xs) !important;
}

/* Settings sidebar */
body.light-mode .settings-tab-btn {
  color: var(--lm-text-lo) !important;
  border-radius: var(--lm-radius-sm) !important;
}
body.light-mode .settings-tab-btn:hover:not(.active) {
  background: var(--lm-bg-sunken) !important;
  color: var(--lm-text-md) !important;
}
body.light-mode .settings-tab-btn.active {
  background: var(--lm-accent-soft) !important;
  color: var(--lm-accent) !important;
  border-color: var(--lm-accent) !important;
}

/* Wallet modal rounded cards */
body.light-mode #wallet-modal .rounded-xl,
body.light-mode #wallet-modal .rounded-2xl {
  border-color: var(--lm-border) !important;
}

/* ─────────────────────────────────────────────────────────────────────────
   § 14 — Toast Notifications
   ───────────────────────────────────────────────────────────────────────── */
body.light-mode #toast .bg-gray-800,
body.light-mode #toast [class*="bg-gray-8"] {
  background: var(--lm-bg-card) !important;
  border: 1px solid var(--lm-border) !important;
  color: var(--lm-text-hi) !important;
  box-shadow: var(--lm-shadow-lg) !important;
}

/* ─────────────────────────────────────────────────────────────────────────
   § 15 — Tab Content: Payments
   ───────────────────────────────────────────────────────────────────────── */
body.light-mode .pay-cf-panel {
  background: var(--lm-bg-card) !important;
  border: 1px solid var(--lm-border) !important;
  box-shadow: var(--lm-shadow-md) !important;
  border-radius: var(--lm-radius-lg) !important;
}
body.light-mode .pay-cf-input {
  background: #f8fbff !important;
  border: 1.5px solid var(--lm-border) !important;
  color: var(--lm-text-hi) !important;
  box-shadow: var(--lm-shadow-xs) !important;
}
body.light-mode .pay-cf-input::placeholder { color: var(--lm-text-dim) !important; }
body.light-mode .pay-cf-input:hover { border-color: var(--lm-border-mid) !important; }
body.light-mode .pay-cf-input:focus {
  border-color: #2563eb !important;
  box-shadow: 0 0 0 3px rgba(37,99,235,0.12) !important;
  background: #ffffff !important;
  color: var(--lm-text-hi) !important;
}

body.light-mode .pay-cf-label {
  color: #1e3a5f !important;
  font-weight: 600 !important;
  font-size: 0.8rem !important;
  letter-spacing: 0.01em;
}

body.light-mode .pay-side-panel {
  background: var(--lm-bg-card) !important;
  border: 1px solid var(--lm-border) !important;
  box-shadow: var(--lm-shadow-sm) !important;
  border-radius: var(--lm-radius-lg) !important;
}
body.light-mode .pay-side-hdr {
  background: linear-gradient(135deg, rgba(29,78,216,0.05), rgba(109,40,217,0.04)) !important;
  border-bottom: 1px solid var(--lm-border) !important;
}

/* Preview box */
body.light-mode #pay-preview-box {
  background: linear-gradient(135deg, #f0f6ff 0%, #f5f0ff 100%) !important;
  border: 1px solid rgba(99,102,241,0.2) !important;
  border-radius: var(--lm-radius-md) !important;
}
body.light-mode #pay-preview-box .prow { border-bottom-color: rgba(99,102,241,0.12) !important; }
body.light-mode #pay-preview-box .pk {
  color: #3b5a8c !important;
  font-weight: 500 !important;
}
body.light-mode #pay-preview-box .pv {
  color: var(--lm-text-hi) !important;
  font-weight: 700 !important;
}

/* Payment note */
body.light-mode .pay-note-input {
  background: #f8fbff !important;
  border: 1.5px solid var(--lm-border) !important;
  color: var(--lm-text-hi) !important;
  box-shadow: var(--lm-shadow-xs) !important;
}
body.light-mode .pay-note-input::placeholder { color: var(--lm-text-dim) !important; }
body.light-mode .pay-note-input:focus {
  border-color: #2563eb !important;
  box-shadow: 0 0 0 3px rgba(37,99,235,0.11) !important;
  background: #ffffff !important;
}
body.light-mode .pay-note-counter       { color: var(--lm-text-muted) !important; }
body.light-mode .pay-note-counter.warn  { color: #b45309 !important; }
body.light-mode .pay-note-counter.over  { color: var(--lm-danger) !important; }

/* Schedule panel */
body.light-mode .pay-sched-panel {
  background: rgba(29,78,216,0.03) !important;
  border: 1px solid rgba(29,78,216,0.14) !important;
  border-radius: var(--lm-radius-md) !important;
}
body.light-mode .pay-sched-opt {
  background: var(--lm-bg-raised) !important;
  border: 1px solid var(--lm-border) !important;
  color: var(--lm-text-lo) !important;
  border-radius: var(--lm-radius-sm) !important;
  transition: all 0.18s ease !important;
}
body.light-mode .pay-sched-opt:hover {
  border-color: var(--lm-blue-border) !important;
  background: var(--lm-blue-soft) !important;
}
body.light-mode .pay-sched-opt.active-now {
  background: rgba(29,78,216,0.08) !important;
  border-color: rgba(29,78,216,0.35) !important;
  color: #1e3a8a !important;
}
body.light-mode .pay-sched-opt.active-later {
  background: var(--lm-accent-soft) !important;
  border-color: var(--lm-accent-border) !important;
  color: var(--lm-accent) !important;
}
body.light-mode .pay-sched-hint        { color: var(--lm-accent) !important; }
body.light-mode .pay-sched-hint.ok     { color: var(--lm-success) !important; }
body.light-mode .pay-sched-hint.err    { color: var(--lm-danger) !important; }
body.light-mode #pay-sched-date,
body.light-mode #pay-sched-time,
body.light-mode #pay-sched-tz {
  background: #f8fbff !important;
  border: 1.5px solid var(--lm-border) !important;
  color: var(--lm-text-hi) !important;
}
body.light-mode #pay-sched-date:focus,
body.light-mode #pay-sched-time:focus,
body.light-mode #pay-sched-tz:focus {
  border-color: #2563eb !important;
  box-shadow: 0 0 0 3px rgba(37,99,235,0.11) !important;
  background: #ffffff !important;
}

/* Field hints */
body.light-mode .pay-field-hint.ok   { color: var(--lm-success) !important; }
body.light-mode .pay-field-hint.err  { color: var(--lm-danger) !important; }
body.light-mode .pay-field-hint.info { color: #3b5a8c !important; }

/* Token buttons */
body.light-mode .pay-tok-btn.tok-off {
  background: var(--lm-bg-raised) !important;
  border: 1px solid var(--lm-border-mid) !important;
  color: var(--lm-text-lo) !important;
}
body.light-mode .pay-tok-btn.tok-off:hover {
  border-color: var(--lm-blue-border) !important;
  color: var(--lm-blue) !important;
  background: var(--lm-blue-soft) !important;
}

/* Disabled send button */
body.light-mode #pay-send-btn:disabled {
  background: var(--lm-bg-sunken) !important;
  border: 1px solid var(--lm-border) !important;
  color: var(--lm-text-dim) !important;
  cursor: not-allowed !important;
}

/* Status badges */
body.light-mode .pay-status-scheduled  {
  background: var(--lm-accent-soft) !important;
  border: 1px solid var(--lm-accent-border) !important;
  color: var(--lm-accent) !important;
}
body.light-mode .pay-status-processing {
  background: rgba(29,78,216,0.07) !important;
  border: 1px solid rgba(29,78,216,0.25) !important;
  color: var(--lm-blue) !important;
}
body.light-mode .pay-status-completed  {
  background: var(--lm-success-soft) !important;
  border: 1px solid rgba(21,128,61,0.25) !important;
  color: var(--lm-success) !important;
}
body.light-mode .pay-status-failed     {
  background: var(--lm-danger-soft) !important;
  border: 1px solid rgba(185,28,28,0.2) !important;
  color: var(--lm-danger) !important;
}

/* Receipt modal */
body.light-mode #pay-receipt-modal { background: rgba(15,23,42,0.6) !important; }
body.light-mode .pay-receipt-modal-inner {
  background: var(--lm-bg-card) !important;
  border: 1px solid var(--lm-border) !important;
  box-shadow: var(--lm-shadow-xl) !important;
  border-radius: var(--lm-radius-xl) !important;
}
body.light-mode .pay-receipt-modal-inner::-webkit-scrollbar-thumb {
  background: rgba(29,78,216,0.2) !important;
}

/* History cards */
body.light-mode #pay-history-list > div,
body.light-mode #payments-list > div {
  background: var(--lm-bg-raised) !important;
  border: 1px solid var(--lm-border-soft) !important;
  border-radius: var(--lm-radius-md) !important;
}
body.light-mode #pay-history-list > div:hover,
body.light-mode #payments-list > div:hover {
  border-color: rgba(29,78,216,0.3) !important;
  background: var(--lm-bg-hover) !important;
}

/* Steps panel */
body.light-mode #pay-steps-panel {
  background: var(--lm-bg-raised) !important;
  border: 1px solid var(--lm-border) !important;
  border-radius: var(--lm-radius-lg) !important;
}
body.light-mode .pstep-idle  .pstep-label { color: #3b5a8c !important; font-weight: 500 !important; }
body.light-mode .pstep-done  .pstep-label { color: var(--lm-text-muted) !important; }
body.light-mode .pstep-idle  .pstep-icon {
  background: var(--lm-bg-sunken) !important;
  border: 1px solid var(--lm-border) !important;
  color: #3b5a8c !important;
}

/* Fee preview */
body.light-mode #cf-fee-preview { color: #3b5a8c !important; }

/* ─────────────────────────────────────────────────────────────────────────
   § 16 — Tab Content: Contracts
   ───────────────────────────────────────────────────────────────────────── */
body.light-mode .cf-panel {
  background: var(--lm-bg-card) !important;
  border: 1px solid var(--lm-border) !important;
  box-shadow: var(--lm-shadow-md) !important;
  border-radius: var(--lm-radius-lg) !important;
}
body.light-mode .cf-input {
  background: #f8fbff !important;
  border: 1.5px solid var(--lm-border) !important;
  color: var(--lm-text-hi) !important;
  box-shadow: var(--lm-shadow-xs) !important;
}
body.light-mode .cf-input::placeholder { color: var(--lm-text-dim) !important; }
body.light-mode .cf-input:hover { border-color: var(--lm-border-mid) !important; }
body.light-mode .cf-input:focus {
  border-color: #2563eb !important;
  box-shadow: 0 0 0 3px rgba(37,99,235,0.12) !important;
  background: #ffffff !important;
}
body.light-mode .cf-label {
  color: #1e3a5f !important;
  font-weight: 600 !important;
  font-size: 0.8rem !important;
}
body.light-mode .cf-card {
  background: var(--lm-bg-raised) !important;
  border: 1px solid var(--lm-border-soft) !important;
  border-radius: var(--lm-radius-md) !important;
  box-shadow: var(--lm-shadow-xs) !important;
  transition: all 0.18s ease !important;
}
body.light-mode .cf-card:hover {
  border-color: rgba(29,78,216,0.35) !important;
  box-shadow: var(--lm-shadow-sm), 0 0 0 1px rgba(29,78,216,0.12) !important;
  transform: translateY(-1px);
}
body.light-mode .cf-btn-disabled {
  color: var(--lm-text-dim) !important;
  background: var(--lm-bg-sunken) !important;
  border: 1px solid var(--lm-border-soft) !important;
}
body.light-mode #cf-steps-panel {
  background: var(--lm-bg-raised) !important;
  border: 1px solid var(--lm-border) !important;
  border-radius: var(--lm-radius-lg) !important;
}
body.light-mode .ct-step-idle .ct-step-icon i { color: #3b5a8c !important; }
body.light-mode .ct-step-idle { color: #3b5a8c !important; }
body.light-mode .ct-step-done span { color: var(--lm-text-muted) !important; }
body.light-mode #cf-ms-sum { color: #3b5a8c !important; }

/* ─────────────────────────────────────────────────────────────────────────
   § 17 — Tab Content: DEX / Swap
   ───────────────────────────────────────────────────────────────────────── */
body.light-mode #dex-swap-center,
body.light-mode #dex-swap-inner {
  background: transparent !important;
}
body.light-mode .dex-swap-card,
body.light-mode [id*="dex-"][class*="rounded"],
body.light-mode #tab-content-dex .bg-gray-900 {
  background: var(--lm-bg-card) !important;
  border: 1px solid var(--lm-border) !important;
  box-shadow: var(--lm-shadow-md) !important;
}
body.light-mode #tab-content-dex input {
  background: #f8fbff !important;
  border: 1.5px solid var(--lm-border) !important;
}
body.light-mode #tab-content-dex input:focus {
  border-color: var(--lm-accent-light) !important;
  box-shadow: 0 0 0 3px var(--lm-accent-glow) !important;
  background: #ffffff !important;
}
body.light-mode #tab-content-dex select {
  background: #f8fbff !important;
}

/* ─────────────────────────────────────────────────────────────────────────
   § 18 — Tab Content: MultiSend
   ───────────────────────────────────────────────────────────────────────── */
body.light-mode #tab-content-multisend .bg-gray-900 {
  background: var(--lm-bg-card) !important;
  border: 1px solid var(--lm-border) !important;
  box-shadow: var(--lm-shadow-md) !important;
}
body.light-mode #tab-content-multisend .bg-gray-800 {
  background: var(--lm-bg-raised) !important;
  border-color: var(--lm-border-soft) !important;
}
body.light-mode #tab-content-multisend input,
body.light-mode #tab-content-multisend textarea {
  background: #f8fbff !important;
  border: 1.5px solid var(--lm-border) !important;
}
body.light-mode #tab-content-multisend input:focus,
body.light-mode #tab-content-multisend textarea:focus {
  border-color: #0e7490 !important;
  box-shadow: 0 0 0 3px rgba(14,116,144,0.12) !important;
  background: #ffffff !important;
}

/* MultiSend step indicators */
body.light-mode .ms-step {
  background: var(--lm-bg-card) !important;
  border: 1px solid var(--lm-border) !important;
  border-radius: var(--lm-radius-md) !important;
  box-shadow: var(--lm-shadow-sm) !important;
}
body.light-mode .ms-step.active {
  border-color: rgba(14,116,144,0.45) !important;
  background: rgba(14,116,144,0.04) !important;
  box-shadow: var(--lm-shadow-sm), 0 0 0 1px rgba(14,116,144,0.15) !important;
}
body.light-mode .ms-step.done {
  border-color: rgba(21,128,61,0.45) !important;
  background: rgba(21,128,61,0.04) !important;
}

/* ─────────────────────────────────────────────────────────────────────────
   § 19 — Tab Content: History
   ───────────────────────────────────────────────────────────────────────── */
body.light-mode .history-tx-row {
  background: var(--lm-bg-card) !important;
  border: 1px solid var(--lm-border-soft) !important;
  border-radius: var(--lm-radius-md) !important;
  box-shadow: var(--lm-shadow-xs) !important;
}
body.light-mode .history-tx-row:hover {
  background: var(--lm-bg-hover) !important;
  border-color: var(--lm-accent-border) !important;
  box-shadow: var(--lm-shadow-sm) !important;
  transform: translateX(2px);
}
body.light-mode .history-filter-btn {
  background: var(--lm-bg-raised) !important;
  border: 1px solid var(--lm-border) !important;
  color: var(--lm-text-lo) !important;
  border-radius: var(--lm-radius-sm) !important;
  transition: all 0.18s ease !important;
}
body.light-mode .history-filter-btn:hover {
  background: var(--lm-bg-hover) !important;
  border-color: var(--lm-border-mid) !important;
  color: var(--lm-text-md) !important;
}
body.light-mode .history-filter-btn.active {
  background: var(--lm-accent-soft) !important;
  border-color: var(--lm-accent-border) !important;
  color: var(--lm-accent) !important;
  box-shadow: 0 0 0 1px var(--lm-accent-border) !important;
}
body.light-mode #tab-content-history .bg-gray-900 {
  background: var(--lm-bg-card) !important;
  border: 1px solid var(--lm-border) !important;
  box-shadow: var(--lm-shadow-md) !important;
}

/* ─────────────────────────────────────────────────────────────────────────
   § 20 — Tab Content: Dashboard / Information
   ───────────────────────────────────────────────────────────────────────── */
body.light-mode #tab-content-dashboard .bg-gray-900 {
  background: var(--lm-bg-card) !important;
  border: 1px solid var(--lm-border) !important;
  box-shadow: var(--lm-shadow-md) !important;
}
body.light-mode #tab-content-dashboard .bg-gray-800 {
  background: var(--lm-bg-raised) !important;
  border-color: var(--lm-border-soft) !important;
}

/* ─────────────────────────────────────────────────────────────────────────
   § 21 — Chat Widget
   ───────────────────────────────────────────────────────────────────────── */
body.light-mode #chat-widget {
  background: var(--lm-bg-card) !important;
  border: 1.5px solid var(--lm-accent-border) !important;
  box-shadow: var(--lm-shadow-xl), 0 0 0 1px var(--lm-accent-glow) !important;
  color: var(--lm-text-hi) !important;
  border-radius: var(--lm-radius-xl) !important;
}
body.light-mode #chat-header {
  background: linear-gradient(135deg, rgba(109,40,217,0.07) 0%, rgba(37,99,235,0.05) 100%) !important;
  border-bottom: 1px solid rgba(109,40,217,0.12) !important;
  border-radius: var(--lm-radius-xl) var(--lm-radius-xl) 0 0 !important;
}
body.light-mode #chat-header .text-white,
body.light-mode #chat-header [class*="text-white"] { color: var(--lm-text-hi) !important; }
body.light-mode #chat-header .text-green-400 { color: #15803d !important; }
body.light-mode #chat-header .text-gray-400  { color: var(--lm-text-muted) !important; }

/* ArcPay bar */
body.light-mode #chat-arcpay-bar.unauthorized {
  background: var(--lm-accent-soft) !important;
  border-bottom: 1px solid var(--lm-accent-border) !important;
}
body.light-mode #chat-arcpay-bar.authorized {
  background: var(--lm-success-soft) !important;
  border-bottom: 1px solid rgba(21,128,61,0.2) !important;
}

/* Messages area */
body.light-mode #chat-messages {
  background: var(--lm-bg-raised) !important;
}
body.light-mode #chat-messages .bg-gray-800,
body.light-mode #chat-messages [class*="bg-gray-8"] {
  background: var(--lm-bg-card) !important;
  border: 1px solid var(--lm-border-soft) !important;
  box-shadow: var(--lm-shadow-xs) !important;
}
body.light-mode #chat-messages .text-gray-300,
body.light-mode #chat-messages .text-gray-400 { color: var(--lm-text-md) !important; }
body.light-mode #chat-messages .text-gray-500,
body.light-mode #chat-messages .text-gray-600 { color: var(--lm-text-muted) !important; }

/* Quick action buttons */
body.light-mode .chat-quick-btn {
  background: var(--lm-bg-raised) !important;
  border: 1px solid var(--lm-border) !important;
  color: var(--lm-text-lo) !important;
  border-radius: var(--lm-radius-sm) !important;
  transition: all 0.18s ease !important;
}
body.light-mode .chat-quick-btn:hover {
  background: var(--lm-bg-card) !important;
  border-color: var(--lm-accent-border) !important;
  color: var(--lm-accent) !important;
  box-shadow: var(--lm-shadow-xs) !important;
}

/* Input area */
body.light-mode #chat-widget .bg-gray-800 {
  background: var(--lm-bg-raised) !important;
  border: 1px solid var(--lm-border) !important;
}
body.light-mode #chat-input {
  background: transparent !important;
  color: var(--lm-text-hi) !important;
}
body.light-mode #chat-input::placeholder { color: var(--lm-text-dim) !important; }
body.light-mode #chat-widget .text-gray-700 { color: var(--lm-text-dim) !important; }
body.light-mode #chat-widget button.hover\:bg-gray-800:hover {
  background: var(--lm-bg-hover) !important;
}

/* Size buttons */
body.light-mode .chat-size-btn {
  background: var(--lm-bg-sunken) !important;
  border: 1px solid var(--lm-border) !important;
  color: var(--lm-text-muted) !important;
  border-radius: 6px !important;
}
body.light-mode .chat-size-btn:hover,
body.light-mode .chat-size-btn.active {
  background: var(--lm-accent-soft) !important;
  border-color: var(--lm-accent-border) !important;
  color: var(--lm-accent) !important;
}

/* FAB button */
body.light-mode #chat-fab {
  box-shadow: 0 6px 24px rgba(109,40,217,0.4), 0 3px 10px rgba(0,0,0,0.14) !important;
}

/* ─────────────────────────────────────────────────────────────────────────
   § 22 — Theme Toggle Buttons
   ───────────────────────────────────────────────────────────────────────── */
#theme-dark-btn, #theme-light-btn {
  cursor: pointer;
  user-select: none;
  transition: all 0.2s ease;
}
body.light-mode #theme-dark-btn {
  border: 1px solid var(--lm-border-mid) !important;
  background: var(--lm-bg-raised) !important;
  color: var(--lm-text-muted) !important;
}
body.light-mode #theme-dark-btn:hover {
  background: var(--lm-bg-hover) !important;
  color: var(--lm-text-md) !important;
}
body.light-mode #theme-light-btn {
  border: 1px solid rgba(245,158,11,0.45) !important;
  background: rgba(245,158,11,0.09) !important;
  color: #92400e !important;
}
body.light-mode #theme-light-btn:hover {
  background: rgba(245,158,11,0.16) !important;
}

/* ─────────────────────────────────────────────────────────────────────────
   § 23 — Scrollbars
   ───────────────────────────────────────────────────────────────────────── */
body.light-mode ::-webkit-scrollbar-track {
  background: var(--lm-bg-sunken) !important;
}
body.light-mode ::-webkit-scrollbar-thumb {
  background: #c2ccdb !important;
  border-radius: 4px;
  border: 2px solid var(--lm-bg-sunken);
}
body.light-mode ::-webkit-scrollbar-thumb:hover {
  background: #a8b5c8 !important;
}

/* ─────────────────────────────────────────────────────────────────────────
   § 24 — Selection
   ───────────────────────────────────────────────────────────────────────── */
body.light-mode ::selection {
  background: rgba(109,40,217,0.15);
  color: var(--lm-text-hi);
}

/* ─────────────────────────────────────────────────────────────────────────
   § 25 — App Info / Info Bar
   ───────────────────────────────────────────────────────────────────────── */
body.light-mode [style*="background:rgba(8,11,24"],
body.light-mode [style*="background:rgba(10,12,24"],
body.light-mode [style*="background: rgba(8,11,24"],
body.light-mode [style*="background: rgba(10,12,24"] {
  background: var(--lm-bg-card) !important;
  border-color: var(--lm-border) !important;
}

/* ─────────────────────────────────────────────────────────────────────────
   § 26 — Arc Badge Overrides (light mode)
   ───────────────────────────────────────────────────────────────────────── */
body.light-mode .arc-badge-pending    { background: var(--lm-warning-soft) !important;   border-color: rgba(217,119,6,0.25) !important;  color: var(--lm-warning) !important; }
body.light-mode .arc-badge-scheduled  { background: var(--lm-accent-soft) !important;    border-color: var(--lm-accent-border) !important; color: var(--lm-accent) !important; }
body.light-mode .arc-badge-processing { background: var(--lm-blue-soft) !important;      border-color: var(--lm-blue-border) !important;   color: var(--lm-blue) !important; }
body.light-mode .arc-badge-completed  { background: var(--lm-success-soft) !important;   border-color: rgba(21,128,61,0.22) !important;    color: var(--lm-success) !important; }
body.light-mode .arc-badge-failed     { background: var(--lm-danger-soft) !important;    border-color: rgba(185,28,28,0.2) !important;     color: var(--lm-danger) !important; }
body.light-mode .arc-badge-cancelled  { background: rgba(71,85,105,0.07) !important;     border-color: rgba(71,85,105,0.2) !important;     color: #475569 !important; }
body.light-mode .arc-badge-cached     { background: var(--lm-blue-soft) !important;      border-color: var(--lm-blue-border) !important;   color: var(--lm-blue) !important; }
body.light-mode .arc-badge-synced     { background: var(--lm-success-soft) !important;   border-color: rgba(21,128,61,0.2) !important;     color: var(--lm-success) !important; }
body.light-mode .arc-badge-partial    { background: var(--lm-warning-soft) !important;   border-color: rgba(217,119,6,0.2) !important;     color: var(--lm-warning) !important; }

/* ─────────────────────────────────────────────────────────────────────────
   § 27 — Offline / Cached bars
   ───────────────────────────────────────────────────────────────────────── */
body.light-mode .arc-offline-bar {
  background: var(--lm-warning-soft) !important;
  border-bottom-color: rgba(217,119,6,0.2) !important;
  color: var(--lm-warning) !important;
}
body.light-mode .arc-offline-retry {
  background: rgba(217,119,6,0.1) !important;
  border-color: rgba(217,119,6,0.25) !important;
  color: #78350f !important;
}
body.light-mode .arc-retry-btn {
  background: rgba(217,119,6,0.07) !important;
  border-color: rgba(217,119,6,0.2) !important;
  color: #78350f !important;
}
body.light-mode .arc-retry-btn:hover {
  background: rgba(217,119,6,0.14) !important;
}
body.light-mode .hist-cache-bar  {
  background: var(--lm-blue-soft) !important;
  border-color: var(--lm-blue-border) !important;
  color: var(--lm-blue) !important;
}
body.light-mode .hist-offline-bar {
  background: var(--lm-warning-soft) !important;
  border-color: rgba(217,119,6,0.2) !important;
  color: var(--lm-warning) !important;
}

/* ─────────────────────────────────────────────────────────────────────────
   § 28 — Accessibility — Focus Rings
   ───────────────────────────────────────────────────────────────────────── */
body.light-mode button:focus-visible,
body.light-mode input:focus-visible,
body.light-mode a:focus-visible,
body.light-mode [role="button"]:focus-visible {
  outline: 2.5px solid var(--lm-accent) !important;
  outline-offset: 2px !important;
}

/* ─────────────────────────────────────────────────────────────────────────
   § 29 — Miscellaneous
   ───────────────────────────────────────────────────────────────────────── */
/* Prevent testnet banner from override */
body.light-mode #testnet-banner { /* amber styling is fine as-is */ }

/* Footer */
body.light-mode footer {
  border-top-color: var(--lm-border) !important;
}
body.light-mode footer .text-gray-600 { color: var(--lm-text-muted) !important; }
body.light-mode footer a:hover { color: var(--lm-text-lo) !important; }

/* Multisend step bar */
body.light-mode #ms-steps-bar .bg-gray-800,
body.light-mode #ms-steps-bar [class*="bg-gray"] {
  background: var(--lm-bg-raised) !important;
  border-color: var(--lm-border) !important;
}

/* ═══════════════════════════════════════════════
   MOBILE OPTIMIZATION — ARC Platform v3
   Full responsiveness for all screen sizes
   ═══════════════════════════════════════════════ */

/* ── Base mobile resets ── */
* { -webkit-tap-highlight-color: transparent; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { overflow-x: hidden; }

/* ── Main content spacing on mobile ── */
@media (max-width: 640px) {
  main.max-w-7xl { padding-left: 12px !important; padding-right: 12px !important; padding-top: 16px !important; }
  .max-w-7xl.mx-auto.px-6 { padding-left: 12px !important; padding-right: 12px !important; }
}

/* ── Header compact on mobile ── */
@media (max-width: 640px) {
  header { padding: 8px 12px !important; }
  header .text-base { font-size: 14px !important; }
  header .text-\\[10px\\] { display: none; }
  #settings-btn, #profile-btn { width: 34px !important; height: 34px !important; }
}

/* ── Navigation tabs — horizontal scroll on mobile ── */
.tab-nav-wrapper {
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.tab-nav-wrapper::-webkit-scrollbar { display: none; }

/* ── Tab buttons — touch-friendly ── */
.tab-btn {
  white-space: nowrap;
  min-width: fit-content;
  touch-action: manipulation;
}

/* ── Wallet connect button — bigger on mobile ── */
@media (max-width: 640px) {
  #wallet-connect-btn,
  .wallet-connect-pulse {
    min-height: 44px;
    min-width: 44px;
  }

  /* Header compact */
  header .flex { flex-wrap: wrap; gap: 8px; }

  /* Tab nav */
  .tab-nav-wrapper { padding: 0 8px; }
  .tab-btn { padding: 10px 12px !important; font-size: 12px !important; }

  /* Main content padding */
  main { padding-left: 12px !important; padding-right: 12px !important; }
  .max-w-7xl { padding-left: 12px; padding-right: 12px; }

  /* Stat cards — 2 columns on mobile */
  .stat-card { padding: 12px !important; }
  .stat-card .text-3xl { font-size: 22px !important; }

  /* Grid overrides */
  .grid.grid-cols-1.md\:grid-cols-2.lg\:grid-cols-4 {
    grid-template-columns: 1fr 1fr;
  }
  .grid.grid-cols-1.lg\:grid-cols-3 {
    grid-template-columns: 1fr;
  }
  .xl\:col-span-2, .xl\:col-span-3 {
    grid-column: span 1 / span 1;
  }
  .grid.grid-cols-1.xl\:grid-cols-5 {
    grid-template-columns: 1fr;
  }

  /* Contracts form — stack all fields */
  .grid.grid-cols-2.gap-2 { grid-template-columns: 1fr; }

  /* Chat FAB — bottom left avoid overlap with MetaMask ── */
  #chat-fab { bottom: 12px !important; right: 12px !important; padding: 10px 14px !important; }

  /* Chat widget */
  #chat-widget {
    width: calc(100vw - 16px) !important;
    height: 72vh !important;
    right: 8px !important;
    bottom: 64px !important;
  }
  #chat-widget[data-size="full"] {
    width: 100vw !important; height: 100vh !important;
    right: 0 !important; bottom: 0 !important; border-radius: 0 !important;
  }

  /* CF cards */
  .cf-card { margin-left: 0 !important; }

  /* Payment form */
  #tab-content-payments .grid { grid-template-columns: 1fr !important; }

  /* Modals */
  .fixed.inset-0 > div { max-height: 92vh; overflow-y: auto; }

  /* Footer */
  footer .flex { flex-direction: column; gap: 8px; text-align: center; }
}

@media (max-width: 480px) {
  .grid.grid-cols-1.md\:grid-cols-2.lg\:grid-cols-4 {
    grid-template-columns: 1fr;
  }
  .tab-btn { padding: 8px 10px !important; font-size: 11px !important; }
  .stat-card .text-3xl { font-size: 18px !important; }
}

/* ── Touch-friendly buttons ── */
button, a, [role="button"] {
  touch-action: manipulation;
}

/* ── Prevent input zoom on iOS ── */
input[type="text"],
input[type="number"],
input[type="email"],
input[type="tel"],
textarea,
select {
  font-size: 16px !important; /* prevents iOS auto-zoom */
}
@media (min-width: 641px) {
  input[type="text"],
  input[type="number"],
  input[type="email"],
  input[type="tel"],
  textarea,
  select {
    font-size: inherit !important;
  }
}

/* ── Wallet modal — mobile friendly ── */
@media (max-width: 640px) {
  #wallet-modal > div,
  #pin-modal > div {
    width: 95vw !important;
    max-width: 95vw !important;
    max-height: 85vh !important;
    overflow-y: auto;
    margin: 0 auto;
  }
}

/* ── DEX / Swap — mobile ── */
@media (max-width: 640px) {
  #tab-content-dex .grid { grid-template-columns: 1fr !important; }
  .dex-swap-card { max-width: 100% !important; }
}

/* ── Multisend — mobile ── */
@media (max-width: 640px) {
  #tab-content-multisend .grid { grid-template-columns: 1fr !important; }
}

/* ── History tab — mobile ── */
@media (max-width: 640px) {
  #tab-content-history .flex.gap-2 { flex-wrap: wrap; }
  .history-filter-btn { font-size: 11px; padding: 5px 10px; }
}

/* ── Overflow fix for contract cards ── */
.cf-card { overflow: hidden; word-break: break-word; }
.cf-card a { word-break: break-all; }

/* ── Smooth scrolling for all overflow containers ── */
.overflow-y-auto, .overflow-x-auto {
  -webkit-overflow-scrolling: touch;
}

/* ── Safe area for iPhone notch / home indicator ── */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  #chat-fab {
    bottom: calc(12px + env(safe-area-inset-bottom)) !important;
  }
  footer {
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
  }
}

/* ── Loading spinner utility ── */
.arc-spinner {
  width: 20px; height: 20px;
  border: 2px solid rgba(139,92,246,0.3);
  border-top-color: #8b5cf6;
  border-radius: 50%;
  animation: arc-spin 0.8s linear infinite;
}
@keyframes arc-spin { to { transform: rotate(360deg); } }

/* ── Better focus rings for accessibility ── */
button:focus-visible, input:focus-visible, a:focus-visible {
  outline: 2px solid rgba(139,92,246,0.7);
  outline-offset: 2px;
}

/* ── Navigation tabs — horizontal scroll on mobile ── */
.tab-nav-wrapper {
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 1px; /* show bottom border */
}
.tab-nav-wrapper::-webkit-scrollbar { display: none; }

/* ── Tab buttons — touch-friendly ── */
.tab-btn {
  white-space: nowrap;
  min-width: fit-content;
  touch-action: manipulation;
}

/* ── Mobile tab spacing ── */
@media (max-width: 640px) {
  .tab-btn { padding: 10px 14px !important; font-size: 12px !important; }
  .tab-btn i { margin-right: 4px !important; }
}

/* ── Wallet connect button — bigger on mobile ── */
@media (max-width: 640px) {
  #wallet-connect-btn { padding: 8px 14px !important; font-size: 13px !important; }
  .wallet-connect-pulse { animation: wallet-pulse 2.5s cubic-bezier(0.4,0,0.6,1) infinite; }
}
@keyframes wallet-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(139,92,246,.4); }
  70%       { box-shadow: 0 0 0 8px rgba(139,92,246,0); }
}

/* ── Dashboard stats — 2 columns on mobile ── */
@media (max-width: 640px) {
  #tab-content-dashboard .grid.lg\\:grid-cols-4 { grid-template-columns: 1fr 1fr !important; }
  #tab-content-dashboard .grid.lg\\:grid-cols-3 { grid-template-columns: 1fr !important; }
  .stat-card .text-3xl { font-size: 1.4rem !important; }
  #db-metrics-bar .grid { grid-template-columns: 1fr 1fr !important; }
}

/* ── Payment form ── */
@media (max-width: 640px) {
  #tab-content-payments .xl\\:col-span-3,
  #tab-content-payments .xl\\:col-span-2 { grid-column: span 1 !important; }
  #tab-content-payments .grid.xl\\:grid-cols-5 { grid-template-columns: 1fr !important; }
}

/* ── Contract cards ── */
.cf-card { overflow: hidden; word-break: break-word; }
.cf-card a { word-break: break-all; }
@media (max-width: 640px) {
  .cf-card { margin-left: 0 !important; }
  #tab-content-contracts .grid.xl\\:grid-cols-3 { grid-template-columns: 1fr !important; }
}

/* ── Modals — full-width on mobile ── */
@media (max-width: 640px) {
  .fixed.inset-0 > div { 
    max-height: 92vh; 
    overflow-y: auto;
    width: 95vw !important;
    max-width: 95vw !important;
    margin: 0 auto !important;
  }
  #wallet-modal > div,
  #pin-modal > div,
  #settings-modal > div,
  #profile-modal > div {
    width: 95vw !important;
    max-width: 95vw !important;
    max-height: 85vh !important;
    overflow-y: auto;
    margin: 0 auto;
    border-radius: 16px !important;
  }
}

/* ── DEX / Swap ── */
@media (max-width: 640px) {
  #tab-content-dex .grid { grid-template-columns: 1fr !important; }
  .dex-swap-card { max-width: 100% !important; }
}

/* ── Multisend ── */
@media (max-width: 640px) {
  #tab-content-multisend .grid { grid-template-columns: 1fr !important; }
}

/* ── History tab ── */
@media (max-width: 640px) {
  #tab-content-history .flex.gap-2 { flex-wrap: wrap; }
  .history-filter-btn { font-size: 11px; padding: 5px 10px; }
}

/* ── Agents tab ── */
@media (max-width: 640px) {
  #tab-content-agents .grid.lg\\:grid-cols-2 { grid-template-columns: 1fr !important; }
}

/* ── Chat FAB — mobile positioning ── */
@media (max-width: 640px) {
  #chat-fab {
    bottom: calc(16px + env(safe-area-inset-bottom, 0px)) !important;
    right: 12px !important;
    padding: 10px 14px !important;
  }
  #chat-widget[data-size="medium"],
  #chat-widget[data-size="mini"] {
    width: calc(100vw - 16px) !important;
    height: 72vh !important;
    right: 8px !important;
    bottom: calc(70px + env(safe-area-inset-bottom, 0px)) !important;
    max-height: calc(100vh - 120px) !important;
  }
  /* Move FAB up when soft keyboard might be open */
  #chat-input:focus ~ #chat-fab,
  #chat-input:focus-within + #chat-fab { bottom: 320px !important; }
}

/* ── Chat widget compact header on mobile ── */
@media (max-width: 480px) {
  #chat-widget .chat-size-btn { padding: 2px 4px !important; }
  #chat-quick-actions button { font-size: 10px !important; padding: 4px 8px !important; }
}

/* ── Overflow fix ── */
.overflow-y-auto, .overflow-x-auto {
  -webkit-overflow-scrolling: touch;
}

/* ── Touch-friendly buttons ── */
button, a, [role="button"] {
  touch-action: manipulation;
  min-height: 36px;
}
/* Override for small inline buttons */
button.text-xs, button.text-\\[10px\\], button.text-\\[11px\\] {
  min-height: unset;
}

/* ── Prevent input zoom on iOS ── */
@media (max-width: 640px) {
  input[type="text"],
  input[type="number"],
  input[type="email"],
  input[type="tel"],
  textarea,
  select {
    font-size: 16px !important;
  }
}

/* ── Wallet modal — mobile friendly ── */
@media (max-width: 640px) {
  #wallet-modal > div { border-radius: 20px !important; }
}

/* ── Footer ── */
@media (max-width: 640px) {
  footer .flex { flex-direction: column; gap: 8px; text-align: center; }
}

/* ── Safe area for iPhone notch / home indicator ── */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  #chat-fab { bottom: calc(16px + env(safe-area-inset-bottom)) !important; }
  footer { padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
}

/* ── 480px — very small screens ── */
@media (max-width: 480px) {
  .grid.grid-cols-1.md\\:grid-cols-2.lg\\:grid-cols-4 { grid-template-columns: 1fr 1fr; }
  .stat-card .text-3xl { font-size: 1.1rem !important; }
  h3 { font-size: 14px !important; }
}

/* ── Loading spinner ── */
.arc-spinner {
  width: 20px; height: 20px;
  border: 2px solid rgba(139,92,246,0.3);
  border-top-color: #8b5cf6;
  border-radius: 50%;
  animation: arc-spin 0.8s linear infinite;
  display: inline-block;
}
@keyframes arc-spin { to { transform: rotate(360deg); } }

/* ── Focus rings for accessibility ── */
button:focus-visible, input:focus-visible, a:focus-visible {
  outline: 2px solid rgba(139,92,246,0.7);
  outline-offset: 2px;
}

/* ── Smooth scrolling ── */
.overflow-y-auto { scroll-behavior: smooth; }

/* ── Better text selection ── */
::selection { background: rgba(139,92,246,0.3); color: #fff; }

/* ════════════════════════════════════════════════════════════════
   ARC PERSISTENCE — Unified Status Badges, Offline Bar, Retry
   ════════════════════════════════════════════════════════════════ */

/* ── Unified arc- status badges ─────────────────────────────── */
[class^="arc-badge-"] {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  border: 1px solid transparent;
  white-space: nowrap;
  line-height: 1.4;
}

.arc-badge-pending    { background: rgba(245,158,11,0.12);  border-color: rgba(245,158,11,0.3);  color: #fbbf24; }
.arc-badge-scheduled  { background: rgba(167,139,250,0.12); border-color: rgba(167,139,250,0.3); color: #c4b5fd; }
.arc-badge-processing { background: rgba(55,138,221,0.12);  border-color: rgba(55,138,221,0.3);  color: #60b4ff; }
.arc-badge-completed  { background: rgba(52,211,153,0.12);  border-color: rgba(52,211,153,0.3);  color: #34d399; }
.arc-badge-failed     { background: rgba(239,68,68,0.10);   border-color: rgba(239,68,68,0.3);   color: #f87171; }
.arc-badge-cancelled  { background: rgba(156,163,175,0.10); border-color: rgba(156,163,175,0.2); color: #9ca3af; }
.arc-badge-cached     { background: rgba(55,138,221,0.07);  border-color: rgba(55,138,221,0.18); color: #7aaae0; }
.arc-badge-synced     { background: rgba(52,211,153,0.08);  border-color: rgba(52,211,153,0.2);  color: #6ee7b7; }
.arc-badge-partial    { background: rgba(245,158,11,0.08);  border-color: rgba(245,158,11,0.2);  color: #fcd34d; }

/* Light mode badge adjustments */
body.light-mode .arc-badge-pending    { background: rgba(217,119,6,0.08);   border-color: rgba(217,119,6,0.25);  color: #92400e; }
body.light-mode .arc-badge-scheduled  { background: rgba(109,40,217,0.08);  border-color: rgba(109,40,217,0.2);  color: #5b21b6; }
body.light-mode .arc-badge-processing { background: rgba(37,99,235,0.08);   border-color: rgba(37,99,235,0.2);   color: #1e40af; }
body.light-mode .arc-badge-completed  { background: rgba(5,150,105,0.08);   border-color: rgba(5,150,105,0.2);   color: #065f46; }
body.light-mode .arc-badge-failed     { background: rgba(220,38,38,0.06);   border-color: rgba(220,38,38,0.2);   color: #991b1b; }
body.light-mode .arc-badge-cancelled  { background: rgba(107,114,128,0.08); border-color: rgba(107,114,128,0.2); color: #4b5563; }
body.light-mode .arc-badge-cached     { background: rgba(55,138,221,0.05);  border-color: rgba(55,138,221,0.15); color: #1d4ed8; }
body.light-mode .arc-badge-synced     { background: rgba(5,150,105,0.06);   border-color: rgba(5,150,105,0.15);  color: #047857; }

/* ── Offline indicator bar ──────────────────────────────────── */
.arc-offline-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  background: rgba(245,158,11,0.09);
  border-bottom: 1px solid rgba(245,158,11,0.22);
  font-size: 12px;
  color: #fbbf24;
  position: sticky;
  top: 0;
  z-index: 200;
  animation: arcOfflineFadeIn 0.3s ease;
}
.arc-offline-bar i { flex-shrink: 0; }
.arc-offline-bar span { flex: 1; }
.arc-offline-retry {
  flex-shrink: 0;
  background: rgba(245,158,11,0.15);
  border: 1px solid rgba(245,158,11,0.35);
  color: #fbbf24;
  padding: 3px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  transition: background 0.18s;
}
.arc-offline-retry:hover { background: rgba(245,158,11,0.28); }

@keyframes arcOfflineFadeIn {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Light mode offline bar */
body.light-mode .arc-offline-bar {
  background: rgba(217,119,6,0.06);
  border-bottom-color: rgba(217,119,6,0.18);
  color: #92400e;
}
body.light-mode .arc-offline-retry {
  background: rgba(217,119,6,0.10);
  border-color: rgba(217,119,6,0.25);
  color: #78350f;
}

/* ── Retry button ────────────────────────────────────────────── */
.arc-retry-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  background: rgba(245,158,11,0.08);
  border: 1px solid rgba(245,158,11,0.22);
  border-radius: 6px;
  color: #fbbf24;
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.18s, border-color 0.18s;
}
.arc-retry-btn:hover {
  background: rgba(245,158,11,0.18);
  border-color: rgba(245,158,11,0.4);
}
body.light-mode .arc-retry-btn {
  background: rgba(217,119,6,0.07);
  border-color: rgba(217,119,6,0.2);
  color: #78350f;
}
body.light-mode .arc-retry-btn:hover {
  background: rgba(217,119,6,0.14);
}

/* ── Cached data notice bars ─────────────────────────────────── */
.hist-cache-bar, .hist-offline-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 8px;
  margin-bottom: 8px;
  font-size: 10px;
}
.hist-cache-bar {
  background: rgba(55,138,221,0.04);
  border: 1px solid rgba(55,138,221,0.12);
  color: #8aaac8;
}
.hist-offline-bar {
  background: rgba(245,158,11,0.06);
  border: 1px solid rgba(245,158,11,0.18);
  color: #fbbf24;
}
body.light-mode .hist-cache-bar  { background: rgba(37,99,235,0.04);  border-color: rgba(37,99,235,0.1);  color: #3b82f6; }
body.light-mode .hist-offline-bar { background: rgba(217,119,6,0.05); border-color: rgba(217,119,6,0.15); color: #92400e; }

/* ── Local Dismiss System ─────────────────────────────────────────────────── */
/* .dismissing: animates an item out before removing it from the DOM state    */
.dismissing {
  transition: opacity 0.2s ease,
              max-height 0.3s ease 0.1s,
              padding 0.3s ease 0.1s,
              margin 0.3s ease 0.1s;
  opacity: 0 !important;
  max-height: 0 !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  margin-top: 0 !important;
  margin-bottom: 0 !important;
  overflow: hidden;
  pointer-events: none;
}

/* Dismiss button — small ✕ used per item across all tabs */
.arc-dismiss-btn {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  background: #2a1515;
  border: 1px solid #5a2020;
  border-radius: 5px;
  cursor: pointer;
  color: #e05555;
  font-size: 13px;
  font-weight: bold;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s, background 0.15s;
  vertical-align: middle;
}
.arc-dismiss-btn:hover {
  border-color: #8b3030;
  background: #3d1a1a;
}
