@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* ========================================
   TRADING PLATFORM — PREMIUM DESIGN SYSTEM
   ======================================== */

:root {
  /* --- Core Colors --- */
  --bg-primary: #0a0e1a;
  --bg-secondary: #111827;
  --bg-tertiary: #1a2234;
  --bg-card: rgba(17, 24, 39, 0.8);
  --bg-card-hover: rgba(26, 34, 52, 0.9);
  --bg-glass: rgba(255, 255, 255, 0.03);
  --bg-glass-hover: rgba(255, 255, 255, 0.06);

  /* --- Accent Colors --- */
  --accent-primary: #6366f1;
  --accent-primary-light: #818cf8;
  --accent-primary-glow: rgba(99, 102, 241, 0.3);
  --accent-secondary: #8b5cf6;
  --accent-cyan: #22d3ee;
  --accent-cyan-glow: rgba(34, 211, 238, 0.2);

  /* --- Semantic Colors --- */
  --color-buy: #10b981;
  --color-buy-glow: rgba(16, 185, 129, 0.25);
  --color-sell: #ef4444;
  --color-sell-glow: rgba(239, 68, 68, 0.25);
  --color-warning: #f59e0b;
  --color-warning-glow: rgba(245, 158, 11, 0.2);
  --color-neutral: #6b7280;
  --color-info: #3b82f6;

  /* --- Text Colors --- */
  --text-primary: #f3f4f6;
  --text-secondary: #9ca3af;
  --text-tertiary: #6b7280;
  --text-accent: #818cf8;
  --text-muted: #4b5563;

  /* --- Borders --- */
  --border-subtle: rgba(255, 255, 255, 0.06);
  --border-default: rgba(255, 255, 255, 0.1);
  --border-accent: rgba(99, 102, 241, 0.3);

  /* --- Gradients --- */
  --gradient-primary: linear-gradient(135deg, #6366f1, #8b5cf6);
  --gradient-success: linear-gradient(135deg, #10b981, #059669);
  --gradient-danger: linear-gradient(135deg, #ef4444, #dc2626);
  --gradient-glass: linear-gradient(135deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.01));
  --gradient-card: linear-gradient(145deg, rgba(17, 24, 39, 0.9), rgba(10, 14, 26, 0.95));
  --gradient-hero: linear-gradient(135deg, #0a0e1a 0%, #1a1040 50%, #0a0e1a 100%);
  --gradient-sidebar: linear-gradient(180deg, #111827, #0a0e1a);

  /* --- Shadows --- */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 20px var(--accent-primary-glow);
  --shadow-buy-glow: 0 0 20px var(--color-buy-glow);
  --shadow-sell-glow: 0 0 20px var(--color-sell-glow);

  /* --- Spacing --- */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;

  /* --- Radius --- */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* --- Typography --- */
  --font-sans: 'Inter', -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  /* --- Transitions --- */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);

  /* --- Z-index --- */
  --z-sidebar: 100;
  --z-header: 200;
  --z-modal: 500;
  --z-toast: 600;
}

/* ========== RESET ========== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 14px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

a {
  color: var(--text-accent);
  text-decoration: none;
}

button {
  cursor: pointer;
  border: none;
  outline: none;
  font-family: inherit;
}

input,
select,
textarea {
  font-family: inherit;
}

/* ========== LAYOUT ========== */
.app-layout {
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  grid-row: 1 / -1;
  background: var(--gradient-sidebar);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--space-md) 0;
  gap: 2px;
  z-index: var(--z-sidebar);
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 60px;
  overflow-x: hidden;
  overflow-y: auto;
  transition: width var(--transition-normal);
}

.sidebar:hover {
  width: 200px;
}

.sidebar-logo {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--gradient-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 18px;
  color: white;
  margin-bottom: var(--space-md);
  box-shadow: var(--shadow-glow);
  flex-shrink: 0;
}

.sidebar-group-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1.2px;
  color: var(--text-muted);
  text-transform: uppercase;
  padding: var(--space-sm) var(--space-sm) 2px;
  width: 100%;
  text-align: center;
  white-space: nowrap;
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  transition: opacity var(--transition-normal), max-height var(--transition-normal);
}

.sidebar:hover .sidebar-group-label {
  opacity: 1;
  max-height: 24px;
}

.sidebar-divider {
  width: 70%;
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
  margin: var(--space-xs) auto;
  flex-shrink: 0;
}

.sidebar-spacer {
  flex: 1;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  flex: 1;
}

.sidebar-btn {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  font-size: 20px;
  transition: all var(--transition-fast);
  position: relative;
  flex-shrink: 0;
  overflow: hidden;
  white-space: nowrap;
}

.sidebar:hover .sidebar-btn {
  width: calc(100% - 16px);
  margin: 0 8px;
  justify-content: flex-start;
  padding-left: 12px;
  border-radius: var(--radius-sm);
}

.sidebar-btn svg {
  flex-shrink: 0;
  transition: color var(--transition-fast);
}

.sidebar-label {
  font-size: 12px;
  font-weight: 500;
  opacity: 0;
  width: 0;
  overflow: hidden;
  transition: opacity var(--transition-normal), width var(--transition-normal);
}

.sidebar:hover .sidebar-label {
  opacity: 1;
  width: auto;
}

.sidebar-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  min-width: 16px;
  height: 16px;
  border-radius: var(--radius-full);
  background: var(--color-sell);
  color: white;
  font-size: 9px;
  font-weight: 700;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

.sidebar-badge.visible {
  display: flex;
}

.sidebar:hover .sidebar-badge {
  position: static;
  margin-left: auto;
}

.sidebar-btn:hover {
  background: var(--bg-glass-hover);
  color: var(--text-primary);
}

.sidebar-btn.active {
  background: rgba(99, 102, 241, 0.15);
  color: var(--accent-primary-light);
}

.sidebar-btn.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 0 var(--radius-full) var(--radius-full) 0;
  background: var(--accent-primary);
}

.sidebar:hover .sidebar-btn.active::before {
  left: -8px;
}

/* Remove emoji tooltip — we have labels now */
.sidebar-btn[title]::after {
  display: none;
}

/* Header */
.header {
  background: rgba(17, 24, 39, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-xl);
  z-index: var(--z-header);
  min-height: 52px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.header-title {
  font-size: 15px;
  font-weight: 700;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header-breadcrumb {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
}

.header-breadcrumb svg {
  color: var(--text-muted);
  flex-shrink: 0;
}

.header-right {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

/* Main Content */
.main-content {
  margin-left: 60px;
  min-height: 100vh;
  padding: var(--space-lg);
  overflow-y: auto;
  background: radial-gradient(ellipse at 50% 0%, rgba(99, 102, 241, 0.05) 0%, transparent 60%);
  transition: margin-left var(--transition-normal);
}

/* ========== MISSING CSS VARIABLE ALIASES ========== */
/* Some inline styles reference abbreviated names — map them */
:root {
  --accent: var(--accent-primary);
  --border: var(--border-default);
  --bg: var(--bg-primary);
  --surface-1: var(--bg-secondary);
  --surface-2: var(--bg-tertiary);
  --bg-hover: var(--bg-glass-hover);
  --border-hover: var(--border-accent);
  --border-primary: var(--border-default);
  --border-color: var(--border-default);
  --buy: var(--color-buy);
  --sell: var(--color-sell);
  --card-bg: var(--bg-card);
  --bg-input: rgba(255, 255, 255, 0.05);
  --accent-color: var(--accent-primary);
}

/* ========== SKELETON SCREENS ========== */
.skeleton {
  background: linear-gradient(90deg,
    rgba(255, 255, 255, 0.04) 25%,
    rgba(255, 255, 255, 0.08) 50%,
    rgba(255, 255, 255, 0.04) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

.skeleton-text {
  height: 12px;
  margin-bottom: 8px;
  width: 80%;
}

.skeleton-text-sm {
  height: 10px;
  margin-bottom: 6px;
  width: 60%;
}

.skeleton-circle {
  border-radius: 50%;
}

.skeleton-card {
  padding: var(--space-md);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

@keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ========== UTILITY CLASSES ========== */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-xs { gap: var(--space-xs); }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }
.text-xs { font-size: 10px; }
.text-sm { font-size: 12px; }
.text-md { font-size: 14px; }
.text-muted { color: var(--text-tertiary); }
.text-center { text-align: center; }
.font-mono { font-family: var(--font-mono); }
.font-bold { font-weight: 700; }
.w-full { width: 100%; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-md); }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: var(--space-md); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.p-sm { padding: var(--space-sm); }
.p-md { padding: var(--space-md); }

/* ========== SCROLLBAR ========== */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* ========== MOBILE BOTTOM NAV ========== */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: var(--z-sidebar);
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-subtle);
  padding: 4px 0 env(safe-area-inset-bottom, 4px);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.mobile-nav-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0;
}

.mobile-nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 4px;
  background: none;
  border: none;
  color: var(--text-tertiary);
  font-size: 9px;
  font-weight: 500;
  cursor: pointer;
  transition: color var(--transition-fast);
}

.mobile-nav-btn svg {
  width: 20px;
  height: 20px;
}

.mobile-nav-btn.active {
  color: var(--accent-primary-light);
}

.mobile-nav-btn:active {
  transform: scale(0.95);
}

/* ========== RESPONSIVE ========== */
@media (max-width: 1024px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .stats-row {
    grid-template-columns: repeat(2, 1fr);
  }

  .pipeline-step {
    min-width: 70px;
    padding: 8px;
  }

  .pipeline-detail {
    display: none;
  }

  .sidebar:hover {
    width: 60px;
  }
  .sidebar:hover .sidebar-label,
  .sidebar:hover .sidebar-group-label {
    opacity: 0;
    max-height: 0;
    width: 0;
  }
  .sidebar:hover .sidebar-btn {
    width: 44px;
    margin: 0;
    justify-content: center;
    padding-left: 0;
    border-radius: var(--radius-md);
  }
}

@media (max-width: 768px) {
  .sidebar {
    display: none;
  }

  .main-content {
    margin-left: 0;
    padding-bottom: 64px;
  }

  .mobile-bottom-nav {
    display: block;
  }

  .stats-row {
    grid-template-columns: 1fr 1fr;
  }

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

  .header-title {
    font-size: 13px;
  }

  .header-breadcrumb {
    display: none;
  }

  .grid-2, .grid-3 {
    grid-template-columns: 1fr;
  }
}
.card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  transition: all var(--transition-normal);
  position: relative;
  overflow: visible;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
}

.card:hover {
  border-color: var(--border-accent);
  box-shadow: var(--shadow-glow);
  transform: translateY(-1px);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-md);
}

.card-title {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-secondary);
}

.card-title-icon {
  margin-right: var(--space-sm);
  font-size: 16px;
}

/* ========== STATS ========== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-md);
}

.stat-card {
  background: var(--gradient-glass);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-md) var(--space-lg);
  position: relative;
  overflow: hidden;
}

.stat-label {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-tertiary);
  margin-bottom: 4px;
}

.stat-value {
  font-size: 28px;
  font-weight: 800;
  font-family: var(--font-mono);
  line-height: 1.2;
}

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

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

.stat-value.neutral {
  color: var(--text-secondary);
}

.stat-value.accent {
  color: var(--accent-primary-light);
}

.stat-change {
  font-size: 12px;
  font-weight: 500;
  margin-top: 2px;
}

.stat-change.up {
  color: var(--color-buy);
}

.stat-change.down {
  color: var(--color-sell);
}

.stat-icon {
  position: absolute;
  right: var(--space-md);
  top: 50%;
  transform: translateY(-50%);
  font-size: 32px;
  opacity: 0.1;
}

/* ========== BUTTONS ========== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
}

.btn-primary {
  background: var(--gradient-primary);
  color: white;
  box-shadow: var(--shadow-glow);
}

.btn-primary:hover {
  box-shadow: 0 0 30px var(--accent-primary-glow);
  transform: translateY(-1px);
}

.btn-success {
  background: var(--gradient-success);
  color: white;
  box-shadow: var(--shadow-buy-glow);
}

.btn-danger {
  background: var(--gradient-danger);
  color: white;
  box-shadow: var(--shadow-sell-glow);
}

.btn-outline {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-default);
}

.btn-outline:hover {
  background: var(--bg-glass-hover);
  color: var(--text-primary);
  border-color: var(--border-accent);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  padding: var(--space-xs) var(--space-sm);
}

.btn-ghost:hover {
  color: var(--text-primary);
  background: var(--bg-glass-hover);
}

.btn-sm {
  padding: 4px 10px;
  font-size: 12px;
}

.btn-lg {
  padding: 12px 24px;
  font-size: 15px;
}

/* ========== BADGE ========== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.badge-buy {
  background: var(--color-buy-glow);
  color: var(--color-buy);
}

.badge-sell {
  background: var(--color-sell-glow);
  color: var(--color-sell);
}

.badge-warning {
  background: var(--color-warning-glow);
  color: var(--color-warning);
}

.badge-neutral {
  background: rgba(107, 114, 128, 0.2);
  color: var(--text-secondary);
}

.badge-accent {
  background: var(--accent-primary-glow);
  color: var(--accent-primary-light);
}

.badge-info {
  background: rgba(59, 130, 246, 0.2);
  color: var(--color-info);
}

/* ========== TABLES ========== */
.table-container {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

thead {
  background: rgba(255, 255, 255, 0.03);
}

th {
  padding: var(--space-sm) var(--space-md);
  text-align: left;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-tertiary);
  border-bottom: 1px solid var(--border-subtle);
}

td {
  padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}

tr:last-child td {
  border-bottom: none;
}

tr:hover td {
  background: var(--bg-glass);
  color: var(--text-primary);
}

td.mono {
  font-family: var(--font-mono);
}

/* ========== PROGRESS BAR ========== */
.progress-bar {
  height: 6px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
  position: relative;
}

.progress-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width var(--transition-slow);
  position: relative;
}

.progress-fill.buy {
  background: var(--gradient-success);
}

.progress-fill.sell {
  background: var(--gradient-danger);
}

.progress-fill.accent {
  background: var(--gradient-primary);
}

.progress-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  animation: shimmer 2s ease-in-out infinite;
}

/* ========== TOGGLE ========== */
.toggle {
  width: 40px;
  height: 22px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.1);
  cursor: pointer;
  position: relative;
  transition: background var(--transition-fast);
}

.toggle.active {
  background: var(--accent-primary);
}

.toggle::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: white;
  transition: transform var(--transition-fast);
}

.toggle.active::after {
  transform: translateX(18px);
}

/* ========== AGENT CARDS ========== */
.agents-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--space-md);
}

.agent-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
}

.agent-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
}

.agent-card.regime::before {
  background: var(--gradient-primary);
}

.agent-card.trend::before {
  background: linear-gradient(90deg, #3b82f6, #2563eb);
}

.agent-card.volatility::before {
  background: linear-gradient(90deg, #f59e0b, #d97706);
}

.agent-card.timing::before {
  background: linear-gradient(90deg, #22d3ee, #0891b2);
}

.agent-card.price-action::before {
  background: linear-gradient(90deg, #ef4444, #dc2626);
}

.agent-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: var(--border-accent);
}

.agent-card.disabled {
  opacity: 0.5;
}

.agent-card.disabled:hover {
  transform: none;
  box-shadow: none;
}

.agent-name {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 4px;
}

.agent-desc {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-bottom: var(--space-md);
}

.agent-score {
  font-size: 36px;
  font-weight: 900;
  font-family: var(--font-mono);
  line-height: 1;
}

.agent-direction {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* ========== RISK PANEL ========== */
.risk-rules {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--space-sm);
}

.risk-rule {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-sm);
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  font-size: 12px;
}

.risk-rule-icon {
  font-size: 16px;
}

.risk-rule-icon.pass {
  color: var(--color-buy);
}

.risk-rule-icon.fail {
  color: var(--color-sell);
}

.risk-rule-name {
  flex: 1;
  color: var(--text-secondary);
}

.risk-rule-value {
  font-family: var(--font-mono);
  font-weight: 600;
}

/* ========== KILL SWITCH ========== */
.kill-switch-container {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-md);
  border: 2px solid;
  transition: all var(--transition-normal);
}

.kill-switch-container.inactive {
  border-color: var(--color-buy);
  background: var(--color-buy-glow);
}

.kill-switch-container.active {
  border-color: var(--color-sell);
  background: var(--color-sell-glow);
  animation: pulse-danger 2s ease-in-out infinite;
}

/* ========== POSITIONS TABLE ========== */
.position-pnl.positive {
  color: var(--color-buy);
  font-weight: 700;
}

.position-pnl.negative {
  color: var(--color-sell);
  font-weight: 700;
}

/* ========== DASHBOARD GRID ========== */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto auto 1fr;
  gap: var(--space-md);
}

.dashboard-grid .full-width {
  grid-column: 1 / -1;
}

/* ========== SECTION TABS ========== */
.section-tabs {
  display: flex;
  gap: 2px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-md);
  padding: 3px;
  border: 1px solid var(--border-subtle);
}

.section-tab {
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-tertiary);
  background: transparent;
  transition: all var(--transition-fast);
  border: none;
}

.section-tab:hover {
  color: var(--text-primary);
  background: var(--bg-glass-hover);
}

.section-tab.active {
  color: white;
  background: var(--accent-primary);
  box-shadow: var(--shadow-glow);
}

/* ========== INPUT ========== */
.input {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  padding: var(--space-sm) var(--space-md);
  color: var(--text-primary);
  font-size: 13px;
  transition: border-color var(--transition-fast);
  width: 100%;
}

.input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-primary-glow);
}

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

.input-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-tertiary);
}

/* ========== TOAST ========== */
.toast-container {
  position: fixed;
  top: var(--space-lg);
  right: var(--space-lg);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.toast {
  background: var(--bg-secondary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: var(--space-md) var(--space-lg);
  min-width: 280px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  animation: slideIn 0.3s ease-out;
  box-shadow: var(--shadow-lg);
}

.toast-success {
  border-color: var(--color-buy);
}

.toast-error {
  border-color: var(--color-sell);
}

.toast-warning {
  border-color: var(--color-warning);
}

/* ========== STATUS DOT ========== */
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.status-dot.online {
  background: var(--color-buy);
  box-shadow: 0 0 8px var(--color-buy-glow);
  animation: pulse-dot 2s ease-in-out infinite;
}

.status-dot.offline {
  background: var(--color-sell);
}

.status-dot.idle {
  background: var(--color-warning);
}

/* ========== SCORE RING ========== */
.score-ring {
  width: 80px;
  height: 80px;
  position: relative;
}

.score-ring svg {
  transform: rotate(-90deg);
}

.score-ring-bg {
  stroke: rgba(255, 255, 255, 0.06);
  fill: none;
  stroke-width: 6;
}

.score-ring-fill {
  fill: none;
  stroke-width: 6;
  stroke-linecap: round;
  transition: stroke-dashoffset 1s ease;
}

.score-ring-value {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 22px;
  font-weight: 800;
  font-family: var(--font-mono);
}

/* ========== ANIMATIONS ========== */
@keyframes shimmer {
  0% {
    transform: translateX(-100%);
  }

  100% {
    transform: translateX(200%);
  }
}

@keyframes pulse-dot {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.5;
  }
}

@keyframes pulse-danger {

  0%,
  100% {
    box-shadow: 0 0 0 0 var(--color-sell-glow);
  }

  50% {
    box-shadow: 0 0 20px 5px var(--color-sell-glow);
  }
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }

  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes float {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-4px);
  }
}

.animate-in {
  animation: fadeIn 0.4s ease-out forwards;
}

.animate-float {
  animation: float 3s ease-in-out infinite;
}

/* ========== SECTION PAGES ========== */
.page {
  display: none;
}

.page.active {
  display: block;
  animation: fadeIn 0.3s ease-out;
}

.page-title {
  font-size: 22px;
  font-weight: 800;
  margin-bottom: var(--space-lg);
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ========== STATS ROW ========== */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}

.stat-detail {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 2px;
}

/* ========== PIPELINE FLOW ========== */
.pipeline-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  min-width: 100px;
  transition: all var(--transition-normal);
  position: relative;
}

.pipeline-step:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--step-color, var(--accent-primary));
  box-shadow: 0 0 15px rgba(99, 102, 241, 0.2);
  transform: translateY(-2px);
}

.pipeline-icon {
  font-size: 24px;
  margin-bottom: 4px;
  animation: float 3s ease-in-out infinite;
}

.pipeline-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-primary);
  text-align: center;
}

.pipeline-detail {
  font-size: 9px;
  color: var(--text-tertiary);
  text-align: center;
  margin-top: 2px;
}

.pipeline-arrow {
  font-size: 18px;
  color: var(--text-muted);
  animation: pulse-dot 2s ease-in-out infinite;
}

/* ========== PIPELINE DASHBOARD ========== */
.pipeline-stages {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.pipeline-stage-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-primary);
  border-radius: 10px;
  padding: 12px;
  text-align: center;
  transition: all var(--transition-normal);
  position: relative;
}

.pipeline-stage-card:hover {
  border-color: var(--border-accent);
  background: rgba(255, 255, 255, 0.05);
}

.pipeline-stage-card.stage-active {
  border-color: rgba(34, 197, 94, 0.4);
  background: rgba(34, 197, 94, 0.04);
}

.pipeline-stage-card.stage-error {
  border-color: rgba(239, 68, 68, 0.4);
  background: rgba(239, 68, 68, 0.04);
}

.pipeline-stage-card.stage-inactive {
  border-color: rgba(107, 114, 128, 0.3);
  opacity: 0.6;
}

.pipeline-stage-icon {
  font-size: 22px;
  margin-bottom: 6px;
}

.pipeline-stage-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.pipeline-stage-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 9px;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 600;
}

.pipeline-stage-detail {
  font-size: 9px;
  color: var(--text-tertiary);
  margin-top: 4px;
  line-height: 1.3;
}

.pipeline-metrics-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.pipeline-metric {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-primary);
  border-radius: 8px;
  padding: 10px 12px;
  text-align: center;
}

.pipeline-metric-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.pipeline-metric-label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-tertiary);
  margin-top: 2px;
}

@media (max-width: 768px) {
  .pipeline-stages {
    grid-template-columns: repeat(3, 1fr);
  }
  .pipeline-metrics-row {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ========== KILL SWITCH INDICATOR ========== */
.kill-switch-indicator {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  transition: all var(--transition-normal);
}

.kill-switch-container.inactive .kill-switch-indicator {
  background: var(--color-buy);
  box-shadow: 0 0 12px var(--color-buy-glow);
}

.kill-switch-container.active .kill-switch-indicator {
  background: var(--color-sell);
  box-shadow: 0 0 12px var(--color-sell-glow);
  animation: pulse-danger 1.5s ease-in-out infinite;
}

.kill-switch-container {
  justify-content: space-between;
}

.kill-switch-label {
  font-size: 15px;
  font-weight: 700;
}

.kill-switch-desc {
  font-size: 12px;
  color: var(--text-tertiary);
}

/* ========== HEADER EXTRAS ========== */
.header-clock {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
  color: var(--accent-primary-light);
  letter-spacing: 1px;
}

.card-link {
  font-size: 12px;
  font-weight: 500;
  color: var(--accent-primary-light);
  transition: color var(--transition-fast);
}

.card-link:hover {
  color: var(--accent-primary);
  text-decoration: underline;
}

.card-header span:first-child {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-secondary);
}

/* ========== AGENTS MINI GRID ========== */
.agents-mini-grid .agent-card {
  padding: var(--space-sm) var(--space-md);
}

.agents-mini-grid .agent-name {
  font-size: 12px;
}

.agents-mini-grid .agent-desc {
  margin-bottom: 0;
}

/* ========== LAYOUT FIX (sidebar fixed + main margin) ========== */
body {
  display: block;
}

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 60px;
  z-index: var(--z-sidebar);
}

.main-content {
  margin-left: 60px;
  min-height: 100vh;
}

/* ========== SCROLLBAR ========== */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* ========== RESPONSIVE ========== */
@media (max-width: 1024px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .stats-row {
    grid-template-columns: repeat(2, 1fr);
  }

  .pipeline-step {
    min-width: 70px;
    padding: 8px;
  }

  .pipeline-detail {
    display: none;
  }
}

@media (max-width: 768px) {
  .sidebar {
    display: none;
  }

  .main-content {
    margin-left: 0;
  }

  .stats-row {
    grid-template-columns: 1fr;
  }

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

/* ===== CARDS COLAPSÁVEIS ===== */
.collapsible-card .card-body {
  overflow: visible;
  transition: max-height 0.3s ease, opacity 0.25s ease, padding 0.3s ease;
  max-height: 10000px;
  opacity: 1;
}

.collapsible-card.collapsed .card-body {
  max-height: 0 !important;
  opacity: 0;
  padding: 0 !important;
}

.card-toggle {
  cursor: pointer;
  user-select: none;
}

.card-toggle:hover {
  background: rgba(255, 255, 255, 0.03);
}

.collapse-icon {
  font-size: 12px;
  color: var(--text-tertiary);
  transition: transform 0.3s ease;
  display: inline-block;
  min-width: 14px;
  text-align: center;
}

.collapsed .collapse-icon {
  transform: rotate(-90deg);
}

.card-loading-state {
  text-align: center;
  padding: 20px;
  color: var(--text-tertiary);
  font-size: 13px;
}

.card-loading-skeleton {
  text-align: center;
  padding: 16px;
  color: var(--text-tertiary);
  font-size: 12px;
}

.card-loading-skeleton::before {
  content: '';
  display: block;
  width: 60%;
  height: 8px;
  margin: 0 auto 8px;
  background: linear-gradient(90deg, rgba(139, 92, 246, 0.05) 25%, rgba(139, 92, 246, 0.15) 50%, rgba(139, 92, 246, 0.05) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
}

@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }

  100% {
    background-position: 200% 0;
  }
}

/* ===== MULTI-TIMEFRAME PRESETS ===== */
.mtf-preset-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-tertiary);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  font-family: inherit;
}

.mtf-preset-btn:hover {
  background: rgba(139, 92, 246, 0.15);
  border-color: rgba(139, 92, 246, 0.3);
  color: #a78bfa;
}

.mtf-preset-btn.active {
  background: rgba(139, 92, 246, 0.25);
  border-color: rgba(139, 92, 246, 0.5);
  color: #c4b5fd;
  font-weight: 600;
  box-shadow: 0 0 8px rgba(139, 92, 246, 0.2);
}

/* ===== CONFLUÊNCIA MTF ===== */
.mtf-tf-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  padding: 12px;
  text-align: center;
  transition: all 0.3s ease;
}

.mtf-tf-card.analyzing {
  border-color: rgba(139, 92, 246, 0.3);
  animation: pulse 1.5s infinite;
}

.mtf-confluence-bar {
  height: 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.05);
  overflow: hidden;
  margin-top: 8px;
}

.mtf-confluence-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.5s ease;
}

/* ===== TOOLTIPS EDUCATIVOS ===== */
.edu-tooltip {
  position: relative;
  cursor: help;
}

.edu-tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(8, 10, 20, 0.98);
  border: 1px solid rgba(139, 92, 246, 0.5);
  color: #e4e4e7;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 12px;
  line-height: 1.6;
  width: max-content;
  max-width: 300px;
  z-index: 9999;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.7);
  white-space: normal;
}

.edu-tooltip::before {
  content: '';
  position: absolute;
  bottom: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: rgba(139, 92, 246, 0.5);
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.15s ease;
  pointer-events: none;
}

.edu-tooltip:hover::after,
.edu-tooltip:hover::before {
  opacity: 1;
}

/* ===== MODAL TF CUSTOM ===== */
.mtf-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.mtf-modal-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.mtf-modal {
  background: rgba(15, 20, 35, 0.98);
  border: 1px solid rgba(139, 92, 246, 0.3);
  border-radius: 16px;
  padding: 24px;
  width: 380px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
  transform: translateY(10px);
  transition: transform 0.25s ease;
}

.mtf-modal-overlay.active .mtf-modal {
  transform: translateY(0);
}

.mtf-tf-select {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  font-family: inherit;
  width: 100%;
  cursor: pointer;
  transition: border-color 0.2s;
}

.mtf-tf-select:hover,
.mtf-tf-select:focus {
  border-color: rgba(139, 92, 246, 0.5);
  outline: none;
}

/* ===== DRAG & DROP + RESIZE ===== */
.analysis-sortable {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
}

/* Asset cards — altura uniforme */
.asset-card {
  min-height: 90px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-sizing: border-box;
}

.drag-card {
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
  min-height: 80px;
  position: relative;
  display: flex;
  flex-direction: column;
}

.drag-card>.card-body {
  flex: 1;
  overflow: auto;
  min-height: 0;
  transform-origin: top left;
}

.drag-card.dragging {
  opacity: 0.4;
  transform: scale(0.96);
  box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.5);
}

.drag-card.drag-over {
  border: 2px dashed rgba(139, 92, 246, 0.6) !important;
  background: rgba(139, 92, 246, 0.05) !important;
}

.drag-handle {
  cursor: grab;
  font-size: 14px;
  color: var(--text-tertiary);
  user-select: none;
  opacity: 0.4;
  transition: opacity 0.2s, color 0.2s;
  letter-spacing: 2px;
  padding: 2px 4px;
  border-radius: 4px;
}

.drag-handle::before {
  content: '⠿';
  font-size: 16px;
}

.drag-handle:hover {
  opacity: 1;
  color: var(--accent);
  background: rgba(139, 92, 246, 0.1);
  cursor: grab;
}

.drag-handle:active {
  cursor: grabbing;
}

/* Resize handle (JS-powered) */
.resize-handle {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 20px;
  height: 20px;
  cursor: nwse-resize;
  z-index: 10;
  opacity: 0;
  transition: opacity 0.2s;
}

.resize-handle::after {
  content: '';
  position: absolute;
  bottom: 3px;
  right: 3px;
  width: 10px;
  height: 10px;
  border-right: 2px solid rgba(139, 92, 246, 0.4);
  border-bottom: 2px solid rgba(139, 92, 246, 0.4);
  border-radius: 0 0 4px 0;
}

.drag-card:hover .resize-handle {
  opacity: 1;
}

.drag-card.resizing {
  user-select: none;
  box-shadow: 0 0 0 1px rgba(139, 92, 246, 0.3);
}

@media (max-width: 768px) {
  .analysis-sortable {
    grid-template-columns: 1fr;
  }

  .analysis-sortable .drag-card {
    grid-column: 1 !important;
  }
}

/* ===== RISK PROFILE SELECTOR ===== */
.risk-profile-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 16px 28px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.03);
  cursor: pointer;
  transition: all 0.25s ease;
  min-width: 140px;
  color: var(--text-secondary);
}

.risk-profile-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.risk-profile-btn.active {
  transform: translateY(-3px);
}

.profile-conservative:hover,
.profile-conservative.active {
  border-color: rgba(34, 197, 94, 0.5);
  background: rgba(34, 197, 94, 0.08);
  box-shadow: 0 0 20px rgba(34, 197, 94, 0.15);
}

.profile-moderate:hover,
.profile-moderate.active {
  border-color: rgba(234, 179, 8, 0.5);
  background: rgba(234, 179, 8, 0.08);
  box-shadow: 0 0 20px rgba(234, 179, 8, 0.15);
}

.profile-aggressive:hover,
.profile-aggressive.active {
  border-color: rgba(239, 68, 68, 0.5);
  background: rgba(239, 68, 68, 0.08);
  box-shadow: 0 0 20px rgba(239, 68, 68, 0.15);
}

.profile-icon {
  font-size: 28px;
}

.profile-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
}

.profile-desc {
  font-size: 10px;
  color: var(--text-tertiary);
  text-align: center;
}

/* ===== HELP BANNER ===== */
.page-help-banner {
  margin: var(--space-sm) 0 var(--space-md);
  background: rgba(14, 165, 233, 0.04);
  border: 1px solid rgba(14, 165, 233, 0.12);
  border-radius: var(--radius-md);
  overflow: hidden;
  animation: helpSlideIn 0.3s ease;
}

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

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.help-banner-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 14px;
  cursor: pointer;
  transition: background 0.2s;
}

.help-banner-header:hover {
  background: rgba(14, 165, 233, 0.06);
}

.help-banner-title {
  font-size: 11px;
  font-weight: 600;
  color: #0ea5e9;
}

.help-banner-toggle {
  font-size: 10px;
  color: var(--text-tertiary);
  transition: transform 0.2s;
}

.help-banner-body {
  padding: 0 14px 12px;
  animation: helpSlideIn 0.2s ease;
}

.help-section {
  margin-bottom: 10px;
}

.help-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.help-text {
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.help-features {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px 12px;
}

.help-feature-item {
  font-size: 10px;
  color: var(--text-secondary);
  padding: 1px 0;
}

.help-tip {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  background: rgba(245, 158, 11, 0.06);
  border: 1px solid rgba(245, 158, 11, 0.12);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 10px;
  line-height: 1.5;
  color: var(--text-secondary);
}

.help-tip-icon {
  font-size: 14px;
  flex-shrink: 0;
}

/* ===== AGENT CONFIG MODAL ===== */
.agent-config-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding-top: 60px;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.agent-config-panel {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 560px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.agent-config-panel .modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.agent-config-panel .modal-body {
  padding: 16px 20px;
}

.agent-config-panel .param-group-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 12px 0 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}

.agent-config-panel .param-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid var(--border-subtle);
}

.agent-config-panel .param-label {
  font-size: 11px;
  color: var(--text-secondary);
  flex: 1;
}

.agent-config-panel .param-desc {
  font-size: 9px;
  color: var(--text-tertiary);
  margin-top: 1px;
}

.agent-config-panel .param-input {
  width: 80px;
  padding: 4px 8px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 11px;
  text-align: right;
}

.agent-config-panel .param-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.agent-config-panel .modal-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* ===== SETTINGS TABS ===== */
.settings-tab {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
  border-radius: 8px 8px 0 0;
  padding: 8px 16px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.settings-tab:hover {
  background: rgba(139, 92, 246, 0.1);
  color: var(--text-primary);
}

.settings-tab.active {
  background: var(--accent) !important;
  color: #fff !important;
  border-color: var(--accent);
  box-shadow: 0 -2px 12px rgba(139, 92, 246, 0.2);
}

.settings-panel {
  animation: fadeIn 0.3s ease;
}

/* ===== INTERNAL TABS (abas internas de páginas) ===== */
.internal-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: var(--space-md);
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border-subtle);
}

.internal-tab {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
  border-radius: 8px 8px 0 0;
  padding: 8px 16px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.internal-tab:hover {
  background: rgba(139, 92, 246, 0.1);
  color: var(--text-primary);
}

.internal-tab.active {
  background: var(--accent) !important;
  color: #fff !important;
  border-color: var(--accent);
  box-shadow: 0 -2px 12px rgba(139, 92, 246, 0.2);
}

/* ===== BOTÃO VOLTAR (drill-down chart) ===== */
.btn-back-readiness {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-secondary);
  border-radius: 8px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: var(--space-sm);
}

.btn-back-readiness:hover {
  background: rgba(139, 92, 246, 0.15);
  color: var(--text-primary);
  border-color: var(--accent);
}

/* ═══════════════════════════════════════
   PAINEL DE OPORTUNIDADES
   ═══════════════════════════════════════ */

.opportunities-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: var(--space-md);
}

.opportunity-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 16px;
    overflow: hidden;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.opportunity-card:hover {
    border-color: var(--border-accent);
    box-shadow: 0 4px 24px rgba(99, 102, 241, 0.1);
}

.opp-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 16px 12px;
    border-bottom: 1px solid var(--border-subtle);
}

.opp-card-body {
    padding: 12px 16px;
}

.opp-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
}

.opp-stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.opp-stat-label {
    font-size: 9px;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.opp-stat-value {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
}

.opp-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-top: 1px solid var(--border-subtle);
    background: rgba(0, 0, 0, 0.15);
}

.opp-countdown {
    font-size: 12px;
    font-weight: 600;
    font-family: 'JetBrains Mono', monospace;
    color: var(--color-warning);
}

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

.opp-btn-approve {
    background: rgba(16, 185, 129, 0.15) !important;
    color: #10b981 !important;
    border: 1px solid rgba(16, 185, 129, 0.3) !important;
    font-weight: 600 !important;
}

.opp-btn-approve:hover {
    background: rgba(16, 185, 129, 0.25) !important;
}

.opp-btn-reject {
    background: rgba(239, 68, 68, 0.15) !important;
    color: #ef4444 !important;
    border: 1px solid rgba(239, 68, 68, 0.3) !important;
    font-weight: 600 !important;
}

.opp-btn-reject:hover {
    background: rgba(239, 68, 68, 0.25) !important;
}

/* ═══════════════════════════════════════
   PAINEL DE POSIÇÕES
   ═══════════════════════════════════════ */

.positions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: var(--space-md);
}

.position-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 16px;
    overflow: hidden;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.position-card:hover {
    border-color: var(--border-accent);
    box-shadow: 0 4px 24px rgba(99, 102, 241, 0.1);
}

.pos-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 16px 12px;
    border-bottom: 1px solid var(--border-subtle);
}

.pos-card-body {
    padding: 12px 16px;
}

.pos-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.pos-stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.pos-stat-label {
    font-size: 9px;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.pos-stat-value {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
}

.pos-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 500;
}

.pos-badge-breakeven {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
}

.pos-badge-trailing {
    background: rgba(99, 102, 241, 0.15);
    color: #818cf8;
}

.pos-badge-confirmation {
    background: rgba(139, 92, 246, 0.15);
    color: #a78bfa;
}

.pos-card-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid var(--border-subtle);
    background: rgba(0, 0, 0, 0.15);
}

.pos-btn-modify {
    background: rgba(99, 102, 241, 0.15) !important;
    color: #818cf8 !important;
    border: 1px solid rgba(99, 102, 241, 0.3) !important;
}

.pos-btn-partial {
    background: rgba(245, 158, 11, 0.15) !important;
    color: #f59e0b !important;
    border: 1px solid rgba(245, 158, 11, 0.3) !important;
}

.pos-btn-close {
    background: rgba(239, 68, 68, 0.15) !important;
    color: #ef4444 !important;
    border: 1px solid rgba(239, 68, 68, 0.3) !important;
}

.pos-inline-form {
    padding: 12px 16px;
    border-top: 1px solid var(--border-subtle);
    background: rgba(0, 0, 0, 0.1);
}

.pos-input {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-default);
    border-radius: 8px;
    padding: 6px 10px;
    color: var(--text-primary);
    font-size: 12px;
    font-family: 'JetBrains Mono', monospace;
    width: 120px;
}

.pos-input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

/* ═══════════════════════════════════════
   EXIBIÇÃO DE SALDO COM TOGGLE
   ═══════════════════════════════════════ */

.balance-display-bar {
    margin-bottom: var(--space-md);
}

.balance-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
}

.balance-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.balance-label {
    font-size: 11px;
    color: var(--text-tertiary);
    font-weight: 500;
}

.balance-value {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
}

.balance-separator {
    color: var(--border-default);
    font-size: 14px;
}

.balance-toggle-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    padding: 4px 8px;
    border-radius: 6px;
    transition: background 0.2s ease;
    margin-left: auto;
}

.balance-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.05);
}

/* ═══════════════════════════════════════
   ANIMAÇÕES
   ═══════════════════════════════════════ */

@keyframes fadeOut {
    from { opacity: 1; transform: scale(1); }
    to { opacity: 0; transform: scale(0.95); }
}

/* ═══════════════════════════════════════
   RESPONSIVIDADE
   ═══════════════════════════════════════ */

@media (max-width: 768px) {
    .opportunities-grid,
    .positions-grid {
        grid-template-columns: 1fr;
    }
    
    .opp-stats-grid {
        grid-template-columns: 1fr 1fr;
    }
    
    .balance-bar {
        flex-wrap: wrap;
        gap: 8px;
    }
}

/* ========== PORTFOLIO & CORRELAÇÃO ========== */

/* Correlation Heatmap */
.corr-heatmap-table {
  border-collapse: collapse;
  width: auto;
  margin: 0 auto;
}

.corr-heatmap-table th,
.corr-heatmap-table td {
  padding: 0;
  border: none;
}

.corr-heatmap-th {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-align: center;
  padding: 4px 6px !important;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.corr-heatmap-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-align: right;
  padding: 4px 8px 4px 4px !important;
  white-space: nowrap;
}

.corr-heatmap-cell {
  width: 52px;
  height: 36px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  border-radius: 3px;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
  cursor: default;
  padding: 4px !important;
}

.corr-heatmap-cell:hover {
  transform: scale(1.15);
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.15);
  z-index: 2;
  position: relative;
}

.corr-legend {
  display: flex;
  justify-content: center;
  gap: var(--space-lg);
  margin-top: var(--space-md);
  font-size: 11px;
  color: var(--text-tertiary);
}

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

.corr-legend-swatch {
  display: inline-block;
  width: 16px;
  height: 10px;
  border-radius: 2px;
}

/* Regime Indicator */
.regime-indicator {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  padding: var(--space-lg) var(--space-xl);
  border: 2px solid;
  border-radius: var(--radius-lg);
  transition: all var(--transition-normal);
}

/* Exposure Bar Rows */
.exposure-bar-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 6px 0;
}

.exposure-bar-label {
  width: 50px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  text-align: right;
  flex-shrink: 0;
}

.exposure-bar-value {
  width: 55px;
  font-size: 11px;
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text-secondary);
  text-align: right;
  flex-shrink: 0;
}

.exposure-bar-pct {
  width: 40px;
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text-tertiary);
  text-align: right;
  flex-shrink: 0;
}

/* VaR Metrics */
.var-metric {
  text-align: center;
  padding: var(--space-md);
  background: var(--gradient-glass);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.var-metric-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-tertiary);
  margin-bottom: 4px;
}

.var-metric-value {
  font-size: 24px;
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--accent-primary-light);
}

.var-metric-value.negative {
  color: var(--color-sell);
}

/* Responsive */
@media (max-width: 768px) {
  #page-portfolio .corr-heatmap-cell {
    width: 40px;
    height: 28px;
    font-size: 8px;
  }
}

/* ═══════════════════════════════════════
   ALERTAS IN-PAGE & CONTA MT5
   ═══════════════════════════════════════ */

.alert-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  margin-bottom: 4px;
  font-size: 11px;
  line-height: 1.4;
  animation: alertSlideIn 0.3s ease;
  border-left: 3px solid transparent;
}

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

.alert-item.info {
  background: rgba(59, 130, 246, 0.06);
  border-left-color: #3b82f6;
}

.alert-item.success {
  background: rgba(34, 197, 94, 0.06);
  border-left-color: #22c55e;
}

.alert-item.warning {
  background: rgba(234, 179, 8, 0.06);
  border-left-color: #eab308;
}

.alert-item.critical {
  background: rgba(239, 68, 68, 0.08);
  border-left-color: #ef4444;
}

.alert-item .alert-time {
  font-size: 9px;
  color: var(--text-tertiary);
  font-family: var(--font-mono);
  white-space: nowrap;
  min-width: 44px;
}

.alert-item .alert-icon {
  font-size: 14px;
  flex-shrink: 0;
}

.alert-item .alert-text {
  flex: 1;
  color: var(--text-secondary);
}

.alert-item .alert-text strong {
  color: var(--text-primary);
  font-weight: 600;
}

.mt5-position-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  margin-bottom: 3px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  font-size: 11px;
  transition: background 0.2s;
}

.mt5-position-row:hover {
  background: rgba(255, 255, 255, 0.04);
}

.mt5-pos-symbol {
  font-weight: 700;
  color: var(--text-primary);
  min-width: 70px;
}

.mt5-pos-dir {
  font-weight: 600;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 4px;
  min-width: 50px;
  text-align: center;
}

.mt5-pos-dir.buy {
  background: rgba(34, 197, 94, 0.15);
  color: #22c55e;
}

.mt5-pos-dir.sell {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

.mt5-pos-volume {
  color: var(--text-tertiary);
  font-family: var(--font-mono);
  font-size: 10px;
}

.mt5-pos-price {
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 10px;
}

.mt5-pos-pnl {
  font-weight: 700;
  font-family: var(--font-mono);
  margin-left: auto;
  font-size: 11px;
}

.mt5-pos-pnl.positive { color: #22c55e; }
.mt5-pos-pnl.negative { color: #ef4444; }
.mt5-pos-pnl.neutral { color: var(--text-tertiary); }

/* ========================================
   TRADE TUTOR — STYLES
   ======================================== */

/* Summary bar */
.tutor-summary {
  display: flex;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}
.tutor-summary-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.tutor-summary-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-tertiary);
}
.tutor-summary-value {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  font-family: var(--font-mono);
}
.tutor-summary-value.positive { color: var(--color-buy); }
.tutor-summary-value.negative { color: var(--color-sell); }

/* Cards grid — responsive */
.tutor-cards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-md);
}
@media (max-width: 1200px) {
  .tutor-cards-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .tutor-cards-grid { grid-template-columns: 1fr; }
  .tutor-summary { flex-direction: column; }
}

/* Individual card */
.tutor-card {
  background: var(--gradient-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.tutor-card:hover {
  border-color: var(--border-accent);
  box-shadow: var(--shadow-md);
}

/* Card header */
.tutor-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.tutor-symbol {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}
.tutor-side {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.tutor-side-buy {
  background: var(--color-buy-glow);
  color: var(--color-buy);
}
.tutor-side-sell {
  background: var(--color-sell-glow);
  color: var(--color-sell);
}
.tutor-ticket {
  font-size: 11px;
  color: var(--text-tertiary);
  font-family: var(--font-mono);
}
.tutor-volume {
  font-size: 11px;
  color: var(--text-secondary);
  margin-left: auto;
}

/* P&L */
.tutor-pnl {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.tutor-pnl-value {
  font-size: 18px;
  font-weight: 700;
  font-family: var(--font-mono);
}
.tutor-pnl-value.positive { color: var(--color-buy); }
.tutor-pnl-value.negative { color: var(--color-sell); }
.tutor-pnl-value.neutral { color: var(--text-secondary); }

/* Sparkline */
.tutor-sparkline {
  flex-shrink: 0;
}
.tutor-sparkline canvas {
  display: block;
  border-radius: 4px;
}

/* Prices */
.tutor-prices {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  padding: 4px 0;
  border-top: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
}

/* Section titles */
.tutor-section-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

/* Market context */
.tutor-market-items {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12px;
}
.tutor-regime {
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
}
.tutor-regime-trending {
  background: rgba(99, 102, 241, 0.15);
  color: var(--accent-primary-light);
}
.tutor-regime-ranging {
  background: rgba(107, 114, 128, 0.15);
  color: var(--text-secondary);
}
.tutor-regime-volatile {
  background: rgba(245, 158, 11, 0.15);
  color: var(--color-warning);
}
.tutor-trend {
  color: var(--text-secondary);
  font-size: 12px;
}
.tutor-volatility {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--text-secondary);
}
.vol-bar {
  display: inline-block;
  width: 32px;
  height: 6px;
  border-radius: 3px;
  background: var(--border-default);
}
.vol-bar.vol-low {
  background: linear-gradient(90deg, var(--color-buy) 33%, var(--border-default) 33%);
}
.vol-bar.vol-medium {
  background: linear-gradient(90deg, var(--color-warning) 66%, var(--border-default) 66%);
}
.vol-bar.vol-high {
  background: var(--color-sell);
}

/* Agent signals */
.tutor-agents-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.tutor-signal-direction {
  font-weight: 700;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}
.tutor-signal-buy {
  background: var(--color-buy-glow);
  color: var(--color-buy);
}
.tutor-signal-sell {
  background: var(--color-sell-glow);
  color: var(--color-sell);
}
.tutor-signal-neutral {
  background: rgba(107, 114, 128, 0.15);
  color: var(--text-secondary);
}
.tutor-agents-individual {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.tutor-agent-score {
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text-tertiary);
  background: var(--bg-glass);
  padding: 2px 6px;
  border-radius: 4px;
}

/* Divergence */
.tutor-divergence {
  border-left: 3px solid var(--color-warning);
  padding-left: 8px;
}
.tutor-divergence-alert {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-warning);
  margin-top: 4px;
}

/* Risk */
.tutor-risk-items {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12px;
  color: var(--text-secondary);
}
.tutor-alert-red {
  color: var(--color-sell);
  font-weight: 600;
}
.tutor-alert-yellow {
  color: var(--color-warning);
  font-weight: 600;
}
.tutor-rr-bad {
  color: var(--color-sell);
  font-weight: 700;
}
.tutor-rr-good {
  color: var(--color-buy);
  font-weight: 700;
}

/* Coaching */
.tutor-coaching-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.tutor-recommendation {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.tutor-rec-manter {
  background: var(--color-buy-glow);
  color: var(--color-buy);
}
.tutor-rec-fechar {
  background: var(--color-sell-glow);
  color: var(--color-sell);
}
.tutor-rec-escalar {
  background: rgba(59, 130, 246, 0.2);
  color: var(--color-info);
}
.tutor-rec-ajustar_sl_tp {
  background: var(--color-warning-glow);
  color: var(--color-warning);
}
.tutor-coaching-source {
  font-size: 10px;
  color: var(--text-tertiary);
}
.tutor-coaching-summary {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0;
}
.tutor-coaching-justification {
  font-size: 11px;
  color: var(--text-tertiary);
  line-height: 1.4;
  margin: 4px 0 0;
}

/* Action buttons */
.tutor-actions {
  margin-top: 4px;
}
.tutor-btn {
  padding: 6px 14px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity var(--transition-fast);
}
.tutor-btn:hover { opacity: 0.85; }
.tutor-btn-close {
  background: var(--gradient-danger);
  color: #fff;
}
.tutor-btn-adjust {
  background: linear-gradient(135deg, var(--color-warning), #d97706);
  color: #fff;
}
.tutor-adjust-form {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.tutor-adjust-form input {
  background: var(--bg-secondary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 5px 8px;
  font-size: 12px;
  font-family: var(--font-mono);
  width: 110px;
}
.tutor-adjust-form input:focus {
  outline: none;
  border-color: var(--accent-primary);
}

/* WS disconnection indicator */
.tutor-ws-disconnected {
  background: var(--color-warning-glow);
  color: var(--color-warning);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  margin-bottom: var(--space-md);
  text-align: center;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

/* Empty state */
.tutor-empty {
  text-align: center;
  padding: 60px;
  color: var(--text-tertiary);
  font-size: 13px;
}

/* ─── Observabilidade Tab Bar ─── */
.obs-tab-bar{display:flex;gap:4px;margin-bottom:var(--space-md);background:rgba(0,0,0,.3);border-radius:8px;padding:3px 4px;overflow-x:auto}
.obs-tab-btn{padding:8px 16px;border:none;background:transparent;color:var(--text-secondary);border-radius:6px;cursor:pointer;font-size:12px;font-weight:600;white-space:nowrap;transition:all .2s}
.obs-tab-btn:hover{background:rgba(255,255,255,.06);color:var(--text-primary)}
.obs-tab-btn.active{background:var(--accent);color:#fff}

/* ═══════════════════════════════════════════
   SIGNAL DASHBOARD — Painel de Sinais
   ═══════════════════════════════════════════ */

.signal-dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
  gap: 1.5rem;
  padding: 1.5rem;
}

.signal-card {
  background: var(--bg-secondary, #1e293b);
  border: 1px solid var(--border-color, #334155);
  border-radius: 12px;
  padding: 1.25rem;
  transition: border-color 0.2s;
}

.signal-card:hover {
  border-color: var(--accent-color, #3b82f6);
}

.signal-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-color, #334155);
}

.signal-card-asset {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary, #f1f5f9);
}

.signal-card-timestamp {
  font-size: 0.75rem;
  color: var(--text-muted, #64748b);
}

/* Gauge container */
.signal-gauge-container {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
  margin-bottom: 1rem;
}

.signal-gauge {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 80px;
  position: relative;
  cursor: pointer;
}

.signal-gauge-label {
  font-size: 0.7rem;
  color: var(--text-muted, #64748b);
  text-align: center;
  margin-top: 0.25rem;
  max-width: 90px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.signal-gauge-confidence {
  font-size: 0.65rem;
  color: var(--text-muted, #64748b);
  font-family: 'JetBrains Mono', monospace;
}

/* Veto badge */
.signal-veto-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #ef4444;
  color: #fff;
  font-size: 0.55rem;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Aggregated panel */
.signal-aggregated-panel {
  background: var(--bg-primary, #0f172a);
  border-radius: 8px;
  padding: 1rem;
  margin-top: 0.75rem;
}

.signal-aggregated-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.signal-direction-badge {
  padding: 0.25rem 0.75rem;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  text-transform: uppercase;
}

.signal-direction-badge.buy { background: rgba(16, 185, 129, 0.15); color: #10b981; }
.signal-direction-badge.sell { background: rgba(239, 68, 68, 0.15); color: #ef4444; }
.signal-direction-badge.neutral { background: rgba(107, 114, 128, 0.15); color: #6b7280; }

.signal-vetoed-badge {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
}

.signal-conviction {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
}

.signal-conviction.strong { background: rgba(16, 185, 129, 0.15); color: #10b981; }
.signal-conviction.moderate { background: rgba(245, 158, 11, 0.15); color: #f59e0b; }
.signal-conviction.weak { background: rgba(107, 114, 128, 0.15); color: #6b7280; }

.signal-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.signal-stat {
  text-align: center;
}

.signal-stat-label {
  font-size: 0.65rem;
  color: var(--text-muted, #64748b);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.signal-stat-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary, #f1f5f9);
}

/* Weights row */
.signal-weights-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.signal-weight-chip {
  font-size: 0.65rem;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  background: var(--bg-secondary, #1e293b);
  color: var(--text-muted, #64748b);
  font-family: 'JetBrains Mono', monospace;
}

/* Context sections */
.signal-context-section {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-color, #334155);
}

.signal-context-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.signal-context-label {
  font-size: 0.7rem;
  color: var(--text-muted, #64748b);
  min-width: 80px;
}

.signal-context-value {
  font-size: 0.75rem;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-primary, #f1f5f9);
}

.signal-regime-badge {
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
}

.signal-ollama-badge {
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
}

.signal-ollama-badge.approve { background: rgba(16, 185, 129, 0.15); color: #10b981; }
.signal-ollama-badge.adjust { background: rgba(245, 158, 11, 0.15); color: #f59e0b; }
.signal-ollama-badge.veto { background: rgba(239, 68, 68, 0.15); color: #ef4444; }

.signal-ollama-alerts {
  font-size: 0.65rem;
  color: var(--text-muted, #64748b);
  margin-top: 0.25rem;
}

/* Tooltip */
.signal-tooltip {
  position: fixed;
  z-index: 1000;
  background: var(--bg-secondary, #1e293b);
  border: 1px solid var(--border-color, #334155);
  border-radius: 8px;
  padding: 0.75rem;
  max-width: 280px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  pointer-events: none;
}

.signal-tooltip-title {
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--text-primary, #f1f5f9);
  margin-bottom: 0.5rem;
}

.signal-tooltip-reasoning {
  font-size: 0.7rem;
  color: var(--text-muted, #64748b);
  margin-bottom: 0.5rem;
  line-height: 1.4;
}

.signal-tooltip-indicators {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.25rem;
}

.signal-tooltip-indicator {
  font-size: 0.65rem;
  font-family: 'JetBrains Mono', monospace;
}

.signal-tooltip-indicator-key {
  color: var(--text-muted, #64748b);
}

.signal-tooltip-indicator-value {
  color: var(--text-primary, #f1f5f9);
  font-weight: 600;
}

/* Empty state */
.signal-empty-state {
  text-align: center;
  padding: 3rem;
  color: var(--text-muted, #64748b);
  font-size: 1rem;
}

/* Responsive */
@media (max-width: 768px) {
  .signal-dashboard-grid {
    grid-template-columns: 1fr;
    padding: 1rem;
  }
}

/* ═══════════════════════════════════════════
   TRADE READINESS INDICATOR
   ═══════════════════════════════════════════ */

.signal-readiness {
  background: var(--bg-primary, #0f172a);
  border-radius: 8px;
  padding: 0.75rem;
  margin-bottom: 0.75rem;
  border: 1px solid var(--border-color, #334155);
  transition: border-color 0.3s, box-shadow 0.3s;
}

.signal-readiness-glow {
  border-color: rgba(16, 185, 129, 0.4);
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.15);
}

.signal-readiness[data-status="BLOCKED_RISK"],
.signal-readiness[data-status="OLLAMA_VETO"] {
  border-color: rgba(239, 68, 68, 0.3);
}

.signal-readiness[data-status="PENDING_CONFIRMATION"] {
  border-color: rgba(59, 130, 246, 0.4);
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.15);
}

.signal-readiness-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.signal-readiness-icon {
  font-size: 1rem;
}

.signal-readiness-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.signal-readiness-dir {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  font-weight: 700;
  margin-left: auto;
}

.signal-readiness-proximity {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary, #f1f5f9);
}

.signal-readiness-bar-bg {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 3px;
  overflow: hidden;
}

.signal-readiness-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.5s ease, background 0.3s ease;
}

.signal-readiness-reason {
  font-size: 0.65rem;
  color: var(--text-muted, #64748b);
  margin-top: 0.35rem;
  line-height: 1.3;
}

.signal-readiness-rules {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-top: 0.35rem;
}

.signal-readiness-rule-chip {
  font-size: 0.6rem;
  font-family: 'JetBrains Mono', monospace;
  background: rgba(239, 68, 68, 0.12);
  color: #fca5a5;
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  white-space: nowrap;
}

/* ═══════════════════════════════════════
   ASSET CONFIG PANEL
   ═══════════════════════════════════════ */
.acp-toggle-btn {
  background: none;
  border: 1px solid var(--border-color, #333);
  border-radius: 4px;
  cursor: pointer;
  padding: 2px 6px;
  font-size: 0.85rem;
  opacity: 0.7;
  transition: opacity 0.2s;
}
.acp-toggle-btn:hover { opacity: 1; }

.acp-panel {
  padding: 0.75rem;
  border-top: 1px solid var(--border-color, #333);
  background: rgba(0,0,0,0.15);
}
.acp-section { margin-bottom: 0.75rem; }
.acp-section-title {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted, #888);
  margin-bottom: 0.4rem;
}
.acp-fields {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
}
.acp-field label {
  display: block;
  font-size: 0.65rem;
  color: var(--text-muted, #888);
  margin-bottom: 0.15rem;
}
.acp-field input {
  width: 100%;
  padding: 0.3rem 0.4rem;
  background: var(--bg-secondary, #1a1a2e);
  border: 1px solid var(--border-color, #333);
  border-radius: 4px;
  color: var(--text-primary, #e0e0e0);
  font-size: 0.75rem;
  box-sizing: border-box;
}
.acp-agents-list { display: flex; flex-direction: column; gap: 0.4rem; }
.acp-agent-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.35rem 0.5rem;
  border-radius: 4px;
  background: rgba(255,255,255,0.03);
  transition: opacity 0.2s;
  gap: 8px;
}
.acp-agent-row.acp-disabled { opacity: 0.4; }
.acp-agent-toggle {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  cursor: pointer;
  color: var(--text-primary, #e0e0e0);
}
.acp-agent-toggle input[type="checkbox"] { cursor: pointer; }
.acp-weight-input {
  width: 70px;
  padding: 0.25rem 0.4rem;
  background: var(--bg-secondary, #1a1a2e);
  border: 1px solid var(--border-color, #333);
  border-radius: 4px;
  color: var(--text-primary, #e0e0e0);
  font-size: 0.8rem;
  text-align: center;
}
.acp-weight-input:disabled { opacity: 0.3; }
.acp-weight-group {
  display: flex;
  align-items: center;
  gap: 4px;
}
.acp-weight-max {
  font-size: 0.65rem;
  color: var(--text-muted, #888);
  white-space: nowrap;
}
.acp-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.5rem;
}
.acp-unsaved {
  font-size: 0.65rem;
  color: #fbbf24;
}
.acp-save-btn {
  padding: 0.35rem 1rem;
  background: var(--accent-color, #6366f1);
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 0.75rem;
  cursor: pointer;
  transition: background 0.2s;
}
.acp-save-btn:hover { background: #4f46e5; }
.acp-save-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Toast */
.acp-toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  padding: 0.6rem 1.2rem;
  border-radius: 6px;
  font-size: 0.8rem;
  z-index: 9999;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.3s, transform 0.3s;
  pointer-events: none;
}
.acp-toast-show { opacity: 1; transform: translateY(0); }
.acp-toast-success { background: #065f46; color: #a7f3d0; }
.acp-toast-error { background: #7f1d1d; color: #fca5a5; }

/* ═══════════════════════════════════════
   READINESS CARD — Enriched
   ═══════════════════════════════════════ */

/* Card header with ⚙️ button */
.readiness-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

/* Execution state badge */
.execution-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  white-space: nowrap;
}
.execution-badge-em-trade {
  background: rgba(34, 197, 94, 0.15);
  color: #22c55e;
}
.execution-badge-aguardando {
  background: rgba(234, 179, 8, 0.15);
  color: #eab308;
}
.execution-badge-bloqueado {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  cursor: help;
}

/* ⚙️ button active state */
.acp-toggle-btn.acp-active {
  opacity: 1;
  border-color: var(--accent-color, #6366f1);
  background: rgba(99, 102, 241, 0.1);
}

/* Position section */
.position-section {
  margin-top: 10px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 6px;
  border-left: 2px solid #6366f1;
}
.position-section-title {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-tertiary, #888);
  margin-bottom: 6px;
}
.position-section-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 12px;
}
.position-section-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.72rem;
}
.position-section-label {
  color: var(--text-tertiary, #888);
  font-size: 0.65rem;
}
.position-section-value {
  font-weight: 600;
  color: var(--text-primary, #e0e0e0);
  font-family: var(--font-mono, monospace);
  font-size: 0.72rem;
}
.pos-type-buy { color: #22c55e; }
.pos-type-sell { color: #ef4444; }

/* Performance section */
.performance-section {
  margin-top: 10px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 6px;
  border-left: 2px solid #8b5cf6;
}
.performance-section-title {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-tertiary, #888);
  margin-bottom: 6px;
}
.performance-section-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 12px;
}
.performance-section-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.72rem;
}
.performance-section-label {
  color: var(--text-tertiary, #888);
  font-size: 0.65rem;
}
.performance-section-value {
  font-weight: 600;
  color: var(--text-primary, #e0e0e0);
  font-family: var(--font-mono, monospace);
  font-size: 0.72rem;
}
.performance-section-empty {
  font-size: 0.72rem;
  color: var(--text-tertiary, #888);
  font-style: italic;
}

/* P&L conditional colors */
.pnl-positive { color: #22c55e !important; }
.pnl-negative { color: #ef4444 !important; }
.pnl-neutral { color: var(--text-secondary, #999) !important; }

/* Dashboard Readiness Summary */
.readiness-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-sm, 8px);
  padding: var(--space-sm, 8px);
}
.readiness-count-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  padding: var(--space-sm, 8px) var(--space-md, 12px);
  text-align: center;
}
.readiness-count-value {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.2;
}
.readiness-count-label {
  font-size: 11px;
  color: var(--text-tertiary, #888);
  margin-top: 2px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.readiness-count-em-trade {
  border-left: 3px solid #22c55e;
}
.readiness-count-em-trade .readiness-count-value {
  color: #22c55e;
}
.readiness-count-aguardando {
  border-left: 3px solid #eab308;
}
.readiness-count-aguardando .readiness-count-value {
  color: #eab308;
}
.readiness-count-bloqueado {
  border-left: 3px solid #ef4444;
}
.readiness-count-bloqueado .readiness-count-value {
  color: #ef4444;
}

/* ═══════════════════════════════════════════════════════════
   COMMAND CENTER — Central de Comando de Prontidão de Ativos
   ═══════════════════════════════════════════════════════════ */

/* ─── Grid de cards ──────────────────────────────────────── */
#readiness-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: var(--space-md, 16px);
}

/* ─── Card em trade ativo — destaque pulsante ────────────── */
.cc-card-in-trade {
  animation: cc-pulse-glow 2s ease-in-out infinite;
}
@keyframes cc-pulse-glow {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.05); }
}

/* ─── Painel MT5 ─────────────────────────────────────────── */
.cc-mt5-panel {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.cc-mt5-left { display: flex; align-items: center; gap: 8px; }
.cc-mt5-center { display: flex; align-items: center; gap: 16px; flex: 1; flex-wrap: wrap; }
.cc-mt5-right { margin-left: auto; }
.cc-mt5-host { font-size: 11px; color: var(--text-tertiary); font-family: var(--font-mono); }
.cc-mt5-latency { font-size: 11px; font-family: var(--font-mono); }
.cc-mt5-stat { font-size: 12px; color: var(--text-secondary); }
.cc-mt5-stat b { color: var(--text-primary); }
.cc-mt5-offline { font-size: 12px; color: #eab308; }
.cc-reconnect-btn {
  background: rgba(99,102,241,0.15);
  border: 1px solid rgba(99,102,241,0.4);
  color: #818cf8;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}
.cc-reconnect-btn:hover { background: rgba(99,102,241,0.25); }
.cc-reconnect-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ─── Badges ─────────────────────────────────────────────── */
.cc-badge { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 12px; font-size: 11px; font-weight: 600; }
.cc-badge-green { background: rgba(34,197,94,0.15); color: #22c55e; border: 1px solid rgba(34,197,94,0.3); }
.cc-badge-red { background: rgba(239,68,68,0.15); color: #ef4444; border: 1px solid rgba(239,68,68,0.3); }
.cc-badge-blue { background: rgba(59,130,246,0.15); color: #60a5fa; border: 1px solid rgba(59,130,246,0.3); }
.cc-badge-gray { background: rgba(107,114,128,0.15); color: #9ca3af; border: 1px solid rgba(107,114,128,0.3); }

/* ─── Toolbar ────────────────────────────────────────────── */
.cc-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.cc-title { font-size: 15px; font-weight: 600; color: var(--text-primary); margin: 0; }
.cc-add-btn {
  background: rgba(99,102,241,0.15);
  border: 1px solid rgba(99,102,241,0.4);
  color: #818cf8;
  border-radius: 8px;
  padding: 6px 14px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}
.cc-add-btn:hover { background: rgba(99,102,241,0.3); }

/* ─── Grid de cards ──────────────────────────────────────── */
.cc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
}
.cc-empty { text-align: center; padding: 60px; color: var(--text-tertiary); grid-column: 1/-1; }
.cc-loading { text-align: center; padding: 40px; color: var(--text-tertiary); }
.cc-loading-sm { padding: 8px; color: var(--text-tertiary); font-size: 12px; }

/* ─── Card ───────────────────────────────────────────────── */
.cc-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  transition: border-color 0.2s;
}
.cc-card:hover { border-color: rgba(99,102,241,0.4); }
.cc-card-paused { opacity: 0.7; border-style: dashed; }

.cc-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.cc-card-title { display: flex; align-items: center; gap: 8px; }
.cc-symbol { font-size: 16px; font-weight: 700; color: var(--text-primary); }
.cc-card-actions { display: flex; gap: 4px; }
.cc-icon-btn {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 3px 7px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--text-secondary);
}
.cc-icon-btn:hover { background: var(--bg-hover); border-color: var(--border-hover); }
.cc-icon-btn.cc-btn-danger:hover { background: rgba(239,68,68,0.1); border-color: rgba(239,68,68,0.4); color: #ef4444; }

/* ─── Score e métricas ───────────────────────────────────── */
.cc-score-row { display: flex; align-items: center; gap: 16px; margin-bottom: 10px; }
.cc-score-circle {
  width: 60px; height: 60px;
  border-radius: 50%;
  border: 3px solid;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  flex-shrink: 0;
}
.cc-score-circle span { font-size: 18px; font-weight: 700; line-height: 1; }
.cc-score-circle small { font-size: 9px; color: var(--text-tertiary); }
.cc-metrics { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.cc-metric { display: flex; justify-content: space-between; font-size: 12px; }
.cc-metric-label { color: var(--text-tertiary); }
.cc-metric-val { font-weight: 600; }
.cc-dir-buy { color: #22c55e; }
.cc-dir-sell { color: #ef4444; }
.cc-dir-neutral { color: #9ca3af; }
.cc-no-data { font-size: 12px; color: #eab308; padding: 8px 0; }

/* ─── Performance ────────────────────────────────────────── */
.cc-perf-row {
  display: flex; gap: 12px; font-size: 11px;
  color: var(--text-secondary);
  border-top: 1px solid var(--border);
  padding-top: 8px; margin-top: 4px;
}
.cc-pos { color: #22c55e; }
.cc-neg { color: #ef4444; }

/* ─── Posição aberta ─────────────────────────────────────── */
.cc-position-box {
  background: rgba(59,130,246,0.06);
  border: 1px solid rgba(59,130,246,0.2);
  border-radius: 8px;
  padding: 10px;
  margin: 10px 0;
}
.cc-position-header { display: flex; justify-content: space-between; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.cc-position-details { display: flex; gap: 12px; font-size: 11px; color: var(--text-secondary); margin-bottom: 8px; }
.cc-position-controls { display: flex; flex-direction: column; gap: 6px; }
.cc-sltp-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.cc-sltp-input {
  width: 90px; padding: 3px 6px;
  background: var(--bg-input, rgba(255,255,255,0.05));
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-primary);
  font-size: 11px;
}

/* ─── Footer do card ─────────────────────────────────────── */
.cc-card-footer { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }

/* ─── Botões ─────────────────────────────────────────────── */
.cc-btn {
  padding: 5px 12px; border-radius: 6px; font-size: 12px;
  cursor: pointer; border: 1px solid transparent; transition: all 0.2s;
  font-weight: 500;
}
.cc-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.cc-btn-primary { background: rgba(99,102,241,0.2); border-color: rgba(99,102,241,0.4); color: #818cf8; }
.cc-btn-primary:hover:not(:disabled) { background: rgba(99,102,241,0.35); }
.cc-btn-warning { background: rgba(234,179,8,0.15); border-color: rgba(234,179,8,0.3); color: #eab308; }
.cc-btn-warning:hover:not(:disabled) { background: rgba(234,179,8,0.25); }
.cc-btn-success { background: rgba(34,197,94,0.15); border-color: rgba(34,197,94,0.3); color: #22c55e; }
.cc-btn-success:hover:not(:disabled) { background: rgba(34,197,94,0.25); }
.cc-btn-danger { background: rgba(239,68,68,0.15); border-color: rgba(239,68,68,0.3); color: #ef4444; }
.cc-btn-danger:hover:not(:disabled) { background: rgba(239,68,68,0.25); }
.cc-btn-secondary { background: var(--bg-hover); border-color: var(--border); color: var(--text-secondary); }
.cc-btn-sm { padding: 3px 8px; font-size: 11px; }

/* ─── Histórico de sinais ────────────────────────────────── */
.cc-history-section { border-top: 1px solid var(--border); margin-top: 10px; padding-top: 10px; }
.cc-history-title { font-size: 12px; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }
.cc-history-list { display: flex; flex-direction: column; gap: 4px; }
.cc-history-item {
  display: flex; gap: 10px; align-items: center;
  font-size: 11px; padding: 4px 6px;
  background: rgba(255,255,255,0.03);
  border-radius: 4px;
}
.cc-history-date { color: var(--text-tertiary); margin-left: auto; font-size: 10px; }
.cc-history-empty { font-size: 11px; color: var(--text-tertiary); padding: 6px; }

/* ─── Modais ─────────────────────────────────────────────── */
.cc-modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999;
}
.cc-modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  width: 400px; max-width: 90vw;
}
.cc-modal-sm { width: 320px; }
.cc-modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.cc-modal-header h3 { margin: 0; font-size: 15px; }
.cc-modal-header button { background: transparent; border: none; color: var(--text-tertiary); cursor: pointer; font-size: 16px; }
.cc-modal-body { margin-bottom: 16px; }
.cc-modal-body label { display: block; font-size: 12px; color: var(--text-secondary); margin-bottom: 6px; }
.cc-modal-footer { display: flex; gap: 8px; justify-content: flex-end; }
.cc-input {
  width: 100%; padding: 8px 12px;
  background: var(--bg-input, rgba(255,255,255,0.05));
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 14px;
  box-sizing: border-box;
}
.cc-input:focus { outline: none; border-color: rgba(99,102,241,0.5); }
.cc-error { font-size: 12px; color: #ef4444; margin-top: 6px; }
.cc-error a { color: #f87171; }

/* ─── Toast ──────────────────────────────────────────────── */
#cc-toast-container {
  position: fixed; bottom: 20px; right: 20px;
  display: flex; flex-direction: column; gap: 8px;
  z-index: 10000;
}
.cc-toast {
  padding: 10px 16px; border-radius: 8px;
  font-size: 13px; font-weight: 500;
  opacity: 1; transition: opacity 0.3s;
  max-width: 320px;
}
.cc-toast-success { background: rgba(34,197,94,0.2); border: 1px solid rgba(34,197,94,0.4); color: #22c55e; }
.cc-toast-error { background: rgba(239,68,68,0.2); border: 1px solid rgba(239,68,68,0.4); color: #ef4444; }
.cc-toast-warning { background: rgba(234,179,8,0.2); border: 1px solid rgba(234,179,8,0.4); color: #eab308; }

/* ─── Shimmer / Placeholder ──────────────────────────────── */
.cc-shimmer {
  background: linear-gradient(90deg, rgba(255,255,255,0.04) 25%, rgba(255,255,255,0.1) 50%, rgba(255,255,255,0.04) 75%);
  background-size: 200% 100%;
  animation: cc-shimmer-anim 1.5s infinite ease-in-out;
}
@keyframes cc-shimmer-anim {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.cc-placeholder {
  opacity: 0.7;
}

/* ========================================
   DASHBOARD TRADING IMPROVEMENTS — CSS
   ======================================== */

/* Price flash animations */
@keyframes priceFlashUp {
  0% { background-color: rgba(34, 197, 94, 0.25); }
  100% { background-color: transparent; }
}
@keyframes priceFlashDown {
  0% { background-color: rgba(239, 68, 68, 0.25); }
  100% { background-color: transparent; }
}
.cc-price-flash-up {
  animation: priceFlashUp 500ms ease-out;
}
.cc-price-flash-down {
  animation: priceFlashDown 500ms ease-out;
}

/* Trailing stop status section */
.cc-trailing-status {
  transition: all 0.3s ease;
}
.cc-trailing-events {
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
}

/* Stale price badge */
.cc-stale-badge {
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Trailing alert notification */
.cc-trailing-notif {
  animation: fadeInSlide 0.3s ease;
}
@keyframes fadeInSlide {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Points analysis panel hour cells */
.cc-points-panel {
  transition: all 0.3s ease;
}

/* ═══════════════════════════════════════════
   UX POLISH — Micro-interactions & Feedback
   ═══════════════════════════════════════════ */

/* Success confirmation pulse */
@keyframes successPulse {
  0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.4); }
  70% { box-shadow: 0 0 0 10px rgba(34, 197, 94, 0); }
  100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

@keyframes errorShake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-4px); }
  40%, 80% { transform: translateX(4px); }
}

.feedback-success {
  animation: successPulse 0.6s ease-out;
}

.feedback-error {
  animation: errorShake 0.4s ease-out;
}

/* Button loading state */
.btn-loading {
  pointer-events: none;
  opacity: 0.7;
  position: relative;
}

.btn-loading::after {
  content: '';
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: btnSpin 0.6s linear infinite;
  display: inline-block;
  margin-left: 8px;
  vertical-align: middle;
}

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

/* Toast improvements */
.toast {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  backdrop-filter: blur(8px);
  animation: toastSlideIn 0.3s ease;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

@keyframes toastSlideIn {
  from { opacity: 0; transform: translateX(100%); }
  to { opacity: 1; transform: translateX(0); }
}

/* Card hover — only on interactive cards */
.card-interactive:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: var(--border-accent);
}

/* Non-interactive cards — no hover transform */
.card:not(.card-interactive):hover {
  transform: none;
}

/* Smooth page transitions */
.page {
  animation: pageEnter 0.25s ease;
}

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

/* Agent card status indicator */
.agent-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  opacity: 0.6;
  transition: opacity var(--transition-fast);
}

.agent-card:hover::before {
  opacity: 1;
}

.agent-card.regime::before { background: var(--gradient-primary); }
.agent-card.trend::before { background: linear-gradient(90deg, #3b82f6, #60a5fa); }
.agent-card.volatility::before { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.agent-card.timing::before { background: linear-gradient(90deg, #22d3ee, #67e8f9); }
.agent-card.price-action::before { background: linear-gradient(90deg, #ef4444, #f87171); }

/* Improved stat cards */
.stat-card {
  position: relative;
  overflow: hidden;
}

.stat-card::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 60px;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(99, 102, 241, 0.03));
  pointer-events: none;
}

/* Risk profile cards — improved highlight */
.risk-profile-btn.active {
  transform: translateY(-3px);
  position: relative;
}

.risk-profile-btn.active::after {
  content: '✓';
  position: absolute;
  top: -4px;
  right: -4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent-primary);
  color: white;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

/* Score ring glow on high scores */
.score-ring-fill {
  filter: drop-shadow(0 0 6px currentColor);
}

/* Better card-loading-state */
.card-loading-state {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: var(--space-xl);
  color: var(--text-tertiary);
  font-size: 13px;
}

.card-loading-state::before {
  content: '';
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--accent-primary-light);
  border-radius: 50%;
  animation: btnSpin 0.8s linear infinite;
}

/* Pipeline step improvements */
.pipeline-step {
  position: relative;
}

.pipeline-step::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 50%;
  width: 0;
  height: 2px;
  background: var(--step-color, var(--accent-primary));
  transition: width 0.3s ease;
  transform: translateX(-50%);
}

.pipeline-step:hover::after {
  width: 80%;
}

/* Header button SVG alignment */
.btn svg {
  vertical-align: middle;
  margin-right: 4px;
}

.btn-sm svg {
  margin-right: 2px;
}

/* Pulse animation for live indicators */
@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.8); }
}

/* Focus ring for accessibility */
.sidebar-btn:focus-visible,
.btn:focus-visible,
.mobile-nav-btn:focus-visible {
  outline: 2px solid var(--accent-primary-light);
  outline-offset: 2px;
}
