/* AUPM v4 - Minimal Professional Design */

:root {
  --bg-primary: #09090b;
  --bg-secondary: #0c0c0f;
  --bg-tertiary: #111114;
  --bg-elevated: #18181b;
  --bg-hover: #1f1f23;
  
  --border: rgba(255, 255, 255, 0.06);
  --border-hover: rgba(255, 255, 255, 0.12);
  
  --text-primary: #fafafa;
  --text-secondary: #a1a1aa;
  --text-muted: #52525b;
  
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --accent-subtle: rgba(59, 130, 246, 0.1);
  
  --positive: #22c55e;
  --positive-subtle: rgba(34, 197, 94, 0.1);
  --negative: #ef4444;
  --negative-subtle: rgba(239, 68, 68, 0.1);
  
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', monospace;
  
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html, body {
  height: 100%;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Loading Screen */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 24px;
  z-index: 9999;
  opacity: 1;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loading-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loader-logo {
  position: relative;
  width: 80px;
  height: 80px;
}

.logo-part {
  position: absolute;
  opacity: 0;
}

/* Part 1 - верхний левый квадрат */
.logo-part.part-1 {
  width: 32px;
  height: 32px;
  top: 0;
  left: 0;
  animation: part1Anim 2.5s cubic-bezier(0.16, 1, 0.3, 1) infinite;
}

/* Part 2 - нижний левый полукруг */
.logo-part.part-2 {
  width: 32px;
  height: 32px;
  bottom: 8px;
  left: 0;
  animation: part2Anim 2.5s cubic-bezier(0.16, 1, 0.3, 1) infinite;
}

/* Part 3 - правая вертикальная часть */
.logo-part.part-3 {
  width: 32px;
  height: 72px;
  top: 0;
  right: 8px;
  object-fit: contain;
  animation: part3Anim 2.5s cubic-bezier(0.16, 1, 0.3, 1) infinite;
}

@keyframes part1Anim {
  0% { 
    opacity: 0; 
    transform: translate(-40px, -40px) rotate(-90deg) scale(0.5);
  }
  20% { 
    opacity: 1; 
    transform: translate(0, 0) rotate(0deg) scale(1);
  }
  80% { 
    opacity: 1; 
    transform: translate(0, 0) rotate(0deg) scale(1);
  }
  100% { 
    opacity: 0; 
    transform: translate(-40px, -40px) rotate(-90deg) scale(0.5);
  }
}

@keyframes part2Anim {
  0%, 5% { 
    opacity: 0; 
    transform: translate(-40px, 40px) rotate(90deg) scale(0.5);
  }
  25% { 
    opacity: 1; 
    transform: translate(0, 0) rotate(0deg) scale(1);
  }
  80% { 
    opacity: 1; 
    transform: translate(0, 0) rotate(0deg) scale(1);
  }
  100% { 
    opacity: 0; 
    transform: translate(-40px, 40px) rotate(90deg) scale(0.5);
  }
}

@keyframes part3Anim {
  0%, 10% { 
    opacity: 0; 
    transform: translateX(50px) scale(0.5);
  }
  30% { 
    opacity: 1; 
    transform: translateX(0) scale(1);
  }
  80% { 
    opacity: 1; 
    transform: translateX(0) scale(1);
  }
  100% { 
    opacity: 0; 
    transform: translateX(50px) scale(0.5);
  }
}

.loader-text {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 3px;
  text-transform: uppercase;
}

/* Layout */
.app {
  display: flex;
  height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 220px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 24px 20px;
  border-bottom: 1px solid var(--border);
}

.sidebar-brand img {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
}

.brand-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}

.brand-ver {
  font-size: 10px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin-top: 2px;
}

.nav {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  transition: all var(--transition);
  position: relative;
}

.nav-link svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  opacity: 0.6;
  transition: all var(--transition);
}

.nav-link:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.nav-link:hover svg { opacity: 0.9; }

.nav-link.active {
  color: var(--text-primary);
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.12) 0%, rgba(59, 130, 246, 0.06) 100%);
}

.nav-link.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  background: var(--accent);
  border-radius: 0 2px 2px 0;
}

.nav-link.active svg { 
  opacity: 1; 
  stroke: var(--accent);
}

.sidebar-footer {
  padding: 20px;
  border-top: 1px solid var(--border);
}

.x-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: var(--transition);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
}

.x-link:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
  border-color: var(--border-hover);
}

.x-link svg {
  flex-shrink: 0;
}

.network-status {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.dot {
  width: 8px;
  height: 8px;
  background: var(--positive);
  border-radius: 50%;
  box-shadow: 0 0 12px var(--positive);
  animation: pulse-glow 2s ease-in-out infinite;
}

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 8px var(--positive); }
  50% { box-shadow: 0 0 16px var(--positive); }
}

/* Main Content */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  height: 64px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.page-title {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.4px;
}

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

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 500;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}

.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(rgba(255,255,255,0.1), transparent);
  opacity: 0;
  transition: opacity var(--transition);
}

.btn:hover::after { opacity: 1; }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

.btn-primary {
  background: var(--accent);
  color: white;
}

.btn-primary:hover { background: var(--accent-hover); }

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

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

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

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

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

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

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

.btn-danger:hover {
  background: #dc2626;
}

.btn-sm { padding: 8px 14px; font-size: 12px; }
.btn-lg { padding: 12px 22px; font-size: 14px; }

.btn-icon {
  width: 38px;
  height: 38px;
  padding: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}

.btn-icon svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

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

/* Wallet Panel */
.wallet-panel {
  display: flex;
  align-items: center;
  gap: 20px;
}

.wallet-balance {
  text-align: right;
}

.wallet-balance-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.wallet-balance-value {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 600;
  color: var(--positive);
}

.wallet-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 12px;
  cursor: pointer;
  transition: all var(--transition);
}

.wallet-btn:hover {
  background: var(--bg-hover);
  border-color: var(--border-hover);
}

.wallet-btn .chevron {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: var(--text-muted);
  stroke-width: 2;
  transition: transform var(--transition);
}

.wallet-dropdown-wrap { position: relative; }

.wallet-dropdown-wrap.open .wallet-btn {
  background: var(--bg-hover);
  border-color: var(--accent);
}

.wallet-dropdown-wrap.open .wallet-btn .chevron {
  transform: rotate(180deg);
}

.wallet-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 280px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px) scale(0.98);
  transform-origin: top right;
  transition: all var(--transition);
  z-index: 1000;
  overflow: hidden;
}

.wallet-dropdown-wrap.open .wallet-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.dropdown-header {
  padding: 18px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
}

.dropdown-user {
  display: flex;
  align-items: center;
  gap: 14px;
}

.dropdown-avatar {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--accent) 0%, #8b5cf6 100%);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}

.dropdown-avatar img { width: 22px; height: 22px; }

.dropdown-info { flex: 1; }

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

.dropdown-addr {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.dropdown-copy {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: var(--text-muted);
  stroke-width: 2;
  cursor: pointer;
  opacity: 0.6;
  transition: all var(--transition);
}

.dropdown-copy:hover {
  opacity: 1;
  stroke: var(--accent);
}

.dropdown-balance {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  padding: 12px 14px;
  background: var(--bg-primary);
  border-radius: var(--radius-md);
}

.dropdown-balance-icon {
  width: 28px;
  height: 28px;
  background: #2775ca;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: white;
}

.dropdown-balance-amount { flex: 1; }

.dropdown-balance-value {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.dropdown-balance-label {
  font-size: 10px;
  color: var(--text-muted);
}

.dropdown-items { padding: 8px; }

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  background: none;
  border: none;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  text-align: left;
}

.dropdown-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.dropdown-item svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  flex-shrink: 0;
}

.dropdown-item.disconnect { color: var(--negative); }
.dropdown-item.disconnect:hover { background: var(--negative-subtle); }

.dropdown-divider {
  height: 1px;
  background: var(--border);
  margin: 8px 14px;
}

/* Content Area */
.content {
  flex: 1;
  padding: 28px;
  overflow-y: auto;
  overflow-x: hidden;
}

.view { display: none; }
.view.active { 
  display: block;
  animation: viewFadeIn 0.4s ease;
}

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


/* Stats Grid - Clean Minimal Design */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  position: relative;
  overflow: hidden;
  transition: all var(--transition);
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0;
  transition: opacity var(--transition);
}

.stat-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
}

.stat-card:hover::before {
  opacity: 0.5;
}

.stat-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 10px;
}

.stat-value {
  font-family: var(--font-mono);
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -1px;
  line-height: 1.1;
  background: linear-gradient(135deg, var(--text-primary) 0%, var(--text-secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.stat-sub {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 8px;
  font-weight: 500;
}

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

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

/* Panels */
.panels-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.panel {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color var(--transition);
}

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

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
}

.panel-header h2 {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.2px;
}

.panel-body {
  padding: 20px 22px;
  min-height: 220px;
}

/* Empty State */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 24px;
  color: var(--text-muted);
  text-align: center;
  min-height: 200px;
}

.empty-state p {
  font-size: 13px;
  opacity: 0.7;
}

/* Toolbar */
.view-toolbar {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
}

/* Search */
.search-box {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  width: 300px;
  transition: all var(--transition);
}

.search-box:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-subtle);
}

.search-box svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: var(--text-muted);
  stroke-width: 2;
}

.search-box input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 13px;
}

.search-box input::placeholder { color: var(--text-muted); }

/* Table */
.table-container {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.table-head {
  display: flex;
  padding: 14px 20px;
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border);
}

.th {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.th.flex-1 { flex: 1; }
.th.w-80 { width: 80px; text-align: center; }
.th.w-100 { width: 100px; text-align: right; }
.th.w-120 { width: 120px; text-align: right; }

.table-body {
  max-height: calc(100vh - 300px);
  overflow-y: auto;
}

.table-row {
  display: flex;
  align-items: center;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}

.table-row:hover { background: var(--bg-hover); }
.table-row:last-child { border-bottom: none; }

.td { font-size: 13px; }
.td.flex-1 { flex: 1; min-width: 0; }
.td.w-80 { width: 80px; text-align: center; }
.td.w-100 { width: 100px; text-align: right; font-family: var(--font-mono); }
.td.w-120 { width: 120px; text-align: right; }

.market-name {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

.price {
  font-family: var(--font-mono);
  font-weight: 500;
}

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

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

.outcome-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  background: var(--positive-subtle);
  color: var(--positive);
}

/* Agent Cards */
.agents-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.agents-grid .empty-state {
  grid-column: 1 / -1;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  min-height: 300px;
}

.agent-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: all var(--transition);
  cursor: pointer;
}

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

.agent-card.active {
  border-color: rgba(34, 197, 94, 0.3);
}

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

.agent-name {
  font-size: 14px;
  font-weight: 600;
}

.agent-status {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 16px;
  font-size: 11px;
  font-weight: 500;
}

.agent-status.running {
  background: var(--positive-subtle);
  color: var(--positive);
}

.agent-status.stopped {
  background: var(--bg-elevated);
  color: var(--text-muted);
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.agent-status.running .status-dot {
  box-shadow: 0 0 6px currentColor;
}

.agent-metrics {
  display: flex;
  gap: 24px;
  padding: 16px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

.metric {
  flex: 1;
}

.metric-value {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 2px;
}

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

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

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

.agent-actions .btn { flex: 1; }

/* Position Items */
.position-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.position-item:last-child { border-bottom: none; }

.position-title {
  flex: 1;
  font-size: 13px;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-right: 12px;
}

.position-value {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}


/* Settings */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 20px;
}

.settings-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
}

.settings-card h2 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
  letter-spacing: -0.2px;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

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

.setting-label {
  font-size: 13px;
  color: var(--text-secondary);
}

.setting-value {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
}

.setting-value code {
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 8px 12px;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
}

.setting-buttons {
  display: flex;
  gap: 8px;
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition);
}

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

.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
}

.modal-box {
  position: relative;
  width: 100%;
  max-width: 520px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transform: scale(0.95) translateY(20px);
  transition: transform var(--transition);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
}

.modal-box.modal-lg {
  max-width: 580px;
}

.modal-box.modal-sm {
  max-width: 400px;
}

.modal.active .modal-box {
  transform: scale(1) translateY(0);
}

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

.modal-header h3 {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.2px;
}

.modal-body { 
  padding: 24px;
  max-height: 70vh;
  overflow-y: auto;
}

/* Mode Tabs */
.mode-tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--bg-elevated);
  border-radius: var(--radius-md);
  margin-bottom: 24px;
}

.mode-tab {
  flex: 1;
  padding: 10px 16px;
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}

.mode-tab:hover {
  color: var(--text-primary);
}

.mode-tab.active {
  background: var(--bg-secondary);
  color: var(--text-primary);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.mode-content {
  display: none;
}

.mode-content.active {
  display: block;
}

/* Strategy Cards */
.strategy-cards {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.strategy-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition);
}

.strategy-card:hover {
  border-color: var(--border-hover);
}

.strategy-card:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-subtle);
}

.strategy-card input {
  display: none;
}

.strategy-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

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

.strategy-desc {
  font-size: 11px;
  color: var(--text-muted);
}

/* Form Sections */
.form-section {
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.form-section:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.form-section-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 16px;
}

/* Checkbox Group */
.checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.checkbox-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
}

.checkbox-item input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 18px 24px;
  border-top: 1px solid var(--border);
}

/* Hide number input arrows */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

input[type="number"] {
  -moz-appearance: textfield;
}

/* Form */
.form-group { margin-bottom: 20px; }
.form-group:last-child { margin-bottom: 0; }

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.input {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 13px;
  transition: all var(--transition);
}

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

.input::placeholder { color: var(--text-muted); }

select.input {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2352525b' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 40px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-hint {
  margin-top: 8px;
  font-size: 11px;
  color: var(--text-muted);
}

/* Address Box */
.address-box {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin: 16px 0;
}

.address-box code {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 12px;
  word-break: break-all;
  color: var(--text-primary);
}

/* Warning */
.warning-box {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  background: rgba(234, 179, 8, 0.08);
  border: 1px solid rgba(234, 179, 8, 0.2);
  border-radius: var(--radius-md);
  color: #eab308;
  font-size: 12px;
}

.warning-box svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  flex-shrink: 0;
  margin-top: 1px;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 28px;
  right: 28px;
  padding: 14px 22px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  transform: translateY(120px);
  opacity: 0;
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 2000;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.toast.success { border-left: 3px solid var(--positive); }
.toast.error { border-left: 3px solid var(--negative); }

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

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

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--border-hover);
}

/* Responsive */
@media (max-width: 1200px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .panels-row { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .sidebar { display: none; }
  .stats-grid { grid-template-columns: 1fr; }
  .header { padding: 0 20px; }
  .content { padding: 20px; }
}

/* Selection */
::selection {
  background: var(--accent);
  color: white;
}

/* Focus visible */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

button:focus:not(:focus-visible),
input:focus:not(:focus-visible) {
  outline: none;
}


/* Agent Detail View */
.agent-detail-header {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 24px;
}

.agent-detail-title {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
}

.agent-detail-title h2 {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.3px;
}

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

.agent-detail-stats {
  display: flex;
  gap: 32px;
  padding: 20px 24px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 24px;
}

.stat-mini {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-mini-value {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}

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

.stat-mini-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.agent-detail-tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  margin-bottom: 20px;
  width: fit-content;
}

.tab-btn {
  padding: 10px 20px;
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}

.tab-btn:hover {
  color: var(--text-primary);
}

.tab-btn.active {
  background: var(--bg-elevated);
  color: var(--text-primary);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.agent-detail-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  min-height: 400px;
}

.tab-content {
  display: none;
  padding: 20px;
}

.tab-content.active {
  display: block;
}

/* Activity List */
.activity-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.activity-item {
  display: flex;
  gap: 16px;
  padding: 16px;
  background: var(--bg-elevated);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

.activity-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.activity-icon svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

.activity-icon.scout { background: var(--accent-subtle); color: var(--accent); }
.activity-icon.analyst { background: rgba(168, 85, 247, 0.1); color: #a855f7; }
.activity-icon.buy { background: var(--positive-subtle); color: var(--positive); }
.activity-icon.sell { background: var(--negative-subtle); color: var(--negative); }
.activity-icon.hold { background: rgba(234, 179, 8, 0.1); color: #eab308; }
.activity-icon.error { background: var(--negative-subtle); color: var(--negative); }

.activity-content {
  flex: 1;
  min-width: 0;
}

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

.activity-action {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.activity-time {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.activity-market {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.activity-reasoning {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}

.activity-meta {
  display: flex;
  gap: 16px;
  margin-top: 8px;
  font-size: 11px;
  color: var(--text-muted);
}

.activity-meta span {
  display: flex;
  align-items: center;
  gap: 4px;
}

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

/* Watchlist */
.watchlist-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.watchlist-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 16px;
  background: var(--bg-elevated);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

.watchlist-item .market-name {
  flex: 1;
  font-size: 13px;
  font-weight: 500;
}

.watchlist-item .price-info {
  display: flex;
  gap: 16px;
  font-family: var(--font-mono);
  font-size: 12px;
}

.watchlist-item .yes-price { color: var(--positive); }
.watchlist-item .no-price { color: var(--negative); }

/* Agent Positions */
.agent-positions-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.agent-position-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 16px;
  background: var(--bg-elevated);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

.agent-position-item .market-name {
  flex: 1;
  font-size: 13px;
  font-weight: 500;
}

.agent-position-item .position-info {
  display: flex;
  gap: 20px;
  font-family: var(--font-mono);
  font-size: 12px;
}

/* Config Grid */
.config-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.config-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: var(--bg-elevated);
  border-radius: var(--radius-md);
}

.config-item .config-label {
  font-size: 12px;
  color: var(--text-secondary);
}

.config-item .config-value {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}
