:root {
  /* --- Design tokens (DOMINUSBOT UI/UX Fase 1) --------------------------- */
  --background: #0a0b0f;
  --surface: #12141a;
  --surface-elevated: #181b23;
  --border: #262a35;
  --text-primary: #e8eaed;
  --text-secondary: #a8adb8;
  --text-muted: #6b7280;
  --positive: #22c55e;
  --negative: #ef4444;
  --warning: #f59e0b;
  --information: #3b82f6;
  --accent: #7c8cff;
  --live: #ef4444;
  --paper: #22c55e;

  /* Aliases de compatibilidade -- nomes antigos usados em partes do CSS que
     ainda nao foram migradas nesta fase; apontam para os tokens acima para
     nao duplicar valores hardcoded. */
  --bg: var(--background);
  --panel: var(--surface);
  --text: var(--text-primary);
  --muted: var(--text-secondary);
  --green: var(--positive);
  --red: var(--negative);
  --yellow: var(--warning);
  --blue: var(--information);

  --sidebar-width: 208px;
  --topbar-height: 56px;
  --statusbar-height: 30px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;

  /* --- DOMINUS SPATIAL OS: tokens do shell (command bar + nav rail + core) */
  --rail-width: 88px;
  --command-bar-height: 56px;
  --terminal-handle-height: 30px;
  --terminal-body-height: 240px;
  --core-observing: var(--positive);
  --core-analyzing: var(--accent);
  --core-deciding: #c084fc;
  --core-executing: var(--warning);
  --core-managing: var(--information);
  --core-waiting: var(--text-muted);
  --core-risk-alert: var(--negative);
  --glow-accent: 0 0 18px rgba(124, 140, 255, 0.35);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--background);
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
}

.hidden {
  display: none !important;
}

.operation-status-wrap {
  position: relative;
  display: flex;
  justify-content: flex-end;
  padding: 5px 18px 0;
  background: var(--background);
}

.operation-status-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.025);
  color: var(--text-muted);
  font: inherit;
  font-size: 0.62rem;
  letter-spacing: 0.04em;
  cursor: pointer;
}

.operation-status-button:hover,
.operation-status-button[aria-expanded="true"] {
  color: var(--text-primary);
  border-color: var(--information);
}

.operation-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
}

.operation-status-dot.status-ok { background: var(--positive); box-shadow: 0 0 7px var(--positive); }
.operation-status-dot.status-error { background: var(--negative); box-shadow: 0 0 7px var(--negative); }

#operation-status-summary { color: var(--text-secondary); text-transform: none; letter-spacing: 0; }

.operation-status-details {
  position: absolute;
  top: calc(100% + 5px);
  right: 18px;
  z-index: 25;
  max-width: min(680px, calc(100vw - 36px));
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-elevated);
  color: var(--text-secondary);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
  font-size: 0.68rem;
  line-height: 1.45;
}

a {
  color: inherit;
}

/* --- Shell: topbar + sidebar + workspace + statusbar -------------------- */

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

/* --- Command Bar (DOMINUS SPATIAL OS) ------------------------------------ */

.command-bar {
  min-height: var(--command-bar-height);
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 8px 18px;
  row-gap: 8px;
  flex-wrap: wrap;
  background: linear-gradient(180deg, var(--surface-elevated), var(--surface));
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}

.command-bar-brand {
  display: flex;
  flex-direction: column;
  gap: 0;
  line-height: 1.1;
  white-space: nowrap;
}

.command-bar-brand .brand-name {
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.14em;
}

.brand-bot-icon {
  display: inline-block;
  margin-right: 4px;
  font-size: 0.9rem;
  filter: drop-shadow(0 0 5px rgba(124, 140, 255, 0.45));
}

.command-bar-brand .brand-subtitle {
  font-size: 0.56rem;
  color: var(--text-muted);
  letter-spacing: 0.08em;
}

.dominus-core {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px 5px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.02);
  white-space: nowrap;
}

.dominus-core-orb {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--core-color, var(--core-waiting));
  box-shadow: 0 0 10px 1px var(--core-color, var(--core-waiting));
  animation: core-pulse 2.4s ease-in-out infinite;
}

.dominus-core-label {
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--core-color, var(--core-waiting));
}

@keyframes core-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.55; transform: scale(0.82); }
}

.dominus-core[data-core-state="risk alert"] .dominus-core-orb { animation-duration: 0.7s; }
.dominus-core[data-core-state="executing"] .dominus-core-orb { animation-duration: 1s; }
.dominus-core[data-core-state="waiting"] .dominus-core-orb { animation: none; opacity: 0.6; }

.command-bar-metrics {
  display: flex;
  align-items: center;
  gap: 16px;
}

.command-bar-metric {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.command-bar-metric .metric-label {
  font-size: 0.58rem;
  color: var(--text-muted);
  letter-spacing: 0.06em;
  font-weight: 700;
}

.command-bar-metric .metric-value {
  font-size: 0.92rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.command-bar-tickers {
  display: flex;
  align-items: center;
  gap: 8px;
}

.overview-tickers {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  width: 100%;
  padding: 0 24px 14px;
}

.overview-tickers .ticker-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
  min-height: 34px;
  padding: 7px 11px;
  background: linear-gradient(135deg, rgba(255,255,255,0.035), rgba(255,255,255,0.015));
  border-radius: var(--radius-md);
}

.overview-tickers .ticker-chip em {
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: right;
}

.ticker-chip {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.ticker-chip em {
  font-style: normal;
  color: var(--text-primary);
  margin-left: 4px;
}

.ticker-chip.stat-positive em { color: var(--positive); }
.ticker-chip.stat-negative em { color: var(--negative); }

.command-bar-status {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.command-bar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.warning-trigger { color: #ef4444; position: relative; font-size: 1.1rem; }
.warning-count {
  position: absolute; top: -2px; right: -2px; min-width: 15px; height: 15px;
  border-radius: 999px; background: #dc2626; color: #fff; font-size: 10px;
  line-height: 15px; text-align: center; font-weight: 700;
}
.warnings-popover {
  position: absolute; z-index: 30; top: 52px; right: 76px; width: 330px;
  padding: 14px 16px; border: 1px solid rgba(239,68,68,.55); border-radius: 8px;
  background: var(--panel, #111827); box-shadow: 0 10px 30px rgba(0,0,0,.35);
}
.warnings-popover ul { margin: 10px 0 0; padding-left: 18px; }
.warnings-popover li { margin: 6px 0; color: #fecaca; font-size: .82rem; }

.btn-icon {
  position: relative;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  padding: 6px 9px;
  font-size: 0.8rem;
  cursor: pointer;
  line-height: 1;
}

.btn-wallet-connected {
  color: var(--green, #34d399);
  border-color: rgba(52, 211, 153, .45);
  cursor: default;
  opacity: .95;
}

.bot-activation-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}
.bot-activation-grid label { display: flex; flex-direction: column; gap: 5px; }

.btn-icon:hover {
  border-color: var(--accent);
  color: var(--text-primary);
}

.notif-count {
  position: absolute;
  top: -5px;
  right: -5px;
  background: var(--negative);
  color: white;
  font-size: 0.58rem;
  font-weight: 800;
  border-radius: 999px;
  padding: 1px 4px;
  min-width: 14px;
  line-height: 1.3;
}

.app-body {
  display: flex;
  flex: 1;
  min-height: 0;
}

.nav-rail {
  width: var(--rail-width);
  min-width: var(--rail-width);
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 10px 0;
  overflow-y: auto;
}

.nav-rail-divider {
  margin: 10px 10px 4px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  font-size: 0.56rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  text-align: center;
}

.nav-rail-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-rail-list li {
  padding: 9px 6px;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text-secondary);
  cursor: pointer;
  border-left: 2px solid transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  text-align: center;
  line-height: 1.2;
}

.nav-rail-list li .nav-icon {
  font-size: 1.05rem;
  line-height: 1;
}

.nav-rail-list li:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.03);
}

.nav-rail-list li.active {
  color: var(--accent);
  border-left-color: var(--accent);
  background: rgba(124, 140, 255, 0.08);
}

.nav-rail-list li .soon-tag {
  display: block;
  font-size: 0.52rem;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 1px 5px;
  letter-spacing: 0.02em;
  margin-top: 2px;
}

.workspace {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  padding-bottom: 32px;
}

.page {
  animation: fade-in 180ms ease;
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.page-placeholder {
  margin: 48px auto;
  max-width: 420px;
  text-align: center;
  color: var(--text-muted);
  padding: 32px;
}

.page-placeholder .placeholder-icon {
  font-size: 1.8rem;
  margin-bottom: 8px;
}

.page-placeholder h2 {
  color: var(--text-secondary);
  font-size: 1rem;
  margin: 0 0 8px;
}

.system-terminal {
  background: var(--surface);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.system-terminal-handle {
  width: 100%;
  height: var(--terminal-handle-height);
  min-height: var(--terminal-handle-height);
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 16px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.68rem;
  letter-spacing: 0.02em;
  cursor: pointer;
  font-family: inherit;
}

.system-terminal-caret {
  font-weight: 700;
  color: var(--text-secondary);
}

.system-terminal.open .system-terminal-caret::before {
  content: "▼ ";
}

.statusbar-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.system-terminal-body {
  border-top: 1px solid var(--border);
  height: var(--terminal-body-height);
  display: flex;
  flex-direction: column;
}

.system-terminal-tabs {
  display: flex;
  gap: 6px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.system-terminal-content {
  flex: 1;
  overflow-y: auto;
  padding: 0 12px 10px;
}

.system-terminal-content .terminal-table {
  font-size: 0.76rem;
}

.system-terminal-content .activity-list {
  max-height: none;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
}

.status-dot.dot-ok { background: var(--positive); }
.status-dot.dot-warn { background: var(--warning); }
.status-dot.dot-off { background: var(--negative); }

/* --- Bandeiras de estado (topo) ------------------------------------------ */

.live-banner {
  background: var(--live);
  color: white;
  font-weight: 800;
  font-size: 0.9rem;
  text-align: center;
  padding: 8px;
  letter-spacing: 0.05em;
  animation: pulse 1.4s infinite;
}

.emergency-banner {
  background: #7f1d1d;
  color: white;
  font-weight: 700;
  text-align: center;
  padding: 8px;
  font-size: 0.85rem;
}

@keyframes pulse {
  0%, 100% { background: var(--live); }
  50% { background: #b91c1c; }
}

/* --- Badges de status ---------------------------------------------------- */

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

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.badge-paper { background: rgba(34,197,94,0.12); color: var(--paper); border: 1px solid var(--paper); }
.badge-live { background: rgba(239,68,68,0.18); color: white; border: 1px solid var(--live); animation: pulse-badge 1.4s infinite; }
.badge-ok { background: rgba(59,130,246,0.12); color: var(--information); border: 1px solid var(--information); }
.badge-blocked { background: rgba(239,68,68,0.12); color: var(--negative); border: 1px solid var(--negative); }
.badge-on { background: rgba(34,197,94,0.12); color: var(--positive); border: 1px solid var(--positive); }
.badge-off { background: rgba(107,114,128,0.12); color: var(--text-muted); border: 1px solid var(--text-muted); }

@keyframes pulse-badge {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.72; }
}

/* --- Controles / botoes --------------------------------------------------- */

.controls {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 24px 12px;
  flex-wrap: wrap;
}

.controls-note {
  color: var(--text-muted);
  font-size: 0.78rem;
}

.controls-note code {
  background: var(--surface);
  padding: 1px 5px;
  border-radius: 4px;
}

.btn {
  background: var(--surface);
  color: var(--text-primary);
  border: 1px solid var(--border);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.82rem;
  transition: border-color 120ms ease, background 120ms ease;
}

.btn:hover {
  border-color: var(--accent);
}

.btn-primary {
  border-color: var(--positive);
  color: var(--positive);
}

.btn-danger {
  border-color: var(--negative);
  color: var(--negative);
  font-weight: 800;
}

.btn-danger:hover {
  background: var(--negative);
  color: white;
}

.btn-emergency {
  background: var(--negative);
  color: white;
  border-color: var(--negative);
  font-weight: 800;
}

.btn-emergency:hover {
  background: #b91c1c;
}

.btn-emergency-ready {
  background: transparent;
  color: var(--positive);
  border-color: var(--positive);
  font-weight: 800;
}

.btn-emergency-ready:hover {
  background: rgba(34, 197, 94, 0.1);
}

.btn-emergency-active {
  background: var(--negative);
  color: white;
  border-color: var(--negative);
  font-weight: 800;
  animation: pulse-badge 1.4s infinite;
}

.btn-emergency-active:hover {
  background: #b91c1c;
}

.btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.btn:disabled:hover {
  border-color: var(--border);
  background: var(--surface);
  color: var(--text-primary);
}

/* --- Grids de metricas ----------------------------------------------------- */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  padding: 0 24px 16px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.stat-label {
  font-size: 0.66rem;
  color: var(--text-muted);
  letter-spacing: 0.06em;
  font-weight: 700;
}

.stat-value {
  font-size: 1.3rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.stat-positive { color: var(--positive); }
.stat-negative { color: var(--negative); }

.panels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 0 24px;
}

.panel-wide {
  grid-column: 1 / -1;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
}

.panel h2 {
  margin: 0 0 12px;
  font-size: 0.85rem;
  letter-spacing: 0.02em;
}

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.section-heading h2 { margin: 0 0 3px; }

.section-subtitle {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.7rem;
}

.section-live-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  border: 1px solid rgba(34, 197, 94, 0.35);
  border-radius: 999px;
  color: var(--positive);
  background: rgba(34, 197, 94, 0.08);
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.05em;
}

.section-live-pill i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 7px currentColor;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

th, td {
  text-align: left;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
}

th {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.active-strategies-table th:not(:first-child),
.active-strategies-table td:not(:first-child) { text-align: right; }

.active-strategies-table tbody tr { transition: background 120ms ease; }
.active-strategies-table tbody tr:hover { background: rgba(124, 140, 255, 0.06); }
.active-strategies-table tbody tr:last-child td { border-bottom: 0; }

.strategy-name-cell {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 180px;
}

.strategy-name-cell strong,
.strategy-name-cell small { display: block; }
.strategy-name-cell strong { font-size: 0.78rem; font-weight: 700; color: var(--text-primary); }
.strategy-name-cell small { margin-top: 2px; color: var(--text-muted); font-size: 0.62rem; }

.strategy-mark {
  display: inline-grid;
  place-items: center;
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  font-size: 0.72rem;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, #6475ff, #9b6dff);
  box-shadow: 0 4px 12px rgba(100, 117, 255, 0.2);
}
.strategy-mark-rsi { background: linear-gradient(135deg, #0ea5e9, #22c55e); }
.strategy-mark-macd { background: linear-gradient(135deg, #f59e0b, #ef4444); }
.metric-money, .metric-number { font-variant-numeric: tabular-nums; white-space: nowrap; }
.metric-money { color: var(--text-primary); font-weight: 650; }
.metric-number { color: var(--text-secondary); }

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

footer.page-footer {
  padding: 12px 24px;
  color: var(--text-muted);
  font-size: 0.72rem;
}

.sidebar-toggle {
  display: none;
  padding: 6px 10px;
  font-size: 1rem;
  line-height: 1;
}

@media (max-width: 900px) {
  .panels { grid-template-columns: 1fr; }
  .nav-rail { position: fixed; top: 0; left: -100%; height: 100%; z-index: 30; transition: left 160ms ease; width: 180px; min-width: 180px; }
  .nav-rail.open { left: 0; }
  .nav-rail-list li { flex-direction: row; justify-content: flex-start; text-align: left; padding: 9px 14px; }
  .command-bar-tickers, .command-bar-metrics { display: none; }
  .overview-tickers { grid-template-columns: repeat(2, minmax(0, 1fr)); padding-inline: 16px; }
  .sidebar-toggle { display: inline-block; }
}

/* --- Command Palette (Cmd+K) ---------------------------------------------- */

.cmdk-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 12vh 16px;
  z-index: 110;
}

.cmdk-panel {
  width: 100%;
  max-width: 560px;
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--glow-accent), 0 18px 40px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}

.cmdk-input {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  padding: 16px 18px;
  font-size: 0.95rem;
  outline: none;
}

.cmdk-results {
  list-style: none;
  margin: 0;
  padding: 6px;
  max-height: 320px;
  overflow-y: auto;
}

.cmdk-results li {
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  color: var(--text-secondary);
  cursor: pointer;
}

.cmdk-results li:hover {
  background: rgba(124, 140, 255, 0.1);
  color: var(--text-primary);
}

.cmdk-results li.empty {
  color: var(--text-muted);
  cursor: default;
}

.cmdk-results li.empty:hover {
  background: none;
}

/* --- Modal de Configuracoes / Wizard ------------------------------------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 16px;
  z-index: 100;
  overflow-y: auto;
}

.modal {
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 520px;
  padding: 20px 24px 28px;
}

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

.modal-header h2 {
  margin: 0;
  font-size: 1.05rem;
}

.btn-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.1rem;
  cursor: pointer;
}

.modal-section {
  border-top: 1px solid var(--border);
  padding-top: 16px;
  margin-top: 16px;
}

.modal-section h3 {
  margin: 0 0 12px;
  font-size: 0.85rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.modal label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.modal input,
.modal select {
  background: var(--background);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 0.9rem;
}

.wizard-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.checklist {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  font-size: 0.82rem;
}

.checklist li {
  padding: 4px 0;
  display: flex;
  gap: 8px;
  align-items: baseline;
}

.checklist .ok { color: var(--positive); }
.checklist .fail { color: var(--negative); }

.badge-off.exchange-connected {
  background: rgba(34, 197, 94, 0.12);
  color: var(--positive);
  border-color: var(--positive);
}

#exchange-status-badge:not(.exchange-connected) {
  cursor: pointer;
}

#exchange-status-badge:not(.exchange-connected):hover {
  border-color: var(--information);
  color: var(--information);
}

.strategy-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 6px 0 !important;
}

.strategy-row-info {
  color: var(--text-primary);
}

.strategy-name-button {
  appearance: none;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  text-align: left;
}

.strategy-name-button:hover,
.strategy-name-button:focus-visible { color: var(--text-primary); text-decoration: underline; }

.strategy-explanation {
  margin-top: 12px;
  padding: 13px 15px;
  border: 1px solid rgba(124, 140, 255, 0.35);
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(124, 140, 255, 0.1), rgba(24, 27, 35, 0.9));
}

.strategy-explanation-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.strategy-explanation h4 { margin: 3px 0 8px; font-size: 0.95rem; }
.strategy-explanation p { margin: 6px 0; color: var(--text-secondary); font-size: 0.78rem; line-height: 1.45; }
.strategy-explanation dl { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 10px 0 0; }
.strategy-explanation dl div { min-width: 100px; }
.strategy-explanation dt { color: var(--text-muted); font-size: 0.62rem; text-transform: uppercase; }
.strategy-explanation dd { margin: 2px 0 0; color: var(--text-primary); font-size: 0.76rem; }
.eyebrow { color: var(--information); font-size: 0.6rem; font-weight: 800; letter-spacing: .08em; }

.muted {
  color: var(--text-muted);
  font-size: 0.75rem;
}

.btn-mini {
  background: transparent;
  border: 1px solid var(--negative);
  color: var(--negative);
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 0.72rem;
  cursor: pointer;
}

.login-modal {
  max-width: 340px;
  text-align: center;
  margin: 15vh auto 0;
}

.login-modal h2 {
  margin: 0 0 4px;
}

.login-modal label {
  text-align: left;
}

.money-mode-note {
  margin: 0 24px 16px;
  padding: 10px 14px;
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid var(--information);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.85rem;
}

.money-mode-note.money-mode-live {
  background: rgba(239, 68, 68, 0.1);
  border-color: var(--negative);
}

.live-modal {
  max-width: 460px;
}

.live-warning {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid var(--negative);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  color: var(--text-primary);
  margin: 0 0 16px;
  font-size: 0.85rem;
}

.live-blocked {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid var(--negative);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin: 0 0 16px;
}

.live-phrase-display {
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px;
  text-align: center;
  word-break: break-all;
  margin: 6px 0 16px;
}

.live-phrase-display code {
  color: var(--negative);
  font-weight: 700;
}

.live-preview-table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 16px;
  font-size: 0.85rem;
}

.live-preview-table td {
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}

.live-preview-table td:first-child {
  color: var(--text-muted);
}

.live-preview-table td:last-child {
  text-align: right;
  font-weight: 600;
}

.btn-live-off {
  background: transparent;
  color: var(--positive);
  border-color: var(--positive);
  font-weight: 800;
}

.btn-live-off:hover {
  background: rgba(34, 197, 94, 0.1);
}

.btn-live-on {
  background: var(--negative);
  border-color: var(--negative);
  color: #fff;
  animation: pulse-badge 2s infinite;
}

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

.activity-header h2 {
  margin: 0;
}

.activity-filters {
  display: flex;
  gap: 6px;
}

.btn-mini-filter {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 0.7rem;
  font-weight: 700;
  cursor: pointer;
}

.btn-mini-filter.active {
  border-color: var(--information);
  color: var(--information);
}

.activity-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 260px;
  overflow-y: auto;
  scrollbar-width: thin;
}

.activity-list li.activity-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.76rem;
  min-width: 0;
}

.activity-list li:last-child {
  border-bottom: none;
}

.activity-time {
  color: var(--text-muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  font-size: 0.68rem;
  min-width: 62px;
}

.activity-message {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-primary);
}

.activity-badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  height: fit-content;
  white-space: nowrap;
  letter-spacing: 0.02em;
}

@media (max-width: 640px) {
  .activity-header { align-items: flex-start; flex-direction: column; }
  .activity-filters { width: 100%; }
  .activity-filters .btn-mini-filter { flex: 1; }
  .activity-list { max-height: 230px; }
  .activity-time { min-width: 54px; font-size: 0.62rem; }
}

.activity-badge.level-info { background: rgba(59,130,246,0.15); color: var(--information); }
.activity-badge.level-warning { background: rgba(245,158,11,0.15); color: var(--warning); }
.activity-badge.level-error, .activity-badge.level-critical { background: rgba(239,68,68,0.15); color: var(--negative); }

/* --- Catalogo de wallets (deteccao instalada/nao instalada) -------------- */

.wallet-catalog li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 8px 0 !important;
}

.wallet-catalog-info {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-primary);
  font-weight: 600;
  font-size: 0.85rem;
}

.wallet-install-state {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.wallet-install-state.installed { color: var(--positive); }
.wallet-install-state.not-installed { color: var(--text-muted); }

/* --- Trading Terminal ------------------------------------------------------ */

.trading-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 24px 12px;
  flex-wrap: wrap;
}

.trading-toolbar select {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  font-size: 0.85rem;
  font-weight: 700;
}

.backtest-inline-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 700;
}

.backtest-inline-label input {
  width: 90px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  padding: 6px 8px;
  font-size: 0.85rem;
}

.trading-price {
  font-size: 1.1rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  margin-left: auto;
}

.indicator-toggles {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 24px 12px;
  flex-wrap: wrap;
}

.indicator-toggles-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 700;
  margin-right: 2px;
}

.indicator-toggles-divider {
  width: 1px;
  height: 16px;
  background: var(--border);
  margin: 0 2px;
}

.indicator-toggle {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.7rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.indicator-toggle::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--dot-color, var(--accent));
  flex-shrink: 0;
}

.indicator-toggle.active {
  border-color: var(--dot-color, var(--accent));
  color: var(--text-primary);
  background: color-mix(in srgb, var(--dot-color, var(--accent)) 15%, transparent);
}

.live-indicator {
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text-muted);
  white-space: nowrap;
}

.trading-layout {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 12px;
  padding: 0 24px 12px;
}

.trading-chart-panel {
  min-height: 380px;
}

.trading-side {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.orderbook-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
  padding: 2px 4px;
}

.orderbook-row.ask { color: var(--negative); }
.orderbook-row.bid { color: var(--positive); }

.orderbook-spread {
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin: 4px 0;
}

.analysis-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  padding: 4px 0;
  color: var(--text-secondary);
}

.analysis-row strong {
  color: var(--text-primary);
}

.trend-bullish, .trend-strong_bullish { color: var(--positive); font-weight: 700; }
.trend-bearish, .trend-strong_bearish { color: var(--negative); font-weight: 700; }
.trend-neutral, .trend-undefined { color: var(--text-muted); font-weight: 700; }

.trading-tab.hidden { display: none; }

@media (max-width: 900px) {
  .trading-layout { grid-template-columns: 1fr; }
}

/* --- Dominus Brain --------------------------------------------------------- */

.brain-score-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.82rem;
}

.brain-score-row:last-child { border-bottom: none; }

.brain-score-value {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.brain-why-panel {
  margin-top: 12px;
  padding: 14px;
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
}

.brain-why-panel ul {
  margin: 8px 0 0;
  padding-left: 18px;
}

.brain-why-panel li {
  margin-bottom: 6px;
  color: var(--text-secondary);
}

/* --- Markets (tabela + heatmap) --------------------------------------------- */

.markets-row:hover {
  background: rgba(255, 255, 255, 0.03);
}

.heatmap-tile {
  width: 150px;
  padding: 16px;
  border-radius: var(--radius-md);
  cursor: pointer;
  color: white;
  text-align: center;
  transition: transform 120ms ease;
}

.heatmap-tile:hover {
  transform: scale(1.03);
}

.heatmap-symbol {
  font-weight: 800;
  font-size: 0.9rem;
  letter-spacing: 0.02em;
}

.heatmap-change {
  font-size: 1.15rem;
  font-weight: 700;
  margin-top: 6px;
  font-variant-numeric: tabular-nums;
}

/* --- System Pipeline (Command Center -- DOMINUS SPATIAL OS Fase 2) -------- */
/* Market Data -> Dominus Core -> Strategy -> Risk Engine -> Bot ->
   Execution -> Exchange/DEX -> Wallet -> Profit -> Reserve. Cada no reflete
   um campo real ja existente (status/positions/strategies/wallets/
   performance/trades) -- nunca um numero ou animacao inventados. */

.pipeline-panel {
  margin: 0 24px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
}

.pipeline-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.pipeline-header h2 {
  margin: 0;
  font-size: 0.85rem;
}

.pipeline-note {
  font-size: 0.68rem;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

.pipeline-flow {
  display: flex;
  align-items: stretch;
  gap: 0;
  overflow-x: auto;
  padding-bottom: 4px;
}

.pipeline-node {
  flex: 0 0 auto;
  width: 108px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.015);
  text-align: center;
}

.pipeline-node-icon {
  font-size: 1.15rem;
  line-height: 1;
}

.pipeline-node-label {
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
}

.pipeline-node-status {
  font-size: 0.66rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.pipeline-node-status.status-ok { color: var(--positive); }
.pipeline-node-status.status-warn { color: var(--warning); }
.pipeline-node-status.status-off { color: var(--text-muted); }
.pipeline-node-status.status-alert { color: var(--negative); }
.pipeline-node-status.status-accent { color: var(--accent); }

.pipeline-node.node-active {
  border-color: var(--accent);
  box-shadow: var(--glow-accent);
}

.pipeline-connector {
  flex: 0 0 26px;
  align-self: center;
  height: 2px;
  background: var(--border);
  position: relative;
}

.pipeline-connector::after {
  content: "";
  position: absolute;
  right: -1px;
  top: -3px;
  border: 4px solid transparent;
  border-left-color: var(--border);
}

.pipeline-connector.connector-active {
  background: var(--accent);
  animation: connector-flow 1.1s linear infinite;
}

.pipeline-connector.connector-active::after {
  border-left-color: var(--accent);
}

@keyframes connector-flow {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

@media (max-width: 900px) {
  .pipeline-flow { gap: 0; }
}

/* --- Workflow (canvas espacial -- DOMINUS SPATIAL OS Fase 3) -------------- */
/* Mesmos 10 nos do System Pipeline (Overview), agora num canvas 2D com
   pan (arrastar) e zoom (scroll). Layout fixo (nao editavel) -- reflete o
   fluxo real do sistema, nao um quadro em branco pra desenhar. */

.workflow-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 24px 12px;
  flex-wrap: wrap;
}

.workflow-toolbar .controls-note {
  max-width: 640px;
}

.workflow-canvas {
  position: relative;
  margin: 0 24px 24px;
  height: 560px;
  overflow: hidden;
  background:
    radial-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 22px 22px;
  background-color: var(--background);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: grab;
}

.workflow-canvas.grabbing {
  cursor: grabbing;
}

.workflow-canvas-inner {
  position: absolute;
  top: 0;
  left: 0;
  width: 1px;
  height: 1px;
  transform-origin: 0 0;
}

.workflow-connectors {
  position: absolute;
  top: 0;
  left: 0;
  overflow: visible;
  pointer-events: none;
}

.workflow-connectors path {
  fill: none;
  stroke: var(--border);
  stroke-width: 2;
}

.workflow-connectors path.connector-active {
  stroke: var(--accent);
  animation: connector-flow 1.1s linear infinite;
}

.workflow-node {
  position: absolute;
  width: 148px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-elevated);
  text-align: center;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}

.workflow-node.node-active {
  border-color: var(--accent);
  box-shadow: var(--glow-accent), 0 4px 14px rgba(0, 0, 0, 0.35);
}

.workflow-node-icon {
  font-size: 1.4rem;
  line-height: 1;
}

.workflow-node-label {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
}

.workflow-node-status {
  font-size: 0.72rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.workflow-node-status.status-ok { color: var(--positive); }
.workflow-node-status.status-warn { color: var(--warning); }
.workflow-node-status.status-off { color: var(--text-muted); }
.workflow-node-status.status-alert { color: var(--negative); }
.workflow-node-status.status-accent { color: var(--accent); }

/* --- Agents (modulos reais do backend, status + ultimas acoes) ----------- */

.agents-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
  padding: 0 24px 24px;
}

.agent-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.agent-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.agent-card-icon {
  font-size: 1.4rem;
}

.agent-card-title {
  font-weight: 800;
  font-size: 0.85rem;
  letter-spacing: 0.03em;
}

.agent-card-status {
  margin-left: auto;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid currentColor;
}

.agent-card-status.status-ok { color: var(--positive); }
.agent-card-status.status-off { color: var(--text-muted); }
.agent-card-status.status-alert { color: var(--negative); }

.agent-card-desc {
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.agent-card-feed {
  list-style: none;
  margin: 0;
  padding: 8px 0 0;
  border-top: 1px solid var(--border);
  max-height: 160px;
  overflow-y: auto;
}

.agent-card-feed li {
  font-size: 0.74rem;
  padding: 4px 0;
  color: var(--text-secondary);
  display: flex;
  gap: 6px;
}

.agent-card-feed .activity-time {
  font-size: 0.68rem;
}

/* --- Signal Fusion (Dominus Brain) ---------------------------------------- */

.fusion-symbol-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-bottom: 8px;
}

.fusion-symbol-card:last-child {
  margin-bottom: 0;
}

.fusion-symbol-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.fusion-verdict {
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid currentColor;
}

.fusion-verdict-confluence { color: var(--positive); }
.fusion-verdict-conflict { color: var(--negative); }
.fusion-verdict-single_signal { color: var(--accent); }
.fusion-verdict-no_signal { color: var(--text-muted); }

/* --- SafePal Live dry-run (Dominus Brain) --------------------------------- */

.safepal-live-controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.safepal-live-controls select {
  background: var(--background);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
}

.safepal-state-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}

.safepal-state-badge {
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid currentColor;
  margin-right: 8px;
}

.safepal-state-ready_for_confirmation { color: var(--positive); }
.safepal-state-simulation_failed { color: var(--negative); }
.safepal-state-rejected_by_risk { color: var(--negative); }
