/* ============================================================================
   OKX BTC/USDT Spot Bot — Modern Fintech Sidebar & Mobile-First UI
   ============================================================================ */
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600;700&family=Noto+Sans+Thai:wght@300;400;500;600;700&family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
  --bg-main: #060911;
  --bg-body: #060911;
  --bg-sidebar: #0b101e;
  --bg-surface: #0f1629;
  --bg-surface-hover: #151f38;
  --bg-elevated: #16203a;
  --bg-glass: rgba(15, 22, 41, 0.78);

  --border-subtle: rgba(148, 163, 184, 0.12);
  --border-strong: rgba(148, 163, 184, 0.24);

  --text-main: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --emerald: #10b981;
  --emerald-soft: rgba(16, 185, 129, 0.14);
  --emerald-glow: rgba(16, 185, 129, 0.35);

  --sky: #38bdf8;
  --sky-soft: rgba(56, 189, 248, 0.14);
  --sky-glow: rgba(56, 189, 248, 0.35);

  --amber: #f59e0b;
  --amber-soft: rgba(245, 158, 11, 0.14);
  --amber-glow: rgba(245, 158, 11, 0.35);

  --rose: #f43f5e;
  --rose-soft: rgba(244, 63, 94, 0.14);
  --rose-glow: rgba(244, 63, 94, 0.35);

  --violet: #8b5cf6;
  --violet-soft: rgba(139, 92, 246, 0.16);

  --sidebar-width: 268px;
  --topbar-height: 68px;
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
}

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

html, body {
  background-color: var(--bg-body);
  color: var(--text-main);
  font-family: 'Plus Jakarta Sans', 'Noto Sans Thai', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
  line-height: 1.55;
  min-height: 100vh;
  overflow-x: hidden;
  max-width: 100vw;
  -webkit-font-smoothing: antialiased;
}

.mono {
  font-family: 'JetBrains Mono', monospace;
}

/* ============================================================================
   App Shell (Sidebar + Main Content)
   ============================================================================ */
.app-shell {
  display: flex;
  min-height: 100vh;
  max-width: 100vw;
  overflow-x: hidden;
}

/* Sidebar Overlay on Mobile */
.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.72);
  backdrop-filter: blur(4px);
  z-index: 990;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.sidebar-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 1000;
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-brand {
  height: var(--topbar-height);
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, #38bdf8 0%, #6366f1 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  box-shadow: 0 4px 14px rgba(56, 189, 248, 0.3);
}

.brand-text h1 {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-main);
}

.brand-text span {
  font-size: 11px;
  color: var(--sky);
  font-weight: 600;
  display: block;
}

.sidebar-close-btn {
  display: none;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 22px;
  cursor: pointer;
  padding: 4px;
}

/* Sidebar Status Widget */
.sidebar-status-box {
  margin: 16px;
  padding: 14px;
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, rgba(30, 41, 59, 0.55) 0%, rgba(15, 23, 42, 0.8) 100%);
  border: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.status-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
}

.live-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  font-size: 11.5px;
  color: var(--emerald);
}

.ws-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--emerald);
  box-shadow: 0 0 10px var(--emerald);
  animation: pulseDot 2s infinite;
}

.ws-dot.offline {
  background: var(--rose);
  box-shadow: 0 0 10px var(--rose);
  animation: none;
}

@keyframes pulseDot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.25); opacity: 0.7; }
}

/* Sidebar Navigation */
.sidebar-nav {
  flex: 1;
  padding: 6px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
}

.nav-section-title {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 10px 12px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 14px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 13.5px;
  cursor: pointer;
  border: 1px solid transparent;
  background: transparent;
  width: 100%;
  text-align: left;
  transition: all 0.18s ease;
}

.nav-item-left {
  display: flex;
  align-items: center;
  gap: 11px;
}

.nav-icon {
  font-size: 17px;
  width: 22px;
  text-align: center;
}

.nav-item:hover {
  background: rgba(148, 163, 184, 0.08);
  color: var(--text-main);
}

.nav-item.active {
  background: linear-gradient(90deg, rgba(56, 189, 248, 0.16) 0%, rgba(56, 189, 248, 0.04) 100%);
  color: var(--sky);
  border-color: rgba(56, 189, 248, 0.28);
}

.nav-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.15);
  color: var(--text-main);
  font-family: 'JetBrains Mono', monospace;
}

.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid var(--border-subtle);
  font-size: 11.5px;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* ============================================================================
   Main Area & Sticky Header
   ============================================================================ */
.main-wrapper {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-width: 0;
  max-width: calc(100vw - var(--sidebar-width));
  overflow-x: hidden;
  box-sizing: border-box;
}

.top-header {
  height: 60px;
  background: var(--bg-glass);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-subtle);
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 900;
}

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

.menu-toggle-btn {
  display: none;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  color: var(--text-main);
  width: 36px;
  height: 36px;
  border-radius: 10px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 18px;
}

.page-title-wrap {
  min-width: 0;
}

.page-title-wrap h2 {
  font-size: 16px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.page-title-wrap p {
  font-size: 11.5px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  flex-shrink: 0;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.01em;
  border: 1px solid transparent;
  white-space: nowrap;
}

.badge-spot {
  background: var(--sky-soft);
  color: var(--sky);
  border-color: rgba(56, 189, 248, 0.3);
}

.badge-mode-paper {
  background: var(--violet-soft);
  color: #c4b5fd;
  border-color: rgba(139, 92, 246, 0.35);
}

.badge-mode-demo {
  background: var(--amber-soft);
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.4);
}

.badge-mode-live {
  background: var(--emerald-soft);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.4);
}

.badge-state {
  background: var(--bg-elevated);
  color: #e2e8f0;
  border-color: var(--border-strong);
}

/* Buttons */
.btn {
  cursor: pointer;
  border: 1px solid var(--border-strong);
  background: var(--bg-elevated);
  color: var(--text-main);
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 12.5px;
  font-weight: 600;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.16s ease;
  white-space: nowrap;
}

.btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.12);
}

.btn:active {
  transform: translateY(0);
}

.btn-green {
  background: var(--emerald-soft);
  color: #34d399;
  border-color: var(--emerald-glow);
}

.btn-yellow {
  background: var(--amber-soft);
  color: #fbbf24;
  border-color: var(--amber-glow);
}

.btn-blue {
  background: var(--sky-soft);
  color: var(--sky);
  border-color: var(--sky-glow);
}

.btn-red {
  background: var(--rose-soft);
  color: #fb7185;
  border-color: var(--rose-glow);
}

/* ============================================================================
   Live / Down & Active / Paused System Health Bar
   ============================================================================ */
.health-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  background: linear-gradient(90deg, rgba(16, 185, 129, 0.10) 0%, rgba(15, 22, 41, 0.95) 50%, rgba(56, 189, 248, 0.08) 100%);
  border: 1px solid rgba(16, 185, 129, 0.3);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.22);
  transition: all 0.25s ease;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

@media (max-width: 1280px) {
  .health-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

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

.health-strip.is-paused {
  background: linear-gradient(90deg, rgba(245, 158, 11, 0.16) 0%, rgba(15, 22, 41, 0.92) 100%);
  border-color: rgba(245, 158, 11, 0.45);
}

.health-strip.is-down {
  background: linear-gradient(90deg, rgba(244, 63, 94, 0.22) 0%, rgba(15, 22, 41, 0.95) 100%);
  border-color: rgba(244, 63, 94, 0.6);
  animation: alertPulse 1.6s infinite;
}

@keyframes alertPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(244, 63, 94, 0.35); }
  50% { box-shadow: 0 0 22px 4px rgba(244, 63, 94, 0.28); }
}

.health-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.health-dot-wrap {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  background: rgba(16, 185, 129, 0.16);
  border: 1px solid rgba(16, 185, 129, 0.35);
  flex-shrink: 0;
}

.health-dot-wrap.warn {
  background: rgba(245, 158, 11, 0.16);
  border-color: rgba(245, 158, 11, 0.4);
}

.health-dot-wrap.danger {
  background: rgba(244, 63, 94, 0.2);
  border-color: rgba(244, 63, 94, 0.5);
}

.health-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

.health-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.04em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.health-value {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.health-sub {
  font-size: 10.5px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pill-live {
  background: rgba(16, 185, 129, 0.18);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.45);
}

.pill-paused {
  background: rgba(245, 158, 11, 0.18);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.45);
}

.pill-down {
  background: rgba(244, 63, 94, 0.22);
  color: #fb7185;
  border: 1px solid rgba(244, 63, 94, 0.55);
}

/* ============================================================================
   Content Sections & Tab Views
   ============================================================================ */
.content-area {
  padding: 18px 22px;
  max-width: 1480px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
  box-sizing: border-box;
  overflow-x: hidden;
}

.tab-section {
  display: none;
  flex-direction: column;
  gap: 16px;
  animation: fadeIn 0.2s ease;
}

.tab-section.active {
  display: flex;
}

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

/* Hero Banner */
.hero-banner {
  background: radial-gradient(circle at top right, rgba(56, 189, 248, 0.14), transparent 55%),
              linear-gradient(135deg, #0f172a 0%, #0b1120 100%);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.hero-price-block {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.hero-pair-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 600;
}

.hero-price-value {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-main);
  line-height: 1.15;
}

.hero-sub-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 2px;
  font-size: 12px;
  color: var(--text-secondary);
}

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

/* State Pipeline Stepper */
.pipeline-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px 20px;
}

.pipeline-steps {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin-top: 14px;
}

.step-box {
  background: var(--bg-body);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: relative;
  transition: all 0.2s ease;
}

.step-box.active-step {
  background: rgba(56, 189, 248, 0.12);
  border-color: var(--sky);
  box-shadow: 0 0 18px rgba(56, 189, 248, 0.16);
}

.step-box.done-step {
  border-color: rgba(16, 185, 129, 0.35);
  background: rgba(16, 185, 129, 0.06);
}

.step-num {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
}

.step-box.active-step .step-num {
  color: var(--sky);
}

.step-box.done-step .step-num {
  color: var(--emerald);
}

.step-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
}

.step-desc {
  font-size: 11.5px;
  color: var(--text-secondary);
}

/* KPI 4-Card Grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  width: 100%;
  box-sizing: border-box;
}

@media (max-width: 1380px) {
  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .kpi-grid {
    grid-template-columns: 1fr;
  }
}

.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.2);
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}

.kpi-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  min-height: 114px;
  min-width: 0;
  overflow: hidden;
  box-sizing: border-box;
}

.kpi-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 600;
}

.kpi-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  background: var(--bg-elevated);
}

.kpi-value {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.kpi-footer {
  display: flex;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--text-secondary);
  padding-top: 6px;
  border-top: 1px solid var(--border-subtle);
}

/* Rules 2x2 Grid */
.rules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 18px;
}

.rule-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: relative;
  overflow: hidden;
}

.rule-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
}

.rule-card.rule-1::before { background: linear-gradient(90deg, #10b981, #34d399); }
.rule-card.rule-2::before { background: linear-gradient(90deg, #38bdf8, #818cf8); }
.rule-card.rule-3::before { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.rule-card.rule-4::before { background: linear-gradient(90deg, #06b6d4, #3b82f6); }
.rule-card.rule-5::before { background: linear-gradient(90deg, #8b5cf6, #a855f7); }
.rule-card.rule-6::before { background: linear-gradient(90deg, #f43f5e, #fb7185); }

.rule-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.rule-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
}

.rule-subtitle {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

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

.metric-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  background: rgba(6, 9, 17, 0.55);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  font-size: 13px;
}

.metric-key {
  color: var(--text-secondary);
}

.metric-val {
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  text-align: right;
}

.progress-wrap {
  width: 100%;
  background: var(--bg-body);
  height: 9px;
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--emerald), #34d399);
  transition: width 0.35s ease;
}

/* Two-Column Layouts (Symmetrical 50/50 Balance) */
.two-col-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
  width: 100%;
  box-sizing: border-box;
}
}

/* Price Ladder */
.ladder-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.ladder-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 10px;
  border-left: 4px solid #475569;
  background: rgba(6, 9, 17, 0.6);
  border-top: 1px solid var(--border-subtle);
  border-right: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
  font-size: 13px;
}

.ladder-item.active-price {
  background: rgba(56, 189, 248, 0.14);
  border-color: rgba(56, 189, 248, 0.4);
  border-left: 4px solid var(--sky);
  font-weight: 700;
}

/* Tables & Logs */
.table-wrap {
  overflow-x: auto;
  margin-top: 12px;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
}

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

th, td {
  padding: 11px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

th {
  background: rgba(6, 9, 17, 0.85);
  color: var(--text-secondary);
  font-weight: 700;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

tr:hover td {
  background: rgba(148, 163, 184, 0.04);
}

.log-feed {
  max-height: 460px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.log-item {
  padding: 10px 14px;
  background: rgba(6, 9, 17, 0.6);
  border: 1px solid var(--border-subtle);
  border-left: 4px solid #475569;
  border-radius: 10px;
  font-size: 12.5px;
}

.log-item.INFO { border-left-color: var(--sky); }
.log-item.WARNING { border-left-color: var(--amber); }
.log-item.ERROR { border-left-color: var(--rose); }

.log-meta {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-secondary);
  margin-bottom: 4px;
  font-family: 'JetBrains Mono', monospace;
}

/* Simulator Controls */
.sim-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

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

.input-group label {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 600;
}

.input-group input {
  background: var(--bg-body);
  border: 1px solid var(--border-strong);
  color: var(--text-main);
  padding: 9px 12px;
  border-radius: 10px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13.5px;
}

.preset-buttons {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
  margin-top: 14px;
}

/* Mobile Bottom Nav */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(11, 16, 30, 0.95);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--border-strong);
  z-index: 950;
  padding: 6px 8px;
  justify-content: space-around;
}

.mob-nav-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-size: 10.5px;
  font-weight: 600;
  font-family: inherit;
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
}

.mob-nav-btn.active {
  color: var(--sky);
  background: rgba(56, 189, 248, 0.12);
}

.mob-nav-btn span.icon {
  font-size: 17px;
}

/* ============================================================================
   Color Utilities & Responsive Breakpoints
   ============================================================================ */
.text-green { color: var(--emerald); }
.text-red { color: var(--rose); }
.text-yellow { color: var(--amber); }
.text-blue { color: var(--sky); }
.text-cyan { color: #06b6d4; }
.text-purple { color: var(--violet); }
.text-muted { color: var(--text-muted); }
.recovery-box.cascade-highlight { border-color: rgba(6, 182, 212, 0.4); background: rgba(6, 182, 212, 0.06); }
.recovery-box.buyback-highlight { border-color: rgba(139, 92, 246, 0.4); background: rgba(139, 92, 246, 0.06); }

@media (max-width: 1420px) {
  .two-col-grid {
    grid-template-columns: 1fr;
  }
  .pipeline-steps {
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  }
}

@media (max-width: 860px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .sidebar-close-btn {
    display: block;
  }
  .main-wrapper {
    margin-left: 0;
    max-width: 100vw;
    padding-bottom: 70px;
  }
  .menu-toggle-btn {
    display: inline-flex;
  }
  .mobile-bottom-nav {
    display: flex;
  }
  .top-header {
    padding: 0 14px;
  }
  .content-area {
    padding: 14px;
    gap: 16px;
  }
  .hero-banner {
    padding: 16px;
  }
  .hero-price-value {
    font-size: 26px;
  }
  .rules-grid {
    grid-template-columns: 1fr;
  }
  .metric-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
  .metric-val {
    text-align: left;
  }
}

/* ============================================================================
   Bot V2: 6-State Interactive Diagram & Grid / Recovery Cards
   ============================================================================ */

/* Top Pill Tab Bar (Matching Images 3–7) */
.state-pill-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0 20px 0;
}

.state-pill {
  cursor: pointer;
  background: var(--bg-body);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  transition: all 0.2s ease;
}

.state-pill:hover {
  color: var(--text-main);
  border-color: var(--border-strong);
  background: var(--bg-surface-hover);
}

.state-pill.active {
  background: #1e3a8a;
  color: #93c5fd;
  border-color: #3b82f6;
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.35);
}

/* Interactive Diagram Canvas */
.fsm-diagram-container {
  background: #090d16;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.fsm-grid {
  display: grid;
  grid-template-columns: 1fr 75px 1fr;
  align-items: center;
  gap: 10px 14px;
}

.fsm-node {
  cursor: pointer;
  background: #0d1322;
  border: 1.5px solid rgba(148, 163, 184, 0.2);
  border-radius: 14px;
  padding: 12px 16px;
  min-height: 84px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 3px;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.fsm-node:hover {
  transform: translateY(-2px);
  border-color: rgba(148, 163, 184, 0.4);
  background: #121a2f;
}

/* Active State Highlighting (Exact Match to Images 3–7) */
.fsm-node.active {
  background: radial-gradient(circle at center, rgba(37, 99, 235, 0.25) 0%, #0d1527 100%);
  border: 2px solid #3b82f6;
  box-shadow: 0 0 20px rgba(59, 130, 246, 0.45);
}

.fsm-node.active .node-title {
  color: #60a5fa;
  text-shadow: 0 0 10px rgba(96, 165, 250, 0.6);
}

.node-title {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.03em;
  color: var(--text-main);
  line-height: 1.2;
}

.node-sub {
  font-size: 11.5px;
  font-weight: 600;
  color: #cbd5e1;
  line-height: 1.2;
}

.node-desc {
  font-size: 10.5px;
  color: var(--text-muted);
  line-height: 1.2;
}

.node-tag {
  font-size: 10.5px;
  padding: 2px 10px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.12);
  color: #94a3b8;
  margin-top: 4px;
  white-space: nowrap;
}

.fsm-node.active .node-tag {
  background: rgba(59, 130, 246, 0.25);
  color: #93c5fd;
  border: 1px solid rgba(59, 130, 246, 0.4);
}

/* Connectors */
.fsm-connector-h,
.fsm-connector-h-reverse {
  display: flex;
  align-items: center;
  justify-content: center;
}

.connector-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  background: rgba(15, 23, 42, 0.8);
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px dashed rgba(148, 163, 184, 0.25);
  white-space: nowrap;
}

.fsm-connector-v-left,
.fsm-connector-v-center,
.fsm-connector-v-right {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px 0;
}

.connector-label-v {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-muted);
  background: rgba(15, 23, 42, 0.6);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px dashed rgba(148, 163, 184, 0.2);
}

.fsm-reset-loop {
  margin-top: 10px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  background: rgba(16, 185, 129, 0.08);
  border: 1px dashed rgba(16, 185, 129, 0.35);
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: #34d399;
}

/* Tranche Cards & Grid Ladder (Bot V3: 2-Column Side-by-Side 10 Tranches) */
.tranche-ladder-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
  padding-right: 2px;
}

.tranche-columns-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
  width: 100%;
  box-sizing: border-box;
}

.tranche-group-column {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  box-sizing: border-box;
}

@media (max-width: 900px) {
  .tranche-columns-grid {
    grid-template-columns: 1fr;
  }
}

.tranche-ladder-list::-webkit-scrollbar {
  width: 6px;
}

.tranche-ladder-list::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.6);
  border-radius: 4px;
}

.tranche-ladder-list::-webkit-scrollbar-thumb {
  background: rgba(56, 189, 248, 0.35);
  border-radius: 4px;
}

.tranche-ladder-list::-webkit-scrollbar-thumb:hover {
  background: rgba(56, 189, 248, 0.7);
}

.tranche-card {
  background: var(--bg-body);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  transition: all 0.2s ease;
}

.tranche-card .tranche-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.tranche-card .tranche-card-body {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.tranche-card .tranche-metric {
  display: flex;
  justify-content: space-between;
  font-size: 0.76rem;
  line-height: 1.25;
}

.tranche-card.held {
  border-color: rgba(56, 189, 248, 0.45);
  background: rgba(56, 189, 248, 0.06);
}

.tranche-card.doi {
  border-color: rgba(244, 63, 94, 0.45);
  background: rgba(244, 63, 94, 0.08);
}

.tranche-card.cut {
  border-color: rgba(244, 63, 94, 0.45);
  background: rgba(244, 63, 94, 0.06);
}

.tranche-group-divider {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 700;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  margin-top: 4px;
  margin-bottom: 4px;
}

.tranche-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.tranche-badge {
  font-size: 11.5px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 6px;
  text-transform: uppercase;
}

.tranche-badge.t1 { background: rgba(56, 189, 248, 0.16); color: #38bdf8; }
.tranche-badge.t2 { background: rgba(245, 158, 11, 0.16); color: #fbbf24; }
.tranche-badge.t3 { background: rgba(244, 63, 94, 0.16); color: #fb7185; }
.tranche-badge.doi-badge { background: rgba(244, 63, 94, 0.2); color: #fb7185; }

.tranche-card-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tranche-metric {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
}

.tranche-metric .lbl {
  color: var(--text-secondary);
}

.tranche-metric .val {
  font-weight: 600;
  color: var(--text-main);
}

.weighted-entry-box {
  margin-top: 14px;
  padding: 12px 14px;
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.weighted-col {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
}

.weighted-col .lbl { color: var(--text-secondary); }
.weighted-col .val { font-weight: 700; color: var(--text-main); }

/* Recovery Mode Card */
.recovery-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
  width: 100%;
  box-sizing: border-box;
}

@media (max-width: 680px) {
  .recovery-summary-grid {
    grid-template-columns: 1fr;
  }
}

.recovery-box {
  background: var(--bg-body);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  overflow: hidden;
  word-break: break-word;
  box-sizing: border-box;
}

.recovery-box.highlight {
  border-color: rgba(16, 185, 129, 0.4);
  background: rgba(16, 185, 129, 0.06);
}

.recovery-box .lbl {
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 600;
  white-space: normal;
  word-break: break-word;
}

.recovery-box .val {
  font-size: 14px;
  font-weight: 800;
  color: var(--text-main);
  white-space: normal;
  word-break: break-word;
}

.recovery-box .sub {
  font-size: 11px;
  white-space: normal;
  word-break: break-word;
}

.breakeven-progress-wrap {
  margin-top: 14px;
  background: var(--bg-body);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-sizing: border-box;
}

.progress-labels {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-secondary);
  word-break: break-word;
}

.progress-track {
  width: 100%;
  height: 8px;
  background: rgba(148, 163, 184, 0.15);
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #10b981, #34d399);
  border-radius: 999px;
  transition: width 0.3s ease;
}

.progress-footer-note {
  font-size: 11px;
  color: var(--text-muted);
}

/* Responsive Table Container & Scrollbars */
.table-responsive {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  box-sizing: border-box;
}

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

.table-responsive::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.6);
  border-radius: 4px;
}

.table-responsive::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.3);
  border-radius: 4px;
}

/* ============================================================================
   Bot V3.7: 3-Zone Interactive Overview & 4-Idea Trade History Styles
   ============================================================================ */
.zone-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 10px;
  background: linear-gradient(90deg, rgba(30, 58, 138, 0.45) 0%, rgba(15, 23, 42, 0.85) 100%);
  border: 1px solid rgba(56, 189, 248, 0.3);
  margin-bottom: 10px;
}

.zone-banner-title {
  font-size: 14px;
  font-weight: 800;
  color: #f8fafc;
  display: flex;
  align-items: center;
  gap: 8px;
}

.zone-banner-sub {
  font-size: 11.5px;
  color: #94a3b8;
}

.coin-radar-card {
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  border-width: 1.5px !important;
}

.coin-radar-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
}

.coin-radar-card.is-selected {
  border-width: 2px !important;
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.35), 0 8px 24px rgba(14, 165, 233, 0.2);
  background: linear-gradient(180deg, rgba(30, 41, 59, 0.95) 0%, rgba(15, 23, 42, 0.95) 100%) !important;
}

.radar-checklist {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 5px;
  margin: 8px 0;
  padding: 7px 8px;
  border-radius: 8px;
  background: rgba(6, 9, 17, 0.65);
  border: 1px solid rgba(148, 163, 184, 0.14);
  font-size: 11px;
}

.radar-check-item {
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.radar-thai-box {
  padding: 7px 9px;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.85);
  border-left: 3px solid #38bdf8;
  font-size: 11.5px;
  color: #e2e8f0;
  line-height: 1.4;
  margin-top: 4px;
}

.zone3-coin-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.zone3-coin-btn {
  cursor: pointer;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(148, 163, 184, 0.25);
  color: #cbd5e1;
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 700;
  font-family: inherit;
  transition: all 0.18s ease;
}

.zone3-coin-btn:hover {
  border-color: #38bdf8;
  color: #fff;
}

.zone3-coin-btn.active {
  background: linear-gradient(90deg, #0284c7, #2563eb);
  border-color: #38bdf8;
  color: #ffffff;
  box-shadow: 0 2px 10px rgba(2, 132, 199, 0.35);
}

.leaderboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.leaderboard-card {
  cursor: pointer;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.92) 0%, rgba(11, 16, 30, 0.92) 100%);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 12px;
  padding: 14px 16px;
  transition: all 0.2s ease;
}

.leaderboard-card:hover {
  transform: translateY(-2px);
  border-color: rgba(56, 189, 248, 0.5);
}

.leaderboard-card.rank-1 {
  border-color: rgba(251, 191, 36, 0.55);
  background: linear-gradient(180deg, rgba(251, 191, 36, 0.08) 0%, rgba(15, 23, 42, 0.92) 100%);
}

.filter-bar-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 14px;
  background: rgba(6, 9, 17, 0.55);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  margin-bottom: 12px;
}

.filter-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  min-width: 125px;
}

.filter-pill-btn {
  cursor: pointer;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(148, 163, 184, 0.22);
  color: #cbd5e1;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  font-family: inherit;
  transition: all 0.15s ease;
}

.filter-pill-btn:hover {
  border-color: #38bdf8;
  color: #fff;
}

.filter-pill-btn.active {
  background: rgba(56, 189, 248, 0.2);
  border-color: #38bdf8;
  color: #38bdf8;
  font-weight: 700;
}

.coin-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 700;
}

.coin-badge.coin-BTC { background: rgba(245, 158, 11, 0.18); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.35); }
.coin-badge.coin-ETH { background: rgba(56, 189, 248, 0.18); color: #38bdf8; border: 1px solid rgba(56, 189, 248, 0.35); }
.coin-badge.coin-SOL { background: rgba(168, 85, 247, 0.18); color: #c084fc; border: 1px solid rgba(168, 85, 247, 0.35); }
.coin-badge.coin-OKB { background: rgba(16, 185, 129, 0.18); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.35); }

