:root {
  --bg-dark: #080b11;
  --bg-sidebar: #0b0f18;
  --bg-card: #111622;
  --bg-card-hover: #161c2b;
  --bg-topbar: #0c101a;
  --border-color: #1b2334;
  --border-color-light: #263148;
  
  --text-main: #f1f5f9;
  --text-muted: #8b949e;
  --text-subtle: #64748b;
  
  --color-green: #10b981;
  --color-green-bg: rgba(16, 185, 129, 0.12);
  --color-green-border: rgba(16, 185, 129, 0.3);
  
  --color-red: #ef4444;
  --color-red-bg: rgba(239, 68, 68, 0.12);
  --color-red-border: rgba(239, 68, 68, 0.3);
  
  --color-blue: #3b82f6;
  --color-blue-bg: rgba(59, 130, 246, 0.12);
  
  --color-purple: #a855f7;
  --color-purple-bg: rgba(168, 85, 247, 0.12);
  
  --color-amber: #f59e0b;
  --color-amber-bg: rgba(245, 158, 11, 0.12);

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Layout sizing tokens */
  --sidebar-width: 210px;
  --topbar-height: 38px;
  --footer-height: 26px;
  --layout-gap: 6px;
}

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

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 12.5px;
  line-height: 1.35;
  height: 100vh;
  overflow: hidden;
}

#app-container {
  display: flex;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

/* ================= Sidebar ================= */
#sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  height: 100vh;
  z-index: 20;
  transition: width 0.25s ease, min-width 0.25s ease;
  overflow: hidden;
}

/* Sidebar collapsed state */
#sidebar.collapsed {
  width: 48px;
  min-width: 48px;
}

#sidebar.collapsed .logo-text,
#sidebar.collapsed .nav-item span,
#sidebar.collapsed .sidebar-status-box,
#sidebar.collapsed .sidebar-header span {
  display: none;
}

#sidebar.collapsed .nav-item {
  justify-content: center;
  padding: 8px;
}

#sidebar.collapsed .logo-box {
  justify-content: center;
}

#sidebar.collapsed .sidebar-header {
  padding: 10px 4px;
}

#sidebar.collapsed .sidebar-nav {
  padding: 6px 4px;
}

.sidebar-header {
  padding: 10px 10px;
  border-bottom: 1px solid var(--border-color);
}

.sidebar-toggle-btn {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  width: 24px;
  height: 24px;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  margin-top: 6px;
  transition: all 0.15s ease;
}

.sidebar-toggle-btn:hover {
  background: rgba(255,255,255,0.05);
  color: var(--text-main);
}

.logo-box {
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo-icon {
  width: 18px;
  height: 18px;
  color: #3b82f6;
  filter: drop-shadow(0 0 6px rgba(59, 130, 246, 0.6));
}

.logo-text {
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 0.5px;
  color: #ffffff;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 8px 8px;
  flex: 1;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  font-size: 13.5px;
  font-weight: 500;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  width: 100%;
  text-align: left;
}

.nav-item:hover {
  background-color: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
}

.nav-item.active {
  background-color: rgba(59, 130, 246, 0.14);
  color: #60a5fa;
  border-color: rgba(59, 130, 246, 0.35);
  font-weight: 600;
}

.nav-icon {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
}

/* Sidebar Bottom Status Box */
.sidebar-status-box {
  background-color: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 8px 10px;
  margin: 6px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.sys-status-head {
  display: flex;
  align-items: center;
  gap: 5px;
}

.sys-title {
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--text-subtle);
}

.sys-sub {
  font-size: 9.5px;
  font-weight: 600;
  color: var(--text-main);
}

.sys-time-box {
  margin-top: 2px;
}

.clock-time {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
}

.clock-date {
  font-size: 8.5px;
  color: var(--text-muted);
}

.sys-conn {
  font-size: 9px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 2px;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
}

.status-dot.green { background-color: var(--color-green); }
.status-dot.green-pulse {
  background-color: var(--color-green);
  box-shadow: 0 0 6px var(--color-green);
}

.app-version {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 8.5px;
  color: var(--text-subtle);
}

/* ================= Main Content Wrapper ================= */
#main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  background-color: var(--bg-dark);
}

/* Top Bar */
#top-bar {
  background-color: var(--bg-topbar);
  border-bottom: 1px solid var(--border-color);
  padding: 0 10px;
  height: var(--topbar-height);
  min-height: var(--topbar-height);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.top-bar-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 9.5px;
}

.top-bar-item .lbl {
  color: var(--text-subtle);
  font-weight: 600;
  letter-spacing: 0.5px;
}

.badge {
  padding: 2px 5px;
  border-radius: 4px;
  font-weight: 600;
  font-size: 9.5px;
  font-family: var(--font-mono);
}

.badge-active {
  background-color: rgba(16, 185, 129, 0.15);
  color: var(--color-green);
  border: 1px solid var(--color-green-border);
}

.badge-subtle {
  background-color: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

.pill-metric {
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 9.5px;
  font-weight: 600;
}

.profit-pill, .winrate-pill {
  background-color: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: var(--color-green);
}

.btn-icon {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 9.5px;
  font-weight: 600;
  cursor: pointer;
}

.btn-sound {
  color: var(--color-green);
  border-color: rgba(16, 185, 129, 0.3);
}

.top-search-input {
  background-color: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 9.5px;
  width: 140px;
}

.top-search-input:focus {
  width: 180px;
  border-color: #3b82f6;
  outline: none;
}

.val-update {
  font-family: var(--font-mono);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 9.5px;
}

.spin-icon {
  width: 10px;
  height: 10px;
  color: var(--color-green);
}

.right-align {
  margin-left: auto;
}

.btn-icon-sq {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 2px 5px;
  border-radius: 4px;
  font-size: 10px;
  cursor: pointer;
}

.btn-quick-act {
  background-color: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.35);
  color: #ffffff;
  padding: 3px 8px;
  border-radius: 4px;
  font-weight: 600;
  font-size: 9.5px;
  cursor: pointer;
}

/* ================= Content Body ================= */
#content-body {
  padding: var(--layout-gap) 8px;
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.page {
  display: none;
  height: 100%;
}

.terminal-zero-scroll {
  display: flex;
  flex-direction: column;
  height: 100%;
  gap: var(--layout-gap) !important;
  overflow: hidden;
}

/* ================= Interactive Resizer Splitters ================= */
.gutter {
  background-color: rgba(27, 35, 52, 0.6);
  position: relative;
  z-index: 20;
  transition: background-color 0.15s ease, box-shadow 0.15s ease;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  border-radius: 3px;
}

.gutter:hover, .gutter.dragging {
  background-color: var(--accent-color, #3b82f6) !important;
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.8);
}

.gutter-horizontal {
  cursor: col-resize;
  width: 5px;
  min-width: 5px;
}

.gutter-vertical {
  cursor: row-resize;
  height: 5px;
  min-height: 5px;
}

/* ================= Main Dashboard Grid — Responsive ================= */
.terminal-grid-layout {
  display: grid;
  grid-template-columns: 1fr 5px clamp(280px, 25vw, 400px);
  gap: 0;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.terminal-main-col {
  display: flex;
  flex-direction: column;
  gap: var(--layout-gap);
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* Top row: Chart + Bundle Map (Compact ~38% vertical space) */
.top-split-row {
  display: grid;
  grid-template-columns: 1fr 5px 38%;
  gap: 0;
  flex: 38 1 0%;
  min-height: 100px;
  overflow: hidden;
}

/* Bottom positions container (~62% vertical space for tables) */
.bottom-positions-container {
  display: flex;
  flex-direction: column;
  gap: var(--layout-gap);
  flex: 62 1 0%;
  min-height: 140px;
  overflow: hidden;
}

/* Position cards — Fill 100% available space with drag resizer, scrollable internally */
#open-positions-card, #closed-positions-card {
  flex: 1 1 0%;
  min-height: 40px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: flex 0.2s ease;
}

#open-positions-card .table-responsive, 
#closed-positions-card .table-responsive {
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  height: 100%;
}

.table-responsive::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}

.table-responsive::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.25);
  border-radius: 3px;
}

.table-responsive::-webkit-scrollbar-thumb {
  background: var(--accent-color, #3b82f6);
  border-radius: 3px;
}

.table-responsive::-webkit-scrollbar-thumb:hover {
  background: #60a5fa;
}

#open-positions-card.is-empty,
#closed-positions-card.is-empty {
  flex: 0 0 auto !important;
  height: 40px !important;
  max-height: 40px !important;
  min-height: 40px !important;
}

/* Right sidebar column — Compact Console (35%) & Expansive AI Feed (65%) */
.terminal-sidebar-col {
  display: flex;
  flex-direction: column;
  gap: var(--layout-gap);
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.console-fixed-card {
  flex: 35 1 0%;
  min-height: 90px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.terminal-sidebar-col > .panel-card:last-child {
  flex: 65 1 0%;
  min-height: 140px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ================= Glassmorphism Modal ================= */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease-in-out;
}

.modal-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background: var(--bg-card, #121824);
  border: 1px solid var(--border-color, #1e293b);
  border-radius: 12px;
  width: 90%;
  max-width: 620px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), 0 0 30px rgba(59, 130, 246, 0.15);
  overflow: hidden;
  transform: scale(0.92);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.show .modal-card {
  transform: scale(1);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid var(--border-color, #1e293b);
}

.modal-header h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main, #f8fafc);
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-close {
  background: transparent;
  border: none;
  color: var(--text-subtle, #94a3b8);
  font-size: 18px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: background 0.15s ease, color 0.15s ease;
}

.btn-close:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
}

.modal-body {
  padding: 18px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

/* ================= Settings Page ================= */
#page-settings {
  flex-direction: column;
  height: calc(100vh - 110px);
  overflow: hidden;
  box-sizing: border-box;
  padding: 10px 14px !important;
}

.settings-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-color);
  flex: 0 0 auto;
}

.settings-4col-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

@media (max-width: 1200px) {
  .settings-4col-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.setting-column-card {
  background: var(--bg-card, #121824);
  border: 1px solid var(--border-color, #1e293b);
  border-radius: 6px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow-y: auto;
}

.setting-column-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent-color, #3b82f6);
  margin: 0 0 6px 0;
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.setting-item-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  gap: 6px;
}

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

.setting-item-label {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-main, #e2e8f0);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

.setting-item-key {
  font-size: 9.5px;
  color: var(--text-subtle, #64748b);
  font-family: var(--font-mono);
  display: block;
}

.setting-mini-input {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-color, #334155);
  border-radius: 4px;
  color: #fff;
  font-family: var(--font-mono);
  font-size: 11.5px;
  padding: 3px 6px;
  width: 75px;
  text-align: right;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.setting-mini-input:focus {
  border-color: var(--accent-color, #3b82f6);
  background: rgba(59, 130, 246, 0.15);
  outline: none;
}

.setting-mini-select {
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid var(--border-color, #334155);
  border-radius: 4px;
  color: #38bdf8;
  font-family: var(--font-mono);
  font-size: 11.5px;
  padding: 3px 6px;
  min-width: 85px;
  max-width: 150px;
  text-align: right;
  cursor: pointer;
  outline: none;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.setting-mini-select:focus {
  border-color: var(--accent-color, #3b82f6);
  background: rgba(59, 130, 246, 0.15);
}

.setting-mini-select option {
  background: #0f172a;
  color: #f8fafc;
}

/* ================= Panel Cards ================= */
.panel-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 6px 8px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
  flex-shrink: 0;
}

.panel-title {
  display: flex;
  align-items: center;
  gap: 6px;
}

.panel-title h2 {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: 0.3px;
}

.star-icon {
  font-size: 11px;
}

.chain-badge {
  font-size: 10px;
  color: var(--text-subtle);
  background: rgba(255, 255, 255, 0.04);
  padding: 1px 4px;
  border-radius: 3px;
}

.ext-link {
  color: #60a5fa;
  font-size: 10px;
  text-decoration: none;
}

.price-action-box {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
}

.chart-price {
  font-weight: 700;
  font-size: 13px;
}

.chart-change {
  font-size: 11px;
  font-weight: 600;
  padding: 1px 4px;
  border-radius: 3px;
}

.chart-change.neg {
  color: var(--color-red);
  background-color: var(--color-red-bg);
}

.chart-change.pos {
  color: var(--color-green);
  background-color: var(--color-green-bg);
}

/* Chart & Bubble Map cards — fill parent height */
.featured-chart-card, .bubble-map-card {
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.featured-chart-body {
  flex: 1;
  width: 100%;
  min-height: 0;
  border-radius: 4px;
  overflow: hidden;
  background-color: rgba(0, 0, 0, 0.3);
}

.featured-chart-body iframe {
  width: 100%;
  height: 100%;
  border: none;
}

.chart-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-subtle);
  font-size: 10px;
}

.live-tag {
  color: #60a5fa;
  font-size: 9px;
}

.tab-pill-group {
  display: flex;
  gap: 2px;
  background-color: rgba(0, 0, 0, 0.3);
  padding: 2px;
  border-radius: 4px;
}

.tab-pill {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 2px 6px;
  font-size: 8.5px;
  font-weight: 600;
  border-radius: 3px;
  cursor: pointer;
}

.tab-pill.active {
  background-color: var(--bg-card);
  color: var(--text-main);
}

/* Bubble Map — fills its container */
.bubble-map-box {
  flex: 1;
  width: 100%;
  min-height: 0;
  background-color: rgba(5, 7, 10, 0.6);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  position: relative;
  overflow: hidden;
}

.bubble-map-box svg,
.bubble-map-box canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
}

.cluster-footer {
  margin-top: 4px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex-shrink: 0;
}

.cluster-legend {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 8.5px;
  color: var(--text-subtle);
}

.cluster-legend span {
  display: flex;
  align-items: center;
  gap: 3px;
}

.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
}

.dot.green { background-color: var(--color-green); }
.dot.amber { background-color: var(--color-amber); }
.dot.blue { background-color: var(--color-blue); }
.dot.purple { background-color: var(--color-purple); }

.cluster-breakdown-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cluster-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 8.5px;
  color: var(--text-muted);
  background-color: rgba(0, 0, 0, 0.2);
  padding: 2px 6px;
  border-radius: 3px;
}

.cluster-item .val {
  font-family: var(--font-mono);
}

.badge-high { background-color: var(--color-green-bg); color: var(--color-green); }
.badge-med { background-color: var(--color-amber-bg); color: var(--color-amber); }
.badge-low { background-color: var(--color-blue-bg); color: var(--color-blue); }

.card-tools {
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn-tool-sm {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 8.5px;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 3px;
  cursor: pointer;
}

.btn-tool-icon {
  background: transparent;
  border: none;
  color: var(--text-subtle);
  font-size: 9px;
  cursor: pointer;
}

.cnt-badge {
  color: var(--text-subtle);
  font-size: 10px;
  font-weight: 500;
}

/* ================= Console Card — Compact & Scrollable ================= */
.console-fixed-card {
  min-height: 90px;
  flex: 0 0 180px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.red-live-dot {
  color: var(--color-red);
  font-size: 8px;
}

.terminal-log-stream {
  background-color: #05070a;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 5px;
  flex: 1;
  min-height: 0;
  height: 100%;
  overflow-y: auto;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: #34d399;
  white-space: pre-wrap;
  line-height: 1.35;
}

.terminal-log-stream::-webkit-scrollbar {
  width: 5px;
}

.terminal-log-stream::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.4);
  border-radius: 3px;
}

.terminal-log-stream::-webkit-scrollbar-thumb {
  background: rgba(16, 185, 129, 0.5);
  border-radius: 3px;
}

.terminal-log-stream::-webkit-scrollbar-thumb:hover {
  background: #34d399;
}

.terminal-cmd-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  background-color: #05070a;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 2px 6px;
  margin-top: 4px;
  flex-shrink: 0;
}

.cmd-prompt {
  color: var(--text-subtle);
  font-family: var(--font-mono);
  font-size: 11px;
}

#terminal-cmd-input {
  flex: 1;
  background: transparent;
  border: none;
  color: #34d399;
  font-family: var(--font-mono);
  font-size: 11.5px;
  outline: none;
}

.cmd-send-btn {
  background: transparent;
  border: none;
  color: var(--text-subtle);
  cursor: pointer;
  font-size: 10px;
}

/* ================= AI Decisions Feed — FLEX GROW ================= */
.select-mini {
  background-color: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 8.5px;
  padding: 1px 4px;
  border-radius: 3px;
  outline: none;
}

.decisions-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-right: 2px;
}

.decision-card {
  background-color: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 5px 6px;
  cursor: pointer;
  flex-shrink: 0;
}

.decision-card:hover {
  border-color: #3b82f6;
  background-color: rgba(59, 130, 246, 0.05);
}

.decision-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2px;
}

.decision-action-group {
  display: flex;
  align-items: center;
  gap: 4px;
}

.decision-time {
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--text-subtle);
}

.decision-symbol {
  font-weight: 700;
  font-size: 11.5px;
}

.status-badge {
  font-size: 9px;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 3px;
}

.status-executed { background-color: var(--color-green-bg); color: var(--color-green); }
.status-monitoring { background-color: var(--color-blue-bg); color: var(--color-blue); }
.status-skipped { background-color: rgba(255, 255, 255, 0.05); color: var(--text-subtle); }

.decision-bundle-info {
  font-size: 10px;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.decision-reason {
  font-size: 10px;
  color: var(--text-subtle);
  margin-bottom: 2px;
  line-height: 1.3;
}

.decision-outcome {
  font-size: 10px;
  color: #60a5fa;
  font-family: var(--font-mono);
}

.btn-full-log {
  width: 100%;
  padding: 4px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 10.5px;
  font-weight: 600;
  border-radius: 4px;
  cursor: pointer;
  margin-top: 4px;
  flex-shrink: 0;
}

.btn-full-log:hover {
  background-color: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
}

/* ================= Tables ================= */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 11.5px;
}

th {
  color: var(--text-subtle);
  font-weight: 600;
  font-size: 10px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  padding: 4px 6px;
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  background-color: var(--bg-card);
  z-index: 5;
}

td {
  padding: 5px 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  color: var(--text-main);
}

tr:hover td {
  background-color: rgba(255, 255, 255, 0.02);
}

.token-cell {
  display: flex;
  align-items: center;
  gap: 6px;
}

.token-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background-color: var(--color-blue-bg);
  color: var(--color-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 10.5px;
  flex-shrink: 0;
}

.token-name-box {
  display: flex;
  flex-direction: column;
}

.token-sym {
  font-weight: 700;
  font-size: 11.5px;
}

.token-sub {
  font-size: 9.5px;
  color: var(--text-subtle);
}

.pnl-pos { color: var(--color-green); font-weight: 700; }
.pnl-neg { color: var(--color-red); font-weight: 700; }

.badge-type-buy {
  background-color: var(--color-green-bg);
  color: var(--color-green);
  padding: 1px 4px;
  border-radius: 3px;
  font-weight: 700;
  font-size: 9.5px;
}

/* Progress bar inside table */
.progress-cell {
  display: flex;
  align-items: center;
  gap: 6px;
}

.progress-bar-track {
  width: 60px;
  height: 5px;
  background-color: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #10b981, #34d399);
  border-radius: 3px;
}

.progress-txt {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
}

.actions-cell {
  display: flex;
  align-items: center;
  gap: 3px;
}

.btn-row-action {
  width: 18px;
  height: 18px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 9px;
}

.btn-row-action:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
}

.btn-row-action.danger {
  color: var(--color-red);
  background: var(--color-red-bg);
  border-color: rgba(239, 68, 68, 0.3);
}

.reason-tp { color: var(--color-green); font-weight: 600; }
.reason-sl { color: var(--color-red); font-weight: 600; }

/* ================= Bottom Footer Status Bar ================= */
#bottom-footer {
  height: var(--footer-height);
  min-height: var(--footer-height);
  background-color: #070a10;
  border-top: 1px solid var(--border-color);
  padding: 0 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 9.5px;
  flex-shrink: 0;
  z-index: 10;
}

.footer-left, .footer-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ft-item {
  color: var(--text-subtle);
  display: flex;
  align-items: center;
  gap: 4px;
}

.ft-item b {
  color: var(--text-muted);
  font-size: 8.5px;
  letter-spacing: 0.5px;
}

.txt-green {
  color: var(--color-green);
  font-weight: 700;
  font-family: var(--font-mono);
}

.ft-badge {
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 8.5px;
  font-weight: 600;
}

.green-badge {
  background-color: var(--color-green-bg);
  color: var(--color-green);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

/* ================= Utility Classes ================= */
.flex-1 { flex: 1; min-height: 0; }
.flex-col { display: flex; flex-direction: column; }
.min-h-0 { min-height: 0; }
.overflow-hidden { overflow: hidden; }
.overflow-y-auto { overflow-y: auto; }

/* ================= Toast ================= */
.toast {
  position: fixed;
  bottom: 32px;
  right: 16px;
  background-color: #1e293b;
  color: white;
  padding: 5px 10px;
  border-radius: 4px;
  border: 1px solid var(--border-color);
  display: none;
  z-index: 2000;
  font-size: 9.5px;
}

.toast.show { display: block; }
.toast.ok { border-color: var(--color-green); }
.toast.err { border-color: var(--color-red); }

/* ================= Custom Scrollbars (global) ================= */
::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}

::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb {
  background: rgba(59, 130, 246, 0.4);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(59, 130, 246, 0.7);
}

/* ================= RESPONSIVE BREAKPOINTS ================= */

/* 720p / Small laptops: ≤ 1366px — sidebar collapses, compact 2-column grid */
@media (max-width: 1366px) {
  :root {
    --sidebar-width: 48px;
    --layout-gap: 3px;
  }

  #sidebar {
    width: 48px;
    min-width: 48px;
  }

  #sidebar .logo-text,
  #sidebar .nav-item span,
  #sidebar .sidebar-status-box {
    display: none;
  }

  #sidebar .nav-item {
    justify-content: center;
    padding: 8px;
  }

  #sidebar .logo-box {
    justify-content: center;
  }

  #sidebar .sidebar-header {
    padding: 10px 4px;
  }

  #sidebar .sidebar-nav {
    padding: 6px 4px;
  }

  .sidebar-toggle-btn {
    display: none;
  }

  /* Keep 2-column grid — narrower sidebar column */
  .terminal-grid-layout {
    grid-template-columns: 1fr 5px clamp(220px, 22vw, 300px);
  }

  .top-split-row {
    flex: 50 1 0%;
    min-height: 100px;
  }

  .bottom-positions-container {
    flex: 50 1 0%;
    min-height: 100px;
  }

  .console-fixed-card {
    flex: 50 1 0%;
    min-height: 100px;
  }

  .terminal-sidebar-col > .panel-card:last-child {
    flex: 50 1 0%;
    min-height: 100px;
  }

  .top-search-input {
    width: 100px;
  }

  .top-search-input:focus {
    width: 130px;
  }

  .panel-card {
    padding: 4px 6px;
  }

  .panel-header {
    margin-bottom: 2px;
  }
}

/* 1080p: 1367px – 1920px — Standard 2-column */
@media (min-width: 1367px) and (max-width: 1920px) {
  .terminal-grid-layout {
    grid-template-columns: 1fr 5px clamp(280px, 24vw, 360px);
  }

  .top-split-row {
    flex: 38 1 0%;
    min-height: 100px;
  }

  .bottom-positions-container {
    flex: 62 1 0%;
    min-height: 140px;
  }

  .console-fixed-card {
    flex: 0 0 180px;
  }

  .terminal-sidebar-col > .panel-card:last-child {
    flex: 1 1 0%;
    min-height: 0;
  }
}

/* 1440p / 2K: 1921px – 2560px — Wider sidebar column */
@media (min-width: 1921px) and (max-width: 2560px) {
  :root {
    --layout-gap: 8px;
  }

  .terminal-grid-layout {
    grid-template-columns: 1fr 5px clamp(340px, 26vw, 420px);
  }

  .top-split-row {
    flex: 38 1 0%;
    min-height: 120px;
  }

  .bottom-positions-container {
    flex: 62 1 0%;
    min-height: 160px;
  }

  .console-fixed-card {
    flex: 0 0 200px;
  }

  .terminal-sidebar-col > .panel-card:last-child {
    flex: 1 1 0%;
    min-height: 0;
  }
}

/* 4K: ≥ 2561px — Maximum space utilization */
@media (min-width: 2561px) {
  :root {
    --layout-gap: 10px;
  }

  .terminal-grid-layout {
    grid-template-columns: 1fr 5px clamp(380px, 22vw, 520px);
  }

  .top-split-row {
    flex: 38 1 0%;
    min-height: 140px;
  }

  .bottom-positions-container {
    flex: 62 1 0%;
    min-height: 180px;
  }

  .console-fixed-card {
    flex: 0 0 220px;
  }

  .terminal-sidebar-col > .panel-card:last-child {
    flex: 1 1 0%;
    min-height: 0;
  }

  .panel-card {
    padding: 8px 12px;
  }
}
