:root {
  --bg-dark: var(--background);
  --bg-card: var(--card);
  --accent-down: var(--bl-danger);
  --text-main: var(--foreground);
  --text-dim: var(--muted-foreground);
  --header-height: 120px;
}

body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-dark);
  color: var(--text-main);
  -webkit-font-smoothing: antialiased;
}

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

/* Header & Navigation */
.app-header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.header-main {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 60px;
}

.header-main h1 {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0;
  background: linear-gradient(90deg, var(--text-main), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.tab-navigation {
  display: flex;
  gap: 8px;
  height: 50px;
  align-items: flex-end;
}

.tab-navigation button {
  background: none;
  border: none;
  color: var(--text-dim);
  padding: 10px 16px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: all 0.2s;
}

.tab-navigation button:hover {
  color: var(--text-main);
}

.tab-navigation button.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* Layout Content */
.app-content {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 24px;
  max-width: 1600px;
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
}

.cockpit-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 8px;
}

.tab-content-full {
  min-width: 0;
  width: 100%;
}

/* Tab Commons */
.tab-header {
  margin-bottom: 32px;
}

.tab-header h2 {
  font-size: 1.75rem;
  margin: 0 0 8px 0;
}

.tab-header p {
  color: var(--text-dim);
  margin: 0;
}

/* Overview Tab */
.bot-status-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  background: var(--bg-card);
  padding: 16px 24px;
  border-radius: 12px;
  border: 1px solid var(--border);
  margin-bottom: 32px;
}

.status-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.status-item .label {
  font-size: 0.75rem;
  color: var(--text-dim);
  text-transform: uppercase;
}

.status-item .value {
  font-size: 1rem;
  font-weight: 700;
}

.status-online {
  color: var(--accent);
}

.mode-live {
  color: var(--bl-warning);
}

.mode-paper {
  color: var(--bl-info);
}

.readiness-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

/* Market Ticker Card */
.market-ticker-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 32px;
}

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

.ticker-header h3 {
  margin: 0;
  font-size: 0.95rem;
  text-transform: uppercase;
  color: var(--text-dim);
  letter-spacing: 1px;
}

.ticker-count {
  font-size: 0.8rem;
  color: var(--text-dim);
  background: var(--bl-surface-muted);
  padding: 4px 10px;
  border-radius: 100px;
}

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

.ticker-item {
  background: color-mix(in oklab, var(--text-main) 2%, transparent);
  border: 1px solid var(--border);
  padding: 10px 12px;
  border-radius: 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.2s;
}

.ticker-item:hover {
  background: var(--bl-surface-muted);
  border-color: var(--border-strong);
  transform: translateY(-2px);
}

.ticker-symbol {
  font-weight: 700;
  font-size: 0.85rem;
}

.ticker-values {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.ticker-price {
  font-size: 0.9rem;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
}

.ticker-change {
  font-size: 0.75rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 4px;
}

.ticker-change.positive {
  color: var(--accent);
}

.ticker-change.negative {
  color: var(--accent-down);
}

.ticker-loading {
  grid-column: 1 / -1;
  text-align: center;
  padding: 30px;
  color: var(--text-dim);
  font-style: italic;
  background: color-mix(in oklab, var(--text-main) 2%, transparent);
  border-radius: 8px;
  border: 1px dashed var(--border);
}

.opportunities-section {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 24px;
  margin-bottom: 32px;
}

.app-sidebar {
  position: sticky;
  top: calc(120px + 24px);
  height: calc(100vh - 120px - 48px);
  display: flex;
  flex-direction: column;
  gap: 20px;
  overflow-y: auto;
  padding-right: 4px;
  /* Space for scrollbar */
}

.app-sidebar::-webkit-scrollbar {
  width: 4px;
}

.app-sidebar::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 10px;
}

.readiness-card {
  background: var(--bg-card);
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 20px;
  display: flex;
  flex-direction: column;
}

.readiness-card .card-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 20px;
}

.readiness-card h3 {
  margin: 0;
  font-size: 1.25rem;
}

.metrics-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}

.metric {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  color: var(--text-dim);
}

.metric .value {
  font-size: 1.5rem;
  color: var(--text-main);
  font-weight: 600;
}

.metric .value.bullish {
  color: var(--accent);
}

.metric .value.bearish {
  color: var(--accent-down);
}

.readiness-footer {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  font-weight: bold;
}

/* Tables (Premium Pro Style) */
.table-container {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--bl-radius-card);
  overflow: hidden;
  margin-bottom: 28px;
  box-shadow: var(--card-shadow);
  position: relative;
}

.table-container::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent-soft), transparent);
}

.pro-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  text-align: left;
}

.pro-table th {
  padding: 14px 16px;
  background: var(--muted);
  font-size: 0.7rem;
  font-weight: 750;
  text-transform: uppercase;
  color: var(--text-dim);
  letter-spacing: 0.08em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.pro-table td {
  padding: 14px 16px;
  font-size: 0.85rem;
  color: color-mix(in oklab, var(--text-main) 84%, transparent);
  border-bottom: 1px solid var(--border);
  transition: all 0.2s ease;
  vertical-align: middle;
}

.pro-table tr {
  transition: all 0.2s ease;
}

.pro-table tbody tr:hover {
  background: color-mix(in oklab, var(--accent) 8%, transparent);
}

.pro-table tbody tr:hover td {
  color: var(--text-main);
  border-bottom-color: var(--border);
}

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

/* Monospace alignment for numbers in tables */
.pro-table .font-mono {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.bold {
  font-weight: 700;
  color: var(--text-main);
}

.fade {
  color: var(--text-dim);
}

.italic {
  font-style: italic;
}

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

.empty {
  padding: 48px !important;
  color: var(--text-dim);
  text-align: center;
}

.side-buy {
  color: var(--accent);
  font-weight: bold;
}

.side-sell {
  color: var(--accent-down);
  font-weight: bold;
}

.up {
  color: var(--accent);
}

.down {
  color: var(--accent-down);
}

.status-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--muted);
  font-size: 0.7rem;
  font-weight: 750;
}

.status-tag.active {
  background: var(--bl-info-muted);
  color: var(--bl-info);
}

.status-tag.pulse {
  background: var(--bl-success-muted);
  color: var(--accent);
  animation: pulse-opac 2s infinite;
}

@keyframes pulse-opac {
  0% {
    opacity: 1;
  }

  50% {
    opacity: 0.5;
  }

  100% {
    opacity: 1;
  }
}

/* Settings Tab */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 24px;
}

.settings-group {
  background: var(--card);
  padding: 24px;
  border-radius: var(--bl-radius-card);
  border: 1px solid var(--border);
  box-shadow: var(--card-shadow);
}

.settings-group h3 {
  margin-top: 0;
  font-size: 1rem;
  color: var(--foreground);
}

.control-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.95rem;
  font-weight: 700;
}

.dot {
  width: 12px;
  height: 12px;
  background: var(--muted-foreground);
  border-radius: 50%;
}

.dot.active {
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
}

.kill-switch {
  width: 100%;
  padding: 16px;
  background: var(--accent-down);
  color: var(--primary-foreground);
  border: none;
  border-radius: var(--bl-radius-control);
  font-weight: 800;
  cursor: not-allowed;
  opacity: 0.5;
}

.config-help {
  margin-top: 40px;
  padding: 24px;
  border-top: 1px solid var(--border);
}

.env-vars {
  background: var(--bg-dark);
  padding: 16px;
  border-radius: 8px;
  font-family: monospace;
}

.var {
  margin-bottom: 8px;
}

/* Responsive */
@media (max-width: 1200px) {
  .app-content {
    grid-template-columns: 1fr;
  }
}

.signals-tab {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.symbols-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(450px, 1fr));
  gap: 24px;
}

.empty-state {
  padding: 48px;
  text-align: center;
  background: var(--bg-card);
  border-radius: 12px;
  border: 1px dashed var(--border);
  color: var(--text-dim);
  font-style: italic;
}
