/* SNKKK AI Trader — Design System (ui-ux-pro-max MASTER.md) */
:root {
  --color-primary: #F59E0B;
  --color-on-primary: #060913;
  --color-secondary: #FBBF24;
  --color-accent: #8B5CF6;
  --color-background: #060913;
  --color-surface: #0C1222;
  --color-card: #121A2D;
  --color-muted: #1A243B;
  --color-foreground: #F8FAFC;
  --color-muted-foreground: #94A3B8;
  --color-border: #24324D;
  --color-positive: #10B981;
  --color-destructive: #EF4444;
  --color-ring: #F59E0B;

  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 12px;
  --space-lg: 16px;
  --space-xl: 24px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --font-sans: 'Inter', 'Noto Sans Thai', -apple-system, BlinkMacSystemFont, sans-serif;
}

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

html, body {
  margin: 0;
  padding: 0;
  background: var(--color-background);
  color: var(--color-foreground);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
  scrollbar-color: #334155 transparent;
  scrollbar-width: thin;
}

.tabular {
  font-variant-numeric: tabular-nums;
}

:focus-visible {
  outline: 2px solid var(--color-ring);
  outline-offset: 2px;
}

button, a, select, input {
  font-family: inherit;
}

/* Login Page */
.login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-lg);
  background: radial-gradient(circle at top right, rgba(245, 158, 11, 0.08), transparent 45%),
              radial-gradient(circle at bottom left, rgba(139, 92, 246, 0.07), transparent 45%),
              var(--color-background);
}

.login-shell {
  width: 100%;
  max-width: 420px;
}

.login-card {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: rgba(245, 158, 11, 0.14);
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: var(--color-primary);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.login-title {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.login-subtitle {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--color-muted-foreground);
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field label {
  font-size: 13px;
  font-weight: 500;
  color: var(--color-foreground);
}

.field input, .field select {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  background: var(--color-background);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-foreground);
  font-size: 14px;
  transition: border-color 180ms ease;
}

.field input:focus, .field select:focus {
  border-color: var(--color-primary);
  outline: none;
}

.field-hint {
  font-size: 12px;
  color: var(--color-muted-foreground);
}

.password-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.password-wrap input {
  padding-right: 44px;
}

.icon-btn {
  position: absolute;
  right: 4px;
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  color: var(--color-muted-foreground);
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  cursor: pointer;
}

.icon-btn:hover {
  color: var(--color-foreground);
  background: var(--color-muted);
}

.form-error {
  margin: 0;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: rgba(239, 68, 68, 0.14);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #FCA5A5;
  font-size: 13px;
}

.login-footer {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--color-muted-foreground);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color 180ms ease, border-color 180ms ease, transform 120ms ease;
  white-space: nowrap;
}

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

.btn-full {
  width: 100%;
  min-height: 44px;
}

.btn-primary {
  background: var(--color-primary);
  color: var(--color-on-primary);
}
.btn-primary:hover:not(:disabled) {
  background: var(--color-secondary);
}

.btn-accent {
  background: rgba(139, 92, 246, 0.16);
  border-color: rgba(139, 92, 246, 0.45);
  color: #DDD6FE;
}
.btn-accent:hover:not(:disabled) {
  background: rgba(139, 92, 246, 0.28);
}

.btn-ghost {
  background: var(--color-muted);
  border-color: var(--color-border);
  color: var(--color-foreground);
}
.btn-ghost:hover:not(:disabled) {
  background: #334155;
}

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.45);
  color: #FCA5A5;
}
.btn-danger:hover:not(:disabled) {
  background: rgba(239, 68, 68, 0.28);
}

.btn-sm {
  min-height: 32px;
  padding: 0 10px;
  font-size: 12px;
}

/* Main Terminal Shell */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--color-border);
}

.topbar-inner {
  max-width: 1440px;
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-text {
  min-width: 0;
}

.topbar-badges {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex-wrap: wrap;
}

.topbar-title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.topbar-sub {
  font-size: 11px;
  color: var(--color-muted-foreground);
}

.mobile-top-actions,
.mobile-drawer-meta {
  display: none;
}

.chev-icon {
  transition: transform 180ms ease;
}

.topbar-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.command-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  flex-wrap: wrap;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.badge-paper {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: #FCD34D;
}

.badge-live {
  background: rgba(16, 185, 129, 0.16);
  border: 1px solid rgba(16, 185, 129, 0.45);
  color: #6EE7B7;
}

.badge-paused {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #FCA5A5;
}

.badge-ai {
  background: rgba(139, 92, 246, 0.16);
  border: 1px solid rgba(139, 92, 246, 0.4);
  color: #DDD6FE;
}

.badge-neutral {
  background: var(--color-muted);
  border: 1px solid var(--color-border);
  color: var(--color-muted-foreground);
}

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

/* Navigation Tabs */
.nav-tabs {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 16px;
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--color-border);
  overflow-x: auto;
}

.nav-tab {
  min-height: 44px;
  padding: 0 16px;
  border: none;
  background: transparent;
  color: var(--color-muted-foreground);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  transition: color 160ms ease, border-color 160ms ease;
}

.nav-tab:hover {
  color: var(--color-foreground);
}

.nav-tab.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}

/* Main Content */
.container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 16px;
}

.tab-panel {
  display: none;
}
.tab-panel.active {
  display: block;
}

/* KPI Grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

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

.kpi-label {
  font-size: 12px;
  color: var(--color-muted-foreground);
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.kpi-value {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.kpi-sub {
  margin-top: 6px;
  font-size: 12px;
  color: var(--color-muted-foreground);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.pos { color: var(--color-positive); }
.neg { color: var(--color-destructive); }
.gold { color: var(--color-primary); }

/* Dashboard Grid */
.main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  gap: 16px;
  margin-bottom: 16px;
}

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

.card-title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Chart Container */
.chart-wrap {
  width: 100%;
  height: 240px;
  position: relative;
}

#equity-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* AI Brain Card */
.ai-summary-box {
  background: var(--color-background);
  border: 1px solid var(--color-border);
  border-left: 3px solid var(--color-accent);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 12px;
  font-size: 13px;
  line-height: 1.6;
}

.chip-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.chip {
  padding: 3px 9px;
  border-radius: 6px;
  background: var(--color-muted);
  border: 1px solid var(--color-border);
  font-size: 12px;
  font-weight: 600;
  color: var(--color-foreground);
}

.tier-bar {
  margin-top: 12px;
  padding: 12px;
  background: var(--color-background);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
}

.tier-progress {
  height: 6px;
  background: var(--color-muted);
  border-radius: 999px;
  overflow: hidden;
  margin: 8px 0;
}

.tier-progress-fill {
  height: 100%;
  background: var(--color-primary);
  border-radius: 999px;
  transition: width 300ms ease;
}

/* Tables */
.table-wrap {
  width: 100%;
  overflow-x: auto;
}

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

th {
  text-align: left;
  padding: 10px 10px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-muted-foreground);
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}

td {
  padding: 10px 10px;
  border-bottom: 1px solid rgba(51, 65, 85, 0.55);
  vertical-align: middle;
}

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

.empty-state {
  padding: 28px 16px;
  text-align: center;
  color: var(--color-muted-foreground);
  font-size: 13px;
}

/* Settings Grid */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.settings-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.status-banner[hidden] {
  display: none !important;
}

.status-banner {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.status-banner.info {
  background: rgba(139, 92, 246, 0.14);
  border: 1px solid rgba(139, 92, 246, 0.35);
  color: #EDE9FE;
}

.status-banner.warn {
  background: rgba(245, 158, 11, 0.14);
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: #FEF3C7;
}

/* Logs */
.log-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 360px;
  overflow-y: auto;
}

.log-item {
  display: grid;
  grid-template-columns: 74px 74px minmax(0, 1fr);
  gap: 10px;
  padding: 8px 10px;
  background: var(--color-background);
  border: 1px solid rgba(51, 65, 85, 0.6);
  border-radius: var(--radius-sm);
  font-size: 12px;
}

/* Toast */
.toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 60;
  max-width: 380px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: var(--color-card);
  border: 1px solid var(--color-primary);
  color: var(--color-foreground);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
  font-size: 13px;
  display: none;
}

.toast.show {
  display: block;
}

/* v2 Additions: Sentiment Bar, Strategy Pills, AI Chat */
.meta-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.intel-card {
  background: linear-gradient(135deg, rgba(14, 24, 44, 0.96), rgba(17, 24, 39, 0.96));
  border: 1px solid rgba(56, 189, 248, 0.32);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  margin-bottom: 12px;
  box-shadow: 0 4px 18px rgba(6, 182, 212, 0.08);
}

.intel-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
  padding-bottom: 7px;
  border-bottom: 1px solid rgba(56, 189, 248, 0.16);
}

.intel-card-title {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #7DD3FC;
}

.intel-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #38BDF8;
  box-shadow: 0 0 8px #38BDF8;
}

.intel-guard-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  max-width: 100%;
}

.intel-guard-note {
  font-size: 11px;
  color: var(--color-muted-foreground);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 280px;
}

.intel-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.intel-item {
  background: rgba(6, 9, 19, 0.62);
  border: 1px solid rgba(51, 65, 85, 0.65);
  border-radius: var(--radius-sm);
  padding: 7px 9px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.intel-item > span {
  font-size: 10px;
  color: var(--color-muted-foreground);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.intel-item > strong {
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Trade Journal: sleek desktop rows + compact mobile cards */
.trades-table {
  min-width: 920px;
}

.trades-table td {
  white-space: nowrap;
  padding: 8px 10px;
}

.trades-table td.trade-reason-td {
  white-space: normal;
  min-width: 180px;
  max-width: 260px;
}

.reason-clamp {
  font-size: 12px;
  color: var(--color-muted-foreground);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  cursor: pointer;
}

.reason-clamp.expanded {
  display: block;
  -webkit-line-clamp: unset;
}

.trades-mobile-list,
.positions-mobile-list {
  display: none;
}

.positions-top-card {
  margin-bottom: 12px;
  padding: 12px 14px;
}

.positions-top-card .card-header {
  margin-bottom: 8px;
}

.positions-table {
  min-width: 900px;
}

.positions-table td {
  white-space: nowrap;
  padding: 8px 10px;
}

.positions-table td.trade-reason-td {
  white-space: normal;
  min-width: 170px;
  max-width: 240px;
}

.empty-state-slim {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: rgba(6, 9, 19, 0.55);
  border: 1px dashed rgba(51, 65, 85, 0.65);
  color: var(--color-muted-foreground);
  font-size: 12px;
  text-align: center;
}

.badge-legacy {
  background: rgba(148, 163, 184, 0.14);
  border: 1px solid rgba(148, 163, 184, 0.35);
  color: #CBD5E1;
  font-size: 10px;
}

@media (max-width: 1024px) {
  .intel-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 768px) {
  .journal-table-wrap,
  .positions-table-wrap {
    display: none;
  }
  .trades-mobile-list,
  .positions-mobile-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }
  .positions-top-card {
    padding: 10px 11px;
    margin-bottom: 10px;
  }
  .positions-top-card .card-header .badge {
    display: none;
  }
  .trade-mcard {
    background: var(--color-background);
    border: 1px solid rgba(51, 65, 85, 0.72);
    border-radius: var(--radius-sm);
    padding: 9px 11px;
    display: flex;
    flex-direction: column;
    gap: 5px;
  }
  .trade-mcard-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
  }
  .trade-mcard-sym {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
    min-width: 0;
  }
  .trade-mcard-sym strong {
    font-size: 13px;
  }
  .trade-mcard-pnl {
    text-align: right;
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
    flex-shrink: 0;
  }
  .trade-mcard-pnl small {
    display: inline;
    font-size: 11px;
    font-weight: 600;
    margin-left: 4px;
  }
  .trade-mcard-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 4px 10px;
    font-size: 11px;
    color: var(--color-muted-foreground);
  }
  .trade-mcard-reason {
    font-size: 11px;
    color: var(--color-muted-foreground);
    line-height: 1.4;
    padding-top: 4px;
    border-top: 1px dashed rgba(51, 65, 85, 0.55);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
  }
  .trade-mcard-reason.expanded {
    white-space: normal;
    overflow: visible;
  }
  #ai-history-list .ai-summary-box {
    padding: 9px 11px;
    font-size: 12px;
    line-height: 1.45;
    margin-bottom: 6px !important;
  }
}

@media (max-width: 600px) {
  .intel-card {
    padding: 9px 10px;
  }
  .intel-guard-note {
    max-width: 175px;
  }
  .intel-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }
  .intel-strip .intel-item:last-child {
    grid-column: 1 / -1;
  }
  .intel-item {
    padding: 6px 8px;
  }
}

.sentiment-card {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.fng-meter {
  display: flex;
  align-items: center;
  gap: 10px;
}

.fng-score {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 14px;
  border: 2px solid var(--color-primary);
  background: rgba(245, 158, 11, 0.12);
}

.strat-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 600;
  background: rgba(139, 92, 246, 0.15);
  border: 1px solid rgba(139, 92, 246, 0.35);
  color: #DDD6FE;
  white-space: nowrap;
}

.news-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.news-item {
  padding: 8px 10px;
  background: var(--color-background);
  border: 1px solid rgba(51, 65, 85, 0.55);
  border-radius: var(--radius-sm);
  font-size: 12px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

/* AI Chat Panel */
.chat-shell {
  display: flex;
  flex-direction: column;
  height: 540px;
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chat-msg {
  max-width: 82%;
  padding: 11px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
}

.chat-msg.user {
  align-self: flex-end;
  background: rgba(245, 158, 11, 0.16);
  border: 1px solid rgba(245, 158, 11, 0.38);
  color: var(--color-foreground);
}

.chat-msg.assistant {
  align-self: flex-start;
  background: var(--color-background);
  border: 1px solid var(--color-border);
  border-left: 3px solid var(--color-accent);
  color: var(--color-foreground);
}

.chat-quick {
  padding: 8px 14px;
  border-top: 1px solid var(--color-border);
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  background: rgba(15, 23, 42, 0.5);
}

.chat-input-bar {
  display: flex;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid var(--color-border);
  background: var(--color-surface);
}

.chat-input-bar input {
  flex: 1;
  min-height: 42px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: var(--color-background);
  color: var(--color-foreground);
  font-size: 13px;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  cursor: pointer;
}

.checkbox-row input {
  width: 18px;
  height: 18px;
  min-height: auto;
  accent-color: var(--color-primary);
}

@media (max-width: 1024px) {
  .meta-strip {
    grid-template-columns: 1fr;
  }
}

/* 3D HUD Overlays & Coin Metrics */
.hero-3d-canvas {
  width: 100%;
  height: 100%;
}

.hud-overlay {
  position: absolute;
  pointer-events: none;
  z-index: 10;
}

.hud-top-right {
  top: 14px;
  right: 14px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
  pointer-events: auto;
}

.hud-btn {
  min-height: 32px;
  padding: 0 10px;
  border-radius: 7px;
  border: 1px solid rgba(148, 163, 184, 0.3);
  background: rgba(6, 9, 19, 0.78);
  backdrop-filter: blur(8px);
  color: var(--color-muted-foreground);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 160ms ease;
}

.hud-btn:hover, .hud-btn.active {
  color: #F8FAFC;
  border-color: var(--color-primary);
  background: rgba(245, 158, 11, 0.16);
}

.hud-bottom-left {
  bottom: 12px;
  left: 14px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  padding: 6px 12px;
  border-radius: 8px;
  background: rgba(6, 9, 19, 0.72);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(51, 65, 85, 0.55);
  font-size: 11px;
  color: var(--color-muted-foreground);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.drawer-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.drawer-metric {
  background: rgba(6, 9, 19, 0.7);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 11px;
}

.drawer-metric strong {
  display: block;
  font-size: 13px;
  margin-top: 2px;
}

.coin-ai-box {
  background: rgba(6, 9, 19, 0.85);
  border: 1px solid rgba(139, 92, 246, 0.45);
  border-left: 3px solid var(--color-accent);
  border-radius: 6px;
  padding: 10px;
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
}

/* Equity Hover Tooltip */
.chart-tooltip {
  position: absolute;
  pointer-events: none;
  display: none;
  padding: 6px 10px;
  border-radius: 6px;
  background: rgba(6, 9, 19, 0.94);
  border: 1px solid var(--color-primary);
  font-size: 11px;
  color: var(--color-foreground);
  white-space: nowrap;
  z-index: 5;
}

/* v4.0: Live Ticker Tape, Treemap Heatmap, Pro Chart, AI Radar, Allocation Bar, Mobile Bottom Nav */
.ticker-bar {
  background: #04070E;
  border-bottom: 1px solid var(--color-border);
  padding: 6px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  overflow-x: auto;
  font-size: 12px;
}

.ticker-items {
  display: flex;
  align-items: center;
  gap: 16px;
  white-space: nowrap;
}

.ticker-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 5px;
  transition: background 150ms ease;
}

.ticker-item:hover {
  background: var(--color-muted);
}

.heartbeat-strip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  color: var(--color-muted-foreground);
  white-space: nowrap;
}

.sse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-positive);
  box-shadow: 0 0 8px var(--color-positive);
}

/* 4-View Market Command Center */
.command-center {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 16px;
}

.command-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  flex-wrap: wrap;
}

.view-switcher {
  display: inline-flex;
  background: var(--color-background);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 3px;
  gap: 3px;
  flex-wrap: wrap;
}

.view-btn {
  min-height: 32px;
  padding: 0 12px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--color-muted-foreground);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 150ms ease;
}

.view-btn:hover {
  color: var(--color-foreground);
}

.view-btn.active {
  background: var(--color-primary);
  color: var(--color-on-primary);
}

.command-stage {
  position: relative;
  width: 100%;
  height: 430px;
  background: #050811;
}

.stage-pane {
  position: absolute;
  inset: 0;
  display: none;
}

.stage-pane.active {
  display: block;
}

/* Treemap Heatmap */
.heatmap-wrap {
  position: relative;
  width: 100%;
  height: 100%;
}

.hm-tile {
  position: absolute;
  border: 1px solid rgba(15, 23, 42, 0.9);
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  text-align: left;
  color: #F8FAFC;
  cursor: pointer;
  overflow: hidden;
  transition: filter 140ms ease, transform 120ms ease;
}

.hm-tile:hover {
  filter: brightness(1.18);
  z-index: 4;
}

.hm-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}

.hm-sym {
  font-weight: 700;
  letter-spacing: -0.01em;
}

.hm-badges {
  display: flex;
  gap: 3px;
}

.hm-tag {
  font-size: 9px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
}

.hm-tag.ai {
  background: #8B5CF6;
  color: #FFFFFF;
}

.hm-tag.hold {
  background: #F59E0B;
  color: #060913;
}

.hm-chg {
  font-weight: 700;
}

.hm-price {
  font-size: 11px;
  color: rgba(248, 250, 252, 0.85);
}

.hm-meta {
  font-size: 10px;
  color: rgba(248, 250, 252, 0.72);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@keyframes flashUp {
  0% { box-shadow: inset 0 0 0 2px #34D399; }
  100% { box-shadow: inset 0 0 0 0 transparent; }
}
@keyframes flashDown {
  0% { box-shadow: inset 0 0 0 2px #F87171; }
  100% { box-shadow: inset 0 0 0 0 transparent; }
}
.flash-up { animation: flashUp 600ms ease; }
.flash-down { animation: flashDown 600ms ease; }

/* Pro Chart Pane */
.prochart-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 310px;
  height: 100%;
}

.prochart-left {
  display: flex;
  flex-direction: column;
  height: 100%;
  border-right: 1px solid var(--color-border);
}

.prochart-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  background: rgba(12, 18, 34, 0.9);
  border-bottom: 1px solid var(--color-border);
  flex-wrap: wrap;
}

.tf-group {
  display: inline-flex;
  gap: 4px;
}

.tf-btn {
  min-height: 28px;
  padding: 0 9px;
  border-radius: 5px;
  border: 1px solid var(--color-border);
  background: transparent;
  color: var(--color-muted-foreground);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.tf-btn.active, .tf-btn:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: rgba(245, 158, 11, 0.12);
}

.prochart-canvas {
  flex: 1;
  min-height: 0;
}

.prochart-side {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  background: var(--color-surface);
}

/* Allocation & Risk Cockpit */
.alloc-bar {
  display: flex;
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--color-background);
  margin: 8px 0;
}

.alloc-seg-cash { background: #38BDF8; }
.alloc-seg-pos { background: #F59E0B; }
.alloc-seg-vault { background: #10B981; }

/* Mobile Bottom Nav */
.mobile-bottom-nav {
  display: none;
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 65;
  background: rgba(2, 6, 23, 0.78);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-backdrop.open {
  display: flex;
}

.modal-card {
  width: 100%;
  max-width: 440px;
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

/* Word-break safety across cards & logs */
.ai-summary-box,
.coin-ai-box,
.chat-msg,
.news-item,
.log-item {
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* Tablet & Compact Desktop */
@media (max-width: 1024px) {
  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .main-grid, .settings-grid {
    grid-template-columns: 1fr;
  }
}

/* Compact Collapsible Header for Tablet/Mobile (<= 960px) */
@media (max-width: 960px) {
  .topbar-inner {
    padding: 8px 12px;
    gap: 8px;
  }
  .topbar-left {
    flex: 1;
    min-width: 0;
    gap: 8px;
  }
  .topbar-left .brand-mark {
    width: 34px;
    height: 34px;
    border-radius: 8px;
  }
  .topbar-left .brand-mark svg {
    width: 17px;
    height: 17px;
  }
  .topbar-sub {
    display: none;
  }
  .topbar-title {
    font-size: 14px;
  }
  #badge-ai {
    display: none;
  }
  #badge-mode {
    padding: 3px 8px;
    font-size: 10px;
  }
  .mobile-top-actions {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
  }
  .mobile-top-actions .btn-sm {
    min-height: 34px;
    padding: 0 10px;
    font-size: 12px;
  }
  .topbar-controls {
    display: none;
    width: 100%;
    padding-top: 10px;
    margin-top: 2px;
    border-top: 1px solid var(--color-border);
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
  .topbar-controls.open {
    display: grid;
  }
  .topbar-controls #btn-ai-scan {
    display: none;
  }
  .topbar-controls .btn {
    width: 100%;
    min-height: 40px;
    font-size: 12px;
  }
  .mobile-drawer-meta {
    display: flex;
    grid-column: 1 / -1;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    background: var(--color-background);
    border: 1px solid var(--color-border);
  }
  #badge-ai-mobile {
    max-width: 65%;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  #btn-mobile-controls[aria-expanded="true"] .chev-icon {
    transform: rotate(180deg);
  }
  .prochart-layout {
    grid-template-columns: 1fr;
    height: auto;
  }
  .prochart-left {
    height: 290px;
    border-right: none;
    border-bottom: 1px solid var(--color-border);
  }
  .command-stage.mode-prochart {
    height: auto !important;
    min-height: 360px;
  }
  .command-stage.mode-prochart .stage-pane.active {
    position: relative;
    inset: auto;
  }
}

/* Mobile Layout (<= 768px) */
@media (max-width: 768px) {
  body {
    padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  }
  .hide-sm {
    display: none;
  }
  .container {
    padding: 10px 10px 14px;
  }
  .card {
    padding: 12px;
  }
  .card-header {
    gap: 8px;
    margin-bottom: 10px;
  }
  .card-title {
    font-size: 14px;
  }

  /* Ticker bar: heartbeat pinned cleanly above swipeable prices */
  .ticker-bar {
    flex-direction: column-reverse;
    align-items: stretch;
    gap: 4px;
    padding: 6px 10px;
    overflow: hidden;
  }
  .heartbeat-strip {
    justify-content: space-between;
    width: 100%;
    font-size: 11px;
    gap: 6px;
    padding-bottom: 4px;
    border-bottom: 1px solid rgba(36, 50, 77, 0.55);
  }
  .heartbeat-strip .hb-sep {
    opacity: 0.4;
  }
  .ticker-items {
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    gap: 10px;
    padding: 2px 0;
  }
  .ticker-items::-webkit-scrollbar {
    display: none;
  }

  .nav-tabs {
    display: none;
  }

  /* Command Center: clean 4-equal segmented switcher */
  .command-toolbar {
    padding: 8px 10px;
    gap: 8px;
  }
  .view-switcher {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 2px;
  }
  .view-btn {
    padding: 0 4px;
    font-size: 11px;
    min-height: 32px;
    text-align: center;
    white-space: nowrap;
  }
  .command-meta {
    width: 100%;
    justify-content: space-between;
    font-size: 11px;
  }
  .command-stage {
    height: 330px;
  }
  .hud-bottom-left {
    left: 8px;
    right: 8px;
    bottom: 8px;
    gap: 6px;
    padding: 5px 8px;
    font-size: 10px;
  }
  .hud-top-right {
    top: 8px;
    right: 8px;
    gap: 4px;
  }
  .hud-btn {
    min-height: 28px;
    padding: 0 8px;
    font-size: 10px;
  }

  /* 2x2 Compact KPI Cards */
  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 12px;
  }
  .kpi-grid .card {
    padding: 11px;
  }
  .kpi-label {
    font-size: 11px;
    gap: 4px;
    flex-wrap: wrap;
    margin-bottom: 4px;
  }
  .kpi-value {
    font-size: 18px;
  }
  .kpi-sub {
    font-size: 11px;
    gap: 4px 8px;
    margin-top: 4px;
  }

  /* Sentiment & Meta Strip */
  .meta-strip {
    gap: 8px;
    margin-bottom: 12px;
  }
  .sentiment-card {
    padding: 10px 12px;
    flex-wrap: wrap;
    gap: 8px;
  }

  /* Tables: smooth touch swipe + sticky first column (symbol) */
  .table-wrap {
    -webkit-overflow-scrolling: touch;
    margin: 0 -2px;
  }
  th, td {
    padding: 8px 8px;
    font-size: 12px;
  }
  .table-wrap table th:first-child,
  .table-wrap table td:first-child {
    position: sticky;
    left: 0;
    background: var(--color-card);
    z-index: 2;
    box-shadow: 3px 0 8px rgba(6, 9, 19, 0.45);
  }

  /* Fixed Log Items: header row (time + category) + full-width message */
  .log-item {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 3px 8px;
    padding: 8px 10px;
    font-size: 12px;
  }
  .log-item > span:nth-child(3) {
    flex: 1 0 100%;
    color: var(--color-foreground);
    line-height: 1.5;
  }

  /* News items stack cleanly */
  .news-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  /* AI Chat optimized for mobile viewport */
  .chat-shell {
    height: calc(100dvh - 185px);
    min-height: 390px;
  }
  .chat-messages {
    padding: 12px;
  }
  .chat-msg {
    max-width: 92%;
    font-size: 13px;
  }
  .chat-quick {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    padding: 8px 10px;
  }
  .chat-quick::-webkit-scrollbar {
    display: none;
  }
  .chat-quick .quick-q {
    flex-shrink: 0;
  }
  .chat-input-bar {
    padding: 10px;
  }
  /* Prevent iOS Safari auto-zoom on focused inputs */
  .chat-input-bar input,
  .field input,
  .field select {
    font-size: 16px;
  }

  /* Settings forms */
  .form-row {
    grid-template-columns: 1fr;
  }

  /* Toast positioned safely above Mobile Bottom Nav */
  .toast {
    left: 12px;
    right: 12px;
    bottom: calc(74px + env(safe-area-inset-bottom, 0px));
    max-width: none;
  }

  /* 6-Tab Mobile Bottom Navigation */
  .mobile-bottom-nav {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 45;
    background: rgba(6, 9, 19, 0.96);
    backdrop-filter: blur(14px);
    border-top: 1px solid var(--color-border);
    padding: 4px 2px calc(4px + env(safe-area-inset-bottom, 4px));
  }
  .mb-nav-btn {
    min-height: 50px;
    padding: 4px 2px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--color-muted-foreground);
    font-size: 10px;
    font-weight: 600;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    cursor: pointer;
    position: relative;
    transition: color 150ms ease, background 150ms ease;
  }
  .mb-nav-btn svg {
    width: 17px;
    height: 17px;
  }
  .mb-nav-btn.active {
    color: var(--color-primary);
    background: rgba(245, 158, 11, 0.10);
  }
  .mb-nav-btn.active::before {
    content: "";
    position: absolute;
    top: 0;
    left: 24%;
    right: 24%;
    height: 2px;
    border-radius: 99px;
    background: var(--color-primary);
  }
}

/* Very narrow phones (<= 360px) */
@media (max-width: 360px) {
  .kpi-value {
    font-size: 16px;
  }
  .mb-nav-btn {
    font-size: 9px;
  }
  .mobile-top-actions .btn-sm {
    padding: 0 7px;
    font-size: 11px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition: none !important;
    animation: none !important;
  }
}


/* Futures-specific badges & 3-way mode switcher */
.badge-testnet {
  background: rgba(56, 189, 248, 0.16);
  border: 1px solid rgba(56, 189, 248, 0.45);
  color: #7DD3FC;
}

.badge-long {
  background: rgba(16, 185, 129, 0.18);
  border: 1px solid rgba(16, 185, 129, 0.5);
  color: #34D399;
}

.badge-short {
  background: rgba(239, 68, 68, 0.18);
  border: 1px solid rgba(239, 68, 68, 0.5);
  color: #F87171;
}

.badge-futures-brand {
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.2), rgba(245, 158, 11, 0.2));
  border: 1px solid rgba(34, 211, 238, 0.45);
  color: #67E8F9;
}

.mode-group {
  display: inline-flex;
  background: var(--color-background);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 2px;
  gap: 2px;
}

.mode-btn {
  border: none;
  background: transparent;
  color: var(--color-muted-foreground);
  font-size: 11px;
  font-weight: 700;
  padding: 5px 9px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.mode-btn:hover {
  color: var(--color-foreground);
}

.mode-btn.active[data-mode="PAPER"] {
  background: rgba(245, 158, 11, 0.22);
  color: #FCD34D;
}

.mode-btn.active[data-mode="TESTNET"] {
  background: rgba(56, 189, 248, 0.22);
  color: #7DD3FC;
}

.mode-btn.active[data-mode="LIVE"] {
  background: rgba(239, 68, 68, 0.25);
  color: #FCA5A5;
}

@media (max-width: 960px) {
  .topbar-controls .mode-group {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
  }
  .topbar-controls .mode-btn {
    min-height: 36px;
    font-size: 12px;
  }
}

/* v5.0: Unmistakable LIVE/TESTNET/PAPER Mode Identity, Liq Bar, Calculator, Filters, Mobile Cards */
.live-mode-bar[hidden] {
  display: none !important;
}

.live-mode-bar {
  background: linear-gradient(90deg, #991B1B, #DC2626, #991B1B);
  color: #FEF2F2;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-align: center;
  padding: 5px 12px;
  border-bottom: 1px solid rgba(252, 165, 165, 0.45);
  box-shadow: 0 2px 14px rgba(220, 38, 38, 0.35);
}

body.mode-live .topbar {
  border-bottom-color: rgba(239, 68, 68, 0.55);
  box-shadow: 0 4px 20px rgba(220, 38, 38, 0.16);
}

body.mode-testnet .topbar {
  border-bottom-color: rgba(56, 189, 248, 0.42);
}

body.mode-paper .topbar {
  border-bottom-color: rgba(245, 158, 11, 0.35);
}

.badge-live-danger {
  background: rgba(220, 38, 38, 0.25);
  border: 1px solid rgba(248, 113, 113, 0.8);
  color: #FEE2E2;
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.45);
  animation: livePulse 2s ease-in-out infinite;
}

@keyframes livePulse {
  0%, 100% { box-shadow: 0 0 8px rgba(239, 68, 68, 0.38); }
  50% { box-shadow: 0 0 16px rgba(239, 68, 68, 0.72); }
}

.status-banner.danger {
  background: rgba(239, 68, 68, 0.16);
  border: 1px solid rgba(239, 68, 68, 0.45);
  color: #FEE2E2;
}

.pos-header-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Liquidation Proximity Safety Bar */
.liq-bar-wrap {
  margin-top: 4px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 112px;
}

.liq-bar-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 10px;
  gap: 6px;
}

.liq-bar-track {
  width: 100%;
  height: 5px;
  border-radius: 999px;
  background: rgba(30, 41, 59, 0.9);
  overflow: hidden;
}

.liq-bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 250ms ease;
}

.liq-safe .liq-bar-fill { background: #10B981; }
.liq-safe .liq-dist { color: #34D399; font-weight: 600; }

.liq-warn .liq-bar-fill { background: #F59E0B; }
.liq-warn .liq-dist { color: #FBBF24; font-weight: 700; }

.liq-danger .liq-bar-fill {
  background: #EF4444;
  animation: liqPulse 1s ease-in-out infinite;
}
.liq-danger .liq-dist { color: #FCA5A5; font-weight: 700; }

@keyframes liqPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

/* Clickable AI Watchlist Chips */
.chip-clickable {
  cursor: pointer;
  transition: border-color 150ms ease, background-color 150ms ease, transform 120ms ease;
}

.chip-clickable:hover {
  border-color: var(--color-primary);
  background: rgba(245, 158, 11, 0.16);
  color: #FEF3C7;
  transform: translateY(-1px);
}

/* Log Filter Pills */
.log-header-right {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-pills {
  display: inline-flex;
  background: var(--color-background);
  border: 1px solid var(--color-border);
  border-radius: 7px;
  padding: 2px;
  gap: 2px;
}

.filter-pill {
  border: none;
  background: transparent;
  color: var(--color-muted-foreground);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 5px;
  cursor: pointer;
  transition: all 140ms ease;
}

.filter-pill:hover {
  color: var(--color-foreground);
}

.filter-pill.active {
  background: rgba(245, 158, 11, 0.22);
  color: #FCD34D;
}

/* Compact Futures Risk & Liquidation Calculator */
.calc-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.calc-grid .field input,
.calc-grid .field select {
  min-height: 38px;
  padding: 6px 10px;
}

.calc-results {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.calc-stat {
  background: var(--color-background);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.calc-stat > span {
  font-size: 11px;
  color: var(--color-muted-foreground);
}

.calc-stat > strong {
  font-size: 14px;
  font-weight: 700;
}

/* Mobile Card Lists for Scanner & Strategies */
.scanner-mobile-list,
.strategies-mobile-list {
  display: none;
}

@media (max-width: 1024px) {
  .calc-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .calc-results {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 768px) {
  .scanner-table-wrap,
  .strategies-table-wrap {
    display: none;
  }
  .scanner-mobile-list,
  .strategies-mobile-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }
  #prochart-symbol {
    font-size: 16px;
  }
  .calc-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
  .calc-results {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }
  .calc-results .calc-stat:last-child {
    grid-column: 1 / -1;
  }
  #btn-pos-emergency {
    min-height: 30px;
    padding: 0 9px;
    font-size: 11px;
  }
}
